]> matita.cs.unibo.it Git - helm.git/commitdiff
experimental branch with no set baseuri command and no developments
authorEnrico Tassi <enrico.tassi@inria.fr>
Fri, 4 Jan 2008 09:38:09 +0000 (09:38 +0000)
committerEnrico Tassi <enrico.tassi@inria.fr>
Fri, 4 Jan 2008 09:38:09 +0000 (09:38 +0000)
1716 files changed:
Makefile [new file with mode: 0644]
Makefile.defs.in [new file with mode: 0644]
components/METAS/meta.helm-acic_content.src [new file with mode: 0644]
components/METAS/meta.helm-acic_procedural.src [new file with mode: 0644]
components/METAS/meta.helm-cic.src [new file with mode: 0644]
components/METAS/meta.helm-cic_acic.src [new file with mode: 0644]
components/METAS/meta.helm-cic_disambiguation.src [new file with mode: 0644]
components/METAS/meta.helm-cic_exportation.src [new file with mode: 0644]
components/METAS/meta.helm-cic_proof_checking.src [new file with mode: 0644]
components/METAS/meta.helm-cic_unification.src [new file with mode: 0644]
components/METAS/meta.helm-content_pres.src [new file with mode: 0644]
components/METAS/meta.helm-extlib.src [new file with mode: 0644]
components/METAS/meta.helm-getter.src [new file with mode: 0644]
components/METAS/meta.helm-grafite.src [new file with mode: 0644]
components/METAS/meta.helm-grafite_engine.src [new file with mode: 0644]
components/METAS/meta.helm-grafite_parser.src [new file with mode: 0644]
components/METAS/meta.helm-hgdome.src [new file with mode: 0644]
components/METAS/meta.helm-hmysql.src [new file with mode: 0644]
components/METAS/meta.helm-lexicon.src [new file with mode: 0644]
components/METAS/meta.helm-library.src [new file with mode: 0644]
components/METAS/meta.helm-logger.src [new file with mode: 0644]
components/METAS/meta.helm-metadata.src [new file with mode: 0644]
components/METAS/meta.helm-registry.src [new file with mode: 0644]
components/METAS/meta.helm-syntax_extensions.src [new file with mode: 0644]
components/METAS/meta.helm-tactics.src [new file with mode: 0644]
components/METAS/meta.helm-thread.src [new file with mode: 0644]
components/METAS/meta.helm-tptp_grafite.src [new file with mode: 0644]
components/METAS/meta.helm-urimanager.src [new file with mode: 0644]
components/METAS/meta.helm-whelp.src [new file with mode: 0644]
components/METAS/meta.helm-xml.src [new file with mode: 0644]
components/METAS/meta.helm-xmldiff.src [new file with mode: 0644]
components/Makefile [new file with mode: 0644]
components/Makefile.common [new file with mode: 0644]
components/STATS/clusters.dot [new file with mode: 0644]
components/STATS/daemons.dot [new file with mode: 0644]
components/STATS/deps.patch [new file with mode: 0644]
components/STATS/patch_deps.sh [new file with mode: 0755]
components/acic_content/.depend [new file with mode: 0644]
components/acic_content/.depend.opt [new file with mode: 0644]
components/acic_content/Makefile [new file with mode: 0644]
components/acic_content/acic2astMatcher.ml [new file with mode: 0644]
components/acic_content/acic2astMatcher.mli [new file with mode: 0644]
components/acic_content/acic2content.ml [new file with mode: 0644]
components/acic_content/acic2content.mli [new file with mode: 0644]
components/acic_content/cicNotationEnv.ml [new file with mode: 0644]
components/acic_content/cicNotationEnv.mli [new file with mode: 0644]
components/acic_content/cicNotationPp.ml [new file with mode: 0644]
components/acic_content/cicNotationPp.mli [new file with mode: 0644]
components/acic_content/cicNotationPt.ml [new file with mode: 0644]
components/acic_content/cicNotationUtil.ml [new file with mode: 0644]
components/acic_content/cicNotationUtil.mli [new file with mode: 0644]
components/acic_content/content.ml [new file with mode: 0644]
components/acic_content/content.mli [new file with mode: 0644]
components/acic_content/content2cic.ml [new file with mode: 0644]
components/acic_content/content2cic.mli [new file with mode: 0644]
components/acic_content/termAcicContent.ml [new file with mode: 0644]
components/acic_content/termAcicContent.mli [new file with mode: 0644]
components/acic_procedural/.depend [new file with mode: 0644]
components/acic_procedural/.depend.opt [new file with mode: 0644]
components/acic_procedural/Makefile [new file with mode: 0644]
components/acic_procedural/acic2Procedural.ml [new file with mode: 0644]
components/acic_procedural/acic2Procedural.mli [new file with mode: 0644]
components/acic_procedural/proceduralClassify.ml [new file with mode: 0644]
components/acic_procedural/proceduralClassify.mli [new file with mode: 0644]
components/acic_procedural/proceduralConversion.ml [new file with mode: 0644]
components/acic_procedural/proceduralConversion.mli [new file with mode: 0644]
components/acic_procedural/proceduralHelpers.ml [new file with mode: 0644]
components/acic_procedural/proceduralHelpers.mli [new file with mode: 0644]
components/acic_procedural/proceduralMode.ml [new file with mode: 0644]
components/acic_procedural/proceduralMode.mli [new file with mode: 0644]
components/acic_procedural/proceduralOptimizer.ml [new file with mode: 0644]
components/acic_procedural/proceduralOptimizer.mli [new file with mode: 0644]
components/acic_procedural/proceduralTypes.ml [new file with mode: 0644]
components/acic_procedural/proceduralTypes.mli [new file with mode: 0644]
components/binaries/Makefile [new file with mode: 0644]
components/binaries/dump_db/dump.sh [new file with mode: 0755]
components/binaries/extractor/.depend [new file with mode: 0644]
components/binaries/extractor/.depend.opt [new file with mode: 0644]
components/binaries/extractor/Makefile [new file with mode: 0644]
components/binaries/extractor/extractor.conf.xml [new file with mode: 0644]
components/binaries/extractor/extractor.ml [new file with mode: 0644]
components/binaries/extractor/extractor_manager.ml [new file with mode: 0644]
components/binaries/heights/.depend [new file with mode: 0644]
components/binaries/heights/.depend.opt [new file with mode: 0644]
components/binaries/heights/Makefile [new file with mode: 0644]
components/binaries/heights/heights.conf.xml [new file with mode: 0644]
components/binaries/heights/heights.ml [new file with mode: 0644]
components/binaries/saturate/Makefile [new file with mode: 0644]
components/binaries/saturate/saturate_main.ml [new file with mode: 0644]
components/binaries/table_creator/.depend [new file with mode: 0644]
components/binaries/table_creator/.depend.opt [new file with mode: 0644]
components/binaries/table_creator/Makefile [new file with mode: 0644]
components/binaries/table_creator/sync_db.sh [new file with mode: 0755]
components/binaries/table_creator/table_creator.ml [new file with mode: 0644]
components/binaries/transcript/.depend [new file with mode: 0644]
components/binaries/transcript/.depend.opt [new file with mode: 0644]
components/binaries/transcript/CoRN.conf.xml [new file with mode: 0644]
components/binaries/transcript/Makefile [new file with mode: 0644]
components/binaries/transcript/engine.ml [new file with mode: 0644]
components/binaries/transcript/engine.mli [new file with mode: 0644]
components/binaries/transcript/grafite.ml [new file with mode: 0644]
components/binaries/transcript/grafite.mli [new file with mode: 0644]
components/binaries/transcript/top.ml [new file with mode: 0644]
components/binaries/transcript/transcript.conf.xml [new file with mode: 0644]
components/binaries/transcript/types.ml [new file with mode: 0644]
components/binaries/transcript/v8Lexer.mll [new file with mode: 0644]
components/binaries/transcript/v8Parser.mly [new file with mode: 0644]
components/binaries/utilities/.depend [new file with mode: 0644]
components/binaries/utilities/.depend.opt [new file with mode: 0644]
components/binaries/utilities/Makefile [new file with mode: 0644]
components/binaries/utilities/create_environment.ml [new file with mode: 0644]
components/binaries/utilities/list_uris.ml [new file with mode: 0644]
components/binaries/utilities/parse_library.ml [new file with mode: 0644]
components/binaries/utilities/test_library.ml [new file with mode: 0644]
components/binaries/utilities/test_xml_parser.ml [new file with mode: 0644]
components/cic/.depend [new file with mode: 0644]
components/cic/.depend.opt [new file with mode: 0644]
components/cic/Makefile [new file with mode: 0644]
components/cic/cic.ml [new file with mode: 0644]
components/cic/cicInspect.ml [new file with mode: 0644]
components/cic/cicInspect.mli [new file with mode: 0644]
components/cic/cicParser.ml [new file with mode: 0644]
components/cic/cicParser.mli [new file with mode: 0644]
components/cic/cicUniv.ml [new file with mode: 0644]
components/cic/cicUniv.mli [new file with mode: 0644]
components/cic/cicUtil.ml [new file with mode: 0644]
components/cic/cicUtil.mli [new file with mode: 0644]
components/cic/deannotate.ml [new file with mode: 0644]
components/cic/deannotate.mli [new file with mode: 0644]
components/cic/discrimination_tree.ml [new file with mode: 0644]
components/cic/discrimination_tree.mli [new file with mode: 0644]
components/cic/helmLibraryObjects.ml [new file with mode: 0644]
components/cic/helmLibraryObjects.mli [new file with mode: 0644]
components/cic/libraryObjects.ml [new file with mode: 0644]
components/cic/libraryObjects.mli [new file with mode: 0644]
components/cic/path_indexing.ml [new file with mode: 0644]
components/cic/path_indexing.mli [new file with mode: 0644]
components/cic/unshare.ml [new file with mode: 0644]
components/cic/unshare.mli [new file with mode: 0644]
components/cic_acic/.depend [new file with mode: 0644]
components/cic_acic/.depend.opt [new file with mode: 0644]
components/cic_acic/Makefile [new file with mode: 0644]
components/cic_acic/cic2Xml.ml [new file with mode: 0644]
components/cic_acic/cic2Xml.mli [new file with mode: 0644]
components/cic_acic/cic2acic.ml [new file with mode: 0644]
components/cic_acic/cic2acic.mli [new file with mode: 0644]
components/cic_acic/doubleTypeInference.ml [new file with mode: 0644]
components/cic_acic/doubleTypeInference.mli [new file with mode: 0644]
components/cic_acic/eta_fixing.ml [new file with mode: 0644]
components/cic_acic/eta_fixing.mli [new file with mode: 0644]
components/cic_disambiguation/.depend [new file with mode: 0644]
components/cic_disambiguation/.depend.opt [new file with mode: 0644]
components/cic_disambiguation/Makefile [new file with mode: 0644]
components/cic_disambiguation/disambiguate.crit2.ml [new file with mode: 0644]
components/cic_disambiguation/disambiguate.crit4.ml [new file with mode: 0644]
components/cic_disambiguation/disambiguate.ml [new file with mode: 0644]
components/cic_disambiguation/disambiguate.mli [new file with mode: 0644]
components/cic_disambiguation/disambiguateChoices.ml [new file with mode: 0644]
components/cic_disambiguation/disambiguateChoices.mli [new file with mode: 0644]
components/cic_disambiguation/disambiguateTypes.ml [new file with mode: 0644]
components/cic_disambiguation/disambiguateTypes.mli [new file with mode: 0644]
components/cic_disambiguation/doc/precedence.txt [new file with mode: 0644]
components/cic_disambiguation/number_notation.ml [new file with mode: 0644]
components/cic_disambiguation/tests/aliases.txt [new file with mode: 0644]
components/cic_disambiguation/tests/eq.txt [new file with mode: 0644]
components/cic_disambiguation/tests/match.txt [new file with mode: 0644]
components/cic_exportation/.depend [new file with mode: 0644]
components/cic_exportation/.depend.opt [new file with mode: 0644]
components/cic_exportation/Makefile [new file with mode: 0644]
components/cic_exportation/cicExportation.ml [new file with mode: 0644]
components/cic_exportation/cicExportation.mli [new file with mode: 0644]
components/cic_proof_checking/.depend [new file with mode: 0644]
components/cic_proof_checking/.depend.opt [new file with mode: 0644]
components/cic_proof_checking/Makefile [new file with mode: 0644]
components/cic_proof_checking/cicEnvironment.ml [new file with mode: 0644]
components/cic_proof_checking/cicEnvironment.mli [new file with mode: 0644]
components/cic_proof_checking/cicLogger.ml [new file with mode: 0644]
components/cic_proof_checking/cicLogger.mli [new file with mode: 0644]
components/cic_proof_checking/cicMiniReduction.ml [new file with mode: 0644]
components/cic_proof_checking/cicMiniReduction.mli [new file with mode: 0644]
components/cic_proof_checking/cicPp.ml [new file with mode: 0644]
components/cic_proof_checking/cicPp.mli [new file with mode: 0644]
components/cic_proof_checking/cicReduction.ml [new file with mode: 0644]
components/cic_proof_checking/cicReduction.mli [new file with mode: 0644]
components/cic_proof_checking/cicSubstitution.ml [new file with mode: 0644]
components/cic_proof_checking/cicSubstitution.mli [new file with mode: 0644]
components/cic_proof_checking/cicTypeChecker.ml [new file with mode: 0644]
components/cic_proof_checking/cicTypeChecker.mli [new file with mode: 0644]
components/cic_proof_checking/cicUnivUtils.ml [new file with mode: 0644]
components/cic_proof_checking/cicUnivUtils.mli [new file with mode: 0644]
components/cic_proof_checking/doc/inductive.txt [new file with mode: 0644]
components/cic_proof_checking/freshNamesGenerator.ml [new file with mode: 0755]
components/cic_proof_checking/freshNamesGenerator.mli [new file with mode: 0644]
components/cic_unification/.depend [new file with mode: 0644]
components/cic_unification/.depend.opt [new file with mode: 0644]
components/cic_unification/Makefile [new file with mode: 0644]
components/cic_unification/cicMetaSubst.ml [new file with mode: 0644]
components/cic_unification/cicMetaSubst.mli [new file with mode: 0644]
components/cic_unification/cicMkImplicit.ml [new file with mode: 0644]
components/cic_unification/cicMkImplicit.mli [new file with mode: 0644]
components/cic_unification/cicRefine.ml [new file with mode: 0644]
components/cic_unification/cicRefine.mli [new file with mode: 0644]
components/cic_unification/cicReplace.ml [new file with mode: 0644]
components/cic_unification/cicReplace.mli [new file with mode: 0644]
components/cic_unification/cicUnification.ml [new file with mode: 0644]
components/cic_unification/cicUnification.mli [new file with mode: 0644]
components/cic_unification/coercGraph.ml [new file with mode: 0644]
components/cic_unification/coercGraph.mli [new file with mode: 0644]
components/cic_unification/termUtil.ml [new file with mode: 0644]
components/cic_unification/termUtil.mli [new file with mode: 0644]
components/content_pres/.depend [new file with mode: 0644]
components/content_pres/.depend.opt [new file with mode: 0644]
components/content_pres/Makefile [new file with mode: 0644]
components/content_pres/box.ml [new file with mode: 0644]
components/content_pres/box.mli [new file with mode: 0644]
components/content_pres/boxPp.ml [new file with mode: 0644]
components/content_pres/boxPp.mli [new file with mode: 0644]
components/content_pres/cicNotationLexer.ml [new file with mode: 0644]
components/content_pres/cicNotationLexer.mli [new file with mode: 0644]
components/content_pres/cicNotationParser.ml [new file with mode: 0644]
components/content_pres/cicNotationParser.mli [new file with mode: 0644]
components/content_pres/cicNotationPres.ml [new file with mode: 0644]
components/content_pres/cicNotationPres.mli [new file with mode: 0644]
components/content_pres/content2pres.ml [new file with mode: 0644]
components/content_pres/content2pres.mli [new file with mode: 0644]
components/content_pres/content2presMatcher.ml [new file with mode: 0644]
components/content_pres/content2presMatcher.mli [new file with mode: 0644]
components/content_pres/mpresentation.ml [new file with mode: 0644]
components/content_pres/mpresentation.mli [new file with mode: 0644]
components/content_pres/renderingAttrs.ml [new file with mode: 0644]
components/content_pres/renderingAttrs.mli [new file with mode: 0644]
components/content_pres/sequent2pres.ml [new file with mode: 0644]
components/content_pres/sequent2pres.mli [new file with mode: 0644]
components/content_pres/termContentPres.ml [new file with mode: 0644]
components/content_pres/termContentPres.mli [new file with mode: 0644]
components/content_pres/test_lexer.ml [new file with mode: 0644]
components/extlib/.depend [new file with mode: 0644]
components/extlib/.depend.opt [new file with mode: 0644]
components/extlib/Makefile [new file with mode: 0644]
components/extlib/componentsConf.ml.in [new file with mode: 0644]
components/extlib/componentsConf.mli [new file with mode: 0644]
components/extlib/graphvizPp.ml [new file with mode: 0644]
components/extlib/graphvizPp.mli [new file with mode: 0644]
components/extlib/hExtlib.ml [new file with mode: 0644]
components/extlib/hExtlib.mli [new file with mode: 0644]
components/extlib/hLog.ml [new file with mode: 0644]
components/extlib/hLog.mli [new file with mode: 0644]
components/extlib/hMarshal.ml [new file with mode: 0644]
components/extlib/hMarshal.mli [new file with mode: 0644]
components/extlib/hTopoSort.ml [new file with mode: 0644]
components/extlib/hTopoSort.mli [new file with mode: 0644]
components/extlib/patternMatcher.ml [new file with mode: 0644]
components/extlib/patternMatcher.mli [new file with mode: 0644]
components/extlib/refCounter.ml [new file with mode: 0644]
components/extlib/refCounter.mli [new file with mode: 0644]
components/extlib/trie.ml [new file with mode: 0644]
components/extlib/trie.mli [new file with mode: 0644]
components/getter/.depend [new file with mode: 0644]
components/getter/.depend.opt [new file with mode: 0644]
components/getter/.ocamlinit [new file with mode: 0644]
components/getter/Makefile [new file with mode: 0644]
components/getter/http_getter.ml [new file with mode: 0644]
components/getter/http_getter.mli [new file with mode: 0644]
components/getter/http_getter_common.ml [new file with mode: 0644]
components/getter/http_getter_common.mli [new file with mode: 0644]
components/getter/http_getter_const.ml [new file with mode: 0644]
components/getter/http_getter_const.mli [new file with mode: 0644]
components/getter/http_getter_env.ml [new file with mode: 0644]
components/getter/http_getter_env.mli [new file with mode: 0644]
components/getter/http_getter_logger.ml [new file with mode: 0644]
components/getter/http_getter_logger.mli [new file with mode: 0644]
components/getter/http_getter_misc.ml [new file with mode: 0644]
components/getter/http_getter_misc.mli [new file with mode: 0644]
components/getter/http_getter_storage.ml [new file with mode: 0644]
components/getter/http_getter_storage.mli [new file with mode: 0644]
components/getter/http_getter_types.ml [new file with mode: 0644]
components/getter/http_getter_wget.ml [new file with mode: 0644]
components/getter/http_getter_wget.mli [new file with mode: 0644]
components/getter/mkindexes.pl [new file with mode: 0755]
components/getter/sample.conf.xml [new file with mode: 0644]
components/getter/test.ml [new file with mode: 0644]
components/grafite/.depend [new file with mode: 0644]
components/grafite/.depend.opt [new file with mode: 0644]
components/grafite/Makefile [new file with mode: 0644]
components/grafite/grafiteAst.ml [new file with mode: 0644]
components/grafite/grafiteAstPp.ml [new file with mode: 0644]
components/grafite/grafiteAstPp.mli [new file with mode: 0644]
components/grafite/grafiteMarshal.ml [new file with mode: 0644]
components/grafite/grafiteMarshal.mli [new file with mode: 0644]
components/grafite_engine/.depend [new file with mode: 0644]
components/grafite_engine/.depend.opt [new file with mode: 0644]
components/grafite_engine/Makefile [new file with mode: 0644]
components/grafite_engine/grafiteEngine.ml [new file with mode: 0644]
components/grafite_engine/grafiteEngine.mli [new file with mode: 0644]
components/grafite_engine/grafiteSync.ml [new file with mode: 0644]
components/grafite_engine/grafiteSync.mli [new file with mode: 0644]
components/grafite_engine/grafiteTypes.ml [new file with mode: 0644]
components/grafite_engine/grafiteTypes.mli [new file with mode: 0644]
components/grafite_parser/.depend [new file with mode: 0644]
components/grafite_parser/.depend.opt [new file with mode: 0644]
components/grafite_parser/Makefile [new file with mode: 0644]
components/grafite_parser/cicNotation2.ml [new file with mode: 0644]
components/grafite_parser/cicNotation2.mli [new file with mode: 0644]
components/grafite_parser/dependenciesParser.ml [new file with mode: 0644]
components/grafite_parser/dependenciesParser.mli [new file with mode: 0644]
components/grafite_parser/grafiteDisambiguate.ml [new file with mode: 0644]
components/grafite_parser/grafiteDisambiguate.mli [new file with mode: 0644]
components/grafite_parser/grafiteDisambiguator.ml [new file with mode: 0644]
components/grafite_parser/grafiteDisambiguator.mli [new file with mode: 0644]
components/grafite_parser/grafiteParser.ml [new file with mode: 0644]
components/grafite_parser/grafiteParser.mli [new file with mode: 0644]
components/grafite_parser/grafiteWalker.ml [new file with mode: 0644]
components/grafite_parser/grafiteWalker.mli [new file with mode: 0644]
components/grafite_parser/print_grammar.ml [new file with mode: 0644]
components/grafite_parser/test_dep.ml [new file with mode: 0644]
components/grafite_parser/test_parser.ml [new file with mode: 0644]
components/hbugs/.depend [new file with mode: 0644]
components/hbugs/Makefile [new file with mode: 0644]
components/hbugs/broker.ml [new file with mode: 0644]
components/hbugs/client.ml [new file with mode: 0644]
components/hbugs/data/hbugs_tutor.TPL.ml [new file with mode: 0644]
components/hbugs/data/tutors_index.xml [new file with mode: 0644]
components/hbugs/doc/hbugs.dia [new file with mode: 0644]
components/hbugs/hbugs_broker_registry.ml [new file with mode: 0644]
components/hbugs/hbugs_broker_registry.mli [new file with mode: 0644]
components/hbugs/hbugs_client.ml [new file with mode: 0644]
components/hbugs/hbugs_client.mli [new file with mode: 0644]
components/hbugs/hbugs_client_gui.glade [new file with mode: 0644]
components/hbugs/hbugs_common.ml [new file with mode: 0644]
components/hbugs/hbugs_common.mli [new file with mode: 0644]
components/hbugs/hbugs_id_generator.ml [new file with mode: 0644]
components/hbugs/hbugs_id_generator.mli [new file with mode: 0644]
components/hbugs/hbugs_messages.ml [new file with mode: 0644]
components/hbugs/hbugs_messages.mli [new file with mode: 0644]
components/hbugs/hbugs_misc.ml [new file with mode: 0644]
components/hbugs/hbugs_misc.mli [new file with mode: 0644]
components/hbugs/hbugs_tutors.ml [new file with mode: 0644]
components/hbugs/hbugs_tutors.mli [new file with mode: 0644]
components/hbugs/hbugs_types.mli [new file with mode: 0644]
components/hbugs/scripts/brokerctl.sh [new file with mode: 0755]
components/hbugs/scripts/build_tutors.ml [new file with mode: 0755]
components/hbugs/scripts/ls_tutors.ml [new file with mode: 0755]
components/hbugs/scripts/sabba.sh [new file with mode: 0755]
components/hbugs/search_pattern_apply_tutor.ml [new file with mode: 0644]
components/hbugs/test/HBUGS_MESSAGES.xml [new file with mode: 0644]
components/hbugs/test/Makefile [new file with mode: 0644]
components/hbugs/test/test_serialization.ml [new file with mode: 0644]
components/hgdome/.depend [new file with mode: 0644]
components/hgdome/.depend.opt [new file with mode: 0644]
components/hgdome/Makefile [new file with mode: 0644]
components/hgdome/domMisc.ml [new file with mode: 0644]
components/hgdome/domMisc.mli [new file with mode: 0644]
components/hgdome/xml2Gdome.ml [new file with mode: 0644]
components/hgdome/xml2Gdome.mli [new file with mode: 0644]
components/hmysql/.depend [new file with mode: 0644]
components/hmysql/.depend.opt [new file with mode: 0644]
components/hmysql/Makefile [new file with mode: 0644]
components/hmysql/hMysql.ml [new file with mode: 0644]
components/hmysql/hSql.ml [new file with mode: 0644]
components/hmysql/hSql.mli [new file with mode: 0644]
components/hmysql/hSqlite3.ml [new file with mode: 0644]
components/lexicon/.depend [new file with mode: 0644]
components/lexicon/.depend.opt [new file with mode: 0644]
components/lexicon/Makefile [new file with mode: 0644]
components/lexicon/cicNotation.ml [new file with mode: 0644]
components/lexicon/cicNotation.mli [new file with mode: 0644]
components/lexicon/disambiguatePp.ml [new file with mode: 0644]
components/lexicon/disambiguatePp.mli [new file with mode: 0644]
components/lexicon/lexiconAst.ml [new file with mode: 0644]
components/lexicon/lexiconAstPp.ml [new file with mode: 0644]
components/lexicon/lexiconAstPp.mli [new file with mode: 0644]
components/lexicon/lexiconEngine.ml [new file with mode: 0644]
components/lexicon/lexiconEngine.mli [new file with mode: 0644]
components/lexicon/lexiconMarshal.ml [new file with mode: 0644]
components/lexicon/lexiconMarshal.mli [new file with mode: 0644]
components/lexicon/lexiconSync.ml [new file with mode: 0644]
components/lexicon/lexiconSync.mli [new file with mode: 0644]
components/library/.depend [new file with mode: 0644]
components/library/.depend.opt [new file with mode: 0644]
components/library/Makefile [new file with mode: 0644]
components/library/cicCoercion.ml [new file with mode: 0644]
components/library/cicCoercion.mli [new file with mode: 0644]
components/library/cicElim.ml [new file with mode: 0644]
components/library/cicElim.mli [new file with mode: 0644]
components/library/cicRecord.ml [new file with mode: 0644]
components/library/cicRecord.mli [new file with mode: 0644]
components/library/coercDb.ml [new file with mode: 0644]
components/library/coercDb.mli [new file with mode: 0644]
components/library/libraryClean.ml [new file with mode: 0644]
components/library/libraryClean.mli [new file with mode: 0644]
components/library/libraryDb.ml [new file with mode: 0644]
components/library/libraryDb.mli [new file with mode: 0644]
components/library/libraryMisc.ml [new file with mode: 0644]
components/library/libraryMisc.mli [new file with mode: 0644]
components/library/librarySync.ml [new file with mode: 0644]
components/library/librarySync.mli [new file with mode: 0644]
components/library/refinementTool.ml [new file with mode: 0644]
components/license [new file with mode: 0644]
components/logger/.depend [new file with mode: 0644]
components/logger/.depend.opt [new file with mode: 0644]
components/logger/Makefile [new file with mode: 0644]
components/logger/helmLogger.ml [new file with mode: 0644]
components/logger/helmLogger.mli [new file with mode: 0644]
components/metadata/.depend [new file with mode: 0644]
components/metadata/.depend.opt [new file with mode: 0644]
components/metadata/Makefile [new file with mode: 0644]
components/metadata/metadataConstraints.ml [new file with mode: 0644]
components/metadata/metadataConstraints.mli [new file with mode: 0644]
components/metadata/metadataDb.ml [new file with mode: 0644]
components/metadata/metadataDb.mli [new file with mode: 0644]
components/metadata/metadataDeps.ml [new file with mode: 0644]
components/metadata/metadataDeps.mli [new file with mode: 0644]
components/metadata/metadataExtractor.ml [new file with mode: 0644]
components/metadata/metadataExtractor.mli [new file with mode: 0644]
components/metadata/metadataPp.ml [new file with mode: 0644]
components/metadata/metadataPp.mli [new file with mode: 0644]
components/metadata/metadataTypes.ml [new file with mode: 0644]
components/metadata/metadataTypes.mli [new file with mode: 0644]
components/metadata/sqlStatements.ml [new file with mode: 0644]
components/metadata/sqlStatements.mli [new file with mode: 0644]
components/registry/.depend [new file with mode: 0644]
components/registry/.depend.opt [new file with mode: 0644]
components/registry/.ocamlinit [new file with mode: 0644]
components/registry/Makefile [new file with mode: 0644]
components/registry/helm_registry.ml [new file with mode: 0644]
components/registry/helm_registry.mli [new file with mode: 0644]
components/registry/test.ml [new file with mode: 0644]
components/registry/tests/sample.xml [new file with mode: 0644]
components/registry/tests/sample_include.xml [new file with mode: 0644]
components/syntax_extensions/.depend [new file with mode: 0644]
components/syntax_extensions/.depend.opt [new file with mode: 0644]
components/syntax_extensions/Makefile [new file with mode: 0644]
components/syntax_extensions/README.syntax [new file with mode: 0644]
components/syntax_extensions/data/dictionary-tex.xml [new file with mode: 0644]
components/syntax_extensions/data/entities-table.xml [new file with mode: 0644]
components/syntax_extensions/data/extra-entities.xml [new file with mode: 0644]
components/syntax_extensions/make_table.ml [new file with mode: 0644]
components/syntax_extensions/pa_unicode_macro.ml [new file with mode: 0644]
components/syntax_extensions/profiling_macros.ml [new file with mode: 0644]
components/syntax_extensions/test.ml [new file with mode: 0644]
components/syntax_extensions/utf8Macro.ml [new file with mode: 0644]
components/syntax_extensions/utf8Macro.mli [new file with mode: 0644]
components/syntax_extensions/utf8MacroTable.ml [new file with mode: 0644]
components/syntax_extensions/utf8MacroTable.ml.txt [new file with mode: 0644]
components/tactics/.depend [new file with mode: 0644]
components/tactics/.depend.opt [new file with mode: 0644]
components/tactics/Makefile [new file with mode: 0644]
components/tactics/auto.ml [new file with mode: 0644]
components/tactics/auto.mli [new file with mode: 0644]
components/tactics/autoCache.ml [new file with mode: 0644]
components/tactics/autoCache.mli [new file with mode: 0644]
components/tactics/autoTypes.ml [new file with mode: 0644]
components/tactics/autoTypes.mli [new file with mode: 0644]
components/tactics/closeCoercionGraph.ml [new file with mode: 0644]
components/tactics/closeCoercionGraph.mli [new file with mode: 0644]
components/tactics/compose.ml [new file with mode: 0644]
components/tactics/compose.mli [new file with mode: 0644]
components/tactics/continuationals.ml [new file with mode: 0644]
components/tactics/continuationals.mli [new file with mode: 0644]
components/tactics/declarative.ml [new file with mode: 0644]
components/tactics/declarative.mli [new file with mode: 0644]
components/tactics/destructTactic.ml [new file with mode: 0644]
components/tactics/destructTactic.mli [new file with mode: 0644]
components/tactics/doc/Makefile [new file with mode: 0644]
components/tactics/doc/body.tex [new file with mode: 0644]
components/tactics/doc/infernce.sty [new file with mode: 0644]
components/tactics/doc/ligature.sty [new file with mode: 0644]
components/tactics/doc/main.tex [new file with mode: 0644]
components/tactics/doc/reserved.sty [new file with mode: 0644]
components/tactics/doc/semantic.sty [new file with mode: 0644]
components/tactics/doc/shrthand.sty [new file with mode: 0644]
components/tactics/doc/tdiagram.sty [new file with mode: 0644]
components/tactics/eliminationTactics.ml [new file with mode: 0644]
components/tactics/eliminationTactics.mli [new file with mode: 0644]
components/tactics/equalityTactics.ml [new file with mode: 0644]
components/tactics/equalityTactics.mli [new file with mode: 0644]
components/tactics/fourier.ml [new file with mode: 0644]
components/tactics/fourier.mli [new file with mode: 0644]
components/tactics/fourierR.ml [new file with mode: 0644]
components/tactics/fourierR.mli [new file with mode: 0644]
components/tactics/fwdSimplTactic.ml [new file with mode: 0644]
components/tactics/fwdSimplTactic.mli [new file with mode: 0644]
components/tactics/hashtbl_equiv.ml [new file with mode: 0644]
components/tactics/hashtbl_equiv.mli [new file with mode: 0644]
components/tactics/history.ml [new file with mode: 0644]
components/tactics/history.mli [new file with mode: 0644]
components/tactics/introductionTactics.ml [new file with mode: 0644]
components/tactics/introductionTactics.mli [new file with mode: 0644]
components/tactics/inversion.ml [new file with mode: 0644]
components/tactics/inversion.mli [new file with mode: 0644]
components/tactics/inversion_principle.ml [new file with mode: 0644]
components/tactics/inversion_principle.mli [new file with mode: 0644]
components/tactics/metadataQuery.ml [new file with mode: 0644]
components/tactics/metadataQuery.mli [new file with mode: 0644]
components/tactics/negationTactics.ml [new file with mode: 0644]
components/tactics/negationTactics.mli [new file with mode: 0644]
components/tactics/paramodulation/.depend [new file with mode: 0644]
components/tactics/paramodulation/Makefile [new file with mode: 0644]
components/tactics/paramodulation/README [new file with mode: 0644]
components/tactics/paramodulation/equality.ml [new file with mode: 0644]
components/tactics/paramodulation/equality.mli [new file with mode: 0644]
components/tactics/paramodulation/equality_indexing.ml [new file with mode: 0644]
components/tactics/paramodulation/equality_indexing.mli [new file with mode: 0644]
components/tactics/paramodulation/founif.ml [new file with mode: 0644]
components/tactics/paramodulation/founif.mli [new file with mode: 0644]
components/tactics/paramodulation/indexing.ml [new file with mode: 0644]
components/tactics/paramodulation/indexing.mli [new file with mode: 0644]
components/tactics/paramodulation/saturation.ml [new file with mode: 0644]
components/tactics/paramodulation/saturation.mli [new file with mode: 0644]
components/tactics/paramodulation/subst.ml [new file with mode: 0644]
components/tactics/paramodulation/subst.mli [new file with mode: 0644]
components/tactics/paramodulation/test_indexing.ml [new file with mode: 0644]
components/tactics/paramodulation/utils.ml [new file with mode: 0644]
components/tactics/paramodulation/utils.mli [new file with mode: 0644]
components/tactics/primitiveTactics.ml [new file with mode: 0644]
components/tactics/primitiveTactics.mli [new file with mode: 0644]
components/tactics/proofEngineHelpers.ml [new file with mode: 0644]
components/tactics/proofEngineHelpers.mli [new file with mode: 0644]
components/tactics/proofEngineReduction.ml [new file with mode: 0644]
components/tactics/proofEngineReduction.mli [new file with mode: 0644]
components/tactics/proofEngineStructuralRules.ml [new file with mode: 0644]
components/tactics/proofEngineStructuralRules.mli [new file with mode: 0644]
components/tactics/proofEngineTypes.ml [new file with mode: 0644]
components/tactics/proofEngineTypes.mli [new file with mode: 0644]
components/tactics/reductionTactics.ml [new file with mode: 0644]
components/tactics/reductionTactics.mli [new file with mode: 0644]
components/tactics/ring.ml [new file with mode: 0644]
components/tactics/ring.mli [new file with mode: 0644]
components/tactics/setoids.ml [new file with mode: 0644]
components/tactics/setoids.mli [new file with mode: 0644]
components/tactics/statefulProofEngine.ml [new file with mode: 0644]
components/tactics/statefulProofEngine.mli [new file with mode: 0644]
components/tactics/tacticChaser.ml [new file with mode: 0644]
components/tactics/tacticals.ml [new file with mode: 0644]
components/tactics/tacticals.mli [new file with mode: 0644]
components/tactics/tactics.ml [new file with mode: 0644]
components/tactics/tactics.mli [new file with mode: 0644]
components/tactics/universe.ml [new file with mode: 0644]
components/tactics/universe.mli [new file with mode: 0644]
components/tactics/variousTactics.ml [new file with mode: 0644]
components/tactics/variousTactics.mli [new file with mode: 0644]
components/thread/.depend [new file with mode: 0644]
components/thread/.depend.opt [new file with mode: 0644]
components/thread/Makefile [new file with mode: 0644]
components/thread/extThread.ml [new file with mode: 0644]
components/thread/extThread.mli [new file with mode: 0644]
components/thread/fake/threadSafe.ml [new file with mode: 0644]
components/thread/fake/threadSafe.mli [new file with mode: 0644]
components/thread/threadSafe.ml [new file with mode: 0644]
components/thread/threadSafe.mli [new file with mode: 0644]
components/tptp_grafite/.depend [new file with mode: 0644]
components/tptp_grafite/.depend.opt [new file with mode: 0644]
components/tptp_grafite/Makefile [new file with mode: 0644]
components/tptp_grafite/ast.ml [new file with mode: 0644]
components/tptp_grafite/heq_problems [new file with mode: 0644]
components/tptp_grafite/hne_problems [new file with mode: 0644]
components/tptp_grafite/lexer.mll [new file with mode: 0644]
components/tptp_grafite/main.ml [new file with mode: 0644]
components/tptp_grafite/parser.mly [new file with mode: 0644]
components/tptp_grafite/tptp2grafite.ml [new file with mode: 0644]
components/tptp_grafite/tptp2grafite.mli [new file with mode: 0644]
components/tptp_grafite/unit_equality_problems [new file with mode: 0644]
components/urimanager/.depend [new file with mode: 0644]
components/urimanager/.depend.opt [new file with mode: 0644]
components/urimanager/Makefile [new file with mode: 0644]
components/urimanager/uriManager.ml [new file with mode: 0644]
components/urimanager/uriManager.mli [new file with mode: 0644]
components/whelp/.depend [new file with mode: 0644]
components/whelp/.depend.opt [new file with mode: 0644]
components/whelp/Makefile [new file with mode: 0644]
components/whelp/fwdQueries.ml [new file with mode: 0644]
components/whelp/fwdQueries.mli [new file with mode: 0644]
components/whelp/whelp.ml [new file with mode: 0644]
components/whelp/whelp.mli [new file with mode: 0644]
components/xml/.depend [new file with mode: 0644]
components/xml/.depend.opt [new file with mode: 0644]
components/xml/Makefile [new file with mode: 0644]
components/xml/test.ml [new file with mode: 0644]
components/xml/xml.ml [new file with mode: 0644]
components/xml/xml.mli [new file with mode: 0644]
components/xml/xmlPushParser.ml [new file with mode: 0644]
components/xml/xmlPushParser.mli [new file with mode: 0644]
components/xmldiff/.depend [new file with mode: 0644]
components/xmldiff/.depend.opt [new file with mode: 0644]
components/xmldiff/Makefile [new file with mode: 0644]
components/xmldiff/xmlDiff.ml [new file with mode: 0644]
components/xmldiff/xmlDiff.mli [new file with mode: 0644]
configure.ac [new file with mode: 0644]
make/main.ml [new file with mode: 0644]
make/make.ml [new file with mode: 0644]
make/make.mli [new file with mode: 0644]
make/test/a.c [new file with mode: 0644]
make/test/b.c [new file with mode: 0644]
make/test/c.c [new file with mode: 0644]
make/test/d.c [new file with mode: 0644]
make/test/e.c [new file with mode: 0644]
matita/.depend [new file with mode: 0644]
matita/.depend.opt [new file with mode: 0644]
matita/.ocamlinit [new file with mode: 0644]
matita/AUTHORS [new file with mode: 0644]
matita/LICENSE [new file with mode: 0644]
matita/Makefile [new file with mode: 0644]
matita/applyTransformation.ml [new file with mode: 0644]
matita/applyTransformation.mli [new file with mode: 0644]
matita/bench_disamberrors [new file with mode: 0755]
matita/bench_summary.py [new file with mode: 0755]
matita/buildTimeConf.ml.in [new file with mode: 0644]
matita/closed.xml [new file with mode: 0644]
matita/contribs/CoRN-Decl/CoRN.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/Basics.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CAbGroups.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CAbMonoids.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CFields.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CGroups.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CLogic.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CMonoids.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/COrdAbs.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/COrdCauchy.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/COrdFields.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/COrdFields2.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CPoly_ApZero.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CPoly_Degree.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CPoly_NthCoeff.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CPolynomials.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CRings.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CSemiGroups.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CSetoidFun.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CSetoidInc.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CSetoids.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CSums.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/CVectorSpace.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/Cauchy_COF.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/Expon.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/algebra/ListType.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/complex/AbsCC.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/complex/CComplex.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/complex/Complex_Exponential.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/complex/NRootCC.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/devel/loeb/IDA/Ch6.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/devel/loeb/per/csetfun.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/devel/loeb/per/lst2fun.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/fta/CC_Props.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/fta/CPoly_Contin1.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/fta/CPoly_Rev.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/fta/CPoly_Shift.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/fta/FTA.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/fta/FTAreg.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/fta/KeyLemma.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/fta/KneserLemma.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/fta/MainLemma.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/COrdLemmas.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/CalculusTheorems.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/Composition.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/Continuity.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/Derivative.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/DerivativeOps.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/Differentiability.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/FTC.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/FunctSequence.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/FunctSeries.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/FunctSums.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/Integral.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/IntervalFunct.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/MoreFunSeries.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/MoreFunctions.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/MoreIntegrals.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/MoreIntervals.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/NthDerivative.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/PartFunEquality.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/PartInterval.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/Partitions.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/RefLemma.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/RefSepRef.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/RefSeparated.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/RefSeparating.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/Rolle.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/StrongIVT.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/Taylor.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/TaylorLemma.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ftc/WeakIVT.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/makefile [new file with mode: 0644]
matita/contribs/CoRN-Decl/metrics/CMetricSpaces.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/metrics/CPMSTheory.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/metrics/CPseudoMSpaces.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/metrics/ContFunctions.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/metrics/Equiv.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/metrics/IR_CPMSpace.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/metrics/Prod_Sub.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/abgroups/QSposabgroup.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/abgroups/Qabgroup.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/abgroups/Qposabgroup.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/abgroups/Zabgroup.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/fields/Qfield.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/groups/QSposgroup.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/groups/Qgroup.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/groups/Qposgroup.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/groups/Zgroup.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/monoids/Nmonoid.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/monoids/Nposmonoid.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/monoids/QSposmonoid.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/monoids/Qmonoid.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/monoids/Qposmonoid.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/monoids/Zmonoid.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/non_examples/N_no_group.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/non_examples/Npos_no_group.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/non_examples/Npos_no_monoid.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/ordfields/Qordfield.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/reals/Cauchy_IR.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/rings/Qring.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/rings/Zring.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/semigroups/Npossemigroup.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/semigroups/Nsemigroup.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/semigroups/QSpossemigroup.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/semigroups/Qpossemigroup.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/semigroups/Qsemigroup.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/semigroups/Zsemigroup.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/setoids/Npossetoid.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/setoids/Nsetoid.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/setoids/Qpossetoid.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/setoids/Qsetoid.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/setoids/Zsetoid.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/structures/Npossec.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/structures/Nsec.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/structures/Qpossec.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/structures/Qsec.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/model/structures/Zsec.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/ordine_compilazione.txt [new file with mode: 0644]
matita/contribs/CoRN-Decl/preamble.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/Bridges_LUB.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/Bridges_iso.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/CMetricFields.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/CPoly_Contin.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/CReals.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/CReals1.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/CSumsReals.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/CauchySeq.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/Cauchy_CReals.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/IVT.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/Intervals.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/Max_AbsIR.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/NRootIR.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/OddPolyRootIR.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/Q_dense.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/Q_in_CReals.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/R_morphism.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/RealFuncts.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/RealLists.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/Series.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/reals/iso_CReals.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/tactics/AlgReflection.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/tactics/DiffTactics1.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/tactics/DiffTactics2.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/tactics/DiffTactics3.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/tactics/FieldReflection.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/tactics/GroupReflection.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/tactics/Opaque_algebra.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/tactics/RingReflection.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/tactics/Step.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/tactics/Transparent_algebra.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/transc/Exponential.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/transc/InvTrigonom.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/transc/Pi.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/transc/PowerSeries.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/transc/RealPowers.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/transc/SinCos.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/transc/TaylorSeries.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/transc/TrigMon.ma [new file with mode: 0644]
matita/contribs/CoRN-Decl/transc/Trigonometric.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-1/blt/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-1/blt/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-1/definitions.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-1/ext/arith.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-1/ext/tactics.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-1/makefile [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-1/plist/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-1/plist/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-1/preamble.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-1/spare.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-1/theory.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-1/types/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-1/types/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-2/blt/defs.mma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-2/blt/props.mma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-2/depend [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-2/ext/arith.mma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-2/ext/tactics.mma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-2/log.txt [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-2/makefile [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-2/plist/defs.mma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-2/plist/props.mma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-2/preamble.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-2/theory.mma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-2/types/defs.mma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Base-2/types/props.mma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/A/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/C/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/C/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/G/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/T/dec.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/T/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/T/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aplus/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aplus/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aprem/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/aprem/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/aprem.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/cimp.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/lift1.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/pr3.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/arity/subst0.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/asucc/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/asucc/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cimp/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cimp/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/drop.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clear/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clen/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/clen/getl.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cnt/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/cnt/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/arity.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/clear.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/drop.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/getl.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csuba/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/arity.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/clear.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/csuba.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/drop.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/drop1.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/getl.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubc/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/clear.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/drop.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/getl.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst0/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/getl.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubst1/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/clear.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/drop.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/getl.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/pc3.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/csubt/ty3.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/definitions.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop1/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop1/getl.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/drop1/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex0/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex0/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex1/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex1/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex2/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ex2/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/flt/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/flt/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/fsubst0/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/fsubst0/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/clear.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/dec.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/drop.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/flt.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/getl.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/getl/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/iso/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/iso/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/iso/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/asucc.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/leq/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift/tlt.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift1/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift1/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/lift1/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/llt/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/llt/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/makefile [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/next_plus/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/next_plus/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/arity.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/dec.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/iso.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/lift1.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/pr3.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/nf2/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc1/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc1/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/dec.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/fsubst0.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/left.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/nf2.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/pc1.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/subst1.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pc3/wcpr0.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/dec.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/pr0.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr0/subst1.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr1/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr1/pr1.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr1/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/clen.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/pr2.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr2/subst1.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/iso.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/pr1.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/pr3.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/subst1.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/pr3/wcpr0.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/preamble.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/r/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/r/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/s/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/s/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sc3/arity.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sc3/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sc3/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/lift1.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/nf2.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/sn3/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/spare.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/dec.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/subst0.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst0/tlt.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/subst1/subst1.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau0/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau0/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau1/cnt.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau1/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tau1/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/theory.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlist/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlist/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlt/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/tlt/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/arity.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/arity_props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/dec.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/fsubst0.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/nf2.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/pr3.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/pr3_props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/subst1.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/ty3/tau0.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/wcpr0/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/wcpr0/fwd.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/LambdaDelta-1/wcpr0/getl.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Makefile [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/defs.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/fun.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/inv.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Unified-Sub/Lift/props.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Unified-Sub/datatypes/Context.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Unified-Sub/datatypes/Term.ma [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Unified-Sub/makefile [new file with mode: 0644]
matita/contribs/LAMBDA-TYPES/Unified-Sub/preamble.ma [new file with mode: 0644]
matita/contribs/LOGIC/CLE/defs.ma [new file with mode: 0644]
matita/contribs/LOGIC/Insert/defs.ma [new file with mode: 0644]
matita/contribs/LOGIC/Insert/fun.ma [new file with mode: 0644]
matita/contribs/LOGIC/Insert/inv.ma [new file with mode: 0644]
matita/contribs/LOGIC/Insert/props.ma [new file with mode: 0644]
matita/contribs/LOGIC/Lift/defs.ma [new file with mode: 0644]
matita/contribs/LOGIC/NTrack/defs.ma [new file with mode: 0644]
matita/contribs/LOGIC/NTrack/inv.ma [new file with mode: 0644]
matita/contribs/LOGIC/NTrack/order.ma [new file with mode: 0644]
matita/contribs/LOGIC/NTrack/props.ma [new file with mode: 0644]
matita/contribs/LOGIC/PEq/defs.ma [new file with mode: 0644]
matita/contribs/LOGIC/PNF/defs.ma [new file with mode: 0644]
matita/contribs/LOGIC/PRed/defs.ma [new file with mode: 0644]
matita/contribs/LOGIC/PRed/wlt.ma [new file with mode: 0644]
matita/contribs/LOGIC/Track/defs.ma [new file with mode: 0644]
matita/contribs/LOGIC/Track/inv.ma [new file with mode: 0644]
matita/contribs/LOGIC/Track/order.ma [new file with mode: 0644]
matita/contribs/LOGIC/Track/pred.ma [new file with mode: 0644]
matita/contribs/LOGIC/WLT/defs.ma [new file with mode: 0644]
matita/contribs/LOGIC/Weight/defs.ma [new file with mode: 0644]
matita/contribs/LOGIC/datatypes_defs/Context.ma [new file with mode: 0644]
matita/contribs/LOGIC/datatypes_defs/Formula.ma [new file with mode: 0644]
matita/contribs/LOGIC/datatypes_defs/Proof.ma [new file with mode: 0644]
matita/contribs/LOGIC/datatypes_defs/Sequent.ma [new file with mode: 0644]
matita/contribs/LOGIC/datatypes_props/Sequent.ma [new file with mode: 0644]
matita/contribs/LOGIC/makefile [new file with mode: 0644]
matita/contribs/LOGIC/preamble.ma [new file with mode: 0644]
matita/contribs/Makefile [new file with mode: 0644]
matita/contribs/PREDICATIVE-TOPOLOGY/class_defs.ma [new file with mode: 0644]
matita/contribs/PREDICATIVE-TOPOLOGY/class_eq.ma [new file with mode: 0644]
matita/contribs/PREDICATIVE-TOPOLOGY/coa_defs.ma [new file with mode: 0644]
matita/contribs/PREDICATIVE-TOPOLOGY/coa_props.ma [new file with mode: 0644]
matita/contribs/PREDICATIVE-TOPOLOGY/domain_data.ma [new file with mode: 0644]
matita/contribs/PREDICATIVE-TOPOLOGY/domain_defs.ma [new file with mode: 0644]
matita/contribs/PREDICATIVE-TOPOLOGY/iff.ma [new file with mode: 0644]
matita/contribs/PREDICATIVE-TOPOLOGY/makefile [new file with mode: 0644]
matita/contribs/PREDICATIVE-TOPOLOGY/subset_defs.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/NLE/defs.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/NLE/inv.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/NLE/nplus.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/NLE/order.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/NLE/props.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/NPlus/defs.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/NPlus/fun.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/NPlus/inv.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/NPlus/monoid.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/NPlusList/defs.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/NPlusList/props.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/ZEq/defs.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/ZEq/setoid.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/datatypes/Bool.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/datatypes/List.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/datatypes/Nat.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/datatypes/Zah.ma [new file with mode: 0644]
matita/contribs/RELATIONAL/makefile [new file with mode: 0644]
matita/contribs/RELATIONAL/preamble.ma [new file with mode: 0644]
matita/contribs/developments.txt [new file with mode: 0644]
matita/contribs/formal_topology/bin/Makefile [new file with mode: 0644]
matita/contribs/formal_topology/bin/formal_topology.ma [new file with mode: 0644]
matita/contribs/formal_topology/bin/theory_explorer.ml [new file with mode: 0644]
matita/contribs/formal_topology/bin/theory_explorer_do_not_trust_auto.ml [new file with mode: 0644]
matita/contribs/formal_topology/formal_topology.ma [new file with mode: 0644]
matita/contribs/formal_topology/formal_topology2.ma [new file with mode: 0644]
matita/contribs/prova.ma [new file with mode: 0644]
matita/core_notation.moo [new file with mode: 0644]
matita/dama/attic/fields.ma [new file with mode: 0644]
matita/dama/attic/integration_algebras.ma [new file with mode: 0644]
matita/dama/attic/ordered_fields_ch0.ma [new file with mode: 0644]
matita/dama/attic/reals.ma [new file with mode: 0644]
matita/dama/attic/rings.ma [new file with mode: 0644]
matita/dama/attic/vector_spaces.ma [new file with mode: 0644]
matita/dama/classical_pointfree/ordered_sets.ma [new file with mode: 0644]
matita/dama/classical_pointfree/ordered_sets2.ma [new file with mode: 0644]
matita/dama/classical_pointwise/sets.ma [new file with mode: 0644]
matita/dama/classical_pointwise/sigma_algebra.ma [new file with mode: 0644]
matita/dama/classical_pointwise/topology.ma [new file with mode: 0644]
matita/dama/constructive_connectives.ma [new file with mode: 0644]
matita/dama/constructive_higher_order_relations.ma [new file with mode: 0644]
matita/dama/constructive_pointfree/lebesgue.ma [new file with mode: 0644]
matita/dama/divisible_group.ma [new file with mode: 0644]
matita/dama/doc/DIMOSTRAZIONE [new file with mode: 0644]
matita/dama/doc/NotaReticoli.pdf [new file with mode: 0644]
matita/dama/excess.ma [new file with mode: 0644]
matita/dama/group.ma [new file with mode: 0644]
matita/dama/lattice.ma [new file with mode: 0644]
matita/dama/makefile [new file with mode: 0644]
matita/dama/metric_lattice.ma [new file with mode: 0644]
matita/dama/metric_space.ma [new file with mode: 0644]
matita/dama/ordered_divisible_group.ma [new file with mode: 0644]
matita/dama/ordered_group.ma [new file with mode: 0644]
matita/dama/premetric_lattice.ma [new file with mode: 0644]
matita/dama/prevalued_lattice.ma [new file with mode: 0644]
matita/dama/sandwich.ma [new file with mode: 0644]
matita/dama/sequence.ma [new file with mode: 0644]
matita/dama_didactic/bottom.ma [new file with mode: 0644]
matita/dama_didactic/deriv.ma [new file with mode: 0644]
matita/dama_didactic/ex_deriv.ma [new file with mode: 0644]
matita/dama_didactic/ex_seq.ma [new file with mode: 0644]
matita/dama_didactic/makefile [new file with mode: 0644]
matita/dama_didactic/reals.ma [new file with mode: 0644]
matita/dama_didactic/sequences.ma [new file with mode: 0644]
matita/dep2dot.rb [new file with mode: 0755]
matita/dictionary-matita.xml [new file with mode: 0644]
matita/dist/BUGS [new file with mode: 0644]
matita/dist/COPYING [new file with mode: 0644]
matita/dist/ChangeLog [new file with mode: 0644]
matita/dist/INSTALL [new file with mode: 0644]
matita/dist/Makefile [new file with mode: 0644]
matita/dist/README [new file with mode: 0644]
matita/dist/configure.ac.sed [new file with mode: 0644]
matita/dist/fill_db.sh [new file with mode: 0755]
matita/dist/static_link/Makefile [new file with mode: 0644]
matita/dist/static_link/static_link.ml [new file with mode: 0644]
matita/doc/primer.txt [new file with mode: 0644]
matita/dump_moo.ml [new file with mode: 0644]
matita/gragrep.ml [new file with mode: 0644]
matita/gragrep.mli [new file with mode: 0644]
matita/gtkmathview.matita.conf.xml.in [new file with mode: 0644]
matita/help/C/Makefile [new file with mode: 0644]
matita/help/C/TODO [new file with mode: 0644]
matita/help/C/declarative_tactics_quickref.xml [new file with mode: 0644]
matita/help/C/docbook.css [new file with mode: 0644]
matita/help/C/figures/database.dia [new file with mode: 0644]
matita/help/C/figures/database.png [new file with mode: 0644]
matita/help/C/figures/developments.png [new file with mode: 0644]
matita/help/C/legal.xml [new file with mode: 0644]
matita/help/C/matita.xml [new file with mode: 0644]
matita/help/C/sec_commands.xml [new file with mode: 0644]
matita/help/C/sec_declarative_tactics.xml [new file with mode: 0644]
matita/help/C/sec_gettingstarted.xml [new file with mode: 0644]
matita/help/C/sec_install.xml [new file with mode: 0644]
matita/help/C/sec_intro.xml [new file with mode: 0644]
matita/help/C/sec_license.xml [new file with mode: 0644]
matita/help/C/sec_tacticals.xml [new file with mode: 0644]
matita/help/C/sec_tactics.xml [new file with mode: 0644]
matita/help/C/sec_terms.xml [new file with mode: 0644]
matita/help/C/sec_usernotation.xml [new file with mode: 0644]
matita/help/C/tactic_quickref.xml [new file with mode: 0644]
matita/help/C/tactics_quickref.xml [new file with mode: 0644]
matita/help/C/version.txt.in [new file with mode: 0644]
matita/help/C/xhtml1-transitional.dtd [new file with mode: 0644]
matita/help/C/xsl/matita-fo.xsl [new file with mode: 0644]
matita/help/C/xsl/matita-tex.xsl [new file with mode: 0644]
matita/help/C/xsl/matita-xhtml.xsl [new file with mode: 0644]
matita/help/C/xsl/tactic_quickref.xsl [new file with mode: 0644]
matita/icons/matita-32.xpm [new file with mode: 0644]
matita/icons/matita-bulb-high.png [new file with mode: 0644]
matita/icons/matita-bulb-low.png [new file with mode: 0644]
matita/icons/matita-bulb-medium.png [new file with mode: 0644]
matita/icons/matita-folder.png [new file with mode: 0644]
matita/icons/matita-object.png [new file with mode: 0644]
matita/icons/matita-theory.png [new file with mode: 0644]
matita/icons/matita.png [new file with mode: 0644]
matita/icons/matita_medium.png [new file with mode: 0644]
matita/icons/matita_small.png [new file with mode: 0644]
matita/icons/matita_very_small.png [new file with mode: 0644]
matita/icons/meegg.png [new file with mode: 0644]
matita/icons/whelp.png [new file with mode: 0644]
matita/icons/whelp.svg [new file with mode: 0644]
matita/lablGraphviz.ml [new file with mode: 0644]
matita/lablGraphviz.mli [new file with mode: 0644]
matita/legacy/coq.ma [new file with mode: 0644]
matita/legacy/makefile [new file with mode: 0644]
matita/library/Fsub/defn.ma [new file with mode: 0644]
matita/library/Fsub/part1a.ma [new file with mode: 0644]
matita/library/Fsub/part1a_inversion.ma [new file with mode: 0644]
matita/library/Fsub/util.ma [new file with mode: 0644]
matita/library/Q/Qaxioms.ma [new file with mode: 0644]
matita/library/Q/q.ma [new file with mode: 0644]
matita/library/Z/compare.ma [new file with mode: 0644]
matita/library/Z/dirichlet_product.ma [new file with mode: 0644]
matita/library/Z/inversion.ma [new file with mode: 0644]
matita/library/Z/moebius.ma [new file with mode: 0644]
matita/library/Z/orders.ma [new file with mode: 0644]
matita/library/Z/plus.ma [new file with mode: 0644]
matita/library/Z/sigma_p.ma [new file with mode: 0644]
matita/library/Z/times.ma [new file with mode: 0644]
matita/library/Z/z.ma [new file with mode: 0644]
matita/library/algebra/CoRN/SemiGroups.ma [new file with mode: 0644]
matita/library/algebra/CoRN/SetoidFun.ma [new file with mode: 0644]
matita/library/algebra/CoRN/SetoidInc.ma [new file with mode: 0644]
matita/library/algebra/CoRN/Setoids.ma [new file with mode: 0644]
matita/library/algebra/finite_groups.ma [new file with mode: 0644]
matita/library/algebra/groups.ma [new file with mode: 0644]
matita/library/algebra/monoids.ma [new file with mode: 0644]
matita/library/algebra/semigroups.ma [new file with mode: 0644]
matita/library/assembly/byte.ma [new file with mode: 0644]
matita/library/assembly/exadecimal.ma [new file with mode: 0644]
matita/library/assembly/extra.ma [new file with mode: 0644]
matita/library/assembly/test.ma [new file with mode: 0644]
matita/library/assembly/vm.ma [new file with mode: 0644]
matita/library/datatypes/bool.ma [new file with mode: 0644]
matita/library/datatypes/compare.ma [new file with mode: 0644]
matita/library/datatypes/constructors.ma [new file with mode: 0644]
matita/library/decidable_kit/decidable.ma [new file with mode: 0644]
matita/library/decidable_kit/eqtype.ma [new file with mode: 0644]
matita/library/decidable_kit/fgraph.ma [new file with mode: 0644]
matita/library/decidable_kit/fintype.ma [new file with mode: 0644]
matita/library/decidable_kit/list_aux.ma [new file with mode: 0644]
matita/library/decidable_kit/streicher.ma [new file with mode: 0644]
matita/library/demo/power_derivative.ma [new file with mode: 0644]
matita/library/demo/propositional_sequent_calculus.ma [new file with mode: 0644]
matita/library/higher_order_defs/functions.ma [new file with mode: 0644]
matita/library/higher_order_defs/ordering.ma [new file with mode: 0644]
matita/library/higher_order_defs/relations.ma [new file with mode: 0644]
matita/library/library_notation.ma [new file with mode: 0644]
matita/library/list/list.ma [new file with mode: 0644]
matita/library/list/sort.ma [new file with mode: 0644]
matita/library/logic/coimplication.ma [new file with mode: 0644]
matita/library/logic/connectives.ma [new file with mode: 0644]
matita/library/logic/connectives2.ma [new file with mode: 0644]
matita/library/logic/equality.ma [new file with mode: 0644]
matita/library/makefile [new file with mode: 0644]
matita/library/nat/binomial.ma [new file with mode: 0644]
matita/library/nat/chebyshev.ma [new file with mode: 0644]
matita/library/nat/chebyshev_thm.ma [new file with mode: 0644]
matita/library/nat/chinese_reminder.ma [new file with mode: 0644]
matita/library/nat/compare.ma [new file with mode: 0644]
matita/library/nat/congruence.ma [new file with mode: 0644]
matita/library/nat/count.ma [new file with mode: 0644]
matita/library/nat/div_and_mod.ma [new file with mode: 0644]
matita/library/nat/div_and_mod_diseq.ma [new file with mode: 0644]
matita/library/nat/div_and_mod_new.ma.dontcompile [new file with mode: 0644]
matita/library/nat/euler_theorem.ma [new file with mode: 0644]
matita/library/nat/exp.ma [new file with mode: 0644]
matita/library/nat/factorial.ma [new file with mode: 0644]
matita/library/nat/factorial2.ma [new file with mode: 0644]
matita/library/nat/factorization.ma [new file with mode: 0644]
matita/library/nat/fermat_little_theorem.ma [new file with mode: 0644]
matita/library/nat/gcd.ma [new file with mode: 0644]
matita/library/nat/gcd_properties1.ma [new file with mode: 0644]
matita/library/nat/generic_iter_p.ma [new file with mode: 0644]
matita/library/nat/iteration2.ma [new file with mode: 0644]
matita/library/nat/le_arith.ma [new file with mode: 0644]
matita/library/nat/log.ma [new file with mode: 0644]
matita/library/nat/lt_arith.ma [new file with mode: 0644]
matita/library/nat/map_iter_p.ma [new file with mode: 0644]
matita/library/nat/minimization.ma [new file with mode: 0644]
matita/library/nat/minus.ma [new file with mode: 0644]
matita/library/nat/nat.ma [new file with mode: 0644]
matita/library/nat/neper.ma [new file with mode: 0644]
matita/library/nat/nth_prime.ma [new file with mode: 0644]
matita/library/nat/ord.ma [new file with mode: 0644]
matita/library/nat/orders.ma [new file with mode: 0644]
matita/library/nat/permutation.ma [new file with mode: 0644]
matita/library/nat/pi_p.ma [new file with mode: 0644]
matita/library/nat/plus.ma [new file with mode: 0644]
matita/library/nat/primes.ma [new file with mode: 0644]
matita/library/nat/relevant_equations.ma [new file with mode: 0644]
matita/library/nat/sigma_and_pi.ma [new file with mode: 0644]
matita/library/nat/times.ma [new file with mode: 0644]
matita/library/nat/totient.ma [new file with mode: 0644]
matita/library/nat/totient1.ma [new file with mode: 0644]
matita/library/technicalities/setoids.ma [new file with mode: 0644]
matita/library_auto/auto/Q/q.ma [new file with mode: 0644]
matita/library_auto/auto/Z/compare.ma [new file with mode: 0644]
matita/library_auto/auto/Z/orders.ma [new file with mode: 0644]
matita/library_auto/auto/Z/plus.ma [new file with mode: 0644]
matita/library_auto/auto/Z/times.ma [new file with mode: 0644]
matita/library_auto/auto/Z/z.ma [new file with mode: 0644]
matita/library_auto/auto/nat/chinese_reminder.ma [new file with mode: 0644]
matita/library_auto/auto/nat/compare.ma [new file with mode: 0644]
matita/library_auto/auto/nat/congruence.ma [new file with mode: 0644]
matita/library_auto/auto/nat/count.ma [new file with mode: 0644]
matita/library_auto/auto/nat/div_and_mod.ma [new file with mode: 0644]
matita/library_auto/auto/nat/euler_theorem.ma [new file with mode: 0644]
matita/library_auto/auto/nat/exp.ma [new file with mode: 0644]
matita/library_auto/auto/nat/factorial.ma [new file with mode: 0644]
matita/library_auto/auto/nat/factorization.ma [new file with mode: 0644]
matita/library_auto/auto/nat/fermat_little_theorem.ma [new file with mode: 0644]
matita/library_auto/auto/nat/gcd.ma [new file with mode: 0644]
matita/library_auto/auto/nat/le_arith.ma [new file with mode: 0644]
matita/library_auto/auto/nat/lt_arith.ma [new file with mode: 0644]
matita/library_auto/auto/nat/map_iter_p.ma [new file with mode: 0644]
matita/library_auto/auto/nat/minimization.ma [new file with mode: 0644]
matita/library_auto/auto/nat/minus.ma [new file with mode: 0644]
matita/library_auto/auto/nat/nat.ma [new file with mode: 0644]
matita/library_auto/auto/nat/nth_prime.ma [new file with mode: 0644]
matita/library_auto/auto/nat/ord.ma [new file with mode: 0644]
matita/library_auto/auto/nat/orders.ma [new file with mode: 0644]
matita/library_auto/auto/nat/permutation.ma [new file with mode: 0644]
matita/library_auto/auto/nat/plus.ma [new file with mode: 0644]
matita/library_auto/auto/nat/primes.ma [new file with mode: 0644]
matita/library_auto/auto/nat/relevant_equations.ma [new file with mode: 0644]
matita/library_auto/auto/nat/sigma_and_pi.ma [new file with mode: 0644]
matita/library_auto/auto/nat/times.ma [new file with mode: 0644]
matita/library_auto/auto/nat/totient.ma [new file with mode: 0644]
matita/library_auto/makefile [new file with mode: 0644]
matita/matita.conf.xml.in [new file with mode: 0644]
matita/matita.glade [new file with mode: 0644]
matita/matita.gtkrc [new file with mode: 0644]
matita/matita.lang [new file with mode: 0644]
matita/matita.ma.templ [new file with mode: 0644]
matita/matita.ml [new file with mode: 0644]
matita/matita.txt [new file with mode: 0644]
matita/matitaAutoGui.ml [new file with mode: 0644]
matita/matitaAutoGui.mli [new file with mode: 0644]
matita/matitaEngine.ml [new file with mode: 0644]
matita/matitaEngine.mli [new file with mode: 0644]
matita/matitaExcPp.ml [new file with mode: 0644]
matita/matitaExcPp.mli [new file with mode: 0644]
matita/matitaGtkMisc.ml [new file with mode: 0644]
matita/matitaGtkMisc.mli [new file with mode: 0644]
matita/matitaGui.ml [new file with mode: 0644]
matita/matitaGui.mli [new file with mode: 0644]
matita/matitaGuiTypes.mli [new file with mode: 0644]
matita/matitaInit.ml [new file with mode: 0644]
matita/matitaInit.mli [new file with mode: 0644]
matita/matitaMathView.ml [new file with mode: 0644]
matita/matitaMathView.mli [new file with mode: 0644]
matita/matitaMisc.ml [new file with mode: 0644]
matita/matitaMisc.mli [new file with mode: 0644]
matita/matitaScript.ml [new file with mode: 0644]
matita/matitaScript.mli [new file with mode: 0644]
matita/matitaTypes.ml [new file with mode: 0644]
matita/matitaTypes.mli [new file with mode: 0644]
matita/matitaWiki.ml [new file with mode: 0644]
matita/matitac.ml [new file with mode: 0644]
matita/matitacLib.ml [new file with mode: 0644]
matita/matitacLib.mli [new file with mode: 0644]
matita/matitaclean.ml [new file with mode: 0644]
matita/matitaclean.mli [new file with mode: 0644]
matita/matitadep.ml [new file with mode: 0644]
matita/matitadep.mli [new file with mode: 0644]
matita/matitamake.ml [new file with mode: 0644]
matita/matitamake.mli [new file with mode: 0644]
matita/matitamakeLib.ml [new file with mode: 0644]
matita/matitamakeLib.mli [new file with mode: 0644]
matita/matitaprover.ml [new file with mode: 0644]
matita/matitaprover.mli [new file with mode: 0644]
matita/matitatop.ml [new file with mode: 0644]
matita/rottener.ml [new file with mode: 0644]
matita/rottenize_lib [new file with mode: 0755]
matita/scripts/README [new file with mode: 0644]
matita/scripts/bench.sql [new file with mode: 0644]
matita/scripts/clean_db.sh [new file with mode: 0755]
matita/scripts/crontab [new file with mode: 0644]
matita/scripts/crontab.sh [new file with mode: 0644]
matita/scripts/functions.lua [new file with mode: 0755]
matita/scripts/profile_svn.sh [new file with mode: 0755]
matita/scripts/public_html/bench.php [new file with mode: 0644]
matita/scripts/public_html/common.php [new file with mode: 0644]
matita/scripts/public_html/composequery.php [new file with mode: 0644]
matita/scripts/public_html/index.html [new file with mode: 0644]
matita/scripts/public_html/showquery.php [new file with mode: 0644]
matita/scripts/public_html/style.css [new file with mode: 0644]
matita/template_makefile.in [new file with mode: 0644]
matita/template_makefile_devel.in [new file with mode: 0644]
matita/tests/TPTP/README [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO001-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO003-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO003-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO004-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO004-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO005-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO005-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO006-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO006-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO009-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO009-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO010-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO010-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO011-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO011-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO012-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO012-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO013-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO013-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO016-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO017-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO018-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO034-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO069-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO071-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/BOO075-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL004-3.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL007-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL008-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL010-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL012-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL013-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL014-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL015-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL016-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL017-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL018-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL021-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL022-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL024-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL025-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL045-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL048-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL050-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL058-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL058-3.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL060-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL060-3.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL061-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL061-3.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL062-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL062-3.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL063-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL063-3.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL063-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL063-5.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL063-6.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL064-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL064-3.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL064-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL064-5.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL064-6.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL064-7.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL064-8.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL064-9.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL083-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL084-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL085-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/COL086-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP001-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP001-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP010-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP011-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP012-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP022-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP023-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP115-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP116-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP117-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP118-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP136-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP137-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP139-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP141-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP142-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP143-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP144-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP145-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP146-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP149-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP150-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP151-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP152-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP153-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP154-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP155-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP156-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP157-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP158-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP159-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP160-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP161-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP162-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP163-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP168-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP168-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP173-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP174-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP176-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP176-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP182-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP182-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP182-3.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP182-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP186-3.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP186-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP188-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP188-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP189-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP189-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP192-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP206-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP454-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP455-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP456-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP457-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP458-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP459-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP460-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP463-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP467-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP481-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP484-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP485-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP486-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP487-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP488-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP490-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP491-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP492-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP493-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP494-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP495-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP496-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP497-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP498-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP509-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP510-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP511-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP512-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP513-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP514-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP515-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP516-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP517-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP518-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP520-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP541-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP542-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP543-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP544-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP545-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP546-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP547-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP548-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP549-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP550-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP551-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP552-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP556-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP558-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP560-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP561-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP562-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP564-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP565-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP566-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP567-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP568-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP569-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP570-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP572-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP573-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP574-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP576-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP577-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP578-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP580-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP581-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP582-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP583-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP584-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP586-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP588-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP590-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP592-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP595-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP596-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP597-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP598-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP599-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP600-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP602-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP603-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP604-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP605-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP606-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP608-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP612-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP613-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP614-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP615-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/GRP616-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LAT008-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LAT033-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LAT034-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LAT039-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LAT039-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LAT040-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LAT045-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL110-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL112-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL113-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL114-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL115-2.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL132-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL133-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL134-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL135-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL139-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL140-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL141-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL153-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL154-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL155-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL156-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL157-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL158-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL161-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LCL164-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LDA001-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/LDA007-3.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/RNG007-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/RNG008-4.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/RNG011-5.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/RNG023-6.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/RNG023-7.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/RNG024-6.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/RNG024-7.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/ROB002-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/ROB009-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/ROB010-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/ROB013-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/ROB030-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/Veloci/SYN083-1.p.ma [new file with mode: 0644]
matita/tests/TPTP/classify.sh [new file with mode: 0755]
matita/tests/TPTP/compare.ods [new file with mode: 0644]
matita/tests/TPTP/da_indagare_perche_non_astrarre_i_letin_sulle_meta_del_body_spacca_tutto.txt [new file with mode: 0644]
matita/tests/TPTP/elenco_CASC.txt [new file with mode: 0644]
matita/tests/TPTP/elenco_problemi_rating0_ancora_da_risolvere.txt [new file with mode: 0644]
matita/tests/TPTP/elenco_problemi_veloci_per_test.txt [new file with mode: 0644]
matita/tests/TPTP/elenco_unsatisfiable.txt [new file with mode: 0644]
matita/tests/TPTP/fetch_results_tptp.lua [new file with mode: 0755]
matita/tests/TPTP/hne_problems.txt [new file with mode: 0644]
matita/tests/TPTP/log.120.orsay.txt [new file with mode: 0644]
matita/tests/TPTP/log.300.19-6.txt [new file with mode: 0644]
matita/tests/TPTP/log.300.26-5.menvcorti [new file with mode: 0644]
matita/tests/TPTP/log.300.26-5.menvcorti.con_rating [new file with mode: 0644]
matita/tests/TPTP/log.300.27-6.fixprove.fixsimpl-infergoal [new file with mode: 0644]
matita/tests/TPTP/log.300.28-6.fixprove.fixsimpl-infergoal [new file with mode: 0644]
matita/tests/TPTP/log.300.29-5.CASC [new file with mode: 0644]
matita/tests/TPTP/log.300.29-6.fix-demodulationgoalwithcurr [new file with mode: 0644]
matita/tests/TPTP/log.300.30-6.fixdemodgoalinpassive [new file with mode: 0644]
matita/tests/TPTP/log.600.15-7.comedasvn_stampapesomassimoeqinprovanellog.txt [new file with mode: 0644]
matita/tests/TPTP/log.600.22-7.matitaprover.txt [new file with mode: 0644]
matita/tests/TPTP/log.600.30-6.weghtNOTlookingatgoalsymbols [new file with mode: 0644]
matita/tests/TPTP/log.600.30-6.weghtlookingatgoalsymbols.txt [new file with mode: 0644]
matita/tests/TPTP/maxweight.txt [new file with mode: 0644]
matita/tests/TPTP/merge_sorted_logs.awk [new file with mode: 0644]
matita/tests/TPTP/prova_LAT145_rating_93.tar.gz [new file with mode: 0644]
matita/tests/TPTP/risultati_CASC_2005.txt [new file with mode: 0644]
matita/tests/TPTP/simulate_casc.sh [new file with mode: 0755]
matita/tests/TPTP/try.sh [new file with mode: 0755]
matita/tests/TPTP/unit_equality_problems.txt [new file with mode: 0644]
matita/tests/absurd.ma [new file with mode: 0644]
matita/tests/apply.ma [new file with mode: 0644]
matita/tests/apply2.ma [new file with mode: 0644]
matita/tests/applys.ma [new file with mode: 0644]
matita/tests/assumption.ma [new file with mode: 0644]
matita/tests/bad_induction.ma [new file with mode: 0644]
matita/tests/bad_tests/Makefile [new file with mode: 0644]
matita/tests/bad_tests/auto.log [new file with mode: 0644]
matita/tests/bad_tests/auto.ma [new file with mode: 0755]
matita/tests/bad_tests/baseuri.log [new file with mode: 0644]
matita/tests/bad_tests/baseuri.ma [new file with mode: 0644]
matita/tests/bool.ma [new file with mode: 0644]
matita/tests/change.ma [new file with mode: 0644]
matita/tests/clear.ma [new file with mode: 0644]
matita/tests/clearbody.ma [new file with mode: 0644]
matita/tests/coercions.ma [new file with mode: 0644]
matita/tests/coercions_contravariant.ma [new file with mode: 0644]
matita/tests/coercions_dependent.ma [new file with mode: 0644]
matita/tests/coercions_dupelim.ma [new file with mode: 0644]
matita/tests/coercions_nonuniform.ma [new file with mode: 0644]
matita/tests/coercions_open.ma [new file with mode: 0644]
matita/tests/coercions_propagation.ma [new file with mode: 0644]
matita/tests/coercions_russell.ma [new file with mode: 0644]
matita/tests/comments.ma [new file with mode: 0644]
matita/tests/compose.ma [new file with mode: 0644]
matita/tests/constructor.ma [new file with mode: 0644]
matita/tests/continuationals.ma [new file with mode: 0644]
matita/tests/contradiction.ma [new file with mode: 0644]
matita/tests/cut.ma [new file with mode: 0644]
matita/tests/decl.ma [new file with mode: 0644]
matita/tests/decompose.ma [new file with mode: 0644]
matita/tests/demodulation_coq.ma [new file with mode: 0644]
matita/tests/demodulation_matita.ma [new file with mode: 0644]
matita/tests/dependent_injection.ma [new file with mode: 0644]
matita/tests/dependent_type_inference.ma [new file with mode: 0644]
matita/tests/destruct.ma [new file with mode: 0644]
matita/tests/elim.ma [new file with mode: 0644]
matita/tests/fguidi.ma [new file with mode: 0644]
matita/tests/first.ma [new file with mode: 0644]
matita/tests/fix_betareduction.ma [new file with mode: 0644]
matita/tests/fold.ma [new file with mode: 0644]
matita/tests/generalize.ma [new file with mode: 0644]
matita/tests/hard_refine.ma [new file with mode: 0644]
matita/tests/injection.ma [new file with mode: 0644]
matita/tests/interactive/automatic_insertion.ma [new file with mode: 0644]
matita/tests/interactive/drop.ma [new file with mode: 0644]
matita/tests/interactive/grafite.ma [new file with mode: 0644]
matita/tests/interactive/test5.ma [new file with mode: 0644]
matita/tests/interactive/test6.ma [new file with mode: 0644]
matita/tests/interactive/test7.ma [new file with mode: 0644]
matita/tests/interactive/test_instance.ma [new file with mode: 0644]
matita/tests/inversion.ma [new file with mode: 0644]
matita/tests/inversion2.ma [new file with mode: 0644]
matita/tests/letrec.ma [new file with mode: 0644]
matita/tests/letrecand.ma [new file with mode: 0644]
matita/tests/makefile [new file with mode: 0644]
matita/tests/match_inference.ma [new file with mode: 0644]
matita/tests/metasenv_ordering.ma [new file with mode: 0644]
matita/tests/multiple_inheritance.ma [new file with mode: 0644]
matita/tests/mysql_escaping.ma [new file with mode: 0644]
matita/tests/naiveparamod.ma [new file with mode: 0644]
matita/tests/overred.ma [new file with mode: 0644]
matita/tests/paramodulation.ma [new file with mode: 0644]
matita/tests/paramodulation/BOO075-1.ma [new file with mode: 0644]
matita/tests/paramodulation/boolean_algebra.ma [new file with mode: 0644]
matita/tests/paramodulation/group.ma [new file with mode: 0644]
matita/tests/paramodulation/irratsqrt2.ma [new file with mode: 0644]
matita/tests/pullback.ma [new file with mode: 0644]
matita/tests/record.ma [new file with mode: 0644]
matita/tests/replace.ma [new file with mode: 0644]
matita/tests/rewrite.ma [new file with mode: 0644]
matita/tests/second.ma [new file with mode: 0644]
matita/tests/simpl.ma [new file with mode: 0644]
matita/tests/tacticals.ma [new file with mode: 0644]
matita/tests/test2.ma [new file with mode: 0644]
matita/tests/test3.ma [new file with mode: 0644]
matita/tests/test4.ma [new file with mode: 0644]
matita/tests/third.ma [new file with mode: 0644]
matita/tests/tinycals.ma [new file with mode: 0644]
matita/tests/unfold.ma [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..44b87c5
--- /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 (file)
index 0000000..faa0c41
--- /dev/null
@@ -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 (file)
index 0000000..8e10b78
--- /dev/null
@@ -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 (file)
index 0000000..f696bae
--- /dev/null
@@ -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 (file)
index 0000000..525cc9c
--- /dev/null
@@ -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 (file)
index 0000000..51afe1b
--- /dev/null
@@ -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 (file)
index 0000000..d2e467a
--- /dev/null
@@ -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 (file)
index 0000000..f73bbeb
--- /dev/null
@@ -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 (file)
index 0000000..223a182
--- /dev/null
@@ -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 (file)
index 0000000..75e2d4d
--- /dev/null
@@ -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 (file)
index 0000000..976b8f1
--- /dev/null
@@ -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 (file)
index 0000000..2002fcc
--- /dev/null
@@ -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 (file)
index 0000000..8a7badf
--- /dev/null
@@ -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 (file)
index 0000000..0ae4a09
--- /dev/null
@@ -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 (file)
index 0000000..c720372
--- /dev/null
@@ -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 (file)
index 0000000..abf16ca
--- /dev/null
@@ -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 (file)
index 0000000..d06666f
--- /dev/null
@@ -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 (file)
index 0000000..21841b5
--- /dev/null
@@ -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 (file)
index 0000000..741fd60
--- /dev/null
@@ -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 (file)
index 0000000..d4955e0
--- /dev/null
@@ -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 (file)
index 0000000..5b2e8d8
--- /dev/null
@@ -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 (file)
index 0000000..a5b1383
--- /dev/null
@@ -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 (file)
index 0000000..82d3640
--- /dev/null
@@ -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 (file)
index 0000000..f9e210f
--- /dev/null
@@ -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 (file)
index 0000000..5f62068
--- /dev/null
@@ -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 (file)
index 0000000..5253060
--- /dev/null
@@ -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 (file)
index 0000000..4c16756
--- /dev/null
@@ -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 (file)
index 0000000..ff18746
--- /dev/null
@@ -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 (file)
index 0000000..20ea843
--- /dev/null
@@ -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 (file)
index 0000000..626e644
--- /dev/null
@@ -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 (file)
index 0000000..9cc9183
--- /dev/null
@@ -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 (file)
index 0000000..01dabc9
--- /dev/null
@@ -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 (file)
index 0000000..5090dcc
--- /dev/null
@@ -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 (file)
index 0000000..b7298bc
--- /dev/null
@@ -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 (file)
index 0000000..4a8ba38
--- /dev/null
@@ -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 (file)
index 0000000..90130df
--- /dev/null
@@ -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 (executable)
index 0000000..d7dd7b3
--- /dev/null
@@ -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 (file)
index 0000000..8ade458
--- /dev/null
@@ -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 (file)
index 0000000..fef8792
--- /dev/null
@@ -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 (file)
index 0000000..72aa997
--- /dev/null
@@ -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 (file)
index 0000000..d62786c
--- /dev/null
@@ -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 (file)
index 0000000..0a9ec6a
--- /dev/null
@@ -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 (file)
index 0000000..69a1f63
--- /dev/null
@@ -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 <asperti@cs.unibo.it>                    *)
+(*                             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 (file)
index 0000000..32ce688
--- /dev/null
@@ -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 (file)
index 0000000..32d4f0d
--- /dev/null
@@ -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 (file)
index 0000000..d4f8709
--- /dev/null
@@ -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 (file)
index 0000000..4bd2f93
--- /dev/null
@@ -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 "<<pretty printing of mutual definitions not implemented yet>>"
+ | 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 (file)
index 0000000..d883ddf
--- /dev/null
@@ -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 (file)
index 0000000..d9d92ad
--- /dev/null
@@ -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, <pattern,action> 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
+
+  (** <name, inductive/coinductive, type, constructor 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 (file)
index 0000000..99aafa4
--- /dev/null
@@ -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 (file)
index 0000000..2ead321
--- /dev/null
@@ -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 (file)
index 0000000..c8b22f4
--- /dev/null
@@ -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 <asperti@cs.unibo.it>                    *)
+(*                             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 (file)
index 0000000..5460003
--- /dev/null
@@ -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 (file)
index 0000000..dcec61d
--- /dev/null
@@ -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 <asperti@cs.unibo.it>                     *)
+(*                              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 (file)
index 0000000..9bb6509
--- /dev/null
@@ -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 <asperti@cs.unibo.it>                    *)
+(*                             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 (file)
index 0000000..681f3cd
--- /dev/null
@@ -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 <name, type> 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 (file)
index 0000000..def5b0a
--- /dev/null
@@ -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 (file)
index 0000000..f0b67eb
--- /dev/null
@@ -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 (file)
index 0000000..f0b67eb
--- /dev/null
@@ -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 (file)
index 0000000..df39ba8
--- /dev/null
@@ -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 (file)
index 0000000..b4f6053
--- /dev/null
@@ -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 (file)
index 0000000..08e49a3
--- /dev/null
@@ -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 (file)
index 0000000..4c0014d
--- /dev/null
@@ -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 (file)
index 0000000..aea3c6e
--- /dev/null
@@ -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 (file)
index 0000000..376313a
--- /dev/null
@@ -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 (file)
index 0000000..ffc55d4
--- /dev/null
@@ -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 (file)
index 0000000..fb95a6d
--- /dev/null
@@ -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 (file)
index 0000000..c374a18
--- /dev/null
@@ -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 (file)
index 0000000..e13846f
--- /dev/null
@@ -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 (file)
index 0000000..71356b6
--- /dev/null
@@ -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 (file)
index 0000000..1953ae7
--- /dev/null
@@ -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 (file)
index 0000000..45505d7
--- /dev/null
@@ -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 (file)
index 0000000..8a60f96
--- /dev/null
@@ -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 (file)
index 0000000..c493873
--- /dev/null
@@ -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 (file)
index 0000000..cd73251
--- /dev/null
@@ -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 (executable)
index 0000000..e7b4366
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
diff --git a/components/binaries/extractor/.depend.opt b/components/binaries/extractor/.depend.opt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/components/binaries/extractor/Makefile b/components/binaries/extractor/Makefile
new file mode 100644 (file)
index 0000000..512b13e
--- /dev/null
@@ -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 (file)
index 0000000..d82b160
--- /dev/null
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<helm_registry>
+  <section name="tmp">
+    <key name="dir">.tmp/</key>
+  </section>   
+  <section name="db">
+    <key name="metadata">mysql://mowgli.cs.unibo.it mowgli helm helm library</key>
+    <key name="metadata">file:///tmp/ user.db helm helm user</key>
+  </section>
+  <section name="getter">
+    <key name="servers">
+      file:///projects/helm/library/coq_contribs
+    </key>
+    <key name="cache_dir">$(tmp.dir)/cache</key>
+    <key name="maps_dir">$(tmp.dir)/maps</key>
+    <key name="dtd_dir">/projects/helm/xml/dtd</key>
+  </section>
+</helm_registry>
diff --git a/components/binaries/extractor/extractor.ml b/components/binaries/extractor/extractor.ml
new file mode 100644 (file)
index 0000000..981900c
--- /dev/null
@@ -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 (file)
index 0000000..13e9277
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
diff --git a/components/binaries/heights/.depend.opt b/components/binaries/heights/.depend.opt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/components/binaries/heights/Makefile b/components/binaries/heights/Makefile
new file mode 100644 (file)
index 0000000..cd27008
--- /dev/null
@@ -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 (file)
index 0000000..9ecb8b6
--- /dev/null
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<helm_registry>
+  <section name="db">
+    <key name="metadata">mysql://mowgli.cs.unibo.it mowgli helm none legacy</key>
+    <key name="type">legacy</key>
+  </section>
+</helm_registry>
diff --git a/components/binaries/heights/heights.ml b/components/binaries/heights/heights.ml
new file mode 100644 (file)
index 0000000..f77c6cb
--- /dev/null
@@ -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 (file)
index 0000000..ecd8d91
--- /dev/null
@@ -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 (file)
index 0000000..abb23a6
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
diff --git a/components/binaries/table_creator/.depend.opt b/components/binaries/table_creator/.depend.opt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/components/binaries/table_creator/Makefile b/components/binaries/table_creator/Makefile
new file mode 100644 (file)
index 0000000..d588969
--- /dev/null
@@ -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 (executable)
index 0000000..7b20138
--- /dev/null
@@ -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 (file)
index 0000000..c735fe6
--- /dev/null
@@ -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 (file)
index 0000000..5e737a1
--- /dev/null
@@ -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 (file)
index 0000000..61ce486
--- /dev/null
@@ -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 (file)
index 0000000..e904b4d
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<helm_registry>
+  <section name="package">      
+    <key name="input_name">CoRN</key>
+    <key name="output_name">CoRN-Decl</key>
+    <key name="input_base_uri">cic:/CoRN</key>
+    <key name="output_base_uri">cic:/matita/CoRN-Decl</key>
+    <key name="input_path">/projects/helm/exportation/CoRN</key>
+    <key name="output_path">$(transcript.helm_dir)/matita/contribs/CoRN-Decl</key>
+    <key name="script_type">.v</key>
+    <key name="coercion">Z_of_nat cic:/Coq/ZArith/BinInt/Z_of_nat.con</key>
+    <key name="coercion">Zpos cic:/Coq/ZArith/BinInt/Z.ind#xpointer(1/1/2)</key>
+    <key name="coercion">nat_of_P cic:/Coq/NArith/BinPos/nat_of_P.con</key>
+  </section>
+</helm_registry>
diff --git a/components/binaries/transcript/Makefile b/components/binaries/transcript/Makefile
new file mode 100644 (file)
index 0000000..b9bfc61
--- /dev/null
@@ -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 (file)
index 0000000..66c6c33
--- /dev/null
@@ -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 (file)
index 0000000..8016d71
--- /dev/null
@@ -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 (file)
index 0000000..e88406b
--- /dev/null
@@ -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 (file)
index 0000000..53aff69
--- /dev/null
@@ -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 (file)
index 0000000..387d47f
--- /dev/null
@@ -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 [ <package> | <conf_file> ]*" 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 (file)
index 0000000..d79636f
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<helm_registry>
+  <section name="transcript">
+    <key name="helm_dir">/home/fguidi/svn/software</key>
+    <key name="heading_path">matita/matita.ma.templ</key>
+    <key name="heading_lines">14</key>
+  </section>
+</helm_registry>
diff --git a/components/binaries/transcript/types.ml b/components/binaries/transcript/types.ml
new file mode 100644 (file)
index 0000000..de7c103
--- /dev/null
@@ -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 (file)
index 0000000..5a90aab
--- /dev/null
@@ -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 (file)
index 0000000..ff70df7
--- /dev/null
@@ -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 <string> SPC STR IDENT INT EXTRA AC OP CP OC CC OQ CQ DEF FS COE CN SC
+   %token <string> 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 <Types.items> 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 (file)
index 0000000..e69de29
diff --git a/components/binaries/utilities/.depend.opt b/components/binaries/utilities/.depend.opt
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/components/binaries/utilities/Makefile b/components/binaries/utilities/Makefile
new file mode 100644 (file)
index 0000000..db76fb5
--- /dev/null
@@ -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 (file)
index 0000000..8a8524d
--- /dev/null
@@ -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 <dumpfile> <uri_index>\n" ^
+             "  <dumpfile>   is the file where environment will be dumped\n" ^
+             "  <uri_index>  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 (file)
index 0000000..90ea516
--- /dev/null
@@ -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 (file)
index 0000000..1d65291
--- /dev/null
@@ -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 (file)
index 0000000..98ade3a
--- /dev/null
@@ -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 "\e[0;32mOK\e[0m %.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 "\e[0;31mSKIPPED\e[0m\n";
+               flush stdout;
+               if not !timeout then
+                begin
+                 Printf.eprintf "\e[0;31mContinue with next URI? [y/_]\e[0m";
+                 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 "\e[0;31mCIRCULARDEP\e[0m\n"
+        | exn ->
+           Printf.printf "\e[0;31mFAIL\e[0m\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 (file)
index 0000000..e15468f
--- /dev/null
@@ -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 (file)
index 0000000..538d4b1
--- /dev/null
@@ -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 (file)
index 0000000..c1e2b0b
--- /dev/null
@@ -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 (file)
index 0000000..6797921
--- /dev/null
@@ -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 (file)
index 0000000..1b02df3
--- /dev/null
@@ -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 <sacerdot@cs.unibo.it>              *)
+(*                                 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 (file)
index 0000000..a1e94e2
--- /dev/null
@@ -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 (file)
index 0000000..e7ee2ed
--- /dev/null
@@ -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 (file)
index 0000000..8334ccf
--- /dev/null
@@ -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:
+   <!ELEMENT CurrentProof (Conjecture*,body)>
+   <!ELEMENT Sequent %sequent;>
+   <!ELEMENT Conjecture %sequent;>
+   <!ELEMENT Decl %term;>
+   <!ELEMENT Def %term;>
+   <!ELEMENT Hidden EMPTY>
+   <!ELEMENT Goal %term;>
+*)
+
+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 <tag_name,
+   * attribute_list> *)
+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 <name, value> _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 "</%s>" 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. <arity>) *)
+      push ctxt (Cic_term term)
+  | "substitution" ->   (* optional transparent elements (i.e. which _may_
+                         * contain a CIC) *)
+      set_top ctxt  (* replace <substitution> *)
+        (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 <arg> 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 <instantiate> *)
+      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 (file)
index 0000000..9472b4c
--- /dev/null
@@ -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 (file)
index 0000000..9bd7b9e
--- /dev/null
@@ -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 <tassi@cs.unibo.it>                     *)
+(*                                 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
+
+\f
+(*****************************************************************************)
+(** _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'' (* ) *)
+;;
+
+\f
+(*****************************************************************************)
+(** 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'
+
+\f
+(*****************************************************************************)
+(** 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 "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\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
+
+\f
+(*****************************************************************************)
+(** 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 (file)
index 0000000..7a43319
--- /dev/null
@@ -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 (file)
index 0000000..dd16521
--- /dev/null
@@ -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 (file)
index 0000000..9977d18
--- /dev/null
@@ -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 (file)
index 0000000..b7c7d11
--- /dev/null
@@ -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 (file)
index 0000000..1e29b5b
--- /dev/null
@@ -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 <sacerdot@cs.unibo.it>               *)
+(*                                 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 (file)
index 0000000..546f4a3
--- /dev/null
@@ -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 (file)
index 0000000..63464e2
--- /dev/null
@@ -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 (file)
index 0000000..3038582
--- /dev/null
@@ -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 (file)
index 0000000..6778798
--- /dev/null
@@ -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 (file)
index 0000000..7e1dc62
--- /dev/null
@@ -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 (file)
index 0000000..bb742f1
--- /dev/null
@@ -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 (file)
index 0000000..c0e4bb2
--- /dev/null
@@ -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 (file)
index 0000000..8999016
--- /dev/null
@@ -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 (file)
index 0000000..e198bcd
--- /dev/null
@@ -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 (file)
index 0000000..5582abc
--- /dev/null
@@ -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 (file)
index 0000000..3fc1e0d
--- /dev/null
@@ -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 (file)
index 0000000..3fc1e0d
--- /dev/null
@@ -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 (file)
index 0000000..2669afb
--- /dev/null
@@ -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 (file)
index 0000000..eb3b934
--- /dev/null
@@ -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 "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ;
+            X.xml_cdata ("<!DOCTYPE CurrentProof SYSTEM \""^ dtdname ^ "\">\n");
+            xml_for_current_proof_body
+         >] in
+        let xmlty =
+         [< X.xml_cdata "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ;
+            X.xml_cdata ("<!DOCTYPE ConstantType SYSTEM \""^ dtdname ^ "\">\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
+                  "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ;
+                 X.xml_cdata
+                  ("<!DOCTYPE ConstantBody SYSTEM \"" ^ dtdname ^ "\">\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 "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ;
+            X.xml_cdata ("<!DOCTYPE ConstantType SYSTEM \""^ dtdname ^ "\">\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 "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ;
+            X.xml_cdata ("<!DOCTYPE Variable SYSTEM \"" ^ dtdname ^ "\">\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 "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ;
+            X.xml_cdata
+             ("<!DOCTYPE InductiveDefinition SYSTEM \"" ^ dtdname ^ "\">\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 "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" ;
+      X.xml_cdata
+       ("<!DOCTYPE InnerTypes SYSTEM \"" ^ dtdname ^ "\">\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 (file)
index 0000000..dcbff3d
--- /dev/null
@@ -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 (file)
index 0000000..bb00476
--- /dev/null
@@ -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 (file)
index 0000000..b63a585
--- /dev/null
@@ -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 (file)
index 0000000..905d1e6
--- /dev/null
@@ -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 (file)
index 0000000..dcc7b66
--- /dev/null
@@ -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 (file)
index 0000000..7878917
--- /dev/null
@@ -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 (file)
index 0000000..c6c6811
--- /dev/null
@@ -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 (file)
index 0000000..ca41244
--- /dev/null
@@ -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 (file)
index 0000000..ca41244
--- /dev/null
@@ -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 (file)
index 0000000..cd03e82
--- /dev/null
@@ -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 (file)
index 0000000..7aeb65a
--- /dev/null
@@ -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
+(*
+      (* <benchmark> *)
+      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
+      (* </benchmark> *)
+*)
+
+      (* (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 (file)
index 0000000..0a966ba
--- /dev/null
@@ -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
+(*
+      (* <benchmark> *)
+      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
+      (* </benchmark> *)
+*)
+
+      (* (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 (file)
index 0000000..dbdb153
--- /dev/null
@@ -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
+(*
+      (* <benchmark> *)
+      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
+      (* </benchmark> *)
+*)
+
+      (* (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 (file)
index 0000000..5dc0df2
--- /dev/null
@@ -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 (file)
index 0000000..c3fa7ef
--- /dev/null
@@ -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 (file)
index 0000000..0ad4981
--- /dev/null
@@ -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 (file)
index 0000000..1eade4c
--- /dev/null
@@ -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 (file)
index 0000000..00fe411
--- /dev/null
@@ -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 (file)
index 0000000..09efea8
--- /dev/null
@@ -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 (file)
index 0000000..e3cc4fa
--- /dev/null
@@ -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 (file)
index 0000000..12b09ff
--- /dev/null
@@ -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 (file)
index 0000000..6a826fc
--- /dev/null
@@ -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 (file)
index 0000000..87bb015
--- /dev/null
@@ -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 (file)
index 0000000..288ea5f
--- /dev/null
@@ -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 (file)
index 0000000..288ea5f
--- /dev/null
@@ -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 (file)
index 0000000..3062749
--- /dev/null
@@ -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 (file)
index 0000000..58e8170
--- /dev/null
@@ -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 (file)
index 0000000..4d1c82c
--- /dev/null
@@ -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 (file)
index 0000000..06b9188
--- /dev/null
@@ -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 (file)
index 0000000..06b9188
--- /dev/null
@@ -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 (file)
index 0000000..b2ee899
--- /dev/null
@@ -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 (file)
index 0000000..8ae5c1b
--- /dev/null
@@ -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 <sacerdot@cs.unibo.it>               *)
+(*                                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 (file)
index 0000000..55566a6
--- /dev/null
@@ -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 <sacerdot@cs.unibo.it>              *)
+(*                                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 (file)
index 0000000..5921c61
--- /dev/null
@@ -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 (file)
index 0000000..408bc88
--- /dev/null
@@ -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 (file)
index 0000000..5c88713
--- /dev/null
@@ -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 (file)
index 0000000..c923c6a
--- /dev/null
@@ -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 (file)
index 0000000..8c37c0f
--- /dev/null
@@ -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 (file)
index 0000000..e898c35
--- /dev/null
@@ -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 <sacerdot@cs.unibo.it>              *)
+(*                                 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 (file)
index 0000000..7f1ec58
--- /dev/null
@@ -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 (file)
index 0000000..82be7fd
--- /dev/null
@@ -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 (file)
index 0000000..a434058
--- /dev/null
@@ -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 (file)
index 0000000..36291fb
--- /dev/null
@@ -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 (file)
index 0000000..87a0ca0
--- /dev/null
@@ -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 (file)
index 0000000..e941917
--- /dev/null
@@ -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 (file)
index 0000000..cbc87e9
--- /dev/null
@@ -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 <tassi@cs.unibo.it>                      *)
+(*                                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 (file)
index 0000000..eb55a47
--- /dev/null
@@ -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 (file)
index 0000000..f2e49d3
--- /dev/null
@@ -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 (executable)
index 0000000..73b75ce
--- /dev/null
@@ -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 (file)
index 0000000..b90c0f2
--- /dev/null
@@ -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 (file)
index 0000000..a7b23ce
--- /dev/null
@@ -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 (file)
index 0000000..a7b23ce
--- /dev/null
@@ -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 (file)
index 0000000..ad87356
--- /dev/null
@@ -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 (file)
index 0000000..f082fc2
--- /dev/null
@@ -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 (file)
index 0000000..bc5b4c0
--- /dev/null
@@ -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 (file)
index 0000000..3667922
--- /dev/null
@@ -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 (file)
index 0000000..4762701
--- /dev/null
@@ -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 (file)
index 0000000..954c483
--- /dev/null
@@ -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 (file)
index 0000000..924020c
--- /dev/null
@@ -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 (file)
index 0000000..7f53e1e
--- /dev/null
@@ -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 (file)
index 0000000..c2f9aaf
--- /dev/null
@@ -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 (file)
index 0000000..fb6a66d
--- /dev/null
@@ -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<BEGIN>%s\n<END>" (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<BEGIN>%s\n<END>" (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<BEGIN>%s\n<END>" (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<BEGIN>%s\n<END>" (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 (file)
index 0000000..e1a6c28
--- /dev/null
@@ -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 (file)
index 0000000..f12ea14
--- /dev/null
@@ -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 (file)
index 0000000..711a152
--- /dev/null
@@ -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 (file)
index 0000000..1886b25
--- /dev/null
@@ -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 (file)
index 0000000..c851bb5
--- /dev/null
@@ -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 (file)
index 0000000..2c5d651
--- /dev/null
@@ -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 (file)
index 0000000..2c5d651
--- /dev/null
@@ -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 (file)
index 0000000..2eadef1
--- /dev/null
@@ -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> 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)
+# </cross>
+
diff --git a/components/content_pres/box.ml b/components/content_pres/box.ml
new file mode 100644 (file)
index 0000000..7c50692
--- /dev/null
@@ -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 <asperti@cs.unibo.it>                   *)
+(*                             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 "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\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 (file)
index 0000000..d2ca17b
--- /dev/null
@@ -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 <asperti@cs.unibo.it>                   *)
+(*                             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 (file)
index 0000000..0c18475
--- /dev/null
@@ -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 (file)
index 0000000..291c59a
--- /dev/null
@@ -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 (file)
index 0000000..911ddc5
--- /dev/null
@@ -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<to>>);   ("=>", <:unicode<Rightarrow>>);
+      ("<=", <:unicode<leq>>);  (">=", <:unicode<geq>>);
+      ("<>", <:unicode<neq>>);  (":=", <:unicode<def>>);
+      ("==", <:unicode<equiv>>);
+    ]
+
+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 (file)
index 0000000..cd5f087
--- /dev/null
@@ -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 (file)
index 0000000..461e2fc
--- /dev/null
@@ -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<Assign>> (* ≔ *); 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>>     (* Π *) -> `Pi
+(*     | SYMBOL <:unicode<exists>> |+ ∃ +| -> `Exists *)
+    | SYMBOL <:unicode<forall>> (* ∀ *) -> `Forall
+    | SYMBOL <:unicode<lambda>> (* λ *) -> `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<def>> (* ≝ *); 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<def>> (* ≝ *);
+      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<exists>> (* ∃ *);
+        (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<Rightarrow>> (* ⇒ *);
+          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 (file)
index 0000000..134a42c
--- /dev/null
@@ -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 (file)
index 0000000..673df33
--- /dev/null
@@ -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 (file)
index 0000000..1d06d19
--- /dev/null
@@ -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 (file)
index 0000000..b9e8976
--- /dev/null
@@ -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 <asperti@cs.unibo.it>                     *)
+(*                              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 (file)
index 0000000..8d3753d
--- /dev/null
@@ -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 <asperti@cs.unibo.it>                    *)
+(*                             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 (file)
index 0000000..7e080ea
--- /dev/null
@@ -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 (file)
index 0000000..86b97b6
--- /dev/null
@@ -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 (file)
index 0000000..1aa5db1
--- /dev/null
@@ -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 <asperti@cs.unibo.it>                    *)
+(*                             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 "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\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 (file)
index 0000000..8252517
--- /dev/null
@@ -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 (file)
index 0000000..256238d
--- /dev/null
@@ -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 (file)
index 0000000..6432359
--- /dev/null
@@ -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 (file)
index 0000000..d9c3a32
--- /dev/null
@@ -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 <asperti@cs.unibo.it>                     *)
+(*                              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 (file)
index 0000000..d6d9daa
--- /dev/null
@@ -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 <asperti@cs.unibo.it>                     *)
+(*                              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 (file)
index 0000000..0ee424f
--- /dev/null
@@ -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 (file)
index 0000000..5ff7100
--- /dev/null
@@ -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 (file)
index 0000000..e76756e
--- /dev/null
@@ -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 (file)
index 0000000..6d96e61
--- /dev/null
@@ -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 (file)
index 0000000..6d96e61
--- /dev/null
@@ -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 (file)
index 0000000..f4d9219
--- /dev/null
@@ -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 (file)
index 0000000..c24b74e
--- /dev/null
@@ -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 (file)
index 0000000..3d8548c
--- /dev/null
@@ -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 (file)
index 0000000..82fa980
--- /dev/null
@@ -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  (* <key, value> 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 "@[<hv2>%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 "@[<hov2>%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 "@[<hv2>%s %s {@," graph_type name;
+      List.iter (fun (k, v) -> fprintf fmt "@[<hv2>%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 "@[<hov2>\"%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 (file)
index 0000000..79037df
--- /dev/null
@@ -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  (* <key, value> 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 (file)
index 0000000..2fba7f6
--- /dev/null
@@ -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 (file)
index 0000000..07de4be
--- /dev/null
@@ -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 (file)
index 0000000..4ad2b5b
--- /dev/null
@@ -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   = "\e[0;34m"
+let yellow = "\e[0;33m"
+let green  = "\e[0;32m"
+let red    = "\e[0;31m"
+let black  = "\e[0m"
+
+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 (file)
index 0000000..6847ce3
--- /dev/null
@@ -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 (file)
index 0000000..cb4976e
--- /dev/null
@@ -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 (file)
index 0000000..90ce20d
--- /dev/null
@@ -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 (file)
index 0000000..cc593d5
--- /dev/null
@@ -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 (file)
index 0000000..5cd15fb
--- /dev/null
@@ -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 (file)
index 0000000..c1b436a
--- /dev/null
@@ -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 (file)
index 0000000..2201ddf
--- /dev/null
@@ -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 <pattern, pattern_id>)
+   * @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 (file)
index 0000000..f5edb69
--- /dev/null
@@ -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 (file)
index 0000000..fc52166
--- /dev/null
@@ -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 (file)
index 0000000..f60b2d4
--- /dev/null
@@ -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 (file)
index 0000000..b95157f
--- /dev/null
@@ -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 (file)
index 0000000..20f69cf
--- /dev/null
@@ -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 (file)
index 0000000..554fb1e
--- /dev/null
@@ -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 (file)
index 0000000..6512190
--- /dev/null
@@ -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 (file)
index 0000000..0f2132e
--- /dev/null
@@ -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 (file)
index 0000000..b41c478
--- /dev/null
@@ -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 *)
+
+  (* <TODO> *)
+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"
+  (* </TODO> *)
+
+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 (file)
index 0000000..5cf5cd3
--- /dev/null
@@ -0,0 +1,71 @@
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..ddce33f
--- /dev/null
@@ -0,0 +1,167 @@
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..d1bc66f
--- /dev/null
@@ -0,0 +1,70 @@
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..8103efc
--- /dev/null
@@ -0,0 +1,102 @@
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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
+"<?xml version=\"1.0\"?>
+<html xmlns=\"%s\" xmlns:helm=\"%s\">
+  <head>
+    <title>HTTP Getter's help message</title>
+  </head>
+  <body>
+    <h1>HTTP Getter, version %s</h1>
+    <h2>Usage information</h2>
+    <p>
+    Usage: <kbd>http://hostname:getterport/</kbd><em>command</em>
+    </p>
+    <p>
+    Available commands:
+    </p>
+    <p>
+      <b><kbd><a href=\"/help\">help</a></kbd></b><br />
+      display this help message
+    </p>
+    <p>
+      <b><kbd>getxml?uri=URI[&amp;format=(normal|gz)][&amp;patch_dtd=(yes|no)]</kbd></b><br />
+    </p>
+    <p>
+      <b><kbd>resolve?uri=URI</kbd></b><br />
+    </p>
+    <p>
+      <b><kbd>getdtd?uri=URI[&amp;patch_dtd=(yes|no)]</kbd></b><br />
+    </p>
+    <p>
+      <b><kbd>getxslt?uri=URI[&amp;patch_dtd=(yes|no)]</kbd></b><br />
+    </p>
+    <p>
+      <b><kbd><a href=\"/update\">update</a></kbd></b><br />
+    </p>
+    <p>
+      <b><kbd><a href=\"clean_cache\">clean_cache</a></kbd></b><br />
+    </p>
+    <p>
+      <b><kbd>ls?baseuri=regexp&amp;format=(txt|xml)</kbd></b><br />
+    </p>
+    <p>
+      <b><kbd>getalluris?format=(<a href=\"/getalluris?format=txt\">txt</a>|<a href=\"/getalluris?format=xml\">xml</a>)</kbd></b><br />
+    </p>
+    <p>
+      <b><kbd><a href=\"/getempty\">getempty</a></kbd></b><br />
+    </p>
+    <h2>Current configuration</h2>
+    <pre>%s</pre>
+  </body>
+</html>
+"
+  xhtml_ns helm_ns
+  version configuration
+
+let empty_xml =
+"<?xml version=\"1.0\"?>
+<!DOCTYPE empty [
+  <!ELEMENT empty EMPTY>
+]>
+<empty />
+"
+
diff --git a/components/getter/http_getter_const.mli b/components/getter/http_getter_const.mli
new file mode 100644 (file)
index 0000000..d532313
--- /dev/null
@@ -0,0 +1,39 @@
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..af5896e
--- /dev/null
@@ -0,0 +1,123 @@
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..d1ab73d
--- /dev/null
@@ -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 (file)
index 0000000..1d774c1
--- /dev/null
@@ -0,0 +1,63 @@
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..d39fe73
--- /dev/null
@@ -0,0 +1,49 @@
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..f7dffd0
--- /dev/null
@@ -0,0 +1,315 @@
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..e9b013e
--- /dev/null
@@ -0,0 +1,102 @@
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..c17435f
--- /dev/null
@@ -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 (file)
index 0000000..cc0ff46
--- /dev/null
@@ -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 (file)
index 0000000..fb0c30e
--- /dev/null
@@ -0,0 +1,72 @@
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..2052e7b
--- /dev/null
@@ -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 (file)
index 0000000..5d28df1
--- /dev/null
@@ -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 (executable)
index 0000000..3107846
--- /dev/null
@@ -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 = <LS>) {
+    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 (file)
index 0000000..54cdc25
--- /dev/null
@@ -0,0 +1,50 @@
+<helm_registry>
+  <section name="getter">
+    <key name="cache_dir">/tmp/helm/cache</key>
+    <key name="dtd_dir">/projects/helm/xml/dtd</key>
+    <key name="port">58081</key>
+    <key name="log_level">180</key>
+    <key name="log_file">http_getter.log</key>
+    <key name="prefix">
+      theory:/  file:///projects/helm/library/theories/
+    </key>
+    <key name="prefix">
+      xslt:/    file:///projects/helm/xml/stylesheets_ccorn/
+    </key>
+    <key name="prefix">
+      xslt:/    file:///projects/helm/xml/stylesheets_hanane/
+    </key>
+    <key name="prefix">
+      xslt:/    file:///projects/helm/xml/on-line/xslt/
+    </key>
+    <key name="prefix">
+      xslt:/    file:///projects/helm/nuprl/NuPRL/nuprl_stylesheets/
+    </key>
+    <key name="prefix">
+      nuprl:/   http://www.cs.uwyo.edu/~nuprl/helm-library/
+    </key>
+    <key name="prefix">
+      xslt:/    file:///projects/helm/xml/stylesheets/
+    </key>
+    <key name="prefix">
+      xslt:/    file:///projects/helm/xml/stylesheets/generated/
+    </key>
+    <key name="prefix">
+      theory:/residual_theory_in_lambda_calculus/
+      http://helm.cs.unibo.it/~sacerdot/huet_lambda_calculus_mowgli/residual_theory_in_lambda_calculus/
+    </key>
+    <key name="prefix">
+      theory:/IDA/
+      http://mowgli.cs.unibo.it/~sacerdot/ida/IDA/
+    </key>
+    <key name="prefix">
+      cic:/     file:///projects/helm/library/coq_contribs/
+      legacy
+    </key>
+    <key name="prefix">
+      cic:/matita/
+      file:///projects/helm/library/matita/
+      ro
+    </key>
+  </section>
+</helm_registry>
diff --git a/components/getter/test.ml b/components/getter/test.ml
new file mode 100644 (file)
index 0000000..6fa236f
--- /dev/null
@@ -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 (file)
index 0000000..dc225e2
--- /dev/null
@@ -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 (file)
index 0000000..0f64ba7
--- /dev/null
@@ -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 (file)
index 0000000..6eb3e7a
--- /dev/null
@@ -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 (file)
index 0000000..2b0f4db
--- /dev/null
@@ -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 (file)
index 0000000..fd3c444
--- /dev/null
@@ -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 (file)
index 0000000..647d38b
--- /dev/null
@@ -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 (file)
index 0000000..7731902
--- /dev/null
@@ -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 (file)
index 0000000..cad7b11
--- /dev/null
@@ -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 (file)
index 0000000..b0d4b70
--- /dev/null
@@ -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 (file)
index 0000000..b0d4b70
--- /dev/null
@@ -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 (file)
index 0000000..b6eed1e
--- /dev/null
@@ -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 (file)
index 0000000..625b233
--- /dev/null
@@ -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 (file)
index 0000000..63580ad
--- /dev/null
@@ -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 (file)
index 0000000..133dad2
--- /dev/null
@@ -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 (file)
index 0000000..0a25954
--- /dev/null
@@ -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 (file)
index 0000000..01fb19c
--- /dev/null
@@ -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 (file)
index 0000000..a8eb19a
--- /dev/null
@@ -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 (file)
index 0000000..2dc8a7c
--- /dev/null
@@ -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 (file)
index 0000000..2dc8a7c
--- /dev/null
@@ -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 (file)
index 0000000..eb2f1b1
--- /dev/null
@@ -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> 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)
+# </cross>
+#
+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 (file)
index 0000000..b3c8a59
--- /dev/null
@@ -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 (file)
index 0000000..00f184b
--- /dev/null
@@ -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 (file)
index 0000000..91ba4ae
--- /dev/null
@@ -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 (file)
index 0000000..5445a51
--- /dev/null
@@ -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 (file)
index 0000000..ca3bc0b
--- /dev/null
@@ -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 (file)
index 0000000..798fa75
--- /dev/null
@@ -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 (file)
index 0000000..8827e70
--- /dev/null
@@ -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 = (* <fresh_instances?, aliases, coercions?> *)
+   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 (file)
index 0000000..88940c2
--- /dev/null
@@ -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 (file)
index 0000000..b5d803f
--- /dev/null
@@ -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<vdash>>; 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<def>> ; 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<def>>; OPT SYMBOL "|";
+    fst_constructors = LIST0 constructor SEP SYMBOL "|";
+    tl = OPT [ "with";
+      types = LIST1 [
+        name = IDENT; SYMBOL ":"; typ = term; SYMBOL <:unicode<def>>;
+       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<def>>; 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<eta>> (* η *); 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<def>> ; 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<def>> (* ≝ *); body = term -> body ] ->
+        GrafiteAst.Obj (loc, Ast.Theorem (flavour, name, typ, body))
+    | flavour = theorem_flavour; name = IDENT; SYMBOL <:unicode<def>> (* ≝ *);
+      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 (file)
index 0000000..f8754df
--- /dev/null
@@ -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 (file)
index 0000000..7425321
--- /dev/null
@@ -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 (file)
index 0000000..b4ca6f0
--- /dev/null
@@ -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 <fname, raw statement>, 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 (file)
index 0000000..f05b77a
--- /dev/null
@@ -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 "@[<hov2>";
+          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 "{@[<hov2> ";
+        let todo = visit_symbol symbol todo is_son (nesting+1) in
+        Format.fprintf fmt "@]} @ ";
+        todo
+    | Slist0sep (symbol,sep) ->
+        Format.fprintf fmt "[@[<hov2> ";
+        let todo = visit_symbol symbol todo is_son (nesting + 1) in
+        Format.fprintf fmt "{@[<hov2> ";
+        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 "{@[<hov2> ";
+        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 "{@[<hov2> ";
+        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 "[@[<hov2> ";
+        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 "@[<hov2>( ";
+            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 "@[<hv2>%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 (file)
index 0000000..2d0f781
--- /dev/null
@@ -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 (file)
index 0000000..76c402c
--- /dev/null
@@ -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\e[01;31m%s\e[00m%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 (file)
index 0000000..d6a85b9
--- /dev/null
@@ -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 (file)
index 0000000..4170d80
--- /dev/null
@@ -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 (file)
index 0000000..691f9d1
--- /dev/null
@@ -0,0 +1,293 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 "<help> not yet written </help>" 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 (file)
index 0000000..93114b3
--- /dev/null
@@ -0,0 +1,46 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..947e351
--- /dev/null
@@ -0,0 +1,42 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..bd4baad
--- /dev/null
@@ -0,0 +1,140 @@
+<!--
+  Data used to fill template "hbugs_tutor.TPL.ml"
+
+  @ADDR@              tutor ip address
+  @PORT@              tutor tcp port
+  @TACTIC@            tactic to use (OCaml function, must have type
+                      ProofEngineTypes.tactic)
+  @HINT@              hint to be sent to client (content of Hbugs_types.Eureka
+                      type constructor, must have type Hbugs_types.hint, see
+                      hbugs_types.ml)
+  @HINT_TYPE@         hint type (3rd argument of Hbugs_types.Register_tutor type
+                      constructor, must have type Hbugs_types.hint_type)
+  @DESCRIPTION@       human readable tutor description
+  @ENVIRONMENT_FILE@  file from which restore proof checking environment on boot
+
+  "source" attribute  corresponding OCaml source file
+
+  INVARIANT:  XML element name below are lowercase version of @TAGS@ used in
+              template
+
+  TODO: hint type isn't yet well formalized
+-->
+
+<tutors>
+
+  <!-- DEBUGGING -->
+<!--
+  <tutor source="wait_tutor.ml">
+    <addr>127.0.0.1</addr>
+    <port>50111</port>
+    <tactic>Wait.wait_tac</tactic>
+    <hint>Hbugs_types.Use_ring_Luke</hint>
+    <hint_type>Use Ring Luke</hint_type>
+    <description>WAIT FOREVER tutor</description>
+    <environment_file>wait.environment</environment_file>
+  </tutor>
+-->
+
+  <tutor source="ring_tutor.ml">
+    <addr>127.0.0.1</addr>
+    <port>50001</port>
+    <tactic>Ring.ring_tac</tactic>
+    <hint>Hbugs_types.Use_ring_Luke</hint>
+    <hint_type>Use Ring Luke</hint_type>
+    <description>Ring tutor</description>
+    <environment_file>ring.environment</environment_file>
+  </tutor>
+  <tutor source="fourier_tutor.ml">
+    <addr>127.0.0.1</addr>
+    <port>50002</port>
+    <tactic>FourierR.fourier_tac</tactic>
+    <hint>Hbugs_types.Use_fourier_Luke</hint>
+    <hint_type>Use Fourier Luke</hint_type>
+    <description>Fourier tutor</description>
+    <environment_file>fourier.environment</environment_file>
+  </tutor>
+  <tutor source="reflexivity_tutor.ml">
+    <addr>127.0.0.1</addr>
+    <port>50003</port>
+    <tactic>EqualityTactics.reflexivity_tac</tactic>
+    <hint>Hbugs_types.Use_reflexivity_Luke</hint>
+    <hint_type>Use Reflexivity Luke</hint_type>
+    <description>Reflexivity tutor</description>
+    <environment_file>reflexivity.environment</environment_file>
+  </tutor>
+  <tutor source="symmetry_tutor.ml">
+    <addr>127.0.0.1</addr>
+    <port>50004</port>
+    <tactic>EqualityTactics.symmetry_tac</tactic>
+    <hint>Hbugs_types.Use_symmetry_Luke</hint>
+    <hint_type>Use Symmetry Luke</hint_type>
+    <description>Symmetry tutor</description>
+    <environment_file>symmetry.environment</environment_file>
+  </tutor>
+  <tutor source="assumption_tutor.ml">
+    <addr>127.0.0.1</addr>
+    <port>50005</port>
+    <tactic>VariousTactics.assumption_tac</tactic>
+    <hint>Hbugs_types.Use_assumption_Luke</hint>
+    <hint_type>Use Assumption Luke</hint_type>
+    <description>Assumption tutor</description>
+    <environment_file>assumption.environment</environment_file>
+  </tutor>
+  <tutor source="contradiction_tutor.ml">
+    <addr>127.0.0.1</addr>
+    <port>50006</port>
+    <tactic>NegationTactics.contradiction_tac</tactic>
+    <hint>Hbugs_types.Use_contradiction_Luke</hint>
+    <hint_type>Use Contradiction Luke</hint_type>
+    <description>Contradiction tutor</description>
+    <environment_file>contradiction.environment</environment_file>
+  </tutor>
+  <tutor source="exists_tutor.ml">
+    <addr>127.0.0.1</addr>
+    <port>50007</port>
+    <tactic>IntroductionTactics.exists_tac</tactic>
+    <hint>Hbugs_types.Use_exists_Luke</hint>
+    <hint_type>Use Exists Luke</hint_type>
+    <description>Exists tutor</description>
+    <environment_file>exists.environment</environment_file>
+  </tutor>
+  <tutor source="split_tutor.ml">
+    <addr>127.0.0.1</addr>
+    <port>50008</port>
+    <tactic>IntroductionTactics.split_tac</tactic>
+    <hint>Hbugs_types.Use_split_Luke</hint>
+    <hint_type>Use Split Luke</hint_type>
+    <description>Split tutor</description>
+    <environment_file>split.environment</environment_file>
+  </tutor>
+  <tutor source="left_tutor.ml">
+    <addr>127.0.0.1</addr>
+    <port>50009</port>
+    <tactic>IntroductionTactics.left_tac</tactic>
+    <hint>Hbugs_types.Use_left_Luke</hint>
+    <hint_type>Use Left Luke</hint_type>
+    <description>Left tutor</description>
+    <environment_file>left.environment</environment_file>
+  </tutor>
+  <tutor source="right_tutor.ml">
+    <addr>127.0.0.1</addr>
+    <port>50010</port>
+    <tactic>IntroductionTactics.right_tac</tactic>
+    <hint>Hbugs_types.Use_right_Luke</hint>
+    <hint_type>Use Right Luke</hint_type>
+    <description>Right tutor</description>
+    <environment_file>right.environment</environment_file>
+  </tutor>
+  <tutor source="search_pattern_apply_tutor.ml">
+    <no_auto /> <!-- this imply that settings below are not significant -->
+    <addr>127.0.0.1</addr>
+    <port>50011</port>
+    <tactic>PrimitiveTactics.apply_tac</tactic>
+    <hint>Hbugs_types.Use_apply_Luke</hint>
+    <hint_type>Use Apply Luke (with argument)</hint_type>
+    <description>Search pattern apply tutor</description>
+    <environment_file>search_pattern_apply.environment</environment_file>
+  </tutor>
+</tutors>
+
diff --git a/components/hbugs/doc/hbugs.dia b/components/hbugs/doc/hbugs.dia
new file mode 100644 (file)
index 0000000..b1c4e64
Binary files /dev/null and b/components/hbugs/doc/hbugs.dia differ
diff --git a/components/hbugs/hbugs_broker_registry.ml b/components/hbugs/hbugs_broker_registry.ml
new file mode 100644 (file)
index 0000000..4670b5e
--- /dev/null
@@ -0,0 +1,317 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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
+(*
+    (* <DEBUGGING> *)
+    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
+    (* </DEBUGGING> *)
+*)
+
+    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 (
+      "<clients>\n" ^
+      (Hashtbl.fold
+        (fun id url dump ->
+          (dump ^
+          (sprintf "<client id=\"%s\" url=\"%s\">\n" id url) ^
+          "<subscriptions>\n" ^
+          (String.concat "\n" (* id's subscriptions *)
+            (List.map
+              (fun tutor_id -> sprintf "<tutor id=\"%s\" />\n" tutor_id)
+              (Hashtbl.find subscriptions id))) ^
+          "</subscriptions>\n</client>\n"))
+        urls "") ^
+      "</clients>"
+    ))
+    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
+(*
+    (* <DEBUGGING> *)
+    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
+    (* </DEBUGGING> *)
+*)
+
+    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 (
+      "<tutors>\n" ^
+      (Hashtbl.fold
+        (fun id (url, hint_type, dsc) dump ->
+          dump ^
+          (sprintf
+"<tutor id=\"%s\" url=\"%s\">\n<hint_type>%s</hint_type>\n<description>%s</description>\n</tutor>"
+            id url hint_type dsc))
+        tbl "") ^
+      "</tutors>"
+    ))
+    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
+(*
+    (* <DEBUGGING> *)
+    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
+    (* </DEBUGGING> *)
+*)
+
+    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 <musing_id, client_id, tutor_id> 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 (
+      "<musings>\n" ^
+      (Hashtbl.fold
+        (fun mid (cid, tid) dump ->
+          dump ^
+          (sprintf "<musing id=\"%s\" client=\"%s\" tutor=\"%s\" />\n"
+            mid cid tid))
+        musings "") ^
+      "</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 (file)
index 0000000..ece9e07
--- /dev/null
@@ -0,0 +1,87 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..c7b5fae
--- /dev/null
@@ -0,0 +1,526 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..0c2e93d
--- /dev/null
@@ -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 (file)
index 0000000..f88a8c3
--- /dev/null
@@ -0,0 +1,672 @@
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+<requires lib="gnome"/>
+
+<widget class="GtkWindow" id="hbugsMainWindow">
+  <property name="title" translatable="yes">Hbugs: your personal proof trainer!</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+
+  <child>
+    <widget class="GtkVBox" id="vbox1">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child>
+       <widget class="GtkMenuBar" id="menubar">
+
+         <child>
+           <widget class="GtkMenuItem" id="toolsMenu">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">Tools</property>
+             <property name="use_underline">True</property>
+
+             <child>
+               <widget class="GtkMenu" id="toolsMenu_menu">
+                 <property name="visible">True</property>
+
+                 <child>
+                   <widget class="GtkCheckMenuItem" id="toggleDebuggingMenuItem">
+                     <property name="visible">True</property>
+                     <property name="label" translatable="yes">Debugging</property>
+                     <property name="use_underline">True</property>
+                     <property name="active">False</property>
+                   </widget>
+                 </child>
+               </widget>
+             </child>
+           </widget>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">False</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkHBox" id="hbox4">
+         <property name="visible">True</property>
+         <property name="homogeneous">False</property>
+         <property name="spacing">2</property>
+
+         <child>
+           <widget class="GtkLabel" id="label11">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes">My URL:</property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_CENTER</property>
+             <property name="wrap">False</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">False</property>
+             <property name="fill">False</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkEntry" id="clientUrlEntry">
+             <property name="visible">True</property>
+             <property name="tooltip" translatable="yes">Local HTTP daemon URL</property>
+             <property name="can_focus">True</property>
+             <property name="editable">False</property>
+             <property name="visibility">True</property>
+             <property name="max_length">0</property>
+             <property name="text" translatable="yes"></property>
+             <property name="has_frame">True</property>
+             <property name="invisible_char" translatable="yes">*</property>
+             <property name="activates_default">False</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="startLocalHttpDaemonButton">
+             <property name="visible">True</property>
+             <property name="tooltip" translatable="yes">Start the local HTTP daemon listening on the specified URL</property>
+             <property name="can_focus">True</property>
+             <property name="label" translatable="yes">Start!</property>
+             <property name="use_underline">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">False</property>
+             <property name="fill">False</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="testLocalHttpDaemonButton">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="label" translatable="yes">Test!</property>
+             <property name="use_underline">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">False</property>
+             <property name="fill">False</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">False</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkVBox" id="vbox4">
+         <property name="visible">True</property>
+         <property name="homogeneous">False</property>
+         <property name="spacing">0</property>
+
+         <child>
+           <widget class="GtkHBox" id="hbox1">
+             <property name="visible">True</property>
+             <property name="homogeneous">False</property>
+             <property name="spacing">2</property>
+
+             <child>
+               <widget class="GtkLabel" id="label1">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes">Broker:</property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">False</property>
+                 <property name="justify">GTK_JUSTIFY_CENTER</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">False</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkEntry" id="brokerUrlEntry">
+                 <property name="visible">True</property>
+                 <property name="tooltip" translatable="yes">HBugs broker URL</property>
+                 <property name="can_focus">True</property>
+                 <property name="editable">False</property>
+                 <property name="visibility">True</property>
+                 <property name="max_length">0</property>
+                 <property name="text" translatable="yes"></property>
+                 <property name="has_frame">True</property>
+                 <property name="invisible_char" translatable="yes">*</property>
+                 <property name="activates_default">False</property>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">True</property>
+                 <property name="fill">True</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkButton" id="testBrokerButton">
+                 <property name="visible">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="label" translatable="yes">Test!</property>
+                 <property name="use_underline">True</property>
+                 <property name="relief">GTK_RELIEF_NORMAL</property>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">False</property>
+               </packing>
+             </child>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">False</property>
+             <property name="fill">False</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkHBox" id="hbox2">
+             <property name="visible">True</property>
+             <property name="homogeneous">False</property>
+             <property name="spacing">2</property>
+
+             <child>
+               <widget class="GtkLabel" id="label2">
+                 <property name="label" translatable="yes">Client ID:</property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">False</property>
+                 <property name="justify">GTK_JUSTIFY_CENTER</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">False</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkLabel" id="clientIdLabel">
+                 <property name="label" translatable="yes"></property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">False</property>
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">True</property>
+                 <property name="fill">True</property>
+               </packing>
+             </child>
+
+             <child>
+               <widget class="GtkButton" id="registerClientButton">
+                 <property name="visible">True</property>
+                 <property name="can_focus">True</property>
+                 <property name="label" translatable="yes">(Re)Register</property>
+                 <property name="use_underline">True</property>
+                 <property name="relief">GTK_RELIEF_NORMAL</property>
+               </widget>
+               <packing>
+                 <property name="padding">0</property>
+                 <property name="expand">False</property>
+                 <property name="fill">False</property>
+               </packing>
+             </child>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">False</property>
+             <property name="fill">False</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkVPaned" id="vpaned1">
+         <property name="visible">True</property>
+         <property name="position">0</property>
+
+         <child>
+           <widget class="GtkFrame" id="frame3">
+             <property name="border_width">4</property>
+             <property name="visible">True</property>
+             <property name="label_xalign">0</property>
+             <property name="label_yalign">0.5</property>
+             <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+
+             <child>
+               <widget class="GtkHBox" id="hbox6">
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">2</property>
+
+                 <child>
+                   <widget class="GtkScrolledWindow" id="scrolledwindow3">
+                     <property name="visible">True</property>
+                     <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
+                     <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+                     <property name="shadow_type">GTK_SHADOW_IN</property>
+                     <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+                     <child>
+                       <widget class="GtkTreeView" id="subscriptionCList">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="headers_visible">True</property>
+                         <property name="rules_hint">False</property>
+                         <property name="reorderable">False</property>
+                         <property name="enable_search">True</property>
+                       </widget>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">True</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+
+                 <child>
+                   <widget class="GtkFixed" id="fixed1">
+                     <property name="visible">True</property>
+
+                     <child>
+                       <widget class="GtkButton" id="showSubscriptionWindowButton">
+                         <property name="width_request">0</property>
+                         <property name="height_request">0</property>
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="label" translatable="yes">Subscribe ...</property>
+                         <property name="use_underline">True</property>
+                         <property name="relief">GTK_RELIEF_NORMAL</property>
+                       </widget>
+                       <packing>
+                         <property name="x">0</property>
+                         <property name="y">0</property>
+                       </packing>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">False</property>
+                     <property name="fill">False</property>
+                   </packing>
+                 </child>
+               </widget>
+             </child>
+
+             <child>
+               <widget class="GtkLabel" id="label12">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes">Subscriptions</property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">False</property>
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+               <packing>
+                 <property name="type">label_item</property>
+               </packing>
+             </child>
+           </widget>
+           <packing>
+             <property name="shrink">False</property>
+             <property name="resize">False</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkFrame" id="frame2">
+             <property name="border_width">4</property>
+             <property name="visible">True</property>
+             <property name="label_xalign">0</property>
+             <property name="label_yalign">0.5</property>
+             <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+
+             <child>
+               <widget class="GtkVBox" id="vbox6">
+                 <property name="visible">True</property>
+                 <property name="homogeneous">False</property>
+                 <property name="spacing">0</property>
+
+                 <child>
+                   <widget class="GtkScrolledWindow" id="scrolledwindow2">
+                     <property name="visible">True</property>
+                     <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
+                     <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+                     <property name="shadow_type">GTK_SHADOW_IN</property>
+                     <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+                     <child>
+                       <widget class="GtkTreeView" id="hintsCList">
+                         <property name="visible">True</property>
+                         <property name="can_focus">True</property>
+                         <property name="headers_visible">True</property>
+                         <property name="rules_hint">False</property>
+                         <property name="reorderable">False</property>
+                         <property name="enable_search">True</property>
+                       </widget>
+                     </child>
+                   </widget>
+                   <packing>
+                     <property name="padding">0</property>
+                     <property name="expand">True</property>
+                     <property name="fill">True</property>
+                   </packing>
+                 </child>
+               </widget>
+             </child>
+
+             <child>
+               <widget class="GtkLabel" id="label13">
+                 <property name="visible">True</property>
+                 <property name="label" translatable="yes">Hints</property>
+                 <property name="use_underline">False</property>
+                 <property name="use_markup">False</property>
+                 <property name="justify">GTK_JUSTIFY_LEFT</property>
+                 <property name="wrap">False</property>
+                 <property name="selectable">False</property>
+                 <property name="xalign">0.5</property>
+                 <property name="yalign">0.5</property>
+                 <property name="xpad">0</property>
+                 <property name="ypad">0</property>
+               </widget>
+               <packing>
+                 <property name="type">label_item</property>
+               </packing>
+             </child>
+           </widget>
+           <packing>
+             <property name="shrink">True</property>
+             <property name="resize">True</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkStatusbar" id="mainWindowStatusBar">
+         <property name="has_resize_grip">True</property>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">False</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+<widget class="GtkWindow" id="subscribeWindow">
+  <property name="title" translatable="yes">Hbugs: subscribe ...</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">False</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+
+  <child>
+    <widget class="GtkVBox" id="vbox8">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child>
+       <widget class="GtkButton" id="listTutorsButton">
+         <property name="visible">True</property>
+         <property name="can_focus">True</property>
+         <property name="label" translatable="yes">Refresh</property>
+         <property name="use_underline">True</property>
+         <property name="relief">GTK_RELIEF_NORMAL</property>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">False</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkScrolledWindow" id="scrolledwindow4">
+         <property name="visible">True</property>
+         <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
+         <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+         <property name="shadow_type">GTK_SHADOW_IN</property>
+         <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+         <child>
+           <widget class="GtkTreeView" id="tutorsCList">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="headers_visible">True</property>
+             <property name="rules_hint">False</property>
+             <property name="reorderable">False</property>
+             <property name="enable_search">True</property>
+           </widget>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkHBox" id="hbox5">
+         <property name="visible">True</property>
+         <property name="homogeneous">False</property>
+         <property name="spacing">0</property>
+
+         <child>
+           <widget class="GtkButton" id="subscribeButton">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="label" translatable="yes">Subscribe to Selected</property>
+             <property name="use_underline">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+
+         <child>
+           <widget class="GtkButton" id="subscribeAllButton">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="label" translatable="yes">Subscribe to All</property>
+             <property name="use_underline">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+           </widget>
+           <packing>
+             <property name="padding">0</property>
+             <property name="expand">True</property>
+             <property name="fill">True</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">False</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkStatusbar" id="subscribeWindowStatusBar">
+         <property name="visible">True</property>
+         <property name="has_resize_grip">True</property>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">False</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+<widget class="GtkDialog" id="messageDialog">
+  <property name="title" translatable="yes">Message</property>
+  <property name="type">GTK_WINDOW_TOPLEVEL</property>
+  <property name="window_position">GTK_WIN_POS_NONE</property>
+  <property name="modal">True</property>
+  <property name="default_width">220</property>
+  <property name="default_height">150</property>
+  <property name="resizable">True</property>
+  <property name="destroy_with_parent">False</property>
+  <property name="has_separator">True</property>
+
+  <child internal-child="vbox">
+    <widget class="GtkVBox" id="dialogVbox1">
+      <property name="visible">True</property>
+      <property name="homogeneous">False</property>
+      <property name="spacing">0</property>
+
+      <child internal-child="action_area">
+       <widget class="GtkHButtonBox" id="dialogAction_area1">
+         <property name="visible">True</property>
+         <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+         <child>
+           <widget class="GtkButton" id="okDialogButton">
+             <property name="visible">True</property>
+             <property name="can_focus">True</property>
+             <property name="label" translatable="yes">OK</property>
+             <property name="use_underline">True</property>
+             <property name="relief">GTK_RELIEF_NORMAL</property>
+             <property name="response_id">0</property>
+           </widget>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">False</property>
+         <property name="fill">True</property>
+         <property name="pack_type">GTK_PACK_END</property>
+       </packing>
+      </child>
+
+      <child>
+       <widget class="GtkTable" id="table1">
+         <property name="border_width">5</property>
+         <property name="visible">True</property>
+         <property name="n_rows">1</property>
+         <property name="n_columns">1</property>
+         <property name="homogeneous">False</property>
+         <property name="row_spacing">0</property>
+         <property name="column_spacing">0</property>
+
+         <child>
+           <widget class="GtkLabel" id="dialogLabel">
+             <property name="visible">True</property>
+             <property name="label" translatable="yes"></property>
+             <property name="use_underline">False</property>
+             <property name="use_markup">False</property>
+             <property name="justify">GTK_JUSTIFY_CENTER</property>
+             <property name="wrap">True</property>
+             <property name="selectable">False</property>
+             <property name="xalign">0.5</property>
+             <property name="yalign">0.5</property>
+             <property name="xpad">0</property>
+             <property name="ypad">0</property>
+           </widget>
+           <packing>
+             <property name="left_attach">0</property>
+             <property name="right_attach">1</property>
+             <property name="top_attach">0</property>
+             <property name="bottom_attach">1</property>
+           </packing>
+         </child>
+       </widget>
+       <packing>
+         <property name="padding">0</property>
+         <property name="expand">True</property>
+         <property name="fill">True</property>
+       </packing>
+      </child>
+    </widget>
+  </child>
+</widget>
+
+</glade-interface>
diff --git a/components/hbugs/hbugs_common.ml b/components/hbugs/hbugs_common.ml
new file mode 100644 (file)
index 0000000..fe2ecfc
--- /dev/null
@@ -0,0 +1,48 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..2d51075
--- /dev/null
@@ -0,0 +1,32 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..5b1998a
--- /dev/null
@@ -0,0 +1,67 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..dad0c93
--- /dev/null
@@ -0,0 +1,35 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..4767b2a
--- /dev/null
@@ -0,0 +1,368 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 <?xml ... ?> declaration nor
+    DOCTYPE one *)
+    "<gTopLevelStatus>\n" ^
+    (sprintf "<CurrentGoal>%d</CurrentGoal>\n" goal) ^
+    type_string ^ "\n" ^
+    body_string ^ "\n" ^
+    "</gTopLevelStatus>\n"
+  | None -> "<gTopLevelStatus />\n"
+
+let rec pp_hint = function
+  | Use_ring -> sprintf "<ring />"
+  | Use_fourier -> sprintf "<fourier />"
+  | Use_reflexivity -> sprintf "<reflexivity />"
+  | Use_symmetry -> sprintf "<symmetry />"
+  | Use_assumption -> sprintf "<assumption />"
+  | Use_contradiction -> sprintf "<contradiction />"
+  | Use_exists -> sprintf "<exists />"
+  | Use_split -> sprintf "<split />"
+  | Use_left -> sprintf "<left />"
+  | Use_right -> sprintf "<right />"
+  | Use_apply term -> sprintf "<apply>%s</apply>" term
+  | Hints hints ->
+      sprintf "<hints>\n%s\n</hints>"
+        (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<tutor_dsc id=\"%s\">%s</tutor_dsc>" s id dsc)
+    ""
+let pp_tutor_ids =
+  List.fold_left (fun s id -> sprintf "%s<tutor id=\"%s\" />" s id) ""
+
+let string_of_msg = function
+  | Help -> "<help />"
+  | Usage usage_string -> sprintf "<usage>%s</usage>" usage_string
+  | Exception (name, value) ->
+      sprintf "<exception name=\"%s\">%s</exception>" name value
+  | Register_client (id, url) ->
+      sprintf "<register_client id=\"%s\" url=\"%s\" />" id url
+  | Unregister_client id -> sprintf "<unregister_client id=\"%s\" />" id
+  | List_tutors id -> sprintf "<list_tutors id=\"%s\" />" id
+  | Subscribe (id, tutor_ids) ->
+      sprintf "<subscribe id=\"%s\">%s</subscribe>"
+        id (pp_tutor_ids tutor_ids)
+  | State_change (id, state) ->
+      sprintf "<state_change id=\"%s\">%s</state_change>"
+        id (pp_state state)
+  | Wow id -> sprintf "<wow id=\"%s\" />" id
+  | Register_tutor (id, url, hint_type, dsc) ->
+      sprintf
+"<register_tutor id=\"%s\" url=\"%s\">
+<hint_type>%s</hint_type>
+<description>%s</description>
+</register_tutor>"
+        id url (pp_hint_type hint_type) dsc
+  | Unregister_tutor id -> sprintf "<unregister_tutor id=\"%s\" />" id
+  | Musing_started (id, musing_id) ->
+      sprintf "<musing_started id=\"%s\" musing_id=\"%s\" />" id musing_id
+  | Musing_aborted (id, musing_id) ->
+      sprintf "<musing_aborted id=\"%s\" musing_id=\"%s\" />" id musing_id
+  | Musing_completed (id, musing_id, result) ->
+      sprintf
+        "<musing_completed id=\"%s\" musing_id=\"%s\">%s</musing_completed>"
+        id musing_id
+        (match result with
+        | Sorry -> "<sorry />"
+        | Eureka hint -> sprintf "<eureka>%s</eureka>" (pp_hint hint))
+  | Client_registered id -> sprintf "<client_registered id=\"%s\" />" id
+  | Client_unregistered id -> sprintf "<client_unregistered id=\"%s\" />" id
+  | Tutor_list (id, tutor_dscs) ->
+      sprintf "<tutor_list id=\"%s\">%s</tutor_list>"
+        id (pp_tutor_dscs tutor_dscs)
+  | Subscribed (id, tutor_ids) ->
+      sprintf "<subscribed id=\"%s\">%s</subscribed>"
+        id (pp_tutor_ids tutor_ids)
+  | State_accepted (id, stop_ids, start_ids) ->
+      sprintf
+"<state_accepted id=\"%s\">
+<stopped>%s</stopped>
+<started>%s</started>
+</state_accepted>"
+        id
+        (String.concat ""
+          (List.map (fun id -> sprintf "<musing id=\"%s\" />" id) stop_ids))
+        (String.concat ""
+          (List.map (fun id -> sprintf "<musing id=\"%s\" />" id) start_ids))
+  | Hint (id, hint) -> sprintf "<hint id=\"%s\">%s</hint>" id (pp_hint hint)
+  | Tutor_registered id -> sprintf "<tutor_registered id=\"%s\" />" id
+  | Tutor_unregistered id -> sprintf "<tutor_unregistered id=\"%s\" />" id
+  | Start_musing (id, state) ->
+      sprintf "<start_musing id=\"%s\">%s</start_musing>"
+        id (pp_state (Some state))
+  | Abort_musing (id, musing_id) ->
+      sprintf "<abort_musing id=\"%s\" musing_id=\"%s\" />" id musing_id
+  | Thanks (id, musing_id) ->
+      sprintf "<thanks id=\"%s\" musing_id=\"%s\" />" id musing_id
+  | Too_late (id, musing_id) ->
+      sprintf "<too_late id=\"%s\" musing_id=\"%s\" />" id musing_id
+;;
+
+  (* debugging function that dump on stderr the sent messages *)
+let dump_msg msg =
+  if debug >= 2 then
+    prerr_endline
+      (sprintf "<SENDING_MESSAGE>\n%s\n</SENDING_MESSAGE>"
+        (match msg with
+        | State_change _ -> "<state_change>omissis ...</state_change>"
+        | 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 (file)
index 0000000..642c0b0
--- /dev/null
@@ -0,0 +1,49 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..32b8e8b
--- /dev/null
@@ -0,0 +1,122 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..b0ef597
--- /dev/null
@@ -0,0 +1,50 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..ca62502
--- /dev/null
@@ -0,0 +1,266 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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
+  "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n" ^
+  "<!DOCTYPE " ^ root ^ " SYSTEM \""^ dtdname ^ "\">\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 (file)
index 0000000..43cd99c
--- /dev/null
@@ -0,0 +1,60 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..e3067f2
--- /dev/null
@@ -0,0 +1,104 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (executable)
index 0000000..3da998d
--- /dev/null
@@ -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 (executable)
index 0000000..9b742d8
--- /dev/null
@@ -0,0 +1,112 @@
+#!/usr/bin/ocamlrun /usr/bin/ocaml
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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
+  <pattern,template> 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 (executable)
index 0000000..5fe796c
--- /dev/null
@@ -0,0 +1,68 @@
+#!/usr/bin/ocamlrun /usr/bin/ocaml
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (executable)
index 0000000..2031e29
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+# Copyright (C) 2003:
+#    Stefano Zacchiroli <zack@cs.unibo.it>
+#    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 (file)
index 0000000..79c94be
--- /dev/null
@@ -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 (file)
index 0000000..cf15dde
--- /dev/null
@@ -0,0 +1,144 @@
+<test>
+
+    <!-- general purpose -->
+
+  <help />
+
+  <usage>usage string</usage>
+
+  <exception name='eccezione1'>corpo dell'exc</exception>
+
+    <!-- client -> broker -->
+
+  <register_client id='client_id' url='client_url' />
+
+  <unregister_client id='client_id' />
+
+  <list_tutors id='client_id' />
+
+  <subscribe id='client_id'>
+    <tutor id='tutor_id1' />
+    <tutor id='tutor_id2' />
+    <!-- .... -->
+    <tutor id='tutor_idN' />
+  </subscribe>
+
+  <state_change id='client_id'> <!-- new state received -->
+    <gTopLevelStatus>
+      <CurrentGoal>0</CurrentGoal>
+      <ConstantType>
+      </ConstantType>
+      <CurrentProof>
+      </CurrentProof>
+    </gTopLevelStatus>
+  </state_change>
+
+  <state_change id='client_id'> <!-- no state received: proof is completed -->
+    <gTopLevelStatus />
+  </state_change>
+
+  <wow id="client_id" />
+
+    <!-- tutor -> broker -->
+
+  <register_tutor id='tutor_id' url='tutor_url'>
+    <hint_type>
+      <!-- HINT TYPE -->
+    </hint_type>
+    <description>
+      descrizione del tutor
+    </description>
+  </register_tutor>
+
+  <unregister_tutor id='tutor_id' />
+
+  <musing_started id='tutor_id' musing_id='musing_id' />
+
+  <musing_aborted id='tutor_id' musing_id='musing_id' />
+
+  <musing_completed id='tutor_id' musing_id='musing_id'>
+    <sorry />
+  </musing_completed>
+
+  <musing_completed id='tutor_id' musing_id='musing_id'>
+    <eureka>
+      <ring />
+    </eureka>
+  </musing_completed>
+
+  <musing_completed id='tutor_id' musing_id='musing_id'>
+    <eureka>
+      <hints>
+        <ring />
+        <fourier />
+      </hints>
+    </eureka>
+  </musing_completed>
+
+    <!-- broker -> client -->
+
+  <client_registered id='broker_id' />
+
+  <client_unregistered id='broker_id' />
+
+  <tutor_list id='broker_id'>
+    <tutor_dsc id='tutor_id1'> description 1 </tutor_dsc>
+    <tutor_dsc id='tutor_id2'> description 2 </tutor_dsc>
+    <!-- ... -->
+    <tutor_dsc id='tutor_idN'> description N </tutor_dsc>
+  </tutor_list>
+
+  <subscribed id='broker_id'>
+    <tutor_dsc id='tutor_id1'> description 1 </tutor_dsc>
+    <tutor_dsc id='tutor_id2'> description 2 </tutor_dsc>
+    <!-- ... -->
+    <tutor_dsc id='tutor_idN'> description N </tutor_dsc>
+  </subscribed>
+
+  <state_accepted id='broker_id'>
+    <stopped>
+      <musing id='musing_id1' />
+      <!-- ... -->
+      <musing id='musing_idN' />
+    </stopped>
+    <started>
+      <musing id='musing_id1' />
+      <!-- ... -->
+      <musing id='musing_idM' />
+    </started>
+  </state_accepted>
+
+  <hint id='broker_id'>
+    <ring />
+  </hint>
+
+  <hint id='broker_id'>
+    <hints>
+      <ring />
+      <fourier />
+    </hints>
+  </hint>
+
+    <!-- broker -> tutor -->
+
+  <tutor_registered id='broker_id' />
+
+  <tutor_unregistered id='broker_id' />
+
+  <start_musing id='broker_id'>
+    <gTopLevelStatus>
+      <CurrentGoal>0</CurrentGoal>
+      <ConstantType>
+      </ConstantType>
+      <CurrentProof>
+      </CurrentProof>
+    </gTopLevelStatus>
+  </start_musing>
+
+  <abort_musing id='broker_id' musing_id='musing_id' />
+
+  <thanks id='broker_id' musing_id='musing_id' />
+
+  <too_late id='broker_id' musing_id='musing_id' />
+
+</test>
diff --git a/components/hbugs/test/Makefile b/components/hbugs/test/Makefile
new file mode 100644 (file)
index 0000000..0b3debf
--- /dev/null
@@ -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 (file)
index 0000000..1afd743
--- /dev/null
@@ -0,0 +1,70 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..bf9c09a
--- /dev/null
@@ -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 (file)
index 0000000..bf9c09a
--- /dev/null
@@ -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 (file)
index 0000000..9630da2
--- /dev/null
@@ -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 (file)
index 0000000..97a15b7
--- /dev/null
@@ -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 <sacerdot@cs.unibo.it>               *)
+(*                                 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 (file)
index 0000000..25d642b
--- /dev/null
@@ -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 <sacerdot@cs.unibo.it>               *)
+(*                                 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 (file)
index 0000000..eb6a764
--- /dev/null
@@ -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 <?xml ...?> 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 (file)
index 0000000..45d0e95
--- /dev/null
@@ -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 (file)
index 0000000..16e6e9d
--- /dev/null
@@ -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 (file)
index 0000000..602c901
--- /dev/null
@@ -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 (file)
index 0000000..356e6e0
--- /dev/null
@@ -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 (file)
index 0000000..b9ace8e
--- /dev/null
@@ -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 (file)
index 0000000..329dd22
--- /dev/null
@@ -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 (file)
index 0000000..3c7de40
--- /dev/null
@@ -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 (file)
index 0000000..b8687c5
--- /dev/null
@@ -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 (file)
index 0000000..452167c
--- /dev/null
@@ -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 (file)
index 0000000..7fec1d3
--- /dev/null
@@ -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 (file)
index 0000000..b8582ba
--- /dev/null
@@ -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 (file)
index 0000000..d514c02
--- /dev/null
@@ -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 (file)
index 0000000..944438d
--- /dev/null
@@ -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 (file)
index 0000000..5f65124
--- /dev/null
@@ -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 (file)
index 0000000..e8d9b94
--- /dev/null
@@ -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 (file)
index 0000000..5a09d59
--- /dev/null
@@ -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 (file)
index 0000000..ad317be
--- /dev/null
@@ -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 (file)
index 0000000..b7ad59f
--- /dev/null
@@ -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 (file)
index 0000000..1966251
--- /dev/null
@@ -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 (file)
index 0000000..b69495f
--- /dev/null
@@ -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 (file)
index 0000000..7b9422d
--- /dev/null
@@ -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 (file)
index 0000000..930d73f
--- /dev/null
@@ -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 (file)
index 0000000..3003194
--- /dev/null
@@ -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 (file)
index 0000000..bba152a
--- /dev/null
@@ -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 (file)
index 0000000..fefbf93
--- /dev/null
@@ -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 (file)
index 0000000..190aaf9
--- /dev/null
@@ -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 (file)
index 0000000..e3c921d
--- /dev/null
@@ -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 (file)
index 0000000..638c0ce
--- /dev/null
@@ -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 (file)
index 0000000..97463b1
--- /dev/null
@@ -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 (file)
index 0000000..c994a9c
--- /dev/null
@@ -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 (file)
index 0000000..f1f84c9
--- /dev/null
@@ -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 (file)
index 0000000..775292c
--- /dev/null
@@ -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 (file)
index 0000000..b966f31
--- /dev/null
@@ -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 (file)
index 0000000..0ca40eb
--- /dev/null
@@ -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 (file)
index 0000000..e1afd61
--- /dev/null
@@ -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 (file)
index 0000000..a1f2a0c
--- /dev/null
@@ -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 (file)
index 0000000..4d65cfe
--- /dev/null
@@ -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 (file)
index 0000000..e82e91f
--- /dev/null
@@ -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 (file)
index 0000000..e608a9c
--- /dev/null
@@ -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 (file)
index 0000000..7c82e27
--- /dev/null
@@ -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 (file)
index 0000000..2c6bfd1
--- /dev/null
@@ -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 (file)
index 0000000..c36d84c
--- /dev/null
@@ -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 (file)
index 0000000..d8e432e
--- /dev/null
@@ -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 (file)
index 0000000..b782469
--- /dev/null
@@ -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 (file)
index 0000000..2fb102d
--- /dev/null
@@ -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 (file)
index 0000000..28268d2
--- /dev/null
@@ -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 (file)
index 0000000..28268d2
--- /dev/null
@@ -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 (file)
index 0000000..39d6900
--- /dev/null
@@ -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 (file)
index 0000000..c416747
--- /dev/null
@@ -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 "<ul>\n%s\n</ul>"
+        (String.concat "\n"
+          (List.map
+            (fun msg -> sprintf "<li>%s</li>" (html_of_html_tag msg))
+            msgs))
+  | `BR -> "<br />\n"
+  | `DIV (indent, color, tag) ->
+      sprintf "<div style=\"%smargin-left:%fcm\">\n%s\n</div>"
+        (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 -> "<b>Error: " ^ html_of_html_tag tag ^ "</b>"
+    | `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 (file)
index 0000000..633b5c3
--- /dev/null
@@ -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 (file)
index 0000000..492a34e
--- /dev/null
@@ -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 (file)
index 0000000..492a34e
--- /dev/null
@@ -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 (file)
index 0000000..9943237
--- /dev/null
@@ -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 (file)
index 0000000..73f137a
--- /dev/null
@@ -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 (file)
index 0000000..bc83f65
--- /dev/null
@@ -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, constants>
+  * 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 (file)
index 0000000..844a083
--- /dev/null
@@ -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 (file)
index 0000000..b1acc4c
--- /dev/null
@@ -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 (file)
index 0000000..d34bd1c
--- /dev/null
@@ -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 *)
+    }
+
+    (** <adjacency list of the dependency graph,
+     *   root,
+     *   generator function,
+     *   invert edges on render?>
+     * 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 (file)
index 0000000..12b502c
--- /dev/null
@@ -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 (file)
index 0000000..4fbae1b
--- /dev/null
@@ -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 (file)
index 0000000..68af269
--- /dev/null
@@ -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 <uri, shortname, metadata> *)
+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 (file)
index 0000000..373ec54
--- /dev/null
@@ -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 (file)
index 0000000..cffb24c
--- /dev/null
@@ -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 (file)
index 0000000..fd61d71
--- /dev/null
@@ -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 (file)
index 0000000..904d837
--- /dev/null
@@ -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 (file)
index 0000000..f96b877
--- /dev/null
@@ -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 (file)
index 0000000..ca780ee
--- /dev/null
@@ -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 <table name, table type>; 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 (file)
index 0000000..cf4f36b
--- /dev/null
@@ -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 (file)
index 0000000..cf4f36b
--- /dev/null
@@ -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 (file)
index 0000000..b08e0eb
--- /dev/null
@@ -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 (file)
index 0000000..bb9715a
--- /dev/null
@@ -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 (file)
index 0000000..fd0df50
--- /dev/null
@@ -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))
+
+  (** <helpers> *)
+
+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 []
+
+  (** </helpers> *)
+
+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
+    (* <section> elements entered so far *)
+  let in_key = ref false in (* have we entered a <key> element? *)
+  let cdata = ref "" in     (* collected cdata (inside <key> *)
+  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 (file)
index 0000000..77c6f6c
--- /dev/null
@@ -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 <application>.<setting>:
+ *   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 (file)
index 0000000..d0b91a2
--- /dev/null
@@ -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 (file)
index 0000000..b0edbda
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<helm_registry>
+  <section name="annotations">
+    <key name="dir">file:///home/zack/miohelm/objects</key>
+    <key name="url">file:///home/zack/miohelm/objects</key>
+  </section>
+  <section name="getter">
+    <key name="mode">remote</key>
+    <key name="url">http://localhost:58081</key>
+  </section>
+  <section name="triciclo">
+    <key name="merge1">yes</key>
+  </section>
+  <section name="triciclo">
+    <include href="tests/sample_include.xml" />
+  </section>
+  <section name="triciclo">
+    <key name="merge2">yes</key>
+  </section>
+  <section name="types">
+    <key name="string">debian</key>
+    <key name="int">1</key>
+    <key name="bool">false</key>
+    <key name="float">2.5</key>
+    <key name="int_list">11</key>
+    <key name="int_list">13</key>
+    <key name="int_list">17</key>
+    <key name="int_list">19</key>
+    <key name="int_float_pair">19 23.2</key>
+  </section>
+  <section name="uwobo">
+    <key name="url">http://localhost:58080/</key>
+  </section>
+</helm_registry>
diff --git a/components/registry/tests/sample_include.xml b/components/registry/tests/sample_include.xml
new file mode 100644 (file)
index 0000000..8a68519
--- /dev/null
@@ -0,0 +1,15 @@
+<helm_registry>
+  <section name="foo1">
+    <key name="bar2">aaa</key>
+    <key name="bar3">bbb</key>
+  </section>
+  <section name="foo2">
+    <key name="bar1">quux</key>
+  </section>
+  <key name="basedir">/public/helm_library</key>
+  <key name="constant_type_file">$(triciclo.basedir)/constanttype</key>
+  <key name="environment_file">$(triciclo.basedir)/environment</key>
+  <key name="inner_types_file">$(triciclo.basedir)/innertypes</key>
+  <key name="proof_file">$(triciclo.basedir)/currentproof</key>
+  <key name="proof_file_type">$(triciclo.basedir)/currentprooftype</key>
+</helm_registry>
diff --git a/components/syntax_extensions/.depend b/components/syntax_extensions/.depend
new file mode 100644 (file)
index 0000000..f3c6a8b
--- /dev/null
@@ -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 (file)
index 0000000..c0cd9c9
--- /dev/null
@@ -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 (file)
index 0000000..5f0065d
--- /dev/null
@@ -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 (file)
index 0000000..eddc7f4
--- /dev/null
@@ -0,0 +1,15 @@
+
+Helm Utf8 macro syntax extension for Camlp4
+
+Sample file:
+
+  --- test.ml ---
+
+  prerr_endline <:unicode<lambda>>
+
+  ---------------
+
+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 (file)
index 0000000..4799545
--- /dev/null
@@ -0,0 +1,378 @@
+<?xml version="1.0"?>
+
+<!--
+ This file is part of EdiTeX, an editor of mathematical
+ expressions based on TeX syntax.
+ Copyright (C) 2002-2003 Luca Padovani <lpadovan@cs.unibo.it>,
+                    2003 Paolo Marinelli <pmarinel@cs.unibo.it>.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+ For more information, please visit the project's home page
+ http://helm.cs.unibo.it/editex/
+ or send an email to <lpadovan@cs.unibo.it>
+-->
+
+<dictionary name="TeX">
+
+  <include href="dictionary-basic.xml"/>
+
+  <!-- Greek Letters (lower case) -->
+
+  <entry name="alpha"      class="i" val="&#x03b1;"/>
+  <entry name="beta"       class="i" val="&#x03b2;"/>
+  <entry name="gamma"      class="i" val="&#x03b3;"/>
+  <entry name="delta"      class="i" val="&#x03b4;"/>
+  <entry name="epsilon"    class="i" val="&#x03f5;"/>
+  <entry name="varepsilon" class="i" val="&#x03b5;"/>
+  <entry name="zeta"       class="i" val="&#x03b6;"/>
+  <entry name="eta"        class="i" val="&#x03b7;"/>
+  <entry name="theta"      class="i" val="&#x03b8;"/>
+  <entry name="vartheta"   class="i" val="&#x03d1;"/>
+  <entry name="iota"       class="i" val="&#x03b9;"/>
+  <entry name="kappa"      class="i" val="&#x03ba;"/>
+  <entry name="lambda"     class="i" val="&#x03bb;"/>
+  <entry name="mu"         class="i" val="&#x03bc;"/>
+  <entry name="nu"         class="i" val="&#x03bd;"/>
+  <entry name="xi"         class="i" val="&#x03be;"/>
+  <entry name="o"          class="i" val="&#x03bf;"/>
+  <entry name="pi"         class="i" val="&#x03c0;"/>
+  <entry name="varpi"      class="i" val="&#x03d6;"/>
+  <entry name="rho"        class="i" val="&#x03c1;"/>
+  <entry name="varrho"     class="i" val="&#x03f1;"/>
+  <entry name="sigma"      class="i" val="&#x03c3;"/>
+  <entry name="varsigma"   class="i" val="&#x03c2;"/>
+  <entry name="tau"        class="i" val="&#x03c4;"/>
+  <entry name="upsilon"    class="i" val="&#x03c5;"/>
+  <entry name="phi"        class="i" val="&#x03d5;"/>
+  <entry name="varphi"     class="i" val="&#x03c6;"/>
+  <entry name="chi"        class="i" val="&#x03c7;"/>
+  <entry name="psi"        class="i" val="&#x03c8;"/>
+  <entry name="omega"      class="i" val="&#x03c9;"/>
+
+  <!-- Greek Letters (upper case) -->
+
+  <entry name="Gamma"   class="i" val="&#x0393;"/>
+  <entry name="Delta"   class="i" val="&#x0394;"/>
+  <entry name="Theta"   class="i" val="&#x0398;"/>
+  <entry name="Lambda"  class="i" val="&#x039b;"/>
+  <entry name="Xi"      class="i" val="&#x039e;"/>
+  <entry name="Pi"      class="i" val="&#x03a0;"/>
+  <entry name="Sigma"   class="i" val="&#x03a3;"/>
+  <entry name="Upsilon" class="i" val="&#x03d2;"/>
+  <entry name="Phi"     class="i" val="&#x03a6;"/>
+  <entry name="Psi"     class="i" val="&#x03a8;"/>
+  <entry name="Omega"   class="i" val="&#x03a9;"/>
+
+  <!-- Symbols of Type Ord -->
+
+  <entry name="aleph"       class="i" val="&#x2135;"/>
+  <entry name="hbar"        class="i" val="&#x210f;&#xfe00;"/>
+  <entry name="imath"       class="i" val="&#x0131;"/>
+  <entry name="jmath"       class="i" val="&#x006a;&#xfe00;"/>
+  <entry name="ell"         class="i" val="&#x2113;"/>
+  <entry name="wp"          class="i" val="&#x2118;"/>
+  <entry name="Re"          class="o" val="&#x211c;"/>
+  <entry name="Im"          class="o" val="&#x2111;"/>
+  <entry name="partial"     class="o" val="&#x2202;"/>
+  <entry name="infty"       class="i" val="&#x221e;"/>
+  <entry name="prime"       class="o" val="&#x2032;"/>
+  <entry name="emptyset"    class="i" val="&#x2205;&#xfe00;"/>
+  <entry name="nabla"       class="o" val="&#x2207;"/>
+  <entry name="surd"        class="o" val="????"/>
+  <entry name="top"         class="i" val="&#x22a4;"/>
+  <entry name="bot"         class="i" val="&#x22a5;"/>
+  <entry name="|"           class="o" val="|" delimiter="1"/>
+  <entry name="angle"       class="o" val="&#x2220;"/>
+  <entry name="triangle"    class="o" val="&#x25b5;"/>
+  <entry name="backslash"   class="o" val="\"/>
+  <entry name="forall"      class="o" val="&#x2200;"/>
+  <entry name="exists"      class="o" val="&#x2203;"/>
+  <entry name="neg"         class="o" val="&#x00ac;"/>
+  <entry name="lnot"        class="o" val="&#x00ac;"/>
+  <entry name="flat"        class="i" val="&#x266d;"/>
+  <entry name="natural"     class="i" val="&#x266e;"/>
+  <entry name="sharp"       class="i" val="&#x266f;"/>
+  <entry name="clubsuit"    class="i" val="&#x2663;"/>
+  <entry name="diamondsuit" class="i" val="&#x2662;"/>
+  <entry name="heartsuit"   class="i" val="&#x2661;"/>
+  <entry name="spadesuit"   class="i" val="&#x2660;"/>
+
+  <!-- Large Operators -->
+
+  <entry name="sum"         class="o" val="&#x2211;" limits="1"/>
+  <entry name="prod"        class="o" val="&#x220f;" limits="1"/>
+  <entry name="coprod"      class="o" val="&#x2210;" limits="1"/>
+  <entry name="int"         class="o" val="&#x222b;" limits="1"/>
+  <entry name="oint"        class="o" val="&#x222e;" limits="1"/>
+  <entry name="bigcap"      class="o" val="&#x22c2;" limits="1"/>
+  <entry name="bigcup"      class="o" val="&#x22c3;" limits="1"/>
+  <entry name="bigsqcup"    class="o" val="&#x2294;" limits="1"/>
+  <entry name="bigvee"      class="o" val="&#x22c1;" limits="1"/>
+  <entry name="bigwedge"    class="o" val="&#x22c0;" limits="1"/>
+  <entry name="bigodot"     class="o" val="&#x2299;" limits="1"/>
+  <entry name="bigotimes"   class="o" val="&#x2297;" limits="1"/>
+  <entry name="bigoplus"    class="o" val="&#x2295;" limits="1"/>
+  <entry name="biguplus"    class="o" val="&#x228e;" limits="1"/>
+
+  <!-- Binary Operations -->
+
+  <entry name="pm"              class="o" val="&#x00b1;"/>
+  <entry name="mp"              class="o" val="&#x2213;"/>
+  <entry name="setminus"        class="o" val="&#x2216;"/>
+  <entry name="cdot"            class="o" val="&#x010b;"/>
+  <entry name="times"           class="o" val="&#x00d7;"/>
+  <entry name="ast"             class="o" val="&#x002a;"/>
+  <entry name="star"            class="o" val="&#x22c6;"/>
+  <entry name="diamond"         class="o" val="&#x22c4;"/>
+  <entry name="circ"            class="o" val="&#x005e;"/>
+  <entry name="bullet"          class="o" val="&#x2022;"/>
+  <entry name="div"             class="o" val="&#x00f7;"/>
+  <entry name="cap"             class="o" val="&#x2229;"/>
+  <entry name="cup"             class="o" val="&#x222a;"/>
+  <entry name="uplus"           class="o" val="&#x228e;"/>
+  <entry name="sqcap"           class="o" val="&#x2293;"/>
+  <entry name="sqcup"           class="o" val="&#x2294;"/>
+  <entry name="triangleleft"    class="o" val="&#x25c3;"/>
+  <entry name="triangleright"   class="o" val="&#x25b9;"/>
+  <entry name="wr"              class="o" val="&#x2240;"/>
+  <entry name="bigcirc"         class="o" val="&#x25ef;"/>
+  <entry name="bigtriangleup"   class="o" val="&#x25b3;"/>
+  <entry name="bigtriangledown" class="o" val="&#x25bd;"/>
+  <entry name="vee"             class="o" val="&#x2228;"/>
+  <entry name="lor"             class="o" val="&#x2228;"/>
+  <entry name="wedge"           class="o" val="&#x2227;"/>
+  <entry name="land"            class="o" val="&#x2227;"/>
+  <entry name="oplus"           class="o" val="&#x2295;"/>
+  <entry name="ominus"          class="o" val="&#x2296;"/>
+  <entry name="otimes"          class="o" val="&#x2297;"/>
+  <entry name="oslash"          class="o" val="&#x00f8;"/>
+  <entry name="odot"            class="o" val="&#x2299;"/>
+  <entry name="dagger"          class="o" val="&#x2020;"/>
+  <entry name="ddagger"         class="o" val="&#x2021;"/>
+  <entry name="amalg"           class="o" val="&#x2a3f;"/>
+
+  <!-- Relations -->
+
+  <entry name="leq"            class="o" val="&#x2264;"/>
+  <entry name="le"             class="o" val="&#x2264;"/>
+  <entry name="prec"           class="o" val="&#x227a;"/>
+  <entry name="preceq"         class="o" val="&#x2aaf;"/>
+  <entry name="ll"             class="o" val="&#x226a;"/>
+  <entry name="subset"         class="o" val="&#x2282;"/>
+  <entry name="subseteq"       class="o" val="&#x2286;"/>
+  <entry name="in"             class="o" val="&#x2208;"/>
+  <entry name="vdash"          class="o" val="&#x22a2;"/>
+  <entry name="smile"          class="o" val="&#x2323;"/>
+  <entry name="frown"          class="o" val="&#x2322;"/>
+  <entry name="propto"         class="o" val="&#x221d;"/>
+  <entry name="geq"            class="o" val="&#x2265;"/>
+  <entry name="ge"             class="o" val="&#x2265;"/>
+  <entry name="succ"           class="o" val="&#x227b;"/>
+  <entry name="succeq"         class="o" val="&#x227d;"/>
+  <entry name="gg"             class="o" val="&#x226b;"/>
+  <entry name="supset"         class="o" val="&#x2283;"/>
+  <entry name="supseteq"       class="o" val="&#x2287;"/>
+  <entry name="sqsupseteq"     class="o" val="&#x2292;"/>
+  <entry name="notin"          class="o" val="&#x2209;"/>
+  <entry name="dashv"          class="o" val="&#x22a3;"/>
+  <entry name="mid"            class="o" val="&#x2223;"/>
+  <entry name="parallet"       class="o" val="????"/>
+  <entry name="equiv"          class="o" val="&#x2261;"/>
+  <entry name="sim"            class="o" val="&#x223c;"/>
+  <entry name="simeq"          class="o" val="&#x2243;"/>
+  <entry name="asymp"          class="o" val="&#x224d;"/>
+  <entry name="approx"         class="o" val="&#x2248;"/>
+  <entry name="cong"           class="o" val="&#x2245;"/>
+  <entry name="bowtie"         class="o" val="&#x22c8;"/>
+  <entry name="ni"             class="o" val="&#x220b;"/>
+  <entry name="owns"           class="o" val="&#x220b;"/>
+  <entry name="models"         class="o" val="&#x22a7;"/>
+  <entry name="doteq"          class="o" val="&#x2250;"/>
+  <entry name="perp"           class="o" val="&#x22a5;"/>
+
+  <entry name="not"            pattern="#1" embellishment="1"/>
+  <entry name="ne"             class="o" val="&#x2260;"/>
+
+  <!-- Arrows -->
+
+  <entry name="leftarrow"                 class="o" val="&#x2190;"/>
+  <entry name="gets"                      class="o" val="&#x2190;"/>
+  <entry name="Leftarrow"                 class="o" val="&#x21d0;"/>
+  <entry name="rightarrow"                class="o" val="&#x2192;"/>
+  <entry name="to"                        class="o" val="&#x2192;"/>
+  <entry name="Rightarrow"                class="o" val="&#x21d2;"/>
+  <entry name="leftrightarrow"            class="o" val="&#x2194;"/>
+  <entry name="Leftrightarrow"            class="o" val="&#x21d4;"/>
+  <entry name="mapsto"                    class="o" val="&#x21a6;"/>
+  <entry name="hookleftarrow"             class="o" val="&#x21a9;"/>
+  <entry name="uparrow"                   class="o" val="&#x2191;"/>
+  <entry name="downarrow"                 class="o" val="&#x2193;"/>
+  <entry name="updownarrow"               class="o" val="&#x2195;"/>
+  <entry name="nearrow"                   class="o" val="&#x2197;"/>
+  <entry name="nwarrow"                   class="o" val="&#x2196;"/>
+  <entry name="longleftarrow"             class="o" val="????;"/>
+  <entry name="Longleftarrow"             class="o" val="????"/>
+  <entry name="longrightarrow"            class="o" val="????"/>
+  <entry name="Longrightarrow"            class="o" val="&#x21d2;"/>
+  <entry name="longleftrightarrow" class="o" val="????"/>
+  <entry name="Longleftrightarrow" class="o" val="????"/>
+  <entry name="longmapsto"                class="o" val="????"/>
+  <entry name="hookrightarrow"            class="o" val="&#x21aa;"/>
+  <entry name="Uparrow"                   class="o" val="&#x21d1;"/>
+  <entry name="Downarrow"                 class="o" val="&#x21d3;"/>
+  <entry name="searrow"                   class="o" val="&#x2198;"/>
+  <entry name="swarrow"                   class="o" val="&#x2199;"/>
+
+  <entry name="buildrel" pattern="#1\over#2" embellishment="1"/>
+
+  <!-- Delimiters -->
+
+  <entry name="lbrack"         class="o" val="[" delimiter="1"/>
+  <entry name="rbrack"         class="o" val="]" delimiter="1"/>
+  <entry name="vert"           class="o" val="|" delimiter="1"/>
+  <entry name="Vert"           class="o" val="&#x2016;" delimiter="1"/>
+  <entry name="lbrace"         class="o" val="{" delimiter="1"/>
+  <entry name="{"              class="o" val="{" delimiter="1"/>
+  <entry name="rbrace"         class="o" val="}" delimiter="1"/>
+  <entry name="}"              class="o" val="}" delimiter="1"/>
+  <entry name="lfloor"         class="o" val="&#x230a;" delimiter="1"/>
+  <entry name="rfloor"         class="o" val="&#x230b;" delimiter="1"/>
+  <entry name="langle"         class="o" val="&#x2329;" delimiter="1"/>
+  <entry name="rangle"         class="o" val="&#x232a;" delimiter="1"/>
+  <entry name="lceil"          class="o" val="&#x2308;" delimiter="1"/>
+  <entry name="rceil"          class="o" val="&#x2309;" delimiter="1"/>
+
+  <entry name="left"           pattern="#1" embellishment="1" delimiter="1"/>
+  <entry name="right"          pattern="#1" embellishment="1" delimiter="1"/>
+  <entry name="bigl"           pattern="#1" embellishment="1" delimiter="1"/>
+  <entry name="bigr"           pattern="#1" embellishment="1" delimiter="1"/>
+  <entry name="bigm"           pattern="#1" embellishment="1" delimiter="1"/>
+  <entry name="big"            pattern="#1" embellishment="1" delimiter="1"/>
+  <entry name="Bigl"           pattern="#1" embellishment="1" delimiter="1"/>
+  <entry name="Bigr"           pattern="#1" embellishment="1" delimiter="1"/>
+  <entry name="Bigm"           pattern="#1" embellishment="1" delimiter="1"/>
+  <entry name="biggl"          pattern="#1" embellishment="1" delimiter="1"/>
+  <entry name="biggr"          pattern="#1" embellishment="1" delimiter="1"/>
+  <entry name="biggm"          pattern="#1" embellishment="1" delimiter="1"/>
+  <entry name="Biggl"          pattern="#1" embellishment="1" delimiter="1"/>
+  <entry name="Biggr"          pattern="#1" embellishment="1" delimiter="1"/>
+  <entry name="Biggm"          pattern="#1" embellishment="1" delimiter="1"/>
+
+  <!-- Accents -->
+
+  <entry name="hat"       pattern="#1" embellishment="1"/>
+  <entry name="widehat"   pattern="#1" embellishment="1"/>
+  <entry name="check"     pattern="#1" embellishment="1"/>
+  <entry name="tilde"     pattern="#1" embellishment="1"/>
+  <entry name="widetilde" pattern="#1" embellishment="1"/>
+  <entry name="acute"     pattern="#1" embellishment="1"/>
+  <entry name="grave"     pattern="#1" embellishment="1"/>
+  <entry name="dot"       pattern="#1" embellishment="1"/>
+  <entry name="ddot"      pattern="#1" embellishment="1"/>
+  <entry name="breve"     pattern="#1" embellishment="1"/>
+  <entry name="bar"       pattern="#1" embellishment="1"/>
+  <entry name="vec"       pattern="#1" embellishment="1"/>
+
+  <!-- Elementary Math Control Sequences -->
+
+  <entry name="overline"  pattern="#1"/>
+  <entry name="underline" pattern="#1"/>
+  <entry name="sqrt"      pattern="#1"/>
+  <entry name="root"      pattern="#1\of#2"/>
+  <entry name="over"      pattern="{}"/>
+  <entry name="atop"      pattern="{}"/>
+  <entry name="choose"    pattern="{}"/>
+  <entry name="brace"     pattern="{}"/>
+  <entry name="brack"     pattern="{}"/>
+
+  <!-- Style -->
+
+  <entry name="displaystyle"      pattern="}"/>
+  <entry name="textstyle"         pattern="}"/>
+  <entry name="scriptstyle"       pattern="}"/>
+  <entry name="scriptscriptstyle" pattern="}"/>
+
+  <!-- Non-Italic Function Names -->
+
+  <entry name="arccos" class="i" val="arccos"/>
+  <entry name="arcsin" class="i" val="arcsin"/>
+  <entry name="arctan" class="i" val="arctan"/>
+  <entry name="arg"    class="i" val="arg"/>
+  <entry name="cos"    class="i" val="cos"/>
+  <entry name="cosh"   class="i" val="cosh"/>
+  <entry name="cot"    class="i" val="cot"/>
+  <entry name="coth"   class="i" val="coth"/>
+  <entry name="csc"    class="i" val="csc"/>
+  <entry name="exp"    class="i" val="exp"/>
+  <entry name="deg"    class="i" val="deg"/>
+  <entry name="det"    class="o" val="det" limits="1"/>
+  <entry name="dim"    class="i" val="dim"/>
+  <entry name="gcd"    class="o" val="gcd" limits="1"/>
+  <entry name="hom"    class="i" val="hom"/>
+  <entry name="inf"    class="o" val="inf" limits="1"/>
+  <entry name="ker"    class="i" val="ker"/>
+  <entry name="lg"     class="i" val="lg"/>
+  <entry name="lim"    class="o" val="lim" limits="1"/>
+  <entry name="liminf" class="o" val="liminf" limits="1"/>
+  <entry name="limsup" class="o" val="limsup" limits="1"/>
+  <entry name="ln"     class="i" val="ln"/>
+  <entry name="log"    class="i" val="log"/>
+  <entry name="max"    class="o" val="max" limits="1"/>
+  <entry name="min"    class="o" val="max" limits="1"/>
+  <entry name="Pr"     class="o" val="Pr" limits="1"/>
+  <entry name="sec"    class="i" val="sec"/>
+  <entry name="sin"    class="i" val="sin"/>
+  <entry name="sinh"   class="i" val="sinh"/>
+  <entry name="sup"    class="o" limits="1"/>
+  <entry name="tan"    class="i" val="tan"/>
+  <entry name="tanh"   class="i" val="tanh"/>
+  <entry name="pmod"   pattern="#1"/>
+  <entry name="bmod"   class="o" val="mod"/>
+
+  <!-- Ellipses -->
+
+  <entry name="dots"          class="i" val="&#x2026;"/>
+  <entry name="ldots"         class="i" val="&#x2026;"/>
+  <entry name="cdots"         class="i" val="&#x22ef;"/>
+  <entry name="vdots"         class="i" val="&#x22ee;"/>
+  <entry name="ddots"         class="i" val="&#x22f1;"/>
+
+  <!-- Fonts -->
+
+  <entry name="rm" pattern="}"/>
+  <entry name="bf" pattern="}"/>
+  <entry name="tt" pattern="}"/>
+  <entry name="sl" pattern="}"/>
+  <entry name="it" pattern="}"/>
+
+  <!-- Horizontal Spacing -->
+
+  <entry name=","/>
+  <entry name="&gt;"/>
+  <entry name=";"/>
+  <entry name="!"/>
+
+  <!-- Braces and Matrices -->
+
+  <entry name="matrix"       pattern="#1" table="1"/>
+  <entry name="pmatrix"      pattern="#1" table="1"/>
+  <entry name="bordermatrix" pattern="#1" table="1"/>
+  <entry name="overbrace"    pattern="#1" limits="1"/>
+  <entry name="underbrace"   pattern="#1" limits="1"/>
+  <entry name="cases"        pattern="#1" table="1"/>
+
+</dictionary>
diff --git a/components/syntax_extensions/data/entities-table.xml b/components/syntax_extensions/data/entities-table.xml
new file mode 100644 (file)
index 0000000..c283631
--- /dev/null
@@ -0,0 +1,2079 @@
+<?xml version="1.0"?>
+
+<entities-table>
+  <entity name="aacute" value="&#x000E1;"/>
+  <entity name="Aacute" value="&#x000C1;"/>
+  <entity name="abreve" value="&#x00103;"/>
+  <entity name="Abreve" value="&#x00102;"/>
+  <entity name="ac" value="&#x0290F;"/>
+  <entity name="acd" value="&#x0223F;"/>
+  <entity name="acE" value="&#x029DB;"/>
+  <entity name="acirc" value="&#x000E2;"/>
+  <entity name="Acirc" value="&#x000C2;"/>
+  <entity name="acute" value="&#x000B4;"/>
+  <entity name="acy" value="&#x00430;"/>
+  <entity name="Acy" value="&#x00410;"/>
+  <entity name="aelig" value="&#x000E6;"/>
+  <entity name="AElig" value="&#x000C6;"/>
+  <entity name="af" value="&#x02061;"/>
+  <entity name="afr" value="&#x1D51E;"/>
+  <entity name="Afr" value="&#x1D504;"/>
+  <entity name="agrave" value="&#x000E0;"/>
+  <entity name="Agrave" value="&#x000C0;"/>
+  <entity name="aleph" value="&#x02135;"/>
+  <entity name="alpha" value="&#x003B1;"/>
+  <entity name="amacr" value="&#x00101;"/>
+  <entity name="Amacr" value="&#x00100;"/>
+  <entity name="amalg" value="&#x02A3F;"/>
+  <entity name="amp" value="&#x00026;"/>
+  <entity name="and" value="&#x02227;"/>
+  <entity name="And" value="&#x02A53;"/>
+  <entity name="andand" value="&#x02A55;"/>
+  <entity name="andd" value="&#x02A5C;"/>
+  <entity name="andslope" value="&#x02A58;"/>
+  <entity name="andv" value="&#x02A5A;"/>
+  <entity name="ang" value="&#x02220;"/>
+  <entity name="ange" value="&#x029A4;"/>
+  <entity name="angle" value="&#x02220;"/>
+  <entity name="angmsd" value="&#x02221;"/>
+  <entity name="angmsdaa" value="&#x029A8;"/>
+  <entity name="angmsdab" value="&#x029A9;"/>
+  <entity name="angmsdac" value="&#x029AA;"/>
+  <entity name="angmsdad" value="&#x029AB;"/>
+  <entity name="angmsdae" value="&#x029AC;"/>
+  <entity name="angmsdaf" value="&#x029AD;"/>
+  <entity name="angmsdag" value="&#x029AE;"/>
+  <entity name="angmsdah" value="&#x029AF;"/>
+  <entity name="angrt" value="&#x0221F;"/>
+  <entity name="angrtvb" value="&#x0299D;&#x0FE00;"/>
+  <entity name="angrtvbd" value="&#x0299D;"/>
+  <entity name="angsph" value="&#x02222;"/>
+  <entity name="angst" value="&#x0212B;"/>
+  <entity name="angzarr" value="&#x0237C;"/>
+  <entity name="aogon" value="&#x00105;"/>
+  <entity name="Aogon" value="&#x00104;"/>
+  <entity name="aopf" value="&#x1D552;"/>
+  <entity name="Aopf" value="&#x1D538;"/>
+  <entity name="ap" value="&#x02248;"/>
+  <entity name="apacir" value="&#x02A6F;"/>
+  <entity name="ape" value="&#x0224A;"/>
+  <entity name="apE" value="&#x0224A;"/>
+  <entity name="apid" value="&#x0224B;"/>
+  <entity name="apos" value="&#x00027;"/>
+  <entity name="ApplyFunction" value="&#x02061;"/>
+  <entity name="approx" value="&#x02248;"/>
+  <entity name="approxeq" value="&#x0224A;"/>
+  <entity name="aring" value="&#x000E5;"/>
+  <entity name="Aring" value="&#x000C5;"/>
+  <entity name="ascr" value="&#x1D4B6;"/>
+  <entity name="Ascr" value="&#x1D49C;"/>
+  <entity name="Assign" value="&#x02254;"/>
+  <entity name="ast" value="&#x0002A;"/>
+  <entity name="asymp" value="&#x0224D;"/>
+  <entity name="atilde" value="&#x000E3;"/>
+  <entity name="Atilde" value="&#x000C3;"/>
+  <entity name="auml" value="&#x000E4;"/>
+  <entity name="Auml" value="&#x000C4;"/>
+  <entity name="awconint" value="&#x02233;"/>
+  <entity name="awint" value="&#x02A11;"/>
+  <entity name="backcong" value="&#x0224C;"/>
+  <entity name="backepsilon" value="&#x003F6;"/>
+  <entity name="backprime" value="&#x02035;"/>
+  <entity name="backsim" value="&#x0223D;"/>
+  <entity name="backsimeq" value="&#x022CD;"/>
+  <entity name="Backslash" value="&#x02216;"/>
+  <entity name="Barv" value="&#x02AE7;"/>
+  <entity name="barvee" value="&#x022BD;"/>
+  <entity name="barwed" value="&#x022BC;"/>
+  <entity name="Barwed" value="&#x02306;"/>
+  <entity name="barwedge" value="&#x022BC;"/>
+  <entity name="bbrk" value="&#x023B5;"/>
+  <entity name="bcong" value="&#x0224C;"/>
+  <entity name="bcy" value="&#x00431;"/>
+  <entity name="Bcy" value="&#x00411;"/>
+  <entity name="becaus" value="&#x02235;"/>
+  <entity name="because" value="&#x02235;"/>
+  <entity name="Because" value="&#x02235;"/>
+  <entity name="bemptyv" value="&#x029B0;"/>
+  <entity name="bepsi" value="&#x003F6;"/>
+  <entity name="bernou" value="&#x0212C;"/>
+  <entity name="Bernoullis" value="&#x0212C;"/>
+  <entity name="beta" value="&#x003B2;"/>
+  <entity name="beth" value="&#x02136;"/>
+  <entity name="between" value="&#x0226C;"/>
+  <entity name="bfr" value="&#x1D51F;"/>
+  <entity name="Bfr" value="&#x1D505;"/>
+  <entity name="bigcap" value="&#x022C2;"/>
+  <entity name="bigcirc" value="&#x025EF;"/>
+  <entity name="bigcup" value="&#x022C3;"/>
+  <entity name="bigodot" value="&#x02299;"/>
+  <entity name="bigoplus" value="&#x02295;"/>
+  <entity name="bigotimes" value="&#x02297;"/>
+  <entity name="bigsqcup" value="&#x02294;"/>
+  <entity name="bigstar" value="&#x02605;"/>
+  <entity name="bigtriangledown" value="&#x025BD;"/>
+  <entity name="bigtriangleup" value="&#x025B3;"/>
+  <entity name="biguplus" value="&#x0228E;"/>
+  <entity name="bigvee" value="&#x022C1;"/>
+  <entity name="bigwedge" value="&#x022C0;"/>
+  <entity name="bkarow" value="&#x0290D;"/>
+  <entity name="blacklozenge" value="&#x029EB;"/>
+  <entity name="blacksquare" value="&#x025AA;"/>
+  <entity name="blacktriangle" value="&#x025B4;"/>
+  <entity name="blacktriangledown" value="&#x025BE;"/>
+  <entity name="blacktriangleleft" value="&#x025C2;"/>
+  <entity name="blacktriangleright" value="&#x025B8;"/>
+  <entity name="blank" value="&#x02423;"/>
+  <entity name="blk12" value="&#x02592;"/>
+  <entity name="blk14" value="&#x02591;"/>
+  <entity name="blk34" value="&#x02593;"/>
+  <entity name="block" value="&#x02588;"/>
+  <entity name="bne" value="&#x0003D;&#x020E5;"/>
+  <entity name="bnequiv" value="&#x02261;&#x020E5;"/>
+  <entity name="bnot" value="&#x02310;"/>
+  <entity name="bNot" value="&#x02AED;"/>
+  <entity name="bopf" value="&#x1D553;"/>
+  <entity name="Bopf" value="&#x1D539;"/>
+  <entity name="bot" value="&#x022A5;"/>
+  <entity name="bottom" value="&#x022A5;"/>
+  <entity name="bowtie" value="&#x022C8;"/>
+  <entity name="boxbox" value="&#x029C9;"/>
+  <entity name="boxdl" value="&#x02510;"/>
+  <entity name="boxdL" value="&#x02555;"/>
+  <entity name="boxDl" value="&#x02556;"/>
+  <entity name="boxDL" value="&#x02557;"/>
+  <entity name="boxdr" value="&#x0250C;"/>
+  <entity name="boxdR" value="&#x02552;"/>
+  <entity name="boxDr" value="&#x02553;"/>
+  <entity name="boxDR" value="&#x02554;"/>
+  <entity name="boxh" value="&#x02500;"/>
+  <entity name="boxH" value="&#x02550;"/>
+  <entity name="boxhd" value="&#x0252C;"/>
+  <entity name="boxhD" value="&#x02565;"/>
+  <entity name="boxHd" value="&#x02564;"/>
+  <entity name="boxHD" value="&#x02566;"/>
+  <entity name="boxhu" value="&#x02534;"/>
+  <entity name="boxhU" value="&#x02568;"/>
+  <entity name="boxHu" value="&#x02567;"/>
+  <entity name="boxHU" value="&#x02569;"/>
+  <entity name="boxminus" value="&#x0229F;"/>
+  <entity name="boxplus" value="&#x0229E;"/>
+  <entity name="boxtimes" value="&#x022A0;"/>
+  <entity name="boxul" value="&#x02518;"/>
+  <entity name="boxuL" value="&#x0255B;"/>
+  <entity name="boxUl" value="&#x0255C;"/>
+  <entity name="boxUL" value="&#x0255D;"/>
+  <entity name="boxur" value="&#x02514;"/>
+  <entity name="boxuR" value="&#x02558;"/>
+  <entity name="boxUr" value="&#x02559;"/>
+  <entity name="boxUR" value="&#x0255A;"/>
+  <entity name="boxv" value="&#x02502;"/>
+  <entity name="boxV" value="&#x02551;"/>
+  <entity name="boxvh" value="&#x0253C;"/>
+  <entity name="boxvH" value="&#x0256A;"/>
+  <entity name="boxVh" value="&#x0256B;"/>
+  <entity name="boxVH" value="&#x0256C;"/>
+  <entity name="boxvl" value="&#x02524;"/>
+  <entity name="boxvL" value="&#x02561;"/>
+  <entity name="boxVl" value="&#x02562;"/>
+  <entity name="boxVL" value="&#x02563;"/>
+  <entity name="boxvr" value="&#x0251C;"/>
+  <entity name="boxvR" value="&#x0255E;"/>
+  <entity name="boxVr" value="&#x0255F;"/>
+  <entity name="boxVR" value="&#x02560;"/>
+  <entity name="bprime" value="&#x02035;"/>
+  <entity name="breve" value="&#x002D8;"/>
+  <entity name="Breve" value="&#x002D8;"/>
+  <entity name="brvbar" value="&#x000A6;"/>
+  <entity name="bscr" value="&#x1D4B7;"/>
+  <entity name="Bscr" value="&#x0212C;"/>
+  <entity name="bsemi" value="&#x0204F;"/>
+  <entity name="bsim" value="&#x0223D;"/>
+  <entity name="bsime" value="&#x022CD;"/>
+  <entity name="bsol" value="&#x0005C;"/>
+  <entity name="bsolb" value="&#x029C5;"/>
+  <entity name="bsolhsub" value="&#x0005C;&#x02282;"/>
+  <entity name="bull" value="&#x02022;"/>
+  <entity name="bullet" value="&#x02022;"/>
+  <entity name="bump" value="&#x0224E;"/>
+  <entity name="bumpe" value="&#x0224F;"/>
+  <entity name="bumpE" value="&#x02AAE;"/>
+  <entity name="bumpeq" value="&#x0224F;"/>
+  <entity name="Bumpeq" value="&#x0224E;"/>
+  <entity name="cacute" value="&#x00107;"/>
+  <entity name="Cacute" value="&#x00106;"/>
+  <entity name="cap" value="&#x02229;"/>
+  <entity name="Cap" value="&#x022D2;"/>
+  <entity name="capand" value="&#x02A44;"/>
+  <entity name="capbrcup" value="&#x02A49;"/>
+  <entity name="capcap" value="&#x02A4B;"/>
+  <entity name="capcup" value="&#x02A47;"/>
+  <entity name="capdot" value="&#x02A40;"/>
+  <entity name="CapitalDifferentialD" value="&#x02145;"/>
+  <entity name="caps" value="&#x02229;&#x0FE00;"/>
+  <entity name="caret" value="&#x02041;"/>
+  <entity name="caron" value="&#x002C7;"/>
+  <entity name="Cayleys" value="&#x0212D;"/>
+  <entity name="ccaps" value="&#x02A4D;"/>
+  <entity name="ccaron" value="&#x0010D;"/>
+  <entity name="Ccaron" value="&#x0010C;"/>
+  <entity name="ccedil" value="&#x000E7;"/>
+  <entity name="Ccedil" value="&#x000C7;"/>
+  <entity name="ccirc" value="&#x00109;"/>
+  <entity name="Ccirc" value="&#x00108;"/>
+  <entity name="Cconint" value="&#x02230;"/>
+  <entity name="ccups" value="&#x02A4C;"/>
+  <entity name="ccupssm" value="&#x02A50;"/>
+  <entity name="cdot" value="&#x0010B;"/>
+  <entity name="Cdot" value="&#x0010A;"/>
+  <entity name="cedil" value="&#x000B8;"/>
+  <entity name="Cedilla" value="&#x000B8;"/>
+  <entity name="cemptyv" value="&#x029B2;"/>
+  <entity name="cent" value="&#x000A2;"/>
+  <entity name="centerdot" value="&#x000B7;"/>
+  <entity name="CenterDot" value="&#x000B7;"/>
+  <entity name="cfr" value="&#x1D520;"/>
+  <entity name="Cfr" value="&#x0212D;"/>
+  <entity name="chcy" value="&#x00447;"/>
+  <entity name="CHcy" value="&#x00427;"/>
+  <entity name="check" value="&#x02713;"/>
+  <entity name="checkmark" value="&#x02713;"/>
+  <entity name="chi" value="&#x003C7;"/>
+  <entity name="cir" value="&#x025CB;"/>
+  <entity name="circ" value="&#x0005E;"/>
+  <entity name="circeq" value="&#x02257;"/>
+  <entity name="circlearrowleft" value="&#x021BA;"/>
+  <entity name="circlearrowright" value="&#x021BB;"/>
+  <entity name="circledast" value="&#x0229B;"/>
+  <entity name="circledcirc" value="&#x0229A;"/>
+  <entity name="circleddash" value="&#x0229D;"/>
+  <entity name="CircleDot" value="&#x02299;"/>
+  <entity name="circledR" value="&#x000AE;"/>
+  <entity name="circledS" value="&#x024C8;"/>
+  <entity name="CircleMinus" value="&#x02296;"/>
+  <entity name="CirclePlus" value="&#x02295;"/>
+  <entity name="CircleTimes" value="&#x02297;"/>
+  <entity name="cire" value="&#x02257;"/>
+  <entity name="cirE" value="&#x029C3;"/>
+  <entity name="cirfnint" value="&#x02A10;"/>
+  <entity name="cirmid" value="&#x02AEF;"/>
+  <entity name="cirscir" value="&#x029C2;"/>
+  <entity name="ClockwiseContourIntegral" value="&#x02232;"/>
+  <entity name="CloseCurlyDoubleQuote" value="&#x0201D;"/>
+  <entity name="CloseCurlyQuote" value="&#x02019;"/>
+  <entity name="clubs" value="&#x02663;"/>
+  <entity name="clubsuit" value="&#x02663;"/>
+  <entity name="colon" value="&#x0003A;"/>
+  <entity name="Colon" value="&#x02237;"/>
+  <entity name="colone" value="&#x02254;"/>
+  <entity name="Colone" value="&#x02A74;"/>
+  <entity name="coloneq" value="&#x02254;"/>
+  <entity name="comma" value="&#x0002C;"/>
+  <entity name="commat" value="&#x00040;"/>
+  <entity name="comp" value="&#x02201;"/>
+  <entity name="compfn" value="&#x02218;"/>
+  <entity name="complement" value="&#x02201;"/>
+  <entity name="complexes" value="&#x02102;"/>
+  <entity name="cong" value="&#x02245;"/>
+  <entity name="congdot" value="&#x02A6D;"/>
+  <entity name="Congruent" value="&#x02261;"/>
+  <entity name="conint" value="&#x0222E;"/>
+  <entity name="Conint" value="&#x0222F;"/>
+  <entity name="ContourIntegral" value="&#x0222E;"/>
+  <entity name="copf" value="&#x1D554;"/>
+  <entity name="Copf" value="&#x02102;"/>
+  <entity name="coprod" value="&#x02210;"/>
+  <entity name="Coproduct" value="&#x02210;"/>
+  <entity name="copy" value="&#x000A9;"/>
+  <entity name="copysr" value="&#x02117;"/>
+  <entity name="CounterClockwiseContourIntegral" value="&#x02233;"/>
+  <entity name="cross" value="&#x02717;"/>
+  <entity name="Cross" value="&#x02A2F;"/>
+  <entity name="cscr" value="&#x1D4B8;"/>
+  <entity name="Cscr" value="&#x1D49E;"/>
+  <entity name="csub" value="&#x02ACF;"/>
+  <entity name="csube" value="&#x02AD1;"/>
+  <entity name="csup" value="&#x02AD0;"/>
+  <entity name="csupe" value="&#x02AD2;"/>
+  <entity name="ctdot" value="&#x022EF;"/>
+  <entity name="cudarrl" value="&#x02938;"/>
+  <entity name="cudarrr" value="&#x02935;"/>
+  <entity name="cuepr" value="&#x022DE;"/>
+  <entity name="cuesc" value="&#x022DF;"/>
+  <entity name="cularr" value="&#x021B6;"/>
+  <entity name="cularrp" value="&#x0293D;"/>
+  <entity name="cup" value="&#x0222A;"/>
+  <entity name="Cup" value="&#x022D3;"/>
+  <entity name="cupbrcap" value="&#x02A48;"/>
+  <entity name="cupcap" value="&#x02A46;"/>
+  <entity name="CupCap" value="&#x0224D;"/>
+  <entity name="cupcup" value="&#x02A4A;"/>
+  <entity name="cupdot" value="&#x0228D;"/>
+  <entity name="cupor" value="&#x02A45;"/>
+  <entity name="cups" value="&#x0222A;&#x0FE00;"/>
+  <entity name="curarr" value="&#x021B7;"/>
+  <entity name="curarrm" value="&#x0293C;"/>
+  <entity name="curlyeqprec" value="&#x022DE;"/>
+  <entity name="curlyeqsucc" value="&#x022DF;"/>
+  <entity name="curlyvee" value="&#x022CE;"/>
+  <entity name="curlywedge" value="&#x022CF;"/>
+  <entity name="curren" value="&#x000A4;"/>
+  <entity name="curvearrowleft" value="&#x021B6;"/>
+  <entity name="curvearrowright" value="&#x021B7;"/>
+  <entity name="cuvee" value="&#x022CE;"/>
+  <entity name="cuwed" value="&#x022CF;"/>
+  <entity name="cwconint" value="&#x02232;"/>
+  <entity name="cwint" value="&#x02231;"/>
+  <entity name="cylcty" value="&#x0232D;"/>
+  <entity name="dagger" value="&#x02020;"/>
+  <entity name="dagger" value="&#x02020;"/>
+  <entity name="Dagger" value="&#x02021;"/>
+  <entity name="Dagger" value="&#x02021;"/>
+  <entity name="daleth" value="&#x02138;"/>
+  <entity name="darr" value="&#x02193;"/>
+  <entity name="dArr" value="&#x021D3;"/>
+  <entity name="Darr" value="&#x021A1;"/>
+  <entity name="dash" value="&#x02010;"/>
+  <entity name="dashv" value="&#x022A3;"/>
+  <entity name="Dashv" value="&#x02AE4;"/>
+  <entity name="dbkarow" value="&#x0290F;"/>
+  <entity name="dblac" value="&#x002DD;"/>
+  <entity name="dcaron" value="&#x0010F;"/>
+  <entity name="Dcaron" value="&#x0010E;"/>
+  <entity name="dcy" value="&#x00434;"/>
+  <entity name="Dcy" value="&#x00414;"/>
+  <entity name="dd" value="&#x02146;"/>
+  <entity name="DD" value="&#x02145;"/>
+  <entity name="ddagger" value="&#x02021;"/>
+  <entity name="ddarr" value="&#x021CA;"/>
+  <entity name="DDotrahd" value="&#x02911;"/>
+  <entity name="ddotseq" value="&#x02A77;"/>
+  <entity name="deg" value="&#x000B0;"/>
+  <entity name="Del" value="&#x02207;"/>
+  <entity name="delta" value="&#x003B4;"/>
+  <entity name="Delta" value="&#x00394;"/>
+  <entity name="demptyv" value="&#x029B1;"/>
+  <entity name="dfisht" value="&#x0297F;"/>
+  <entity name="dfr" value="&#x1D521;"/>
+  <entity name="Dfr" value="&#x1D507;"/>
+  <entity name="dHar" value="&#x02965;"/>
+  <entity name="dharl" value="&#x021C3;"/>
+  <entity name="dharr" value="&#x021C2;"/>
+  <entity name="DiacriticalAcute" value="&#x000B4;"/>
+  <entity name="DiacriticalDot" value="&#x002D9;"/>
+  <entity name="DiacriticalDoubleAcute" value="&#x002DD;"/>
+  <entity name="DiacriticalGrave" value="&#x00060;"/>
+  <entity name="DiacriticalTilde" value="&#x002DC;"/>
+  <entity name="diam" value="&#x022C4;"/>
+  <entity name="diamond" value="&#x022C4;"/>
+  <entity name="Diamond" value="&#x022C4;"/>
+  <entity name="diamondsuit" value="&#x02666;"/>
+  <entity name="diams" value="&#x02666;"/>
+  <entity name="die" value="&#x000A8;"/>
+  <entity name="DifferentialD" value="&#x02146;"/>
+  <entity name="digamma" value="&#x003DC;"/>
+  <entity name="disin" value="&#x022F2;"/>
+  <entity name="div" value="&#x000F7;"/>
+  <entity name="divide" value="&#x000F7;"/>
+  <entity name="divideontimes" value="&#x022C7;"/>
+  <entity name="divonx" value="&#x022C7;"/>
+  <entity name="djcy" value="&#x00452;"/>
+  <entity name="DJcy" value="&#x00402;"/>
+  <entity name="dlcorn" value="&#x0231E;"/>
+  <entity name="dlcrop" value="&#x0230D;"/>
+  <entity name="dollar" value="&#x00024;"/>
+  <entity name="dopf" value="&#x1D555;"/>
+  <entity name="Dopf" value="&#x1D53B;"/>
+  <entity name="dot" value="&#x002D9;"/>
+  <entity name="Dot" value="&#x000A8;"/>
+  <entity name="DotDot" value="&#x020DC;"/>
+  <entity name="doteq" value="&#x02250;"/>
+  <entity name="doteqdot" value="&#x02251;"/>
+  <entity name="DotEqual" value="&#x02250;"/>
+  <entity name="dotminus" value="&#x02238;"/>
+  <entity name="dotplus" value="&#x02214;"/>
+  <entity name="dotsquare" value="&#x022A1;"/>
+  <entity name="doublebarwedge" value="&#x02306;"/>
+  <entity name="DoubleContourIntegral" value="&#x0222F;"/>
+  <entity name="DoubleDot" value="&#x000A8;"/>
+  <entity name="DoubleDownArrow" value="&#x021D3;"/>
+  <entity name="DoubleLeftArrow" value="&#x021D0;"/>
+  <entity name="DoubleLeftRightArrow" value="&#x021D4;"/>
+  <entity name="DoubleLeftTee" value="&#x02AE4;"/>
+  <entity name="DoubleLongLeftArrow" value="&#x0F579;"/>
+  <entity name="DoubleLongLeftRightArrow" value="&#x0F57B;"/>
+  <entity name="DoubleLongRightArrow" value="&#x0F57A;"/>
+  <entity name="DoubleRightArrow" value="&#x021D2;"/>
+  <entity name="DoubleRightTee" value="&#x022A8;"/>
+  <entity name="DoubleUpArrow" value="&#x021D1;"/>
+  <entity name="DoubleUpDownArrow" value="&#x021D5;"/>
+  <entity name="DoubleVerticalBar" value="&#x02225;"/>
+  <entity name="downarrow" value="&#x02193;"/>
+  <entity name="Downarrow" value="&#x021D3;"/>
+  <entity name="DownArrow" value="&#x02193;"/>
+  <entity name="DownArrowBar" value="&#x02913;"/>
+  <entity name="DownArrowUpArrow" value="&#x021F5;"/>
+  <entity name="DownBreve" value="&#x00311;"/>
+  <entity name="downdownarrows" value="&#x021CA;"/>
+  <entity name="downharpoonleft" value="&#x021C3;"/>
+  <entity name="downharpoonright" value="&#x021C2;"/>
+  <entity name="DownLeftRightVector" value="&#x02950;"/>
+  <entity name="DownLeftTeeVector" value="&#x0295E;"/>
+  <entity name="DownLeftVector" value="&#x021BD;"/>
+  <entity name="DownLeftVectorBar" value="&#x02956;"/>
+  <entity name="DownRightTeeVector" value="&#x0295F;"/>
+  <entity name="DownRightVector" value="&#x021C1;"/>
+  <entity name="DownRightVectorBar" value="&#x02957;"/>
+  <entity name="DownTee" value="&#x022A4;"/>
+  <entity name="DownTeeArrow" value="&#x021A7;"/>
+  <entity name="drbkarow" value="&#x02910;"/>
+  <entity name="drcorn" value="&#x0231F;"/>
+  <entity name="drcrop" value="&#x0230C;"/>
+  <entity name="dscr" value="&#x1D4B9;"/>
+  <entity name="Dscr" value="&#x1D49F;"/>
+  <entity name="dscy" value="&#x00455;"/>
+  <entity name="DScy" value="&#x00405;"/>
+  <entity name="dsol" value="&#x029F6;"/>
+  <entity name="dstrok" value="&#x00111;"/>
+  <entity name="Dstrok" value="&#x00110;"/>
+  <entity name="dtdot" value="&#x022F1;"/>
+  <entity name="dtri" value="&#x025BF;"/>
+  <entity name="dtrif" value="&#x025BE;"/>
+  <entity name="duarr" value="&#x021F5;"/>
+  <entity name="duhar" value="&#x0296F;"/>
+  <entity name="dwangle" value="&#x029A6;"/>
+  <entity name="dzcy" value="&#x0045F;"/>
+  <entity name="DZcy" value="&#x0040F;"/>
+  <entity name="dzigrarr" value="&#x0F5A2;"/>
+  <entity name="eacute" value="&#x000E9;"/>
+  <entity name="Eacute" value="&#x000C9;"/>
+  <entity name="easter" value="&#x0225B;"/>
+  <entity name="ecaron" value="&#x0011B;"/>
+  <entity name="Ecaron" value="&#x0011A;"/>
+  <entity name="ecir" value="&#x02256;"/>
+  <entity name="ecirc" value="&#x000EA;"/>
+  <entity name="Ecirc" value="&#x000CA;"/>
+  <entity name="ecolon" value="&#x02255;"/>
+  <entity name="ecy" value="&#x0044D;"/>
+  <entity name="Ecy" value="&#x0042D;"/>
+  <entity name="eDDot" value="&#x02A77;"/>
+  <entity name="edot" value="&#x00117;"/>
+  <entity name="eDot" value="&#x02251;"/>
+  <entity name="Edot" value="&#x00116;"/>
+  <entity name="ee" value="&#x02147;"/>
+  <entity name="efDot" value="&#x02252;"/>
+  <entity name="efr" value="&#x1D522;"/>
+  <entity name="Efr" value="&#x1D508;"/>
+  <entity name="eg" value="&#x02A9A;"/>
+  <entity name="egrave" value="&#x000E8;"/>
+  <entity name="Egrave" value="&#x000C8;"/>
+  <entity name="egs" value="&#x022DD;"/>
+  <entity name="egsdot" value="&#x02A98;"/>
+  <entity name="el" value="&#x02A99;"/>
+  <entity name="Element" value="&#x02208;"/>
+  <entity name="ell" value="&#x02113;"/>
+  <entity name="els" value="&#x022DC;"/>
+  <entity name="elsdot" value="&#x02A97;"/>
+  <entity name="emacr" value="&#x00113;"/>
+  <entity name="Emacr" value="&#x00112;"/>
+  <entity name="empty" value="&#x02205;&#x0FE00;"/>
+  <entity name="emptyset" value="&#x02205;&#x0FE00;"/>
+  <entity name="EmptySmallSquare" value="&#x025FD;"/>
+  <entity name="emptyv" value="&#x02205;"/>
+  <entity name="EmptyVerySmallSquare" value="&#x0F59C;"/>
+  <entity name="emsp" value="&#x02003;"/>
+  <entity name="emsp13" value="&#x02004;"/>
+  <entity name="emsp14" value="&#x02005;"/>
+  <entity name="eng" value="&#x0014B;"/>
+  <entity name="ENG" value="&#x0014A;"/>
+  <entity name="ensp" value="&#x02002;"/>
+  <entity name="eogon" value="&#x00119;"/>
+  <entity name="Eogon" value="&#x00118;"/>
+  <entity name="eopf" value="&#x1D556;"/>
+  <entity name="Eopf" value="&#x1D53C;"/>
+  <entity name="epar" value="&#x022D5;"/>
+  <entity name="eparsl" value="&#x029E3;"/>
+  <entity name="eplus" value="&#x02A71;"/>
+  <entity name="epsi" value="&#x003B5;"/>
+  <entity name="epsiv" value="&#x0025B;"/>
+  <entity name="eqcirc" value="&#x02256;"/>
+  <entity name="eqcolon" value="&#x02255;"/>
+  <entity name="eqsim" value="&#x02242;"/>
+  <entity name="eqslantgtr" value="&#x022DD;"/>
+  <entity name="eqslantless" value="&#x022DC;"/>
+  <entity name="Equal" value="&#x02A75;"/>
+  <entity name="equals" value="&#x0003D;"/>
+  <entity name="EqualTilde" value="&#x02242;"/>
+  <entity name="equest" value="&#x0225F;"/>
+  <entity name="Equilibrium" value="&#x021CC;"/>
+  <entity name="equiv" value="&#x02261;"/>
+  <entity name="equivDD" value="&#x02A78;"/>
+  <entity name="eqvparsl" value="&#x029E5;"/>
+  <entity name="erarr" value="&#x02971;"/>
+  <entity name="erDot" value="&#x02253;"/>
+  <entity name="escr" value="&#x0212F;"/>
+  <entity name="Escr" value="&#x02130;"/>
+  <entity name="esdot" value="&#x02250;"/>
+  <entity name="esim" value="&#x02242;"/>
+  <entity name="Esim" value="&#x02A73;"/>
+  <entity name="eta" value="&#x003B7;"/>
+  <entity name="eth" value="&#x000F0;"/>
+  <entity name="ETH" value="&#x000D0;"/>
+  <entity name="euml" value="&#x000EB;"/>
+  <entity name="Euml" value="&#x000CB;"/>
+  <entity name="excl" value="&#x00021;"/>
+  <entity name="exist" value="&#x02203;"/>
+  <entity name="Exists" value="&#x02203;"/>
+  <entity name="expectation" value="&#x02130;"/>
+  <entity name="exponentiale" value="&#x02147;"/>
+  <entity name="ExponentialE" value="&#x02147;"/>
+  <entity name="fallingdotseq" value="&#x02252;"/>
+  <entity name="fcy" value="&#x00444;"/>
+  <entity name="Fcy" value="&#x00424;"/>
+  <entity name="female" value="&#x02640;"/>
+  <entity name="ffilig" value="&#x0FB03;"/>
+  <entity name="fflig" value="&#x0FB00;"/>
+  <entity name="ffllig" value="&#x0FB04;"/>
+  <entity name="ffr" value="&#x1D523;"/>
+  <entity name="Ffr" value="&#x1D509;"/>
+  <entity name="filig" value="&#x0FB01;"/>
+  <entity name="FilledSmallSquare" value="&#x025FE;"/>
+  <entity name="FilledVerySmallSquare" value="&#x0F59B;"/>
+  <entity name="flat" value="&#x0266D;"/>
+  <entity name="fllig" value="&#x0FB02;"/>
+  <entity name="fnof" value="&#x00192;"/>
+  <entity name="fopf" value="&#x1D557;"/>
+  <entity name="Fopf" value="&#x1D53D;"/>
+  <entity name="forall" value="&#x02200;"/>
+  <entity name="ForAll" value="&#x02200;"/>
+  <entity name="fork" value="&#x022D4;"/>
+  <entity name="forkv" value="&#x02AD9;"/>
+  <entity name="Fouriertrf" value="&#x02131;"/>
+  <entity name="fpartint" value="&#x02A0D;"/>
+  <entity name="frac12" value="&#x000BD;"/>
+  <entity name="frac13" value="&#x02153;"/>
+  <entity name="frac14" value="&#x000BC;"/>
+  <entity name="frac15" value="&#x02155;"/>
+  <entity name="frac16" value="&#x02159;"/>
+  <entity name="frac18" value="&#x0215B;"/>
+  <entity name="frac23" value="&#x02154;"/>
+  <entity name="frac25" value="&#x02156;"/>
+  <entity name="frac34" value="&#x000BE;"/>
+  <entity name="frac35" value="&#x02157;"/>
+  <entity name="frac38" value="&#x0215C;"/>
+  <entity name="frac45" value="&#x02158;"/>
+  <entity name="frac56" value="&#x0215A;"/>
+  <entity name="frac58" value="&#x0215D;"/>
+  <entity name="frac78" value="&#x0215E;"/>
+  <entity name="frown" value="&#x02322;"/>
+  <entity name="fscr" value="&#x1D4BB;"/>
+  <entity name="Fscr" value="&#x02131;"/>
+  <entity name="gacute" value="&#x001F5;"/>
+  <entity name="gamma" value="&#x003B3;"/>
+  <entity name="Gamma" value="&#x00393;"/>
+  <entity name="gammad" value="&#x003DC;"/>
+  <entity name="Gammad" value="&#x003DC;"/>
+  <entity name="gap" value="&#x02273;"/>
+  <entity name="gbreve" value="&#x0011F;"/>
+  <entity name="Gbreve" value="&#x0011E;"/>
+  <entity name="Gcedil" value="&#x00122;"/>
+  <entity name="gcirc" value="&#x0011D;"/>
+  <entity name="Gcirc" value="&#x0011C;"/>
+  <entity name="gcy" value="&#x00433;"/>
+  <entity name="Gcy" value="&#x00413;"/>
+  <entity name="gdot" value="&#x00121;"/>
+  <entity name="Gdot" value="&#x00120;"/>
+  <entity name="ge" value="&#x02265;"/>
+  <entity name="gE" value="&#x02267;"/>
+  <entity name="gel" value="&#x022DB;"/>
+  <entity name="gEl" value="&#x022DB;"/>
+  <entity name="geq" value="&#x02265;"/>
+  <entity name="geqq" value="&#x02267;"/>
+  <entity name="geqslant" value="&#x02A7E;"/>
+  <entity name="ges" value="&#x02A7E;"/>
+  <entity name="gescc" value="&#x02AA9;"/>
+  <entity name="gesdot" value="&#x02A80;"/>
+  <entity name="gesdoto" value="&#x02A82;"/>
+  <entity name="gesdotol" value="&#x02A84;"/>
+  <entity name="gesl" value="&#x022DB;&#x0FE00;"/>
+  <entity name="gesles" value="&#x02A94;"/>
+  <entity name="gfr" value="&#x1D524;"/>
+  <entity name="Gfr" value="&#x1D50A;"/>
+  <entity name="gg" value="&#x0226B;"/>
+  <entity name="Gg" value="&#x022D9;"/>
+  <entity name="ggg" value="&#x022D9;"/>
+  <entity name="gimel" value="&#x02137;"/>
+  <entity name="gjcy" value="&#x00453;"/>
+  <entity name="GJcy" value="&#x00403;"/>
+  <entity name="gl" value="&#x02277;"/>
+  <entity name="gla" value="&#x02AA5;"/>
+  <entity name="glE" value="&#x02A92;"/>
+  <entity name="glj" value="&#x02AA4;"/>
+  <entity name="gnap" value="&#x02A8A;"/>
+  <entity name="gnapprox" value="&#x02A8A;"/>
+  <entity name="gne" value="&#x02269;"/>
+  <entity name="gnE" value="&#x02269;"/>
+  <entity name="gneq" value="&#x02269;"/>
+  <entity name="gneqq" value="&#x02269;"/>
+  <entity name="gnsim" value="&#x022E7;"/>
+  <entity name="gopf" value="&#x1D558;"/>
+  <entity name="Gopf" value="&#x1D53E;"/>
+  <entity name="grave" value="&#x00060;"/>
+  <entity name="GreaterEqual" value="&#x02265;"/>
+  <entity name="GreaterEqualLess" value="&#x022DB;"/>
+  <entity name="GreaterFullEqual" value="&#x02267;"/>
+  <entity name="GreaterGreater" value="&#x02AA2;"/>
+  <entity name="GreaterLess" value="&#x02277;"/>
+  <entity name="GreaterSlantEqual" value="&#x02A7E;"/>
+  <entity name="GreaterTilde" value="&#x02273;"/>
+  <entity name="gscr" value="&#x0210A;"/>
+  <entity name="Gscr" value="&#x1D4A2;"/>
+  <entity name="gsim" value="&#x02273;"/>
+  <entity name="gsime" value="&#x02A8E;"/>
+  <entity name="gsiml" value="&#x02A90;"/>
+  <entity name="gt" value="&#x0003E;"/>
+  <entity name="Gt" value="&#x0226B;"/>
+  <entity name="gtcc" value="&#x02AA7;"/>
+  <entity name="gtcir" value="&#x02A7A;"/>
+  <entity name="gtdot" value="&#x022D7;"/>
+  <entity name="gtlPar" value="&#x02995;"/>
+  <entity name="gtquest" value="&#x02A7C;"/>
+  <entity name="gtrapprox" value="&#x02273;"/>
+  <entity name="gtrarr" value="&#x02978;"/>
+  <entity name="gtrdot" value="&#x022D7;"/>
+  <entity name="gtreqless" value="&#x022DB;"/>
+  <entity name="gtreqqless" value="&#x022DB;"/>
+  <entity name="gtrless" value="&#x02277;"/>
+  <entity name="gtrsim" value="&#x02273;"/>
+  <entity name="gvertneqq" value="&#x02269;&#x0FE00;"/>
+  <entity name="gvnE" value="&#x02269;&#x0FE00;"/>
+  <entity name="Hacek" value="&#x002C7;"/>
+  <entity name="hairsp" value="&#x0200A;"/>
+  <entity name="half" value="&#x000BD;"/>
+  <entity name="hamilt" value="&#x0210B;"/>
+  <entity name="hardcy" value="&#x0044A;"/>
+  <entity name="HARDcy" value="&#x0042A;"/>
+  <entity name="harr" value="&#x02194;"/>
+  <entity name="hArr" value="&#x021D4;"/>
+  <entity name="harrcir" value="&#x02948;"/>
+  <entity name="harrw" value="&#x021AD;"/>
+  <entity name="Hat" value="&#x00302;"/>
+  <entity name="hbar" value="&#x0210F;&#x0FE00;"/>
+  <entity name="hcirc" value="&#x00125;"/>
+  <entity name="Hcirc" value="&#x00124;"/>
+  <entity name="heartsuit" value="&#x02661;"/>
+  <entity name="hellip" value="&#x02026;"/>
+  <entity name="hercon" value="&#x022B9;"/>
+  <entity name="hfr" value="&#x1D525;"/>
+  <entity name="Hfr" value="&#x0210C;"/>
+  <entity name="HilbertSpace" value="&#x0210B;"/>
+  <entity name="hksearow" value="&#x02925;"/>
+  <entity name="hkswarow" value="&#x02926;"/>
+  <entity name="hoarr" value="&#x021FF;"/>
+  <entity name="homtht" value="&#x0223B;"/>
+  <entity name="hookleftarrow" value="&#x021A9;"/>
+  <entity name="hookrightarrow" value="&#x021AA;"/>
+  <entity name="hopf" value="&#x1D559;"/>
+  <entity name="Hopf" value="&#x0210D;"/>
+  <entity name="horbar" value="&#x02015;"/>
+  <entity name="HorizontalLine" value="&#x02500;"/>
+  <entity name="hscr" value="&#x1D4BD;"/>
+  <entity name="Hscr" value="&#x0210B;"/>
+  <entity name="hslash" value="&#x0210F;"/>
+  <entity name="hstrok" value="&#x00127;"/>
+  <entity name="Hstrok" value="&#x00126;"/>
+  <entity name="HumpDownHump" value="&#x0224E;"/>
+  <entity name="HumpEqual" value="&#x0224F;"/>
+  <entity name="hybull" value="&#x02043;"/>
+  <entity name="hyphen" value="&#x02010;"/>
+  <entity name="iacute" value="&#x000ED;"/>
+  <entity name="Iacute" value="&#x000CD;"/>
+  <entity name="ic" value="&#x0200B;"/>
+  <entity name="icirc" value="&#x000EE;"/>
+  <entity name="Icirc" value="&#x000CE;"/>
+  <entity name="icy" value="&#x00438;"/>
+  <entity name="Icy" value="&#x00418;"/>
+  <entity name="Idot" value="&#x00130;"/>
+  <entity name="iecy" value="&#x00435;"/>
+  <entity name="IEcy" value="&#x00415;"/>
+  <entity name="iexcl" value="&#x000A1;"/>
+  <entity name="iff" value="&#x021D4;"/>
+  <entity name="ifr" value="&#x1D526;"/>
+  <entity name="Ifr" value="&#x02111;"/>
+  <entity name="igrave" value="&#x000EC;"/>
+  <entity name="Igrave" value="&#x000CC;"/>
+  <entity name="ii" value="&#x02148;"/>
+  <entity name="iiiint" value="&#x02A0C;"/>
+  <entity name="iiint" value="&#x0222D;"/>
+  <entity name="iinfin" value="&#x029DC;"/>
+  <entity name="iiota" value="&#x02129;"/>
+  <entity name="ijlig" value="&#x00133;"/>
+  <entity name="IJlig" value="&#x00132;"/>
+  <entity name="Im" value="&#x02111;"/>
+  <entity name="imacr" value="&#x0012B;"/>
+  <entity name="Imacr" value="&#x0012A;"/>
+  <entity name="image" value="&#x02111;"/>
+  <entity name="ImaginaryI" value="&#x02148;"/>
+  <entity name="imagline" value="&#x02110;"/>
+  <entity name="imagpart" value="&#x02111;"/>
+  <entity name="imath" value="&#x00131;"/>
+  <entity name="imof" value="&#x022B7;"/>
+  <entity name="imped" value="&#x1D543;"/>
+  <entity name="Implies" value="&#x021D2;"/>
+  <entity name="in" value="&#x02208;"/>
+  <entity name="incare" value="&#x02105;"/>
+  <entity name="infin" value="&#x0221E;"/>
+  <entity name="inodot" value="&#x00131;"/>
+  <entity name="int" value="&#x0222B;"/>
+  <entity name="Int" value="&#x0222C;"/>
+  <entity name="intcal" value="&#x022BA;"/>
+  <entity name="integers" value="&#x02124;"/>
+  <entity name="Integral" value="&#x0222B;"/>
+  <entity name="intercal" value="&#x022BA;"/>
+  <entity name="Intersection" value="&#x022C2;"/>
+  <entity name="intlarhk" value="&#x02A17;"/>
+  <entity name="intprod" value="&#x02A3C;"/>
+  <entity name="InvisibleComma" value="&#x0200B;"/>
+  <entity name="InvisibleTimes" value="&#x02062;"/>
+  <entity name="iocy" value="&#x00451;"/>
+  <entity name="IOcy" value="&#x00401;"/>
+  <entity name="iogon" value="&#x0012F;"/>
+  <entity name="Iogon" value="&#x0012E;"/>
+  <entity name="iopf" value="&#x1D55A;"/>
+  <entity name="Iopf" value="&#x1D540;"/>
+  <entity name="iota" value="&#x003B9;"/>
+  <entity name="iprod" value="&#x02A3C;"/>
+  <entity name="iquest" value="&#x000BF;"/>
+  <entity name="iscr" value="&#x1D4BE;"/>
+  <entity name="Iscr" value="&#x02110;"/>
+  <entity name="isin" value="&#x02208;"/>
+  <entity name="isindot" value="&#x022F5;"/>
+  <entity name="isinE" value="&#x022F9;"/>
+  <entity name="isins" value="&#x022F4;"/>
+  <entity name="isinsv" value="&#x022F3;"/>
+  <entity name="isinv" value="&#x02208;"/>
+  <entity name="it" value="&#x02062;"/>
+  <entity name="itilde" value="&#x00129;"/>
+  <entity name="Itilde" value="&#x00128;"/>
+  <entity name="iukcy" value="&#x00456;"/>
+  <entity name="Iukcy" value="&#x00406;"/>
+  <entity name="iuml" value="&#x000EF;"/>
+  <entity name="Iuml" value="&#x000CF;"/>
+  <entity name="jcirc" value="&#x00135;"/>
+  <entity name="Jcirc" value="&#x00134;"/>
+  <entity name="jcy" value="&#x00439;"/>
+  <entity name="Jcy" value="&#x00419;"/>
+  <entity name="jfr" value="&#x1D527;"/>
+  <entity name="Jfr" value="&#x1D50D;"/>
+  <entity name="jmath" value="&#x0006A;&#x0FE00;"/>
+  <entity name="jopf" value="&#x1D55B;"/>
+  <entity name="Jopf" value="&#x1D541;"/>
+  <entity name="jscr" value="&#x1D4BF;"/>
+  <entity name="Jscr" value="&#x1D4A5;"/>
+  <entity name="jsercy" value="&#x00458;"/>
+  <entity name="Jsercy" value="&#x00408;"/>
+  <entity name="jukcy" value="&#x00454;"/>
+  <entity name="Jukcy" value="&#x00404;"/>
+  <entity name="kappa" value="&#x003BA;"/>
+  <entity name="kappav" value="&#x003F0;"/>
+  <entity name="kcedil" value="&#x00137;"/>
+  <entity name="Kcedil" value="&#x00136;"/>
+  <entity name="kcy" value="&#x0043A;"/>
+  <entity name="Kcy" value="&#x0041A;"/>
+  <entity name="kfr" value="&#x1D528;"/>
+  <entity name="Kfr" value="&#x1D50E;"/>
+  <entity name="kgreen" value="&#x00138;"/>
+  <entity name="khcy" value="&#x00445;"/>
+  <entity name="KHcy" value="&#x00425;"/>
+  <entity name="kjcy" value="&#x0045C;"/>
+  <entity name="KJcy" value="&#x0040C;"/>
+  <entity name="kopf" value="&#x1D55C;"/>
+  <entity name="Kopf" value="&#x1D542;"/>
+  <entity name="kscr" value="&#x1D4C0;"/>
+  <entity name="Kscr" value="&#x1D4A6;"/>
+  <entity name="lAarr" value="&#x021DA;"/>
+  <entity name="lacute" value="&#x0013A;"/>
+  <entity name="Lacute" value="&#x00139;"/>
+  <entity name="laemptyv" value="&#x029B4;"/>
+  <entity name="lagran" value="&#x02112;"/>
+  <entity name="lambda" value="&#x003BB;"/>
+  <entity name="Lambda" value="&#x0039B;"/>
+  <entity name="lang" value="&#x02329;"/>
+  <entity name="Lang" value="&#x0300A;"/>
+  <entity name="langd" value="&#x02991;"/>
+  <entity name="langle" value="&#x02329;"/>
+  <entity name="lap" value="&#x02272;"/>
+  <entity name="Laplacetrf" value="&#x02112;"/>
+  <entity name="laquo" value="&#x000AB;"/>
+  <entity name="larr" value="&#x02190;"/>
+  <entity name="lArr" value="&#x021D0;"/>
+  <entity name="Larr" value="&#x0219E;"/>
+  <entity name="larrb" value="&#x021E4;"/>
+  <entity name="larrbfs" value="&#x0291F;"/>
+  <entity name="larrfs" value="&#x0291D;"/>
+  <entity name="larrhk" value="&#x021A9;"/>
+  <entity name="larrlp" value="&#x021AB;"/>
+  <entity name="larrpl" value="&#x02939;"/>
+  <entity name="larrsim" value="&#x02973;"/>
+  <entity name="larrtl" value="&#x021A2;"/>
+  <entity name="lat" value="&#x02AAB;"/>
+  <entity name="latail" value="&#x02919;"/>
+  <entity name="lAtail" value="&#x0291B;"/>
+  <entity name="late" value="&#x02AAD;"/>
+  <entity name="lates" value="&#x02AAD;&#x0FE00;"/>
+  <entity name="lbarr" value="&#x0290C;"/>
+  <entity name="lBarr" value="&#x0290E;"/>
+  <entity name="lbbrk" value="&#x03014;"/>
+  <entity name="lbrace" value="&#x0007B;"/>
+  <entity name="lbrack" value="&#x0005B;"/>
+  <entity name="lbrke" value="&#x0298B;"/>
+  <entity name="lbrksld" value="&#x0298F;"/>
+  <entity name="lbrkslu" value="&#x0298D;"/>
+  <entity name="lcaron" value="&#x0013E;"/>
+  <entity name="Lcaron" value="&#x0013D;"/>
+  <entity name="lcedil" value="&#x0013C;"/>
+  <entity name="Lcedil" value="&#x0013B;"/>
+  <entity name="lceil" value="&#x02308;"/>
+  <entity name="lcub" value="&#x0007B;"/>
+  <entity name="lcy" value="&#x0043B;"/>
+  <entity name="Lcy" value="&#x0041B;"/>
+  <entity name="ldca" value="&#x02936;"/>
+  <entity name="ldquo" value="&#x0201C;"/>
+  <entity name="ldquor" value="&#x0201E;"/>
+  <entity name="ldrdhar" value="&#x02967;"/>
+  <entity name="ldrushar" value="&#x0294B;"/>
+  <entity name="ldsh" value="&#x021B2;"/>
+  <entity name="le" value="&#x02264;"/>
+  <entity name="lE" value="&#x02266;"/>
+  <entity name="LeftAngleBracket" value="&#x02329;"/>
+  <entity name="leftarrow" value="&#x02190;"/>
+  <entity name="Leftarrow" value="&#x021D0;"/>
+  <entity name="LeftArrow" value="&#x02190;"/>
+  <entity name="LeftArrowBar" value="&#x021E4;"/>
+  <entity name="LeftArrowRightArrow" value="&#x021C6;"/>
+  <entity name="leftarrowtail" value="&#x021A2;"/>
+  <entity name="LeftCeiling" value="&#x02308;"/>
+  <entity name="LeftDoubleBracket" value="&#x0301A;"/>
+  <entity name="LeftDownTeeVector" value="&#x02961;"/>
+  <entity name="LeftDownVector" value="&#x021C3;"/>
+  <entity name="LeftDownVectorBar" value="&#x02959;"/>
+  <entity name="LeftFloor" value="&#x0230A;"/>
+  <entity name="leftharpoondown" value="&#x021BD;"/>
+  <entity name="leftharpoonup" value="&#x021BC;"/>
+  <entity name="leftleftarrows" value="&#x021C7;"/>
+  <entity name="leftrightarrow" value="&#x02194;"/>
+  <entity name="Leftrightarrow" value="&#x021D4;"/>
+  <entity name="LeftRightArrow" value="&#x02194;"/>
+  <entity name="leftrightarrows" value="&#x021C6;"/>
+  <entity name="leftrightharpoons" value="&#x021CB;"/>
+  <entity name="leftrightsquigarrow" value="&#x021AD;"/>
+  <entity name="LeftRightVector" value="&#x0294E;"/>
+  <entity name="LeftTee" value="&#x022A3;"/>
+  <entity name="LeftTeeArrow" value="&#x021A4;"/>
+  <entity name="LeftTeeVector" value="&#x0295A;"/>
+  <entity name="leftthreetimes" value="&#x022CB;"/>
+  <entity name="LeftTriangle" value="&#x022B2;"/>
+  <entity name="LeftTriangleBar" value="&#x029CF;"/>
+  <entity name="LeftTriangleEqual" value="&#x022B4;"/>
+  <entity name="LeftUpDownVector" value="&#x02951;"/>
+  <entity name="LeftUpTeeVector" value="&#x02960;"/>
+  <entity name="LeftUpVector" value="&#x021BF;"/>
+  <entity name="LeftUpVectorBar" value="&#x02958;"/>
+  <entity name="LeftVector" value="&#x021BC;"/>
+  <entity name="LeftVectorBar" value="&#x02952;"/>
+  <entity name="leg" value="&#x022DA;"/>
+  <entity name="lEg" value="&#x022DA;"/>
+  <entity name="leq" value="&#x02264;"/>
+  <entity name="leqq" value="&#x02266;"/>
+  <entity name="leqslant" value="&#x02A7D;"/>
+  <entity name="les" value="&#x02A7D;"/>
+  <entity name="lescc" value="&#x02AA8;"/>
+  <entity name="lesdot" value="&#x02A7F;"/>
+  <entity name="lesdoto" value="&#x02A81;"/>
+  <entity name="lesdotor" value="&#x02A83;"/>
+  <entity name="lesg" value="&#x022DA;&#x0FE00;"/>
+  <entity name="lesges" value="&#x02A93;"/>
+  <entity name="lessapprox" value="&#x02272;"/>
+  <entity name="lessdot" value="&#x022D6;"/>
+  <entity name="lesseqgtr" value="&#x022DA;"/>
+  <entity name="lesseqqgtr" value="&#x022DA;"/>
+  <entity name="LessEqualGreater" value="&#x022DA;"/>
+  <entity name="LessFullEqual" value="&#x02266;"/>
+  <entity name="LessGreater" value="&#x02276;"/>
+  <entity name="lessgtr" value="&#x02276;"/>
+  <entity name="LessLess" value="&#x02AA1;"/>
+  <entity name="lesssim" value="&#x02272;"/>
+  <entity name="LessSlantEqual" value="&#x02A7D;"/>
+  <entity name="LessTilde" value="&#x02272;"/>
+  <entity name="lfisht" value="&#x0297C;"/>
+  <entity name="lfloor" value="&#x0230A;"/>
+  <entity name="lfr" value="&#x1D529;"/>
+  <entity name="Lfr" value="&#x1D50F;"/>
+  <entity name="lg" value="&#x02276;"/>
+  <entity name="lgE" value="&#x02A91;"/>
+  <entity name="lHar" value="&#x02962;"/>
+  <entity name="lhard" value="&#x021BD;"/>
+  <entity name="lharu" value="&#x021BC;"/>
+  <entity name="lharul" value="&#x0296A;"/>
+  <entity name="lhblk" value="&#x02584;"/>
+  <entity name="ljcy" value="&#x00459;"/>
+  <entity name="LJcy" value="&#x00409;"/>
+  <entity name="ll" value="&#x0226A;"/>
+  <entity name="Ll" value="&#x022D8;"/>
+  <entity name="llarr" value="&#x021C7;"/>
+  <entity name="llcorner" value="&#x0231E;"/>
+  <entity name="Lleftarrow" value="&#x021DA;"/>
+  <entity name="llhard" value="&#x0296B;"/>
+  <entity name="lltri" value="&#x025FA;"/>
+  <entity name="lmidot" value="&#x00140;"/>
+  <entity name="Lmidot" value="&#x0013F;"/>
+  <entity name="lmoust" value="&#x023B0;"/>
+  <entity name="lmoustache" value="&#x023B0;"/>
+  <entity name="lnap" value="&#x02A89;"/>
+  <entity name="lnapprox" value="&#x02A89;"/>
+  <entity name="lne" value="&#x02268;"/>
+  <entity name="lnE" value="&#x02268;"/>
+  <entity name="lneq" value="&#x02268;"/>
+  <entity name="lneqq" value="&#x02268;"/>
+  <entity name="lnsim" value="&#x022E6;"/>
+  <entity name="loang" value="&#x0F558;"/>
+  <entity name="loarr" value="&#x021FD;"/>
+  <entity name="lobrk" value="&#x0301A;"/>
+  <entity name="longleftarrow" value="&#x0F576;"/>
+  <entity name="Longleftarrow" value="&#x0F579;"/>
+  <entity name="LongLeftArrow" value="&#x0F576;"/>
+  <entity name="longleftrightarrow" value="&#x0F578;"/>
+  <entity name="Longleftrightarrow" value="&#x0F57B;"/>
+  <entity name="LongLeftRightArrow" value="&#x0F578;"/>
+  <entity name="longmapsto" value="&#x0F57D;"/>
+  <entity name="longrightarrow" value="&#x0F577;"/>
+  <entity name="Longrightarrow" value="&#x0F57A;"/>
+  <entity name="LongRightArrow" value="&#x0F577;"/>
+  <entity name="looparrowleft" value="&#x021AB;"/>
+  <entity name="looparrowright" value="&#x021AC;"/>
+  <entity name="lopar" value="&#x03018;"/>
+  <entity name="lopf" value="&#x1D55D;"/>
+  <entity name="Lopf" value="&#x1D543;"/>
+  <entity name="loplus" value="&#x02A2D;"/>
+  <entity name="lotimes" value="&#x02A34;"/>
+  <entity name="lowast" value="&#x02217;"/>
+  <entity name="lowbar" value="&#x0005F;"/>
+  <entity name="LowerLeftArrow" value="&#x02199;"/>
+  <entity name="LowerRightArrow" value="&#x02198;"/>
+  <entity name="loz" value="&#x025CA;"/>
+  <entity name="lozenge" value="&#x025CA;"/>
+  <entity name="lozf" value="&#x029EB;"/>
+  <entity name="lpar" value="&#x00028;"/>
+  <entity name="lparlt" value="&#x02993;"/>
+  <entity name="lrarr" value="&#x021C6;"/>
+  <entity name="lrcorner" value="&#x0231F;"/>
+  <entity name="lrhar" value="&#x021CB;"/>
+  <entity name="lrhard" value="&#x0296D;"/>
+  <entity name="lrtri" value="&#x022BF;"/>
+  <entity name="lscr" value="&#x02113;"/>
+  <entity name="Lscr" value="&#x02112;"/>
+  <entity name="lsh" value="&#x021B0;"/>
+  <entity name="Lsh" value="&#x021B0;"/>
+  <entity name="lsim" value="&#x02272;"/>
+  <entity name="lsime" value="&#x02A8D;"/>
+  <entity name="lsimg" value="&#x02A8F;"/>
+  <entity name="lsqb" value="&#x0005B;"/>
+  <entity name="lsquo" value="&#x02018;"/>
+  <entity name="lsquor" value="&#x0201A;"/>
+  <entity name="lstrok" value="&#x00142;"/>
+  <entity name="Lstrok" value="&#x00141;"/>
+  <entity name="lt" value="&#x0003C;"/>
+  <entity name="Lt" value="&#x0226A;"/>
+  <entity name="ltcc" value="&#x02AA6;"/>
+  <entity name="ltcir" value="&#x02A79;"/>
+  <entity name="ltdot" value="&#x022D6;"/>
+  <entity name="lthree" value="&#x022CB;"/>
+  <entity name="ltimes" value="&#x022C9;"/>
+  <entity name="ltlarr" value="&#x02976;"/>
+  <entity name="ltquest" value="&#x02A7B;"/>
+  <entity name="ltri" value="&#x025C3;"/>
+  <entity name="ltrie" value="&#x022B4;"/>
+  <entity name="ltrif" value="&#x025C2;"/>
+  <entity name="ltrPar" value="&#x02996;"/>
+  <entity name="lurdshar" value="&#x0294A;"/>
+  <entity name="luruhar" value="&#x02966;"/>
+  <entity name="lvertneqq" value="&#x02268;&#x0FE00;"/>
+  <entity name="lvnE" value="&#x02268;&#x0FE00;"/>
+  <entity name="macr" value="&#x000AF;"/>
+  <entity name="male" value="&#x02642;"/>
+  <entity name="malt" value="&#x02720;"/>
+  <entity name="maltese" value="&#x02720;"/>
+  <entity name="map" value="&#x021A6;"/>
+  <entity name="Map" value="&#x02905;"/>
+  <entity name="mapsto" value="&#x021A6;"/>
+  <entity name="mapstodown" value="&#x021A7;"/>
+  <entity name="mapstoleft" value="&#x021A4;"/>
+  <entity name="mapstoup" value="&#x021A5;"/>
+  <entity name="marker" value="&#x025AE;"/>
+  <entity name="mcomma" value="&#x02A29;"/>
+  <entity name="mcy" value="&#x0043C;"/>
+  <entity name="Mcy" value="&#x0041C;"/>
+  <entity name="mdash" value="&#x02014;"/>
+  <entity name="mDDot" value="&#x0223A;"/>
+  <entity name="measuredangle" value="&#x02221;"/>
+  <entity name="MediumSpace" value="&#x0205F;"/>
+  <entity name="Mellintrf" value="&#x02133;"/>
+  <entity name="mfr" value="&#x1D52A;"/>
+  <entity name="Mfr" value="&#x1D510;"/>
+  <entity name="mho" value="&#x02127;"/>
+  <entity name="micro" value="&#x000B5;"/>
+  <entity name="mid" value="&#x02223;"/>
+  <entity name="midast" value="&#x0002A;"/>
+  <entity name="midcir" value="&#x02AF0;"/>
+  <entity name="middot" value="&#x000B7;"/>
+  <entity name="minus" value="&#x02212;"/>
+  <entity name="minusb" value="&#x0229F;"/>
+  <entity name="minusd" value="&#x02238;"/>
+  <entity name="minusdu" value="&#x02A2A;"/>
+  <entity name="MinusPlus" value="&#x02213;"/>
+  <entity name="mlcp" value="&#x02ADB;"/>
+  <entity name="mldr" value="&#x02026;"/>
+  <entity name="mnplus" value="&#x02213;"/>
+  <entity name="models" value="&#x022A7;"/>
+  <entity name="mopf" value="&#x1D55E;"/>
+  <entity name="Mopf" value="&#x1D544;"/>
+  <entity name="mp" value="&#x02213;"/>
+  <entity name="mscr" value="&#x1D4C2;"/>
+  <entity name="Mscr" value="&#x02133;"/>
+  <entity name="mstpos" value="&#x0223E;"/>
+  <entity name="mu" value="&#x003BC;"/>
+  <entity name="multimap" value="&#x022B8;"/>
+  <entity name="mumap" value="&#x022B8;"/>
+  <entity name="nabla" value="&#x02207;"/>
+  <entity name="nacute" value="&#x00144;"/>
+  <entity name="Nacute" value="&#x00143;"/>
+  <entity name="nang" value="&#x02220;&#x00338;"/>
+  <entity name="nap" value="&#x02249;"/>
+  <entity name="napE" value="&#x02A70;&#x00338;"/>
+  <entity name="napid" value="&#x0224B;&#x00338;"/>
+  <entity name="napos" value="&#x00149;"/>
+  <entity name="napprox" value="&#x02249;"/>
+  <entity name="natur" value="&#x0266E;"/>
+  <entity name="natural" value="&#x0266E;"/>
+  <entity name="naturals" value="&#x02115;"/>
+  <entity name="nbsp" value="&#x000A0;"/>
+  <entity name="nbump" value="&#x0224E;&#x00338;"/>
+  <entity name="nbumpe" value="&#x0224F;&#x00338;"/>
+  <entity name="ncap" value="&#x02A43;"/>
+  <entity name="ncaron" value="&#x00148;"/>
+  <entity name="Ncaron" value="&#x00147;"/>
+  <entity name="ncedil" value="&#x00146;"/>
+  <entity name="Ncedil" value="&#x00145;"/>
+  <entity name="ncong" value="&#x02247;"/>
+  <entity name="ncongdot" value="&#x02A6D;&#x00338;"/>
+  <entity name="ncup" value="&#x02A42;"/>
+  <entity name="ncy" value="&#x0043D;"/>
+  <entity name="Ncy" value="&#x0041D;"/>
+  <entity name="ndash" value="&#x02013;"/>
+  <entity name="ne" value="&#x02260;"/>
+  <entity name="nearhk" value="&#x02924;"/>
+  <entity name="nearr" value="&#x02197;"/>
+  <entity name="neArr" value="&#x021D7;"/>
+  <entity name="nearrow" value="&#x02197;"/>
+  <entity name="nedot" value="&#x02260;&#x0FE00;"/>
+  <entity name="NegativeMediumSpace" value="&#x0205F;&#x0FE00;"/>
+  <entity name="NegativeThickSpace" value="&#x02005;&#x0FE00;"/>
+  <entity name="NegativeThinSpace" value="&#x02009;&#x0FE00;"/>
+  <entity name="NegativeVeryThinSpace" value="&#x0200A;&#x0FE00;"/>
+  <entity name="nequiv" value="&#x02262;"/>
+  <entity name="nesear" value="&#x02928;"/>
+  <entity name="nesim" value="&#x02242;&#x00338;"/>
+  <entity name="NestedGreaterGreater" value="&#x0226B;"/>
+  <entity name="NestedLessLess" value="&#x0226A;"/>
+  <entity name="NewLine" value="&#x0000A;"/>
+  <entity name="nexist" value="&#x02204;"/>
+  <entity name="nexists" value="&#x02204;"/>
+  <entity name="nfr" value="&#x1D52B;"/>
+  <entity name="Nfr" value="&#x1D511;"/>
+  <entity name="nge" value="&#x02271;&#x020E5;"/>
+  <entity name="ngE" value="&#x02271;"/>
+  <entity name="ngeq" value="&#x02271;&#x020E5;"/>
+  <entity name="ngeqq" value="&#x02271;"/>
+  <entity name="ngeqslant" value="&#x02271;"/>
+  <entity name="nges" value="&#x02271;"/>
+  <entity name="nGg" value="&#x022D9;&#x00338;"/>
+  <entity name="ngsim" value="&#x02275;"/>
+  <entity name="ngt" value="&#x0226F;"/>
+  <entity name="nGt" value="&#x0226B;&#x00338;"/>
+  <entity name="ngtr" value="&#x0226F;"/>
+  <entity name="nGtv" value="&#x0226B;&#x00338;&#x0FE00;"/>
+  <entity name="nharr" value="&#x021AE;"/>
+  <entity name="nhArr" value="&#x021CE;"/>
+  <entity name="nhpar" value="&#x02AF2;"/>
+  <entity name="ni" value="&#x0220B;"/>
+  <entity name="nis" value="&#x022FC;"/>
+  <entity name="nisd" value="&#x022FA;"/>
+  <entity name="niv" value="&#x0220B;"/>
+  <entity name="njcy" value="&#x0045A;"/>
+  <entity name="NJcy" value="&#x0040A;"/>
+  <entity name="nlarr" value="&#x0219A;"/>
+  <entity name="nlArr" value="&#x021CD;"/>
+  <entity name="nldr" value="&#x02025;"/>
+  <entity name="nle" value="&#x02270;&#x020E5;"/>
+  <entity name="nlE" value="&#x02270;"/>
+  <entity name="nleftarrow" value="&#x0219A;"/>
+  <entity name="nLeftarrow" value="&#x021CD;"/>
+  <entity name="nleftrightarrow" value="&#x021AE;"/>
+  <entity name="nLeftrightarrow" value="&#x021CE;"/>
+  <entity name="nleq" value="&#x02270;&#x020E5;"/>
+  <entity name="nleqq" value="&#x02270;"/>
+  <entity name="nleqslant" value="&#x02270;"/>
+  <entity name="nles" value="&#x02270;"/>
+  <entity name="nless" value="&#x0226E;"/>
+  <entity name="nLl" value="&#x022D8;&#x00338;"/>
+  <entity name="nlsim" value="&#x02274;"/>
+  <entity name="nlt" value="&#x0226E;"/>
+  <entity name="nLt" value="&#x0226A;&#x00338;"/>
+  <entity name="nltri" value="&#x022EA;"/>
+  <entity name="nltrie" value="&#x022EC;"/>
+  <entity name="nLtv" value="&#x0226A;&#x00338;&#x0FE00;"/>
+  <entity name="nmid" value="&#x02224;"/>
+  <entity name="NoBreak" value="&#x0FEFF;"/>
+  <entity name="NonBreakingSpace" value="&#x000A0;"/>
+  <entity name="nopf" value="&#x1D55F;"/>
+  <entity name="Nopf" value="&#x02115;"/>
+  <entity name="not" value="&#x000AC;"/>
+  <entity name="Not" value="&#x02AEC;"/>
+  <entity name="NotCongruent" value="&#x02262;"/>
+  <entity name="NotCupCap" value="&#x0226D;"/>
+  <entity name="NotDoubleVerticalBar" value="&#x02226;"/>
+  <entity name="NotElement" value="&#x02209;"/>
+  <entity name="NotEqual" value="&#x02260;"/>
+  <entity name="NotEqualTilde" value="&#x02242;&#x00338;"/>
+  <entity name="NotExists" value="&#x02204;"/>
+  <entity name="NotGreater" value="&#x0226F;"/>
+  <entity name="NotGreaterEqual" value="&#x02271;&#x020E5;"/>
+  <entity name="NotGreaterFullEqual" value="&#x02270;"/>
+  <entity name="NotGreaterGreater" value="&#x0226B;&#x00338;&#x0FE00;"/>
+  <entity name="NotGreaterLess" value="&#x02279;"/>
+  <entity name="NotGreaterSlantEqual" value="&#x02271;"/>
+  <entity name="NotGreaterTilde" value="&#x02275;"/>
+  <entity name="NotHumpDownHump" value="&#x0224E;&#x00338;"/>
+  <entity name="NotHumpEqual" value="&#x0224F;&#x00338;"/>
+  <entity name="notin" value="&#x02209;"/>
+  <entity name="notindot" value="&#x022F6;&#x0FE00;"/>
+  <entity name="notinva" value="&#x02209;&#x00338;"/>
+  <entity name="notinvb" value="&#x022F7;"/>
+  <entity name="notinvc" value="&#x022F6;"/>
+  <entity name="NotLeftTriangle" value="&#x022EA;"/>
+  <entity name="NotLeftTriangleBar" value="&#x029CF;&#x00338;"/>
+  <entity name="NotLeftTriangleEqual" value="&#x022EC;"/>
+  <entity name="NotLess" value="&#x0226E;"/>
+  <entity name="NotLessEqual" value="&#x02270;&#x020E5;"/>
+  <entity name="NotLessGreater" value="&#x02278;"/>
+  <entity name="NotLessLess" value="&#x0226A;&#x00338;&#x0FE00;"/>
+  <entity name="NotLessSlantEqual" value="&#x02270;"/>
+  <entity name="NotLessTilde" value="&#x02274;"/>
+  <entity name="NotNestedGreaterGreater" value="&#x024A2;&#x00338;"/>
+  <entity name="NotNestedLessLess" value="&#x024A1;&#x00338;"/>
+  <entity name="notni" value="&#x0220C;"/>
+  <entity name="notniva" value="&#x0220C;"/>
+  <entity name="notnivb" value="&#x022FE;"/>
+  <entity name="notnivc" value="&#x022FD;"/>
+  <entity name="NotPrecedes" value="&#x02280;"/>
+  <entity name="NotPrecedesEqual" value="&#x02AAF;&#x00338;"/>
+  <entity name="NotPrecedesSlantEqual" value="&#x022E0;"/>
+  <entity name="NotReverseElement" value="&#x0220C;"/>
+  <entity name="NotRightTriangle" value="&#x022EB;"/>
+  <entity name="NotRightTriangleBar" value="&#x029D0;&#x00338;"/>
+  <entity name="NotRightTriangleEqual" value="&#x022ED;"/>
+  <entity name="NotSquareSubset" value="&#x0228F;&#x00338;"/>
+  <entity name="NotSquareSubsetEqual" value="&#x022E2;"/>
+  <entity name="NotSquareSuperset" value="&#x02290;&#x00338;"/>
+  <entity name="NotSquareSupersetEqual" value="&#x022E3;"/>
+  <entity name="NotSubset" value="&#x02284;"/>
+  <entity name="NotSubsetEqual" value="&#x02288;"/>
+  <entity name="NotSucceeds" value="&#x02281;"/>
+  <entity name="NotSucceedsEqual" value="&#x02AB0;&#x00338;"/>
+  <entity name="NotSucceedsSlantEqual" value="&#x022E1;"/>
+  <entity name="NotSucceedsTilde" value="&#x0227F;&#x00338;"/>
+  <entity name="NotSuperset" value="&#x02285;"/>
+  <entity name="NotSupersetEqual" value="&#x02289;"/>
+  <entity name="NotTilde" value="&#x02241;"/>
+  <entity name="NotTildeEqual" value="&#x02244;"/>
+  <entity name="NotTildeFullEqual" value="&#x02247;"/>
+  <entity name="NotTildeTilde" value="&#x02249;"/>
+  <entity name="NotVerticalBar" value="&#x02224;"/>
+  <entity name="npar" value="&#x02226;"/>
+  <entity name="nparallel" value="&#x02226;"/>
+  <entity name="nparsl" value="&#x02225;&#x0FE00;&#x020E5;"/>
+  <entity name="npart" value="&#x02202;&#x00338;"/>
+  <entity name="npolint" value="&#x02A14;"/>
+  <entity name="npr" value="&#x02280;"/>
+  <entity name="nprcue" value="&#x022E0;"/>
+  <entity name="npre" value="&#x02AAF;&#x00338;"/>
+  <entity name="nprec" value="&#x02280;"/>
+  <entity name="npreceq" value="&#x02AAF;&#x00338;"/>
+  <entity name="nrarr" value="&#x0219B;"/>
+  <entity name="nrArr" value="&#x021CF;"/>
+  <entity name="nrarrc" value="&#x02933;&#x00338;"/>
+  <entity name="nrarrw" value="&#x0219D;&#x00338;"/>
+  <entity name="nrightarrow" value="&#x0219B;"/>
+  <entity name="nRightarrow" value="&#x021CF;"/>
+  <entity name="nrtri" value="&#x022EB;"/>
+  <entity name="nrtrie" value="&#x022ED;"/>
+  <entity name="nsc" value="&#x02281;"/>
+  <entity name="nsccue" value="&#x022E1;"/>
+  <entity name="nsce" value="&#x02AB0;&#x00338;"/>
+  <entity name="nscr" value="&#x1D4C3;"/>
+  <entity name="Nscr" value="&#x1D4A9;"/>
+  <entity name="nshortmid" value="&#x02224;&#x0FE00;"/>
+  <entity name="nshortparallel" value="&#x02226;&#x0FE00;"/>
+  <entity name="nsim" value="&#x02241;"/>
+  <entity name="nsime" value="&#x02244;"/>
+  <entity name="nsimeq" value="&#x02244;"/>
+  <entity name="nsmid" value="&#x02224;&#x0FE00;"/>
+  <entity name="nspar" value="&#x02226;&#x0FE00;"/>
+  <entity name="nsqsube" value="&#x022E2;"/>
+  <entity name="nsqsupe" value="&#x022E3;"/>
+  <entity name="nsub" value="&#x02284;"/>
+  <entity name="nsube" value="&#x02288;"/>
+  <entity name="nsubE" value="&#x02288;"/>
+  <entity name="nsubset" value="&#x02284;"/>
+  <entity name="nsubseteq" value="&#x02288;"/>
+  <entity name="nsubseteqq" value="&#x02288;"/>
+  <entity name="nsucc" value="&#x02281;"/>
+  <entity name="nsucceq" value="&#x02AB0;&#x00338;"/>
+  <entity name="nsup" value="&#x02285;"/>
+  <entity name="nsupe" value="&#x02289;"/>
+  <entity name="nsupE" value="&#x02289;"/>
+  <entity name="nsupset" value="&#x02285;"/>
+  <entity name="nsupseteq" value="&#x02289;"/>
+  <entity name="nsupseteqq" value="&#x02289;"/>
+  <entity name="ntgl" value="&#x02279;"/>
+  <entity name="ntilde" value="&#x000F1;"/>
+  <entity name="Ntilde" value="&#x000D1;"/>
+  <entity name="ntlg" value="&#x02278;"/>
+  <entity name="ntriangleleft" value="&#x022EA;"/>
+  <entity name="ntrianglelefteq" value="&#x022EC;"/>
+  <entity name="ntriangleright" value="&#x022EB;"/>
+  <entity name="ntrianglerighteq" value="&#x022ED;"/>
+  <entity name="nu" value="&#x003BD;"/>
+  <entity name="num" value="&#x00023;"/>
+  <entity name="numero" value="&#x02116;"/>
+  <entity name="numsp" value="&#x02007;"/>
+  <entity name="nvap" value="&#x02249;&#x00338;"/>
+  <entity name="nvdash" value="&#x022AC;"/>
+  <entity name="nvDash" value="&#x022AD;"/>
+  <entity name="nVdash" value="&#x022AE;"/>
+  <entity name="nVDash" value="&#x022AF;"/>
+  <entity name="nvge" value="&#x02271;"/>
+  <entity name="nvgt" value="&#x0226F;"/>
+  <entity name="nvHarr" value="&#x021CE;"/>
+  <entity name="nvinfin" value="&#x029DE;"/>
+  <entity name="nvlArr" value="&#x021CD;"/>
+  <entity name="nvle" value="&#x02270;"/>
+  <entity name="nvlt" value="&#x0226E;"/>
+  <entity name="nvltrie" value="&#x022EC;&#x00338;"/>
+  <entity name="nvrArr" value="&#x021CF;"/>
+  <entity name="nvrtrie" value="&#x022ED;&#x00338;"/>
+  <entity name="nvsim" value="&#x02241;&#x00338;"/>
+  <entity name="nwarhk" value="&#x02923;"/>
+  <entity name="nwarr" value="&#x02196;"/>
+  <entity name="nwArr" value="&#x021D6;"/>
+  <entity name="nwarrow" value="&#x02196;"/>
+  <entity name="nwnear" value="&#x02927;"/>
+  <entity name="oacute" value="&#x000F3;"/>
+  <entity name="Oacute" value="&#x000D3;"/>
+  <entity name="oast" value="&#x0229B;"/>
+  <entity name="ocir" value="&#x0229A;"/>
+  <entity name="ocirc" value="&#x000F4;"/>
+  <entity name="Ocirc" value="&#x000D4;"/>
+  <entity name="ocy" value="&#x0043E;"/>
+  <entity name="Ocy" value="&#x0041E;"/>
+  <entity name="odash" value="&#x0229D;"/>
+  <entity name="odblac" value="&#x00151;"/>
+  <entity name="Odblac" value="&#x00150;"/>
+  <entity name="odiv" value="&#x02A38;"/>
+  <entity name="odot" value="&#x02299;"/>
+  <entity name="odsold" value="&#x029BC;"/>
+  <entity name="oelig" value="&#x00153;"/>
+  <entity name="OElig" value="&#x00152;"/>
+  <entity name="ofcir" value="&#x029BF;"/>
+  <entity name="ofr" value="&#x1D52C;"/>
+  <entity name="Ofr" value="&#x1D512;"/>
+  <entity name="ogon" value="&#x002DB;"/>
+  <entity name="ograve" value="&#x000F2;"/>
+  <entity name="Ograve" value="&#x000D2;"/>
+  <entity name="ogt" value="&#x029C1;"/>
+  <entity name="ohbar" value="&#x029B5;"/>
+  <entity name="ohm" value="&#x02126;"/>
+  <entity name="oint" value="&#x0222E;"/>
+  <entity name="olarr" value="&#x021BA;"/>
+  <entity name="olcir" value="&#x029BE;"/>
+  <entity name="olcross" value="&#x029BB;"/>
+  <entity name="olt" value="&#x029C0;"/>
+  <entity name="omacr" value="&#x0014D;"/>
+  <entity name="Omacr" value="&#x0014C;"/>
+  <entity name="omega" value="&#x003C9;"/>
+  <entity name="Omega" value="&#x003A9;"/>
+  <entity name="omid" value="&#x029B6;"/>
+  <entity name="ominus" value="&#x02296;"/>
+  <entity name="oopf" value="&#x1D560;"/>
+  <entity name="Oopf" value="&#x1D546;"/>
+  <entity name="opar" value="&#x029B7;"/>
+  <entity name="OpenCurlyDoubleQuote" value="&#x0201C;"/>
+  <entity name="OpenCurlyQuote" value="&#x02018;"/>
+  <entity name="operp" value="&#x029B9;"/>
+  <entity name="oplus" value="&#x02295;"/>
+  <entity name="or" value="&#x02228;"/>
+  <entity name="Or" value="&#x02A54;"/>
+  <entity name="orarr" value="&#x021BB;"/>
+  <entity name="ord" value="&#x02A5D;"/>
+  <entity name="order" value="&#x02134;"/>
+  <entity name="orderof" value="&#x02134;"/>
+  <entity name="ordf" value="&#x000AA;"/>
+  <entity name="ordm" value="&#x000BA;"/>
+  <entity name="origof" value="&#x022B6;"/>
+  <entity name="oror" value="&#x02A56;"/>
+  <entity name="orslope" value="&#x02A57;"/>
+  <entity name="orv" value="&#x02A5B;"/>
+  <entity name="oS" value="&#x024C8;"/>
+  <entity name="oscr" value="&#x02134;"/>
+  <entity name="Oscr" value="&#x1D4AA;"/>
+  <entity name="oslash" value="&#x000F8;"/>
+  <entity name="Oslash" value="&#x000D8;"/>
+  <entity name="osol" value="&#x02298;"/>
+  <entity name="otilde" value="&#x000F5;"/>
+  <entity name="Otilde" value="&#x000D5;"/>
+  <entity name="otimes" value="&#x02297;"/>
+  <entity name="Otimes" value="&#x02A37;"/>
+  <entity name="otimesas" value="&#x02A36;"/>
+  <entity name="ouml" value="&#x000F6;"/>
+  <entity name="Ouml" value="&#x000D6;"/>
+  <entity name="ovbar" value="&#x0233D;"/>
+  <entity name="OverBar" value="&#x000AF;"/>
+  <entity name="OverBrace" value="&#x0FE37;"/>
+  <entity name="OverBracket" value="&#x023B4;"/>
+  <entity name="OverParenthesis" value="&#x0FE35;"/>
+  <entity name="par" value="&#x02225;"/>
+  <entity name="para" value="&#x000B6;"/>
+  <entity name="parallel" value="&#x02225;"/>
+  <entity name="parsim" value="&#x02AF3;"/>
+  <entity name="parsl" value="&#x02225;&#x0FE00;"/>
+  <entity name="part" value="&#x02202;"/>
+  <entity name="PartialD" value="&#x02202;"/>
+  <entity name="pcy" value="&#x0043F;"/>
+  <entity name="Pcy" value="&#x0041F;"/>
+  <entity name="percnt" value="&#x00025;"/>
+  <entity name="period" value="&#x0002E;"/>
+  <entity name="permil" value="&#x02030;"/>
+  <entity name="perp" value="&#x022A5;"/>
+  <entity name="pertenk" value="&#x02031;"/>
+  <entity name="pfr" value="&#x1D52D;"/>
+  <entity name="Pfr" value="&#x1D513;"/>
+  <entity name="phi" value="&#x003C6;"/>
+  <entity name="Phi" value="&#x003A6;"/>
+  <entity name="phiv" value="&#x003D5;"/>
+  <entity name="phmmat" value="&#x02133;"/>
+  <entity name="phone" value="&#x0260E;"/>
+  <entity name="pi" value="&#x003C0;"/>
+  <entity name="Pi" value="&#x003A0;"/>
+  <entity name="pitchfork" value="&#x022D4;"/>
+  <entity name="piv" value="&#x003D6;"/>
+  <entity name="planck" value="&#x0210F;&#x0FE00;"/>
+  <entity name="planckh" value="&#x0210E;"/>
+  <entity name="plankv" value="&#x0210F;"/>
+  <entity name="plus" value="&#x0002B;"/>
+  <entity name="plusacir" value="&#x02A23;"/>
+  <entity name="plusb" value="&#x0229E;"/>
+  <entity name="pluscir" value="&#x02A22;"/>
+  <entity name="plusdo" value="&#x02214;"/>
+  <entity name="plusdu" value="&#x02A25;"/>
+  <entity name="pluse" value="&#x02A72;"/>
+  <entity name="PlusMinus" value="&#x000B1;"/>
+  <entity name="plusmn" value="&#x000B1;"/>
+  <entity name="plussim" value="&#x02A26;"/>
+  <entity name="plustwo" value="&#x02A27;"/>
+  <entity name="pm" value="&#x000B1;"/>
+  <entity name="Poincareplane" value="&#x0210C;"/>
+  <entity name="pointint" value="&#x02A15;"/>
+  <entity name="popf" value="&#x1D561;"/>
+  <entity name="Popf" value="&#x02119;"/>
+  <entity name="pound" value="&#x000A3;"/>
+  <entity name="pr" value="&#x0227A;"/>
+  <entity name="Pr" value="&#x02ABB;"/>
+  <entity name="prap" value="&#x0227E;"/>
+  <entity name="prcue" value="&#x0227C;"/>
+  <entity name="pre" value="&#x02AAF;"/>
+  <entity name="prE" value="&#x02AAF;"/>
+  <entity name="prec" value="&#x0227A;"/>
+  <entity name="precapprox" value="&#x0227E;"/>
+  <entity name="preccurlyeq" value="&#x0227C;"/>
+  <entity name="Precedes" value="&#x0227A;"/>
+  <entity name="PrecedesEqual" value="&#x02AAF;"/>
+  <entity name="PrecedesSlantEqual" value="&#x0227C;"/>
+  <entity name="PrecedesTilde" value="&#x0227E;"/>
+  <entity name="preceq" value="&#x02AAF;"/>
+  <entity name="precnapprox" value="&#x022E8;"/>
+  <entity name="precneqq" value="&#x02AB5;"/>
+  <entity name="precnsim" value="&#x022E8;"/>
+  <entity name="precsim" value="&#x0227E;"/>
+  <entity name="prime" value="&#x02032;"/>
+  <entity name="Prime" value="&#x02033;"/>
+  <entity name="primes" value="&#x02119;"/>
+  <entity name="prnap" value="&#x022E8;"/>
+  <entity name="prnE" value="&#x02AB5;"/>
+  <entity name="prnsim" value="&#x022E8;"/>
+  <entity name="prod" value="&#x0220F;"/>
+  <entity name="Product" value="&#x0220F;"/>
+  <entity name="profalar" value="&#x0232E;"/>
+  <entity name="profline" value="&#x02312;"/>
+  <entity name="profsurf" value="&#x02313;"/>
+  <entity name="prop" value="&#x0221D;"/>
+  <entity name="Proportion" value="&#x02237;"/>
+  <entity name="Proportional" value="&#x0221D;"/>
+  <entity name="propto" value="&#x0221D;"/>
+  <entity name="prsim" value="&#x0227E;"/>
+  <entity name="prurel" value="&#x022B0;"/>
+  <entity name="pscr" value="&#x1D4C5;"/>
+  <entity name="Pscr" value="&#x1D4AB;"/>
+  <entity name="psi" value="&#x003C8;"/>
+  <entity name="Psi" value="&#x003A8;"/>
+  <entity name="puncsp" value="&#x02008;"/>
+  <entity name="qfr" value="&#x1D52E;"/>
+  <entity name="Qfr" value="&#x1D514;"/>
+  <entity name="qint" value="&#x02A0C;"/>
+  <entity name="qopf" value="&#x1D562;"/>
+  <entity name="Qopf" value="&#x0211A;"/>
+  <entity name="qprime" value="&#x02057;"/>
+  <entity name="qscr" value="&#x1D4C6;"/>
+  <entity name="Qscr" value="&#x1D4AC;"/>
+  <entity name="quaternions" value="&#x0210D;"/>
+  <entity name="quatint" value="&#x02A16;"/>
+  <entity name="quest" value="&#x0003F;"/>
+  <entity name="questeq" value="&#x0225F;"/>
+  <entity name="quot" value="&#x00022;"/>
+  <entity name="rAarr" value="&#x021DB;"/>
+  <entity name="race" value="&#x029DA;"/>
+  <entity name="racute" value="&#x00155;"/>
+  <entity name="Racute" value="&#x00154;"/>
+  <entity name="radic" value="&#x0221A;"/>
+  <entity name="raemptyv" value="&#x029B3;"/>
+  <entity name="rang" value="&#x0232A;"/>
+  <entity name="Rang" value="&#x0300B;"/>
+  <entity name="rangd" value="&#x02992;"/>
+  <entity name="range" value="&#x029A5;"/>
+  <entity name="rangle" value="&#x0232A;"/>
+  <entity name="raquo" value="&#x000BB;"/>
+  <entity name="rarr" value="&#x02192;"/>
+  <entity name="rArr" value="&#x021D2;"/>
+  <entity name="Rarr" value="&#x021A0;"/>
+  <entity name="rarrap" value="&#x02975;"/>
+  <entity name="rarrb" value="&#x021E5;"/>
+  <entity name="rarrbfs" value="&#x02920;"/>
+  <entity name="rarrc" value="&#x02933;"/>
+  <entity name="rarrfs" value="&#x0291E;"/>
+  <entity name="rarrhk" value="&#x021AA;"/>
+  <entity name="rarrlp" value="&#x021AC;"/>
+  <entity name="rarrpl" value="&#x02945;"/>
+  <entity name="rarrsim" value="&#x02974;"/>
+  <entity name="rarrtl" value="&#x021A3;"/>
+  <entity name="Rarrtl" value="&#x02916;"/>
+  <entity name="rarrw" value="&#x0219D;"/>
+  <entity name="ratail" value="&#x021A3;"/>
+  <entity name="rAtail" value="&#x0291C;"/>
+  <entity name="ratio" value="&#x02236;"/>
+  <entity name="rationals" value="&#x0211A;"/>
+  <entity name="rbarr" value="&#x0290D;"/>
+  <entity name="rBarr" value="&#x0290F;"/>
+  <entity name="RBarr" value="&#x02910;"/>
+  <entity name="rbbrk" value="&#x03015;"/>
+  <entity name="rbrace" value="&#x0007D;"/>
+  <entity name="rbrack" value="&#x0005D;"/>
+  <entity name="rbrke" value="&#x0298C;"/>
+  <entity name="rbrksld" value="&#x0298E;"/>
+  <entity name="rbrkslu" value="&#x02990;"/>
+  <entity name="rcaron" value="&#x00159;"/>
+  <entity name="Rcaron" value="&#x00158;"/>
+  <entity name="rcedil" value="&#x00157;"/>
+  <entity name="Rcedil" value="&#x00156;"/>
+  <entity name="rceil" value="&#x02309;"/>
+  <entity name="rcub" value="&#x0007D;"/>
+  <entity name="rcy" value="&#x00440;"/>
+  <entity name="Rcy" value="&#x00420;"/>
+  <entity name="rdca" value="&#x02937;"/>
+  <entity name="rdldhar" value="&#x02969;"/>
+  <entity name="rdquo" value="&#x0201D;"/>
+  <entity name="rdquor" value="&#x0201D;"/>
+  <entity name="rdsh" value="&#x021B3;"/>
+  <entity name="Re" value="&#x0211C;"/>
+  <entity name="real" value="&#x0211C;"/>
+  <entity name="realine" value="&#x0211B;"/>
+  <entity name="realpart" value="&#x0211C;"/>
+  <entity name="reals" value="&#x0211D;"/>
+  <entity name="rect" value="&#x025AD;"/>
+  <entity name="reg" value="&#x000AE;"/>
+  <entity name="ReverseElement" value="&#x0220B;"/>
+  <entity name="ReverseEquilibrium" value="&#x021CB;"/>
+  <entity name="ReverseUpEquilibrium" value="&#x0296F;"/>
+  <entity name="rfisht" value="&#x0297D;"/>
+  <entity name="rfloor" value="&#x0230B;"/>
+  <entity name="rfr" value="&#x1D52F;"/>
+  <entity name="Rfr" value="&#x0211C;"/>
+  <entity name="rHar" value="&#x02964;"/>
+  <entity name="rhard" value="&#x021C1;"/>
+  <entity name="rharu" value="&#x021C0;"/>
+  <entity name="rharul" value="&#x0296C;"/>
+  <entity name="rho" value="&#x003C1;"/>
+  <entity name="rhov" value="&#x003F1;"/>
+  <entity name="RightAngleBracket" value="&#x0232A;"/>
+  <entity name="rightarrow" value="&#x02192;"/>
+  <entity name="Rightarrow" value="&#x021D2;"/>
+  <entity name="RightArrow" value="&#x02192;"/>
+  <entity name="RightArrowBar" value="&#x021E5;"/>
+  <entity name="RightArrowLeftArrow" value="&#x021C4;"/>
+  <entity name="rightarrowtail" value="&#x021A3;"/>
+  <entity name="RightCeiling" value="&#x02309;"/>
+  <entity name="RightDoubleBracket" value="&#x0301B;"/>
+  <entity name="RightDownTeeVector" value="&#x0295D;"/>
+  <entity name="RightDownVector" value="&#x021C2;"/>
+  <entity name="RightDownVectorBar" value="&#x02955;"/>
+  <entity name="RightFloor" value="&#x0230B;"/>
+  <entity name="rightharpoondown" value="&#x021C1;"/>
+  <entity name="rightharpoonup" value="&#x021C0;"/>
+  <entity name="rightleftarrows" value="&#x021C4;"/>
+  <entity name="rightleftharpoons" value="&#x021CC;"/>
+  <entity name="rightrightarrows" value="&#x021C9;"/>
+  <entity name="rightsquigarrow" value="&#x0219D;"/>
+  <entity name="RightTee" value="&#x022A2;"/>
+  <entity name="RightTeeArrow" value="&#x021A6;"/>
+  <entity name="RightTeeVector" value="&#x0295B;"/>
+  <entity name="rightthreetimes" value="&#x022CC;"/>
+  <entity name="RightTriangle" value="&#x022B3;"/>
+  <entity name="RightTriangleBar" value="&#x029D0;"/>
+  <entity name="RightTriangleEqual" value="&#x022B5;"/>
+  <entity name="RightUpDownVector" value="&#x0294F;"/>
+  <entity name="RightUpTeeVector" value="&#x0295C;"/>
+  <entity name="RightUpVector" value="&#x021BE;"/>
+  <entity name="RightUpVectorBar" value="&#x02954;"/>
+  <entity name="RightVector" value="&#x021C0;"/>
+  <entity name="RightVectorBar" value="&#x02953;"/>
+  <entity name="ring" value="&#x002DA;"/>
+  <entity name="risingdotseq" value="&#x02253;"/>
+  <entity name="rlarr" value="&#x021C4;"/>
+  <entity name="rlhar" value="&#x021CC;"/>
+  <entity name="rmoust" value="&#x023B1;"/>
+  <entity name="rmoustache" value="&#x023B1;"/>
+  <entity name="rnmid" value="&#x02AEE;"/>
+  <entity name="roang" value="&#x0F559;"/>
+  <entity name="roarr" value="&#x021FE;"/>
+  <entity name="robrk" value="&#x0301B;"/>
+  <entity name="ropar" value="&#x03019;"/>
+  <entity name="ropf" value="&#x1D563;"/>
+  <entity name="Ropf" value="&#x0211D;"/>
+  <entity name="roplus" value="&#x02A2E;"/>
+  <entity name="rotimes" value="&#x02A35;"/>
+  <entity name="RoundImplies" value="&#x02970;"/>
+  <entity name="rpar" value="&#x00029;"/>
+  <entity name="rpargt" value="&#x02994;"/>
+  <entity name="rppolint" value="&#x02A12;"/>
+  <entity name="rrarr" value="&#x021C9;"/>
+  <entity name="Rrightarrow" value="&#x021DB;"/>
+  <entity name="rscr" value="&#x1D4C7;"/>
+  <entity name="Rscr" value="&#x0211B;"/>
+  <entity name="rsh" value="&#x021B1;"/>
+  <entity name="Rsh" value="&#x021B1;"/>
+  <entity name="rsqb" value="&#x0005D;"/>
+  <entity name="rsquo" value="&#x02019;"/>
+  <entity name="rsquor" value="&#x02019;"/>
+  <entity name="rthree" value="&#x022CC;"/>
+  <entity name="rtimes" value="&#x022CA;"/>
+  <entity name="rtri" value="&#x025B9;"/>
+  <entity name="rtrie" value="&#x022B5;"/>
+  <entity name="rtrif" value="&#x025B8;"/>
+  <entity name="rtriltri" value="&#x029CE;"/>
+  <entity name="RuleDelayed" value="&#x029F4;"/>
+  <entity name="ruluhar" value="&#x02968;"/>
+  <entity name="rx" value="&#x0211E;"/>
+  <entity name="sacute" value="&#x0015B;"/>
+  <entity name="Sacute" value="&#x0015A;"/>
+  <entity name="sc" value="&#x0227B;"/>
+  <entity name="Sc" value="&#x02ABC;"/>
+  <entity name="scap" value="&#x0227F;"/>
+  <entity name="scaron" value="&#x00161;"/>
+  <entity name="Scaron" value="&#x00160;"/>
+  <entity name="sccue" value="&#x0227D;"/>
+  <entity name="sce" value="&#x0227D;"/>
+  <entity name="scE" value="&#x0227E;"/>
+  <entity name="scedil" value="&#x0015F;"/>
+  <entity name="Scedil" value="&#x0015E;"/>
+  <entity name="scirc" value="&#x0015D;"/>
+  <entity name="Scirc" value="&#x0015C;"/>
+  <entity name="scnap" value="&#x022E9;"/>
+  <entity name="scnE" value="&#x02AB6;"/>
+  <entity name="scnsim" value="&#x022E9;"/>
+  <entity name="scpolint" value="&#x02A13;"/>
+  <entity name="scsim" value="&#x0227F;"/>
+  <entity name="scy" value="&#x00441;"/>
+  <entity name="Scy" value="&#x00421;"/>
+  <entity name="sdot" value="&#x022C5;"/>
+  <entity name="sdotb" value="&#x022A1;"/>
+  <entity name="sdote" value="&#x02A66;"/>
+  <entity name="searhk" value="&#x02925;"/>
+  <entity name="searr" value="&#x02198;"/>
+  <entity name="seArr" value="&#x021D8;"/>
+  <entity name="searrow" value="&#x02198;"/>
+  <entity name="sect" value="&#x000A7;"/>
+  <entity name="semi" value="&#x0003B;"/>
+  <entity name="seswar" value="&#x02929;"/>
+  <entity name="setminus" value="&#x02216;"/>
+  <entity name="setmn" value="&#x02216;"/>
+  <entity name="sext" value="&#x02736;"/>
+  <entity name="sfr" value="&#x1D530;"/>
+  <entity name="Sfr" value="&#x1D516;"/>
+  <entity name="sharp" value="&#x0266F;"/>
+  <entity name="shchcy" value="&#x00449;"/>
+  <entity name="SHCHcy" value="&#x00429;"/>
+  <entity name="shcy" value="&#x00448;"/>
+  <entity name="SHcy" value="&#x00428;"/>
+  <entity name="ShortDownArrow" value="&#x02304;&#x0FE00;"/>
+  <entity name="ShortLeftArrow" value="&#x02190;&#x0FE00;"/>
+  <entity name="shortmid" value="&#x02223;&#x0FE00;"/>
+  <entity name="shortparallel" value="&#x02225;&#x0FE00;"/>
+  <entity name="ShortRightArrow" value="&#x02192;&#x0FE00;"/>
+  <entity name="ShortUpArrow" value="&#x02303;&#x0FE00;"/>
+  <entity name="shy" value="&#x000AD;"/>
+  <entity name="sigma" value="&#x003C3;"/>
+  <entity name="Sigma" value="&#x003A3;"/>
+  <entity name="sigmav" value="&#x003C2;"/>
+  <entity name="sim" value="&#x0223C;"/>
+  <entity name="simdot" value="&#x02A6A;"/>
+  <entity name="sime" value="&#x02243;"/>
+  <entity name="simeq" value="&#x02243;"/>
+  <entity name="simg" value="&#x02A9E;"/>
+  <entity name="simgE" value="&#x02AA0;"/>
+  <entity name="siml" value="&#x02A9D;"/>
+  <entity name="simlE" value="&#x02A9F;"/>
+  <entity name="simne" value="&#x02246;"/>
+  <entity name="simplus" value="&#x02A24;"/>
+  <entity name="simrarr" value="&#x02972;"/>
+  <entity name="slarr" value="&#x02190;&#x0FE00;"/>
+  <entity name="SmallCircle" value="&#x02218;"/>
+  <entity name="smallsetminus" value="&#x02216;&#x0FE00;"/>
+  <entity name="smashp" value="&#x02A33;"/>
+  <entity name="smeparsl" value="&#x029E4;"/>
+  <entity name="smid" value="&#x02223;&#x0FE00;"/>
+  <entity name="smile" value="&#x02323;"/>
+  <entity name="smt" value="&#x02AAA;"/>
+  <entity name="smte" value="&#x02AAC;"/>
+  <entity name="smtes" value="&#x02AAC;&#x0FE00;"/>
+  <entity name="softcy" value="&#x0044C;"/>
+  <entity name="SOFTcy" value="&#x0042C;"/>
+  <entity name="sol" value="&#x0002F;"/>
+  <entity name="solb" value="&#x029C4;"/>
+  <entity name="solbar" value="&#x0233F;"/>
+  <entity name="sopf" value="&#x1D564;"/>
+  <entity name="Sopf" value="&#x1D54A;"/>
+  <entity name="spades" value="&#x02660;"/>
+  <entity name="spadesuit" value="&#x02660;"/>
+  <entity name="spar" value="&#x02225;&#x0FE00;"/>
+  <entity name="sqcap" value="&#x02293;"/>
+  <entity name="sqcaps" value="&#x02293;&#x0FE00;"/>
+  <entity name="sqcup" value="&#x02294;"/>
+  <entity name="sqcups" value="&#x02294;&#x0FE00;"/>
+  <entity name="Sqrt" value="&#x0221A;"/>
+  <entity name="sqsub" value="&#x0228F;"/>
+  <entity name="sqsube" value="&#x02291;"/>
+  <entity name="sqsubset" value="&#x0228F;"/>
+  <entity name="sqsubseteq" value="&#x02291;"/>
+  <entity name="sqsup" value="&#x02290;"/>
+  <entity name="sqsupe" value="&#x02292;"/>
+  <entity name="sqsupset" value="&#x02290;"/>
+  <entity name="sqsupseteq" value="&#x02292;"/>
+  <entity name="squ" value="&#x025A1;"/>
+  <entity name="square" value="&#x025A1;"/>
+  <entity name="Square" value="&#x025A1;"/>
+  <entity name="SquareIntersection" value="&#x02293;"/>
+  <entity name="SquareSubset" value="&#x0228F;"/>
+  <entity name="SquareSubsetEqual" value="&#x02291;"/>
+  <entity name="SquareSuperset" value="&#x02290;"/>
+  <entity name="SquareSupersetEqual" value="&#x02292;"/>
+  <entity name="SquareUnion" value="&#x02294;"/>
+  <entity name="squarf" value="&#x025AA;"/>
+  <entity name="squf" value="&#x025AA;"/>
+  <entity name="srarr" value="&#x02192;&#x0FE00;"/>
+  <entity name="sscr" value="&#x1D4C8;"/>
+  <entity name="Sscr" value="&#x1D4AE;"/>
+  <entity name="ssetmn" value="&#x02216;&#x0FE00;"/>
+  <entity name="sstarf" value="&#x022C6;"/>
+  <entity name="star" value="&#x022C6;"/>
+  <entity name="Star" value="&#x022C6;"/>
+  <entity name="starf" value="&#x02605;"/>
+  <entity name="straightepsilon" value="&#x003B5;"/>
+  <entity name="straightphi" value="&#x003C6;"/>
+  <entity name="Sub" value="&#x022D0;"/>
+  <entity name="subdot" value="&#x02ABD;"/>
+  <entity name="sube" value="&#x02286;"/>
+  <entity name="subE" value="&#x02286;"/>
+  <entity name="subedot" value="&#x02AC3;"/>
+  <entity name="submult" value="&#x02AC1;"/>
+  <entity name="subne" value="&#x0228A;"/>
+  <entity name="subnE" value="&#x0228A;"/>
+  <entity name="subplus" value="&#x02ABF;"/>
+  <entity name="subrarr" value="&#x02979;"/>
+  <entity name="subset" value="&#x02282;"/>
+  <entity name="Subset" value="&#x022D0;"/>
+  <entity name="subseteq" value="&#x02286;"/>
+  <entity name="subseteqq" value="&#x02286;"/>
+  <entity name="SubsetEqual" value="&#x02286;"/>
+  <entity name="subsetneq" value="&#x0228A;"/>
+  <entity name="subsetneqq" value="&#x0228A;"/>
+  <entity name="subsim" value="&#x02AC7;"/>
+  <entity name="subsub" value="&#x02AD5;"/>
+  <entity name="subsup" value="&#x02AD3;"/>
+  <entity name="succ" value="&#x0227B;"/>
+  <entity name="succapprox" value="&#x0227F;"/>
+  <entity name="succcurlyeq" value="&#x0227D;"/>
+  <entity name="Succeeds" value="&#x0227B;"/>
+  <entity name="SucceedsEqual" value="&#x0227D;"/>
+  <entity name="SucceedsSlantEqual" value="&#x0227D;"/>
+  <entity name="SucceedsTilde" value="&#x0227F;"/>
+  <entity name="succeq" value="&#x0227D;"/>
+  <entity name="succnapprox" value="&#x022E9;"/>
+  <entity name="succneqq" value="&#x02AB6;"/>
+  <entity name="succnsim" value="&#x022E9;"/>
+  <entity name="succsim" value="&#x0227F;"/>
+  <entity name="SuchThat" value="&#x0220B;"/>
+  <entity name="sum" value="&#x02211;"/>
+  <entity name="Sum" value="&#x02211;"/>
+  <entity name="sung" value="&#x0266A;"/>
+  <entity name="Sup" value="&#x022D1;"/>
+  <entity name="sup1" value="&#x000B9;"/>
+  <entity name="sup2" value="&#x000B2;"/>
+  <entity name="sup3" value="&#x000B3;"/>
+  <entity name="supdot" value="&#x02ABE;"/>
+  <entity name="supdsub" value="&#x02AD8;"/>
+  <entity name="supe" value="&#x02287;"/>
+  <entity name="supE" value="&#x02287;"/>
+  <entity name="supedot" value="&#x02AC4;"/>
+  <entity name="Superset" value="&#x02283;"/>
+  <entity name="SupersetEqual" value="&#x02287;"/>
+  <entity name="suphsol" value="&#x02283;&#x0002F;"/>
+  <entity name="suphsub" value="&#x02AD7;"/>
+  <entity name="suplarr" value="&#x0297B;"/>
+  <entity name="supmult" value="&#x02AC2;"/>
+  <entity name="supne" value="&#x0228B;"/>
+  <entity name="supnE" value="&#x0228B;"/>
+  <entity name="supplus" value="&#x02AC0;"/>
+  <entity name="supset" value="&#x02283;"/>
+  <entity name="Supset" value="&#x022D1;"/>
+  <entity name="supseteq" value="&#x02287;"/>
+  <entity name="supseteqq" value="&#x02287;"/>
+  <entity name="supsetneq" value="&#x0228B;"/>
+  <entity name="supsetneqq" value="&#x0228B;"/>
+  <entity name="supsim" value="&#x02AC8;"/>
+  <entity name="supsub" value="&#x02AD4;"/>
+  <entity name="supsup" value="&#x02AD6;"/>
+  <entity name="swarhk" value="&#x02926;"/>
+  <entity name="swarr" value="&#x02199;"/>
+  <entity name="swArr" value="&#x021D9;"/>
+  <entity name="swarrow" value="&#x02199;"/>
+  <entity name="swnwar" value="&#x0292A;"/>
+  <entity name="szlig" value="&#x000DF;"/>
+  <entity name="Tab" value="&#x00009;"/>
+  <entity name="target" value="&#x02316;"/>
+  <entity name="tau" value="&#x003C4;"/>
+  <entity name="tbrk" value="&#x023B4;"/>
+  <entity name="tcaron" value="&#x00165;"/>
+  <entity name="Tcaron" value="&#x00164;"/>
+  <entity name="tcedil" value="&#x00163;"/>
+  <entity name="Tcedil" value="&#x00162;"/>
+  <entity name="tcy" value="&#x00442;"/>
+  <entity name="Tcy" value="&#x00422;"/>
+  <entity name="tdot" value="&#x020DB;"/>
+  <entity name="telrec" value="&#x02315;"/>
+  <entity name="tfr" value="&#x1D531;"/>
+  <entity name="Tfr" value="&#x1D517;"/>
+  <entity name="there4" value="&#x02234;"/>
+  <entity name="therefore" value="&#x02234;"/>
+  <entity name="Therefore" value="&#x02234;"/>
+  <entity name="theta" value="&#x003B8;"/>
+  <entity name="Theta" value="&#x00398;"/>
+  <entity name="thetav" value="&#x003D1;"/>
+  <entity name="thickapprox" value="&#x02248;&#x0FE00;"/>
+  <entity name="thicksim" value="&#x0223C;&#x0FE00;"/>
+  <entity name="ThickSpace" value="&#x02009;&#x0200A;&#x0200A;"/>
+  <entity name="thinsp" value="&#x02009;"/>
+  <entity name="ThinSpace" value="&#x02009;"/>
+  <entity name="thkap" value="&#x02248;&#x0FE00;"/>
+  <entity name="thksim" value="&#x0223C;&#x0FE00;"/>
+  <entity name="thorn" value="&#x000FE;"/>
+  <entity name="THORN" value="&#x000DE;"/>
+  <entity name="tilde" value="&#x002DC;"/>
+  <entity name="Tilde" value="&#x0223C;"/>
+  <entity name="TildeEqual" value="&#x02243;"/>
+  <entity name="TildeFullEqual" value="&#x02245;"/>
+  <entity name="TildeTilde" value="&#x02248;"/>
+  <entity name="times" value="&#x000D7;"/>
+  <entity name="timesb" value="&#x022A0;"/>
+  <entity name="timesbar" value="&#x02A31;"/>
+  <entity name="timesd" value="&#x02A30;"/>
+  <entity name="tint" value="&#x0222D;"/>
+  <entity name="toea" value="&#x02928;"/>
+  <entity name="top" value="&#x022A4;"/>
+  <entity name="topbot" value="&#x02336;"/>
+  <entity name="topcir" value="&#x02AF1;"/>
+  <entity name="topf" value="&#x1D565;"/>
+  <entity name="Topf" value="&#x1D54B;"/>
+  <entity name="topfork" value="&#x02ADA;"/>
+  <entity name="tosa" value="&#x02929;"/>
+  <entity name="tprime" value="&#x02034;"/>
+  <entity name="trade" value="&#x02122;"/>
+  <entity name="triangle" value="&#x025B5;"/>
+  <entity name="triangledown" value="&#x025BF;"/>
+  <entity name="triangleleft" value="&#x025C3;"/>
+  <entity name="trianglelefteq" value="&#x022B4;"/>
+  <entity name="triangleq" value="&#x0225C;"/>
+  <entity name="triangleright" value="&#x025B9;"/>
+  <entity name="trianglerighteq" value="&#x022B5;"/>
+  <entity name="tridot" value="&#x025EC;"/>
+  <entity name="trie" value="&#x0225C;"/>
+  <entity name="triminus" value="&#x02A3A;"/>
+  <entity name="TripleDot" value="&#x020DB;"/>
+  <entity name="triplus" value="&#x02A39;"/>
+  <entity name="trisb" value="&#x029CD;"/>
+  <entity name="tritime" value="&#x02A3B;"/>
+  <entity name="tscr" value="&#x1D4C9;"/>
+  <entity name="Tscr" value="&#x1D4AF;"/>
+  <entity name="tscy" value="&#x00446;"/>
+  <entity name="TScy" value="&#x00426;"/>
+  <entity name="tshcy" value="&#x0045B;"/>
+  <entity name="TSHcy" value="&#x0040B;"/>
+  <entity name="tstrok" value="&#x00167;"/>
+  <entity name="Tstrok" value="&#x00166;"/>
+  <entity name="twixt" value="&#x0226C;"/>
+  <entity name="twoheadleftarrow" value="&#x0219E;"/>
+  <entity name="twoheadrightarrow" value="&#x021A0;"/>
+  <entity name="uacute" value="&#x000FA;"/>
+  <entity name="Uacute" value="&#x000DA;"/>
+  <entity name="uarr" value="&#x02191;"/>
+  <entity name="uArr" value="&#x021D1;"/>
+  <entity name="Uarr" value="&#x0219F;"/>
+  <entity name="Uarrocir" value="&#x02949;"/>
+  <entity name="ubrcy" value="&#x0045E;"/>
+  <entity name="Ubrcy" value="&#x0040E;"/>
+  <entity name="ubreve" value="&#x0016D;"/>
+  <entity name="Ubreve" value="&#x0016C;"/>
+  <entity name="ucirc" value="&#x000FB;"/>
+  <entity name="Ucirc" value="&#x000DB;"/>
+  <entity name="ucy" value="&#x00443;"/>
+  <entity name="Ucy" value="&#x00423;"/>
+  <entity name="udarr" value="&#x021C5;"/>
+  <entity name="udblac" value="&#x00171;"/>
+  <entity name="Udblac" value="&#x00170;"/>
+  <entity name="udhar" value="&#x0296E;"/>
+  <entity name="ufisht" value="&#x0297E;"/>
+  <entity name="ufr" value="&#x1D532;"/>
+  <entity name="Ufr" value="&#x1D518;"/>
+  <entity name="ugrave" value="&#x000F9;"/>
+  <entity name="Ugrave" value="&#x000D9;"/>
+  <entity name="uHar" value="&#x02963;"/>
+  <entity name="uharl" value="&#x021BF;"/>
+  <entity name="uharr" value="&#x021BE;"/>
+  <entity name="uhblk" value="&#x02580;"/>
+  <entity name="ulcorn" value="&#x0231C;"/>
+  <entity name="ulcorner" value="&#x0231C;"/>
+  <entity name="ulcrop" value="&#x0230F;"/>
+  <entity name="ultri" value="&#x025F8;"/>
+  <entity name="umacr" value="&#x0016B;"/>
+  <entity name="Umacr" value="&#x0016A;"/>
+  <entity name="uml" value="&#x000A8;"/>
+  <entity name="UnderBar" value="&#x00332;"/>
+  <entity name="UnderBrace" value="&#x0FE38;"/>
+  <entity name="UnderBracket" value="&#x023B5;"/>
+  <entity name="UnderParenthesis" value="&#x0FE36;"/>
+  <entity name="Union" value="&#x022C3;"/>
+  <entity name="UnionPlus" value="&#x0228E;"/>
+  <entity name="uogon" value="&#x00173;"/>
+  <entity name="Uogon" value="&#x00172;"/>
+  <entity name="uopf" value="&#x1D566;"/>
+  <entity name="Uopf" value="&#x1D54C;"/>
+  <entity name="uparrow" value="&#x02191;"/>
+  <entity name="Uparrow" value="&#x021D1;"/>
+  <entity name="UpArrow" value="&#x02191;"/>
+  <entity name="UpArrowBar" value="&#x02912;"/>
+  <entity name="UpArrowDownArrow" value="&#x021C5;"/>
+  <entity name="updownarrow" value="&#x02195;"/>
+  <entity name="Updownarrow" value="&#x021D5;"/>
+  <entity name="UpDownArrow" value="&#x02195;"/>
+  <entity name="UpEquilibrium" value="&#x0296E;"/>
+  <entity name="upharpoonleft" value="&#x021BF;"/>
+  <entity name="upharpoonright" value="&#x021BE;"/>
+  <entity name="uplus" value="&#x0228E;"/>
+  <entity name="UpperLeftArrow" value="&#x02196;"/>
+  <entity name="UpperRightArrow" value="&#x02197;"/>
+  <entity name="upsi" value="&#x003C5;"/>
+  <entity name="Upsi" value="&#x003D2;"/>
+  <entity name="upsilon" value="&#x003C5;"/>
+  <entity name="Upsilon" value="&#x003D2;"/>
+  <entity name="UpTee" value="&#x022A5;"/>
+  <entity name="UpTeeArrow" value="&#x021A5;"/>
+  <entity name="upuparrows" value="&#x021C8;"/>
+  <entity name="urcorn" value="&#x0231D;"/>
+  <entity name="urcorner" value="&#x0231D;"/>
+  <entity name="urcrop" value="&#x0230E;"/>
+  <entity name="uring" value="&#x0016F;"/>
+  <entity name="Uring" value="&#x0016E;"/>
+  <entity name="urtri" value="&#x025F9;"/>
+  <entity name="uscr" value="&#x1D4CA;"/>
+  <entity name="Uscr" value="&#x1D4B0;"/>
+  <entity name="utdot" value="&#x022F0;"/>
+  <entity name="utilde" value="&#x00169;"/>
+  <entity name="Utilde" value="&#x00168;"/>
+  <entity name="utri" value="&#x025B5;"/>
+  <entity name="utrif" value="&#x025B4;"/>
+  <entity name="uuarr" value="&#x021C8;"/>
+  <entity name="uuml" value="&#x000FC;"/>
+  <entity name="Uuml" value="&#x000DC;"/>
+  <entity name="uwangle" value="&#x029A7;"/>
+  <entity name="vangrt" value="&#x022BE;"/>
+  <entity name="varepsilon" value="&#x0025B;"/>
+  <entity name="varkappa" value="&#x003F0;"/>
+  <entity name="varnothing" value="&#x02205;"/>
+  <entity name="varphi" value="&#x003D5;"/>
+  <entity name="varpi" value="&#x003D6;"/>
+  <entity name="varpropto" value="&#x0221D;"/>
+  <entity name="varr" value="&#x02195;"/>
+  <entity name="vArr" value="&#x021D5;"/>
+  <entity name="varrho" value="&#x003F1;"/>
+  <entity name="varsigma" value="&#x003C2;"/>
+  <entity name="varsubsetneq" value="&#x0228A;&#x0FE00;"/>
+  <entity name="varsubsetneqq" value="&#x0228A;&#x0FE00;"/>
+  <entity name="varsupsetneq" value="&#x0228B;&#x0FE00;"/>
+  <entity name="varsupsetneqq" value="&#x0228B;&#x0FE00;"/>
+  <entity name="vartheta" value="&#x003D1;"/>
+  <entity name="vartriangleleft" value="&#x022B2;"/>
+  <entity name="vartriangleright" value="&#x022B3;"/>
+  <entity name="vBar" value="&#x02AE8;"/>
+  <entity name="Vbar" value="&#x02AEB;"/>
+  <entity name="vBarv" value="&#x02AE9;"/>
+  <entity name="vcy" value="&#x00432;"/>
+  <entity name="Vcy" value="&#x00412;"/>
+  <entity name="vdash" value="&#x022A2;"/>
+  <entity name="vDash" value="&#x022A8;"/>
+  <entity name="Vdash" value="&#x022A9;"/>
+  <entity name="VDash" value="&#x022AB;"/>
+  <entity name="Vdashl" value="&#x02AE6;"/>
+  <entity name="vee" value="&#x02228;"/>
+  <entity name="Vee" value="&#x022C1;"/>
+  <entity name="veebar" value="&#x022BB;"/>
+  <entity name="veeeq" value="&#x0225A;"/>
+  <entity name="vellip" value="&#x022EE;"/>
+  <entity name="verbar" value="&#x0007C;"/>
+  <entity name="Verbar" value="&#x02016;"/>
+  <entity name="vert" value="&#x0007C;"/>
+  <entity name="Vert" value="&#x02016;"/>
+  <entity name="VerticalBar" value="&#x02223;"/>
+  <entity name="VerticalLine" value="&#x0007C;"/>
+  <entity name="VerticalSeparator" value="&#x02758;"/>
+  <entity name="VerticalTilde" value="&#x02240;"/>
+  <entity name="VeryThinSpace" value="&#x0200A;"/>
+  <entity name="vfr" value="&#x1D533;"/>
+  <entity name="Vfr" value="&#x1D519;"/>
+  <entity name="vltri" value="&#x022B2;"/>
+  <entity name="vnsub" value="&#x02284;"/>
+  <entity name="vnsup" value="&#x02285;"/>
+  <entity name="vopf" value="&#x1D567;"/>
+  <entity name="Vopf" value="&#x1D54D;"/>
+  <entity name="vprop" value="&#x0221D;"/>
+  <entity name="vrtri" value="&#x022B3;"/>
+  <entity name="vscr" value="&#x1D4CB;"/>
+  <entity name="Vscr" value="&#x1D4B1;"/>
+  <entity name="vsubne" value="&#x0228A;&#x0FE00;"/>
+  <entity name="vsubnE" value="&#x0228A;&#x0FE00;"/>
+  <entity name="vsupne" value="&#x0228B;&#x0FE00;"/>
+  <entity name="vsupnE" value="&#x0228B;&#x0FE00;"/>
+  <entity name="Vvdash" value="&#x022AA;"/>
+  <entity name="vzigzag" value="&#x0299A;"/>
+  <entity name="wcirc" value="&#x00175;"/>
+  <entity name="Wcirc" value="&#x00174;"/>
+  <entity name="wedbar" value="&#x02A5F;"/>
+  <entity name="wedge" value="&#x02227;"/>
+  <entity name="Wedge" value="&#x022C0;"/>
+  <entity name="wedgeq" value="&#x02259;"/>
+  <entity name="weierp" value="&#x02118;"/>
+  <entity name="wfr" value="&#x1D534;"/>
+  <entity name="Wfr" value="&#x1D51A;"/>
+  <entity name="wopf" value="&#x1D568;"/>
+  <entity name="Wopf" value="&#x1D54E;"/>
+  <entity name="wp" value="&#x02118;"/>
+  <entity name="wr" value="&#x02240;"/>
+  <entity name="wreath" value="&#x02240;"/>
+  <entity name="wscr" value="&#x1D4CC;"/>
+  <entity name="Wscr" value="&#x1D4B2;"/>
+  <entity name="xcap" value="&#x022C2;"/>
+  <entity name="xcirc" value="&#x025EF;"/>
+  <entity name="xcup" value="&#x022C3;"/>
+  <entity name="xdtri" value="&#x025BD;"/>
+  <entity name="xfr" value="&#x1D535;"/>
+  <entity name="Xfr" value="&#x1D51B;"/>
+  <entity name="xharr" value="&#x0F578;"/>
+  <entity name="xhArr" value="&#x0F57B;"/>
+  <entity name="xi" value="&#x003BE;"/>
+  <entity name="Xi" value="&#x0039E;"/>
+  <entity name="xlarr" value="&#x0F576;"/>
+  <entity name="xlArr" value="&#x0F579;"/>
+  <entity name="xmap" value="&#x0F57D;"/>
+  <entity name="xnis" value="&#x022FB;"/>
+  <entity name="xodot" value="&#x02299;"/>
+  <entity name="xopf" value="&#x1D569;"/>
+  <entity name="Xopf" value="&#x1D54F;"/>
+  <entity name="xoplus" value="&#x02295;"/>
+  <entity name="xotime" value="&#x02297;"/>
+  <entity name="xrarr" value="&#x0F577;"/>
+  <entity name="xrArr" value="&#x0F57A;"/>
+  <entity name="xscr" value="&#x1D4CD;"/>
+  <entity name="Xscr" value="&#x1D4B3;"/>
+  <entity name="xsqcup" value="&#x02294;"/>
+  <entity name="xuplus" value="&#x0228E;"/>
+  <entity name="xutri" value="&#x025B3;"/>
+  <entity name="xvee" value="&#x022C1;"/>
+  <entity name="xwedge" value="&#x022C0;"/>
+  <entity name="yacute" value="&#x000FD;"/>
+  <entity name="Yacute" value="&#x000DD;"/>
+  <entity name="yacy" value="&#x0044F;"/>
+  <entity name="YAcy" value="&#x0042F;"/>
+  <entity name="ycirc" value="&#x00177;"/>
+  <entity name="Ycirc" value="&#x00176;"/>
+  <entity name="ycy" value="&#x0044B;"/>
+  <entity name="Ycy" value="&#x0042B;"/>
+  <entity name="yen" value="&#x000A5;"/>
+  <entity name="yfr" value="&#x1D536;"/>
+  <entity name="Yfr" value="&#x1D51C;"/>
+  <entity name="yicy" value="&#x00457;"/>
+  <entity name="YIcy" value="&#x00407;"/>
+  <entity name="yopf" value="&#x1D56A;"/>
+  <entity name="Yopf" value="&#x1D550;"/>
+  <entity name="yscr" value="&#x1D4CE;"/>
+  <entity name="Yscr" value="&#x1D4B4;"/>
+  <entity name="yucy" value="&#x0044E;"/>
+  <entity name="YUcy" value="&#x0042E;"/>
+  <entity name="yuml" value="&#x000FF;"/>
+  <entity name="Yuml" value="&#x00178;"/>
+  <entity name="zacute" value="&#x0017A;"/>
+  <entity name="Zacute" value="&#x00179;"/>
+  <entity name="zcaron" value="&#x0017E;"/>
+  <entity name="Zcaron" value="&#x0017D;"/>
+  <entity name="zcy" value="&#x00437;"/>
+  <entity name="Zcy" value="&#x00417;"/>
+  <entity name="zdot" value="&#x0017C;"/>
+  <entity name="Zdot" value="&#x0017B;"/>
+  <entity name="zeetrf" value="&#x02128;"/>
+  <entity name="ZeroWidthSpace" value="&#x0200B;"/>
+  <entity name="zeta" value="&#x003B6;"/>
+  <entity name="zfr" value="&#x1D537;"/>
+  <entity name="Zfr" value="&#x02128;"/>
+  <entity name="zhcy" value="&#x00436;"/>
+  <entity name="ZHcy" value="&#x00416;"/>
+  <entity name="zigrarr" value="&#x021DD;"/>
+  <entity name="zopf" value="&#x1D56B;"/>
+  <entity name="Zopf" value="&#x02124;"/>
+  <entity name="zscr" value="&#x1D4CF;"/>
+  <entity name="Zscr" value="&#x1D4B5;"/>
+</entities-table>
diff --git a/components/syntax_extensions/data/extra-entities.xml b/components/syntax_extensions/data/extra-entities.xml
new file mode 100644 (file)
index 0000000..73b12ad
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+
+<entities-table>
+  <entity name="def" value="&#x0225d;"/>  <!-- ≝ -->
+  <entity name="neq" value="&#x02260;"/>  <!-- ≠ -->
+  <entity name="leq" value="&#x02264;"/>  <!-- ≤ -->
+  <entity name="geq" value="&#x02265;"/>  <!-- ≥ -->
+  <entity name="nleq" value="&#x02270;"/> <!-- ≰ -->
+  <entity name="ngeq" value="&#x02271;"/> <!-- ≱ -->
+  <entity name="to" value="&#x02192;"/>   <!-- → -->
+  <entity name="divides" value="&#x02223;"/>  <!-- ∣ -->
+  <entity name="ndivides" value="&#x02224;"/>  <!-- ∤ -->
+  <entity name="circ" value="&#x02218;"/>  <!-- ∤ -->
+</entities-table>
+
+<!-- vim: set encoding=utf8: -->
diff --git a/components/syntax_extensions/make_table.ml b/components/syntax_extensions/make_table.ml
new file mode 100644 (file)
index 0000000..59204c6
--- /dev/null
@@ -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 (file)
index 0000000..d81ec21
--- /dev/null
@@ -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 (file)
index 0000000..9f5034a
--- /dev/null
@@ -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 (file)
index 0000000..8f98bfd
--- /dev/null
@@ -0,0 +1,3 @@
+(* $Id$ *)
+
+prerr_endline <:unicode<lambda>>
diff --git a/components/syntax_extensions/utf8Macro.ml b/components/syntax_extensions/utf8Macro.ml
new file mode 100644 (file)
index 0000000..36d6b17
--- /dev/null
@@ -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 (file)
index 0000000..b21ba50
--- /dev/null
@@ -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 (file)
index 0000000..eefdcea
--- /dev/null
@@ -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 (file)
index 0000000..50f62cb
--- /dev/null
@@ -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 (file)
index 0000000..579ab17
--- /dev/null
@@ -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 (file)
index 0000000..579ab17
--- /dev/null
@@ -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 (file)
index 0000000..7c9f00d
--- /dev/null
@@ -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 (file)
index 0000000..ba80608
--- /dev/null
@@ -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 (file)
index 0000000..a40d00f
--- /dev/null
@@ -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 (file)
index 0000000..b12b26c
--- /dev/null
@@ -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 (file)
index 0000000..61c6588
--- /dev/null
@@ -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 (file)
index 0000000..874a20d
--- /dev/null
@@ -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 (file)
index 0000000..ab05564
--- /dev/null
@@ -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 (file)
index 0000000..7ed3c36
--- /dev/null
@@ -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 (file)
index 0000000..0d5a2e5
--- /dev/null
@@ -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 (file)
index 0000000..6bc3dd0
--- /dev/null
@@ -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 (file)
index 0000000..44db74b
--- /dev/null
@@ -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 (file)
index 0000000..044fa45
--- /dev/null
@@ -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 <abs>"
+
+  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 (file)
index 0000000..277dfe3
--- /dev/null
@@ -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 (file)
index 0000000..c248d0c
--- /dev/null
@@ -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 (file)
index 0000000..8fd91b0
--- /dev/null
@@ -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 (file)
index 0000000..a8bfc00
--- /dev/null
@@ -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 (file)
index 0000000..cc3f0d5
--- /dev/null
@@ -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 (file)
index 0000000..b7d8fb4
--- /dev/null
@@ -0,0 +1,124 @@
+
+#
+# Generic makefile for latex
+#
+# Author: Stefano Zacchiroli <zack@bononia.it>
+#
+# 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 (file)
index 0000000..8b7bbc9
--- /dev/null
@@ -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 (file)
index 0000000..fc4afea
--- /dev/null
@@ -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 <return> 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&#2\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 (file)
index 0000000..a914d91
--- /dev/null
@@ -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 <return> 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 (file)
index 0000000..06952d6
--- /dev/null
@@ -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 (file)
index 0000000..c0d56b8
--- /dev/null
@@ -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 <return> 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 <return> 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 (file)
index 0000000..98257ca
--- /dev/null
@@ -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 <return> 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 (file)
index 0000000..b73af44
--- /dev/null
@@ -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 <return> 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 (file)
index 0000000..02202b3
--- /dev/null
@@ -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 <return> 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 <return> 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 <return> 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 (file)
index 0000000..29961db
--- /dev/null
@@ -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 (file)
index 0000000..b203bee
--- /dev/null
@@ -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 (file)
index 0000000..bd73865
--- /dev/null
@@ -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 (file)
index 0000000..1aa4817
--- /dev/null
@@ -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 (file)
index 0000000..d7728c0
--- /dev/null
@@ -0,0 +1,244 @@
+(***********************************************************************)
+(*  v      *   The Coq Proof Assistant  /  The Coq Development Team    *)
+(* <O___,, *        INRIA-Rocquencourt  &  LRI-CNRS-Orsay              *)
+(*   \VV/  *************************************************************)
+(*    //   *      This file is distributed under the terms of the      *)
+(*         *       GNU Lesser General Public License Version 2.1       *)
+(***********************************************************************)
+
+(* $Id$ *)
+
+(* Méthode d'élimination de Fourier *)
+(* Référence:
+Auteur(s) : Fourier, Jean-Baptiste-Joseph
+Titre(s) : Oeuvres de Fourier [Document électronique]. Tome second. Mémoires publiés dans divers recueils / publ. par les soins de M. Gaston Darboux,...
+Publication : Numérisation BnF de l'édition de Paris : Gauthier-Villars, 1890
+Pages: 326-327
+
+http://gallica.bnf.fr/
+*)
+
+(** @author The Coq Development Team *)
+
+
+(* Un peu de calcul sur les rationnels... 
+Les opérations rendent des rationnels normalisés,
+i.e. le numérateur et le dénominateur sont premiers entre eux.
+*)
+
+
+(** Type for coefficents *)
+type rational = {
+num:int; (** Numerator *)
+den:int;  (** Denumerator *)
+};;
+
+(** Debug function.
+    @param x the rational to print*)
+let print_rational x =
+        print_int x.num;
+        print_string "/";
+        print_int x.den
+;;
+
+let rec pgcd x y = if y = 0 then x else pgcd y (x mod y);;
+
+(** The constant 0*)
+let r0 = {num=0;den=1};;
+(** The constant 1*)
+let r1 = {num=1;den=1};;
+
+let rnorm x = let x = (if x.den<0 then {num=(-x.num);den=(-x.den)} else x) in
+              if x.num=0 then r0
+              else (let d=pgcd x.num x.den in
+                   let d= (if d<0 then -d else d) in
+                    {num=(x.num)/d;den=(x.den)/d});;
+
+(** Calculates the opposite of a rational.
+    @param x The rational
+    @return -x*)
+let rop x = rnorm {num=(-x.num);den=x.den};;
+
+(** Sums two rationals.
+    @param x A rational
+    @param y Another rational
+    @return x+y*)
+let rplus x y = rnorm {num=x.num*y.den + y.num*x.den;den=x.den*y.den};;
+(** Substracts two rationals.
+    @param x A rational
+    @param y Another rational
+    @return x-y*)
+let rminus x y = rnorm {num=x.num*y.den - y.num*x.den;den=x.den*y.den};;
+(** Multiplyes two rationals.
+    @param x A rational
+    @param y Another rational
+    @return x*y*)
+let rmult x y = rnorm {num=x.num*y.num;den=x.den*y.den};;
+(** Inverts arational.
+    @param x A rational
+    @return x{^ -1} *)
+let rinv x = rnorm {num=x.den;den=x.num};;
+(** Divides two rationals.
+    @param x A rational
+    @param y Another rational
+    @return x/y*)
+let rdiv x y = rnorm {num=x.num*y.den;den=x.den*y.num};;
+
+let rinf x y = x.num*y.den < y.num*x.den;;
+let rinfeq x y = x.num*y.den <= y.num*x.den;;
+
+
+(* {coef;hist;strict}, où coef=[c1; ...; cn; d], représente l'inéquation
+c1x1+...+cnxn < d si strict=true, <= sinon,
+hist donnant les coefficients (positifs) d'une combinaison linéaire qui permet d'obtenir l'inéquation à partir de celles du départ.
+*)
+
+type ineq = {coef:rational list;
+             hist:rational list;
+             strict:bool};;
+
+let pop x l = l:=x::(!l);;
+
+(* sépare la liste d'inéquations s selon que leur premier coefficient est 
+négatif, nul ou positif. *)
+let partitionne s =
+   let lpos=ref [] in
+   let lneg=ref [] in
+   let lnul=ref [] in
+   List.iter (fun ie -> 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 (file)
index 0000000..8b26bc2
--- /dev/null
@@ -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 (file)
index 0000000..8e44344
--- /dev/null
@@ -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<n*1/d
+*)
+
+let tac_zero_inf_pos (n,d) =
+ let tac_zero_inf_pos (n,d) status =
+   (*let cste = pf_parse_constr gl in*)
+   let pall str (proof,goal) t =
+     debug ("tac "^str^" :\n" );
+     let curi,metasenv,_subst,pbo,pty, attrs = proof in
+     let metano,context,ty = CicUtil.lookup_meta goal metasenv in
+     debug ("th = "^ CicPp.ppterm t ^"\n"); 
+     debug ("ty = "^ CicPp.ppterm ty^"\n"); 
+   in
+   let tacn=ref (mk_tactic (fun status -> 
+        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 (file)
index 0000000..e5790ec
--- /dev/null
@@ -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 (file)
index 0000000..8734837
--- /dev/null
@@ -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 (file)
index 0000000..f130fe7
--- /dev/null
@@ -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 (file)
index 0000000..8644826
--- /dev/null
@@ -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 (file)
index 0000000..d2608b8
--- /dev/null
@@ -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 (file)
index 0000000..7559f36
--- /dev/null
@@ -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 (file)
index 0000000..86bad46
--- /dev/null
@@ -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 (file)
index 0000000..d8caf93
--- /dev/null
@@ -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 (file)
index 0000000..c3a1272
--- /dev/null
@@ -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 (file)
index 0000000..e610212
--- /dev/null
@@ -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 (file)
index 0000000..2c8b996
--- /dev/null
@@ -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 (file)
index 0000000..f2dd37f
--- /dev/null
@@ -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 (file)
index 0000000..7cdf29c
--- /dev/null
@@ -0,0 +1 @@
+val init: unit -> unit
diff --git a/components/tactics/metadataQuery.ml b/components/tactics/metadataQuery.ml
new file mode 100644 (file)
index 0000000..abe192b
--- /dev/null
@@ -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 (file)
index 0000000..a1b5336
--- /dev/null
@@ -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 (file)
index 0000000..fb904bf
--- /dev/null
@@ -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 (file)
index 0000000..bfa3e8d
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
diff --git a/components/tactics/paramodulation/Makefile b/components/tactics/paramodulation/Makefile
new file mode 100644 (file)
index 0000000..2f3afa5
--- /dev/null
@@ -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 (file)
index 0000000..bf484ae
--- /dev/null
@@ -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 (file)
index 0000000..7893ecb
--- /dev/null
@@ -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<collect>> 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<collect>> in ()   *)
+;;
+
+let id_of e = 
+  let _,_,_,_,id = open_equality e in id
+;;
+
+let get_stats () = "" 
+(*
+  <:show<Equality.>> ^ 
+  "# 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 (file)
index 0000000..6eb48a0
--- /dev/null
@@ -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 (file)
index 0000000..85ec40f
--- /dev/null
@@ -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 (file)
index 0000000..f9b51a5
--- /dev/null
@@ -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 (file)
index 0000000..2a9de5f
--- /dev/null
@@ -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<Inference.>>*) ;;
diff --git a/components/tactics/paramodulation/founif.mli b/components/tactics/paramodulation/founif.mli
new file mode 100644 (file)
index 0000000..ef15292
--- /dev/null
@@ -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 (file)
index 0000000..4e14964
--- /dev/null
@@ -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 (file)
index 0000000..7f464d2
--- /dev/null
@@ -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 (file)
index 0000000..9739f1c
--- /dev/null
@@ -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<current contro active>> in *)
+      let maxm, res =
+        Indexing.superposition_right bag eq_uri !maxmeta env active_table current 
+      in
+(*       let _ = <:stop<current contro active>> 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<active contro current>> in *)
+      let pos = infer_positive curr_table ((*copy_of_current::*)active_list) in
+(*       let _ = <:stop<active contro current>> 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<simplify_goal_set new>> in *)
+                    let rc = simplify_goal_set bag env goals (a,b) in
+(*                     let _ = <:stop<simplify_goal_set new>> 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! <begin>";
+    prerr_endline (CicPp.pp goal_proof names); 
+    prerr_endline "THE PROOF DOES NOT TYPECHECK!";
+    prerr_endline error;
+    prerr_endline "THE PROOF DOES NOT TYPECHECK! <end>";
+    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 (file)
index 0000000..20b564f
--- /dev/null
@@ -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 (file)
index 0000000..7e8ab8b
--- /dev/null
@@ -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 (file)
index 0000000..6627bf0
--- /dev/null
@@ -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 (file)
index 0000000..02dbf69
--- /dev/null
@@ -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 (file)
index 0000000..c6e64b8
--- /dev/null
@@ -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 (file)
index 0000000..2f25415
--- /dev/null
@@ -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 (file)
index 0000000..47acc7c
--- /dev/null
@@ -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 (file)
index 0000000..890874a
--- /dev/null
@@ -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 (file)
index 0000000..b385122
--- /dev/null
@@ -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 (file)
index 0000000..39fb69b
--- /dev/null
@@ -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 (file)
index 0000000..016a7ba
--- /dev/null
@@ -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 <sacerdot@cs.unibo.it>               *)
+(*                                 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 (file)
index 0000000..f8cdec8
--- /dev/null
@@ -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 (file)
index 0000000..ea7586e
--- /dev/null
@@ -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 (file)
index 0000000..d8e9ed3
--- /dev/null
@@ -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 (file)
index 0000000..93436e7
--- /dev/null
@@ -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 (file)
index 0000000..7c7b833
--- /dev/null
@@ -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 (file)
index 0000000..9c39caa
--- /dev/null
@@ -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 (file)
index 0000000..f04e7dc
--- /dev/null
@@ -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 (file)
index 0000000..7695a4f
--- /dev/null
@@ -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 <uri, typeno, consno> 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 <uri, typeno> 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 ("<term1>" ^ (CicPp.ppterm t1) ^ "</term1>"));
+        warn (lazy ("<term2>" ^ (CicPp.ppterm t2) ^ "</term2>"));
+        (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 <aterms, varmap> 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 (file)
index 0000000..b6eb34b
--- /dev/null
@@ -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 (file)
index 0000000..7d0e958
--- /dev/null
@@ -0,0 +1,1904 @@
+(************************************************************************)
+(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
+(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
+(*   \VV/  **************************************************************)
+(*    //   *      This file is distributed under the terms of the       *)
+(*         *       GNU Lesser General Public License Version 2.1        *)
+(************************************************************************)
+
+(* $Id: setoid_replace.ml 8900 2006-06-06 14:40:27Z letouzey $ *)
+
+let default_eq () =
+ 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"))
+
+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 (file)
index 0000000..abe71f4
--- /dev/null
@@ -0,0 +1,70 @@
+(************************************************************************)
+(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
+(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
+(*   \VV/  **************************************************************)
+(*    //   *      This file is distributed under the terms of the       *)
+(*         *       GNU Lesser General Public License Version 2.1        *)
+(************************************************************************)
+
+(*i $Id: setoid_replace.mli 8779 2006-05-02 20:59:21Z letouzey $ i*)
+
+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 morphism_signature = (bool option * Cic.term) list * Cic.term
+
+val register_replace : (Cic.term -> 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 (file)
index 0000000..3780018
--- /dev/null
@@ -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 (file)
index 0000000..64a394d
--- /dev/null
@@ -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 (file)
index 0000000..cb700f7
--- /dev/null
@@ -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 <sacerdot@cs.unibo.it>              *)
+(*                                 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' =
+              "<h1 color=\"red\"> ^ Exception raised trying to apply " ^
+               uri ^ ": " ^ Printexc.to_string e ^ " </h1>" ^ exc
+             in
+              tl',exc'
+    in
+     filter_out uris
+  in
+    let html' =
+     " <h1>Objects that can actually be applied: </h1> " ^
+     String.concat "<br>" uris' ^ exc ^
+     " <h1>Number of false matches: " ^
+      string_of_int (List.length uris - List.length uris') ^ "</h1>" ^
+     " <h1>Number of good matches: " ^
+      string_of_int (List.length uris') ^ "</h1>"
+    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 (file)
index 0000000..f647ebc
--- /dev/null
@@ -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 (file)
index 0000000..44a6ab4
--- /dev/null
@@ -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 (file)
index 0000000..aa2e2bf
--- /dev/null
@@ -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 (file)
index 0000000..8c97039
--- /dev/null
@@ -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 (file)
index 0000000..99041ed
--- /dev/null
@@ -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 (file)
index 0000000..ee5dc48
--- /dev/null
@@ -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 (file)
index 0000000..3a3db7d
--- /dev/null
@@ -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 (file)
index 0000000..3557632
--- /dev/null
@@ -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 (file)
index 0000000..7759190
--- /dev/null
@@ -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 (file)
index 0000000..7759190
--- /dev/null
@@ -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 (file)
index 0000000..46f009e
--- /dev/null
@@ -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 (file)
index 0000000..d59cccd
--- /dev/null
@@ -0,0 +1,110 @@
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..5fb3bd4
--- /dev/null
@@ -0,0 +1,35 @@
+(*
+ * Copyright (C) 2003:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..b2c4277
--- /dev/null
@@ -0,0 +1,35 @@
+(*
+ * Copyright (C) 2003-2005:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..78166ab
--- /dev/null
@@ -0,0 +1,44 @@
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..afe9533
--- /dev/null
@@ -0,0 +1,100 @@
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 "<doCritical>");
+        (try
+          Mutex.lock mutex;
+          let res = Lazy.force action in
+          Mutex.unlock mutex;
+          debug_print (lazy "</doCritical>");
+          res
+        with e ->
+          Mutex.unlock mutex;
+          raise e);
+
+    method private doReader: 'a. 'a lazy_t -> 'a =
+      fun action ->
+        debug_print (lazy "<doReader>");
+        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 "</doReader>");
+        res
+
+      (* TODO may starve!!!! is what we want or not? *)
+    method private doWriter: 'a. 'a lazy_t -> 'a =
+      fun action ->
+        debug_print (lazy "<doWriter>");
+        self#doCritical (lazy (
+          while readersCount > 0 do
+            Condition.wait noReaders mutex
+          done;
+          let res = Lazy.force action in
+          debug_print (lazy "</doWriter>");
+          res
+        ))
+
+  end
+
diff --git a/components/thread/threadSafe.mli b/components/thread/threadSafe.mli
new file mode 100644 (file)
index 0000000..78166ab
--- /dev/null
@@ -0,0 +1,44 @@
+(*
+ * Copyright (C) 2003-2004:
+ *    Stefano Zacchiroli <zack@cs.unibo.it>
+ *    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 (file)
index 0000000..bc31032
--- /dev/null
@@ -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 (file)
index 0000000..c743002
--- /dev/null
@@ -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 (file)
index 0000000..4e4d316
--- /dev/null
@@ -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 (file)
index 0000000..b8f855d
--- /dev/null
@@ -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 (file)
index 0000000..b45d71c
--- /dev/null
@@ -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 (file)
index 0000000..845ea31
--- /dev/null
@@ -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 (file)
index 0000000..273d1b7
--- /dev/null
@@ -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 (file)
index 0000000..e52b77c
--- /dev/null
@@ -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 (file)
index 0000000..4fe1721
--- /dev/null
@@ -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 <string> TYPE
+  %token <string> COMMENT
+  %token <int> NUM
+  %token <string> LNAME
+  %token <string> UNAME
+  %token <string> 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 <Ast.ast list> 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 (file)
index 0000000..667b7e3
--- /dev/null
@@ -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 (file)
index 0000000..0cebccb
--- /dev/null
@@ -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 (file)
index 0000000..c394ddd
--- /dev/null
@@ -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 (file)
index 0000000..4821484
--- /dev/null
@@ -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 (file)
index 0000000..4821484
--- /dev/null
@@ -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 (file)
index 0000000..592c085
--- /dev/null
@@ -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 (file)
index 0000000..c0da8eb
--- /dev/null
@@ -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 (file)
index 0000000..0d4fcb4
--- /dev/null
@@ -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 (file)
index 0000000..39f37df
--- /dev/null
@@ -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 (file)
index 0000000..39f37df
--- /dev/null
@@ -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 (file)
index 0000000..6d8d395
--- /dev/null
@@ -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 (file)
index 0000000..5453c54
--- /dev/null
@@ -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 (file)
index 0000000..3e4936d
--- /dev/null
@@ -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 (file)
index 0000000..ef544f8
--- /dev/null
@@ -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 (file)
index 0000000..80c4d65
--- /dev/null
@@ -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 (file)
index 0000000..5ef59bd
--- /dev/null
@@ -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 (file)
index 0000000..5ef59bd
--- /dev/null
@@ -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 (file)
index 0000000..7948435
--- /dev/null
@@ -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 (file)
index 0000000..84c042e
--- /dev/null
@@ -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 (file)
index 0000000..0e3a4bc
--- /dev/null
@@ -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 <sacerdot@cs.unibo.it>               *)
+(*                                 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 ("</" ^ (pprefix p) ^ n ^ ">\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 "<?xml version=\"1.0\" ?>\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 (file)
index 0000000..4feca75
--- /dev/null
@@ -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 <sacerdot@cs.unibo.it>               *)
+(*                                 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 (file)
index 0000000..4f57e12
--- /dev/null
@@ -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 (file)
index 0000000..c13481c
--- /dev/null
@@ -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 <line, column> *)
+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 <line, column> pair *)
+val get_position: xml_parser -> position
+
diff --git a/components/xmldiff/.depend b/components/xmldiff/.depend
new file mode 100644 (file)
index 0000000..e2832de
--- /dev/null
@@ -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 (file)
index 0000000..e2832de
--- /dev/null
@@ -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 (file)
index 0000000..afffaee
--- /dev/null
@@ -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 (file)
index 0000000..6f68438
--- /dev/null
@@ -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 (file)
index 0000000..cf084af
--- /dev/null
@@ -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 (file)
index 0000000..f985336
--- /dev/null
@@ -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 (file)
index 0000000..df20a35
--- /dev/null
@@ -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 (file)
index 0000000..c243d79
--- /dev/null
@@ -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 (file)
index 0000000..8830a83
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
diff --git a/make/test/b.c b/make/test/b.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/make/test/c.c b/make/test/c.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/make/test/d.c b/make/test/d.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/make/test/e.c b/make/test/e.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/matita/.depend b/matita/.depend
new file mode 100644 (file)
index 0000000..b0d8efc
--- /dev/null
@@ -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 (file)
index 0000000..933d2bb
--- /dev/null
@@ -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 (file)
index 0000000..d936ad5
--- /dev/null
@@ -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 (file)
index 0000000..2b999b1
--- /dev/null
@@ -0,0 +1,6 @@
+Andrea Asperti <asperti@cs.unibo.it>
+Ferruccio Guidi <fguidi@cs.unibo.it>
+Luca Padovani <lpadovan@cs.unibo.it>
+Enrico Tassi <tassi@cs.unibo.it>
+Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
+Stefano Zacchiroli <zacchiro@cs.unibo.it>
diff --git a/matita/LICENSE b/matita/LICENSE
new file mode 100644 (file)
index 0000000..9e2c40c
--- /dev/null
@@ -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 (file)
index 0000000..6595af7
--- /dev/null
@@ -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 (file)
index 0000000..0309cf5
--- /dev/null
@@ -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 <asperti@cs.unibo.it>                  *)
+(*                                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
+           | _ -> "<<exception raised pretty-printing the exception>>"
+         ) ^ " ]] " ^
+        (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 (file)
index 0000000..788ef68
--- /dev/null
@@ -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 <asperti@cs.unibo.it>                  *)
+(*                                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 (executable)
index 0000000..87ece78
--- /dev/null
@@ -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 (executable)
index 0000000..32df4b0
--- /dev/null
@@ -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 (file)
index 0000000..ec01152
--- /dev/null
@@ -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 (file)
index 0000000..d3125ef
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<b:box xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:b="http://helm.cs.unibo.it/2003/BoxML">
+  <b:h>
+    <b:space width="2em"/>
+    <b:v>
+      <b:space height="2ex"/>
+      <b:v>
+        <b:decor style="box">
+         <b:space width="1ex" height="1ex"/>
+       </b:decor>
+       <b:space height="1ex"/>
+       <b:text>This goal has already been closed.</b:text>
+       <b:text>Use the "skip" command to throw it away.</b:text>
+      </b:v>
+    </b:v>
+  </b:h>
+</b:box>
diff --git a/matita/contribs/CoRN-Decl/CoRN.ma b/matita/contribs/CoRN-Decl/CoRN.ma
new file mode 100644 (file)
index 0000000..7a39a0e
--- /dev/null
@@ -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 "{<Q}" := Qlt (no associativity, at level 90).
+*)
+
+(* NOTATION
+Infix "{+Q}" := Qplus (no associativity, at level 85).
+*)
+
+(* NOTATION
+Infix "{*Q}" := Qmult (no associativity, at level 80).
+*)
+
+(* NOTATION
+Notation "{-Q}" := Qopp (at level 1, left associativity).
+*)
+
+coercion cic:/CoRN/model/structures/Qsec/inject_Z.con 0 (* compounds *).
+
+(* From model/structures/Zsec *********************************************)
+
+(* NOTATION
+Infix "{#Z}" := ap_Z (no associativity, at level 90).
+*)
+
+coercion cic:/Coq/ZArith/BinInt/Z.ind#xpointer(1/1/2) 0 (* compounds *).
+
+(* From reals/Bridges_LUB *************************************************)
+
+(* NOTATION
+Notation "( p , q )" := (pairT p q).
+*)
+
+(* From reals/CMetricFields ***********************************************)
+
+coercion cic:/CoRN/reals/CMetricFields/cmf_crr.con 0 (* compounds *).
+
+(* NOTATION
+Notation MAbs := (cmf_abs _).
+*)
+
+coercion cic:/CoRN/reals/CMetricFields/MCS_seq.con 0 (* compounds *).
+
+(* From reals/CReals ******************************************************)
+
+coercion cic:/CoRN/reals/CReals/crl_crr.con 0 (* compounds *).
+
+(* From reals/CauchySeq ***************************************************)
+
+(* NOTATION
+Notation PartIR := (PartFunct IR).
+*)
+
+(* NOTATION
+Notation ProjIR1 := (prj1 IR _ _ _).
+*)
+
+(* NOTATION
+Notation ProjIR2 := (prj2 IR _ _ _).
+*)
+
+(* NOTATION
+Notation ZeroR := (Zero:IR).
+*)
+
+(* NOTATION
+Notation OneR := (One:IR).
+*)
+
+(* From reals/Cauchy_CReals ***********************************************)
+
+(* NOTATION
+Notation "'R_COrdField''" := (R_COrdField F).
+*)
+
+(* From reals/Intervals ***************************************************)
+
+(* NOTATION
+Notation Compact := (compact _ _).
+*)
+
+(* NOTATION
+Notation FRestr := (Frestr (compact_wd _ _ _)).
+*)
+
+(* From reals/Q_dense *****************************************************)
+
+coercion cic:/CoRN/reals/Q_dense/pair_crr.con 0 (* compounds *).
+
+(* NOTATION
+Notation "( A , B )" := (pairT A B).
+*)
+
+(* From reals/Q_in_CReals *************************************************)
+
+coercion cic:/Coq/NArith/BinPos/nat_of_P.con 0 (* compounds *).
+
+(* From reals/R_morphism **************************************************)
+
+coercion cic:/CoRN/reals/R_morphism/map.con 0 (* compounds *).
+
+(* From tactics/FieldReflection *******************************************)
+
+(* NOTATION
+Notation II := (interpF F val unop binop pfun).
+*)
+
+(* From tactics/GroupReflection *******************************************)
+
+(* NOTATION
+Notation II := (interpG G val unop binop pfun).
+*)
+
+(* From tactics/RingReflection ********************************************)
+
+(* NOTATION
+Notation II := (interpR R val unop binop pfun).
+*)
+
+(* From transc/RealPowers *************************************************)
+
+(* NOTATION
+Notation "x [!] y [//] Hy" := (power x y Hy) (at level 20).
+*)
+
+(* NOTATION
+Notation "F {!} G" := (FPower F G) (at level 20).
+*)
+
+(* From devel/loeb/per/lst2fun ********************************************)
+
+coercion cic:/CoRN/devel/loeb/per/lst2fun/F_crr.con 0 (* compounds *).
+
+coercion cic:/CoRN/devel/loeb/per/lst2fun/to_nat.con 0 (* compounds *).
+
diff --git a/matita/contribs/CoRN-Decl/algebra/Basics.ma b/matita/contribs/CoRN-Decl/algebra/Basics.ma
new file mode 100644 (file)
index 0000000..3276657
--- /dev/null
@@ -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/CoRN-Decl/algebra/Basics".
+
+include "CoRN.ma".
+
+(* $Id: Basics.v,v 1.7 2004/04/09 15:58:31 lcf Exp $ *)
+
+(*#* printing alpha %\ensuremath{\alpha}% #&alpha;# *)
+
+(*#* printing beta %\ensuremath{\beta}% #&beta;# *)
+
+(*#* printing delta %\ensuremath{\delta}% #&delta;# *)
+
+(*#* printing eps %\ensuremath{\varepsilon}% #&epsilon;# *)
+
+(*#* printing phi %\ensuremath{\phi}% #&phi;# *)
+
+(*#* printing eta %\ensuremath{\eta}% #&eta;# *)
+
+(*#* printing omega %\ensuremath{\omega}% #&omega;# *)
+
+(*#* printing nat %\ensuremath{\mathbb N}% #<b>N</b># *)
+
+(*#* printing Z %\ensuremath{\mathbb Z}% #<b>Z</b># *)
+
+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 (file)
index 0000000..5548ff0
--- /dev/null
@@ -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 (file)
index 0000000..716750a
--- /dev/null
@@ -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 (file)
index 0000000..8f9f5b7
--- /dev/null
@@ -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% #&Dagger;# *)
+
+(*#* printing {/} %\ensuremath{/}% #/# *)
+
+(*#* printing {1/} %\ensuremath{\frac1\cdot}% #1/# *)
+
+(*#* printing [/]?[//] %\ensuremath{/?\ddagger}% #/?&Dagger;# *)
+
+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}% #<i>partial</i># 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 (file)
index 0000000..67d508c
--- /dev/null
@@ -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-% #&minus;# *)
+
+(*#* printing [--] %\ensuremath-% #&minus;# *)
+
+(*#* printing {-} %\ensuremath-% #&minus;# *)
+
+(*#* printing {--} %\ensuremath-% #&minus;# *)
+
+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 (file)
index 0000000..b1d55aa
--- /dev/null
@@ -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% #&hArr;# *)
+
+(*#* printing CFalse %\ensuremath\bot% #&perp;# *)
+
+(*#* printing False %\ensuremath\bot% #&perp;# *)
+
+(*#* 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 (file)
index 0000000..d7a0d53
--- /dev/null
@@ -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 (file)
index 0000000..5f34816
--- /dev/null
@@ -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 (file)
index 0000000..14f20ea
--- /dev/null
@@ -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 (file)
index 0000000..cb64766
--- /dev/null
@@ -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<% #&lt;# *)
+
+(*#* printing [<=] %\ensuremath{\leq}% #&le;# *)
+
+(*#* printing [>] %\ensuremath>% #&gt;# *)
+
+(*#* 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 (file)
index 0000000..655f755
--- /dev/null
@@ -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}% #&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 (file)
index 0000000..9a72ec0
--- /dev/null
@@ -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 (file)
index 0000000..79ec88e
--- /dev/null
@@ -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 (file)
index 0000000..c72a7ae
--- /dev/null
@@ -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 (file)
index 0000000..bd621de
--- /dev/null
@@ -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&times;# *)
+
+(*#* 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 (file)
index 0000000..2aa33c7
--- /dev/null
@@ -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% #&times;# *)
+
+(*#* printing [^] %\ensuremath{\hat{\ }}% #^# *)
+
+(*#* printing {*} %\ensuremath\times% #&times;# *)
+
+(*#* printing {**} %\ensuremath\ast% #&lowast;# *)
+
+(*#* 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 (file)
index 0000000..e107fad
--- /dev/null
@@ -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 (file)
index 0000000..f025d8a
--- /dev/null
@@ -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{%#<i>#a
+priori#</i>#%}% 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(&lang;s,H&rang;)#; 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(&lang;s,H&rang;)# 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 (file)
index 0000000..380219a
--- /dev/null
@@ -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}% #&sube;# *)
+
+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 (file)
index 0000000..a11ee12
--- /dev/null
@@ -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}% #&equiv;# *)
+
+(*#* printing [~=] %\ensuremath{\mathrel{\not\equiv}}% #&ne;# *)
+
+(*#* printing [#] %\ensuremath{\mathrel\#}% *)
+
+(*#* printing ex_unq %\ensuremath{\exists^1}% #&exist;<sup>1</sup># *)
+
+(*#* printing [o] %\ensuremath\circ% #&sdot;# *)
+
+(*#* 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 (file)
index 0000000..3930cbf
--- /dev/null
@@ -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}% #&sum;<sub>0</sub># *)
+
+(*#* printing Sum1 %\ensuremath{\sum_1}% #&sum;<sub>1</sub># *)
+
+(*#* printing Sum2 %\ensuremath{\sum_2}% #&sum;<sub>2</sub># *)
+
+(*#* printing Sum %\ensuremath{\sum}% #&sum;# *)
+
+(*#* printing Sumx %\ensuremath{\sum'}% #&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 (file)
index 0000000..7c3b812
--- /dev/null
@@ -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 (file)
index 0000000..bbf6cda
--- /dev/null
@@ -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 (file)
index 0000000..29bc341
--- /dev/null
@@ -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 (file)
index 0000000..f97dfd9
--- /dev/null
@@ -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    *)
+
+(* <O___,, *        INRIA-Rocquencourt  &  LRI-CNRS-Orsay              *)
+
+(*   \VV/  *************************************************************)
+
+(*    //   *      This file is distributed under the terms of the      *)
+
+(*         *       GNU Lesser General Public License Version 2.1       *)
+
+(*#**********************************************************************)
+
+(*i $Id: ListType.v,v 1.2 2004/03/26 16:07:02 lcf Exp $ i*)
+
+(* THIS IS A OLD CONTRIB. IT IS NO LONGER MAINTAINED ***)
+
+(* Moved to Type for CoRN *)
+
+(* end hide *)
+
+(*#*
+%\cleardoublepage\setcounter{page}{1}%
+*Lists in Type
+
+This file contains a variant of the development of lists in the standard
+library of Coq but moved to the Type level.
+*)
+
+(* UNEXPORTED
+Section List
+*)
+
+alias id "A" = "cic:/CoRN/algebra/ListType/List/A.var".
+
+inline "cic:/CoRN/algebra/ListType/list.ind".
+
+inline "cic:/CoRN/algebra/ListType/app.con".
+
+inline "cic:/CoRN/algebra/ListType/app_nil_end.con".
+
+(* UNEXPORTED
+Hint Resolve app_nil_end: list v62.
+*)
+
+inline "cic:/CoRN/algebra/ListType/app_ass.con".
+
+(* UNEXPORTED
+Hint Resolve app_ass: list v62.
+*)
+
+inline "cic:/CoRN/algebra/ListType/ass_app.con".
+
+(* UNEXPORTED
+Hint Resolve ass_app: list v62.
+*)
+
+inline "cic:/CoRN/algebra/ListType/tail.con".
+
+inline "cic:/CoRN/algebra/ListType/nil_cons.con".
+
+(*#***************************************)
+
+(* Length of lists                      *)
+
+(*#***************************************)
+
+inline "cic:/CoRN/algebra/ListType/length.con".
+
+(*#*****************************)
+
+(* Length order of lists      *)
+
+(*#*****************************)
+
+(* UNEXPORTED
+Section length_order
+*)
+
+inline "cic:/CoRN/algebra/ListType/lel.con".
+
+(* UNEXPORTED
+Hint Unfold lel: list.
+*)
+
+alias id "a" = "cic:/CoRN/algebra/ListType/List/length_order/a.var".
+
+alias id "b" = "cic:/CoRN/algebra/ListType/List/length_order/b.var".
+
+alias id "l" = "cic:/CoRN/algebra/ListType/List/length_order/l.var".
+
+alias id "m" = "cic:/CoRN/algebra/ListType/List/length_order/m.var".
+
+alias id "n" = "cic:/CoRN/algebra/ListType/List/length_order/n.var".
+
+inline "cic:/CoRN/algebra/ListType/lel_refl.con".
+
+inline "cic:/CoRN/algebra/ListType/lel_trans.con".
+
+inline "cic:/CoRN/algebra/ListType/lel_cons_cons.con".
+
+inline "cic:/CoRN/algebra/ListType/lel_cons.con".
+
+inline "cic:/CoRN/algebra/ListType/lel_tail.con".
+
+inline "cic:/CoRN/algebra/ListType/lel_nil.con".
+
+(* UNEXPORTED
+End length_order
+*)
+
+(* UNEXPORTED
+Hint Resolve lel_refl lel_cons_cons lel_cons lel_nil lel_nil nil_cons: list
+  v62.
+*)
+
+inline "cic:/CoRN/algebra/ListType/In.con".
+
+inline "cic:/CoRN/algebra/ListType/in_eq.con".
+
+(* UNEXPORTED
+Hint Resolve in_eq: list v62.
+*)
+
+inline "cic:/CoRN/algebra/ListType/in_cons.con".
+
+(* UNEXPORTED
+Hint Resolve in_cons: list v62.
+*)
+
+inline "cic:/CoRN/algebra/ListType/in_app_or.con".
+
+(* UNEXPORTED
+Hint Immediate in_app_or: list v62.
+*)
+
+inline "cic:/CoRN/algebra/ListType/in_or_app.con".
+
+(* UNEXPORTED
+Hint Resolve in_or_app: list v62.
+*)
+
+inline "cic:/CoRN/algebra/ListType/incl.con".
+
+(* UNEXPORTED
+Hint Unfold incl: list v62.
+*)
+
+inline "cic:/CoRN/algebra/ListType/incl_refl.con".
+
+(* UNEXPORTED
+Hint Resolve incl_refl: list v62.
+*)
+
+inline "cic:/CoRN/algebra/ListType/incl_tl.con".
+
+(* UNEXPORTED
+Hint Immediate incl_tl: list v62.
+*)
+
+inline "cic:/CoRN/algebra/ListType/incl_tran.con".
+
+inline "cic:/CoRN/algebra/ListType/incl_appl.con".
+
+(* UNEXPORTED
+Hint Immediate incl_appl: list v62.
+*)
+
+inline "cic:/CoRN/algebra/ListType/incl_appr.con".
+
+(* UNEXPORTED
+Hint Immediate incl_appr: list v62.
+*)
+
+inline "cic:/CoRN/algebra/ListType/incl_cons.con".
+
+(* UNEXPORTED
+Hint Resolve incl_cons: list v62.
+*)
+
+inline "cic:/CoRN/algebra/ListType/incl_app.con".
+
+(* UNEXPORTED
+End List
+*)
+
+(* UNEXPORTED
+Implicit Arguments length [A].
+*)
+
+(* UNEXPORTED
+Implicit Arguments In [A].
+*)
+
+(* UNEXPORTED
+Implicit Arguments cons [A].
+*)
+
+(* UNEXPORTED
+Section Map
+*)
+
+alias id "A" = "cic:/CoRN/algebra/ListType/Map/A.var".
+
+alias id "B" = "cic:/CoRN/algebra/ListType/Map/B.var".
+
+alias id "f" = "cic:/CoRN/algebra/ListType/Map/f.var".
+
+inline "cic:/CoRN/algebra/ListType/map.con".
+
+(* UNEXPORTED
+End Map
+*)
+
+(* UNEXPORTED
+Implicit Arguments map [A B].
+*)
+
+(* UNEXPORTED
+Hint Resolve incl_app: list v62.
+*)
+
diff --git a/matita/contribs/CoRN-Decl/complex/AbsCC.ma b/matita/contribs/CoRN-Decl/complex/AbsCC.ma
new file mode 100644 (file)
index 0000000..0182da4
--- /dev/null
@@ -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/complex/AbsCC".
+
+include "CoRN.ma".
+
+(* $Id: AbsCC.v,v 1.2 2004/04/23 10:00:54 lcf Exp $ *)
+
+include "complex/CComplex.ma".
+
+(*#* * Absolute value on [CC]
+** Properties of [AbsCC] *)
+
+(* UNEXPORTED
+Section AbsCC_properties
+*)
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_nonneg.con".
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_ap_zero_imp_pos.con".
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_wd.con".
+
+(* UNEXPORTED
+Hint Resolve AbsCC_wd: algebra_c.
+*)
+
+inline "cic:/CoRN/complex/AbsCC/cc_inv_abs.con".
+
+(* UNEXPORTED
+Hint Resolve cc_inv_abs: algebra.
+*)
+
+inline "cic:/CoRN/complex/AbsCC/cc_minus_abs.con".
+
+inline "cic:/CoRN/complex/AbsCC/cc_mult_abs.con".
+
+(* UNEXPORTED
+Hint Resolve cc_mult_abs: algebra.
+*)
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_minzero.con".
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_IR.con".
+
+(* UNEXPORTED
+Hint Resolve AbsCC_IR: algebra.
+*)
+
+inline "cic:/CoRN/complex/AbsCC/cc_div_abs.con".
+
+inline "cic:/CoRN/complex/AbsCC/cc_div_abs'.con".
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_zero.con".
+
+(* UNEXPORTED
+Hint Resolve AbsCC_zero: algebra.
+*)
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_one.con".
+
+inline "cic:/CoRN/complex/AbsCC/cc_pow_abs.con".
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_pos.con".
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_ap_zero.con".
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_small_imp_eq.con".
+
+(* begin hide *)
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_properties/l_1_1_2.con" "AbsCC_properties__".
+
+(* end hide *)
+
+(* UNEXPORTED
+Hint Resolve l_1_1_2: algebra.
+*)
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_square_Re_Im.con".
+
+(* UNEXPORTED
+Hint Resolve AbsCC_square_Re_Im: algebra.
+*)
+
+(* begin hide *)
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_properties/l_1_2_3_CC.con" "AbsCC_properties__".
+
+(* end hide *)
+
+(* UNEXPORTED
+Hint Resolve l_1_2_3_CC: algebra.
+*)
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_mult_conj.con".
+
+(* UNEXPORTED
+Hint Resolve CC_conj_mult: algebra.
+*)
+
+(* begin hide *)
+
+inline "cic:/CoRN/complex/AbsCC/l_2_1_2.con".
+
+(* UNEXPORTED
+Hint Resolve l_2_1_2: algebra.
+*)
+
+(* end hide *)
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_mult_square.con".
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_square_ap_zero.con".
+
+inline "cic:/CoRN/complex/AbsCC/cc_recip_char.con".
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_strext.con".
+
+inline "cic:/CoRN/complex/AbsCC/AbsSmallCC.con".
+
+inline "cic:/CoRN/complex/AbsCC/Cexis_AFS_CC.con".
+
+(* The following lemmas are just auxiliary results *)
+
+(* begin hide *)
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_properties/l_4_1_2.con" "AbsCC_properties__".
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_properties/l_4_2_3.con" "AbsCC_properties__".
+
+inline "cic:/CoRN/complex/AbsCC/AbsCC_properties/l_4_3_4.con" "AbsCC_properties__".
+
+(* end hide *)
+
+(* UNEXPORTED
+End AbsCC_properties
+*)
+
+(* UNEXPORTED
+Hint Resolve AbsCC_wd: algebra_c.
+*)
+
+(* UNEXPORTED
+Hint Resolve cc_inv_abs cc_mult_abs cc_div_abs cc_div_abs' cc_pow_abs
+  AbsCC_zero AbsCC_one AbsCC_IR AbsCC_mult_conj AbsCC_mult_square
+  cc_recip_char: algebra.
+*)
+
+(*#* ** The triangle inequality *)
+
+inline "cic:/CoRN/complex/AbsCC/triangle.con".
+
+inline "cic:/CoRN/complex/AbsCC/triangle_Sum.con".
+
diff --git a/matita/contribs/CoRN-Decl/complex/CComplex.ma b/matita/contribs/CoRN-Decl/complex/CComplex.ma
new file mode 100644 (file)
index 0000000..de4d83d
--- /dev/null
@@ -0,0 +1,387 @@
+(**************************************************************************)
+(*       ___                                                              *)
+(*      ||M||                                                             *)
+(*      ||A||       A project by Andrea Asperti                           *)
+(*      ||T||                                                             *)
+(*      ||I||       Developers:                                           *)
+(*      ||T||         The HELM team.                                      *)
+(*      ||A||         http://helm.cs.unibo.it                             *)
+(*      \   /                                                             *)
+(*       \ /        This file is distributed 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/CComplex".
+
+include "CoRN.ma".
+
+(* $Id: CComplex.v,v 1.8 2004/04/23 10:00:55 lcf Exp $ *)
+
+(*#* printing Re %\ensuremath{\Re}% #&real;# *)
+
+(*#* printing Im %\ensuremath{\Im}% #&image;# *)
+
+(*#* printing CC %\ensuremath{\mathbb C}% #<b>C</b># *)
+
+(*#* printing II %\ensuremath{\imath}% #i# *)
+
+(*#* printing [+I*] %\ensuremath{+\imath}% *)
+
+(*#* printing AbsCC %\ensuremath{|\cdot|_{\mathbb C}}% *)
+
+(*#* printing CCX %\ensuremath{\mathbb C[X]}% #<b>C</b>[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 (file)
index 0000000..228a19f
--- /dev/null
@@ -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 (file)
index 0000000..988c7f7
--- /dev/null
@@ -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 (file)
index 0000000..fe7031a
--- /dev/null
@@ -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 (file)
index 0000000..88fcfbe
--- /dev/null
@@ -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 (file)
index 0000000..e41d74f
--- /dev/null
@@ -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 (file)
index 0000000..3dad80b
--- /dev/null
@@ -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 (file)
index 0000000..d4110c6
--- /dev/null
@@ -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 (file)
index 0000000..1cf9ca6
--- /dev/null
@@ -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 (file)
index 0000000..86a4385
--- /dev/null
@@ -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 (file)
index 0000000..5b97159
--- /dev/null
@@ -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 (file)
index 0000000..c4522f4
--- /dev/null
@@ -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 (file)
index 0000000..e3c5ba6
--- /dev/null
@@ -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 (file)
index 0000000..66d4a75
--- /dev/null
@@ -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}% #&eta;<SUB>0</SUB># *)
+
+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 (file)
index 0000000..385a37e
--- /dev/null
@@ -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 (file)
index 0000000..c3701c2
--- /dev/null
@@ -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 (file)
index 0000000..3751049
--- /dev/null
@@ -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 (file)
index 0000000..e5ae78e
--- /dev/null
@@ -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 (file)
index 0000000..6f88486
--- /dev/null
@@ -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 (file)
index 0000000..8c983b1
--- /dev/null
@@ -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 (file)
index 0000000..bd30234
--- /dev/null
@@ -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 (file)
index 0000000..812a91e
--- /dev/null
@@ -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 (file)
index 0000000..481eb2b
--- /dev/null
@@ -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}% #&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&isin;[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 (file)
index 0000000..34bd794
--- /dev/null
@@ -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 (file)
index 0000000..917cbe2
--- /dev/null
@@ -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}% #&sum;<sup>n</sup># *)
+
+(*#* printing Fun_Series_Sum %\ensuremath{\sum_0^{\infty}}% #&sum;<sub>0</sub><sup>&infin;</sup># *)
+
+(* 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 (file)
index 0000000..aeed920
--- /dev/null
@@ -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}% #&sum;<sub>0</sub># *)
+
+(*#* printing FSum %\ensuremath{\sum}% #&sum;# *)
+
+(*#* printing FSumx %\ensuremath{\sum'}% #&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}$#{f<sub>i</sub>}# 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 f<sub>m</sub> through f<sub>n</sub>#
+( [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$#f<sub>1</sub># is independent of the proof that
+[i [<] n].  This holds both for the value and the domain of the partial
+function $f_i$#f<sub>i</sub>#.
+*)
+
+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 (file)
index 0000000..4a8a416
--- /dev/null
@@ -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}% #&int;<sub>I</sub># *)
+
+(*#* printing Integral %\ensuremath{\int_I}% #&int;<sub>I</sub># *)
+
+(* 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$#&int;<sub>a</sub><sup>b</sup>dx=b-a# and $\int_a^af(x)dx=0$#&int;<sub>a</sub><sup>a</sup>=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&isin;[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 (file)
index 0000000..b08ef76
--- /dev/null
@@ -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 (file)
index 0000000..18f5f6e
--- /dev/null
@@ -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}}% #&sum;'<sub>&infin;</sub># *)
+
+(* 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}$#f<sub>i+1</sub># with
+$f_i$#f<sub>i</sub># 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 (file)
index 0000000..4d7622b
--- /dev/null
@@ -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 (file)
index 0000000..88fff5d
--- /dev/null
@@ -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}% #&int;# *)
+
+(*#* printing integral' %\ensuremath{\int}% #&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$#&int;<sub>a</sub><sup>b</sup>f=&int;<sub>min(a,b)</sub><sup>b</sup>f-&int;<sub>min(a,b)</sub><sup>a</sup>f#,
+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 (file)
index 0000000..30bf4b4
--- /dev/null
@@ -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}% #(-&infin;,+&infin;)# *)
+
+(*#* printing openl %\ensuremath{(\cdot,+\infty)}% #(&sdot;,+&infin;)# *)
+
+(*#* printing openr %\ensuremath{(-\infty,\cdot)}% #(-&infin;,&sdot;)# *)
+
+(*#* printing closel %\ensuremath{[\cdot,+\infty)}% #[&sdot;,+&infin;)# *)
+
+(*#* printing closer %\ensuremath{(-\infty,\cdot]}% #(-&infin;,&sdot;]# *)
+
+(*#* printing olor %\ensuremath{(\cdot,\cdot)}% #(&sdot;,&sdot;)# *)
+
+(*#* printing clor %\ensuremath{[\cdot,\cdot)}% #[&sdot;,&sdot;)# *)
+
+(*#* printing olcr %\ensuremath{(\cdot,\cdot]}% #(&sdot;,&sdot;]# *)
+
+(*#* printing clcr %\ensuremath{[\cdot,\cdot]}% #[&sdot;,&sdot;]# *)
+
+(*#* *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{%#<i>#are%}%#</i># 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&isin;P# then $[x,x]\subseteq P$#[x,x]&sube;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&isin;[a,b]&sube;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]&sube;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]&sube;[a',b']&sube;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 (file)
index 0000000..180d8a7
--- /dev/null
@@ -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 (file)
index 0000000..9771d16
--- /dev/null
@@ -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}% #&asymp;# *)
+
+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 (file)
index 0000000..a46add4
--- /dev/null
@@ -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 (file)
index 0000000..b303160
--- /dev/null
@@ -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}% #&sum;<sub>P</sub># *)
+
+(* 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,a<sub>n-1</sub>]#.  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(x<sub>i</sub>)(a<sub>i+1</sub>-a<sub>i</sub>)# where
+$x_i\in[a_i,a_{i+1}]$#x<sub>i</sub>&isin;[a<sub>i</sub>,a<sub>i+1</sub>]#.
+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 (file)
index 0000000..6034e53
--- /dev/null
@@ -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{%#<b>#Theorem#</b>#%}% 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)-&int;f(x)dx|&le;&epsilon;(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 (file)
index 0000000..7a26802
--- /dev/null
@@ -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 (file)
index 0000000..5aee670
--- /dev/null
@@ -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 (file)
index 0000000..da18b29
--- /dev/null
@@ -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 (file)
index 0000000..01273b0
--- /dev/null
@@ -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 (file)
index 0000000..fd99ff0
--- /dev/null
@@ -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 (file)
index 0000000..43eefa3
--- /dev/null
@@ -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 (file)
index 0000000..a8f1b21
--- /dev/null
@@ -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)}$#f<sub>i</sub>=f<sup>(i)</sup>#.
+*)
+
+(* 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<sup>(i)</sup>(a)/i!*(x-a)<sup>i</sup>.#
+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 (file)
index 0000000..e22afe0
--- /dev/null
@@ -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% #&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&isin;[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&isin;[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 (file)
index 0000000..e5ac91f
--- /dev/null
@@ -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 (file)
index 0000000..45f6ff0
--- /dev/null
@@ -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 (file)
index 0000000..5078600
--- /dev/null
@@ -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$ #<I>l</I># is member 
+of the list of images of elements of $l$ #<I>l</I>#.
+*)
+
+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$
+#<I>l</I># is member of the list of images of elements of $l$ #<I>l</I>#.
+*)
+
+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$#<I>P</I># of a pseudo metric space $X$#<I>X</I># is said to be located if for all 
+elements $x$#<I>x</I># of $X$#<I>X</I># there exists an infimum for the distance 
+between $x$#<I>x</I># and the elements of $P$#<I>P</I>#.
+*)
+
+(* 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$#<I>x</I># in a pseudo metric space $X$#<I>X</I>#, for all located subspaces $P$#<I>P</I># of $X$#<I>X</I>#,
+[Floc] chooses for a given natural number $n$#<I>n</I># an $y$#<I>y</I># in $P$#<I>P</I># such that:
+$d(x,y)\leq \mbox{inf}\{d(x,p)|p \in P\}+(n+1)^{-1}$
+#d(x,y) &le; inf&#x007B;d(x,p)&#x007C; p&#x03F5;P&#x007D; + (n+1)<SUP>-1</SUP>#.
+[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$#<I>P</I># of a totally bounded pseudo metric space $X$
+#<I>X</I># 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$#<I>P</I># is %\emph{open}%#<I>open</I># if for all $x$#<I>x</I># in $P$#<I>P</I># there exists an open sphere 
+with centre $x$#<I>x</I># that is contained in $P$#<I>P</I>#.
+*)
+
+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$#<I>x</I># of a located pseudo metric space $X$#<I>X</I># and the elements of a 
+subspace $P$#<I>P</I># of $X$#<I>X</I>#.
+*)
+
+inline "cic:/CoRN/metrics/CPMSTheory/infima.con".
+
+(* UNEXPORTED
+Implicit Arguments infima [X].
+*)
+
+(*#*
+A non-empty totally bounded sub-pseudo-metric-space $P$#<I>P</I># is said to be 
+%\emph{well contained}% #<I>well contained</I># in an open sub-pseudo-metric-space $Q$#<I>Q</I># if $Q$#<I>Q</I># contains 
+all points that are in some sense close to $P$#<I>P</I>#.
+*)
+
+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 (file)
index 0000000..7b64208
--- /dev/null
@@ -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 (file)
index 0000000..504a7d7
--- /dev/null
@@ -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 (file)
index 0000000..22f6da2
--- /dev/null
@@ -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 (file)
index 0000000..fd53f08
--- /dev/null
@@ -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 (file)
index 0000000..46746e6
--- /dev/null
@@ -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)$
+# d<SUB>prod</SUB>((a<SUB>1</SUB>,b<SUB>1</SUB>),(a<SUB>2</SUB>,b<SUB>2</SUB>)):= d<SUB>A</SUB>(a<SUB>1</SUB>,b<SUB>1</SUB>)+d<SUB>B</SUB>(b<SUB>1</SUB>,b<SUB>2</SUB>)#.
+This is %\emph{not}% #<I>not</I># the one used to make the metric of 
+$\RR^{2}$ #IR<SUP>2</SUP># 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 (file)
index 0000000..4e6f57e
--- /dev/null
@@ -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$#&lang;#[Qpos],$(x,y) \mapsto xy/2$ #(x,y) &#x21A6; xy/2#$\rangle$#&rang;#
+The positive rational numbers form with the operation  $(x,y) \mapsto xy/2$  #(x,y) &#x21A6; 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 (file)
index 0000000..57c6da7
--- /dev/null
@@ -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$#&lang;#[Q],[[+]]$\rangle$#&rang;#
+*)
+
+(*#* 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 (file)
index 0000000..4c5f2b2
--- /dev/null
@@ -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$#&lang;#[Qpos],[[*]]$\rangle$#&rang;#
+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 (file)
index 0000000..0cfc20c
--- /dev/null
@@ -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$#&lang;#[Z],[[+]]$\rangle$#&rang;#
+*)
+
+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 (file)
index 0000000..8024b79
--- /dev/null
@@ -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$#&lang;#[Q],[[+]],[[*]]$\rangle$#&rang;#
+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 (file)
index 0000000..99993bd
--- /dev/null
@@ -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$#&lang;#[Qpos],$(x,y) \mapsto xy/2$ #(x,y) &#x21A6; xy/2#$\rangle$#&rang;#
+The positive rationals form with the operation  $(x,y) \mapsto xy/2$ 
+#(x,y) &#x21A6; 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 (file)
index 0000000..e508583
--- /dev/null
@@ -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$#&lang;#[Q],[[+]]$\rangle$#&rang;#
+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 (file)
index 0000000..02e0b6c
--- /dev/null
@@ -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$#&lang;#[Qpos],[[*]]$\rangle$#&rang;#
+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 (file)
index 0000000..3f54301
--- /dev/null
@@ -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$#&lang;#[Z],[[+]]$\rangle$#&rang;#
+*)
+
+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 (file)
index 0000000..4eac5c0
--- /dev/null
@@ -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$#&lang;#[nat],[[+]]$\rangle$#&rang;#
+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 #<i>#%\emph{%the monoid of natural numbers%}%#</i>#:
+*)
+
+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 (file)
index 0000000..1d23f7d
--- /dev/null
@@ -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$#&lang;#[Npos],[[*]]$\rangle$#&rang;#
+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 (file)
index 0000000..0ec63cd
--- /dev/null
@@ -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$#&lang;#[Qpos],$(x,y) \mapsto xy/2$ #(x,y) &#x21A6; xy/2#$\rangle$#&rang;#
+Two is the unit of the operation  $(x,y) \mapsto xy/2$ #(x,y) 
+  &#x21A6; 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 (file)
index 0000000..e194607
--- /dev/null
@@ -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$#&lang;#[Q],[[+]]$\rangle$#&rang;# and $\langle$#&lang;#[Q],[[*]]$\rangle$#&rang;#
+***$\langle$#&lang;#[Q],[[+]]$\rangle$#&rang;#
+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$#&lang;#[Q],[[*]]$\rangle$#&rang;#
+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 (file)
index 0000000..e8f9f96
--- /dev/null
@@ -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$#&lang;#[Qpos],[[*]]$\rangle$#&rang;#
+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 (file)
index 0000000..d6b0dde
--- /dev/null
@@ -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$#&lang;#[Z],[[+]]$\rangle$#&rang;# and $\langle$#&lang;#[Z],[[*]]$\rangle$#&rang;#
+***$\langle$#&lang;#[Z],[[+]]$\rangle$#&rang;#
+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$#&lang;#[Z],[[*]]$\rangle$#&rang;#
+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 (file)
index 0000000..260cc8d
--- /dev/null
@@ -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$#&lang;#[nat],[[+]]$\rangle$#&rang;#
+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 (file)
index 0000000..7f86667
--- /dev/null
@@ -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$#&lang;#[Npos],[[+]]$\rangle$#&rang;#
+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 (file)
index 0000000..7dbff70
--- /dev/null
@@ -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$#&lang;#[Npos],[[+]]$\rangle$#&rang;#
+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 (file)
index 0000000..0729946
--- /dev/null
@@ -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$#&lang;#[Q],[[+]],[[*]],[[<]]$\rangle$#&rang;#
+ [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 (file)
index 0000000..a355fe3
--- /dev/null
@@ -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 (file)
index 0000000..5a1723d
--- /dev/null
@@ -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$#&lang;#[Q],[[+]],[[*]]$\rangle$#&rang;#
+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 (file)
index 0000000..3927f43
--- /dev/null
@@ -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$#&lang;#[Z],[[+]],[[*]]$\rangle$#&rang;#
+
+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 (file)
index 0000000..466677d
--- /dev/null
@@ -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$#&lang;#[Npos],[[+]]$\rangle$#&rang;# and $\langle$#&lang;#[Npos],[[*]]$\rangle$#&rang;#
+***$\langle$#&lang;#[Npos],[[+]]$\rangle$#&rang;#
+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$#&lang;#[Npos],[[*]]$\rangle$#&rang;#
+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 (file)
index 0000000..393e003
--- /dev/null
@@ -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$#&lang;#[nat],[[+]]$\rangle$#&rang;#
+*)
+
+(*#* 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 (file)
index 0000000..54eb20c
--- /dev/null
@@ -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$#&lang;#[Qpos],$(x,y) \mapsto xy/2$#(x,y) &#x21A6; xy/2#$\rangle$#&rang;#
+The positive rationals form with the operation
+$(x,y) \mapsto xy/2$#(x,y) &#x21A6; 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 (file)
index 0000000..f433622
--- /dev/null
@@ -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$#&lang;#[Qpos],[[*]]$\rangle$#&rang;#
+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 (file)
index 0000000..09fbc4a
--- /dev/null
@@ -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$#&lang;#[Q],[[+]]$\rangle$#&rang;# and $\langle$#&lang;#[Q],[[*]]$\rangle$#&rang;#
+***$\langle$#&lang;#[Q],[[+]]$\rangle$#&rang;#
+*)
+
+inline "cic:/CoRN/model/semigroups/Qsemigroup/Q_as_CSemiGroup.con".
+
+(*#* ***$\langle$#&lang;#[Q],[[*]]$\rangle$#&rang;#
+*)
+
+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 (file)
index 0000000..4ec6a0a
--- /dev/null
@@ -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$#&lang;#[Z],[[+]]$\rangle$#&rang;# and $\langle$#&lang;#[Z],[[*]]$\rangle$#&rang;#
+***$\langle$#&lang;#[Z],[[+]]$\rangle$#&rang;#
+*)
+
+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$#&lang;#[Z],[[*]]$\rangle$#&rang;#
+*)
+
+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 (file)
index 0000000..23363a1
--- /dev/null
@@ -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 (file)
index 0000000..b3bf1fc
--- /dev/null
@@ -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 (file)
index 0000000..9557dc1
--- /dev/null
@@ -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) &#x21A6; 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 &#x21A6; 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 (file)
index 0000000..71cdafa
--- /dev/null
@@ -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 (file)
index 0000000..84541c4
--- /dev/null
@@ -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 (file)
index 0000000..7a47323
--- /dev/null
@@ -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<SUP>+</SUP># *)
+
+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 (file)
index 0000000..084be10
--- /dev/null
@@ -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 (file)
index 0000000..38f43ac
--- /dev/null
@@ -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<SUP>+</SUP># *)
+
+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)
+&#x21A6; xy/2#. We will see that its unit is 2. Its inverse map is $x
+\mapsto 4/x$ #x &#x21A6; 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 (file)
index 0000000..42d6e56
--- /dev/null
@@ -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}}% #0<sub>Q</sub># *)
+
+(*#* printing QONE %\ensuremath{1_\mathbb{Q}}% #1<sub>Q</sub># *)
+
+(*#* printing QTWO %\ensuremath{2_\mathbb{Q}}% #2<sub>Q</sub># *)
+
+(*#* printing QFOUR %\ensuremath{4_\mathbb{Q}}% #4<sub>Q</sub># *)
+
+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$#&lang;a,n&rang;# with [a:Z] and
+[n:positive]. Intuitively, $\langle a,n\rangle$#&lang;a,n&rang;#
+represents the rational number [a[/]n]. Then there is the equality on
+[Q]: $\langle a,m\rangle=\langle
+b,n\rangle$#&lang;a,m&rang;=&lang;b,n&rang;# 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 "{<Q}" := Qlt (no associativity, at level 90).
+*)
+
+(* NOTATION
+Infix "{+Q}" := Qplus (no associativity, at level 85).
+*)
+
+(* NOTATION
+Infix "{*Q}" := Qmult (no associativity, at level 80).
+*)
+
+(* NOTATION
+Notation "{-Q}" := Qopp (at level 1, left associativity).
+*)
+
+(*#* ***Constants
+*)
+
+inline "cic:/CoRN/model/structures/Qsec/QTWO.con".
+
+inline "cic:/CoRN/model/structures/Qsec/QFOUR.con".
+
+(*#* ***Equality
+Here we prove that [QONE] is #<i>#%\emph{%not equal%}%#</i># 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 (file)
index 0000000..b7aa226
--- /dev/null
@@ -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 (file)
index 0000000..2770903
--- /dev/null
@@ -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 (file)
index 0000000..9d7d553
--- /dev/null
@@ -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 (file)
index 0000000..52059cc
--- /dev/null
@@ -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 (file)
index 0000000..99cd76b
--- /dev/null
@@ -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 (file)
index 0000000..db445d6
--- /dev/null
@@ -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 (file)
index 0000000..0c8b365
--- /dev/null
@@ -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 (file)
index 0000000..a43dcfc
--- /dev/null
@@ -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 (file)
index 0000000..f8d973b
--- /dev/null
@@ -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 (file)
index 0000000..552fce4
--- /dev/null
@@ -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&le; i &le; 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 (file)
index 0000000..4bc6c7a
--- /dev/null
@@ -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&gt;0 there exists N such that for all m&ge; N |seqm-seqN|&le; 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 &ge; N |seqm-seqN| &le; 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 (file)
index 0000000..2fb5a06
--- /dev/null
@@ -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 (file)
index 0000000..19dacb6
--- /dev/null
@@ -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 (file)
index 0000000..356ae30
--- /dev/null
@@ -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\]%#&forall;e&gt;0
+&exist;x<sub>1</sub>,...,x<sub>n</sub>&forall;y&isin;P&exist;
+1&le;i&le;n.|y-x<sub>i</sub>|&lt;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 (file)
index 0000000..de92736
--- /dev/null
@@ -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 (file)
index 0000000..0f976d7
--- /dev/null
@@ -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&le;sqrt(n)x#;
+ - if [Zero [<] x] then $0<\sqrt[n]x$#0&lt;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&lt;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 (file)
index 0000000..ebcef6d
--- /dev/null
@@ -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 (file)
index 0000000..2b12a73
--- /dev/null
@@ -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 (file)
index 0000000..0a4f302
--- /dev/null
@@ -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}%#<i>arbitrary</i># 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 (file)
index 0000000..5ce1b10
--- /dev/null
@@ -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 (file)
index 0000000..aa6ba33
--- /dev/null
@@ -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,&infin;)#, [Intol a] for the
+left-open interval $(a,\infty)$#(a,&infin;)#, [Intcr b] for the
+right-closed interval $(-\infty,b]$#(-&infin;,b]#.
+
+Intervals like $[a,b]$#[a,b]# are defined for arbitrary reals [a,b] (being
+$\emptyset$#&empty;# 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)\rightarrow( c< b)\rightarrow\ (f (a)<0)
+\rightarrow\ (0:<f(b))
+         \rightarrow \forall x,y\in\RR (a\leq x\leq b)\rightarrow
+       (a\leq y\leq b)\rightarrow (x<y)
+                \rightarrow \exists z\in\RR(x\leq z\leq y)\wedge(f(z)\noto 0))$
+*_
+
+Ax_iom strmon_ivt_prem : (c:IR)(str_monotOncl 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<b) \rightarrow(c <a)\rightarrow( c< b)
+\rightarrow(f (a)<0)\rightarrow (0:<f(b))
+         \rightarrow \exists z\in\RR(a\leq z\leq b)\wedge(f(z)= 0))$
+*_
+
+Ax_iom strmoncl_imp_ivt : (c:IR)(str_monotOncl c)
+           ->(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 (file)
index 0000000..322b204
--- /dev/null
@@ -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 (file)
index 0000000..40315e1
--- /dev/null
@@ -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}% #&sum;<sup>n</sup># *)
+
+(*#* printing series_sum %\ensuremath{\sum_0^{\infty}}% #&sum;<sub>0</sub><sup>&infin;</sup># *)
+
+(*#* printing pi %\ensuremath{\pi}% #&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 (file)
index 0000000..40fc12b
--- /dev/null
@@ -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 (file)
index 0000000..51ba402
--- /dev/null
@@ -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 (file)
index 0000000..a0457f8
--- /dev/null
@@ -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 (file)
index 0000000..6a3212b
--- /dev/null
@@ -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 (file)
index 0000000..11c2e55
--- /dev/null
@@ -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 (file)
index 0000000..a3041e0
--- /dev/null
@@ -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 (file)
index 0000000..e47a4cf
--- /dev/null
@@ -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 (file)
index 0000000..f614cbd
--- /dev/null
@@ -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 (file)
index 0000000..84a076a
--- /dev/null
@@ -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 (file)
index 0000000..4b92202
--- /dev/null
@@ -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 (file)
index 0000000..25fdc7e
--- /dev/null
@@ -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 (file)
index 0000000..434241c
--- /dev/null
@@ -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$#e<sup>1</sup>=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(e<sup>x</sup>)=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 (file)
index 0000000..73a386b
--- /dev/null
@@ -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 (file)
index 0000000..af134ca
--- /dev/null
@@ -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}% #&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&isin;[0,&pi;/2)#, [(Cos x) [>] 0];
+$\cos(\frac{pi}2)=0$#cos(&pi;/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 (file)
index 0000000..2bb43ff
--- /dev/null
@@ -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 (file)
index 0000000..fd08141
--- /dev/null
@@ -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)}$#x<sup>y</sup>=e<sup>y*log(x)</sup>#, 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 (file)
index 0000000..314d0f5
--- /dev/null
@@ -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)<sup>2</sup>+sin(x)<sup>2</sup>=1# and, equivalently, $1+\tan(x)^2=\frac1{\cos(x)^2}$#1+tan(x)<sup>2</sup>=1/(cos(x)<sup>2</sup>)#.
+*)
+
+(* 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 (file)
index 0000000..7e00f92
--- /dev/null
@@ -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 (file)
index 0000000..a806584
--- /dev/null
@@ -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)$#(-&pi;/2,&pi;/2)#, sine in
+$(0,\pi)$#(0,&pi;)# and tangent in $(0,\frac{\pi}2)$#0,&pi;/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 (file)
index 0000000..b4f59a9
--- /dev/null
@@ -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 (file)
index 0000000..4864a2c
--- /dev/null
@@ -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 (file)
index 0000000..c7952eb
--- /dev/null
@@ -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 (file)
index 0000000..ec3212d
--- /dev/null
@@ -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 (file)
index 0000000..e8a0765
--- /dev/null
@@ -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 (file)
index 0000000..4a7946c
--- /dev/null
@@ -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 (file)
index 0000000..3198e94
--- /dev/null
@@ -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 (file)
index 0000000..1ca1142
--- /dev/null
@@ -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 (file)
index 0000000..7338262
--- /dev/null
@@ -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 (file)
index 0000000..f5ad380
--- /dev/null
@@ -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 (file)
index 0000000..e19f961
--- /dev/null
@@ -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 (file)
index 0000000..d89a218
--- /dev/null
@@ -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 (file)
index 0000000..638fd2e
--- /dev/null
@@ -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 (file)
index 0000000..1c9b499
--- /dev/null
@@ -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 (file)
index 0000000..12438b3
--- /dev/null
@@ -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 (file)
index 0000000..d244663
--- /dev/null
@@ -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 (file)
index 0000000..4ac4a61
--- /dev/null
@@ -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 (file)
index 0000000..ee4663a
--- /dev/null
@@ -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 (file)
index 0000000..18de7f7
--- /dev/null
@@ -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 (file)
index 0000000..2c20deb
--- /dev/null
@@ -0,0 +1,744 @@
+\e[0;32mInfo:  \e[0mexecution of blt/defs.mma started:
+\e[0;34mDebug: \e[0mExecuting: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/blt ...''
+\e[0;34mDebug: \e[0mIncluding /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./preamble.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/.
+\e[0;34mDebug: \e[0mExecuting: ``include "cic:/matita/LAMBDA-TYPES/Base-2/preamble" ...''
+\e[0;34mDebug: \e[0mIncluding /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/.
+\e[0;32mInfo:  \e[0mexecution of blt/defs.mma completed in 1''.
+\e[0;32mInfo:  \e[0mexecution of blt/props.mma started:
+\e[0;34mDebug: \e[0mExecuting: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/blt ...''
+\e[0;32mInfo:  \e[0mbaseuri cic:/matita/LAMBDA-TYPES/Base-2/blt/props is not empty
+\e[0;32mInfo:  \e[0mcleaning baseuri cic:/matita/LAMBDA-TYPES/Base-2/blt/props
+\e[0;32mInfo:  \e[0mRemoving: cic:/matita/LAMBDA-TYPES/Base-2/blt/props/*
+\e[0;34mDebug: \e[0mIncluding /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/.
+\e[0;34mDebug: \e[0mExecuting: ``include "cic:/matita/LAMBDA-TYPES/Base-2/blt/defs" ...''
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: lt_blt
+Pre Nodes : 257
+nat
+nat
+nat
+nat
+\e[0;33mWarn:  \e[0mOptimizer: remove 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 2
+\e[0;33mWarn:  \e[0mOptimizer: nested application
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 2
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: le_bge
+Pre Nodes : 255
+nat
+nat
+nat
+nat
+\e[0;33mWarn:  \e[0mOptimizer: remove 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 2
+\e[0;33mWarn:  \e[0mOptimizer: nested application
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 2
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: blt_lt
+Pre Nodes : 221
+bool
+bool
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: bge_le
+Pre Nodes : 222
+bool
+bool
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mIncluding /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/.
+\e[0;32mInfo:  \e[0mexecution of blt/props.mma completed in 7''.
+\e[0;32mInfo:  \e[0mexecution of ext/arith.mma started:
+\e[0;34mDebug: \e[0mExecuting: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/ext ...''
+\e[0;32mInfo:  \e[0mbaseuri cic:/matita/LAMBDA-TYPES/Base-2/ext/arith is not empty
+\e[0;32mInfo:  \e[0mcleaning baseuri cic:/matita/LAMBDA-TYPES/Base-2/ext/arith
+\e[0;32mInfo:  \e[0mRemoving: cic:/matita/LAMBDA-TYPES/Base-2/ext/arith/*
+\e[0;34mDebug: \e[0mIncluding /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./preamble.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/.
+\e[0;34mDebug: \e[0mExecuting: ``include "cic:/matita/LAMBDA-TYPES/Base-2/preamble" ...''
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: nat_dec
+Pre Nodes : 474
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: simpl_plus_r
+Pre Nodes : 85
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: minus_plus_r
+Pre Nodes : 33
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: plus_permute_2_in_3
+Pre Nodes : 117
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: plus_permute_2_in_3_assoc
+Pre Nodes : 86
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: plus_O
+Pre Nodes : 191
+nat
+nat
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: minus_Sx_SO
+Pre Nodes : 24
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: eq_nat_dec
+Pre Nodes : 303
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: le_false
+Pre Nodes : 382
+nat
+nat
+nat
+nat
+\e[0;33mWarn:  \e[0mOptimizer: remove 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 2
+\e[0;33mWarn:  \e[0mOptimizer: nested application
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 2
+\e[0;33mWarn:  \e[0mOptimizer: swap 2
+nat
+nat
+nat
+nat
+\e[0;33mWarn:  \e[0mOptimizer: remove 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 2
+\e[0;33mWarn:  \e[0mOptimizer: nested application
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 2
+\e[0;33mWarn:  \e[0mOptimizer: swap 2
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: le_Sx_x
+Pre Nodes : 20
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: le_plus_minus_sym
+Pre Nodes : 45
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: le_minus_minus
+Pre Nodes : 84
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: le_minus_plus
+Pre Nodes : 505
+\e[0;33mWarn:  \e[0mOptimizer: remove 3
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 2
+\e[0;33mWarn:  \e[0mOptimizer: swap 2
+nat
+nat
+nat
+nat
+\e[0;33mWarn:  \e[0mOptimizer: remove 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 2
+\e[0;33mWarn:  \e[0mOptimizer: nested application
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 2
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: le_minus
+Pre Nodes : 51
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: le_gen_S
+Pre Nodes : 217
+\e[0;33mWarn:  \e[0mOptimizer: remove 3
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 2
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: lt_x_plus_x_Sy
+Pre Nodes : 64
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: simpl_lt_plus_r
+Pre Nodes : 75
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 1
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 1
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: minus_x_Sy
+Pre Nodes : 330
+nat
+nat
+nat
+nat
+\e[0;33mWarn:  \e[0mOptimizer: remove 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 2
+\e[0;33mWarn:  \e[0mOptimizer: nested application
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 2
+\e[0;33mWarn:  \e[0mOptimizer: swap 2
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: lt_plus_minus_r
+Pre Nodes : 53
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: minus_x_SO
+Pre Nodes : 56
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: le_x_pred_y
+Pre Nodes : 175
+nat
+nat
+nat
+nat
+\e[0;33mWarn:  \e[0mOptimizer: remove 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 2
+\e[0;33mWarn:  \e[0mOptimizer: nested application
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 2
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: lt_le_minus
+Pre Nodes : 44
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: lt_eq_e
+Pre Nodes : 45
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: le_lt_false
+Pre Nodes : 25
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: arith0
+Pre Nodes : 185
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: O_minus
+Pre Nodes : 211
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: minus_minus
+Pre Nodes : 592
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 1
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 1
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: plus_plus
+Pre Nodes : 1222
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 1
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 1
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 1
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 1
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 1
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 1
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: le_S_minus
+Pre Nodes : 41
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mIncluding /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/.
+\e[0;32mInfo:  \e[0mexecution of ext/arith.mma completed in 44''.
+\e[0;32mInfo:  \e[0mexecution of ext/tactics.mma started:
+\e[0;34mDebug: \e[0mExecuting: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/ext ...''
+\e[0;32mInfo:  \e[0mbaseuri cic:/matita/LAMBDA-TYPES/Base-2/ext/tactics is not empty
+\e[0;32mInfo:  \e[0mcleaning baseuri cic:/matita/LAMBDA-TYPES/Base-2/ext/tactics
+\e[0;32mInfo:  \e[0mRemoving: cic:/matita/LAMBDA-TYPES/Base-2/ext/tactics/*
+\e[0;34mDebug: \e[0mIncluding /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./preamble.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/.
+\e[0;34mDebug: \e[0mExecuting: ``include "cic:/matita/LAMBDA-TYPES/Base-2/preamble" ...''
+\e[0;34mDebug: \e[0mExecuting: ``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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mExecuting: ``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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mIncluding /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/.
+\e[0;32mInfo:  \e[0mexecution of ext/tactics.mma completed in 4''.
+\e[0;32mInfo:  \e[0mexecution of pippo.mma started:
+\e[0;34mDebug: \e[0mExecuting: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/pip ...''
+\e[0;34mDebug: \e[0mIncluding /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./preamble.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/.
+\e[0;34mDebug: \e[0mExecuting: ``include "cic:/matita/LAMBDA-TYPES/Base-2/preamble" ...''
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: minus_x_Sy
+Pre Nodes : 330
+nat
+nat
+nat
+nat
+\e[0;33mWarn:  \e[0mOptimizer: remove 3
+\e[0;33mWarn:  \e[0mOptimizer: swap 2
+\e[0;33mWarn:  \e[0mOptimizer: nested application
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 2
+\e[0;33mWarn:  \e[0mOptimizer: swap 2
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mIncluding /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./pippo.mma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/.
+\e[0;32mInfo:  \e[0mexecution of pippo.mma completed in 2''.
+\e[0;32mInfo:  \e[0mexecution of plist/defs.mma started:
+\e[0;34mDebug: \e[0mExecuting: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/pli ...''
+\e[0;34mDebug: \e[0mIncluding /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./preamble.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/.
+\e[0;34mDebug: \e[0mExecuting: ``include "cic:/matita/LAMBDA-TYPES/Base-2/preamble" ...''
+\e[0;34mDebug: \e[0mIncluding /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/.
+\e[0;32mInfo:  \e[0mexecution of plist/defs.mma completed in 1''.
+\e[0;32mInfo:  \e[0mexecution of plist/props.mma started:
+\e[0;34mDebug: \e[0mExecuting: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/pli ...''
+\e[0;34mDebug: \e[0mIncluding /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/.
+\e[0;34mDebug: \e[0mExecuting: ``include "cic:/matita/LAMBDA-TYPES/Base-2/plist/def ...''
+\e[0;34mDebug: \e[0mExecuting: ``inline procedural "cic:/matita/LAMBDA-TYPES/Base-1 ...''
+BEGIN: papp_ss
+Pre Nodes : 121
+\e[0;33mWarn:  \e[0mOptimizer: anticipate 3
+\e[0;33mWarn:  \e[0mOptimizer: 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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mIncluding /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/.
+\e[0;32mInfo:  \e[0mexecution of plist/props.mma completed in 2''.
+\e[0;32mInfo:  \e[0mexecution of types/defs.mma started:
+\e[0;34mDebug: \e[0mExecuting: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/typ ...''
+\e[0;34mDebug: \e[0mIncluding /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./preamble.ma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/.
+\e[0;34mDebug: \e[0mExecuting: ``include "cic:/matita/LAMBDA-TYPES/Base-2/preamble" ...''
+\e[0;34mDebug: \e[0mIncluding /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/.
+\e[0;32mInfo:  \e[0mexecution of types/defs.mma completed in 0''.
+\e[0;32mInfo:  \e[0mexecution of types/props.mma started:
+\e[0;34mDebug: \e[0mExecuting: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/typ ...''
+\e[0;32mInfo:  \e[0mbaseuri cic:/matita/LAMBDA-TYPES/Base-2/types/props is not empty
+\e[0;32mInfo:  \e[0mcleaning baseuri cic:/matita/LAMBDA-TYPES/Base-2/types/props
+\e[0;32mInfo:  \e[0mRemoving: cic:/matita/LAMBDA-TYPES/Base-2/types/props/*
+\e[0;34mDebug: \e[0mIncluding /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/.
+\e[0;34mDebug: \e[0mExecuting: ``include "cic:/matita/LAMBDA-TYPES/Base-2/types/def ...''
+\e[0;34mDebug: \e[0mExecuting: ``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
+\e[0;34mDebug: \e[0mProcedural: level 2 transformation
+\e[0;34mDebug: \e[0mProcedural: grafite rendering
+\e[0;34mDebug: \e[0mIncluding /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/.
+\e[0;32mInfo:  \e[0mexecution of types/props.mma completed in 2''.
+\e[0;32mInfo:  \e[0mexecution of theory.mma started:
+\e[0;34mDebug: \e[0mExecuting: ``set "baseuri" "cic:/matita/LAMBDA-TYPES/Base-2/the ...''
+\e[0;34mDebug: \e[0mIncluding /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/.
+\e[0;34mDebug: \e[0mExecuting: ``include "cic:/matita/LAMBDA-TYPES/Base-2/ext/tacti ...''
+\e[0;34mDebug: \e[0mIncluding /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/.
+\e[0;34mDebug: \e[0mExecuting: ``include "cic:/matita/LAMBDA-TYPES/Base-2/ext/arith ...''
+\e[0;34mDebug: \e[0mIncluding /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/.
+\e[0;34mDebug: \e[0mExecuting: ``include "cic:/matita/LAMBDA-TYPES/Base-2/types/pro ...''
+\e[0;34mDebug: \e[0mIncluding /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/.
+\e[0;34mDebug: \e[0mExecuting: ``include "cic:/matita/LAMBDA-TYPES/Base-2/blt/props ...''
+\e[0;34mDebug: \e[0mIncluding /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/.
+\e[0;34mDebug: \e[0mExecuting: ``include "cic:/matita/LAMBDA-TYPES/Base-2/plist/pro ...''
+\e[0;34mDebug: \e[0mIncluding /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/./theory.mma with path: /home/fguidi/svn/software/matita/contribs/LAMBDA-TYPES/Base-2/.
+\e[0;32mInfo:  \e[0mexecution 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 (file)
index 0000000..f20e608
--- /dev/null
@@ -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 (file)
index 0000000..3dc03da
--- /dev/null
@@ -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 (file)
index 0000000..29357a8
--- /dev/null
@@ -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 (file)
index 0000000..f04df20
--- /dev/null
@@ -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 (file)
index 0000000..1adab3e
--- /dev/null
@@ -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 (file)
index 0000000..000f283
--- /dev/null
@@ -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 (file)
index 0000000..d79bfc4
--- /dev/null
@@ -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 (file)
index 0000000..1c592ef
--- /dev/null
@@ -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 (file)
index 0000000..0022395
--- /dev/null
@@ -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 (file)
index 0000000..3090142
--- /dev/null
@@ -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 (file)
index 0000000..d66873d
--- /dev/null
@@ -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 (file)
index 0000000..0d05ba9
--- /dev/null
@@ -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 (file)
index 0000000..236063d
--- /dev/null
@@ -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 (file)
index 0000000..1c66152
--- /dev/null
@@ -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 (file)
index 0000000..0a1c35e
--- /dev/null
@@ -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 (file)
index 0000000..16adef5
--- /dev/null
@@ -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 (file)
index 0000000..2580372
--- /dev/null
@@ -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 (file)
index 0000000..60264bc
--- /dev/null
@@ -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 (file)
index 0000000..e3a36f1
--- /dev/null
@@ -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 (file)
index 0000000..2af721d
--- /dev/null
@@ -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 (file)
index 0000000..410400d
--- /dev/null
@@ -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 (file)
index 0000000..fbdcd38
--- /dev/null
@@ -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 (file)
index 0000000..46e4c8c
--- /dev/null
@@ -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 (file)
index 0000000..7b60c2a
--- /dev/null
@@ -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 (file)
index 0000000..6c9662a
--- /dev/null
@@ -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 (file)
index 0000000..4592f39
--- /dev/null
@@ -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 (file)
index 0000000..ae22330
--- /dev/null
@@ -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 (file)
index 0000000..d2c7713
--- /dev/null
@@ -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 (file)
index 0000000..c5390f9
--- /dev/null
@@ -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 (file)
index 0000000..ae0f6a5
--- /dev/null
@@ -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 (file)
index 0000000..118dc7c
--- /dev/null
@@ -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 (file)
index 0000000..2cfcaa8
--- /dev/null
@@ -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 (file)
index 0000000..4749583
--- /dev/null
@@ -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 (file)
index 0000000..a188071
--- /dev/null
@@ -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 (file)
index 0000000..2885518
--- /dev/null
@@ -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 (file)
index 0000000..8773297
--- /dev/null
@@ -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 (file)
index 0000000..f9b4334
--- /dev/null
@@ -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 (file)
index 0000000..81620ce
--- /dev/null
@@ -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 (file)
index 0000000..ff9d01c
--- /dev/null
@@ -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 (file)
index 0000000..036ca28
--- /dev/null
@@ -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 (file)
index 0000000..1b8612a
--- /dev/null
@@ -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 (file)
index 0000000..003b18a
--- /dev/null
@@ -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 (file)
index 0000000..2b56bc7
--- /dev/null
@@ -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 (file)
index 0000000..d93e4d6
--- /dev/null
@@ -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 (file)
index 0000000..62e10c0
--- /dev/null
@@ -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 (file)
index 0000000..d697f12
--- /dev/null
@@ -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 (file)
index 0000000..059c359
--- /dev/null
@@ -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 (file)
index 0000000..646247a
--- /dev/null
@@ -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 (file)
index 0000000..6348a63
--- /dev/null
@@ -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 (file)
index 0000000..301cba9
--- /dev/null
@@ -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 (file)
index 0000000..75651a1
--- /dev/null
@@ -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 (file)
index 0000000..dd2a039
--- /dev/null
@@ -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 (file)
index 0000000..d13d2b0
--- /dev/null
@@ -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 (file)
index 0000000..fb9fdf5
--- /dev/null
@@ -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 (file)
index 0000000..5d90ea5
--- /dev/null
@@ -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 (file)
index 0000000..b1a0632
--- /dev/null
@@ -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 (file)
index 0000000..7980be5
--- /dev/null
@@ -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 (file)
index 0000000..d4ccb6e
--- /dev/null
@@ -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 (file)
index 0000000..24e20c4
--- /dev/null
@@ -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 (file)
index 0000000..a298dfc
--- /dev/null
@@ -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 (file)
index 0000000..96e86ee
--- /dev/null
@@ -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 (file)
index 0000000..a6af746
--- /dev/null
@@ -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 (file)
index 0000000..9cafa82
--- /dev/null
@@ -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 (file)
index 0000000..2258189
--- /dev/null
@@ -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 (file)
index 0000000..3f90ff3
--- /dev/null
@@ -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 (file)
index 0000000..7a7efe4
--- /dev/null
@@ -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 (file)
index 0000000..92e19a5
--- /dev/null
@@ -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 (file)
index 0000000..a0f89e0
--- /dev/null
@@ -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 (file)
index 0000000..d8a6ad2
--- /dev/null
@@ -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 (file)
index 0000000..5d88520
--- /dev/null
@@ -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 (file)
index 0000000..3fbcb51
--- /dev/null
@@ -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 (file)
index 0000000..6201547
--- /dev/null
@@ -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 (file)
index 0000000..e0b4688
--- /dev/null
@@ -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 (file)
index 0000000..af9e245
--- /dev/null
@@ -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 (file)
index 0000000..0297207
--- /dev/null
@@ -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 (file)
index 0000000..dea03ca
--- /dev/null
@@ -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 (file)
index 0000000..f8ec287
--- /dev/null
@@ -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 (file)
index 0000000..5d1e9dc
--- /dev/null
@@ -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 (file)
index 0000000..078545c
--- /dev/null
@@ -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 (file)
index 0000000..66350ed
--- /dev/null
@@ -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 (file)
index 0000000..3e16c05
--- /dev/null
@@ -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 (file)
index 0000000..218efc4
--- /dev/null
@@ -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 (file)
index 0000000..482249d
--- /dev/null
@@ -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 (file)
index 0000000..f35ee35
--- /dev/null
@@ -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 (file)
index 0000000..9143b89
--- /dev/null
@@ -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 (file)
index 0000000..a8d7daf
--- /dev/null
@@ -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 (file)
index 0000000..d3eccba
--- /dev/null
@@ -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 (file)
index 0000000..773e572
--- /dev/null
@@ -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 (file)
index 0000000..8b7c552
--- /dev/null
@@ -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 (file)
index 0000000..f22b7b3
--- /dev/null
@@ -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 (file)
index 0000000..0d97227
--- /dev/null
@@ -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 (file)
index 0000000..c176ca6
--- /dev/null
@@ -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 (file)
index 0000000..81a47ff
--- /dev/null
@@ -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 (file)
index 0000000..5381652
--- /dev/null
@@ -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 (file)
index 0000000..62218d7
--- /dev/null
@@ -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 (file)
index 0000000..a5228d9
--- /dev/null
@@ -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 (file)
index 0000000..fa327f9
--- /dev/null
@@ -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 (file)
index 0000000..5a66079
--- /dev/null
@@ -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 (file)
index 0000000..edc9758
--- /dev/null
@@ -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 (file)
index 0000000..25f9dfd
--- /dev/null
@@ -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 (file)
index 0000000..d14a0e5
--- /dev/null
@@ -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 (file)
index 0000000..36c2657
--- /dev/null
@@ -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 (file)
index 0000000..0ad16f9
--- /dev/null
@@ -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 (file)
index 0000000..9a03fcd
--- /dev/null
@@ -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 (file)
index 0000000..5a80f43
--- /dev/null
@@ -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 (file)
index 0000000..6a8cc0a
--- /dev/null
@@ -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 (file)
index 0000000..0e041d0
--- /dev/null
@@ -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 (file)
index 0000000..4042efe
--- /dev/null
@@ -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 (file)
index 0000000..bbdef6d
--- /dev/null
@@ -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 (file)
index 0000000..db5d765
--- /dev/null
@@ -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 (file)
index 0000000..19ef144
--- /dev/null
@@ -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 (file)
index 0000000..d344883
--- /dev/null
@@ -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 (file)
index 0000000..8f20b32
--- /dev/null
@@ -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 (file)
index 0000000..1764e86
--- /dev/null
@@ -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 (file)
index 0000000..e0f2654
--- /dev/null
@@ -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 (file)
index 0000000..d67f672
--- /dev/null
@@ -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 (file)
index 0000000..d7aa809
--- /dev/null
@@ -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 (file)
index 0000000..23868ee
--- /dev/null
@@ -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 (file)
index 0000000..849e860
--- /dev/null
@@ -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 (file)
index 0000000..54b097c
--- /dev/null
@@ -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 (file)
index 0000000..33c4477
--- /dev/null
@@ -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 (file)
index 0000000..2206469
--- /dev/null
@@ -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 (file)
index 0000000..499cd5f
--- /dev/null
@@ -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 (file)
index 0000000..c81142f
--- /dev/null
@@ -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 (file)
index 0000000..0bd48d4
--- /dev/null
@@ -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 (file)
index 0000000..01f4fc1
--- /dev/null
@@ -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 (file)
index 0000000..91d5eaf
--- /dev/null
@@ -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 (file)
index 0000000..6ab7daf
--- /dev/null
@@ -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 (file)
index 0000000..cd70ecf
--- /dev/null
@@ -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 (file)
index 0000000..3a6db77
--- /dev/null
@@ -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 (file)
index 0000000..4113620
--- /dev/null
@@ -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 (file)
index 0000000..0893239
--- /dev/null
@@ -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 (file)
index 0000000..98a40de
--- /dev/null
@@ -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 (file)
index 0000000..510b2d6
--- /dev/null
@@ -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 (file)
index 0000000..5ed59a4
--- /dev/null
@@ -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 (file)
index 0000000..26c4a21
--- /dev/null
@@ -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 (file)
index 0000000..4086f5b
--- /dev/null
@@ -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 (file)
index 0000000..5d1ef3b
--- /dev/null
@@ -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 (file)
index 0000000..59e04ce
--- /dev/null
@@ -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 (file)
index 0000000..5e8396c
--- /dev/null
@@ -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 (file)
index 0000000..0aa5523
--- /dev/null
@@ -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 (file)
index 0000000..85540bd
--- /dev/null
@@ -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 (file)
index 0000000..98a21a5
--- /dev/null
@@ -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 (file)
index 0000000..7840b3c
--- /dev/null
@@ -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 (file)
index 0000000..27275fa
--- /dev/null
@@ -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 (file)
index 0000000..77932c9
--- /dev/null
@@ -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 (file)
index 0000000..848d216
--- /dev/null
@@ -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 (file)
index 0000000..307d553
--- /dev/null
@@ -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 (file)
index 0000000..2cb35e5
--- /dev/null
@@ -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 (file)
index 0000000..27a0221
--- /dev/null
@@ -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 (file)
index 0000000..3baff8a
--- /dev/null
@@ -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 (file)
index 0000000..5e61372
--- /dev/null
@@ -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 (file)
index 0000000..1f628e9
--- /dev/null
@@ -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 (file)
index 0000000..2134403
--- /dev/null
@@ -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 (file)
index 0000000..c29781a
--- /dev/null
@@ -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 (file)
index 0000000..c07efa6
--- /dev/null
@@ -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 (file)
index 0000000..4894993
--- /dev/null
@@ -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 (file)
index 0000000..dd20dae
--- /dev/null
@@ -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 (file)
index 0000000..f9dc333
--- /dev/null
@@ -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 (file)
index 0000000..005f3a1
--- /dev/null
@@ -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 (file)
index 0000000..505d1e4
--- /dev/null
@@ -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 (file)
index 0000000..6cb9d34
--- /dev/null
@@ -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 (file)
index 0000000..7acdf61
--- /dev/null
@@ -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 (file)
index 0000000..e7f13ac
--- /dev/null
@@ -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 (file)
index 0000000..fd161f3
--- /dev/null
@@ -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 (file)
index 0000000..c1d3787
--- /dev/null
@@ -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 (file)
index 0000000..0d38de3
--- /dev/null
@@ -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 (file)
index 0000000..779e4a8
--- /dev/null
@@ -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 (file)
index 0000000..d84d094
--- /dev/null
@@ -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 (file)
index 0000000..7b5c1d1
--- /dev/null
@@ -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 (file)
index 0000000..8cdfff8
--- /dev/null
@@ -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 (file)
index 0000000..70b9434
--- /dev/null
@@ -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 (file)
index 0000000..cfa2bbe
--- /dev/null
@@ -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 (file)
index 0000000..c675bc6
--- /dev/null
@@ -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 (file)
index 0000000..e16f362
--- /dev/null
@@ -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 (file)
index 0000000..7b147c2
--- /dev/null
@@ -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 (file)
index 0000000..9b9c0bb
--- /dev/null
@@ -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 (file)
index 0000000..fd0ba2f
--- /dev/null
@@ -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 (file)
index 0000000..304adc5
--- /dev/null
@@ -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 (file)
index 0000000..3170860
--- /dev/null
@@ -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 (file)
index 0000000..a933775
--- /dev/null
@@ -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 (file)
index 0000000..dc20f3f
--- /dev/null
@@ -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 (file)
index 0000000..0a1853d
--- /dev/null
@@ -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 (file)
index 0000000..9baf6cb
--- /dev/null
@@ -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 (file)
index 0000000..845ea89
--- /dev/null
@@ -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 (file)
index 0000000..09a531f
--- /dev/null
@@ -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 (file)
index 0000000..30ee315
--- /dev/null
@@ -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 (file)
index 0000000..daf2a25
--- /dev/null
@@ -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 (file)
index 0000000..ad412ab
--- /dev/null
@@ -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 (file)
index 0000000..9f37ad2
--- /dev/null
@@ -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 (file)
index 0000000..f5acb3e
--- /dev/null
@@ -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 (file)
index 0000000..b75bc80
--- /dev/null
@@ -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 (file)
index 0000000..ba58219
--- /dev/null
@@ -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 (file)
index 0000000..2f758d8
--- /dev/null
@@ -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 (file)
index 0000000..4ad1efb
--- /dev/null
@@ -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 (file)
index 0000000..eff4d8e
--- /dev/null
@@ -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 (file)
index 0000000..1370b3d
--- /dev/null
@@ -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 (file)
index 0000000..5267f5c
--- /dev/null
@@ -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 (file)
index 0000000..358626f
--- /dev/null
@@ -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 (file)
index 0000000..d0f9999
--- /dev/null
@@ -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 (file)
index 0000000..4693788
--- /dev/null
@@ -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 (file)
index 0000000..9809bc5
--- /dev/null
@@ -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 (file)
index 0000000..60e08db
--- /dev/null
@@ -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 (file)
index 0000000..a470e0d
--- /dev/null
@@ -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 (file)
index 0000000..dff8bb8
--- /dev/null
@@ -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 (file)
index 0000000..359d385
--- /dev/null
@@ -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 (file)
index 0000000..f528051
--- /dev/null
@@ -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 (file)
index 0000000..93fba67
--- /dev/null
@@ -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 (file)
index 0000000..b8a4e2a
--- /dev/null
@@ -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 (file)
index 0000000..86e8031
--- /dev/null
@@ -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 (file)
index 0000000..95630e4
--- /dev/null
@@ -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 (file)
index 0000000..9df9cbd
--- /dev/null
@@ -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 (file)
index 0000000..f5c63fd
--- /dev/null
@@ -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 (file)
index 0000000..a7f5e7f
--- /dev/null
@@ -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 (file)
index 0000000..d7a63e5
--- /dev/null
@@ -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 (file)
index 0000000..d889c39
--- /dev/null
@@ -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 (file)
index 0000000..5b3ba49
--- /dev/null
@@ -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 (file)
index 0000000..821fd99
--- /dev/null
@@ -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 (file)
index 0000000..7c7aba2
--- /dev/null
@@ -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 (file)
index 0000000..9053183
--- /dev/null
@@ -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 (file)
index 0000000..17148e2
--- /dev/null
@@ -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 (file)
index 0000000..f770bcf
--- /dev/null
@@ -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 (file)
index 0000000..1bf1838
--- /dev/null
@@ -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 (file)
index 0000000..f272bd5
--- /dev/null
@@ -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 (file)
index 0000000..11868b6
--- /dev/null
@@ -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 (file)
index 0000000..bdd2374
--- /dev/null
@@ -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 (file)
index 0000000..1ffe5b2
--- /dev/null
@@ -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 (file)
index 0000000..4f11e8c
--- /dev/null
@@ -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 (file)
index 0000000..85a4c3b
--- /dev/null
@@ -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 (file)
index 0000000..3e7d727
--- /dev/null
@@ -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 (file)
index 0000000..25cf7c0
--- /dev/null
@@ -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 (file)
index 0000000..d38d3f1
--- /dev/null
@@ -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 (file)
index 0000000..2c90f33
--- /dev/null
@@ -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 (file)
index 0000000..cce6c78
--- /dev/null
@@ -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 (file)
index 0000000..5a844a6
--- /dev/null
@@ -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 (file)
index 0000000..5dfcdde
--- /dev/null
@@ -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 (file)
index 0000000..e5dba4a
--- /dev/null
@@ -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 (file)
index 0000000..ec6441d
--- /dev/null
@@ -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 (file)
index 0000000..fa2c29f
--- /dev/null
@@ -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 (file)
index 0000000..09d8269
--- /dev/null
@@ -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 (file)
index 0000000..f7c44a8
--- /dev/null
@@ -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 (file)
index 0000000..e5ac91f
--- /dev/null
@@ -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 (file)
index 0000000..b1e50f8
--- /dev/null
@@ -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 (file)
index 0000000..9c104f3
--- /dev/null
@@ -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 (file)
index 0000000..62fc8bd
--- /dev/null
@@ -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 (file)
index 0000000..b86e5f2
--- /dev/null
@@ -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 (file)
index 0000000..1d6c763
--- /dev/null
@@ -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 (file)
index 0000000..da2c1f6
--- /dev/null
@@ -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 (file)
index 0000000..5bc9c2a
--- /dev/null
@@ -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 (file)
index 0000000..dcdf846
--- /dev/null
@@ -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 (file)
index 0000000..0e62051
--- /dev/null
@@ -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 (file)
index 0000000..711fba2
--- /dev/null
@@ -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 (file)
index 0000000..7469f08
--- /dev/null
@@ -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 (file)
index 0000000..18fc87b
--- /dev/null
@@ -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 (file)
index 0000000..013cd67
--- /dev/null
@@ -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 (file)
index 0000000..d90adb9
--- /dev/null
@@ -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 (file)
index 0000000..cc3cc30
--- /dev/null
@@ -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 (file)
index 0000000..576a079
--- /dev/null
@@ -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 (file)
index 0000000..8d8b304
--- /dev/null
@@ -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 (file)
index 0000000..03dd7d0
--- /dev/null
@@ -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 (file)
index 0000000..b6ac608
--- /dev/null
@@ -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 (file)
index 0000000..a521c9a
--- /dev/null
@@ -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 (file)
index 0000000..86d0231
--- /dev/null
@@ -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 (file)
index 0000000..f7fc430
--- /dev/null
@@ -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 (file)
index 0000000..6d270ca
--- /dev/null
@@ -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 (file)
index 0000000..37ca8f6
--- /dev/null
@@ -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 (file)
index 0000000..5834528
--- /dev/null
@@ -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 (file)
index 0000000..313362e
--- /dev/null
@@ -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 (file)
index 0000000..75a3c58
--- /dev/null
@@ -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 (file)
index 0000000..87f61d7
--- /dev/null
@@ -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 (file)
index 0000000..e5ac91f
--- /dev/null
@@ -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 (file)
index 0000000..d52da97
--- /dev/null
@@ -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 (file)
index 0000000..f7e0352
--- /dev/null
@@ -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 (file)
index 0000000..3bfd0c9
--- /dev/null
@@ -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 (file)
index 0000000..1c1d94a
--- /dev/null
@@ -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 (file)
index 0000000..39a021c
--- /dev/null
@@ -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 ("<pgip><" ^ un ^ "doitem>" ^ s ^ "</" ^ un ^ "doitem></pgip>\n");*)
+ output_string mout_ch ("<pgip><" ^ un ^ "doitem>" ^ s ^ "</" ^ un ^ "doitem></pgip>\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 (file)
index 0000000..3a9dcde
--- /dev/null
@@ -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 (file)
index 0000000..89ab948
--- /dev/null
@@ -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 (file)
index 0000000..b98865a
--- /dev/null
@@ -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 (file)
index 0000000..a0cab98
--- /dev/null
@@ -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 (file)
index 0000000..17d5993
--- /dev/null
@@ -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 (file)
index 0000000..194a391
--- /dev/null
@@ -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 (file)
index 0000000..50bf063
--- /dev/null
@@ -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<v → 0 < (v ∧ e).
+
+(* Here we are avoiding a construction (the quotient space to define
+   f=g iff I(|f-g|)=0 *)
+record integration_riesz_space (R:real) : Type \def
+ { irs_archimedean_riesz_space:> 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 (file)
index 0000000..5be3c9d
--- /dev/null
@@ -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<n → sum_field F n ≠ 0.
+axiom le_zero_sum_field: ∀F:ordered_field_ch0.∀n. O<n → lt F 0 (sum_field F n).
+
+axiom lt_zero_to_le_inv_zero:
+ ∀F:ordered_field_ch0.∀n:nat.∀p:sum_field F n ≠ 0. 0 ≤ inv ? (sum_field ? n) p.
+
+definition tends_to : ∀F:ordered_field_ch0.∀f:nat→F.∀l:F.Prop.
+ apply
+  (λF:ordered_field_ch0.λf:nat → F.λl:F.
+    ∀n:nat.∃m:nat.∀j:nat.m ≤ j →
+     l - (inv F (sum_field ? (S n)) ?) ≤ f j ∧
+     f j ≤ l + (inv F (sum_field ? (S n)) ?));
+ apply not_eq_sum_field_zero;
+ unfold;
+ autobatch.
+qed.
+
+(*
+definition is_cauchy_seq ≝
+ λF:ordered_field_ch0.λf:nat→F.
+  ∀eps:F. 0 < eps →
+   ∃n:nat.∀M. n ≤ M →
+    -eps ≤ f M - f n ∧ f M - f n ≤ eps.
+*)
+
+
+
+definition is_cauchy_seq : ∀F:ordered_field_ch0.∀f:nat→F.Prop.
+ apply
+  (λF:ordered_field_ch0.λf:nat→F.
+    ∀m:nat.
+     ∃n:nat.∀N.n ≤ N →
+      -(inv ? (sum_field F (S m)) ?) ≤ f N - f n ∧
+      f N - f n ≤ inv ? (sum_field F (S m)) ?);
+ apply not_eq_sum_field_zero;
+ unfold;
+ autobatch.
+qed.
+
+definition is_complete ≝
+ λF:ordered_field_ch0.
+  ∀f:nat→F. is_cauchy_seq ? f →
+   ex F (λl:F. tends_to ? f l).
diff --git a/matita/dama/attic/reals.ma b/matita/dama/attic/reals.ma
new file mode 100644 (file)
index 0000000..eaa6a24
--- /dev/null
@@ -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                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+set "baseuri" "cic:/matita/reals/".
+
+include "attic/ordered_fields_ch0.ma".
+
+record is_real (F:ordered_field_ch0) : Type
+≝
+ { r_archimedean: ∀x:F. ∃n:nat. x ≤ (sum_field ? n);
+   r_complete: is_complete F  
+ }.
+
+record real: Type \def
+ { r_ordered_field_ch0:> 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 (file)
index 0000000..2ea1888
--- /dev/null
@@ -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 (file)
index 0000000..1e29bee
--- /dev/null
@@ -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 (file)
index 0000000..5d9c2da
--- /dev/null
@@ -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 (file)
index 0000000..d85a02c
--- /dev/null
@@ -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 (file)
index 0000000..ec6a1c7
--- /dev/null
@@ -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 (file)
index 0000000..21db34e
--- /dev/null
@@ -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 (file)
index 0000000..c5ba9bb
--- /dev/null
@@ -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 (file)
index 0000000..8518d7e
--- /dev/null
@@ -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 (file)
index 0000000..789c7c9
--- /dev/null
@@ -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 (file)
index 0000000..7664128
--- /dev/null
@@ -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 (file)
index 0000000..6830ef4
--- /dev/null
@@ -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 (file)
index 0000000..197c3ff
--- /dev/null
@@ -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 (file)
index 0000000..76a6842
--- /dev/null
@@ -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\93ܶ\11¾çW°t\11§â\81ù\0ø\88/\96,)å\94\92JI\e\1d¤QRX\12»A\89C\8eùX'ëüøô\8b\1cÎrìÒ%§\\86x6\1a_w\7fÝ\98 RQ\14Ü\aôùcðòæÛ7q\90D*Ë\82\9b» MT\99\ 5û8ÎU\94\ 67¯>\85?tÃØOãè\1füã£}ô]ëvû47aí\1anÜìÊ4t]ï\8e\16\a4Î4v÷ùæOA©
+\13ì\13­J\91ÕîÒ8|À\1f×ß»öQv¼ê\8e¾µ£\15É\9e¿oÝ-4`ép?9\94÷í\9bä¬j\1cC«XI\7fgO§Ý>É®\1f\18Å¡ow\89   G×·\1dïO\83X«Tãþ½I\95ÑÁ>5J\17¬^c§ÚãV\10òÞV®¯»Ñs÷\a\18Nòе,GÃÕJVC\ee\ 2£\92\98d\1c\12­7G¥\99Ê\138p^ôºí}%ç|ì\1aÿTfV¨(?Ëü7ÏÇ\ 1X\ 5\87@÷4.U
+\86Ê\8dÊØNñ\ e¬\96èðG\808
\9e\10\bë\89-\86Æx}CÖ\ 6½bU\1aÒ+R\ 5"X\96*â£>àuS\ 3×ÈÌNg\80ý7h\8b$lɦû4KÃÆ\8d\80¨\1d§^\ 6\8ev\ 4Û\8f¾¢¾\ e+03`\ 5\83'\ 2­ëmë¬\b\9aZ^\ 4Æê\19Óª"ÌA\90\9534ìízÏ>\14\81;j¥5éÇ®µO\8a"<ú\814H\8a2tüYfK²|\ 6bîûÙgq\8f\1d\ 6ëyÁ\89¾|Q\13gá4¯\18ájè?$P\16ÿ4\81d\19k»þh\9b£\93\ 3xÛàöke\r){?y\12¤     >nT]?ÈXíî\e\94¯Óp\18':
+FmUÙÚ\1d}åÕn¯£"ü«'\94.\14Õqxê]å\a»è\ 1ð&¦XîÝÖÞ\1eå ©µÜ\0T÷[L\11h\b\e\10É.Þc\ fTFA\13\ 3
+\93\87Ã\83o«®\81(}Æ\v\ f\ e\1eTæÎA,së\e\7fØñ\98«eKÓ8nÝM-Úåú\9e+f?$&oýHÜ\13\85Ã\84ßX\98\ 2\19bðè_E\f¦²\fAÇK\19\90\atHWáö¬\fÉÄB71Û\ 6\eä·\bÞ0o¶Í½»ÅXÝ\8f\9dørÓÝc\7f«£mmãG\8eëTÏÖÅæp\ 2\1f个eè\9dwã\84\1a\9c2ö~6$-Haû8αxè\1dÊm¤Ïw\ 1\1f\ 5Ã5þ\19\vì6k7
+6\1e¢°÷Ï\ e;uæ\83@\17\ 1xZ¤\98\ 2Þ\81%\1a@\87 -û®­\17/³¤C^P¤=\7f\817\1edÝ;gѶi\11¡        \1a\19õ<2Rz\90±Z\ 6\93`ÊãoÝ\ 3\18\11\ 3Ñ\19³\ e\13Çá\9b\1dl´c7q\17\ f\8cS\99M8a 8\940hè@^]\90Wc¿ò£í[\99\1c:\fj\94`\9bjjÉ]q\1cÙ\93\9cÆ\180kÇ\83È\80Ïí\11'n)®Q\81\85.¶.\8b:érÆÌ\80ÓR\1e\9dzÇ]¢:üvÄÕÐ:\1c|\8d(>ã.X\919'¬\98Ã\80\10L\94\85\7fqþéNtY
+\0\93\81Ã\ 3UD\93c\ e\16\84î²Õò0\eK\9b<|;ýËñý¦þþ\97\8f\16X»å\99OÅgn\9cÀQ\91Éu\19\87/\1a\7fê%ØüðËË©ÿ\ 2DðO\8bçþ,ûbÙçðS°ùÀ\13À\15·º|Ê>\7fó)ÿ\8c
+çLÏ\97¬\97ê\föV3á\1då\86\8e¬¦ñâ5¤ 2\97.\98ôPÒ\83·<"ä\8fc\87CKù\v°þ\ 3h\96ç!Ý\e\\80¬\ 3+(MÁ·¶×\8c+A\86G\15é\99%°«\ 1SÎ×æ\9chËL\95\1aDP|íöEøÝ\9cò\97% <1²ä\1f\e\ 1¹*s\99Ün\85Ba\16þ÷¥ö¸²\93\80*$\@Q\86¨H\17Ï´<^KA\92­´\8b\13\15\r\9e\1eR`\15Â\93{b;\81â\82ª\1c\1fFùS@\85\94\95¢ÜU¤_AO#\19°ô\ f\10\ 2z\86\0¨\97Dzæ÷[øUü[àÍ¡vK6{S\95&_\83ü\17ôWÃ2¨õe£d\12c9<Û\ 2£(IC?\17I\10lu\87)\1fÉ\1cÙ\a\1cwñq\1cÇÊ\8bç[\88\ 2pæÞK\1f\12Wí%\9db¿\96ïáPuÇ\13P9§«}\ 6FLÖ~\8cùväZ\ f*\eLìi\84ô\87\8e çá·\9b+\ 3+\87Ð$§\13ìhÀ\9cÆÜÖ­óRåù\ 6à\15*«Ð¸Hó Î·\es\18}6ô\87­\e\80\b»¯¸\83ıíýVñĨ²¼\fÈÕI\98Á\94ÎÖ`n/_bjý\8aÀü\ eË\92\82«@ËùA\87ÍóÅ5úÑ.Õ&Nõ®Y^bÐe{á\16ú\9a¹\0çè[ÞYFK©\ 3\8dÁµCÇMJå]_ûv{\ 1LÄú"_$Y¾E\1dl2\9b\10       ¸\ 5\1a^ÕÇ\1a4\ 2nÖ\94¡6f\8dÓB%¿Î/¨À<[s\11\89R»9·\8bM\9fª_À{©ü\1fp*¸\99NÎn\86wBèñ+5$@_\9c¡G]\11z¦¼"Vi±\ 6u6\ 6\94q£\IÊL.ê\16ð¨\82\94G\124\89\8e[¦g·CV¢4J¬\94\94×X      ¬7/¿j\19\95g¿\1a\19\btb\1dImMN\8cªóGª};\97°Â\1dRíÁs\ 6\1fÊ+DðE8g\7f\8dï\a\96\8co¤Ó©ñÕ\12Èð\1a:\93\91\96ÕçrÞS0L"£¶\9b+&\11\7f\93\13\8bÙB\7fMbÄòLË\v\0µ\9bD[\b¾\85\9a Q\8aò«÷kãf\98À)\8bu®¬:(ûÆÉ\ fô°\81õwðº\94¦oø{YH\19\12\13\96Ä,ï\16*£á\ 5ï\97Ç\ 2ð]ðóü\9f\81)À/\82c\10\17\19&Pé7Á{ú\8f!GVÏ)wCY\83\7f}\941\ 6Ôå?$Åò\87\adx\90\99ª\8c\9f ¯üÉö£\9f³\1feE#Y-\ fßW\1eÂ\8aR_Æìõc{\87¡@\94HiÕ\84\7fk½Ðß \19ÎDðr\90M\9e¿/1ÌZ\vuu\96éð\83\97é?S%\84\90ôÛ-Ï\92\12ó'[\17\14ý\88ï\81\95\fN%8<Þ\f\aó\7f¸§£8ɹy>P\83+¼Þ\1f­o°\0ÕÀÈò\7fÓ÷Õ  \ e½e\1aP~d¬Î\88b@æÁ\9e\9e\7f\87Ö`Æ\86ÀLþoÁtê\11\9eÀß_Áq\1d×è\93%<}\97?\0cqõßý\17¡P\8b\98
+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\8fã¸\11¾çW\18si\19hk%QÏìi\1e;\9b\ 4\9bE\90m$\87v\1fØ\12ÇC@\12½zÌ¡\7f}êEÙ²Ü9\18"\8bïbÕW\1fË»(\8c¢ÝiG\9f_w\9f\9e~úªvq\1cVÙîéÛ.-ÃTí\ ey\19\16ÉîéËsðEï\ f\89\8a\ 2ÝÖso±\1c\a\9d\9e\fül\8dõH\ 5Ç$Ïöi\1e\a\86û\8e\93\9e\1c\17\aS\9b~\9fä\ 1\8cÀB\ 1\ 5hIª wØë\11*Y\14Ló4iìöÃj\14¥UPcõ»t\9e{ÍK\9fõ\0\13¼<ýcw\88\8b0Ëà\93\86iJ[m`;i\92\ 5\93n\r\96pQ7XÍe=N\83ÆU¨Ö\98¶}°²³Ó ß¬ë\r\ f?\ ff¬mßÈ\1c\8dn[\19\ 43À>çAª?p´\99&\£åME¼\9f\8c÷\ 3k\80\1aÒ<\vÆ3®\80]~ú\9a\9dçØ7¢ÞÿáÖ«»¨Â4\91Æp\7f(³$ø{\8fÓÁYÚi°<ód\86Îö\16\94\96\1eÐR\11\98\81Û\1aÛ9<õ`¤Y7Ü`FÓ\9d­#i\14Ø\96g}Ú\97p\85n\80»e\r\17YX\16+\r\eÖ\85Ê\82Ï\8enóÇ\9eÖ;\99þM\1a¾8Ø\8f\9e¤Fw¢òà7óÊ[\eO3*6*WV\83]yïn\1cí«mE6\9aÓl\aÃsÌ=\võù< y\95A]³R½Þy\97g4Ë\9cçÏâ,\98÷\a\ 5\ 6\ 5{4\ 3\99\86Ê@\15}íð"±\8c\9bÄï\9f\18\96Gwö͵\15KUY\ 1òq²Ólú\86:FÁ2\80¯\98ʽ\e:t\81ÛûVE\15Fñ»\17~\90ö«³Ô f\14Ãá\1d\17\96u |\ 4\ 5uöpÜw\ 6\f¢Fi\19\81t³p\9c§è,¼ð?ñÚ\83\9f÷\87\18.½Ùì"Qa\92J×ã\1e,/«R¶\rR\b,{j­ìe\9a\eëFËëÚNÌï\ 4÷/=lÏm Z@\ 5qܲ\b\8bjí¹\83!\ fD%§    jÜê\ e\8f£ªàoº\1fQ\1c\ 5ÿ%\ 3}¥Û5\ 3õUà\9fÜè\ 1
+\87\0H\806h\97Ð\ 2VËâ?g¾~\90¡\19£¨'\aá2hÐ\fµÞ:òwì\1012à¦"0\83óÌhæ¸é9\8e^\1e\9fãø%Dl¨ÈSU\94\a¯³ë5\17Ñr4¸      î;\8e\ 3\80\9fÆH\13\19 |/\ad'Nð\8eÙM\12t\13\iÁE¬´\ ff\1c\rMºu\ 3Ñ\13^D
+\864îcØ8M§`\19((lR¤}ÜT\99\8bª û$8@\15Ú\1e|o\9c\18Ex©TèýÈÆ4ó0Hs«ýê\ 4µ\80\16å\82\16dwÕ\95sä*¬\94\18\1eM\a\8aÍHãÕñØä÷`É\18\1aò\bwykö\99
+Ër±ú[C\8f³PygÄ#&°9\ e4p\81\rA\18\96ƹ®AËb\9eIZ\82äìÁ\8aâ\²\8a\ 4 \9b±\18*\93Õmb×Öv\88.rʼ
\95\1aaâú\ 6l7ºËòËAù&@/`\18£\80\14Ý+\82Õ\83\eö ÖÆö\86Q\11\1ct\ 3\16I\12æ¹Ìöï;ai\8104v\95\ 6¿Ï\14\16\14ì\8e°·ðØ\v\98\1dÒÉ~y\ 2¢áÉE\92@ä.i\82Ï®CEä
+|Ëöµ=³æò4p¯\16B«¥\18K,¡\0Ó·¾¯;\13þ»\9ea\ 2\85\8848\90\90ÆqyÐþ¢\ 6/jd\8eo\0Ñ8÷ÜBxÜ\10\8aÌk\9f\87ø0\8aõ,8\1ekÇT\0\97¥\81^\98Í\a\1e\80\ 15¡Ø,NtY8»u"\14é\ 6\89   E\14ªR\10ÂÒX;ÙÿÖ½   \841\8eêáä:!Y"¢¨\eU7\80        ·\95\97
\1cÑÒGá«ÃØ·7&B\1fxxͱÎ\8eµtn\1f®\17»³)O\10\0\9aþ0\9eSAE=2·ê}{îÁ\18[\81lYq Ð\17\88!\83:\82Z\88\18¾\11\93\8bR9]N\\10a^\13\17ÂyX>Úþ\84à¿ED=\8eút\12\v\98Ìh\17\85ß\5nÝ\8aÈHa°ãÜ\82¯Z´z \15\1cf!\ÆaZìT\181a&Óg{
\1c\90Ë7üòÈóà\ eæþ\84\96Kv]x­`ãñ\b±\13\18æ\a\9e\ 2(t\98®\bÁ\bÛ\1eÑÙªÂk\e\8b\v%§z\19\Y(:СvÝy\9eè\\1c\ 3a\f³¨"¨Mc\b°a\1cº\85n/TýÿE\15twШe\8cB\16Ú!\ f¥\8a\87\83\ 1¬\8aE\14D@¤;\9cúÕ\ 2±\9b\18\rK\bØáq¿\ 5
+\95\94a.@1\98\86}=\ 5¨\9f'f\889ò8æð¼/G\91\87älhÐ\99iú  \8c\92\8d\ 3\7f`9¡$\ e^\1cW¤>
+m\9e\1cõ=\16¬2\0Ø\85\ 5«<bbI\81?¯®8:6q\.7q\99\ 2\1aÇå\9c¼´EU×ú\83ÌÂN!\ 1Õñ\80o®o\965ÇÙo{u\7f­;±\91@\1cósr$8\ 6þ=Ô7b\9c*S°wºÔ,ã`\8e1ùz\8a\85\8d@Ew\10\94'\1fXZþ
\13eÅÈcD\ e\ f\97·;\b\ 2o¯v¦°Uf\14þ\80\95´[²\0t@\15\12\85\19d\ 2Í\O\96ðCñ[\a@A¿\8e3Ǽ¹ÛR\0(%ù5ÙÍc\15ü.~\ 5K/(\86\95\84?\f\7f3\9c\8a9êe£\ 2\1föàÍ%\ró\15\ 1i,ÚI®x\16TÈEà»
+\11Dss¦Úô¬Æ\1e\88\18\ f\14Æ^í$3\13^aÃ`.$8  Èë\80 \131Oãe-$<\eÂË^Ñ
+`Ð\16\0¼ñi&~Ý\88S\13]·¹÷\8a\82æ\8e\81¥áàJ\1d\96\16\ 3\ 6Ý¡\ 5)ò1Eëÿkï p\ 5\8f\ 1\80®ÖLæ\8d¨sRU\v^Bãr?XIù³º\1f\1aRr\88Á\10Ë}Õ\95\17â\90Ñu\9d\95åôÙ¾ãí\849¤»«(\81\91­\88)öà\15ÎÒ\87/ÖKå{û
+N\89\aâç+\ 5åÉÍX\8d®Ù Åt\98\90®üê²ïÄÞS»¥À\0¡\91g\86¿mì¿\b+oý\azXâK\bè\9bd\b¸¶\8a³(hä{eaWÒOº×\f\väP\92Y\88øõ\bÏxéÆ\97Ô\ 1xQ\ 4Q\b<@7<Ý\ f£t\ 5´h\11\843@*9\91C\ fâ¸äTÎ\8a\97<r\ 3ÒEü\8eâ§1\ 4\1fAM2oZ7\96\\90\83`ÐÉ\8c\133H\1cÐÈ\1c_éýkº\96\1e´Ðð\9c¿Ü\ 1/  u\84q\980\9a\1d\17.i0\vNDë`¢\8aÎAKÁé\9e\8b\97{^\ 1\8få\8cgÇ7eR\0\1c\ e\9a\13\1fF×;n\1aè\8eP&\9fI\96Õ\13\ 5bdÑ\8d4\rÌ\r$øcKï\15QËÄB0°xE0Þ\v\85«\90\8aé:Ø\99\81\bI¼V\95Á';~'>\voíçô\85\85\97,Ü c|Ò\ e\ 6`D\aôk\10±¹i-\83ÛTÞ_·\97Cï|Ì#Ñ\vAòR#&+Za\16h\9cÈ\0`\13­^Þ«n\906\9fËú¤GîôÇÙâM\8c,~®^\10\v\84ÿc»§¸Ðø]³\b\80\86ýjýv\9b+&\17G+½ª\80\12\ 6Õ%Ù\11Çâ÷T¼y
+àp±1©Q²\ 4:\12Ü°9KÂâ#q`ìc\es\87÷\91ÕdñÕ\99\93\17\19&¿ä\1d\ 6"z\87Á\973µÔjdz\85\9f\17º+£Ý0:îâ¯\12¤>%Ã=6o\93\1a\85\93ö\8d<\1f\94¤\86ç}x,Î\1c;:¢º\ 6\7f¬\99\1fpd\b_\1c«@\0\0\86\1c\87j\9cw¡        \8fI\96Ã
\9bH$q\94p0\a\ 1íü\ e\84eΠ    KòvÓ02Ø\vTÜñþ¬,\91Aà$\1fÑnä\80 S\0,(Î\91Òó\16*V\84>\ 2sB\13%7/\ 2\9e\84\1f7Ð:\18ÝJQ^×Kv\ 3D>àbÑMï!Às\86>\9d¦de    p\96ÏV£Î4Ø'ÇÝ\94\98\12~¾Xîò«\ 5eK&­·.äwæÇó¹µ\ 2ùþÄøàÚd\17x=Çs\81åKÏIcÎÖ{\82\91·Å\1a\rP\15\1c{é£.ï;®²»µ¶¹Ä_nh\19\10¼\92Ë%Ï\ fS\11\87¦6IüaÑ'þ¸Æïv\14ãKNÊ\8d|ç;\80\80(\ 2þµ¼³V7ËÙ¡\9b\9bÅØâ³aù: \1c©wó:di\9e        ó̽Áì\15Ç}ü\veIó,iS\94"\80\8e\96­7¦Yà,\9eÊ%bÔ\7fù\1f¨ì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ÚÍ\1aÛnÛ8ö}¿Â;/#cj\8eH\8a¤\98¢\ f-:³\98\18´\ 1ö¡i\17\8a¥¤ÂÚ\92+ÉÙ¢_¿ç\90\94D\87\92ã&i¦\ f\89$^ÏýêELâxq½0\8f\7f,^\9dÿú;]PE\18]\9c_-xLÒt±\92)Qlqþú}Ä\96+JY\12½Üí\9az¹â4Z¯K|Q"j\8a®\×\9b¬)\96\1fÎÿ¹øíÜ\9cÆ\17\94\12-¼Óð\ 3\8ezW\ï\8b*\87Í  K£\7f/S\1a\15\97Ë\15\93QÑà\98\8eÞÓøó÷\94~x\ 6ß"\89Ö¥\1d\87-LÁÅû\9dy)\9ab[Û\99²²§}Þ\17m\97Ù±¶øZÖUa'òbcG»¢\86mnI^\1a\88ãÅ\8a&$I\fxoz`Z\0\13\96É4ºª\9bí\12\86ö\9b¬Ã\v¥\8cªb³ù93£\97e?\b\97lðd©Ì5ef·çEi\a\1d¡J²\¥"\8dþUWvA[f\ 6\11XRV]±
+\81j\8a¶Íº\12èÁu\fXöo\99¹\90«4Úfm[nÍ\87\8a®\8bªh²MÙ]0)\96I\9aFfb\80\107´{÷âag\bv¶\       .£u]­\8b
+'ºÆRÚ\83Êr²\ 4\9arXPÕmg¤\ 2ÞÛn\9f\97ýû¾Ä\17`YÝ\96y^t]i'zBد\9b¥à\80ɾËì¼\88.¢ºßXÝ^c`¼X\92\16IJ\12\ e\80      F\94²2\86´g\9aÃI¸î×ßÅ(\8d\8c\13)\ 1\11Ãìçv:\19§)G\1d°Óÿ     6+¢\95\9b\f·
\127ùÑNòÉ\9d\17K\vܾ²OG\ e\14o\9d\0\96×Åe\ 3\ 3=\ 6MiØpc¥\84i\16e¹]Ú\1fðy\ f¤©>£¼âp\aJP£\84ı[Ê#'U+%\88ô%«-¶;ä\17ã"zÏQã\18h\1c*Xjô\91\81( Èà3/.\98PUéô
+\87Ücã\9e»¦Ü\ e¯5|\15½\bê(³\97\80Î\99y\ 3;\97>ò\\8dÈ#\87WI,\f+\ 3}\98`kB\84pô}»\©    öÀv&\8eqV\1eã¬8äìÜÎ\15\ 5CpÁ\14\r\ 4\802´/\ 1)J@f_@\81ö]·oÌ'p03\14\85\895²þ\13*eB'Å\99rJ¸\1c1Oï\83ù#É´@Ô\91Ý\92\1aÉH\99e3`ÔÖ]W{¼\ 6Ô\8c$ÀÔ\14\89(ÿ\8b\95ô9j\8eB+g4\87«\98\båKáÕ¾BU@^Ý\ 6A\bBY\7fÒ¤4Ä#×Î\82í\12oêY\1a Ï\bïÏþ»\9d\95Þ, xk¯\7f-%*\19à2¬b\96\17FuÛØâ D\17\ep)\16$¡³wõÂ\8e6E\8b\bã\ 56\b\bX¤Ð2k\f7\8e\13\8d\8aIèe´µÑA¾7\81\88ÁÃ<À5ÖUÝÁß\99å#ìC\aàù±Ý\10} Ï©¯«2´.\82¤½<fNË/CÎh"S·\8aM\bõh\0ÞN\99\aÝÓ\12\18\80~ ¤Ð\8as¢ÀÕ1A\94\98§\93"ñÀä£\962\vPHI:«W@~Ùóç2¸4!:õ\8d\ 1cÑ/á\11éh,ï\aº<\ 2ºÒ³F\1aaçÇ`?0d\10\16½\bÅ\13TöA ß¢:÷õ\9d&'ÑN=
+\0w0ïy°\17Ä\8eê;®\16\8f\82ûm¦*\92\8e8K\15\12\85\8d2ù£êÂ\18©ºL\88I\86ô²0µ\98\1dð4ªÛ¶hnÜ\87sûöÃ$\15|0d&¯àÚå40~Ä\ f1°©R\1cµ©^X²Û\ fÑ\1aæ#\10\8f\15\bTaï+ ïè-\13\98älû\17gZ\1385ñ]dÑîLî\82.\0\ 2È,ôtàTõwã_¬f\r\82&©>\9d\7fß,\93ô)´¥O\83À2$zÁIÌF×h\18Bñ¢Õ0ñ\9bõÄWÙº4ñ¥F_\8f®/7L6^º\17<ü0\81¿ÆÄu3\84\ 2z:\14Pt¤ç\9b©°Cô\14é³\88n^(V\f<)D\16ÆÏÉ\19îÂ
+yªe\b9\9c\8eR\7f\16\1cÍÇpùYx.\ 4Xé  6ãã7Ú\f\ f¢\17SÈ$|öR\8f\14Óðª#·ò£\97²Ç±\8eóU!Î@M©­r\94í~cÄ\82j\17\8dÂ\8b/|,\8eò\9fë&/û¯]Ö|-m²Dõ\94\98\8fÊöf*¢\1cÍOä\8e\ 1;W\99ä\ 4.ȪQ#h:u\83¦c¨?\1f\ 4\9b|\96k\1d½Ûïlv]7CUeÅ!¡Q\ayyiR{:T´0í\1f*Z\98ЯÑð~*&H¯\91\9eG4q\90\95"\9f\12\16z4FíIÙ\82/²P\19v\98Ò\8d\85q]cqÏlÕþ½\9cð^Ô\fRup<\17£\r\19\98\fg\ eL\ e\fqJD`\ 2\ fÂMì\1cõCé\14pEgÌIjmÌëÃú\ 6WIÄ\b%¾üú\181il\14\97\92p+À¯\91\f\81\ 4JÌ3\1e=uÐ>\9a\ 3ñê\93èÁÆfÛ:ô¸tô/ù\84\7f\89ÓÓ\Ó!*¾\94È1µí£é³\17Su8!~üÈí\96çg£cOè\14\9fô÷ÇéãÃqÒ\93\97\92\19S\9dh\8c/@c\14æßA\88!\ fC\f®xTn·E^\9ar9ª\11Vôªº]\9b0\ 3\a\1aÚ\1f6
+Ï#Hg\18@QE\ 4÷¤\93\vÌõà¡£ØÂv\a\88\92\8fþô»é\8f
\f#{ÂØ10ôi©à<¡\ eÔ\18¼\97P*z]ZâìLíÎ\8a\81 2Ú?s\8e\8c+LÑ=G6Ô2°ðb#J©¢\1c\ýõ>»Þ\94YõÕ\8ca\9f\ 1>®kW¿\81\81¡
+\1dH     ø\ÁNáÁ\99-"\eo*±¼Ü5î6p*õ¦\bÃ¥T¢@Ï\1d\9db~3Q\80\92Ò\ 5,ðÒ\16Ûrµ-\0\9duæò"ÍÈmï\1eÖqÇDm>\8c8\vý\18\b\ 2lôÜØùR\83\10»6\97ublÖ\89aA\10\9cX\92\98ò\13nÿÓ\14Â\12L\ 1áßd1L\8dÔ\1fÄØ<\15hÍm»\ 5\19èPòùVÏF½ºÃÍd~Ë\89~<]\O)AÂ\1f'\13¼\a|òÛ}-£wTÝ\1e@¦Ëy2A\8e!\1fæbl\ f/\81`Êe|oKS[pm/n+ñæ¹)L/Á~ \8cë4zU6ÿýTCÔ#íð{þÁNô½b·Õ-ÏË-6-ûÄ\ 2§L9\ 5\97i<ê\ fd¨ ?Î×)DÄ«\1c_`÷´*m#\1aU­ê\e¬        6À\86\96l2ÆîØ1ï\97Øä»iÇxóâb]Û^\90+µüdÇsgwmc\bÏp\8dìgasì¦lº}¶\19k3¦§Zæ®\9b\8bVÉôTÝ\ 3\82q\v3¼ç®aëSSêÈÕ\19\ eìNì\9b\9c7Åv46|ÖØÄ\89\89\98\ 5\ 4»\82ö\8dÚ*\fQ9\eõê¶\81ù\12fëà\f\8e\87ÎéI\ 6f\8dö®\9eH!=gs¿2Do\ 2¾LìÖê\e\8b\18z2°Ãn)\80ÿrÉ\92\bË\82:ÚÔ\r"4Q]A>\bêw\11\1el;Õ   q\f\83øa²ªÎ\1eÑ\84\7f    ÁH½\98ûiL¤\9a\ 2Cz¾byì\8c³\19õq\ 5\13¡h\1flÿQYO½3\8cn@µ\97"\8e0\82Âg\1fÜøé\87\1c\13\98m\16\8a#\88ºê\11½
+\9b\9a£¸=\80D_æ#ÎCN\1d\1d\91O\957\86Þèi`\\9eÄ©dò\8ck+Ô\93\9a\v¤ÔOéúï\12¨\ 3Q\ 2%P¦R?\9að?\8dÌÔæßÕ\9c\97\96Ê\18\ e¡\13\14EÜöòòr²Ê°\ 2f
+íWp\7f\10\eó];gS\ 5\83»ê\ 5ò\89z\8a÷¦\8c¸?eÔ\8fPJù2A\9a±'ö\ 4íÖ»\0øË«L\87R#\9eÊg_ÎûìC\13\8f  \1eÁÄN\87\ eüD\87t´É!\13È#m\90\89¿\82Q\aÅ\ 3\8cÎ\87\0¼h!Po².³\81x\96ç%¤\ 2åÁÏèìB/ho;[E±?ºÜ\98\14\ 1\7f=\99uEU\f¶<\ 6\10þ·H¨m
+Z\90¶ã7ÇbúfñÎ[Çܸ2ëR¬{¹ï\89up\1eó×\99o\7f\1ddxÊ¿×}\ f÷¾:_\0\9f  ÅA\f\83á\ eü¿ý\1fb\94\9b3
+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\93ã¶\11¾çW(\9b\83©Ê\8a&^\ 4°.\1f\9d\95\93S\94\ 3\87Âβ\8a\94´\89÷ק\e\0IP\ 45\9aÇÚ[>ì\90Â\8b@?¿îÆ®²4ËVw+ûøëê\9b\9b/¿'+BR-V7ïV,K\95Zmr\95Jººyûïä\a³ß\17ë\r#,¡)w/Ûdg*÷º;\19|áÉ·EWÜVMeºj»N×ÿ¹ùûê»\e»º\1eW§T§\8c\87ËÿT\15M\8b£¿ü\9e\ 5» )U«Ì\8eØ&®[\8cÝ<\15Â÷\16®\93d+\99j\89\9dyJà\v$U¶¿\99­-Ò\9c¯úîíúÒâ_E&S~Õ¾ngûâ©V\ fì\8b=°¯üùûú_\84^¹xô¾\ 2\9eª\94ô\8b\1fNåZd\89ýc\ e\87ªmPJ²,©\9aÙ\9e$Msêçý8[täN9\85\94s;èXÔ¸Z®\92ò½\99\1f\91àq\1e%\13|\9c\rR)Ç3Ò\ÎÖ',Íèãhøäõ¯\94\9d\80\\ 4\94y\14ê{KÿÎ\11«]s\9dÜ\ 1#f\14\13)'þ\8bó\1dÃ\8a²ß\ fu½yÐKÒ\ûÞ\7fÌwÃp7®×¸]ôÌÓQæ    \92Ê^¶w3\ 1ÌÓìEm\81\ 5_­7$Ï{î²ÉiU\7fÚ^\ 1\0\83­úã|.|¢ïÍb|£ù@©óÝéTªçSåJi\12\v\1ao©"ãTù4DÙ0ES¡\9cî\8b3\89\ 6a>5ð\84ß?\9f\8a:&MR¥\9cMUu¢\8a\83\9d s-$)Õ\8bF©ïI×\e\ eßÿË\9aò¤\86w\9dÔm\87jVÌù\0Gx>\v\97\r\8eÔ\97%Û÷?U´eªä%.R¹ÈE\91*1Ð\vÑÀ\86\92\1c?¶¡àÜ\1d[ÿÙ!_[ûçÝ\ 43\84T\92© pV¢S\95\0\ 2@óä}ñ\1a_dRÜß×UY4»ÖuTµ{Þ¬\15\88\19\8b\0\ 4\f³\9b\8e¬=Ê\81®ûÎ\94fg\9a54\1fÍë\19ea\10¾m(C¤ô;àlÜ\1f\ 5îùW?\1f;;\9f\8c\98v\18Ïô|!¶D( \ 1H\1eIþ<?ªJõ§ò>\8f>êçËÊe?ò¸ó=\91\95ì\9c\95t\81\95òS\ 2\89ß\87\14+\1f<\9fg\93}̽-å©z      \e³,X
+\81è£\ 4ë¡h0â |È\ff
+\99c\ fS8¯R\9eª×îí\1e\1d\82±Þƹ\9aÊ5·Gsè\aÖÞ\v\95mSÖ'\f¡Ìà\18\12ÿ\85H\87¤\99\18¾·\1f\e\84FÌ^¯~
+FRß¡ÝH\85.»o\88\8c\845ùd¤k\bG\ 2º\92\93¯û\86ñëñ\94\ 2Q\1a¥;È)P¥À#\8b¥d\ 1É(F\19áÄ\7f5vZf#M\0\A¤i\Gi\81\98\9eæhæ"ÊøµÁòµvà\92Ó9ÇEr@ͦ?ʽÝrWµÝÞîØ6×Õ¾:\16G{^\12\v    ÏÆ\0n\ eVÁTdùhKÄ\9aKîb\f\a°¥\b\83ë\1dB*¡\92o\8bSùþ\17\ 4¸R8\80Û\14µ\ 5hw\85Ý\1c\8a©@\f\97(#\98\90ÉÎØöÎu,³\83*\81(ÿ%ÍÖ\83ú=É^¨0T\ 5\12TÍ»\80\17\8e^\99Æ=\ 6ô\1a¹\83\11I\84;B\8e âÇX\84Lz1¨[\87MG&y¼,\89Å\ fO\83Ë\14Dê\9a7EÀ§²çÏ,`\92©$\83¨H2£¢\1cãù\97Á@\97]»V\9e\189±L\ 1âìÛ¦=¶\8d\87ñe\a\12Õ#t×dúcö\96Öqp\1cÂ\a\9e½vä%Ì\1e;`êϧªAEàD&ý\13\15\ 2\17y¿\86U\7fY+\8aÑ\9fÌdòö\8b¢>v-\8eR        Ä\1eöK-¨\ag:0÷ØÛÆÒ/\94\ 6\ enï]Ø<\ fC%Òg1\ fÃÐ\1eMò0\13K7¢\ 5ð'\91-\8c\9c\8bd\80hJF\ 3\88\ 1Jy?`\1f\8d\ eû\8d\17··U±o#¡\14ÄÇJN\fÑo\9dþ\89ÃÓ _²\8f¨\87Öa\86\14x/\93¯çäÎÆä§R³G%q'À\93\8e\16\80\93XbD\8b_eïQòª`ï\vp\88æ\1aaÆ>h 8q\ erh\ e\92­\ 2\90ã\eb#5&ªÂ\91¶a\ e\87\82¯÷\rÃ׿¹Yq\9b\92\ 2Ë\ 6\1aç\90Ì·u\ 1Ö¸,¬\8d\92\89\92:[±a9\9fXlÛ°ó\1dvÂi\ f&\ e\7f³¤3>¹Êg\86\89\9f\1c8,øUì7Þ\bJäL \7f{s´\b\84\v7Å¿o\93*5)ì\91â\92\87cg@\9dm\8f³¸ÊY\\83ìÙðL%?VeÛí¬ÖÛaÎ\88úÕÀ_Úç¾8\1aø\adÀß\80\97[Xùtt{ËÂ\ 4à±ú°\16°o\18\aØ¢¬\9c\7fP:i]KÓâ\92\8cL\1c\aµ0¤óSo«Ú·mmÚ\87\82¯\1fw\ 5Í\9divƵ7\ 6I_À\91ÜïÃñ\ 4gé|ï0\e0:\90Ë\8fAöàs»=¶Ç¢6á!& Á|üX¼Ú®ß «\10~çZ\9f¹¼\1cÖ\83\16RVµÿ½ÝîÌ\16öÙT\9d\82\84QD*\1f5ôü\a\89òI2\1fjôß\9e\87#2\89í\15\93«~\85ó\1dÒd²J\v\e¸\1dvY\16uÙÖ\96T6ÂéókV\96|\8cS\ 2Yñ@\93å@Þ¾\18\ 4Ë\1d.på&\80;½6\81 c\82|@9ÌFM¸ò\87µ\9dwg\9a\8f¾£1¸\11\ 6\9c4Í¡u¯;S×_ \90ö\90(\ 4h\18s\f¾±\9d\eT\88]³¾¿ÚÛô#\9e\8eÛZ\97]\1e¾n:\90\ 3ÛL\`ÇT°EÔ\19¯\86 ¹g\0Óï\9d\82²\ 2(i\8f6\10\0÷´+êÚ¾\82æ\99\ 1}íP\7ff\ 6;W)¹\18\\87ÙlÂ1WJ\92ª\b¬í\8fôÑ\aVLM¸\85»êµÞ£ ;©vÏí¶i-ëJàtݾêM\rG'\13úz,"\83MLºêpªA:íO\16h%ô\95¾±òV­CÅlZÜ5e\96ñØ{0w§Ñîá¼û®½ï*sô\96BYÛ\ 1í»jÆlª\ 2r¸LþÎê\ 6";üÕ6Ǫ9UÇ_ft\84àe¨\\rJåb\ 6\80ïJ\846¬öPüÝ©ñtÅ_{GªÝÉ*ÍÜïB\10 /9^\92\8d ï\£ÞµÍ®èQ°\17Ex\ 5\9cûÆ{á\0\8b\11jQ¸\8d7\1c\7fÞz{Óï\16â\ e\88È\17Ãu*R\rjÉ!ÞgîÄo«Òy\0Ʋhá\ f\83\156;Ý´@\96ëh\14{N\84a\1dÐh˼LôºvDÙQÉ©=\1dæñ\9fJu\ f\\ eÆíÔÇãîÇP?µ¿bá®Ó`       !5\ fÙýpè+\0C¨ß,\11¡GÁ\8af\17R)/ůcdá4d\ ew\ 3ÈXÄ86\14\8fÞ|\8d&\92[\8b\7f¾
+\vàÿµÑå¤Ú\aê9ôÓXB5ÓW\1d\13eCå\81l(\11Ê\86\12\v©\10\98sm*dC\81êT\87&ò          \11ù<±P©d\17Å\82ñ«Ò\1a\17ÄB\9c]t`\93²±\ e¤\ 2\ 3©ªy7\97
+°­ì\91D\98\14§õe©¸ª\füÚ\99Dï¼\9ayx+r̲^\ e\9aÄcô\7fâÀ\87À\7f\8c8á¡âZ¤ÓçE\9eù³\fÑC)8É/Ü\81\10ù\8bÄ\9dsY³ÉÃ(       £"\97£N¾\ 4\r_Lkã\a\8d¸v¦\18\bR\89>\ 3/°.\93Êå\f|nwÆ\15ÀSÝß×\8b©´ä\17½8Åý\ fø
+\94ƺh\9e\15ºgÛ\16³;\99\1aÓI\11\95L32TiàT\10=Dï\15r\8a\95ÆOçq/\v:ø<²|Û\azÏo°é\89I\92â\82]\ ephÄ.ó´ït\17±øÂ-:Ìf§y\1ez k     1½í6ÒáUD¥\87\8cæü\9cùx\9b\10!¾Î¯»f#RÂ>\9fºo\11«\8b²Ë·¥ÈÅÛRäº{6#ÁƲ\rf|DR\0\94ÏM·ïC:lû`Ã=\96\87¨\ 6";WÛÉó%°;Å,\ 4|\8b¢\9f\rf±Pk7½(fj\83Å\9c¹\83\ 6³6\80ÐÛ\18@Î/#!q\15\12òw\1f¹^º¸*^\fÊü)¢l\ 3\92\99\9f\80Ã\1d-ØÎ\93ïh    Fû\12øÛj\8fɼ"\88tmÒçÃ\87ª°\99/Þ§\8fª±¾\ 2\11^îã×9¹\81\1däé\81\80Âç(C\ f\88\ 6,\83\7f\9fVóÛ\85ÛµCa1z»\96]º\KõbQG\8dÖÓ\87ó\a\9fü{?·\8b\e"\95½oõÀeµ+}âr\89ÄÆñ\8f,ó}¢"I~%fþÌJ O\89æ\9fqSSD=È\9bËW\\84Ê°\14\86#ÿ¶ëÓÌ%Ö@y\9e\1dèú\90n²­bH\13º1\98!ä\&eqhÝ\9b­³ÂÓ:\1d|\99\94=pÎÎ\9cU5°1B`°ôxËþ\19ÿýbòßBìg|Õ\14\19\16ù\ 2/\17äªóáÎÀÜn)=\16Ioc~_?æ22\8b\85\8a\98Ðö~ÕX\11\13\fݼÎ%\94ÄdñXçò\r\91\91°&(r0Ò5Ì+bÁ×}Ãøõ1\87\9f\13ë9¬£Y÷6U\13wCJ³>\93ß\9784M¶ÛΠÐÕEW½rM;\9bÜ\87\97ãp××%zíó\asëÌõáîäW5góúÛ¿Á¬ïñêp±T%;¶'\ 4ÑXÁj°xÅÑ*6eÛÙwi\91\a¶UÍ]gvUPã\13\19±\15\13?©öÏí¶l÷÷µqÅ!׶\9b{\15\ 6v\9cÓE\99\80\r
+5B\16»ÊϧÂ}½õ\92Ì&7ë\ fíñØz\8a¶}ái.ÅÙxaÿ\87X\816\ f (\13Éw%.ç¬\89½Æ\85.H÷.\88{yýÃÿ\ 1Z·î\b
+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ã¶\15~ï¯PÓ\87P\935C\IìN:Óì6\9dtv\92NÖoq\1eh\89ör"\93.%mÓüú\9e\ 3\80\ 4(\80\94d{½ÛöŦ\0\12\97\83s¾sÅ"K³lq»Ðÿþ¶øöòëïÈ\82\90T\89ÅåÍ\82eiQ,.d\91ætqùæçäMuEEÞÔ¿×mS-/\98â     M\8btùËåß\17\7f½Ô\9f+÷9¡2ÍåèûzU\97w-|)e²z_á\87_\7f'Ü'ð*Ë\17\99~ù'Óë\ fÈÒLÙÞ+*Å\92ç"±\830ïµ\f\1fÌk«öî~SíªÍ¿aRÎ\92ênIer½¼\80¿Õz]­±\99'u\13,\85Ð"\95ý0oõÐ\94qÛ»­^À0y\96Ü/¹Jª\ e÷'\92\16\7fÜ6µ¦Î\ 5£*¥@LÂSÎÍWûÕRd\89þSm·\9a¤\87[\91$\15Ã\8e\93`\8d<\15ý
+KÓI²E\9eª\\7f\9b\12\ 1ó¥\85îo\82±E*á\97í¾Z\ 6;TiVØÁcäá©,æNJ0Û»®\918EòºÜ¯Þã1ä*Ù\95\9bʴƸ\80dYJó¹\8dñ`cÜ_8Ьïþ"\18\8a\8dÇæ#Þ\19X\8c\86\v\83\a\12Ü\1dÖü\16\84z\9a\1dþéùv\bë\93ý\ 6\97/,c\170 4\8c-\f\81\ 3ï¿/\83áQ¦\8aÉ¥©\94˹\95Q5ÉpÀ¬Äv\8eà\88\8d\19¬\93R|\17ß|·¿¿\a\93¶ë*\rKJ$\1aáô³LÊ\8dù¿«º»Ú \9eHÖÕfS\9aöm5 ¡\0A\ 6Lyo\7fÔ\eó¿«võªÝ´!%\14E<\18í\87\8d\ 4\88\93\11ÔI\9aô\139L³ÐÂRÊ}hA\94Ë\ fP\ e\1a"b\f\80«Èø¼Ù\88æE\7f"89\fçvIE¢é\0\ 3ßì\9b\9e\10Ð\8b\94\84Æõ~Sv\11áæ\19j\85~k9\89â7\9fA\1e\96J9M8\9a\8a"F8XnÛ­58ÃâVm\83\eÙÁø´Höí~\9bZ)tC]P\ 1RJà?\10V\ f\ 4\8dWµÀ,°q\9e Ð~jRûÁJ(\ 2°\ 4-j\ 4ã]]6!'0\96\92~?å«%|\80
+êP6(@"\9b\13\8e\82Ï¡ñ\0LZÝ´!U)\8c@fAÃcÇ<v(¤Gìë\88tr\9f\8dr\ e\18Q\ 6\83ü²û-\82\98R+;\0ÕYmgûãꮧà¾)í*AE\ 3\90\8dT´î\88°¥R\8eÈ?\85\ 4$hJÙ½]\ 5«Ó(Ê¥/Ã?\87\8c\82ü\14å\13\9fÿeÊzZÿ\ 2rXäÉËoBn\ 2UÕ/ç&\98H QG\94>G\7fð9Ùäý\ e^\86P\94J5£\1a\8eð\1fMsvÒ\9a\8f~\1eÊ\1eOU?ùmÀ7\1e±R\0\ 58\94w¨ÿ\84@ý§ÿ\ fúß7ì\0\ 4{Bmê;s\9au\13\9e\ 5ã\ 3A§¹~d'\8cx\1a\98®ï\ e\17¡P&\ eÖ°Ýß\87\11Á\9ed\11彶\91ËnW5·­ACÔ`\19r\86gC\94\11£\10íÙ\19ù\92ù´|ÁDz7k\9e\ e\rñ
+O=K\1a\0Yý°\ 5õÿ"\98\13Ô\aÚ3 ¡Sf0i\1d2\89³À¯\8epIá\\9eSÁq$ð\92;p´$(cæ\0\e\16´\fÎ\0¸$\ f\84l,þÃ!\9cÊóG\88ò\14Jâ±tx\15Óèùië\9f\15;N\9d\rø°Í°`3×1Ñ ôÿîPãt \at\88¯áe ýèü£\11çIó?:mhé?7S.\89ÌS¡íK0ZM\84äÇí¶ê>\98    \17\ 4\94`[ïö»\9d\rð\0\1f\ 5\9e\88\9b\18Ö÷»\ 3\82\17ª?®<z\\ 2Îõ<È\1f\v\bw\ ej?ßÀãÞHL¤\ 58e4-èÄX9ò×Ð?,Õ\e\ 3´\ 6Ò¾\9f®¶/\90á\ 5øÚiÿ<\8blg0.BöÉý0É1RÔ\11Ã\85ºÏiÌn.è¤Á\14xµ`'\8a\94\8cÂHß77ånW¿@\87\84\81sj"t»ÐÏ(X*\9c(\v\19l%Ç!çNUK\88\7fª¬`Ñ\13a$%G\ e¤xÖ\ 3a¾¦fÎ\1c±T+¯¯µÈ\ 5B ]\1cj\8adb.P3&Ù\171£f\80\95Md©¹p¦¥¤Yò\1aMË¢H®Ëí®4\8fÿÜ×ÍÚ6ßµÛ]g\9dn\84\95\1c\8d"ϪZaX \86\1d`^ËSö9\ 6Yo£Úþ\18úO\8aÞ\8cñBõ½&"\83~:Eì´\ 1Ô1\16s'\17MDh\ 6\83¼2\83Ø Om~\81      º©WH%ý\13#5øÿmu\87^=>\ 2\1a\9b\87Uk\ 2)uS"üRô\ 5ѬþÍ\97µ\1dwWmíÐÛ}hç\11\10qP°\9eÄFä|Ð,À\8ex¤ÕVÏ\87.hu»Ç\95æ\fF¿®M3È9\86¦°\1f\85߶Mj\86\¸èÀ\19ÇËüã\ 5èpÞ³\17\897_ÂzM\ 4\r\7f\ 2"T]Ýv¶×Æ˨ñ§W£P·¯Ci\96a´É#ÔºÒ\ 1òθßÆ\vov\91¬Aæ\82\ f¿F\10x\b\7f\fYO8\11\9fU.cÚx`&0X{h!ÅÁì\b\12Æ?VcN'46óWsÓþ\1aÁPBÜy\1e5ª&QÔö£ã\9b\8f\1fÐr©Ld\rs"`Ø\0§\86¡\92\f\99(p~ÄW\97ä   Ájr\12úðhS\81h7ô\e\19\ e\fâ,ÍØã-âYUþñ=¾Ù¨\fæzL*ÃÉôsÛþìÄm\ e\16âÒ³Öû¤\ 1\0bt\10÷¦\ 3c¼lÖ:G@\93r\r\88f\9f\ fu\ 2¶Et\ 2\11¹\97)\8a\86À      ¦L­\12[\9b\81LJ\81ö\8a
+\1fi\9a¿0*#"e\ 4\8d\ fy¶Áw`½¨yëÅ\ 5\90"2À\a\87¯ZïWQ\vë\821m\ 1{FÊç!\v±ý(5'
+C\8c0ªd\ 6\10,\ 5\ 5SΨQp\8c\90{\18I¶5\18;h¾¯ðx\19õr-Ì\181\85I.CWÔ."`ð\riW\18\9d\9aøï\9fÃH{æb­\99\19\10øu\e\9c¸èÀ]È ÌEݬÍ'£±à\1f¢q\83!G\1fMG\búñÀÑG\8d»\88vTÅS0ÄÑ\903õÏêpxîBÒ3Î\9fI¹}¨»\9d\ 6\1eÍS\82ÈdoR^}²\12ºîڦݵM]\9aO´Ï\0ÿ#\ 4Ô|T\9c/S3é\96\17f2gÜã\8a0ªaWq» Ù\19ÌÖÁÿ\89\82\13\v|È    \r~\17²\1fw¶Ó\94÷wA%\9cA~F\8cv\8e\15Ñ^'\86\99ò\98
+\82£e\8e\9b\80LEòM(\16nÓOµ\94èù\12irå\a\ eØÛϧ]PJ{3Ô?\86ÂÕ\fD\97¬\9e\fÙ£\82¬>R\{\82Ó¢\92\9c»á¿\8ayƹ|\1e3ðQ\ 4R\8f#\10ùT\ 4\92\8fµ\rØó\10è\93sÐs\99×GCë\91@¹­Dä\0úÅXó\81ñ°ÚìuH!L² \9e2¦ñ\9b\7f\ 6)¶CRå\9f\9a\91.8\8bÇo\rG]ÀËt:èÁ\8eDpÕXù\8eêÓx±\18\ 6ÿ/Hñ¡:Îãê\98ª#äV\8eÜ\14´îlÒ\85K\97ã~\ 4Ô}\ e\92üê\88$KÕWá­­AºÚ×ÖJ\ 4\87ºBÿ:È`xE\13Qr\17Î\1f-»ë\1acáu$÷.\84+z;\r\12òIHø44?3AKþW²î³A\1a^°>\86ðöËr³ëZËXåÖ>é\98\f:\1e]¹ÛY¶«\e¯j±HÖöUp\9cÌ\83M½âgeSnÚÛv\98:\ 3\82ý\v\d\92fb\98þÎ5\80\ 3\ 3tÙ,ÞyoRÛ\91\9b7\v\8c\r\917\v]Xâ½i\1aü7\v\8c\97ú³Û\ 67»#\91È$ÆØu\82\1a3\eívk\vò3\95´\1d\92\84dÉMÛé2ySÀ©û*Ó³®\87\14\13ü&¦\0\14Ú?àëU×WÈÁ\aWW¶ô\15ÞýÂ~¬I
+\ f;[B©\9dZ\92ã2ý\b¡u ßV×Æ[ÜÞî«°:3\9bªËÄB|\9a\92Ì<]\r.0üxÝ6K\86«e\ 4V{[5¿c\87\9bö\ es<å\88¯Æ\ 5>\19Õõô\82ÃQÍUsR\97Ð\9d®æ$Ê\95:\9e\8c¥\96|¨æäj¢\9a\93ç\ f\8e°G¶aM'\1f×½\ 1Y\rA.¨²\17!ÚÐ¥\17Êíì·ÈºT>K\94bºö\9e \7fg\13\85n\85«_{¦ÂÒ8@\9f\au\8b3UmÊ%\10¢Emò\91Em\12«\9fMç®ÜÔæhcÕ\8c<Ã|Òi:\86©Ç¤U@ß\ eýß\18³lPѱ\1a*\919®yØ\84Â\9f0bosö1ø9÷¥Ë\ 6ÿ8r±'\93\7fYb   >È\9eJ6m§Ë*C\82\8b'Y`\1c\85ÔXàF\16¾x\82 Ï\89\85GbâN\93åúߢ×\1aÔIY­ù|q\16)\ 6.ÄøØ\b7\973\ 6]uNa\98P\ 5\86¢µ¶1u\0x¯f]\1a\85\86\8fV\1f÷·/xaµ,ôÝwÕªZ÷ÙXÓ¹\e\94¤.k\8f×\vÐ"s×>¢ÅÔ|ö&B>[¦ë*\11¢eºC®þ)Êt\aÑ!x#ÊË1}ß´`\1fê\145S}}Èv\17*,8\b%\1e\15   \1fcÖK\vZ1¯\9b*]\vw\98u?¯nJ\1d«\9bzxÎ_\8c\82\85Ud\82ÂËËÇj\19$9\ 3m{REË\ 6\99)\9e\1eÊ\ 2?\ 2©\86Á\1fMª{s\11\vK\9a\88\9a(iò\98;\9eë sy¶\ 1¨\7f\88ùĽÄYv\9f¬v£~4ãd^\9f\88]½<ÐEã+0\ 4\vXýkl\91\ 1hq>\8b\8dË1=i\8c]\9d\94dr\89Ò]\bF\93· É\e}C\90»¤<'\98\947m]½*\97:9\17£6\ 1GBÒϪþãlMY`:rFS
+?É\f¤\89V\1eÒ§!©Ìp,\0ó\10"¨Y"\8c2ÿÀ4ß\8fxÆ^\80á涶WûfÝàõÞ^«|]våuÝÔUWû¡ïue\82\13\9b!¯ë\99\ 4G\ 2j´ðîR>Xäå        µTçÞcxø\f\ fS=cV\98\88ðHN\11\87]\84GbÌ\8cDâ6Ø!\89\17·±\r\917aL2zÓ4\84\11\1eovÛàfÿörA)Å\12¥\v\99K\ 4\86°ÛøÃ\7f\0)\8f
+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\93ã¶\11¾çW({Yª²\82I\0$\88Ýò!vbWR®ÊÃs³¼.\8eÄ\1d£\8a$d>æ0¿>Ýh@$EJ35Þds"\b\ 2Ý\8d¯¿~@ÚÄ,\8e7\ f\e÷ø~óÍÝWß%\9bD1\9elî>mDÌò|³Ër¦øæî/?Eb»K\12.£om×·Cß\9bGóôT<\19Û\94Û\9fïþ¾ùë\9d\13!6IÂt:\11\81/°ÿ[³ÝI\9eFv»ã*:\1c\86\93)j\8bs*²m\81\83,:\96\87û}ß\16ÇÁ)xCS\87³êm*¢\82äÁ\16úÚ\97¶-ë ÈÐó\87òÞé+»\87¡|ç\f\8d7»D2)\9dU\a[\97Û\9dHã¨ë\87£)zKo\r\19\82ÃS[\1eÊcÙl\9d\ e¿¸tv±í.\8dUôÃۢƯ÷Æm\97\9a\8c\12i\125h²\9dhÀ1\17Ñ\9egéVfITÒ\86ß\ 6Ph\97ö\1dKC\82Ú²7\a[¹7\ eúk³«Ë¾5\aÿýè¿\1c\ 6ó\ eGùùh<zDãÊ# ã-1\r\91\8eA/\82¥~§3ÆË%¨«¡/z35/õðu½é\aÓ\1dl\83¾\8cy44è\82XF¦>9èmÛ\17gðpEgûÞ³ *º\ eQ̲,ú\a\fÛGO\8aXD\1dZ\89\82\8e\ 5M\10K`°\8fj¯£+ZB2×À\87\ 5z\8dí\9dGe¢¢¢9\80\0\94        º\17g\11¤¶³4\fÜKtpï~ë\17mÁÖ_Kzi,\82§ã\99\vQÁ1Èì\87¾÷2\91;&(8\15mU´å\8a\93\11k\8d\94'Oµ\9d÷\8aN\97\9cÇI¢\97V#çñ%\88\99\r¢+3\b\ 6X6ò\19÷×a°4ËTÕ\0Ê\ 1AD-\8b£êm     >j\9e\10%!ý\81a0F\9e\10äS *}êz¿¸  \8b\81)\9fZK\84°´¥o\83Ä¡ô\ 3\ 3¼ºjXcÑ=pZ®¥;5>\ f\117\95í\ 3\9a\89t\8ec¢s\81«RPéIYÙ\a0ÒÇ\90£ÎWßé1wñT0\91\81ZÔ÷\b\1e\19:Z3Ío\19\8b\85_2ê\0â7G`¸Wx,p\1e\8f°ã¹fBOç-«"D \86\18~kÛ£¡7\1e\9cÌCè[ô¤àÑ¿\ 6\8b¦¨ \aSÄàB¿q\8a\98\10¶ø¹7'ã5\98µ\84è`¿\80\11½O\81-&ç\93"¥à\84Éó×Ij¢\9d\1cxST£\8fË=OUcFb\18\92Ô\97mm\1a³\1e\1eRäA\85\9eÂ\86¯\ 16§M¹º\0«»Á¯v1e«ÞÏï÷Þþ7~wq!}z\0\9aÁ\90_XUþ6`LJH\8eç\10Ú\89\1c\93¥«\1cy
+\91\ 2½\16ëèoMgëÚQRkJÀ°â~°\8d[\f¸A \17.¶ð\83©hö"ZD\9aÍK\a,qÈâ\0=¼0\93¼Í}Iä\98t\97\1eö\v\82güBç\19îNF\9e\99\89q|r\ 3\1f«\94à9\94ä=\14y\fE¯ÂÒF\978qà\91\13#r\ 62íÂò\89\1f(ÿ²±ÏØÈ\9cI\ 1\15K´[þOR\86LÃ|\85\81\88EümÑRôÀTî­\87ç\8f'Óñ:¿ò0¸y\0Ç\7fï(pphº\93\81$hÞQ@C¤»¤\86\9föû¢±5D!\90É\858´Oi:;\ 4r\17Ê($Ýη\10H*(·T\8fhì\¤È³i\92E\ 3M×E{(úâ=0\bLCJàìe\ 2\ 5é+¹Ï«\1d\0PÓÌ\1e\ ePt+Qf\1d)\86\ 6Î\87uO@\95|ìè¹*^È8ú\ 4µÝ50\1cä:Nè±m]\ 4\11\94Ä`ön\9bÇѹZÁ^W­àìZÑÔ¹\84,\8cÜ{#\8ee[ºì\9e\11\9f\12ö\97õÉX7«/ÔAÏ\90²\8cÖ¹B$â4ªÌ½ëÌbª!8õ\r\90\ 5\81¹\9føÏû­\97öhJ\97\95aIç;\9e>l-ªÕ$J.R\14µP\94)Ju>\ 13\9f\80 uÙá\aÏÚtCXì< Õ\15\ f\80Øà\ 1X;Å\86v\ 1\bI\0aѺ)\96c+\9a\91^xº\ 33ªrp\11\90LH¬r°IH\96Ñ&Á\12\7f\rø3xÈÖ\ 6\93\eEU\ 6à\84JEo\93\0¶´n?mgD\1cY¤I\86ÎsöAAU©\v"-\9c:L x\16å\12aW\ 2C\9a§g®\eRJ\96ÈiJX\16÷\84¥¾n·[h\87Ñj|:Ë\ 5´¢ÓÔ\ 3͹]\94þ\ 4F*ñ2B£Ò\1c\95"r%@\ 2\ 6î´äO)\ 1\0\12\95NDqÍ\92 êßÛ]\1e} 5r²F2\1e,þe!\ 1à
+\9dÊrk:îüx{ç.\81ây\9*\13¡Ë¡\80\90Ð+Û\91\8eï\17b¥`\9a\9f\10ÈY\1eäQ)£Î\ 5P\e¨Î\82\ fR¦ô¬\17m:SÖ%µç{ª%\92Ç\90°l\ f,ú@¥\7f\rÞ$gq>«®\9f\94ÇÓ\93R\8b4oò±K°¤¸;a\vâÇ3¢ã\fdCV²wKkT>:{\ 5ë\98\82\r\1e\9aú\93 ÍãÄáº>Ãiì[\94»æ]\1a\90B\vª®ºF³89\ 3\08¥ÈdÔ¯ Û<\9d*\90L\9d÷%Ë4\18\90ß"¨ºEP9'¨\98\13?¸dÉ3ÍÒ\v\9aÉ9Íä\19K)\96¾\80d&®o\a»Â\89þ¸Ü\9bãÏ$W\19\ eù2¨îè¦{\84.éSáÈ\ 3X\ 6L)£Q£îï\bÊÅÎÄ£§ÖB\1a,ûñ\9eû\9e\1agºÈ@zsÙÛ>\ 4·LÍ\8c\13\16koIá\89\7fï\9e\19Üj/Ï\f\99èì(¾\12I#"«Q­\ 3"Øô M¿ú\8bO"c\\ 5æâý\aW$l\9aÄ'J²\18\9d²Káüyz%J²1 W\ 2^b\aæO¼8aή³\14\82/\133¬² azNèð¦I\82+\15}\8d\8f<\8aéñõÒ¤\ 4+SüÚãd7\8e£ôÕäþ\9aó|ð\ eK9f\82\1d\a\16\12\e\9eó\97ÐXg¾\98¿\ 2§ï\97\90H·dð¹ö\99á\89\9c¹:'W«Û®Ö¯wõK\90øø\19\90øø{\90\b$Éa6\9f\90D<G\92L\84\19hVÀ\994I7ãà\19\9e,ôÊ1åÑ%t&X\8diþ¶àÃ<À¦°CQUs\19b]ÆmJܯ\18wÞz\9bÙ\87\85Ú\94Å£?_\9cÆ2¬Iñë\1døjró[îË_ä¾Û\82o»/¿Þ\9fLd¼Â}òeÆ=ç>\1f\90\C«î³vâ>Êç"2\87æ8û\1f¤íW1þ¿Ì\93u¥×\v%\80\9bÿßV\83Ï\ eð/_\18àÀé8Ã? Ç"\93>Cé\f\1aQ\99}ùNd=\93ðÏ\91¯ñWÔ$úÓÚ¥ä|\9dÿ¢½ÇúÙ\93\17ÉX=»¸\95âóÉ\8dY­ü¼2âú;@¹¸4\89ùE1;ÛÇÂÅ\1c/ò;hxrú÷<ó¬ýÃ\7f\0ùíÒ\19
+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Ý\8fÛ¸\11\7fï_áö¥2ºæIüV\82ëC\91»C\8b\0\r\9a¼uÛ\83ÖÖn\ 4È\92cËéõþúÎ\90\94D\99\94íìGrèËjÍÏ\99áÌüf\86\¤$M\17\ f\vóùiñ\97\ fßýÈ\16YFr±øp¿à\9ap¶XIM\14]|xóÏä\1fÕºÝoªbÛÞ,W\é¤\80\ f×ÉÝrEUR6å-\15j]µ¶uSÖøO\9eÔe×µûÒÍY/©L>\96Ø¥\92Ú­°nw»Êý\7f\9b,ÿõáoßý(FJ¨J\89ä\8bÔR±\éäõr\95I\99lìP\8fh\9a\12ÆÜÈÛ¥ÝåPYB6Õº´{\1cvů@'L^¬Xª\89 \8bUÆ      çfÞ¡ÜV«mÙí\81ßå\8aå°B\89_mèey\9eÜ\1f\e\98ß\94\ 1¥\19\17DR·\7fH]\96\12-]ï«`²&)\e\984\9dÜ\9bJ       \15=c\94³pkJÄ\99é\8c¨ÜõþÞöJ¯W\12u2\97Mæ²~î¡5\87½ÙT\87û Š      çP>\1cË\ 6\8f·«¬Øvûv·¯Êî\96J±ä\1a\14æ\95\959e\8c8\91\v³ì\ eV\95\87y°zûÐT\ 1\7f YÝÓX¸ó¿3_\ 5JuÊ/ÍIÞK\9a\86²Ê\bÍçù¥$Ï\ïç¥àIQ?´\8dS\17\r\a\9c\ 3\a\92¤\96ô\8c\98\8e\1f>\18ûñ6\91)ÉÀ~2Ê\88\943
+\ 1«èþPC½çD\88     Ç
+l- V\12¦F\8d?\15\84"zè\ 5;\8a1+{fS\14?\1cC(/=êí\93\99\90à7\ 2*Ô¨¼h¶T©ä{üè$}m\ 5\9f¥9jË\8ar\92ZqÒK\92çªw]_Cò\8eèÀy¥£®=\81\8c»yÙ\ 1\19r ÃIKç\842+,ezØ%a©\f=ÄoBM¥\8ay·AM\1fA\9f<ÑÀu\8c>Nýä4ùSÌ\10òg0\84õ¼\98\ 4¡ãazgÖÃq\96\83¨,Ný\1d0ª+÷å\16}²äIÕØïý±;îM\9b\0̳m\80}\ 6x«b_ìKÛV\1evuµ®ºb\8bn[%\9dk¯jûEüÛ\1fÜBE]»îЫ;\ 3UÈ \8f£0\ eA=eIY\97ͺèL\10@YòéX4\9bÖv5åº<\1c
+X\91,W\12\84â³ÅSd«­;¤\19G×¥mÜTÛöÐí\11Æ\9bªo2t¤>    Ý±3`\ 4¬»Ï¾:\1cë®è[[ت©îªº²Ð³³±ÌÞöB$\80"*mßííæXÔUÏx\9e\14\7fÀ\ e\10ra\a|:\96\16~¨<ù\98Q 7<\ 2@\14\90fW\11{öÙxö)\ 2\84¿1ÁTSÙ0cÅt
+\16<\85\9aÜ·\ eID\ 6Ó\ 5\18³õxï«ÂBÖD\a\19@[\0¢a°\90\8fÁB\14<Ù  xz¤ä$íí\14Î\93\83¾¼\ 1\1d+ð0\190¾þ\18¢\8bR\84öÑ]\11\10\93\13Ñ\e\95\fÌ%u=ß\9f\r\87î"TÒ\9eÊC,\8a\9c\91ç_\84vw\17<v(\ f\92÷\1cÿ9\86×\ 3_iÀ\17ÄHb*ýw`\1fÅÊ\85º\10C\ 1\1cxöa\8e\ 5BckcKø/\94\86\90cH\e¢\ f\80²<w\b\83S\8d\1dBÖO\ 5\87P·fÿP\ 1x6JüU°?\bK]w\1c\11Í\1aHÿBÍ:eÊÏ\9aÆÃë\8f6\8fÒsc%ÿ¹0ñ³H\8d\9b\80Ϧ\9a9\a)\9e%\90¸Z-'AXÀ    x\9c\8c\ fªæ¹%_\16 a\8c\955\b\85÷Ø.\1cZ`\14·b$µîê\a`\9e±¤ÚnKÈ0»Öþ\·Í\ 1|µA,Æø\98<2Fm2\ 6\8dû².¼lÌO\ 2 d̲+\8e\18\92@iiã\92&¥Ý¼p¹Ìj\8f®<\ 5\90ª¬ï¶ÝnÔ\ 1IÆT±¸q¹\rH\ 6â}ÏÈ6Ç\ 6\90ÁÂÂ\1a\81ö£ûa8@L\1a80?\r\94\1e\83\\1e\19<)ú`Ý"Õ@Æy\y\aà\8dË'íaÀ\16%\0[è,¶0P\8b\ 5"\18Ñf\89·K§¬ ¥VUçä/A)ùµ\166ÙrÔt\bj"î\99ñY\0\ 2óÔù\18J\82\b\157R\ 2J×Hn»\ 2O\87,4\87ª«>[\81\81\88p\ 5=\11\15\8e\9fû9\15\97Ê\0/,N\1cîb\16lÏä®h\8azëRâ²\ f\15j\e\17\9dÑr«\13\ 3>%'\99\9aµø\9cH1áSf\89ÛåØ\14C\0Ó\972\8a\81\85\14\18ü\ f¸Õ\fSXGúÖû\rø¾¨\17ï½qÔµ\v3N\13ªúß±qùdT>\19\ 3A¬ò÷ì\7f÷{¢x=Õe)Ñp&L\ 1êÙääm¹Ý"sp¨\8c°Y¥MÁú²ÉÄ÷1\ 1\8f>ì Èæ¦\82§1`d\9cq&Àç26\ 3Ó\12Ç­\86\ 1!e\10ô¨Y\88Ñ£u\\85N\1ea\ 6\9dÎ\13¦=ÂPY±\827\81f?\9cdc´÷\fYÙµ\90ôB)ö\95çèo\8cqò(®)\eÞ:\19\10H\83\85ØìBç#\87Þaiã\a\1fé°rArk\18\7fu\98ë\F±Ã\94gÄ#\85\95Ü\1e©6\90==\1c\8b\87\1a²\8b_]\e8\97¢yhk@é°¦É4Z\11$&(\80¯\15¹<¦¸@\9f½¼å\9f¿)oq̽æÎß\98]μúCörõ\87YMÏ/iz~¥¦ç\974}Âê\©E=CÝlÎ\a>\8eÕi1\9fÒoî\9b¾Á\89½öªR\ e 9\97X\9d2\94BÐÓ>\8c\9b0¿\95ÏSM\8e\89\84\9fw×úZo\9d\9d÷Ö:⬿\9dùä\10±\14@uò\16\1dv\8ag\827b,uW6¶±Ý»^\e¡Bg\1f¡¦ª\8fP1eÍÒ¤)kÛ¼u\97A\80\ fîv$\13\10ALnvÖX¦Ã*ÜgT\87ÖEÁUp\ 5\ 5\81\9aÖ³W2\9aHæåÍ\88Da4\82@ØG#¿D²ýüê
\7fcÆ>¤2±pídæ´Ê ®Õ\85_bû\ eÇmO+@Ø\f\ 3í¹ù\1e×ñX\91Ͳ,ñ^à$Á\9f¦\ e\\1aë\1fs\a.(:×0)à\82\91L{y\81k\88\8c\845åd¤m\b\93\bow×0î\1eO#8DLT\85i\ 4¿\94Fx\13ß\99Ú°\89³ $\8e^T*¼O¾¢Æ*õ\97\PÆk¬\11ïJ\94z6çÊ}\13ìgþ;$7\1duøÚ\8b*[X\8a\ 2&{Yú\7f¾\8aþøÝÌU¥½!@\17\84e\8f\fÐEª\88´*÷\13^s¸\9aB_>¨\9dþBÓn_®ËM_f¸±\1e¶¸»sEwtÐnä±éëN]\e{}\90?W þDåQ3Ê£¾r´õt\ 6¦\ 6\9fÒé\1aS?? Ü\8biöùbu$\8eñ\8b     /y-{â3N¤\96\9då\8e\9dãNý¿¸\9bHÌ-\84Æ궡¼¨ë?\16\ fÍ\9as|\ 3\9a}k.ÕE§úÂo("\81úð®ì<\ 3g\81|°ë\9f£vM\1fO\1c;ëtØlíÒ+l>Þ°\9f¿$2¹\9b!Y~\9dK½pÇöÛ\86\ 2y\19ËÎìþj&Hp.@âÛEû\18ê\8dÃøOÇjz¹\84ÙÞLüî¦o½\86\14ï®Â¨\1c;´ô¢r×\10\e©1ÊóG\9a\860~÷vï\e\86Ýãñ»d¶!|\1f!8\858^Ì¿\8fÈñ\ eË\9b?ó<\82#!\97,\9eÒñæ\85Æn§\86\17<\91Ð}¼\9d×\82\8eo# Ã\88¾\8dÐ\1e\88\15Q3î\9d\80\8cÛ±\18\9fO\847ð ®J\9ey\a\9f«6ÿ\92ûs1¾\1f\89]ÊçgÜBFtv\157­»\8deJc-Æ+H\94\18~\83\95àÅ{Ó\95[üãîâc"Hõx\rôäÐk2\93=ÏÛ\83\17\89}òÜ\9b\89{\7f\93&;s\ 3ZÅôLÑk^J\D\8bè;\ fq¢d|z\9b+^úyǵTÏF\8f\97²½ÉÔ\15Þ\99+Ìürô[8H9Ïô»ÿ\ 1 ÿ\b\9b
+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\93Û¸\11~ϯÐÛRe\vKÜ`\9cMU\ÙM%å¤RëyËU\1c\89ö²\8a#É:&\8e\7f}\1a\0A\82\ 2x\8c\86\9aÙ\97á\88¸\81n4\17)JÓÅç\85yüiñþîû\9fè\ 2c\94ñÅݧ\ 5S\88ÑÅJ($Éâî\8fÿH>\96Ë\15%"Ù\1d\8fÅá±þ±^Â\9f_\8aå¿îþòýO¼m-   ¢\8bÔ´Ëm!k\v3ÄD]øO"dÐ\18\13$H]áÞ\96z\13SHɺðXØYÔ\8fã®Úéÿ¤.¸ìTÀ2qÝn\13t*PªÜ\94\92 -C\9c÷®\ 6æS\97ý;\I\8a\84Û\87ûwË\15\16Âõà\r\8e\ 5¢Í\86,\97+"eòCÐ\17I\11Én»\80ÿLZ@x$\98#\9c\ 5\v\80\87JRdkã¶ö\8ad\ 4I    O\82²Ì4úûa·\87\93KA¸Êoån«\ f\84"a\9a/~¼3â\99yCRØ´Å*ÃHbÓÅ\87%Oaq+ʲä°\84?E\95Û®.×+`¯X=[Ñ
+`§sÄÜ\9e\94ÛpS\18¢®\83\ fac\8c\14\9b/\99dFBaNk=±Ýêt0\93Ý\1eËSù\98Û%®\b4Ä´»+ºÚÎüùÔÙ\bÿà%âx±Â0)Yëi¾Ý\ 5s¦0+'c¹;Hó\940«Ë-"\19Ê\m\12®\1f·\92øs(\f0\7f§hë]¸{\ 4\87°A\86gs\ 1\ eM÷Áà¼=Z´\1Ê\93\1f\ 1®¶\9b\9dÝcÌ¡\82\80=\86Íâ¦V\1a\f\90!ìfð;+Ê¡¶a\85ø4më*=ë¨s£3qà SV        êvÙ³l\ 1r\14^\9f\ 3$\83K\9b\88\89Áð\feÒG\12B\927a\17ª­õ¢XNâXîõ\803\94\92i}D\ eN°Y$\ 2\r÷l\9bxU\13\18[2\9d¶äÁ\1dW¯¢H\0é\ 2)\r¾Rs¥\9bêSö\14\99êê\93z)Á¸ \bþ\19ÉÖ&\ e\8b\8cèK!Â\15\ 2J/\ 4\8e\b¿5½\133 ò\13¤H\9f\81y\84ì\0l«"¯+LORøøðïzè\16M\91R ñ
+ëatÍC¹Î\97às<\96ùCÈ»8pØÁcÍ\9e\ f\ elÐj¨lâ±^¶\ 5\8eã\84û÷¡PS\94:\85K\81Üràµûýù \89.W\11±\0æE³\9b\8a\85BxÐò*u¥X\8cn\84ë8}\v«\17ÆE.óp\15¸EÙ\88\19KÛé÷0_\8a\88ì=Ë\f\11×y}\10\81\v\0ܺ\17ç\94~N\1d}\84w\eªM\15×x³\ 2¿\ 4äS\17ümw2*\ 2þ_\e8\80\1f2Éïï]  øî\9f\ eçÓ)?Õ?KýPàÑ\7f>\17[­g§Ò\16|ÊOîßÇ%§I^\95\9bÒv¾-*[`úTɦ¨ªº»õîxÒý\97\8fz\ 2Ö-Hí,­C\0}\98Å\89\8e¿×\0øÏ\91xDc\ 3~»\qp96Ú\r\ 5\90\ f}\vpZ=ß\82
+\9a|\rú#\14aw\92obä½qOþ\17
+cÚRH³cz""2\11FZõ53!±\99\80Þe]\99êë.Ó<¨³°Èä2ÄU\ 3¯+\96⤪wjS\1eÏ\9fÏùç
+|×oyß(X{Ȫ\19\89\8dc\19Á\9fÖh|\8dí[c³¬Ï.pR8A\ 6\87Ö\97ãâË\19¤\873\90¸Z"Mü\89\9bè\ 3\89M\f:JÑñ)¿Æ¶§9\92ÆÙ\ap_ü\17\90\ 3£\94ëÐ\0Ó\95\1fÚ\17`\váY->z5I]@lM¥õÖ½\88Ô´¾°WÓ¾ðk*í\94û£×/Úѵ\95Ä\81\95$L¢\8c\rGxd'°Á\83\b\8f×Ç`$QL\r%f\1dWßÉD\11\89\ 3ð\v¼ëÀ%åO\favÇuÓ.\1föU¹¶á ({h\ 4~\9eXI6\84Ù\84\v$øµ!("S\94Y7è£Áp\8béT¤VÏA¥Ö:öUǽÊ\93Õ4¥\8câ\0\81pÐë[EAôé\a\8bì\18>\1f~SÚX\93`3%¬÷D3-Ê#\ 6\90\92!ó«ÆÍ/\194ÿbtü©\81/Neò!¯ñKp\rã\1e\80í\ fåC\8dUå^ÃQ²;\15Gc;3\1fþ\f¨mê\9aÇu~8åÆ\ 4@\ 3Û¬8\84½¼µ\156çí\97s\1d\97?\14ÇSn_׸Yº^+×{±Þm7y\1fî\ 1\97 ÒÇ=)µìGÐ\f
+\84ôÑ̾\88ÔÔü¤SÓ¾\88à^;zý¢\1d=\8e{4U:¢oâÃÅ\83ÙkÉ\0ëT/Ö¥p8¸Ó0\8f\88X£î?ÄT\9dM\ 2\9cc\1d\8a6D=Õw&ùC±=¹\9f\11\1c\ 4\r$S0h\14\82\ 6ç\15\ 5`1ÀWéÔaó`XÑâ¾C>P\12*®E>J±¶\aºÙ\9f·\86\97j-à\r\15`\1d¦$\867\f ÿÆÁY:\18\ 6Pxj\18\80âh \ 3·\9eÈÌQÆl0
+Ö0¸áÅËI}Lr\96\9fB\bf=Öû\91;Äw\96Ò\ 3QÝn@\16\ 3K\88g     ÑL\9d\8d\96\14¥/\ 4õ#uV   ksêY%Ë\84ò\98ÝTøFwÉ\12I\a#\ 5¨,\ 1\e\8fQ[6\ 2lõX><\14§C\99\87\9b¨ q6\80OM4ot^yä\b°\7f\8d\ 5¤Æ»Æê\1e%iOë%\8e2\12#WS\81ø&x6\1c\rô\8eaü®IÄüm6\12\96Í®D3Ñ
+îð´'Þº¿uÞª\89I{zÕ\ 4W\fS\ 3\94ùIÛüÖu\85}Ý6\ 1\19Múªïò
+\88ºkc\14Óxm=\ 4\r8>"Ô#h\14ä\92Ò\bíÒ\ 5\9cz´«~\11©©36:5í\8b\90 y£×/ÚÑ{\b\9a¢\88\90\90 e½é\ 6\8e µ\r?\86\8c\ 5{z\eåob\12\7f«\9bb\fÚ\ 5\12ê\b\8bÉ:ðî¬;\84\ 6ê­\9a
+\83Îl,£¦\91¶IÄÒ\9b\981\8a\ 3\13#\1a\89½µ,3¯´§\96T;\93¨\11\89\94¦-´>ã\926²Pzý\ 1°`\9dÌw¿\18÷Ö9é\1a´»\8drä|ÕØù\8a«\13|n´aü \e6ib×Ë\9d\8bIó:Rq\15Ëg©@\ 4wrá~É#\97ÂX\87ÏL\8a        \9bßl\\99¡àm\9d5èÌ\85\8f¦®p¥,w»÷£ÊHy½_\99¿òkÊä»ÈEÀOI\85xξ\r\\85\8b\19.\92\9f\8b»cKã}Kë\97\¬]×aÉ\15£\92K^WrçϼòwHj.5¸\ 4\8b\8b\93¤HÎ~]ëOհקɻ\97V\1aÊ\90ǽF.ï\19çu®ä\97sniðÎòÞcéÂ\94úr°*\1e\97\9c'}QIÛMËy\19\83ó\8f\10\94Çbõ¯H\1dèË¿\84±¿CªÛ\8eYÿnÆ|\7fçR¶\99\16Ð\90Û&¼joOEsWµ7÷1:hÛÜÇÄ¢¿ûüp*×»*?<øí\8dS`\9b\1fNy]\10ÉôÕòXß'¨ák \9cöRoFuJ\1d\10Æ&åâi¹¾a\¦\9bê\8bU7[\97»lÝó6·|µ;\86)Û|gÉë¦toö\86Ë\1e¾\95yU»I+\9ca\1d\92op \10Âò\8d÷ù6¯Ú\13\bVÉÚ¤Ãè\1d \0\ f\95ÝûM¢WI\14M\ e%¼I\8bã±´×è:à@Òä¯ú¢¼¾\95\9bèï[<ª´\8a^9vs\19ä\8f\1cO`ΤÎܽM\18ȸuÚt´i\01\8a\8dg\89ö\8c'-³\9a_Ê(¿\849\ 2p\8eñË[s õÐ×\f\8d\8a6òjú2G¦éÄ\fº_{^óüߨ´nOd      ­\86Íéô\ fÇí%"×Èû­¤\ 2Û¼Jªsêâ[\fÆÓܹÍ\94t<¾Ñ4¾!³'ÒÎ\92´ÙwF¬íây_$¼\12\9c½Pb²²üZöðë\89ɱ"å\8eï}>\0ir1æÊ>]Ä\15þõ#®]r]÷Ѳk\9e)½Y!uÖ\ 5ÄgØõ\8b°¦îSú5ë\17!ÍöF·/¼Ñã\11eA\f\11eª#ÊP¯\8f×Â!QÚiÙóé\16i¿F»Á§[YGXÝ@§¼*í\rï:òy§\ eÐÎJÆ\9eÇ¥²è×\ 2\86KeÉ\1f\96\84% zÀÎû\ 3δ½Æ\9aÁ1_GI\11}±O<'ßËbðCÞDL\8c4\ e\9bw\894C\b`=\86?\97Géõ\81"+Iõ\a\8d\80"\1a\80u\1dUëÙoþ\ f)\fî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\93ã¶\11½çW¨r1U^ÑÄ7¸k§Ê[¶SIù\90\96I\\94Ä\9de\15%\8e\89÷ק\ 1\90\ 4(\80\10\9d±/#\12\ 4\81F³ñúu£g\91¥Y¶xXè\9f¿.ÞÞ}õC¾@(ÍÙâîý\82\94\8b\15\97©À\8b»ïþ\95ü£]²,iô\9f÷éòßw\7f_|\7f§ß"ö-.R\86Fo-1O\9aj³Ä2ù°Ä"¹Ç\9c/)ÇI¹\\11\86\92º0¿Ûêpz8\15\ fuUì?ê6\9c\1c[¸yhê¢-Õ|_ýÀìLHæ)¡\8bLϲ5\8f]AÒLv\ fï\13ïe\9a2Ö=-Þ,W\88ódã\r\81xJq?ÆÒ<¦ö±LIÞ?Å\ø\ 2\92\14\91ÛÉ·\ eÉG¸\95o\85I\9e\8b\ 1j\92O\17c­Å\10!5±\14»b\10L\95B\18|dd>r\96\1cÊÝJ[Ì\8aP\9e\82Y!\9aRª_yl»>¿.\19M\8aºÚ\16¯T\ 3|\91ÊXƺ8\1c\vÓg×\1c\8e\8eL'\v\98\ eJª½2¼_\95Å\95í¡H\97+\96ñä\9f§²\e\v\f®l+\98\93\9eæÉV\r \85Ì\8c|Ìèÿp¨\9a\9d\12\ 5ÆÛv¿my¬6MÝ\98;X]µÚ\95\eÝ"ô²U÷¢6\17?\96»]a\1e\91\94¼ö\15-\94©­0|\ e6ý¥ò[\e\fÆ!\83\91iί7\18>2\18>a0Ì\15C\88ä\eo(\9c¥8¿\81\18Þ¾\15)ï·å\7füÅg)ÇaEÒÑ\9eÊð¬1üÕ³4£Ïö\rb\8bÿù\ 6\8bÿùI\8b÷\85\93"\8a¨Ø\8eýl\88\1f\1eãõ\84ÿë¼&¢y*\90îù#`\ 1¦4Ù\9eô\ 5³È$\152õO]\bë:n\9aÝc]\1e\8b}cî\15Ü©ßǶQ°fðÒ¼~\ fPc\1eî\9b£ÆG=\80êö¡\9ba_Ö¦u§\86\13\0\7f\97\ 3w\ 6\8e7
+aOÇc¥¡SÃ\19S°§uÁ\9do\85ÕB\8d2~ò\14\99\ 1\98ã<ï=\ 2\1e Ñ /¬`]Õ][ýE\ 5+®6ÅǪÙ\a<>ÅJ©fØÿyÖ\93§ùEëéßþÍÿô\995M\7fê<={s4/åsç\8dKí[\9c\82J1~\97\ 4ßý&4-%\93Ëå\96\9bÜ/\a2\97¥tñß\ 5\85\86`\8fÐ\14±ÅÎ60®\90»^¼szâî\ 15=¥\12¸o\bôäDIàô4\rnO\99R1\9a½k°³¿½[P©\96·BR(õ«uü­6´á}q<6\1d\83P;íC©ø\ 4XÞáTkKcÀb\8ac¹7í¤£\11BíÁcO À©WÝE±ÝVGË\14\183[I÷)÷\87n* 1\9bêP\98\99\85öü\9aï ¡@ÃÙ`uG\ 5`O¨wÊm©ñà¨$\13\9c \ fð\95¶Ü\15\17´Â>Ñ\9b¸iAb÷\81i.Ûå\8af\19\80\1a\88\ f\887Ú~Ðï\17E\84\1aP\0E¹B$Ýý±h\9bºô)\90\1a\14H¼C¨´ê\80 \ f\b\0R´ßv\97\95R\10\95.OR­{ÓZ\1e`=¦éþþPí\0\0þl\9e\14µþ\18z°£&jz\90¢.\81ÀÑ\&ßo\15Tdc5Q>¬Çój¿©´\8aEr,ê]w¥åǬ7\10sÓË\ f\1döða\ e\87¢­\9a\1e\99\f\r,Ì-3½¶å\98\ eV¦Ù¡\83Ujv\1e²;\ f¤Ã`Ù½sÐÆ@a\ 5\10-àQTåÄb\b\1e\11Ø\ 2\98Ñ4×/¾«\94[8ßó\84\9c{9qÎÃ\1cè!°%{\10À!ü\18xD\aðù(¸\19|5èµR\ 6\ 4Ûê\83\ f\9d\0Ú=\8d+|.\91¥\82^\b¢\ 67³ö¤ÈS9\8dÙ0ö@37\ 1Ü\1d¨ÄäÄùäÄÔ"/\18&\a\ e÷í\12Â\9eZ\19iR7í\12~\8a\10Ë\1f\bHDÐ4­BöÕàbÈõZ\84ÅÈa1&H\934\95#Ôúî¤7\8fÙ8°¸\83¯oÁÕÅôê.{I\1cùÐ\88G\9có`¨O\9bw\13\98\17\ f\84øÂÇ\85½\97¡\98\18³ÉÉ\15!\v\99\\ 10n2þ¸\18\ví:-
+}Jf\aç¤w\v?\ 1\8f\1d$V{åw«P$£¨Ã\85ÈÖ\12÷\0u·ä«\b$aäg
+E0\9a5ðz:Úf)ÊGa®\f\87¹3\93D\9fI3¾à\ e\1e\845\13\1dw0Åé\0R¤9úC\a\90×+;f-ØË\89h\9bÉ|\9b\ 1öNç\ 5¢\842%·æ\1a_\14õ±í\bͦPÄ5\1c\98u9«ãÉðh¸,öEÝ<4\13qB7\87\8d\13\b\ 1À
\7fõ@ºì¿k\bô\841ɨ§iðã\ 4gö®Áήt\82|\9d\97Üå_DPÅ¿È4ÿBJãî\9b\13\ 4\f¢b>'\83Âóiâ\ 5\1a\90\93Ä+·^FQbpE³\98\aµÉê\98õƽË:ð&Îçn¸§ùæ'\ 3ÜMØÄ%Má\88¦Èõþ\7fÆË1=\89|\16b_ ¹\1d3$Êv¯$\ f\ 4È\83\10\86P\ eù\9f\8e?ìvå¶*\8e£HW¥\9etVÞ \90ÍÄ\8b`&~\14zM¢\95\91ÁA+É\94Û\b`\90\ 4\8f \\f2\r\81\9e0&\eõ4\r\ 1´²³w\rvö0ZQp\97ðëF\8b\99:E\0n\1eA+1zq2ZDò\1c¬úc\9eîwë\99\13EÖÉ\ 6Ákx\1a\0/\8b\\fçÉ»2äÚ\b\8f\85\8bÙ¥p1Fæ\19\89lûó\bi¼í奣¾³³\8a|$5\93N\14\ 1;%\16E\90X\88\98E³÷\92ßd     \9b\0±Êã\13³Y«÷Õ®\ 1%\e\85\9aQ\ 4û\9c\ e*´l>ob\7fÙ\ e\99ì \93ÓT\\1dvQ\95P%öD]eøTºP'Ú\ 4±D\86h"c®\8aõº*vM \91.í9Gp\97ÑK¹\91ÁGnby\8c\96
+a#Y\90\81ýlC)|\16KáóéÝ\ 1qþ%\ab<ñXa\84½È\92\1d+{£\12»@ßOû_N¡}Fa\9fñø>CYL\f9½Ëà\82Ä-\86y9\8a\91\ 2òY\13G×ÿ
+\80\15áä¡->VÀ\1d¨ &e#Øà7áÒdYWRfÉ·:¨±|ã\95ï\8c 8ÏHÔ\e¡ix¸¨14Wc\81©qJóOTøx§\f\ai\13\98\8cɨ\bâ¥0ùIDz\e:1ëí¥;j\fð"F¬5ß6\ 4xN_D"¾È#Å\14X(¬Ù\92b*tE\8aOuÕ\ 3\8e\1dªÛ5\ 4\98hÔÓ4ø¤Ø\99½k°³\87I1ËòÁ\1d¶Í#@\1føÐCeÎ\8dÁ÷i\82Ì&     ²ÂB:\1ae:\9c\8f3d\1efÈÃÞ\ e2äáið\\ 5\8f\8eUT}SðX\ 5]ÈG¡O\89ùÆû«\97\80{\96\94E\8f\9biÄxET\1c:\8fG\ 1\rÂsó\1d\834Á¼\83¼Í\12ó3Ô$¹ëa\9bÇÇ\93æxþç#Ò\96sÅ0îSåÃs\14ùÆ\98\95Îê)ýi'\18;ÚÉeú\99³G×®3fjq|\ eF*C±ÅÍN{\9e¸°ðYÔïÕ°ú$\11G*Ô¾2ÔaT(/mPÙ$y>tµ\93Î!\93:8¡Ü=XÊBÇ#ýgøÚäÒ\ 3A\83T\93>OÖ\7fsÅQȼáë\8eBÐK\1c\85\90\14O(0¼¤\94Hu¥xÉc í´AÜpíÁ²Ú\15\14^\89\9eûü\ e?ÿmöĵŵóꬷ¡\98\88Ì\12¼\98ä\8e\80\ f]\»\1e/í¬úü¹¾Í-J|ßÄOV9ÒîJ\vª\93ò0Ûɯ\7f Â~\95gPkà4«_í_üW©Í<eæ\A3\v\9fU°,\15/Xx=\7f\15ª¢Q×-«ZÅ®X1\10ác\9bï\v%\ 3sz\rKrä\b&'\87ê¨&´±E$!\8b\14\8fz\9aDQ¸P5là-î\81§©*Ö>i\fL\ eióu³\86ûMÓ*:\96a§z2CçÅÛÐF\ 2\94\f\11'\ 5óµqR~a3Fªô×tú2X\v'cåØìÌ\92H¸ :H\18\86-yèv\8bæ¨þhTzÃý\16ZªtrǶ\14\ 3ôëÕÈCÛ¡T\15ʦ\90+ÏU\95\92\93¦«ºÒ\8dÇV\95½>öÕ«¶¤£l?öÿ¡tØÔ§Cóªëa²Æ¦4Äþ\a\80*y\1eJfÍy¬iTÿ¥5Y7Î)ìf'\97Ä!& Õx¨v÷ÐÔÜ\aúÁxn\1eÉÜûi$;ow?Ìûö\ e>\e\0Ø9Wå\15J[y'þ\9fþ\ f\82&>[
+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\8fÛ8\12¾ï¯Ð\9eFÆÆ\1añM%\98\ 12\99Í\0\8bA\10Lú¶½\aÅV:\ 2l«#ËÙt~ýT\91\14E[\94úÝ\93ì^\9a2\9fŪb=>²\93<Ëóä"1ÅoÉ/g?¾f     !Y!\92³\ f  ×\19gÉRêLÑäì×\7f§¿ÖÛfßµu¹m\16KFtÚ´¥ý¨7¶<[è<­\9a¶Ú\9a\ 6\95\9e§+\1crèºúó\82Ê´9_Ø\86uUÛ!ëC\85\1fEúªlË÷õ®®Ú:[,9£éïnö˶Á±\9f\17\82§å³Å\7fÎþ\95,\89Ê\84\80\82g\9c\eâêuµ[P\95
+\87Q\91\9a\9f\ eÕfc¾%¬º±\1f¿WÛ­k§\19\7f¶XÒ¢HÏ©\14\v.IZÙ Úú\12\1a\14l³+;×ÛÖT­\9dfÕl/7UW}ýZfH×\8f¯ÉÀ¿<YR \8f\18òÎ\16\ 5÷\9c¡\85LYF$~!\8f\f3°Ò0\ 3ë\ 2f\9c/ÌÔÉ?Ï\8c\80\8aa\ 1Ê\81v
+LÈ\81\19Ê,ó®.w\8d¥$\90\19¡@\ fö8Om³\b\ 4\8d¬´­¥ÛE\9e¨¬PØ(3\82|ÎTa:ìF\93\8bL¯¾\1dä;3ý\8bÈhÊg)\93®õý\882\8eå5\94ñG¤¬\1fú%Â3)î@Y Z\98I»é÷\87Õ\82\17éj!àhí÷u³CeÑ2­w#ªð !Ë\82sñÇhnBQbvò®Üà9ÌYºúX\8d7\99£~ÝN3ø0\c9ì\92J5Z\ 1i¡·äãÝW¸©\ e\ 5Ì*2ª\86\15.\8d\10Z˱\ 6År\ 1Ò\18±\8deºWÛ1Í$ÏzîSÛ(\83F\92ѵ¾\89I\8eö\13W\96\88^\80<.À\ 2\1d°\1ei¡Ìr}w«ÀÇ|\13S\1aþb±$Rö\12fGûÕý~ûcÀÃc \95kýûx,\9cÐ\9eþ<"8®<«N©+²\9cÜ\9f-QuÒ×±\85Ý\8c-÷á\8a\9aäÊ\92i\9a       \1d\1a\88A§A\9d\ f;(á÷§C¹\89)\94Ò\83B}\19\11\e\8eT[ÄU{l\94ú\16tý°þË\ 5å)øj iÓ´xÐʱ$`\v÷\17âM­ÎÓëö´\14\85ç\97      \87(\91¸\98   8LýÛ\16ÅÚ\98?\1f\8e\ 2\88\90I\107\10تÌqB\1cö[[~­+\eÜ\94\e\eòøXÉ\ 4\99ýÄ@Hû@¨\89ÙA"E¦È\83\19Bvd\bE/û}m£µ\8fc\rYR\88|\14²E:¶|ç\8a\87{òý\9dZ3\15q\16Ð\9f\15·\8b\87\96\94\92ô\1fã­\82Ã\97\8fäÏÄ\ 3\19îo@\94\ få\98î(Jv*J:!Jõ¿\11\9a|\ f¢¼v\7fNL¦\18;oð+ú!lÌ´bé,ç·R¬\17\83SK\1880\8d^\90¡l\r\91\98fk
+\81Lm²{\8aé\12Ô°ôs½ï\ãºÚl*[[[\7fÖtÕÞ\ e é¦´M«f·Ú\1c0ñª0:\ 1Ãt\9e¾i:\v\83\98\ e\88;|¬ì\9cåû÷CËþ\ 3B\1fegRr\ 4\ 4\ 2¼\ 2¼+\95yú¡ì:ì-Iº¯.\ e\bbÈ´«\90\ 6Å\10ó`à\88ëuc{ï\fR\0}ÛÊ\ 4þø9 ,õó±à@rÞ\aÏFl\93\8f¾\1a\89¤\18Ò\91z{¹Aä%\92B\12u¼<\v\ f\91§-b!`h?ý×\bå>>¸öü]E\16&ÅìÂêxá#=ô.(\80f SNþ\9b\95\83#¡Tã\91Ø\ 6\150§N6É» 'u\rÌöÔ\18òõ\15±\9e
+\95<ìi*Â\9e\1a\93\9epõ¾Â¯\ e\87ÅázT\90\8cÛÃôrÐY8\ 2Ûj¿wßëÚ\95Õ9\15jW·\95ý½ù¡Ú_¶\16\8d\18'      4/2)ÿ/Bóg\16·\ 3NT»µcÚ§Cå,\8cF3dãs-P\99ÃóoÑJ\18Vµ}\b[íÁ\18\94ÛÞ\ 6x\8cÑ}ízôrU¢\8006_mJ\10ª    "|/_\r\8adQÁ78\90*i,LmÌ\8dR`yÚjë¾[\98£Ý»\1f¥ëÝy¼\12*\8d*@yØÕ«º³P©Æ´Ìt]Û\15Tº©·5R\8eßç\96\ 4öØÙM×M9\ 1âî«m½ÜV]\e3%*ÏèÍÀ\8c\ 5âÇ$­Ö¶Äý`éL-~®\90Ãh²9Ëmòb\10çýaµêµÚökv\16z6 ï\ 5JF\eÉð\9c\1dáÅ8Ϻ¶\83^\95\a;?\8eºzn÷ªdÆH¸×jµ2Ë @/\f\88\ 3\1f\87ݪ.;§\14pÎVõÞµ\9f\e\8a\8cè×\16\8d\87|\r¦q\96h\1a\7f~Û6\97\88\13¥Í¾þj÷'¤Æ\84NMÁË\84\ 3Éà\93\19cx\9cgàåÀÅÌ\83¸w\83JÙ,T
+ÖZô\92?ì@\1f\ 5\88f\f\9aV¶!\ 2\9a\92\9cg\84M"\13pÞsæ\91$\98o\1dIt3¥OB\9c«\91UAO,§á\11\9eÉ\19xd\0¬ \ 6)\bMßU\11ôWÂg\11*Ù_\9e\ f>)º\ 5ª\10\88j\fú\89Y§T<)[®blaú±ñ¢g\16ßC\93\bÅ4¶\96#¹Sa[\10\14\v¼øIàU\84|&ü\14ºÊMò}'è\8a)\9aYäêÝáÒÝÖíL,sJ\16\f\98A.\81\86\9ef9Ún>·W\1fè\EtÊ\9b\15d;G㻯\11Jczð@\8c\81\9b¤ätz­\a\84\e\9c\rÁÎ"ýy´\10\85p\86\9b\19»rS\1d/4ÒJö ðé´:ëá0FîÞtÖ\e´\9fÝ5(n02\89ç\0&_²\18|\10H_Øèz°wçT\91±]Ì\87\93¿\8b\1d;\9f\93à<>K\81
+g»mÇ\93\ 4,qW2\90­M±\9eÓ\8c\90o\ 5±»½\85Ö\ 3;\87Ô+Ìå9&\8dàí\ 6Å\1d²$\r\89
+,\9aQ\8a\97\11\f§Ü&\ 4b;.}\85MT`N:ÌÙ\ f)@ä2ô¡GvIqX\97Pw±á¯êe\1eG¨!Â\9137u>¨¡*\1fó\88\95Ï«\9d\9aS»YWE¾\9düéÖ®êÞ
+\ 2q/\9e\90AA\18-2&æ\14Ä\ f¹\9b\82\90GP\101H1® Ô;\9d\88\87÷\aÎS2L"\8fîîÞ.¦\1d\1e¤\81\ 6\ 5øØOÿü'\9b¤m˱cdà6{}ú\10QE¯l×\1f\81\171«éC\85)\ ey\9cf\euÚý\1e.b8\8d
+<\a8Î?êýaÓ\95ýíÖ\ 6\9f/\8dV\ 4\15¨F4côÞ±â¬s¤³±\9e¾),÷\0ÎûK\f\8e5\99y¦'ôGã!ë\9b\1f\1då\9f¶dGô\1d\85\17¹òôÍÚ1u\ f\8c\1f\ e\11K\fØ6aÈ\10\84Áë\bÎr|E·M\10\bÂ\14ÍUô\86,\fæú!\1c\9d°·ch»`):\85Y2\14È\1c),·w¡\9e\14\96k´ö3¤ø!'¤\10\83,õÄ̧\0\86\12\17\13\81¼\83î¹d\98\ 5à\b\83¹@\ 4Û\96øÔнêsOòàÔþпÊC¨~\ 2\7f\rø+\17\ 2AÔ1ª\8a\r\\ 4¨ª«\88ô\94Ôú"ßÓV\8cñ×`uW1¬n¼Öx÷Ú a\13@\rã\ 2\81\1a=\rÔØw\80Á,\10$\8f³\84 ;~\8c\17mó0\8d\1eü\88AiP\9aQ\94\ 6\e"(M¡2Ån\88\8f\80¾Æð\91ð*ä\ eÆH>EØýh¯¡Tï)/\91åöÝ\ 6Ç÷>.\93:\ 2§§\9eÿ\80\1d\10\8fúüg\ e\9e`qxâ~\9ecR\93õ\8c"óÁ¶\89\ 5WÜ<Æ\ 3B\11\0\11\0þxå¢6\ 2!\94\16ÇXìÍ\ 1\ eá\9f®¼®\11<0O¯ñ\1dô\1aK0\88íûºkë&\82jj´9\9ePjOV\14<ð±D\ e\87G\10mÌÇ\92ç4\1e\9511\808Ñg=>x\89¾ëñXTô]\8fWq\87`À^'Óh\86¡Úw\9cF\87\8a\14Í\92\94N\8cÍò2<qé²0\94
+ÊP·À¥+\93\94ö\15±4©\1f\ 2\9e\894I TæÓ$§\13/MÀì\9eß3Î3zü\8ap\89×\17­½\9b\88çR"ÓlH\ 6\fÏÆA=¤qÃÑ\9eÈ»É}òî|°±­K\bF3\10s㱤Ú\81\8bßÀ³ª/±·8áS\9c\92»Ðc\9fü\17¤\19Ou\8fû¸IÈÕh\e ªO\80¦\\9b\85p\e\8d\ f¡?\1de!Ü\     \v)\11E\81,¤È1Zè+¢Y\88\e¢\14>µ¼E\1a\ 2Ve\8e\16\96+l\1dha e\ 5\9f£Å\ f9¥å\96y\b}>\9f\83\88¢À \15{¿ªý\rw\13\1e_ÎC\ 4[\83¥Ã·\11+÷ÿAþ-\10b\fý¿\1d\1d]+ÛkÜqpÊ\82\a\vÀ\8fÞ\8d\89È\f\84\ 4Ú콺s    \84\ 5\8d\92Oºí\ 2\r{øo\18x-NS·Ùµ»»>¾\16_h\9aNdoN\ eÛ \82 ñã\9c\f\eT\98\93¹\8a\ 2Ë°gq\9a\11Úd-X½¯ð«ÿr\ 6áR\81¨ÓR*\89G\b7Lr·\8f¿ý    »µÏ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ä¶\11~ϯ\98<\85S^ÂÄI0\8e]åÄq*©\94+\95Ý·L\92âÎP2«fHí\1c\8e7¿>Ý8Hp\0RÒJZ9/Ò\10g£Ï¯\eX\15¤(V·+óïO«ß¿ûò{º¢\82p±zw³â\ 5Ñz\95+MJ¶z÷Ý?2NØ:§\94\89ìoÇþÔl/ÿmû®YÿóÝ_V\7f|gfó\15¥¤\92ÁìÊüÃÙ?4ûuÎË2;5·\97öÜ¿\81¯ªÈN\97»»uÎʬ?\1e\9bC\8fCt¶¯íÐ\ f\97zw¼ÜÙO\9dm2ÜìËïå¸\r+\ 4\91rU\98-þ¾Îuö\95\1d#Æ1p"æ\87ü;Z¡$Ué:ã©\920á:ÿµ<3§Je;;&`\ 3üàÌ\rÚ¬í©.\9d=α9·Û~ß{¶\1cÚüÐ\9c\8fÐF\fSs&aö*\aú\854+üy\8f¬âãÌk\92`BÉ\anDÄ0´ë=µv©¶[3\95\9d\9b\1c7LɵÐUVÛ¾Ã\9a!µ ,ü\16Ù®Ùï\eûóØìk\14\7f\e\ 4r=\r
+\96,#:*Â*7àM4_\11å\8553\99\ fss¦Eöµ¥¨\89Vb%ñ+©h\99Âõ¸Ù]}¾\1cëý¡qìðÌÉ\9d$*J¨¶¢\10fÞ®?\9bQºÌvõ\1e5\14\7f\9e\87ÎNçætò\8dçãå\8cËÛ®]k\9b\9b     \81ømÿ&û  ii@0n£·\8dµ8óÁ    Ý¬Éh}+¡\91ï9å îÔÐøW´\eÁ²®wóð\ 3·Çÿ\r\90e\r\ e
+\8d\116Ƕ?º\81\e\8dm0\9a+xæ\aùIÛ-\9cÒh\81\1e\9bÓÖqÐ4QXd×8\1eÒ\12-5`á0¼\84á¸\ 5«tfuPÑ\f©`2»é»]íÅRï\9b\19\96\12èh÷ö¿s-ÄJ\9b\86ÒÎ\19ìk¶ý®Ù0Yv­ã\89,\f/+\12:²*Ðg.\89`H>'\855÷mÝõ\91F\ 1ß©WÍ\84§
+üÔÏ\8e¾Âº\10¯ô9%ÖUvÑÚ\92(Pl×\r¬2ý!\91^\9d/\1dÈ\H\89ÂY\8b*Û®e\91Y!5¶c{Ävà¼ééή¹í"\8a©äèú'Þ¤\9a¸UáOÔà\9a»x\ 5\85ª89´\98¸£Á7²x.'\8aÏn^\91Â/ì\9c\82è\89~}×nÛÚh8èÕöÇ&ÚBU\84^ɤ\9a¸nÊFO\ 4Zi¼\8c\12\8b\88iR)Ï\8eÁ¶ÊêÚ¶¢\93H"½SÞa\8c\ 4N\9a\80WUI!Fþ° \92¾\92Ú\81/ö[\9f\9aß&\82óà«\1fÄ^éÙ{¨o\9dÓà\92\11]\85\16¸\88ü¨\8dêrÔ»6&<Ð\8fOeJYÍs\ 5¾|\7f\82-°¼\1ac\14\92Ø\83ðê\88\f^¢Gy\1c\1d\81ýhü?Ò1\ 4K911ÅæE\0àÌ\vèÎx\85£#\17?n}p\ f\19'FÌ\13\13\ 4ë\rúà\fZM\ 4\8f\1f"Z4ªÚ\0¦\90\88¶ë÷gë¬ÞÄ\84è\11ÓŨK\91B?«ôed\13®ß\ 1¿\9fSÀOW#ð»fUI´çã¯ã¹\0;}o\11qJ\12­&®/\ 6ß\ e
+0¦\f\96÷P@\81­L\83\1f/\v\v\bÊ"tZÅ\18úíg\10øáË\ 4\193µ>»_#\16ð«6!\1ahf ÀËÛ¦Á\ 5æ\88\88¥öÍ!À'¶ç\9a\0ÍFÕJbèÁ];¬Â<V1î\9b#\9c\ 1¼×Û\rê®Þ÷·u\f\93¢D©\0\98@V\ 5\ 5x\8bA>\0\84 í*fÁ\89\14°\86\92\88O\1d8\89cS\ 1\0çÕÜ!\98v\88N8O\a6èÐ)t\82Í\b\84£\9d1t\e    ó2\ 5_\18Õ\84«'!\88·\98\9cÂN\80p\r\90`
+7oOç\ 1ÿ\85¾¶\80%\87\1cÃÇ8+¡h\93³¨\87\8e¹Q\ 2\11bÂém\1c<¼Ç\84\ 2\11óɹKO*"\ fãÕ]Èlló&\1eéÍÝ4Z\11\ 2\1f\10ÿMbo"Ò\ 2L+Å\vª\96¸/ÒÊA\88¹\0ê¿]3\919\14eÏS§¢\18¯¦TM\12Ì!Ä}\9d
+¨Â\aÔ\8f\119\8aP1Õ)Zh\8cñ¡\91\e\852\7fnæü·*\11Óå\1c4X\94V\13!³il¡`×Bæx\86\9c(HVM»MCñ§õ$XT\19=I©1Í)]ÙÅdLÐtnÀÇ\1fj¿²m\84\94\7fÛ\9e\83j\805\ f\85\86\1e¦À\8dK»öí¡=7Ãa
+8ê\7fV\ 2N\83\9c\91\8a®\ ec\ 3\93hzûÕÛ`$s\1dÌ\8eÔ\18\0}Cb$¬YNFÚ\86p¤a]¸»k\18w\1fsf.\15"\17\13(\7f\ 3þÈdÜ°Ù\18\13ñã:Iƶ«$\19\9bÚÃݾÝÖöc\1f\16\97»\ e\90Ò\99T¸~\ 4\ 5\0\8ey\7f\1fÏqvÀÀ<C,
+Òê\9a![îN.J½·étçFôCôjm@Ûö¶\88Ñþ\ 4ÎÏ\aÓ\9díkNw\10éýJ§þ\9cJÀó\12¢@uO°\13\98\89\83\7f\\bv\ 2\ 2&\87\94\89ª¥`7 êÏï\914\92\18F;VÎD;dk"Ú\ 1\ f\97£\1dÎÃÞ>\11ò\98\89`sx\1f"\1c\90>)c\99¥û\ 3êgÁ¦qA\14<\15ApÜæ:`\80óU\85N:_³N\aÄ\9a\1f&z6ö÷ŵA¶wë\96²I\1d6n²CksÀ"¤·\e\93?ÏüP¶åX<ü\98Jw\86z\83ñ]°\90ñ\98²xP¦­«1r¿\86b\r\95ÝYñS"¯\82\93\bã\9axH9t)â¥SH1\14\81®çVc"¼HÏ\13sפ0J=[x
+"ü½;'\83ü°ñÚCÇ\82\93¢üÄ0/0
+\89Á\9f\81\1f\84¼äÒ}¸$*V\10ÿ\968:d\86és\ 1\91l\16÷\0G\a\9e¥D9èþ\13òí\8f\98Ò,$ÍzDÐ\89¤Y\8f\86\95Åâù\80\ 1\14Y©³oâ\b\ 10zȯ\117Vbä¼\ 3Nq^\bÁV³ií\83§ËYX§ÆÅ$X*¸óDåQ@X~¡ê\85\8a
+z2ÊÕôãk\172)\86ßE\14\80«\ 6>\80ù\8dR\18a¡6Ȭ08R\b\89¡\12\91\99Àb\88o°È\fÖdÃ\9aÃ\14     É·]\98'\1c( 9S\82\9f¤tr¸·±\80êÛ÷ïM.\17Õâ\18)L"\8d©AHz\r»ÇsÐg\10¬\11MéM|ÞB@UË\84Ï\ e
+¯O¦B%\1c(\ 4\1a6{-\8aºò\9e<\99"%,<§TÚ\9c³Dq~\1e\84!\ 1\9fåc+M\8c±ì\8b\98T=F\9bÏ^©äs\95Êð¨0þ\9e:3«Æu\9e&p`\12\9da\92ú|Lzäáx\10½dæl3a\150T/\9a\ 5\12\7fPµ8i\ e\85q_£Ù¼\98U\88ÇÁØ_\86À\1fX¿\9fZ\85®\9eQs\96\ 5þ\7få;¦H¡\8a¢\11üÓ\89Ò&\v<Á/H;Ù§hgõú>û^íäOòÙËÞH/½ÐÉ9\0qDtT!\1e\1f
\ 1\bT\0Ô ó\91\0ù\98\ 4\f¨*d¸ÿvÅ9?H*\9f\1eñÄ\e¬B¢%^A6>1SOí\17©r{ù¢nH/{!ý@1ëe\1f¤\9f+æ¤\8f÷Õò\e?YV¸\r\8eô\ fq¶ø¨çGWÎò\ 5ÑHvt¬\1d¼ºw+_\e\19Å\9a=ÄüobÊ8\96»\ 5þ\99I³¨\16¦"!K\85ªv\80\ 6t       þ;\91e\r34,.g²¬
+Kh&ųe\ 2\ f\97¶K\¤\821Óê¹\9e\87VjøÂuLt9áT÷\104\98\17\94ñ\95\ 3vT<¸rp\r©\91\15\82°p¤i\88/'\82Ý}ð»{\8c{ejª\10\98ÿá\89þÐ\1fûý¾>¶½}\ 6É     c³\95s&LV\15L\9fyÃÆ^óÝL\10XLí\1cáD²v\8e\1d\89Ú96/ÖÎq@ò¦X,>t\vÞ©Í<tÃë3¢Ê°R½XvL_üê%\12\18»¯ú[ üyЭ¦AhXÛOWA\1e'áI\8dZ\87/\92\1eR\96\11eu\13\1fSc\rè\93\86\80\ 3\f\98¸¹pÏ\8b\87\87QLéña\94ù\8a..°\11/.º±1áÙ1Ú`è\r\94%}YA_ô²B=åY _z\16¨Ç'\ 1ÇÖ\9b`¬k|ô5Ï]£\ f¯z\96Õð¹ï%Âçëk\92ÀÆ
+1C.8á¶\92I}äþÕÿ\0\8a\12´°
+endstream
+endobj
+90 0 obj
+<<
+/F1 10 0 R
+/F3 16 0 R
+/F5 22 0 R
+/F4 19 0 R
+/F9 41 0 R
+/F10 52 0 R
+/F6 25 0 R
+/F12 62 0 R
+>>
+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ÚÝ[[³Û¶\11~ï¯P\9fBM,\86¸\12pâÎ4M\9d\99N'\93Ö~«Û\f}D\9fp"\89\8e.nÝ_ß]\0$AaII>ç$\99¾Ø\87¸.v\17»ßîB\8b"/\8aÅýÂý÷íâë×_¼´\vÆr«\16¯ß-D\91\e³Xi\93\97|ñú\9b\7fdßï\97ªÈZ÷Ï»|ùÏ×\7fYüùµ\9b%\86YºÌ\15\8bg½:½\7f¿\ñ2kwMµmqÚ\17/U4Áä\ 5[\14\7f\1c\ ffC¯~Ãu\99Ìg"72\8cøè{crrÖu>[®dÁ²öphªåJ\18\9dÝ-¹Î~¬ñCeõ¡9\1c«dy[ä¥
++Àþ\f\16aeö\87d#\ edð0®\bË·»d9ÁsÝ\11´&¨-L·W\96Ì\95¹R\93\8c²yÙñé_)\8f\80\8b¼çÑJ¨ìËå\8aé²['"\81\818º¡o\96Ä6¬gFY\90Â\10·rË«ÒJ\946\17b±b2\97Òõüñí[T\19\10\9c`"óZTïñ\8be\rþWd\7f­·ÛÆ·\b8£o¬û\ 6ñ,%Ñ\14¹\95c>²bQæ¶ô"Ð
+hÈ\8dëß%\f0¹Õ\8b®\9bVH\10ñ´BÃ|>-§"çgº<â½\8c4\91Þ\98\8f7\1eé\96VÃM@\86n+ϧ\9fOõáØzÖ¡ÎÂ¥8î+¼\f}\93\13\10We^H/ \15,B\8bRÑp©\9aÿ6í\ e\19\ f2\129g½}(r¹ø÷B\ 2\1d\ 5\96È\9cmÿm@oÙb³x\15\8dã¾Ýúq&çe÷\9d\8e\83õd<Î\7fÇãL.Ëx_ÿ=ì\8bö\8b%V\8fq\8e\ f\89*\ 6¬\90\96ãÁÄÈðÙø\8e\81¾\8dg¾jªTóY$Åkî8¡\9bpÓ#å\8c\16\86¯®¿»¾6V!S\86åO;<\94\94Ùát·\94\16\8c!Øõ\1a\8c£\13£\94"»Ûc{}ð=»cíÇ¿ÉÖµ\9b°÷3únØÏÍkR³Ç¹Ìu·óßS²BO¾\\95Bf¯ê`\11´D»\15Y\ 4g¤ëÔª2äдiì;9e\1a¹\9d$ÌËÔ÷\1e«\rê7\1cöîÇ\94\ 4)Ðx=\96a¿(t5\12º\1c\84î\f»¦\f;\18-;mØËA3~\9fÎUx¹:çvÎ$\95\9bز\0\83ªÍr\ 5ÿmZ§A©S\95Åà­RJ#y½@\9b_\82\8a¾§<i!näÚø&ðèªPB)ÍÕ$\1aPúw©Ö\9b\\99O'ñü6w~\12\96\ 5\e·\82+%oÆeL\17(-\9cöµ7ñܲlÛ\1eÀâïküâ=,J½S\ 4#(\9e\98\ 1\e\94\9agµ_ÿ´\vûT÷÷M»¯¼\8f \9dëz³    t\80)ºëM\10\92\85\19\99\17úñlä3ÜÉ\0û\80¤\ f\1f\96\ eb¤(u%à\82ÛØ\14}\12tP\97¡Ã4\83\ 1\1d\88\ e\1dD`¨°Y{¿kR\ 5V¹ì.HJ\f.ÆÆVQÓVñ»\84\10\83,ì-¶ä6{Ù ªÞ¶\9e\9cõi\a\98"\85ÒÀ(;KУÑó=JÓsÇÐÜQr\98\ 4²àÞÐ\10H\15p\84\8ep}a;'\ 4\96®D\14Ì(ó¦\9fä \ e#\9b\18\81\ 5§díä­\95rà:é\98ìu\8eiìX"µ\aD¥dtå¶É&Nî       ,\895#\17\9d
+£4áEBD\r½F\ f\17@\16ÅÄ\ 5\0Ì\17Fo)\97ÖÇ9T \ 6(®¿lÛT\86
+Ñëy \14//\a\15 udUäª\1cëÈH,6ÂDZéìo§f·n0\86\1dÞô\87?\9e\8eÇÆÿ\19þÛUÇÓ¾Ú¤,Yqá HdÇ\88Ã\89Aìôá"3µ­RÀ\ 5\18·÷\9dï\b¼ÒûÎÝ\97ÔÚæF¾I\92\94\83êfî\9bÃis¬\10®À­\ 1Àêâ\96\ fÍþèÔÊù/ÅtvÂ\ eÕ¹(\1c\13B\9er\14òh\88\f\88P\13¹¬ÑSë\ا\bù{\vN\86\92ç®ä±@e|÷\1d¨¼ànåèî;;û"½oÅ`øþß¹´¥|B¼Òã\10:'\85\19ø\7f\11\99<D<OéE¢3|åÕ¬ó"\ 4\1e\ eq>W\1a\13:\9eò\ 3f\92¸ÈvíÑý%'\9d* è²¼2\87DJ\eâ\82®\9f\14¶*oËP\89\89\fÕ\vJ\92\92\7fòâ\16£\88®»÷ÁÄeî\93\1cóÐób\ 6mKÁ`\1eåtQL\103Ô»uë?¼¥\96ã`\ 2\e¨`\82\97CZìvn\84XÂô¶Íé̾>ÜÕ!Ä\89¢6p\ 21rû¦r      6\18µù¬Ú¿m0\0kê£\ f\9d\fFÍÞõ4DÊ\82åZß\8a]\83¯\ 3¬s·9­ÉT¼)\1etÉõ\9c\r\9e5ÁâA&X<©£rÑ}Ç=_<H¬\ 1ËÅ­q~\9aRîv¾2§L§v£ð\7f!\rÂe@\8aª\vù¿«7A\vªCëÿZ7\1e×\f·¥  \1du¬È\8d×ÆC\18½¯ \8eßU1|Ò\0\ 5wM½\ f8©ÚU\9bö¾\9aH\ 3\a\9a\86<0ð\1a\ f\93&x\81û9SQ\8674\10#aM=\1aé\eÒdp´{h\18v§ÓÁ\ 2\8d\8e\8aÓÁ\10\89a:XN§\83\81*6\9aùª©vm"<Á1³ýt  a9\9b\106\ 3R¯        c¯¯"ìcB\98Âìú\83\11\93\v\ 5\91©FuT\9cÊ8[ AÎåuygtÜ\9aT\ 4È\12\93vË­¶\98\9e¼x«Ë9\16^J`FVã½KÕï=;Zü "â\95p1q\14ý\11Þ\99ç\Oç'\ 4jó(?a§\121%\ 4P®úëøëÓCR\94¡Òºk       ~¨\b\9b\ 4[\9eÖÁ¸HRW\8a¦\90\10¼\1cz\8f\18!\ 3Ef*¡\7f\8e\fÆÙt+\86\f°\94\8cNR\8b! %uHÏÊ\18l\a@Ú~@=\e\16\88ìÙy%\91×^e;ec:¸c$\9aظ\98»\ 4ÿ±Á:Út]@D)ËÙ:ÎE'ù1!3z       \10hÄê\92òytvs"]h\81\ 1\8bGr>\81\rÓ\0Äí\ eͱùÐ\8c\80\1c\87Óvin\18µ¯7UÈ\1d¸\9eÏÚýºÙÕ©¢\176ÎÄtG\1egKxg&\ fõ=\1aJÜà\ eÓØ\94NÛ¡úü\91\b\1c\f\95¿\a
+Ïóö^Ĭô\ 5Ï^Ä}\9aD\9f\83oMy\10+r¦\1fÑ·¹}Âv?wé2ü\18Òe\ en\a\12C&Ç$\99\1cÎ;¬<\11ýñ¢L¢ñ\eõ\94ϽX\11ç`n\f\9e\ 4¢\15\13\81'Q\16\88ÍSH\84\1dÜD\90(4P#Kt¸ñH×\90\82§h÷®¡ß\9d\ 6O²à\88\8f#ð¤4¾Î\0k?     \9e$f\84ã\99\13àIF\91Ð/^MÇ8]L¢'øC¨_\r?Å´9\0%­¥\ 1\14v\9c\97úC3\81«\98bCÝ\95ô¯Ö\8cý+.O\"À"\16S~W\95Ô&ùàÑJ?\80HwD8ðv\90\85\916\8bQ\16²gï\ f5\89² îR3Ù\ f1x)\ 2\1es_\82W\ 6h\0§*Ï\9d*|\98©\87\12\10ø\b6\8d\17ø\90Õz\ e\80A)I\ 3\ 6Ó\13ù`\96\1e\82jÖøb È\ eí¦\rº\1aZ&N\82õb¬Ð¤êC\97é\9fÏ=%P\83\17½2  d'\92@_ú\a\10.$F<\80/!Ü\93\11'\9b\8czÿx\8e\1e\1aÌ¥ò®\ 1<L\ 1¯ì'¾\1c\90J¡­u¶Ø#\rïçß6îí\18\0\8eu\15²\v\9b\10"£ëÝ×wõºî\vþ\91\8b^W\9b\8b®\18 \ 6í\ 3\ 35\83\ f\94\10Ù\80ò¦\9e\r\8e<[h FÂ\9aàТ\91¾!õ\81Ñî¡aØ}H¼È\12bÀ2Jöq[øgWøÇÙ[\87\82LO¢õzT\88\84\e5d¬ËÏ¢å\91\12ö/tÝk\892ª¾â\82t\81=*\ 2þD`$3ÿúÀL\16ÁAëY7\17A^\0»û\1aãK\ e\80\e˹î9    \859A\90\17®ºD³ÒS\rcW%ú©\19\ e\11ùáhIçæ\13\19Á\ 1\ 6{ÉÎ\9e\ 3À÷ЩÕ$#4jm¿ò³.ðRg¨|\1e{T\ 4\13ÀnPL\10sX\84÷e\14\92\aú\89x\00\87©8B\9e
+6X\14ο%(\ 4ÔòØg¾(wù(gÞÔç!W\9fÁ}ÃU¹k\8eáYî]»í\86¢\ 1\7f\9eúT¥ÑÜ\0¢G\17={ElÂ)cçêQý\15yNB4]^kä\82)a<ât\1fM}NÌVvò\95Åyí\80x¿§/Þ\93\as"®R8N°ñ¢7\1dÖ\8c\ fË"\93»²¸øJà ¨\14\13Í_¡\97[a\12ÎSØ$Ûs\fèFp\84Þþ'¢8\v0\1cNVØëäÜ\10æ®L\80~Ì;\8d1ÓÀ;\8a\ 3\12ýñ\ 5\ epîXÀì4\v:\8dzQP\90\f\1c\9bÿ\19ħ] \86PSؾW\eZMå%Óv\9b\9aª\8bjj~)5ý\81TSvQOíoXOoSS\92\ 3\9cý&ÔtT\89\ 5ï6¨Íü»\v¥-V`pä\9f~lª}µÅ\18¡ô1\82VàÁýSÜu½\ f-]ÝM»¸@¸\87»¢Tqr\ fF\91P\94\8b¨&ð\13ùøf\1a\8bòá\85\8a;Øâ\9c°>wÂî ©\8aé¡°t\ 3üâö\ 2\16Q¿\ eþÒü¬B\81 ÔÕ×®\ 6¡¤Õ*o\ 5dòi\ 1\99¼\16\90\1dÚ]\e2Èûæ\10B¥ã±ù°T"\e\14ýY÷¶pô`Ä7v\88­ëÁñy *6\14îÙØ\10Ï÷µi\89éU=W\9b\86³®taº\0\95ü©RüNç\9a\17\1f\8f\9a\5y)â\9f*a\16\85ü©\92\90d¢Ò\9a!Ï6û\8b#   \8b}ïK§ÅtR\ f ±´½   Y       Ñý\842Íðñè\97)W½ð¶cÃÌÇ\8fT\89B)H\9c»Ú!ÈX>\f\9eF.#º\0\9f3òEsdf>õaÙ\18Æ\8f\96æÚ\17\90äiÏÝÕ$ a©?uÝs\98\b \8f\15³ Ì"\ 5\17ÌÙ£
+C>­0"\10óÃ죭«Nûpa\8c\ 3F+Ï Æøw\12¬\0\8c\0+1\8498\86uï@\7f÷?#Å\9aÏ
+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\93Û¸\11~ϯP\9eLUF4q\11Àºöa\13gSI¥6N<yÊ$U´Dϲ"\91³¤4±çק\e\0Ip\0êðh×µ/:p6úüº\81E\96fÙâ~a¾þ´øýíëïõ\82\90T\8bÅíÇ\ 5ËR¥\16«\¥\92.nßþ+y×.E\964æãcºü÷í_\16\7f¼5³Ø8+\97© þ¬ï>|¨\8a]³\1\9a'Uý±Øï+\9cûú{1ÎZ1\9e
+ºXÑ<åfVa\87\90l!S-ÍÂ)\11\v\9ejÛÿ_³}¶XÉTiÓR»\19t\98!RÂ`\b\8eØ^\8fPÂÓ\9c/¨ù\a#¾]®¨\94É]\12ÐFr\Ï®ó)BV.\16+\92J=Òõú{>N\97©T\8b¡ÿ?°\r\1dåt¹"¹\f~QJaÐs\1a\18\1c\93_H\83Ç        8*í9\11\99-´ë¬\ 3.\894g#õwËÈñ(q³C²I\86Ó\7f6²Õ\94ì©èùqÑ{§ú6¤\9b¦\9c\1e£;?%ré\8b<Ø?\e\ f\16Q80\ 5q\1d¦\91\804ÂRýkSÇóåJRF&Újl:\94/ÍRª¯gÒ1µï\ fx\96#;%@oöÊt\anÏß]¤\9a\8d\8eí\9b\19GíÜ;¡\ 4\1d6\8eüÛ®\ 4ßl}µTɶ°ß\8fKpÜe[ÝQ!צM&\9brk»uÒ\95ë¦Þ¸±\ fE»/m;\ eyUÖK*\93C½®\8a}s\ 3\1d\9a`\87\1d¼?ì÷\8d\1d\ÔŶ¹/z§\ e\ 6Ê]\1c°û\0\ 5\ fmµ+\86¨\93A\9cøß\82Ãi2\94\15\13xªÝØ@\15~o\17ï½\91ÔuP;\12~È¡!2\12Ö\94\93\91¶Á\1f©R.'»»\86qwd:    \99\9eg)³âùk¹ÛÁ     \ 5X!\83m&aUûªÍÒ\Nf¾¯\8aÀ\ 2@\98ò¥\9e\87\ 2°\ 1×ÝG\ 2=ÑúÁ8\ f5\9c\89\83\17é\ eë%×É\1aACÙuUS\97Ø\81H b64U}0ùG°¾N³¾3]®TF\93÷\87\87\a\½©­Öâºë\1fÍ\ 6 \8aØS¶¶µÁ?÷u\ 4xPÎÐi\18\95\13\ e'ËzwAmo>ñ:C$ú!ä
+E\87k{Ë®êöEm\fÁ²\0¾YòÓ¡¨\8d!Àïr[îÊ\1a\10\92ù·©"h\84bt9\83I7Á\\90tÞ+\a\15\ 1\121\18OÙÄ3y\1a\0\98\8e¡\ 3r\ 3¾\ 1ÌÄ@\f\0ê\82¥@Ñ\ 1|\8dN´wå$\86Î\1cOáÿØ\99\8b)K\85O\ 6å£û\8d:Xþì\18\16)Ò   -\13®\81\8c\ 6\8fY\ 6;jϪÀ\vF\18\a\ eâRÆ\110\8e\87\90q\fµi\ 5\96\19Ç\8f1\8e\1fgÜ°ò\87`o\8e\88qb\82¡­óZ1ÅS%|/þÝ\92\8a\ 4¼>\18á¶iÑ\16\85Nô,ÏõEª\v\9e\ 4"îK\8dÛÓ\,¹ä F2¥¬3cJÇ\9d\19v¬Í\99ÊÎöÔûÒ\84:\95 )Û®\10«(\8d$\9fyàËUî¬\ 3\93é\89EâÎsúÄ\9bre\85\r\0+e¹/ìukG\ fÌH{E¢Üew\97d\92\14\83©\r:ï,\12A< \92&æÎy>:\8eÐ\8fë1¼DÝø\80 \7f\bÅESÑ»«Ò\ 1\12D\97\8e\9c<N\8e00o\ 2f§a\85]\81\9c¶ê\ eÛ}qÓgØø-\93ǪÝ\e\ 2\8dl\ 5É\93\83å\9b\85_Ðá\90\aN\ 2ä\91\87áb%­\12ARÎNøZ\0\9c\17då'S3\8a\81j>5cgb\98ÙÌL½\b¸³k\ 2w_\1f4\ 2Ïáì 8\19;þq
+ùÕ)dÓÔ\82\8f\14¾\19-·G¶TÁ·4½h\1fh®ëʺ\17ð¤\ 6ù\80*Þ·ÅS\85fD\ 4 |ÛÖ«#4\81\9bH^Ãð×\8bð\v¸¨i\18Æü0\86_¨Æ\f÷«á\17ñ<\f¯2\ 4vA(æ\13w\9e\8f¡ø¤ò\9cÏÀãú\13Øî¯\82¿üÂSƬ\84\9e´\92\1e\15­8#Éß\ fe\a(ß"$ÎSêÇÌMµkº}ëÜñ\1a\93æ\1f]\98éó_\bÅë1\ 4CC¬TÉ¥\a*f$L.\83\r+ªµ\ 3\b9±±O@\8c\87ø\8eÉ}\9eôñݺ\ 1®Ð=\ 3ºÕ\98\12\7fÞZrÛâ\1eh/vnVc\17ò\83¨¼ì¬\8a\8d¥Ç+A$8«
+ÎÚU»j[Z\ 2\8bm_\8c(×å&`À´*á\98°ó\1a\b\ 2ã°Ö\0Y\14\ e\18k\r®!6R#0ôG\9a\86°*áíÞ7\f»{\82\82|\83Xoþ\87Æ\14k\1e«Òp]\0Ä2
+       ?6Eë\9a\f#D\ e(\ 2Y^WO £Ê\rrß[à×Þ\r\ 3Ó/Ûªég\97á\bÌ\81¬
+\8cÃ\ 6¥0ÆB$\1eÐ3\96Q;ª^;ꦶ?ë\12»\8a\1a\14ÍIq×ÔÍ\1eôén\99:E\19\15Á\87¦o½\83áTÆ1\1c©Ùº\f£)C>ºÛ\8eXQ\ 6âºf×)÷ÎVe\9e\15è'0\9fMª2\8c¨\19XO¢U\19-±0r^Q\863\15\14e\18\91¶(\83\e\ fE\19l=R\94\81P\9fM\1cd\14Ì_\ 2\9e§%\19!'%\99°À\rR=+R²SP\83\9d\15
+YPx»VÂ/\ 6¸;\1f\bÙ\ 5\85\12àÜ\80ÿ\8cii']ªç\98\99Óô\19bg\93ÒK/\vË$5W\16a¦*2\85¶$\16´¿\84IÃÊG£æds\1d\89$l°\ 4Î\92·Õº¿ùÔ&r\80µ\rå\ fhT\86s¡òc`£~EòS¬Ö:ä\7f\93r\ 5VX\ 6ï\9a\rþ×Ö Lwo\82áå      Ä\ fò3º)vÂMIîå×@c·n«GÃÀ\88B)}\8eF9\85\ 2\8eà\9dV>\9aß´d Ø\85\aÓs\a\9b«e¸hË©èmk¼\16g,¹ïS$«\19\8c&ëÆF¯¶Ùn\v\ 3\96°\11\9b\8c±Á\1f\83\95\8f\95\82{.
+\88_\9fJhOÕû&¼\85.?É@¤D\13GÒ¦\9càBÛè!< 6Z&!\10â35-ÛL¯Kùà¯û\12\b\9bT\9d\ 6̬\1co\14\e\r§W/É&uÊ\94\ f\1f}f\0\rÏ ò*ÏDòöPÿt(-m\96F6AR\ e\13M\10(\fù`YXÛ\7f\96¡\90.\14fU\99ü³.\1cR"\fùèç\15fq·4åÒV\7f(\1f.ß°­¿|3í\8fKÁÀY¹á£ð°¯ÚÚÖÞÃ`Ûsü\86m\88\ 4ñÛà\r;ÈÃó¸BÄ¿°ÜC*W\0B7½¦\987\b\1eO\ 6o0Ä\99g7ÛWº"\vq&\ 4\0\8c¸³`\93\12\83M\96æ r\9a\9a½\ 3ÌFxóKß\ 1ªTë   Ø\94d\ 6lJ«ÝØ_\15\11\8fÀк&dN+§\ 3\91É©ÌÏD¬\82p/NK\1a\rÉÒT\14²ùX,#W\aNû(&a^,G\eâ\19\1fl\b\7f\e£DpPØÿ1\8e\ 5N\91\89Tå_-«Ð£x:w
+\83þ Ë
+Ãu6Êã3^l&o¬\ 1>\ 5\82¥\ 4«\87³\82¥)׳\82\ 5\95\19\1e¥ì\8bme©\8aÉ\93Óqäçèë\9c|\ 4\10ì$\80P\98«¼\ 4@x¬\8eTáÃë´§X\V3\98'æåÀ\ fQu=\92\r\+Qe7öwU\e¿\16r^\88ñ®ü\ 4r;ö&ësdêà\10\8eO}\8a\9cfØõ\ 4|\13\80\15Y\7f\13å0M\ efûêP\83\vÙO0\9cÐî¦\ 5Âø\80Èað]R÷Í]Yw\8dmíÊ]µÚ\95û¶Z7\18º Qc(æ6\14ã\90¢\1eá\1f,\1eÝ\14\86á¦ñ²\89¥ÂÜLf\8e\b\1c\11ð³xp¡¼v¯yª\1e\83\9aJþ¦\ 1ÄðÆy¨Ê\8e@zÛ\8dûó®mp\ 1\ 5Ød@3Ð\f\11-CO\v»¾w#\9b®+ÛÇ*|îãP\1c\10I\85Ù\1fßg$÷e]¶À\bÓ\f|\rã\85Vø$Ë
+q\13(G>¢Ë/ð\94y\10\10E\0ÿ\95»\ f1\16÷)ö0mHX¢o(\a§÷ÛX5y°Õ\fùAmµ\8b\12\9cØÑCîúPY\b\87ørshÛ2b\14ùø\90ät\16eP_\b\97<_ùb¸\ 4\9a%\93Û¥"    `ÓÂÖ"\1d²e,7\16èió«j÷°­ÖÅÓX%®l\ 1ÓÚfçjɽ\15ݸÊu³sµÜ¾æ¾oúÒ¡»\18íÊû\83}¸¶w\vïKÀ¶îõY¬rhÁØíRC\144#­\91\ 1\86Éæ\1ft\81ÊâCi8RÆ\8e\819.¿bíP©        \9c\ 3U\8bù\9cFk\87\0¶òc\ 1\9b        /çÇÅ#X\90*¼~>\ 2\ 5éQ((ä¹ÅK¥\92÷\91\1c\9cæÌÄßÞ½ê\99±\13\8a\11b¸ \88=±ñ©`ã\81¿ÀKæ\17\1e@ÌUI~\ 1?\19rpHëÒÐ×\81\96`µVâû\10\1cB\98³Úßü\1fx\13\98%
+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[\93Û¶\15~ï¯Pó\12jÆB\88\v   "\9e<ÔNÒIÇÓvâíS\94\12v\8d©DnHj\9bì¯ï9\0H\ 2KH^_¦µÛ\97%\85ëÁÁwn\1fw\95\93<_Ý®ìã\8f«\17W_}¯V\94\12U¬®nV<'UµÚ\94\15\91luõíOÙ_»u\91g­ýsCÖ?_ýiõÝ\95\9dÅçY¥$\ 5\8df­Y\99én½aReímcpâWß\17ó\14Q\90¢XåvtãzÅÜKsÂ}'s\9deÐI        S¾÷Ï®\97G½ªò½½©\9bv±5SD0?bË\8aÒ\r ùJ\12%q\0\9c\86­\ 4á<\94.Ø¢"J­6Ó\0½Ø¡\9aÏ\ 6\eÈÄ\ 6L¾e\83*Ø`¯q\95Æ\f\ 6\14ZåÙ®=j÷Ö·w]MÖ\eÁòìGÓ\9f\ eCí:Z¼\80û{S\1fu³f2\e\96BnhU\12\ 1ûPA\84xGm\ 4\88\12\81°[VÊÅ^\94\93\92z\8düºØ¡$e\ 1b\90êü\ e°\96ï~ëúï¥q\0\1ceÁ)î@\8d\ eÁ\\96g\10,ÏÃ\97^\82/#¬:\ f_\8e\82¸^ý\f¶¯¤\15Fza\8a̸\9fí {ól!\95\ 4»\1a\ 5Û/V/I>n½Í\96'\8a`ûD$\ 4ó\vR\86Hx¾Þв\1cï;6Ñj4àíz¡½\8aT¥ïýýrn\897ézs§\90\1987öQ\94ðD$ý7\95à\9c2hBá\9eÖ\9a\8bÑ  {Ô\94yf\ eødÙÕº¢\99n;}¬±\81\82s1þå¤Ý\90\97uW_\9bÆèΠ\0e\9eÕ××àIZ7®>\1cÚ®^ê\1c¼?ã\1f®ôóîAªó*\87\9dÆ~«q\99ÖøE\85\17Õy\85\17èò½Â½R~9Õεz½ôÆ_\ 4\93è\8c\ 2·ºoqܽ½\8eûuQd¨zp/Ƕ\1fººÓSXÍ\89Xýk%`Û\1cO\f\9e\ 2\9eǹ!\17\84\16«Ãêu0\92ù\ eîFV\88\8c±!1\12a\17\8dt\ráÈ\8a\b\19íî\eæÝ_\­\ 44"ÚxAhiOù\97(Ü \92(Ëêf\87\91è\rB+¯²\ 3\9e\9cÚ\bvwÐ\83~xÀ\86\\85.\ eºû»úÁ¸\8e^\1fÍæ¨\87Îìlôc\18\0\8aµ\0\85û5÷ÆMºi\9b=î¿q×@%b*¸\85¡>h§wsô.´\eêæ¡&\1eqóuç«\rãÄYÑ·>ø>\98¶Áù\8af\9cp\1a¥B*ôß\9c\b¼}    \8eÜ-\0\92{ãáÙÎj\ 2^\9c=ò¬[\v\95éÁìl\86uh\9d    \ 6§Æþv   H\ 5\19\92z\92Aý¸ÞT`\14\8b\18%\10\10nÈ?\96a\ 4m/÷öôxjA\98ð\9d\7f¿<Óú¾}Ê\129{d\8a*2Åéhö²¥\18\9d|\1c²Õ¸\bàÉ_;è\94ÈÈ\r"ÐÚÅ\1e\98\ 4\8e\19C\8fw"òÌj\9f\ 3æîPé\0Áñ÷[o\ 3ð Ä»ÜÆ\19Å@àâü\92b8]*ÆÊè$;ºÃBK\ 5r4úà\ eÖë¦oÝ«\ 3 À\f\11&`^ã\8e\vX\14ê~4!%H.B\eê½\11ÀPkv0úe}Ú½ùͽÛ\ráiͼÈ\1f+n\194h\ 5ª\89c\86\8anx
+sÎ>\9a{më\91[½]\9f+F¼gb¬ð\16üÚ:\88"kÚÁ¾\95Ùì\93 Ùù$ì\1eM\1cFìÇ\91\91£\82\86úλªÆO3\r.6t­Í\18÷í0ø\917õâ@<\aà\8f'ÒýîpêÍý\12NB\91|DAgnô\ 4m\89\ 3\82ëèÌèoñv\99ÂØ\8c»óHõ     µs1ãu\9f²¬i\7fÓ$\93m5Áùñd\90}Ä(\16\0\axïÊÁ>\ e\ f %¬n\9f âAwõpê¼øA<\80_Ûm\87.\12Ý£\ 3&h\82ÊP\13þ\9eÚ/pK\ 4·}\ 4óà7\ 5_¾×ÿ4ÍÞýz4\aâ·mö\17ª\9b½v\1d§Æ=!à\1f ¢\1cÇE"åQ\19\ 5XÂ9¹\ 4\8bØ龯;\1f\19q]ì(ÃûiÁÒ¡­\ 2\81\1a÷\82\97\88³ï:¨ï\8c\1e\9c±WUV»É\13~q\90-Nì[\ fàkMÓ\e}ÔK©úÓXÔ\98\v¤Á\88¸\85SßÌ\1dxC(\14v\1dÌÑ\fµ\ 3\18lêS\17\r\99\8b¶A\r\ 6»\95¥[y±âhª©\bë"äÕZ\899'\85w\b°ìl\80\85tDBÕÊó\92\r<UæC Î\8b\18¦Q\9c\9a|Kä;Ë"\11m\8a
+³Ð\8f\99ÀòG5ÃÔ\9ftüS¨;YÇ\ 32Æ.{ôÌбs9Eïz\9aÁ7o!Õ·\13¬\a\1d\9d
+CuÆ>~\9a\87\10`\8a[g\88ÏÑÕ3¸¢\94_\80\eQåY\8d?r\f\9cfßõ¦GépíÚG\8e¶KG
+)\88â±\86c\86\ 5w\91æ\8b\12@`XÕæA\8a\88â`\98\Ü1\9dwù5á÷&Úé\e´\ 6g\16\vP²Ùµ>\15(\91\ ei\b\94\14\ eeuID\19\8a\8d.\v¹ \12z\ f\11ãbl\fÓ\e^AP)C«\7f\17f\91\v\11Q\8b-$\14¬ÊÞ «\ 2çXB=À\1c]\ 2°BgTùØA\1fÑ%ÐÄ\Ä\87'XÐn¶\1c\18\9bP(\ 5¹©ú Ó\8eÔ\815\8b\18k\18æ²·Ü¥\e\9cY\v³¾\1d\9b\13JïýA\ eî\19Æ\9dXT\0(-Ï\ 6f\0z)¢ìÑÖPþv\18ÔÆ\89xjË8pÎÎR\17\98ÓÕ\ f7ÊXVÉ#£ä\94Nao\ 1z\86¤õgË<HRÉKÌCHõ\80ßÌgv\1dË^\v\v¨´_é£\r\9f\14ëSÆ\9f%4.f\12ã)Îá\9cÿ\12ïo\r\16hH93\1cùä+¹ ¦<ëÃä»ñÍËp\E\1elAÏp¨ðË\80\9d\81\18Kd\82rÁv\150.îwb\1c¬'Âqö÷\92\98\99÷õ¿§}ÑwR,ì¹\b¾å@Bé\99\bHyÖÈë\88ì\87\83£N\87\82\1fÖ    Áó\95¾F\1c\81Ñß\9eô\19¿<®\rOæé\9fÝîtç\88\ e@'\925\98ÉÕ{p°\98T)X_»ê\ 4\9a\1d\17Ö\8d®\17ZvÈ\85\9d\86\ 1j\85BX\82\f\13\ f[ÀBï,§òrB£\95\13×±rÚ&,@\17\89/¦Õ6¥ímz\a¶â8Oxñ¾Ôþâ\11×äS\94×'_ïµ\8d'qpz=ø\19\8e3\85\97ó\v¥Ê\83K\90\7f        W$S|\r'\15ûOò5\81Á8¾f²\98\97\v\8b\81r,0\18Ç\8f¢fd2¦B\ e@Ç=_%Oú\89\1côU"\98\0Ü\1f\9ft\9b\1dÑ#\9fð\v\9dýdCý':<?`á®s_r\985\ 1ßÞé\ 32L\96\80\815ö_¶ÝÞ4¾Ó\87e$\13iÈeí¿Ô¿\9c¼\89\1ctcI      \86\1c\ 4ò\ e¾d\93\181\8d«Â|ÄüÚ.\87\8e\ 1\12°\12ó\19\,ä0W%¤9Ð+\94Â\fòÃ`Ê?]\98æ*º=¦TÌ'\832ÇÔç¹»\ 3É°öÚ0A¨ó¢,¡¶\ 2 ]©Ï]m>l'Q_ÄIlJq\96~\98  \17Ä_Èr8lîÍÈ\ f,\13\14Içêå\13õ\v\97TT\86*òèaª@·máãcp\ 2=Bbfæé¶\r$\ 4#©Cg:ªóVo¹,Èû~Z\1cDA^3\9e¤öG¹N};äc\91ðsâ+\18\ fK\84ÅdûY)ÿÜÃ\98¿¥sqlºÄg\98\ 4@½¨ÝUØh/hüy&]\92@\92\ 1ûD\ 6\9a«\8bp\82\17\b\91Ó\80Ä\ 6ùü\7f\ 2Éõ«\8b\aÝð\829\19¦L¼o\eoµ>Æp\e\12\1dL\88ZO°\17U\85Õ\8fý7\ 6ò\82|½Þ\14\92\86Ä­*\1c\ f\8a/\13mÞ×\ eÏÆ\12\85\90ãm=ÂO\839Ää#äs\871¯k\a\17,\9f¹\v0{Ï_\1aü8·ÃIo|~\ 6K\9e\9a3\9f\0÷\96Ç\14\82gú gê|\81\1eÄÙ²\1646Ù\0K\92ãr²\81\84ýL+;¶W¸O\81øìOV8\91m·øõ}@Öõ\v?$ųy­W $OT\1c¤²²\92Ù\1f\9aúÐÞF\14¼\90\f2tpÛfd\ 3\v\ 5µE 1§Ó\f·6¥È¡*\1c\902q\8d½±\89ϵMù1û]þ#\fD[ñ±Ì=¶\8f\89Ì\b \87\9f\835\82¥\e?8k'é\16\ 2O?\8c¾ÔÑ0\90Ô\8fS§Llü\9e\f\9dA$Ë+\7f\ 3\98\92\95øõãÿ)\9dÇÜ\95¥É±ræÆ>\83\84ð)é<s\85\vË\93\85\v\9d­êÓKPø[NZD\9c\ 6D6\9eý­÷^\13ÎkÜ5[\9b\96\99\936\9d³\99º\9bÿ\e/\10Faÿcx\15ix=O°/\93.¾I,M/\ 1\17ÿ'\80Ok\aÿÄÇ0\91Ú\8fn\ eéä\92\85\85ÕÎz\fV\95Öc°J\86õ\19þ\9cë3ü¥ÇÆ(T>Ôn     _\8e¹1\98Ñá3\ 5§² â\7f,_ÂoCÈXÛ£»G*J #Í\89À\ f\ 2
+\99$[\8f
+\9fdüîßÿ\9d²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Úí[[\8fÛº\11~ï¯ðéKd fÄ«¨\9e¶@\9a\9e\14i\83¢m¶@\81³ç\14Z[Ù\b\95­\8d$§ÙüúÎ\90\94D­(Û{K\93´/\96DRÔp8\97ofèELâxq¹0\97?,~wöì¥XPJR¹8{»à1Ñz±R\9a$lqöû\1f£s¦\92åOg\7f\92Æ\8b\84¤     \8eJ      K\17+J´\19òÚöËa\16E\98ZtÝßÛn>tKÂÄ"6\9d¿   ÌM'S{ïÂ\8dHû¹¯\96+¦¢¼^®\ 4×Q±Û\14ë¬Îñ)\89ÊܶÖy\99}*ª]a\9b7OªzSì\gÞ5æï÷Å\87¥äQVæ»O\196+\98Ð\8e:\8f&KdIJ\84r«xíÖè1\92rÂ\ï?'/\9bµÆ>wD\90;?\1f~sE\95\8a6\13\ eÂ`Î\ eñp´=çKË\82
+\87-V<aб¢\82\baû§k\17DJGÄ\v "\89\82Ë×_Ëú\89\ f\v\v¡\89à\8bU\9a\10EM÷ß\8a5ÊK¶­\80MTGë%\bÜ;\14\eX÷f\9fÛÖ&ß\16«mÞÖE×\7f\93\ 5\89;yéhf=Í\8aÄÈu\92¤f\0\9dÐ\9c\92\ 4\9eºþÀüq/oGggGf7b\ f«Ú»k±k\8a|;ýf"\89ì>ú\8f©¦J¢º\ 57Õ®r,ËÛ6w¢Æ\ 5\93\84Â(á\92%Q\vJ+Y\füÅ+\8bò¦hZ3\17>\19öKF£uÕ´Ù\ e9o_ Æ0\80L7E\v\13¢\89\98\0\8eubü¯)õ\f-`<Çm\8a$ÛÞ?MßMHÜÍÜf¥#iN2\84Ä\9b\8e\ eàJ`\ 3\81\1a\99\1c\94\ f1ÚÁÃJûÑ©Îõ\94rMbîF\81a\98h5(M·ìÁ1x\1f\ 1ó\ 1ö\9bû{z\aiü,kI\88N\ e-\ 5X\ eÂÙmñ*a¡mQ$ýü»²â HVÀÑóáSu  îíæÜR \9b\ eNîñ\81\81µìö\94\85\ 4½\9f# â1Q\1dù\ 4Ý\88\8c^Y\82\9aür\9f÷\1a\89-e¾Ýº[k\r\fÝ8âÃ\87\828Öz\92DS\89\93¯\18x\12n\r\0\8eYÆ2â\84sÏl?{\99ú$s"à}\19£\eÀ\17ß쯮\962\8e\0\ 3X;\ e\16fml¸\94ÖØÁµZ\8a4º4(\ 1º\8b]\9b×\1f²\12?\17\95U`K$\89;Æü8a\e\1fLKf8\9fD\17Ó9\14á\9d\bþd{½eh¢´ë\ 4\12CƵ\93\88¯ÒAóÁA¿\98¬.AÞz\0å&oR\92v¼/³\ e·\0\1eK¬á\91Öçx>\1961\9b¢Ôt0ñS"\15Ò0èö\8b  \11¨\1a\9er7\ 5È&\17èj@\90Ð\91¡\13\ 3_g\1a§_×\1aÅóÀ×}\eùzòu\87a\?*\9fÐÑó%\13\11È,\10PV5ÒáhÚïÜM³_c³áHÞ4\0\8bó\80ëÓ\83_?b³\ 2\84£Òö\84í\ 2à_ù&q\19\10üä\80Ü\vÂO×:5£ujVë\92A«Á+È¥HDÔÁ\15\r\90@\8e\\eÚ3àæ\8bl¿~w\r÷ÀÔºh®\90Ã\0s*Û\9b\ 5°ZB\12zêÞ\87%O{\92\97ÛO»KS\95\95»Ã\16\95\18\8a\fÝÐ\7fkºQÇøÃÉìÄæsØ\1c\0\18³6_\1c±ù,æ$\16ÿ·ù_²Í\1fKõÔèÏ\e\86#V_\9clõSzÔêëyÕ\13¬wMÖæ+\16°ùÐ\18´ùéQõÑóÚ#û/£Á×Iô¦ÈvSA\15lPÓ°¤¨£ö[\1f6ßzÞzëN\84­Ó\ 1F\84\9c\8eé\b\by\9a\ eaò#Yx©gã:0ò\1cc7O >Nt!\1dÄ=\f\98\87¡\0ª÷/çA<Í\ e-^Ýsñ\1eÿ\fdH\83\90a"0àtO\95Û\90^ÓA`î\88&FÒ(g¤Ññäc(g\98\9e\14\b~\17²¹¬ë\8d§Ö \1e\ 2³C^xb\83\18¡òv\86`6}õð\1c\15'qT?\ eK%Ñ\83\84\ 6\0\ 2 fj\ 1\82\18\ 1\ 4N\11 ÈC\0Ac4)%I\94E\bE6¡\r\82\98ÈW\1ctp\98Ãã¾ñ\14\89\f\eOì0Í\15x\9bݾucw¹\ 3/O\8ea\19f\19ùÐvvd%ûN\83?o¾mSEâ\eI5\1f@5ôà\9e{\vt\16¹\97K?Y\99\ e\ e\ e)\1d;¤tÄ<A\87T¥3^ëP\9a\12s.·\8cYæÑÝ\1dQÉX·ä\TùhvK\9ff·îäYOÙW\1eÞ×G\ 1J#¬`Ñ6\8a!õó¿Ô&Æ2?oG¶×÷W\0¹ð­T ·ì\833\93 ·ÑÙÄ?&(Nslñ æÏ\87ê Y\80¡}ÉNM¸\11\8fK\92ãT°¸1éÈ\1d÷¾ü)¨\ f¥QÕ4\ 1\1d\86èU«{ (?%v\8a\ 5ÇhzCV²PMC\9e\9aMOâ`6\9d\rî\80"£dôÛ\90\ 3îãã\18\15\89\85\r\ 39»©K\88\açæ4G\85\9fC\85\9fÞÎ9\8b\18ëÙâ\rfJ\f"\19ò\8e\8fd\1cå½\8c£¸£q\94Á-þ5*ob72T¬¸Q\13x~qa\930\98òÏJ°\86\ 1\ f\87N\1cà\19\16LîÌEzK&\8eáÊ!\rQü¶\1ab84µ%,\1eÌöçq£÷XäTÖl)j"l#[Ã<
+\8f|'dLÅýjvìq\99{³Z\17d\91¼K
+ü¸ª\81Åü~ÆǺs;\\ 2f\10}\11\1f\1e£ueËpuÖ\98Ì®kZq\15c\1aÍ\wU\ 3ýö¾p\9e¹Í\9b\82``%£¿îsû.t_Õ¶fgªôSé\96Þ\ ed!»ÜûÊð\ 6r¯d\19\10\ eå{Z¥£|c©ÊvYY]f[WrÌí:\9bÂâ\16\86\99ûÑA\83\84@*\v\95R7ÅÖp£\ eTýAy\95:\ 5®\1d\95Î\8b@©8Õ#¸\ 5\9b\1c\13±ø÷BÀ\18ÌIñ\ 4Т^l\87\ 6¥\88Ð\8brñÆ\eÉ\\87²#5\ 6Û]C`$ÌIG#m\83?R\9b\14«÷u×0|}88Ãñä\8c\85\86Ks\0£\19,\7fU;\86¿­ê-îÓ¾4\87µ°Da.\89Ï|3²(íõl©!ú­ê|\9bÙñ¦\84\ 1/¼Î/ìî5\97û<TEN\8c2\ e\88õl\99\8a~&\11Ç\985PóY\ 3\83\9c\0\85P\ÝlÖ ÆÓ\19ÿ½zY/8áDk\ 2\8a^l\8b6Ã4\ 1>\85j\vÔ\97ÞÿÅêÂ8\10\97\94Ù(ÅäXº ÅU¨F\ 5\as$)\0\80ö¯C\86\87Böþ\98Í´\ e\80Ñ\88\18\ 3ÔDÌ\85ì)\eÓÀÃ4Ì\1eÃ\1c×òÆoS60\14\ 4,päm\88 O\15üt\ eµâ\9e@<\1d®pci\13·!pD-\19âò\8f¡mè\vÝ\87·!\989ék¸.\157u\870\ 3½\ f\1e¡\8f\e\15\9c\9829\901ÑCd\1cÌ\98ô\16!\98\ 3­ÛTbxÐã\9ev\90Xúï\82Í\ 3Õ¶\1e\88\ fA\12í§\9eo\93ü\10èVeç\18í\91e\9eÆÖÁ¥ô\86\83K\8d[\8a\83\a\aN\8f\1ef+\a\9f5μ\ eIT\1fã\aD*\1dÒ\11ß\85RVª\97(ùÜ^Þïñô·½7°\16®à\ e×\83\eLYhÅ\94'C\rç!Ü3à"áN\\98°¡dã\90(âs9r\1fx\ 6\ 3\91Ò;ü¹¶ñ²=v®Bä*\86å\8b¯Ç\11\aePú\f\ 3Ã\9e\0Çz­0\fðb\10@úB\89\9e'ï÷î oe\87\8d=/l+!\1e\vÍ\11f\9eà3\1e'Îkw¼¸tþ\9c\82\8dâ£"Ä\ 6k(\ë¨í¨°
+9ͱ\8ad@^'&Yq1±p\ 2\1aGà±\9a\ 6ïuzCX¡!$¬L\12ª\1eVXÙXXaáF\8dtêDSõ¢\89}Ù®?\0\8f\8f\9c£Õ;Íòí`Fë\98ôè/\12Þ¿P$5&]\80Op\95I¼µÇUW:N¢W»ªlë\1c\ 5A3/ôÄaefghúôxÓº\19ÖÕöªÌÛüÓ'×à\9dsqo9\e\13\7fS\7fÞ8r\9c`\89y\0ÆçÐ\9f\17ï_6ã#\ eõ'Á\1c\ 6\a*¬!\ fâpú93ÿc\93 \1eä\0ÅÃ\94ÍLB\98G¯JË0§"\1c0=\16ï\1d\17\v\14ë\81¯áä;\ 3ÎJ?÷\1e\84ø\\1e*¢õ6ê!\8ahOmýtcNÛ\82\17öØí&ßì×ÁR\17\8då½ð\9cü2ë\ 6ã\84°:$\1dÊ\atÀ´Ë:ûTtǦKÛÖ      
+4Ùc \10\0²\ e3\98¿þ\80\9eºt\1fî*\v\e\19\95Oö»b]´Öïi\eBbæ/wÙ&\93-é2P;ûR\10:ª¾Ö8ó\ f\85\9cK8\1a
+XC*£Ì\95j&¢\90N\80Ç-ã°1%ã@Ì;Ì|\1d*     ðÃ\89Q©bâçE¥\ 4»\1fHvJ        \86ØËuÚçÀ8\98OùãÌó4%:|×=÷ßÅ \90\9aÃêÂËÎËT¢1Â\95p"`ï(\18¾¿£\80%\12\X¾½*ªÃù}EM8\893üð¡Ø¸?ÉåÛîæ)
+:3@\82\89¤Ïë3¡#û7¸Ú\ 1L\ 6\9a\84ÿ\9a«÷mëþ÷j\e\8d\12à»m\17\8dâË\b       ±q\94nµ]çQe¾Ê£«Âô\19µ\92\14°÷\14\8f\Õùºh²1½Â}\14Q;²7Åv\9bo\8a¬u\8f몮Ê2«\8bÊTÖ\0íl\ 1\89f¶Ó\10\aWÄúx=?w¼üe÷òn]çmõ+k\1eb\vûz\9f1\8eÕ¸e\9a\ 1ý"ª.\8a¼u\7f\fxO­E\80¾÷X\15Éì}\93ã?\8c\rª£Ô1¶¨mØ)\80°
+,\96\820äùnm³à¦ÕÝØÙË63¯wǵ\16T\ 3\80NñÜ\ 4n½ù\7f\99tÒñ\8bÿ\0\@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¯ÛÆ\15Þ÷W(Þ\98B-\86óä0\81\17\ 4-
+/j\17(\10%\ 6-\8d¯\a¥H\95¤ÜØ\8bþö\9e3\ fr(Rºò½N\17A\17÷\92óÐÌ\99ó>ßp\95¥Y¶º[ÙÇ\ f«?¾þú{¶"$-Äêõ»\15ËR¥V\e©Ò\9c®^\7f÷cÒ\1d\9aæI߬7\\16ÉÎÀ\93ódK¥XsI\13\rí<KÞ5mmì$hìË
+_HR\95k*\93\ f\92¦\r\83Æ=_\1dMßë¶K×\e%Uòâ®ò\ 3»¦~×65þ²/\9f­7"\13\89©Ý\82e×·eß7¶[âú?½þË*[m\bO9·\14ï\1a\aü§Û;]\7f\eFyÒ\9aî¸Þ`o\8f\842*\92Ò=ö'í^\ eºoÍ\ ew~¯q寿/FÞ\10¥R
+{á&{Óõ¦îý¤\88\81\9c¦\9cùI\87r¾F\91òÂ\ fëµÈ\92\7f\9dÌ\87²Òu\ f\87g\A»¬÷H\1d/\90à¾]Ã\v\10lwZm¨ÈRBÝq\85]¥´|c \12¤§ý\80¬\87u¡ó\9c4Y¤Äoý-\1e\97&§Ú2\808f5Uo\9b\196%ðÎl©Èw¥í%ER=ÕHíZ°\ 4)þä»·Ûª±lÝAï\13·Þ^W\95vkyÞf\13Þ>s§±\14E¢³ÛKà\81®Ü\9bU>\99\ 4q\19ßÝë¦Õ\a;;\a.én§Ý\80?P\8eêx(+Ó;5UER\82\9a\93×k\95%e\8d\1aéV\95É»\12\16óïucRKÛ\8b×`\1a+®P\9a\eB%\8a\rI|iI\93,éôÝÉ*<\93|\\ 2Þ\ fÀÇÆÏñúÖu~ì\14^öÚ\89\r^u¥\ fÚÙ\98q?Cî\95np×tf¿\aù\97nh»-«\8dc\1eÉS!bîÝé·-LãÈt\8d\ 4\12®ÌÁôö\9d \rY\95\90\91:f NA)þ6Ó\18\95Ê ËO\9e9»÷â7Ö\8aa§¾\1c$\84M<°\ 2Õq;VOË\1aæv\9e\80]Uv\9dÙ\95\8e4ÔôÁ³À¨ç\95ÿ)ê\80·î\rÉÀ\1dñ©\8d\83e\9cú\1eµ\91'%ª³(ð7\9d³£"éʶ¬koHeU=m,e»]Ó¶^waÀÔ{ §7Ïp\ 1\9eô'd4z,S:s¬Á\99x[Üy_\86\e\ 6kmÍÝ&ö@Î$ÁÕue\90)j¦È\93­_\8a\91à:Iâ\87,Ù¸\9fPIå\9f\9dÞk$JÊd×ê½)\ f\8d\11\9bì¼\ f¦:\1d\8f ~®½k\ eGsêÝîh(sÿ\18\8c\bÌu×T^ï­ÂàKP\184¢:\98áÁ\198êeã\86"\ 1 ç8[¤Õ õízÉ\92
+\10¥%ã\15\90mWmj<\1dH]Q\b\1c½\7f;¡ÃW\f\96ê\8d#\13{;}0\eçH\1a7¾M\9cÖ\8aQk)\13\83Rorpwv\ e\8f\14\9f§\94û)of+äi\91\ f\9eòü§"¥Â\ fþ¼ôK9úX\ 2âÛϬ
+^X0«íÚ\1d\f\83\96}A·iÏ_\8137Mk¼ß/\8aTÒX\8cǶ9\82ë\8b<\1cð>/lxe\8a ÓÑV+Tf£UkÞ\9e¬¸¤\15\17ô\86AýÖÉ¡\9a\19KeJT \99ærv¨<ÍÂøÆê\90\95$®ï´\b(êtÝù¾c«w¦Ã)ît\9c¥TƧ\83\f¢ò>Ý\a\10T/\8cGµùd@e\W×@(ÿÆ\11CFb2\2%Î\1a¿\8b~\86+1\99°\94å\91rN#4£0\8a\91\96¤9³+ü½v\91ÎÇb\bb\10`\9dé\10\15ë$\8e7syÓbÈ\e\16Ô\95£\e\1f\94U]PVñ`eå×\945¿EY騬çù\8cJ³|P\vTÄ\X½\ 2ním\9a\1e\83\90Ï£$jPË<p.Z\1dd\8c¬\8b\k§\9d;>ZQ´®Ñ`ã®6³\ 3\8a"e!ºýâ\8fø\11Ýh8ï§\19Ã@ú"X0\9d-\b/TMÃåDuR\12\92;ÈÝN\98O\9d¯°Á\90\9b\81'\84\94\828.Ì\13µÑ\96¶K\1aS\8c\97Ù\ 1àÈ\17U\85dc@ÿ¸°-ag\92æ±²PrQ\93pá %\9f0Q\bª8Õ¤a\85ëf°x¨[7?ßV\8cJ~ýToæ\14G\v_§øãla\95ª/A0Æ\a\9açÉs|¨$s\8fçsZ$zÎìá
+u\83>ýükéÓ\9b\aë\13}¸>Ýd$\ fP§)³Øòº\9f¯Myq#³îS§Ë²\9fÇQð\94 Ç2rVgÁ\94CY\rÁT]\ e¦,-\8a\15ÆI\98åV0;\97ï±\ 2Jý÷Ú½`º\87Ï\85\10\v©Íý!\16ÒJ\9aÿfclAç1vÉ\1c\82zíµ¯\11YNSÅâÄ
+s=y5×ãEZ°ÏNõÎ\89æy*Ã,\fÚ\14\84«;\bø\r\16\8a¼t/ÝÉJÕ\8a\1c²V§YTa\ 6aû[7àÆ\970\17
+!uH»¯K\1f´×\1f\88dN6ö@\1c«K´1\9cS/Ø\90\ 4y\87ñå4\88ƨÎÞ\1dÀ\1f\91à\11\83D\18\b{RÊN\8eÍÜ\81Ñ\b®\1c¸\10)¿ù¼ùì¼2\95ä¾ó²{Î\9b\a\95ïËÊ\97ÜÎ\98Evcr¦dzÍA\ f\9c\85\15\8fÌÂ`\16D\8f\9b³°«áe16©â\v¤p×Cî%á>@\97\1f\12\98o±¥\7f.ìOh¼ÿ\ 2\ 5\84¦<lòÕ\9c·btõÙ<åÇx\15ų\10\94b\88ÖA\11\fJj°"\17Õ:³\87rÛÅ%\810`ï!\15\99\ 48\18\1aÂ\96ç\88Ù¸¢\14F\17ËpèoZÿb\9c\9f\ekئïuØ£vkuÖ%bW\89,-ûP\16Ï\10¾VcÁ\14P\17ýÍz#\8b"\ 6Î\ 4ú\r}8\1aD\8bxA'ð\1cÂKþÙ\1dK\88àó2\1fv$\81ó\7f\9a»\9d1Âü\98]I$¾]\10ú\10"ÉO\8e\ 4\ f\11#ÉïNµ¯é±µóп±øÙI»é\ e¼Äº\1e\88\99òHR2\99\1cÖ\16:v×\17\99\fø+Ïr\ f\ 6LA\\19\819naê\88¹x\19Ѹi\97\98\9b\ 3åA7ÿº`8\10Â8"C\16Ý\99_,¤9\18ö0ᱧÎ\97¼\12di"\88ÿ87Ë\fs\89\89S\9e \1cc\9aò#¹\9f¸eD\8d,¹Ò"\8cþä\9cÅ
+1$t\83\110\10n\1cx6ªÓ,\17£#\88u\`\91
+nec<v{×\96o\8d\8bo\99½\83b\9c,±^ÑT\14·2\1f×\8aU\ eÛ\ 1ò\87×\1a¯.\16b\9eBØà
+ñCN\ 6Îìà×ò®\ 5\88ö8j\80\13U\81\1e8²¢(Å6\ 1H\1cÐ\19ßó9\80a\16Åè[³H\93®7¢\10ÉKç\19é\14)\87ºWwå\9dn\adqo\ 2À\19]ÙÁá2e\11¼ñp\88ë\eLÉxâ\1f\ 3; %,f\8aÏ ö\16ÁS7qt®vBåz\ fe¯áÏ¢ÐØï®9\10ÄÇÖ{wó\80\13-¶¯]÷<T,\0ä\1cÒ"âR\92?Ô;\eEh\91\87L\12\98\8e°®»\84ð5\18öB\96Sù        \b­êý \18è\9b\1a/¨Hþ\ã\18\84\ 4¼\\ 4\9e\9eÂVVg\96ã\ fBz¨\vL%ÛíLæXëÉÏ\15ù\13·\9c\88Ä\82­%\ f\95\81¥±ÿ!¶Ï\16±}\84e\90Âè2\ 6Z\9el\88\vá\ 4\83-w;Émų\eS~V\8c\ 5\eÉ\95-\98£ú ÅëÍá.\89ÊÅ;\ fÁ0§¿!/S×ÓB5\1c\8fâÕ¤{8å\93bJ7vÌ\88ã\8bB\13d\925^®H>\8b:WyàÛ\90¢a#²Xh5K¥GAF_ÿøÚc\1a\ 4I~_í\ 1\ 5UÆàuK&ýr®çPI\16Q*Me>'\97\8ezqõ¤\17\7fMo/6^^Àè\86      G\9b\ 3\aÑ æ\83ê\8cö2ùæ"¶Ö\1c]yviy\96æa´¶.¬ÒΧ\82ÆA&ð,\1fp\13g`i\ 6$\ f\ 3/\1c    ú\83ÙOml\87\8d÷¾a}+<Ã÷\vÆ]ØRI\13sð·\98]ïo«)PÅ'nÓÕ\ 2\98ý\97\9f]fY/]L£\1dx裱+ÛnADrò\1f«\fáW\7f\e\96õ\97²'{\91\8d·¸OÝeµÿ\bæ­ñ\1fPl·\vÁûIúY\17hàÙ\11ó+.c~\ 4\8d`#¤ÍXì]¯)\17 »Q²¿5Ä.\1fÀ\7f«ãù\12®\89½3\\13zI\9c\1eí\aâ(\91Ë)¬g×=\8cp\91\98\14¼#R>\ 4æâ:¢g¿\97\91(ºz\8e·*\9e*ú(ÀM<\16\80¢r\0Üæuê\8dÈÍ\83ѱûÐÀA1çØ&f\ 6\19ö À\ fÚµliA²Ù]5t\8dðú\ 6qN2ù\ e&ÌGàbF¦ÂB\99\ 5+þÏ<\10\vý\8cý\ 2#ùôn@Äð\98ȧqp\1a\9aä\98
+r¶\14F\vqùçtüBâ«ùGK\11\0´\0ÿÑQ5\9dµ\1d<®ÚY8ùî\84¸   ¿ù\ e\99@ÙËgwÈç\14Sp\bâ\81\86R\86\1a»a6 ß',ù\ 5ðÊø\14lRÿgñ\97)xóø\8d¿l\84¢$X\b\85\17\8eþ·àqÑN"~l@E\91ZáR¶\7f̬\fêw\81\1fYxøÕ[\19¡Ã\ 41~'ð<\9bSÊQÁ\80ëÊE\98Cø¸\8dO"L8ò»\ 5\9c°P¿Ö}émWÕ_Òù,^A¾¹\ f<~ØMÈ\82c\9eê\99¼\ 5\b\rèÿÙz\ 5_ZÈuTàê]ÈØÀ£©Õ¿Á\91*ëT$U)ÏW\87\15\93YÊøÐQ­^\9d\14r\89\f\fWBþ'Eìî¢ãÚ-Y(n\16M;°ë÷d¹ÄG¸\93Ç\91\97\84Sô§àÄÑÕÛcK\7f´ßý\17æ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[\8fÛ¸\15~ï¯ÐÛÊHÄ\15ïd\83<´h·Ø"X\14Ùy(Ði\ve¬L\ 5ÈRjËÛd\1eúÛ{\ e©\v5\92e{Æ\99̦y\99\91ER<\97\8fçÊ(%i\1aÝFîß\9f¢ß_}ÿ\ 3\8d(%VFWï#\9e\12c¢D\19¢Ytõ\87¿ÅoòÍ&[%\\8b\98\13\91\92Õ߯þ\1cýñÊ­³Ã:
+OT\84\vÿ\92oa\99°q½\82?·U\81+¿ÿA\ ek\84&\92\9býñÕ*¡JÅ\9fü,1Ìb\94pÑÎb\93\ 3³íè[?\1aRÅ    íF·Ån_6\99\9fÃ\ 3\8e\rQ:\82\89ÒMûïd\8b\84\91TGI?c=ù\84"©iw¹\8e§l\12©æ¹\f>A\rI;Y\¯&BÐÄèn\94)=\15\ 3#ª[þ\0úäIôñ{ôÙÙox\84$Ì2ä;a\80\1aá\ 1±]É\14Ð\80\7fÞ\8fp\14\92
+\98 Q\ 2\8b©ò«VLÅ\ eJLÆõ,\8c\14QÝæÕDr4%\9c\8eá£ÆðéDóÓ\94i`AÜ\83\ fСâ¢z\9f5Má9¥T\13\ 143I\98vs7Å\f\1d\96tD¾\9f° \895§ioF\7f\96tü}\9cÁ\8dî\18øÇÌÂt\0\95lAESXdµß\18ôG\89¶¡hyHµ\82­ºñ\19Ôº    ~\83\7fÎí®\86ÝÕdw\10ª\9cn?\12\9aâÃö¯fÈcâ¤SùiFl\8c}\13[LgH3Ýî·«\84i=o\8eÀf[ú\rÐ\97×\8c\8cÏ\ 2\9a/\89M}Q±é#b\13Ƕç\8bÛ?Cçé=_\17mQÁ\88÷\1c7õ&_%\82êx]ló\ 6ý\8d \ 6^W»üv\9fWwí\8bu~[\16þq×ä»]û\9cÁS½i\7f¬\vÿ%øNqS\97u;=ß\14É&o¶ð\8e¬\12MÓø\8d\v\8a\80> ¤sÖ°ãM¹\87¯U@\ f³&®·\99\7fXçÛâ\97\95äq÷;+Ëïö·û\f\90@¯À0\82Ká)2Äv\1eÝÏ ½\8a½\ 2\86\b\8bN@\0´YÂC\0\ fJ\8c<½t_§\8e\15°?\10Ó\19\fþúï¡ÈS"Lô\9f\88)IR\ 4\95\14¸å&b\86\13\17eô3j§\9f¦ JPa\ 4\ 1s\9cËv\0\80\93źñ\8e8\15\8cwgë\ 5\9d\ 2CàB\8aFÕQïM*}      QF*b/å²X;Ië8«n0\18úW«\91\9bz×l÷MÒÆ[R£y\bTØ \9aD\9cmòjÅtÜä$\10\ 3HA\0\19)®Ð\94H\ 3Rè_(\90\86qR\18f²vÀø\99\ 6c\9dîÅÌLø&·áLÿ"\9ci\88УÝÛ\17Ãî \ 3\ 1/9¼´\ 25\8a\88Y\ 5\8fKÈK
+ÿx\83ì¡T¸`1\9e\93ºªñ\87\80 \rp¹]gþ7\8f?lë\ fÛ"oÀ\fÈ\950\161\8c\8b®;a¢Ì0Þ\84\ 6Öy»G\85¯÷\eÀ¾\1fØæ \98Wm\0¨Ñ\b\ 4\92Ç3\83a"\1cføb¶©ýÏ\ f¨^\88e\9bÌ}­©}P[ºÙxâ7HDv\a\87® -\90\ 6¬¤a,=ÎÊ豬\8cq\86$âÊ\9f\v\94Æ}3\ 6ã½cÏZ;ön.\86Uö¤Xz&\15\83\1d:#[õ\82´qUW        È\v\f¤\ f\8c'\ 2~ünÅD\³\8dËz\8bÃÓÌ-±\1cmÊÙ\817\9f\r¼é\8c?6ÝÊV$Ùôë\0k\13FD&ð1|\1c\11uì?\11\95c;\93v&òÅ\\ e­;åO\95.ÐÊ>K\ 6\ fªáþçÍ\10\7f¼\0\16\18\9d¥\90;+¿@¢>\99D=wxÒ!©¸]Ê\0\7f;9ú`\1e\18º\99\0é\9d\ 1\90Î\0°Ã\ 6 Å\809A\a\97Úû\ 6\80\8f\f\80:-ÌÉfâC*\1f\10¡Í\7fþ\11yÜ» e\ e»ç\87®\17£¬[z3¡¬\8d\95\99\r\7f~·¿Áª\8aû\83Á ø\ f\80\ 6ç.\ 4ä\\ e\ 6\97\83ODc\9aãÔ¬l§\81\röc¡!n}\9bÑè·Ã°Â/\83y7às'L\837çKH\99áZ\84LY\15p}(Z§K\1a7\8br5X/ìÇ\97\8dá¬Úøôó6ÌfÀËõã\1f\9c¬\8fÖA\ 3\13{\81\ 2Ö\ 1§\9b{*Zõ!\:õ\ 5\91x"!P@­\13­G¡x@P\ 2PÀ`]z\1eÿ:\rÖ\89ò^\99\9e\1a°\8f5\0\ 6Má_-\8fÀÈ\1cN¤ñT\9bðØ\ 6L\82«\ 2Ú\ 1ÑV|V\1eù2\8f:àñ°ézæ<\9e¡ÇÃF0àqÆ\87µI2W.ÁqPÞ\15»¦\rêmܹòàTH\8b[\1f
+E\r\9aÖ®X½\1cm\86ò\82cÊ]\1a«\8f¦±j)\8deötqòq\88C#\8e\19ìq\87óL\fãQO;Ò\8aî´âô\9b{+5£]¡\bg\8b\89\ 6ímÞÄÀQéZ\v\90Q\12Ë\1fs4äç6qrrüÇ\8eRöÇ\7fð\93!\1a5v\94\1em\ 1.ÉæaT\9aeP\9a\10\93!\8f
+uù¬x<ÉÊÝã1Påë9\1e\rÿ\ 2<\8eMÏÈ[=Ôö\9c£å³-\8fY6<æ\84\b\7f&óÂ6f\8aÞGc\8a\17f^Æ`æÅ\97J/\90\92&\82ÛÎc¼ñ\8e\ 5<Y\1aÿ{\9f5ù¶\9a¦êJb\ 3ý\94¤âí*1\9dç\17ã\9a¢<Xm×C¨ùj¦NÏ\ e7W¦+y8è|Ó\85zè³ÉNPÂ\97\85\vhA\92ëºÉ\_V1\9fï(\1aï«Ì?ø¢Þ~ÛK\9eös|\1eÔ\14.kÂò¸/£¦
+\13e\97ïxR\83\82¹\9bIºb9VãøÙ\9dm¡{$ý\94\ 1eYéê³*nò\97n¥Iñ°}Þû\b\ fë÷\8b0Íé³\8ek¦ÓÙ\82S\87â\14äme_ýÄ_j¾\93/ÍÐ\v\10ÂÐ\ e\1d¼\10Â\86\1aåÛ)]|è\1f\16\95'\f\8eâP\8fµ"ÞÕpÀ\9bz[d-$´Às\11@ÂuV8 j½Î+÷CP\9fD\v\91B\12ÝW2µÖñ\8fU]6[Pn"\94\89\92\88Ig|û¨q^á*\88+\9f\80\9d\14±ö\18}ú2ô}³Ù\95ù>\1e'\12Ä=à
+\7fÍâ
+k \182\ 6U\8c\vÞ7\1a_\18éK\88m\9fL¸>\99f]C¯ïÆ´o³²ì&äØ}­\8a»¶éæÖx\r¤\f=裠b  çC% Ûú»¬ÊÊú¶¥`ÒÅ\eíàq\1aÈðIp\88\r±×Ó\v\ 6é \86GÂMv%ÛãpÃ&\8eW©oÊ\85M\9d¶ã3\a?c\88\9e\9b\9d9\88;KR:º~åÛËmóL\ 2ú\15ënSyb\99Q}Ãi\8b\80\80\ 1Ñ`#j\17"Á½\ 3÷\97U·u\89\93\1d$!+\17ö\98\9bR\97uSwS\ré¡oujç\7fì¦\94yb&\8eC\9e
+æ£`l\9a@\90þ4±ÀÈôÎJº\87çõê%¶ e|ÓV\89¹2.Ã\18lûl\87A\19ã<®w»|ë{Ù\ ei<èØâ\ fôÃ\8c\8bø\97bÛ¸Ãä"<Ie¼÷\13Öyég´¡7>b×Ó\8fæþ\ 5L*Û±  ~áÝ}ü\8e.;\8cÏt\10ªL\ 2\14\9e\17EýÒ\9b\83Ñ¥ÁÐRè\ 3\96"¨[]ö*#jÕ\95\14\9eã-E;ð5Í;\80ëþvΡëIôH\ 2È'      àøn\14=\98/ÝÛýð­.³|©Ë<¶\85t7S\ 2Rü«\92Ú±ÝÏhËÉ¥\e\8còÐ\rÆÑy±î^
+^îh³¼oçå×t^>Í\9c\17m\17¥Æ\9fµÔÄ9E®\8416WIsýÕ\ 5HÚÓ ù\0á~Õ\90\94\ f7áìQ\90<»ð9\16Ú¢Ìø%\ 1ùÐ{\15\ f7à\ùª÷7\ 3þÍ\80ÿú\føg:/\v\17ï^´\17~¬Æ\ 6Ä386_ÀÉ<±½ü¿ð1_É¡Y¼«9J\1c\84»ðÎ\ 5^÷t_×mIî7ÿ\ 3¥'Ã\1e
+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\12\7f¿¿\82s/¡&\11J|\93ñä\1eî\92ÜôÚétRO_ê¸CK´\ fs\14é\90\94\9bËÃýí·ø\12I\13²äXVâ¶/6\ 5\80Àb?~Ø],£\ 4%It\15\99\7fÿ\8cþ~úÍ[\1aa\8c2\1e\9d^F4Ai\1aÍE\8a$\89N_ÿ\12¿Îgs\9a²øÃZ½\80§,\8bÛËfÝuyµ¬m\8f\7f\1e\7f_¬Vn0E\8cÀh\96$qé\9a\96\96E\93\1d½Tíúj\9d_\95*¯>¹1]\ 3?®ê2o\8aÙûÓ\7fEI4Ç\f1f\b¹\9eÍ\89\88\8bÆô\10\8a\ 4\89(ÂÜôýO7~ó\96÷û\98\13\94\88\19±´#\ 6;\15(Ia\ 5Ý\89fs\99\88ø\1fu\ 54c {-Ú®ÖÏ"Î/.T¾ªmǪn;Ø\82ûµ\98\ 1Aÿ¶¤â,Õó=\88"\9c É\1cIgDð\19\13$.,\19ë*·\ fm±RóU\ 1¬Zä\86n\19¿\ 3jsK\12p[S3'\14øf¹gW»\99\11   ÌSg\84Ë\ 5\f&Z\ 4EY\9aG\11WÅ¢hÛ\1cøo\7f/êÕuÞ©\vUªÎ\92\92f±{\r8`\a\rI±-\85ëè´\86¬ý¸¦èÔÂH\15\19êÞ\9c\82ÖE,E\8c\ 2\89\18øbi|÷íÏo^¿y÷\ 6\94\ 1\18û}nÿßR\14=\81ä\880½Iýo;·å.ùg\9eÙñä}\868w½\1fm'ë;3D]߯\93\17A\88Â÷~\ 2¡°ød6ÇBÄÿ\9dLC\92;g!\9bYn\93ÎQ&=é3à1!ñsk\16\18%ô`fñ\19lÁ®ó|Ç\8e6|\91wñå|\aw\ 3|\11=_nO+5²m¬KNÍ\8f!±Ó\82å\81\987V\8a!\15©\16áp\13Î^\1c2cÁPjµ\1eàTÝÌ8Ó\86Éd\12/scÏLb0Í«uQi|ê
+۹Ȼ¢r½Kåÿ\ fL«°m0!\8dó\12°Ú¾§aW#\87í­¯*5Ù\17\ 5°!^!«      ß1\98©ß7±½bÄuâ÷ûCH&d#Ò¸U\16ݨ\ 4FãááP·mÑÜ(\8b\18\v\8du\80ËæGÝ8\1c±Ç\96Årý»|¦ôÞÒ¸îàhÚ¼)Ü\9bÜ\9ek0\93\83¯z²o        Â\1eCÞMi'\88§\ 18w \ 6°y±î\94\ 1æúlö2 nT"
+
+G\ 4¢Ù>(\16й\fá\ 3ÀØÝ\0454²×¼p\16       ;\0\12Li^fúàB2\eª\13\1f®-`-ß\7f\12 \8d°½lp
+<©\9eõ\10\90\1cà\bÞkâm,áS\96\8c\16\a\9enúGGÂx¥´§r\axÝ_\95ö\85þ#sîHÊô\94Xroe\922~\15\80§Ìpo\8e¥vä¾\1c<ÝCòt\9bä÷A1ºeù;õâS\0d\ 49ú¾ÂÄ\1d\17<\1f¼/ºK^øN\81\91;7&>_`\87µ·³Ùó\80­%ÌÎó{·µó?míiÙÚùÓ¶µi´B\10#\930\91\8f\ 6l¨x4'ê(\aû}µ\95?¶[}\18+\fEÍD\b\94Ù\84fñÂ\86`6X6\91a§s_öy\95Wªhò\176ô[\ e\ 6\r"êi¬FRD2\13©±/©\18\ fp%ÏwIFN$#\90À»¼kºÃ»æ_q¨v0\96üáBµ¯Z\99îò~Î\1f)\11r¾ë\94\ e2ä~ÎÇö8\8d\18pÚá;>¾B\1dÈbîíø\1fÀ{<\86ü¾\80óx´m\1d7®þ¼máC\84i\18á?\84¥\9dÿiiOÈÒÎ\9f¶¥}¥AÚñlð¸AÚ1ö\15Ø\19pÝsöe\1fÁ\85ªS(\87­H3²¯\12°µ\19\9fT]é*\84,\9bܹ-êjQ®} ×({Ù§ò\95+e!<Ϋ\85»/\94îúOlÊZàQ\97µlJ\18\12\bõ~\8b\18Ð\96ð\rI«¾\81\ 1OdTF?\rF\12×\91Ú\91©¾6õ\r\81\910'\1d\8d´\rÃ\91)br´ºkèWïK-¨\ 4\86mßêÍ1vë\9eX·4ª]\97\9d©q¡8õLıë^Õ¥éb<V+{7\7]>\9aBUvÀ\87µn\97±}\81ÅùuSØ\9e¼´ÿOgi\12\17uS\18\ e3S8Äí\1d/\9c¡\9c\ f¯x7·º\8cS\bÙs]\9bÒ.Ìo\16\97Ï\8a\ fkåî®\8bê\93\ eàY
+íj¥`3ùjp\19®Ç(ûZ[w\9dªZU¬\Ã2p»\r$dtû-¯!Ð!\8d-¨Ñ+\ÖÍÊÕâP\92\99kÜ~+¿L\17é\r7w¥\ 1\17Ó¥\ 4¢>uö^g(\980K\1a¦Òx¹v\ f¶$§/NºeÊF\19\92í5HØc£«lÂ\9aú\a\95E\f'=\8b»¼Ô×í\8c\8cÙ¯)o몶O`ÊK¥\8d9/7²s[v»Ü\14&Xuá\12\8dx\ku¹1%\ 1B«m§nL\ 1\9bÔuO°¬nçñÙ\99r\93\92¢,Õ_Ot5\1aÕ\bQ7KW0\0c;]õ¦\aßè*)=k_.\0?L¢\b\865EéQ\88\82\18\97Ïô$U  MMc\L\91àw\15\14d\1e!+]«F²¡\81¾°\18Öæå\8d¦Ë\959,r_Üp\9d\ e\14X     tåMq6C\ eÐ\87B\15:O;'@.¶Hkq\90Y\1cdh\bÑÙ\80H]Ï\ 5`ÃDâ\15â'\95Wu j¤×æÜÕ\ 2]\ 4j\81\90\18×\8e\8c\8dCêØ\95\8d\99éµn1cY\O\19N\88.$qDLÝ\8c\ 4ÑôN7\83\8dÿbB\0ë\93\ 3h6ç\92Å?ê:\1a\9a\11\10\ eÐ\13ª¥á\83¼\ f,If\1aÛã¿Mt\ 1\b÷F\9cLw\9e î{\8bVµ]\1dà?ãúÌÞ¬\84-a\81\95hÏä\1dKM¡\ 1ìÈ\9c\86½Ö\7f§­7\v­#z÷$¸Nâ9\r\0RØY\16\ 1\80c W{º~»+´ä^\15Z·ËÌä¾®©\91ðíùe¯t\81¼ øPÞ ¾\v!DjJØÄN¬\16\9fË ±W        \e¹Å läizI^ÏxbjË´0·Ú\ 4\e\18ÒÇíÕ\94pN±1TÐ\11ß\88÷o\1fpüz2ÞOv%ûSu¡wUW!Kâ\8f-\9dc«/\9e0\82÷ñ\1fòåz ÒÜ\9e%¦ýÇÆpÈü¹D[|}\ 1\ e Ä\14,\ 3D´QÃ[Õ¶æ8\9eì\eT\8a\8e@S§B\ 3\10\93hçØA\f@2£\\1fN¡£)õ\90÷\9f@\ 4\98n¯f\1c¨Ù\ fÁ\8a@:\ 6±AÑ¡õc(6¾:I\91=<WùÇ\90ªKOÃe Q\9e¥\ fÇ¿<\10\ f¿\9dL\87L\1d\11\8dIä»\9d  æ!+î\ fä\1d±±\99b\19\9c\82>\98\ 3\ f\b\91\9f\10\a.\ 2è èq\95à"\14Ml\1c\92=X \1f\8f\ 5\820\vÈv\f\1fÐ\7fe±0\båú#\1a\19\99ïV\86Î\88Kn¤Ño\11\ 5\10\86ÈmÎ\ 1º\ 1\8cW\11\95Ôx÷®Áæ\17Æ)\1aÿ
+\85\83 Ûâ¸KíÌ¥\88ì\93ìá\h46ç\86©\95®\82g\0ÖUÒcG3\10ªc/º\97¯,cÈDB\0®\9c\9d\rE\ 4\ 3X/âç8¨Z\ 4\8e-ÿþI¨V`\13äõ'(\1dÂLÆo\91\89§³\182í¨W\81t[ê§`\ 1\1dK{\17r\8eåN    dÄ{$ïlvHÇ\8f\14\ f¾\rп\82ß\ 6¤Y\7fT}ÜþÅ\aî\93(äNÌ;DêD\93\9b\80ÝëÏ 4á:        ¦L\92
+\9aëU±ùJ\0út¾ËDÖ\94Ä6U°îT©<\ 3 z¶).\b³^º\13\9c\99¨tðí\95É\fð4¾nêëF\15þ\83ª4víyÛÖ\86\93\v\95w.\89e{|v\87\83\99m\92\v*\10(Ë^¬¿\ 6,nãB\9f\1d\q\9c\87\9c\96Í'\18¡\94\ 5Ó\ 1ÞÖ\94\ 5E}thöárdú±­mf\15\1eýÄ\ 3W*\e\84æá\\88WÿÖ\85·:i(MæTd\1aÙt\1fN\9dnÿåÿ
+Ë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\93ÛÆ\15¾çWàf°$´Ñ{w\IU6§\9c\1cR%ÏͲSà\10\1e¡ÌeÄÅ\91|ÈoÏ{\8dn\0d\83 \87\ 3R#U.\9a\99^\1e^¿å{K·\92\9cäyò\90¸\1f\7fOþ|÷õ·<¡\94X\99Üý\9cð\9c\18\93\10Í\92»¿þ\90\16\8f\8f»u±-ßN&?Þý#á\82Ø$c\8a\b7ËpðëoeK@\12#\93ÜMÎêÉ\ euErã'ߦÑVA¤ò³\1f¾\99dT©ôcD\82\1a\92³@c2É\98\1f"R,'ür.äY\ð.\17\8c¦¯"R°Êª\e²á¦E;­\89Ña\96)\1d}#£Üq\98QM\ 4\1f\87M\9d~\88ø`\94\ 4\95ý;\16RNTs\ 6&U½\80æÀ½Õõ)\84\0\16\89¶nÍ/\11\87\92P\964óµ:Ø%ê°ç\9d3:\9fm\8cm´ãÉcÇÛ·\85\ e\13T´¶ð¢¥|\9e\a\f\1e\8f]MÊ]\8f£\847\a\98ħ\a¡hÂÌ-]ê§SÊÖ\914\14Q£éZ\8f\0p}\1eE\a\8fÇN\1c\8f\9eR6=P¶>âRbl6N\88\99ÞÖ¥´}\96\15=Y̧}
+Cºî    é \eN,\1fɳ\8a\v?\88Æ1\ 5H:\94=\v¢\ 6\rþ2t\93/ÉÒ.\97îÇIÆeðÈ^\11S}&¡\ 1c\1f-\80¼P̼u\80<\82\99·\10sO\bæ¹@j#\85àËcÓ´'!WâÖaíC\9f\8a\9aã\rÃþ4\92\9bh\8d÷ê&þ\8cx5=n\9fö)'ß×\1d¿q.ð\89\8a\98aÉü\ 2\bÍ\8fû? ´d·\94Ó\93\8b^fa    æ\11\9c\b\15Ö¹FFò·»$'Â$ÿI\94"\16³x\ 3\8b\92E¢Y½Åý9O¾?l\9b\84å\16DlÚÎ\b\bU\83ÑÖ\9d\94\1e]r\94\95A\7f\86±(ø\86\r+qø8\eay\ f\eô\ 4\1ft\90\ fJ\19a¶e\84\82\19R1ÀI³al\89Pì@\89\ e'"'C"iÖ?U&`cêJaúùUº\19\ eÒæ&­\ 23ì¢æº\8d\ 2õl$\e*\8dÇ\13ðH<\fÊ7ô@±3kp3c\84\9f\ 6÷Ú£®        \ f!¤ß+äuuö¢[h\9fU\15ö)Ú*O\15ó-\9aW\ 3"ú}\88.ý× \8ck¬fpå¿ÖÅkÈ|(K7¥Û$\18Éu        \95nþ¿=\89\ 6É\81ÓfÅK¼\ 1\80(­h»\80Fô;\96è[2 Ü \89\13\10Ñq\9e\1eFj\90\10B\11\ 4à\b¤V YÙ\fÔ±ºY%(¡¶\vY 5\89I\95\93\ 4\13      ä\13º«qª:óy8å+ÞgP\96#^\ 6Ð\8eÕ`\9bÆÅ|¾Z\17\11 ÎZÇ\19Õ!A¼CxÃè\r\92\ 1ÞúÛXL\f\ 5+jt?äQq\8dÀb\88\19¬øº§;\ e\171\e\99\89\ 1\11\9f\ 5\ 2|\1f\ 4\ 2{\140.· åjY'\14\¹¼9\ 3Ð\165\12Þ\17\9b\15¬b*½_-'L§Ûu±®V¯ë±jùs±ÝVþ¯uµÙÍ·åº\9cN1MIk褠\10\8bH\0\9f\vzê<ÞÎ\89éÔM\11\0Z\8e\r\198¦E\v\ 5\ 4´õu«\1f\b\b\18\96Ù\9cèε:\0&\1a\ 6þÛO\9få\94pÙ¡\8f\1dr¬Êöé7Ë\ eèïÙ\98Ë
+9&0]\88m¡^´&ò*\8e\12Tby,07l"\ 5^QI{\:\88ø\80è\1dî\15w*?à>,\e\8bû8#>àþ\8fÑñN\9dĸØÕ\9e\84ç̵\ 3\ eN\12\96\8du\12Þ\17Ρ\90oNòÍpvÃÑñë\95ÕÜ{4úó»²ãÞ
+Ý{³-pHº!77ÿªzt\1e½Ú\96\9b
+q\9d;÷v\93ïwÕrV¹\8fK8\v\10©\a<];OW7{6r\89§»¾\84í÷tH\10°ñÂÁX¡z\ 2OçÆujü@ðô°L²ý^DëéGèc\93Cwé+§ºCúaÙ\ 1ý^\vS\97yz°0q\ 6ð¾¬ë\r\95ð\95JDú\85ß¼\8fS"\8eÛEÞ»v\ 6D\92 (×½\fUáGb»\11ý[\81¼\hÏs\17\80wÈ°Êä(ò\93ý\98\7fö¹[Þv)¿(o{!\r\99ÿ{Û'ñ¶Ã\8fX\12äp"i\11yChVø<e\17Ê\8dÅj¾­\1eçÕ}±\9cù\1a¥ÎRÊu\9d ô$\7f\10©é\80\ 3æ\18øëÙ×qêR;vû\1eö\v½Ð\7f
+õu/dÆjF>ïÕÄ\95<\90\9eº55§z\ 4Á\18\9f\1eÃ\80v\93Þ\ f\95ú궥þE=a!\9b\8bÄï°\18\12*\9d\95¨\95eµ­~\9dH\9eºF±¤P,-°~\9aVK\ fGB¦s,\91\84N\1f×å}9+ë\ 2«òdªÍîaW<Ì«bù[é\88°.~Á¶Õò\8a»\93PVÐ~\ 1ì¿\18m.4Yß\e<\1d\10\7f\81°¦Cê?\10?\r\81ò\85\87\ füè\9bG\ 6\fo¿y´ªûJÌ]ô\9eè\9eëÏ {Î\86ºçPþ\aòÅtZ\15\8bUì: µ\91\ 2È~Ñrµcö^\19\9aÁ+Cõ<pÐc\82\83~\168\9cÈN$x\99©[\9a«Í¦ò  ÊÜÿÄV   é\14\12PG\b \90Ëfã¢\1dÀ\1e)u\85\92¹  \81`\8e+\8dë\8cù\81\9e\95@Sí­¬\aº+\8dkÏt¾î\aÚ¯C\19#\f>¤Ë¤\90\84Õ\95ÈwóI&\94\85\13­Öå\ 2\8e't\9e\87]Yw\84Ëzz³-¦Õ¼ÚÜ\97õ\8aùWåû\1d\82¤H\8by¹ü­ðTÖþ\97¹_7Ûy\ 2\8br»®î\11\95=¸gÛ¨9ë\854?éÛÎ\f\r}¬@ôú\18Ľß9¸w[mÇ\88(öqë½ëj³]O\84MËí¶\8cßØ  ìGzØ\80h\10\1aë.V\94k/¾z\úFýÞ9\8chß`½é\ 1¥< =ñ\99D÷¿\ 4i\8b\8f\143&<"ÝM¬H\e5C\fÂî$éº\81íÊÜâ\eèL\ 2\vy-Äï«¢¯¡Úvã\ 6}öÍ$ÓáÊn?_j"R\9c\94êöÒ2Þ*Û\9d?\rït`ÑkWü\10,lW¼"Ìî ?\10¹I½ªÁ\90e\9e®æ+\1cÕà.\8b\ 6\ eó~t\86¦QMw\90\11\8bMU$2+³Úâ¨Î±ãÙ±¸iMwQ.·±\97\bK\9a7\8fo\99V\11úµél^-ªm±]\91I&5CÝ-ã\90e §§ýéÀÁC@{4c\ 4_l¸z\13±\84\17f\81§má,Ýæé}\ f\ 6\b×\8f<öê\1c\12g>\1cÚxë)ÓØeÛ\8aà      \84§\7f\9a0\91\ 1\9cZ\8b\9a·ÝÒÿ²Ù9m:U\97\10\ 2VËØÁ!ÜSd»£Â³\8a\96ý\8c_¶w\82Ë\9e\84_ñèNÐ\rÈYÅ»\81/.FÎ\ 6\ fl®¹í\ 5½È\89ÐÒ]\1e\80äf¨m\10Þ_\8aÝý»\8fõï=,\ 2Lió9@\88z:\84\80rÂ즬%à\7fl\1cz¸ßü\88û\eÂ\80\17£\b\11\99µälÐ5\97HL\ fIL\fIì`ç~nIÇ«\13&=>ÞÜ\1e\91ØQ©æø\1fN2ÅÑ!\#ØúÐ÷»ÿ\ 1Ø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\93ã¶\11¾çW¨r1UYÁÄ\93àº\9c\83ÇvÊñ\96ËÉNN\99\15¹³¨¢È1Imâ=ä·§\e\0Ip\bI3km\9c\$\12\0\81\1f_wc\93\924ÝÜoìß\1f6_Ý~þm¾¡\94ärsûvÃS¢õf§4ÉØæöë¿&?v[\99&­ýyK¶\7f»ýãæ\9b\15\9f¿R\19\914üê/M±Ý1Î\13sx¨Í¾ø`Ú¦\82\96T%wLÉ­P,ÁwÎ`j¦\92÷ïMñ\ 2Þ%MLãÚ\7f:\16\rv\r­]\94jN\84ÞpB¥]áßØúù·r&bÇHª6»iDéF\84d\92ToRÛy\97¬¾\17DJßû¯/¶;ªTòój
+ªIÊÇ9¶®[ÌÝ\19ÑÙØËT¶Z\832¢¨\1fð\8béË.ÓgÏà\ 1þ²¤êÜ[{ß\98ÕÜ2%¹\88o>Ø\1d£\84\8f$°õÞ(a¹ïýó\8a°\1dÏr"øfG\ 5\11ÂïñUu8\80 p8f8Ýôn\e\bØFh;>Ï\90eN\14AV²\ 4DåÐnw\ 2öR\7fVÔCWà\8bX\88\1aÙî2\99\9a¾·£\1fÓʨ$\8cÍ'Å`
+\95&¿_\91Í\ 4Ñ#cR·hå\96\83\89\9bõÄ\12\ eXÏóÒõ\ 1\81\82\8d\12P­y\98\12>òðûõ·ÊwíÛCå\88\ 1mA\8eí¸È\88ÈCî\8e¼U\14y+\80#R¤É\8f¨R(
+\1c¶k\9cd´CÕ\el\ 1\9dìM?DÈRb\16«\1fVr\ 1\8bªGr¡B\99_~È\17ê\90\8f{\1a\8aºräîñ\94ßU`\ fx\96\ 6Ò\8b}QéÍ\ 5\19YÚxá=¬\85W!\83Æ\93ÉÒõ&9áü4©)QãF<e\9dé\8fõP\8c\a \bìtç´àÓ[(×IS09yæ>\853ØQ\92¹Õ\9bµh\12\ 5+\8dý\9eOëyp|0ÏaE#\fÔó<O5\82ËS\9fXy0ÍZ\9cr2nómd\17ùB¿¨\82­¬öÀ\89TÀ®\8cÎ
\rK\8a\9f0\82Ú³ \f\86n\ eð\ e¾kz¯7¯Ñ\ 2M\83À+z\eôý\8aZ\rì\12xôØ}¿Ú¬D\92\1c½ \82\82ñäOGÓ\94\ 6½]®\9d·Ë)\18µn°\82nÝ£¤29bG\9a\94UíFx}ÆGÔgÿ}`Ûó\13ÚÁÀ\86quY?$\1eé9ý\b\ f\9e¡e\v,Ðû­\14  jõã\9920¾\19\8cÌ\b×\9fD\11ðÌ\88\aú¢\1aè|\9e\ 6ù4ÍGB\81\85\aZ/ÀG\16ü.æl3uÚQ0Dq\17°Rö©-Ñ\99\ 3\10ÿ#\a@¯y\0báKļ¸X\83¥\9cd\19\98\8eT/\90B` xÊ\88@6J\89né°á0§Õ\1a×àMÔ4L)\84à'ÄÁ~¡\89³Q_¢ÉÐ1\0\a#\ 2ÛÊ^\9e@û>F :\1d5ýÆ8T¯s\80ó\0ç$ \94f_\1fËÊ\81»Ú\82¼,)Í¡í\ 1°Y\8cöÂõ\95Åà!  ¹î\8d\81îÎT\83\9fP'\85\9b°\8c\186\95/\8e\98¹\8dE@\:\9fFJ\ 2F\ 3\9f\ 5\8cJå´\9bÃÜ\901"\85åó<\92ù\8eÌ\8dÔÞ\8eÙ\86ÈH\98\93-Fº\86p¤FÒÂÕ}üú\f\85Yjm\ 6nã;ô
+\0án·\9a&UÛUÖ7È\1c}\83t]{\84\8c=\ 4ì1eUÔ\87Ê\ 5\r\ f\ 6d/yè\8c\9d\0>{(º¡z     ®*e\89i"L×ç`>(\15\9d\ 2\1cÓ{\80Ù8È\8eÓ·\9d\1d(l
+\0~.C¿Q\1e\91º,\87\1d\í+w´}u0»C5tÆm\ ee\88\81\8c`·N\93á8\80,a8i
+7CÕ÷UóÁø}gnßÐ~¼?\16µq_Y\17\fÿí\83§¶\e\8e\8dqãúvØY2Ó\90ÀÁ4½\ 1RÀ¡ó<O~hq\ 6\96&nm\§jJÜ/Í1*q³ö\ 3¶0
+\1eq\7f´á1|ñе\ f\81´ç\89o/\8dû\a ÿPWCõá\83ïè\8fn\92\88\9c£^\8e'³Ó#0Z"u6\1aî\7f¬ýò\8cÆ×\9fÊù˿Ǿ̦/­A_{\14\93ÃÛ¾ð°\19\ 4_-¢Â²}óÆ\89\v\89\v\87ùîî</\8a®ú­k2µûoЦ´î¹«\ 6³okÿv\a\12\ 3\96¨ô¯\96íøð\80ÃáPöUy\1c\17(ú¾]\9cµó\8cõq(\ 2áASÔ\ fES\16]él\1a\8a\ fZ¯¢\ 1\89²q\14¼\1c\8a\ 14\12H)|L\v®mæD\8aª<¦J¾®î\98Ì\1aãS$RjÔaµHµä¡gQ\ 4M\81¦¨hÖ\14\0\9aÜ¿óAq\ e\9bÚ
+0ÃÍ\8aÿ\1a?|\8aG¿\81\13Ì\12\9fb(×\8e9'9\r"\84\9b\88ãLóu\84\90/\82©)\16ÃS\9cÉvG\f\f\1fìn\94ÿ2Mj¿;0)0\ e=\887\1f õ\16¸O\ 2\14\1a     \9bºZA\eë|\9f       Ð¢Ç\8c\15þ8\17\94Gç9\957óv\9dS\85îÁ®\bÒÛ\95î0%\b\92·sî\ 5Y%Qlg6ù\f\194ËØ^¨Î    Õ\9fì\-5h«ðÿØx\9aû\a{<¶18\8cðÀ\1eå\81®v\ 6 Ô\1c±G?X\a \9c!\856t\r\95kªý\7f\7fÜïÁ?\80Úù11þÉ\9c¨ì\9917?\15s\8f\ 4\16¥£ ª«ñ\b-       Q\87«Ù¼Ã¨¿e#}\93¬àL}Û´!\vDrS\1c]f\ 5\7f~\1e\9d/}\94\94ë\9cÓ\ 6¯;\f\16Ë\ 1¹µÃo,<Í"\92?\11\bn\9e\90Ü$.we±\8bËú0Ü:úÔh°¨òI\82Wûçó´c>ÆNg¥\11©\1f¥ñ\11ýíJ_Á¯æ(à\ 13\9c\ 1±Ê¶6#\ 2\84\b\ 1Ï0gm\9d\rò泥y(îïM1ø\160e#\10>ËH\ 6\9b\9a\1cq\19\11ºTÏqQ\84%t\8a\8aJï[F\84=Â1\vOV1!\95\16Ú\ 1\1f\b½°öSMDL§ò\19!^C£Î\98\8e/"_O\12\1a·:#Û\7f^Q&Iv\890\11\12æ\94=K^úx«6\87õ\82à\92Å\15Ê\ 1WJ\ 6®7\r\8e:\97ÏÚö9:/\ 4\94"åã<ß5\ eþ½®<,B\84Æ\89\1a\81_}\ 4ÈWAÔ3!;\ fì\9c\80;pçû\1eL\98XS\98XéK0pÅ}\rêY\ 4A\11öÔ\1e\11î\11W\1e\ 3\ 2\10\8b¬\82\81\85\92¡\9dâU«éÞ\ e©À\ e©¥\1dr\911X\89g\ 2E\90-Ì2\9c\ 3\8ap4`iµmy\84\14%eç\90¢z\1a@zu\ eM°0\8fü*"ÞL]B\89\13\19\16úL$/P"6\87(\11ßc(\91}Z\90¸.Ö\10N¯W¯ü8|\99Û¢\90È(\9ae\9f&\91\8e%Ô¯\9e:éú\ 6ä\90ò9\í\86bV
+àhÓbäå\ 6ù\ 2\8d{)\8bÚ=\8c\ 5'xÄb\9eï­:ãòÀn\9a\11£Är9S\85é&Z2\10s¦g* ã\94V÷©ÀX}h\ 3\14\81è&Ç*_\18\\9aXÙG\8eøâU,h\9dmpÌ\920L\9eT{ÓÏVĦæÅ\92N\18\11ë¡\1eï\8b7ÆA\9fÔ\97ó,@\81=\8c\1fÅÒ^\102§ì$ÅA\10\7f·Å<\ e\e\fN\ 3ú\è\8d\ 5¯,ä\8e-\1fXÚgl\8cp\12Ã0Û!=\88T\b"5ø\vÛ\16\ 1­Tò¹\90¹\16ì|μÖ6/¤\97×\ 2\80\82\87\97ö%NÅ0ß{-}²µ\18\91\99ËGÙ]4EóÁ¬ÔL§sV\ 5\8fÐ\1fß»ªC\13SE\8aËÀÙÔ宧,B\14¸R¾(çZÇ\10Ê°\ 3\8d\11\89EÃ(Ï   @\16Ú\85\85GÙaM+\93¡_\19õ\16B\ 4¼bqÒ\9fÀ\13\ 5\7f\9f
+ò¶*\8b\ 6\19Y\11«=\81{\9a0òù{\ 5âI÷
+nVÇ\ 3\1aÎ\ 3\10.\17eÙ%-\ 2Åý\fª¾è®d\88l\7fµû#ìbdðdt~½=\9cóK;\9eæ(l\81Ì=çV\91\84°D»xæuuosÃ\1a\1dÕ¡*'ðæ3»\9a9w\84\ 3Æz©vîÈ*|\9a¼¶·6Ü\fÍÛb°\81·\8eÆþhg§Zóub\7fÍ\13Ofl=\8a5¹k\85\1f\9e\e
+9\98ÏE\9c\1e2\9b{8QaQél¤n"V|
\88»\13ó\r¦Û]h¹\91\12ë°|´\15çìµúu\ 2 ñÄ\0H|D\0ôËtúÿ>\b\f²\rÖGÀ[üÞ\99\98K\8e\91\8b )Bè\93÷\8a\ 2¿°¾\8f qo\8bäLgª~_EÄP\0\ 2ä6íáAò¥\9cËÉXF_ӮƲ\a\e UËÿÖ-È«TöÏè\94>/Nú\1a\17\8cbi\17¬Æ~Ò´Ë/ç\8f¼À\1f\1eòÇJÊ\97\1e\85ÏÄ>?\8fèÁ\82¾:V8\93¬;\9d\1cR4\e/8\84ñ\96¯ÊA¤\19Ü\17¶ï¶\14\aaaÙÎUY\88DeâcT_ZöÁØ\18ÚÞ%ÅT~Ä\98òm\875å¡E\eB3XÄØ'_|Ä\11\bIÆHy\95\1cB\84\81SÁ²þ6\94±ùaxl*$PbÉÒ\96¢q\8cË8\ 1(yo0rËa\17\95\et¢¶3]kè"\80ÁÞ8x²\92Y\ 2\17C'l
+\84ûÈZ\92>K`q\11W¡ÀÍÙ\82¿m
+K2\8e!Í|zÝnLæ\b¬$\aáÕý\12É\8c\ 1ià,\ 4#R\9f«¢H>]Êõ)º(\vØ9~ëµ\93\^\14\f\ 3\88KPà4\97Oºá\1c¯\8cLý¾\8cÓ¹\ 4cÔý
+I4_ºß\85!Ìó¥\v-êÚ\15äñ¶NÄ°J õú\fúHË\1ee {\16d?qWH        E«B
+Bb\19¹ÿ\83íYpýǽGÆÁ|,\1cgß×·\84æuýû´îW·\10>X<¾S\99BF[Ì\94\7fó\1f7Wæ\ 2
+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\93ÛÆ\11¾çW°r\11X\11a`Þ\90Ê\aG\8eSI©RªxoÙljDBë©Â\83\ 6AÙÚC~{ºg\ 6Ä`\ 1bÉ]®¼®\1c$\ 23\83yôóëîÙE\12'Éâva\7fþºøóÕ7?ÐE\9aÆ\19_\}Z0\153ºX   \15K²¸úþ_Ñû|¹bRE»¶Ù·í¾ñ¯\eã\9b·úÎÔþ9/ͪÌÛƬ}Ëu´ü÷Õß¿ù\81÷\v¤\99\8ciºHìäï\96«TFoá\7f\8d\e\9b&\v\19\8d\8d³t±JcåGÛ\ 1Áne\9cd\8b®ûzé\16Í\8f®Mx,©_ú½]UL¯J²~Õ÷£UELøhÕRWk]ùsÃsÝhüp±"\19\8dS iÊbÆì'\9b¼(`\93$\13Q\95¯óÝN7Æ¿×[ø\95QÞ U+\83\8dÒÒ\1a;\9b¼\ 5Ê\16u\f\8b\10n9\83Ýõ\12¾øüyf
+á§\90\87)\«©\+l!\7fmw\9b¸}r»OSmê¶\85i)\81\19´Ý4>Þ_ÁÒ\87\ 5,&,æ\9eÌÿ\19\92Ùu¾\1d}ÊcÂ|çÍ\88îð ºOaë#É¢±è\96ýçèã,N:©{í\8e±«\91]øä\ e&A\80o÷y\85älÍ\e/\17ý\f ª\ 4··"4¦\8eBßç×\84ËÊ \1dPìT\1aÑ\98e±¥å_®¬reá\ e\19\1e~\95\92\84\9dáG\83Bsÿ(\94Æ*ó»ýu\92\ eÝA¿\85U)\9fT4\15+1\9c#\10r\81´\ 2\19\97\99\1dP\8d\16á±\0¾tý åv@\16\12Tv\9bÈÇ\8b'1W¾÷ËÔ\ 1(;ë\0_F\a\0U¾Øþ7ûÜí"/ò2¯ZãÞ6f´'Åc~° £)A\ 2ÓnÇ×S\9f\83iáì`ûÆ;"ÝÜ×K'C+ªÀN\8bÐz|\0\95ÓåXf@ìä=~³pnzT#\81Y\82\1eeV\86æÀu¾ù\16\15_N\9aÖ¤ßü©Ò\16lO¡É=ôOo\91ÌÉBú\900ÐYa\0\8e
+30í\14ÂÞ¼|ÂÞ|uÂ\82\ e\8a\91r\85\1aÙa\ e\9a0p\94½y5®Io½ó©´\1f£­\87JxgÏ¡­Õ`ÄEÔÚW\1aU\1ap\8b\f\87½8\1f\80\86ÆõVµ\1f¶oMaÐS$Y´®ËÜ©c*ñ<\816\82½hn{\17é=\8b÷#°\88íâð[7y©ã\91SIBwrµÌXäFâ 8\13\9e\1cu&©@'²J3\81FÅY$\9eD\16\ 6$è¤Y\86Ç\82¦#~Z\ 2ïÓ¡U\18Ì\8fg\1cèÄ@®\ e.èfòÓ®×q\ 5wôÑn¨òûëxÛÚ÷4Ú\19í\1e¦<;\0\8a\83k\7f?»ÓõO~þ\89iЫ\9ed}\11\ 4\r{;,\80óYÈù\ e\10;\9aßW\f&c!\ f®`l¬{µè0ð\bEÁnÉ¥PÔ±/\8fA`pÐô\1cà=¶§b(:C»Gf)#z\88>A\94ß\92\81°@\9cF\13o©¨\v£(Í¢Æ\8a\1a`s\94&\8bÏ)\95a@\85ýþ\e÷\n\8b¼­=JH\15ØN\15b÷¿UuÑ:Ù|=\16NP\98'Ë&\9dã\83\98ã\ 3\9fã\83\bù çdÓ;\9d£ñÙ\9c·?Ø\8bk"ø\92I\8ef\93\ 2\10\12Q Ú\ e"\9fz\82+Ð0Á\15øéÐ^\bs%\8f³ì$B\1f\11õô·\96õ9\1a\8bó\1c?P\89Å   \rýÝ\a+ µýïÓ1x\80\86\17@\baVÄû\98  ØD§¨JE\1fä?.î\19"\1a»\ eJ\a'\93ø\8côÐñ\12\0Ê®c\ 3\12\w·_c\82Àã\1fhØøßwz¿Æ@õ'üï\8bûÊTG\89\92
+\86O]p¼RSJÍzÕ|6\81\e;\12\9a.lØ\84ýÿ\1d}¼"q\ 2\81ÞaÄfB\12\13\15DM+\9e²è\ 3b/\véx\1aÕ·Õ8\12\ 3K\9a¢\1f
+\1czåÕ¡\1c\1d\ fóFÝ\1aÄõ\8a\ 1ü \9d\96ÿcl\ 4H\1f16f·/Ú./\ 4ú\rë\83ü$éÌáÅÉ\87\9f50Ï\14\93Ñóâs~,>÷¤ÿuÊ\12©,\98\1cÜ\ 6»Ô>Ë \ 1Ͳ±¡\vQt\9f\94\ 2g"Ç\ 2\0ØU=$â/\9bËç\ 6\88ü\98}\9b\ 5¸|É@\16\14\93D\7f²ªJRô[/\84\83Ϭ\0ÿÇ\8a
+\81ºÏD\btg/FY/Æ\8b9b\81¸§ç\88»¼\f\r.cQäÄ< L\19?\8b\ 6o{\0º I¬\14\82\ 4\80MÔöc\9a\b1Å!·ô\1aóF\19\96zðݦ\1dT\12\15\98ÅPi\0Ür×0\ 5Êx\16ËÇ[n\19§jN\9d²\98\93Ë¥ÏW\ 4\91¥\8d\96D\1aùÓÚ²\12\1cΡQq@£Øg\8b\a\87hU°\1e\8cÊ#`\94=\1a\8c\9e\18a>\ 6\8c\8a³À(K³è»J\17õ­^ù(\88d\87\19\99Ò\97\9c\10ò\v\80üÆý6ú\16¤\a\13\81\82E]Åͽ\15¯\86%¸qz\ eCOÎ\8f\ 2ú!bf"zWWnî\9f÷ùΦFáY\7fühK\rv?\9f\1d¦6\98¶[ëÖ·\16Úï:¯V].\82¢à\85\992ÝæwwÚ'Ió3ê\88\14ë¿\17\12\82{\ 5\17\12íf¦\vP\87\b|¾\¬Î\8a\95\83H·K~S©pö¦¨\8b¢£\15Ä\v·{}[@À{çÂ\ 6\ 6ZÏ]Ô@\1e4Ïü±æY|\1d<y7a\96@fÎÆ\93\ f[ÿ¯³Ïyû9v°üù8È\9f·dDç(CÏÇ0OçàÍ3p\90>9ðË^\18\9b\87\a     5½Ï·G\92|\1eo1@àÜÍóyÉÁ\ 1\15f\ 3\90\ 1Âë= \13ÙtNGqtÏÉ\11qÁâ|v<\89Ã\10M\1dMâ°¾8\84\ e\83      5¨#âûÆ4yÛj÷²®+W\ 4¼ó\rèö^i\87\ 4Ü\11\ e\a\1aßR"}~zV&^ww\ 48n>ô¸¸6æ¥\ 5 \8b\8dÑ}-\12Z¶z·Ó··Æ&®Ud\8b\96LF\85)\8d\e\82\0Öâ7ÖKâ`8\81±\b\ 5F\95à×á\9fYk÷¾®]MÌ\0ïh¤Ã\vEn[\9dã\1fø5ßf'\85_K¹ÆÍàîçðèúÚî¹ÚÔî\9eNWgu[þã\84È\81;E¤F\8002¤ã@A\12uN\19á\14ý\eÞ\vHgo\ô¦iÅؽ8\86\rêÿÉ©\13\8d\80\90\ 6\19\8dû(ç\0\89\1fG%q\11*Ý<\8dJ']Âx\88D'\99øAaº¯ ?7í\86\16\9a\ e\18\98Ð\90ÍRFoƱ,Oà4.Ó¼®½\r[\e\17Ñ)\85e,Æ\92A\84\87#¶M\8dv\0ô\91Gº3uý\95   4dSÈ\19o\0Ê'Ô¶.T?\14\97©\1fÚc\82ùÆx¾ôæ\9bCठðyïß\87áQgô\8dëlL©«îfaw\93D`a °\8enz{QS\rø\80&\10Ü ²áóÒú\fo\17Mi­{«'"
+N\ 5Â\ f[f[zÏI\18\16\90J4Ó\1a\12P©>{Á¦+G   <±ßQ=øèe\85\10\8b§b\98Ë\80³cå\17    \12\\91\85·ðN3f|D\12}Ô;tóØë\7f|ÌìùJÜ¥å\ 3_·{Çx\e1ãå r[\98u^\ 67\84 \19Ddk4\84É\8d»q\92J\89÷?\9e\ 4\1fÁô±N\vQçGH#`íü×U^¸m®ëfg\ f"-¤ÑþÑ\v\95¿\a\8bMzëó\ 1\ 4ì\93\18\bºO¥ÙÜ\ 6\10æSÝT&\90aXvñË\82Á>\12\0\9e\p4%eßÀíÕ\9abñc0\92ø\ eåFBh \ f\r\13#aN:\18é\1aÂ\91
+\ f\1f®î\eúÕ\ 3]Sö\88x¶ï\9c\86Z¨Â\13báL\v\1aÚÚw\1a¹¢mî:\8dk³Õ^|ð¢g\ïäe@\1e«\17~o\88\8béP\15ñ¤þøS\a\168áK½\ e\eÁ³Ú»?\ e¶sn\ 5:\84í\ac\83W\ f\19'\11
+\ 3DEÑnï/>ÖM\93cJ\ e\e7¯ð¯\f죩*ÀÒ~p\89\86e\ fJeße\97sÃÇ&/º¿\vèfØ\18{w\1d\18²o^\85\19(\8bºõÆýbzÛ=ù\v\96åðÎ#ø³Ú\ 2\855¸¨|ÂE       êH\85×\95
+<\9c
+\8dïô\9fpp\10\88ì÷ \ 1jV\ 1T\80Ö\10I\81\e·>\ 5ÿ²ÆþNÂ*!z<ø,yóG\9cýÞµþ!\10\1e"-\8eÜ6&o=ÞÌ¢î´Æ\93`\aQ_îN¾É?:Q/:\17Â\0Ã\8bðz[\9f3\1f]ÿaý]\8dk"Å\14\1aèúW6\80\ 4ÛìàrÊ\80¾ø\a;\88\97m\9a õBû\87ÿ\ 1;~\8c»
+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\93Û¸\11~ϯPòD\95-,q\ 3v6UÙéd].W<o;ë-\8eD;¬\95Ä\89¤qvýëÓ\r\80\97\0r¤¹âTò2#\81\0ÑèãëFwk\96\93<\9f}\9c¹\7f\7f\99}sñÕ+:£\94X9»ø0ã91f¶P\86h6»øîÇìbnEVÖ»rSÌ\17\\8b\8c\13IÉü§\8b¿Í¾¿p«m·\9aRC\ 4ï/ÿë\1aVÉ<ÛÍ\85ÍÊCµ\9cÃ\97z]ã\v¾zÅ»¥\92\11­f¹[t\99ùDz{,\88\94áé·ó\ 5ÕÙK?Eô6çÄð0ççè\ 5\9aX\1d\1eÆK%a"<|?½rA\95ÊV~\ eÍý3wpÂÙlA\89  $\1e\1fO\93\1cø\14\1e_Îýó\1eç\80o\r\ 5\97Lɹ\0N\97À:àÚª¼BæÕëM¹=\94\11\12ËÚ¥ZE¯\86­Mx¾XW\9bêP\1cj/À\ 53\1c\ 5µ`\82\b7áíÎÉÇýù0\90rï,J\83
\16\96\13ê\85ü®BÝàyJpðj\1avÿ5b\9b"Jv\ÛÆJA\14\8f¸&\ 6¢i¸Æ¢\9dQ&ªÕ\99ãW\83¶PÝê[EJòÜ\9fa?q\18a:^ßÿ4\vÎlv³\rÛío\96Ër¿¯êmé\aV\95\9fñmq³\9c3\95ýcÎtö\9b\1f«¶þ\7f\82Fª$±\81Æ¿Ï\17&e)\8209e)jÊRäù\96Â\87RiÕuîe:\ 3\84\ 3p\0eBºg\8e      \ 2¥±­ýÇu3Ô2
+\19Äe\92   T\92¼\85\13&U$,\8d\e\81°´us~IH\v´»}îÄÅECVJÑ\19a¶ÛQ§Ô\83ÞaÇU\89oÛV\87°õ²Þ\84ON àüß\85\19\9f\eÝA\90æ\86Ì\17BÚì-êN¹óãõG`Ú1å )êUW 
+\ 5\fb\88>4ûSD&\83\ fÍAs\98¤¸³\99\88\1f\86°F\ 2oR*¨\87\96«z\ f\19Éåp)\1f\r \1d
\15@\827\91\18\1e\ 5àOã\15bmT\1d6N;\9dqk\ fâÚF«ÁÜE'Î`\10¿¦\\87±½\17m\12¾ÃÚ\81^\1c3Ó °´Î#Ö<`6p\f8N;á\ 6\89\7fÍ\18ø}\8bTPKr6ÛÀ\0X:k\aÖ³w>R`íKÛ%L!\87ñÅ*"Ý\12\8d\e\a?q=_4º¨FtQ(¢\9b³l\ 3Ï6Ñ\81aKÙ¹K\9dÇö\8f\ 60®A9Q\r\ 6\81\95\83\v\ 3ª\90F\9dÕ1e2GFä}Û\15\83WÊ»*´C?Ó7¿ ÖÀ¬%\82~B­­!9í/yLÝ~\93:®îaUìD\90Åü\16ü\151\1aÊ14<Ù|bö\ 2§ô\10V\19cÙ³\98dÓ9¾$7í\13qó}\92\9bì|ßò$Ü\8cc2£#0\92\ 3äç\1a_cÆÀ\88S§Ù@\13\0\11§\8a\18Ù|op¨G\90\9f--Ê\a\13a        \18\1fx#÷øÅHP\e.>T\vb\94\9bùçõºÞ\15Ͻ\1dzXpÐ\ 5ß\92Ðe\ 4\86Åyß\e\feÌé$d1\94á(dÁË\e\r(®®ªbSÇ~\\1aw\v\ 1täöñ@Á\8c\9cÐ`üÓ<þù6\1d\1e\8fÈÌ´
+\9b\135øä(|\1c\rôcÆ\r'±ñýmÀ\9a\84\82§á¢\98¾\99\0X¬A\8f    \ 6\87\19\83§á²\1cÑ\ 2Ç\ 6\9dfC\8f\vI0T_\8e\89\83õyÂ\1e÷Oæ¾ÎÞLß|Ì}=ô4\1fÕy|<\93\ 1÷Å6z\92 ì##ð9b\8a\ 5´`\10¿cnèÿVýßfÕ\ fäiîfÔOÇÆ3Ï\7fRÐý\18®ö\91\ 3\82   1\9díÉ\19Ü\8c]\fÎ\89Ðc1½\95DãTA\94\86¨\9eæ\14\f$Âú°@É&\1cwp\85        \ 5ÚÆòÏR÷~I'/\17X¢àªO
+\13\84Ñ)RÚ%        bn¡\85MÓ"¨»Åw´\0|\1a=IK³¤£\85?\10c\14Ç={Ä(\8b\a\98"¦Yòà\8c1Ê¥\83;Z,#ÔLÒÒ,9¦\ 5/^ª¥æëÔ½Ktf®Ø-\17Df4j»+*ÔÛåúfåîb\93É\1aÉIêZ6°ÑÜô®Ý£õ£æÚ\9d\ 2C{B¡e\98¬äcÉÊ$\f0:,\19\8c$Ô¦aúιx\1aS×{\83Û!:\1f,j&À\e\8e*E\94÷\1eª£ì\¿¾\86\15\8f^æ$¦­­\1d>L
+yB*Þ\8bÒ\84M1Þ%\1fî¤^ô?­]ê\12\1fqp·)רû;½êòàº%¦tK}Aº\15EHChÔ\939+ÄÎ\97ÓØɹ%~»\ 2\91ò\13þ)·+WßSÙ;8\84\8f\15v\rp\9díË\8f\16+;¾ú¥²\ fÅ¡\99ôi.yV¬«fý¶¬üª]     £~lYï\ f»\9báúT½Àr\98\82WúI    ~bª±\85±]ÄQ\10\86>OË\17<·¡\9c¯¨/\1dʦ૱\8e¹\bÕO¦\89äýl~¯\12L-\9cÂñÀók÷\119¢=G¨+\ 5Çå\ 6\8a¡XS\ 3\8eï7­JºìfîH\83\7fûØu1pår\8a%&fÉ vµ=ð\1cÕ¡¾ÿM\90Ûªy[\v­@ø"+6\r+Â9
+\97²õ\9f×Õ&\8eµ9GZN4æßÓ\98X\8b\16Ñ.?UI\86\1cQ'p\84NqDt5²ÐÈÁ\8dtñQ§A¯\v\1f\93¬ª\rÚ@\11\8aÃ̶\1aɲ¦Æäâ\98}AzQ\18\ 4a\ 2öË\ 1C8vó\18\bº\ 1\18\84u3\99{@ÑÑàLãø\10\ 6R3AªÃ\99n ?Ó \ e÷wo\ 6ÚÝ¿¹\98        \10\88Åó\83\7fR]û\8cc
+Å{ü\82\ e\1f|\8f§§\80 Ëjí8ÁТ°\1eY¡V-\8b\9d\eÍÛR²\9b\8eP\84Swؼ\84\8dKî[²ïBá}òö\1e%öåö(Ñá}\1d\8e_îÊUu(ü©W\85\1fL\9c^é®:z×®\93\87>ûh×\89?E±íõ\f\80\9eH\0MÕoAYãq\95Í®wõõ®*\ fÞn\8cÉÂ86è0\r<ÚïK§;\1a\9bvÀت«\eD(,\14\ 1E\fVø©yöÏ\9br\7f¨\9fã ÃN\ e\9b-\8cº!\9am\ 1éÝÄÂ\ 1þ®Ä«\ 5îuUíë\8fÛº×\92\85ÍHØk'\0ìs\7fï~\8b¯+Àsø\e\89`Ùu\ 5Î\ fìß}Eo\89gÂOÛ\12]L±«Â÷¡%øÅ­\1dà\97dk\97è:îîÜ\95w÷^#u\8aÆós®U販\1cºl<ûeµÙ\94»}ý\87 *T\ eëõ®\13\87ò$,\98®ôÿ:É\9eã{ÕÓ\ 3B8þëDö­\1f\9f^α¥\88çÞ·Pqì[ÜP¹ö\1fÖåf\13¦\r£8fÔ\90ÁÀ·ë\1d(cíJ¬M«\9b\19º)\98T­ÂK*§ 0Rxqh×\99Ñ\13\aØ\93Wtô\7f\8e øð:\10\ 4\1f9LÄp\10¢1?\rbÆ*4~ì\ eÝ}\1e\87L[ô\ 5s½^\97\87òógï)\a}³y¯\892ì$ ÆÃLÇx³,s-6B\vÂeÓH¹\8dëº\10´\88\8b Í«¸'&G9\8d6CB(?ì\85´\ 3\e%\º^Ómª½\8d6s\8aÉö\97d\v\92%<r=Ã^MÙe!¯"
+E×ò\ 5:¨ò<{\8bb\1196«\ 2Á©z¼´\98LÊûýl\0¬\89~6\b·LÛÏ\16ñ¦wû,÷\80îuBBBv®\1f¶¢H\99Nm\ 5ú`G·\82(\86a\10\82L¤{Û\80ü\87ùB\82\ eÇûøÖ¬Ñ#A\fÆ»\ 6º
+/F\10õ¤\9aç8±ü>Y\85aÒj²(\17\14û·Øw\9b.´H]Ró^gÎHÃ\89áÓ\17\fÖèî³d0.:~k\96\ 2REì98:}\95?\8b\11\9f¡ieuíºíÑ@Ð\98Ç\fDhìÄIî*\86:«Æq\ 5\9e\ eqe\98?Э\ 5\82²6gõc\8cz\9d÷?\ 2½A\ 6ºëñþ)ÑTß\9aî\18¬\ 1&P\92\e×ó¤xåÃ\88\97\8fëù­}UÃ{4\8d¸!;n\84[#ÞÎø\1d»ÿ%Óh\18¸ìUÕ\86\9cà&\8b\95÷¨Åîª\82P¸N \98\1c03mRh\99wY\8c\9cx\7fý.Ñi\fþÑÐÑÎLÛ=L4fÒ®i;Ùi,ù°ÓØgù\93\9dÆ(V\8cÄ!f ò1!S\8eºaCÌd\8e\9eß+G/¾ä<ª<ênÔ\r{\8en\81öÈÂdÒÂþèKG\ 2\93*S\85*\96Klë[HÉ   \95Ø7\ro£ª\1dH\14ªÚ%
+Â>Ñ\9dvئø2ÕOßràþ\19þ)ù_%°§U\9dÿéüü\98\17Ê»K\Z¯Ì\99zű\8fFöô\8aK\fà'Ôª]q¬V>Y\102ðÒ8Sñ¢r\90\16©\99êî«¿$úù[Vb*V\95\87(\15ë+T.TvY\rѤÙV>I\ 2\ f]b\ 5þ\1fç&\19ó×5üp17´ýÝ!NÆ\ 2\97¿\81bôï\92+ÛªI \83\88\89§Úcñ\87
+\83\9f\18ý\90ê²m\7f,òâkôKºU\99\98»¬\büíY\8f\9fF\88Î\13?£#¹¨E»>mê2råü(­>$3ÎU{2ó~Ù{`V¦y\85Ht®\18ÕżTû®éá\8f\16\94««c\fA\83º5úö»\7f\ 3 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Úí\1cYsã¶ù½¿\82}
+9\89\10â\ 6\87fÛd\92ÝÉd&îS\1cwh\99Ñjªc«#ÙÍC\7f\ 1    
+ $Ë\96-Åz±Lâ#\8eï¾È$Gy\9e\8c\12óómòõÕ\97ßÐ\ 4cTðäê×\84æH©d \14\92$¹úÇÏé\8f\19\91iµÈ\ 6\94ðt>\9a\8d³_®¾ÿò\eÞ>Â\ 4\12\rôÇ×Ù\0\v\91~²P¬\85"\18Qî \88\1dõ\96Õÿ\90Â\8dþ\1c¬@\11©\1f\ 2·á\14\ 2Qá ~\81í\8at9¶¿ïK\80N\ 6\9c'\ 3Â\10\17þF¼¥8RõRwv\10ç\89D\85\84A\81r\8d\e\8cda\0Þ\ 4{\90(/\92fü:\rq\858\8f£Ê?\89Þ&uP×Y6 R¦\7f\v¦"y\8b²èV\8bçØ*!éçÁT\1aª\10'¶ÕMþ\94HÉz\94\b\19¬¡gÕ\bgúW"F\9f\92A>Æd\89\7f\87çÌ\91hιu\81kÂEp\ 4}:æ\1dá?Áü\1c\1d!\vf0+´3Ì\1c\0n\0ô\f¬«   0õ\ 6\eeòC°¶\0E௽\85áä\13\89q@\9d\ 2\95:d+uÄyQ\87÷Q§×\12`\86\0\ 4\9d\8aMöÅ\87èË]ì\8b÷åÞ\90:
+\1e<\1eqøñ\89\11\87\1fĽ]O\85ªÆ\8c\84´\ePN5þOÌLÜ<ÌLÈÈ\11ÄEÌð\83\8cÄ\11I\83\ 6\1f\976ü1l\ 4½ðîÉ\9b\88\9b\87\99\88Ã\98÷$\1d\9c^\13Ñ\17¿\r(+\90äOh)Ê\b%U×Öó¸\90Õ6&\9cAG¡¢Ø:\a9\96£ü`Wc§\12\14\8féj\1c\18Æ<£\81:mâ\9c\90\85zÙAxÄ\a&\8a#)\9eÒ        ÞÆ¿\17#µ#
+?S\ 4=\81ö}¢$Òá\96ùS¦\ 3NKe\197ÏXî9Ñ©e\ 2\9eÖ\ 2ÜWÁQ\94\9f\9a\82ëq¼n#¹nq\89>\eÝø1¦\e\9b\85[êã§èøþg\10½õ\9d­ßv\14(ßÎ{ôpÞûSÙåmfg¯
+\14õ\95\8e¤°\80§t¶Ö/õ$$Â:Mh\1aaK\f^[~qØ.\ eÛÅa;³xù$ë&\97x9\96ÒÝrºW¦Qå\9fW=m9\840Dí<?U!ÿߧyåÝ®}\1e§ÍBµM+Ñ6\vL¡E§\ 1ÀÁüZÎj\19w9UMÙú\8c:ÜÑP\fIl\0p\8dÍ\1c1\95ü\9e`"\10Ã\80F\8cX2Õ<É\8cdÙëIò\93\a¤\10g\1d\82sMhíÝ\19T\10\9a\10D¤ÏoXxãycfiÌC*ô\91\80¤VfBUT³S9\99Ì\17¶}\892¤hB\91Þ\ 6\8cü/\12\95 \&\83\ 6â.Bâf[{é·®\85\88\bHÇóÐ2У\a¼y°!Q0QGV\ 5Ý*/ª©\9d}\15p\80ö\8dTÑÏ\ 1\84Is\8e\9a\ 3\b/\10/68 \ 5Ò\1c\80;\1cà+\fRÓèm(\ 4\14l5\ 3¥\ 3\0\1f \ 6`\9bè\98LWëÕ
+\1aÓ\98JG\93°\9dN°&ô\9f\85Z4GrCO\8b®ÿ\86\10&­ç¿\\83p\rÇÕ\fÚûVÕÀ6ÈQʬ\96` P\ 1pZCØ\ 6ÀÑ¢\9cÝ\8dQ6`T¤?T¶½î®Z\8c\7fË8KK{=Ì çÎ=á\9d\1dæ)#'ÆE\8e°è\9e¹k\eT½ïY¹Z/ô\1c_Dú³\80\84Âïî{\ 2þßÔlÍøödË=\8c\18ï3b÷\95°{n\95<®½Ýße{\16rÝì"×\9eUäãSëf\17µ\1e͹¿GhªUK³\ 5üºõa\1a¿EI\ 3©\87ÿ»\1ek\rb\r\9aD\ 4\f­\0³õ\ 2MZ\1f\82e\1e3(\8ahNÈ\8b\1eÇÆ¢\92\8d\15x6Ôæ'Ý\8dƵq`\84\83\17Õ\18\11è\9d&æOÏô\94\e\9d\9eKp\806§¯Á6¦ï Ëø¨\144µï9\11Ï®6\9cô9\8e1\9a¶ÈÚ¼³=(~ÑÿGÔÿ÷Lß_ôÿ\19éÿNÓ\8aÖÁÚ?Ëa\86¢\8eX6\15\84Ðê\80@G\v\ 1E=M\145jß];õP\ 3q\8a\9d¾|\e\13\r\8d\8e\8bì_dÿ"ûG\93ýÍE
+T\a\95¯·§§¨$ÐÑf\b\82ë0Þã\ 4½\93\ eÔ\ e\90\0Þ'\ 1®8\7f,a¥\97\10\11\91\1aî&\90îa~µ\90S\90Ýþ`M\98`M\9cv°Æv\ 5\91òõ\8c`¤Dû\1em¹\\96³»¹Í\8c\95\13\9b\13\9b\8c§ã\95K¥5Ù²°4+Û\96\81h^°)?ýÕ:oaðD1p\8f\ 5\9a8ý|7^®Gër4\19\97³?J»¡úµÙá|¶¬\16¿e\9c¦å«HÂ\8dç\90 \ fõø3¼Dñ\ 2*J§÷¢Ýùtp\9dx\83õ\v\9fÞ+@ø|^\ f¸ï»ê~:öm6\908ÂÜX@UåyêÁ\87ÙR\99\9bâª\86ünÖ\18¨ád½\1cÏgÕ+(Iu«M"þ¹
+¨ïªý¾WÁ\9eø{\15ú<ág\1eTë°\9djQ\7f\1f~ÄÛ\8bú¼)xßÞ\8eËé<ân0\ 2Ë<ÔÝ8\81OIøâù°&½ó\11î\1d\99\ 3Nòº¶á<áÖA\9dÎ\97«Eù\a\96î¢\0\9cñ\8c        \9cº\12óp>ý0©V%ò²\92Éï        Ó\8bÀç^ÜÜÓö\86&\0.LZ²\85$n\80ZH\ 5½\1dõ\8d\18d\ 1\18ö!Í\r\1fR!&;«»\eíê__%LA/ç\80kæ.lÉä»\89=øª\9a/ª©Ã²\1a­¡\12/L%\9e\14*@Âä³jY®VsëÂ\97³r2\1fÍëú¼\9bò*SyÚNËSª\9d8ä¸Ç\175i¬?!Ðp\ 2{ºÊ
+Ö<È(Ñ\ fr\8a|\92\16>\83\16öLB\87\93¶WI\a\17¡DS
+}6¾\9a\94\91~a\8d\1f°\ 2}Ü \13ö¢S4kr\16¦ñ`@\vÍ-ïÃÎ)\8dýÆ\9b(cÁ\15S\81@{â\ 6qH uº"˼úßm°Ó¢=#\90³\80O\17\95\81´\91\ 2\18ç1Ãç\9dQog\8f¤FÂzVº]®\87\19+ÒaÆ5_-\8d!v\8d$¹V\82~\1fÉx\16kWklè\9b\10é\ 4\1asÜa¯£ïØÒÇ4À\9bÇõ¦@Ù@(\95þ=#,Õ\92¤\ f<\99/àÜ!\89´8?\98Dj;\85T?\81¨Ç¥Z9H\ 6ÜÄ\88ÒJ\14Ä6Oß\94ëáûOp¯h(â­ ´Xï\97\9f\91*ëÆ5¶Y§î{ßH¶ò\18>ÊÛ\86ª\9bíO\1azF\8c\9ea\89\ 6\81½Æ\7f\v\ 2\9bW\99\97\95E\92ûYÎ's÷_e1i®s¶\81é(VM÷\83$¾4\9c'rI\8bÜ^\87¢\17¹Þù¬á\18\b\8c\84ò­Ì\8f\vÐ#sóçWÔã0\b  \1d\0úaY÷æýkVZ\9a\8cµ\e0\1eÖ\9e\ 2PÃu¦QèL3Ô\99N«»q¹*§­15p\90\8b\83\7fÞUÓ©\9bM['¥%_2\91¾û¬\9c¬\\17æ\80
\19øÄ´\96\98\18\16Ès\9b6\ 3s\rù4¸aì/ËqúaQ\r«;oi=8q+ê\7f¯Mæ\r\0\17åH\1f¢´\17Æ®\97^#\9e]dZÙaÍqæ\8e3î¶\93/·¢`Ú[a\8f­'\ 1&ÿ:ëq\95\ 4\13¦-²¹¦
\88û\ 3÷¥çýØë\b\1c\83Æ\12\ fÎ\\87NR»®»nÖ\85vLíOÀ\87×\84\14`\82\8c#@Ýþÿò\7fÄÎ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Úí[[\8fÛ¸\15~ï¯p\9f"#1W¼\93(¶À6é\16X\ 4A\8bM\9f\9a¦Ple*¬-O|\99NòÐßÞsHJ¢,J\1eÏ%»\8b.\ 2ddñvîç#y4ËI\9eÏ®fîÏ_f\7fzûÍ÷|F)±rööãL\18"øl¡\fÑlööÕ?²ïnæLge½ÚÎ\17\9c\8bl»+üÃr[ï\ f\ 5üs\r2[b¿\7f\97¾±.×þaW\1eªåv\1dú¼Ëæÿ|ûÃ7ßËnA\96+\92ÛYî\16{9_P\9dýÁw\12]'Ê\89a¡Ï¿\ 6Shbuh\1c\ e\95\84\89ÐøÞ7òäÈwsOð:p°:\96\9eæMyØUÀ\9cBæN\97\94ä&Ì°ò­4÷ÓB«ÂÆ\ 5%&0wº<<ÐYÓ\9c\98\9cP;5·íæ~=\98\r#\14\97gD       ×©\ 2%\1e\ eÈV®³]µ¿\9e/Pµ\87Cu3\97"+6e\8d:lz¬\8a\ 1E\94\ebD\9f&\1e\13¬UhtÜÌhN¬\98qB¥{ùßÁ\84\vFr\ 5´6=\92sÊ0ç~[o=iå§#Ò̳b\1dh®°Ae\9f\8e\85·ÔÜ \87\a0¿\86\9d¢ò¯÷Çmxªê\85£rA\95&\f¬\9e
+"<\1d\87rçe²^W/@L\96eK\18Å\fZ4\98=>ÊÌ\vp\8b\1d|s\10êÎ÷XU\9b-PQìJÿ»±#øÁ\93Þ\0Úbê\ eÞÀ§¼AMy\83ì{ÃØH\10\8aJ\98\1dtæ()¢í\88Qk4̶\1dÝ\8aI\9d½cJÎ\85¢Yà½\8b\v(\96}¹©\16ÞѶ^%Ð\9d(ãU\12¬w³)w{Ô-\88°ªýß\84\ba`ë\92¯\93Â{´H26rBv,\92ÝÐi\15*?\92\1d     sD\ eC)\bX\80\80\18±¾Û_wÛk4èl»¯¾TÛ\1a$,8Í8\91Â\8d\9fýù­\8bò6\12\82àÄ¢t¹ÄÉp\96\1f«¢Þ\ eØâ\9c4<ß\ eÃWÞ\19Ì·@\81ÊSú \91YÝ&Â\98\92\91HêÁ"`\ 6¼gN®\83\8d\ 3\ 4ÓqÐé/\9eC\84õ\8d\9f\vq\11ý\9f\aôK¢Ï\91\91ßÌ^ÕÃÅ\ 5\r\a\89±M\1c ó\85\ 4·únΠ\85\81\ 1Øl½ÝÍáÏ0\88\vE$\9fTªl\85rÊ.¤¤¡\ 1÷å-uÇïç\ 1ÉÐÁ´ñ\1c\15!W\80ü\8dOX­Ëï=p\0.öCÕB*bã¶i;\7f\1cå¢\97\96ûL\bÖæå!\ f\8aÐNì\8et\r\11Yõ}r.Á!Ý\7f\1f{^\18{»&\12        Ñ\8c\bí\86ý½\86Ì"\8c\86`w½®\96EãÎh\99>\802\f Â(\98\eÂßÍMU@z\92!"âHÌ\80Øt\18:3µ\96\18{G´\92\f\95JÂQ\ 4\91\8dfo]\fÔ)\9f3$ç\1dä\1aDg@D\8dR\81c=äAv\ eq9àÒ\11Þº\v\aê<\aN\19]ÒG\15l¯êj\88t\0T\12Fc\90\86\88a\0á\8d\18ØP\ 6\94\ f
+|$(´\86×\0{\96ÃÔʵþÍY\8aÎ\1c\80\87\14\rXçÙöúÚ¡\19\0-hX\1c¨Û\1f¯\ 3Ω«b\93°*\r3\9eWÉTÎ\93Q\84|$­pÈ\80\18Ó9ËrdÏ$\92\83 -\148K÷Y\9có8t\9fÎa\88lHü£g
\82¢b,¼8\9d\f²¹nºç\98\11\0\14¤ó:\ 4U\89\vGÁö'\9c¿\ 1/o\86&   \99L÷MRõM²±\817C&\19`\91Ðz(Ö\95ÇnÝ\86\91Å\1e\84¿\92\1edÀ{\eîêaäÈI+G¦ó¡\99Â6\88\8dR\b°
\ 3±À®\98º>\9bâ6å\96ºáòã`\ 5Ù¥\9cUÂÊÛMî\19S\19\85H&æ\\ e\10\92\89Áçm
+|\1a;\98FĦÖÍò>\95\13[ñ½\ 3@\9f¢2Jª?%\80\10\8dbï<%\82ô棿_æìNRL\ 25z©\14\87³xt4)Ef\9fX\8cì\8c\18åÃŨ.3Ƨæ_\8eð?©&ñ@2ù£[»Hªé
+#\9f\1d\ 6\9bU\ 6Äæ¦AD´Ié\80QÍì?3\ 4͸!g\82á\11ÙfƵp(:¼XÏ~<\85\9dí\10Ø\1f\86`Ç# \0!Ðàx\98\875Hiý¬ÜWûCY\7f)<(XU\ 1\1c\1eU\1c\ eU\ 2¥Ðî\98"J.:\11~\99"ºéZî÷þ´\11òÁÒ-£³«b\17°Juh((Ö¾ííÜЬÜîÊMh\81\8d/õO%B\18­³º8\1cwź9í\81\9d\ 3Xx\94úÚ\83/ìO\rν~V\ 5Ôs\0Öýëöð\86ÓäÉ\ 3\ 5üÏé\83¶ºý½",¤³ÒÿI\1e\16upþ\11v¦n\99\ 6O«ÀõËâè35þ÷Ù·Å\87\87¡;\88¬ð\ 3¢Ã\9cáæÓ\9dµ\99\1eðH&KÓb"\82Ç\19"{ã\80\ 2\10X^\1dÃ\86ÑC4°We\1e-e_\86\0é¥\00A`ÞA¼÷©m¬¸SÂ\9b\8cR\81ÄÑlrr:\11ÍàV\18X\11ĶÎÊèÉF\ 5öÆ]£\12£\90ë\ 4÷_\90Ê\1er\1cy\ 65@ØÈFweÔ\12a§T%\1f¤ª_²¦Ô£h\8a=\9a;%\12ºbO§\9a³^D\9fV7²¯\e9æEã¦Ë       \97¿\99îy ¦Ç\81\18E fÇ\80\98ð77\0sÜ  ç\ 6^\18d¼y\91\0\10\80\14>\ 1ĸ¢Í\ 5^Ø+\7f:Võj\b¸¸vwiLà\8dÙ×Ki\17\9fñAþ×\93G|\f\1dîgÎÊÝÑÐûÔ\11¹bÿ/YyÁ\18Ë\9e\ f\95d\1e\b\9d.8<\ehÇv0û>ÚQ¿ªh6\1dìu*Ø\v\f'¿Yï»ùóÄÁg\9e»}\18\86ɯ\10b\10RÊqU\ 1ú§ú×­*~\ 1p9\vÿ/I\13\9cØé³\11ªÁ\95E\ ei\18Ò15\14Ópø\9dÈƾ7`|f£TlÁJ\fñ¥PÏS4äz\9a\ 6\vÈ4"\83åÂ]ú\8d\93Ñ\f¸\9c\125I   ÃK%\1aQÂ4ÚÞ8%í\80SJ𨽣åÛT\ 2\17Ý!\1f\10B\95/§HÜ\81\ 6\90#°°È6·àþz`ë\ fevÅþ°í^¹\87þé\f\898uH\8c\92\¶sn¢\179ÞÏ"«]Oæ\1a(\96ZyÌÆtû"Õ\13´Óïé^Ä=\rÞæÆ«7/ÚÕQ\ 6t(\ 3E\e\19¼Üî¶ëu±«\90q-ðHK\8eÖr0Ed\7føH-\aë<júêQN^=NÖ#\88®\1eA\b{·z\ 4\9dÈõv\18\ 6zwùÌ\ e\83uâ6\7fª$¡=\ ew%    @%þ\91yS\80\80OÃëCÅ°jí\91è~\9d¨þ\ 3­N\90=¬Bàҵݳ\fA\18Wk\82Ã^\95»P\12èkÚVþpÏ\95¼íÊe¹*}\89A\19JÞ\\ 1\12zc(@r\15s\1c\9b2:\7f \v
+)\99¦]µãW³\82Þ\1e¸½¢Ü\a¾BÍ\9e3\ 2/`ák¯¢
+\952\15\89\0º\8eÜ\8e¤(\14ê\8e\859gù¿Mäã6Y¿ðA¶l¯i\93\1aãÑ\99ý}\14ÆÏY¿\9eR\17ð\93Çú\8a\b\ eN\8bO     §u\17¼\13Ú\99T\ e\9fRÎý«¦ú®>©\9b±\g-\ 6±(×Y\8a
+Od0hP,Î`þEª§E|\18÷t/\12¹®[½yÑ®\9eÎuÒ_\95\9cæ:É5æ:5\9eë,æ\8ax8äºáu\12í\8a\84î{Û~ÿ\8a>0\94¶<çè\vº \7f\1c\97\98ý\96\18\8aËý>Ôuixã²b¹÷-õ¡ôýSµ\80Rt÷=Ãä\vAÉv\85\90~Ñj\98myw²1´\7f@nF\8d'\7fÑmVÎ$\7f\1f.1£È8\\ 2\1c\90çà\0\97Ý\85H²<\91Ê\8b
+ûNöSí­ìþx\9d¨\90ë\8e\9eîx÷Ý\93\80í.}]PreGîO\83\b\92\90â1X~\9d\7f:\96{U\13\88ù\0¬:ÌW\17k\a\8aP\\86÷ÄånÓ\944¢$n\8auxºv>°\v¥ß°5·½:PçE®\f4åEØ°*Ýû\9do\88|   \e\93¾\ 4\ 1\9bÞ­°6|"`Ðï\17ðþR`%ñF¾\ 1æ "\96\adä~P\0G_ªÃÑ]¤b[{Ë\fû®¸°\10zVkß%\ e\99ø\e·\a¾\aÂ4|\ 3\82Zv\ 2\ 2,\16×ßãÄË]¹_4u·¨ÄHÜËî;\10\99k\17EàÁÉ\11þ\9aTHÕ\fSØWü\88ç\81¥÷çÎtæ\9eÓV\17(\87        ö%Ç=û/ã«\r}\87kÒ×w8÷õ¬ÖÛÚ+ßY«¡½:dì\12.#Üs±Ay}¨®\8eÕÁ÷3!£ã0Tbdfu¹^?ó¦v¬\97\95ÿ\90\fòÃÊ};\86Õ\1f­\99\87/!ú¥¬\8a:ÿr~\95\80áª;\84¸M\96@é{§\11\8f\1dT\87\bÃ4`\1c\0YæËr]}¤E\11á\81_Ý|î\81¯\8a\ f\1f\y®ÿ±^ãwzC\99@:Ð\ f¨\9eÎí]˧ïSÅ(Fª\18ODoǯ\96¢oA~?\1c«:'ͽ\9c\82ìF.Ôðó?¼K\eÖª<QÕüÏ%´öö7!4ÝU¢ç\98[0(Ü \9b\97«\12¿j\13ਯËÍÆ%\1e\v©H\18W³£\ 5Í^U~\ 4~*\8ae;õ\97âÅpç\ fX>×ã\9eʺ\8d^ÒS'á\ f<(ù\84®
+ØLwóÇÙÚ`¶\ eù5?ùº0È\v·¨\1c\9a|l£Æ`eþ\ 2¶8á\18\86\89\10ô~÷?­~Åì
+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¯ÛÆ\15~ï¯Pýb
+½b8ûÐF\1e\12gA\v£Hã\8b h\94\14¼\12­2 È\e.Ní\87þö\9e3\v94Gòµã y\91ÈÙç¬ß9\87\9b,ͲÍicþ¾Þ|~ûÉWlCH\9a\8bÍíË\r×)g\9b\9dÔ©¢\9bÛ/¾O¾«\ eå«-UIÙõÅÍv'\98Húñþ~»\83¶¶©\8as»ýáöo\9f|%æE\b\15©\90\9bÌ,ð_Û\1dìAXÊ´ëýÔö\92l£Ò\ao\9e\92Í\8e¤Út?_O¦i\9eo|?\9cd½{\9eJ²Ü<X^¦RÌë7«õE*Ù´|ºÝåL%\9fÕuÛ\15«\8d\ 4\fËÝFÇÈF\99¾v\11\99R9m´OV«óT\88÷»\85\82O\8b?Ýî\88\941F\ 4\17Øom7_tSϧ?¯'ëTúÞl»ã9KJüãÉÏcÕ\1c+\9c°Ù1\ 6ÌÎá¨<åÜ\8c­\v\18\ 5ÇéÇáìûªmp\9aT1\1ah\92
+õkX9\13\ 1î·ã,OöT\8a-\97Ä\1c\16\8e\ 1\a5»?+Æ\ 3\8aù\7fðçµí«Ö\84ÍEJ>\9cçHðàH\89U¬cÙ¹Ã|Óµ¨X:iûêÍL\19\96\12½ß\820j¡\92o¬2º\13Ö\96Ì4\93x\ 4Cfa\16¿Ýj¸cÛ\95gCo\ 1\8b\b\86ú\9bÑ÷b\ 1\91$ÍÞÍ\ 3\95_g\82ë·\Ð\17¸ \1d\17\ 5\91\14\8dm*/2\85PPyõN®¸3<[\9dQ\81É\99º\9f¢\8d\93\895pe7\14\rî>´\86vÄm\ f\82M@\81I(دªn\80IÒ^N\10\91\8cÛ\1d\83E\8ee\8d\14g4O\ eíù¾.\87òÍ\e×\80\17Çÿ\18åy\96j\7f«g Ã
+ζÒQ\96jêÆü{µ\84¡@æ®õöT\91Ro`~\8cÍ\94ÓLc>Öt\85Á\8c½\83°Y\1e2ÿÆ^¶ì«~(×\16\ fäÜ\eî׫ãæ©?-]\93
+NÂ'JEü\rñ\97\19\8aºt¬0Ú\1e=\ 5û5¢´¸ñ\a\9aõ¥6\89KÚä8ó:fg&\ f\e1ì°\1d½l×EÊ|o\96:aW¹eõ$ì/ÊÓ¸¦\1d\18{ùPÚ]ô\88¿!íد§\9dÆU.Ò\ eîÈf\9fÈ$\87k\80ýBô\0o,±Ö\1d­7¾\81õ6c\9e\97çsa\1fYÊ5\1aI|.í\9f\83ZÕZêµD°v\11fe©b×`\16YsC,¦³\80^¯cësO(o-í\89ëÇcS\1dªÁZy\9d'\85\13\85z\ 1\ 6À4\82U\a\92ÔÕ¹\1aÐÂ\e[\18ó\83Ð\ 1\8c\1fT\9c\1f\8f§±8ÕUѼYc3ÊiªÈeÚÐ4\93\ f\83 Ï"î&\15dòâQ     ¢\93\1a\94]õj+xRØ{\1e\vã\vð6ó%wÎ\89k\85ê\1d\90gº=\ 3·\ 2\ e\9c[}üò\16Ð;ßü²á°U\86R/@iÕæ<7p\95rµ©7/\82\91ÔuH;R§TM\r\91\91°&Y\8c´\ráH\8d\9b\84»»\86y÷Ïo}HA\94ÆQFØ\90\ 2\80C\ em?t£g04\18\18\0ÿc\83ÿ\0(ûò|_µ¶q¿?´Í¡+\87ö\91m\98\95\89{P\ 3ÿ\r\9e_¡ë\86À\ 5w¸Aª\93\ 4æW\aOq¢Ð¢\ 4¨©.\10\8a1pµîÏ\1eq\18\90\89\f\99\b~\1f0@_\95çÒx³ÌÊ0\8e\1d<ÜbD[Ç\ e\8dÏË;«\e=\1aÌ\1dÍ\89\a?ÔﱧB5E}.-Ò(í&\ e*\14Ca\99\9e\85\82ñ\ 5¸P\14-\8c¾\0\15±\ 4IS\8f\1eIrP\9c¾ì¬à5G?f\86QÌa@ö\16\ f`f\81ä\e\86¾\1dËc;½8ì³8ÉÏcÙ\ fæÎ<éK/®\0~\8azèZÛÞ´\r²j        û\18      N\84£\fF\82\89§²)»¢®\0#\ 5Ëy\10\ 5\ 3ï,ß\e¿øà&\86WY\9d\13ç#ý!|}968¨Â7\99\9c«~ì\8a»ªvïåÑ\8eª\1c7Ns§i4\83¾ÏÖ\16\a`ÆÛhk\81\83©G(ä\a»Xa׺/º¡êJû\82öÁ=.\8f\89\9aP\83Qu¦\ 2\82Ü%úÜ\eá\84\13Ãy\8f\1a;Éa\97ïL p´¢\ 2\168¹¯\fý\1cJ\95\16¥Ú«Y´
\ 6³ÚÚå@\fËÉêÌÚ\f\93ÓÌf\b^àz\14µ¹±Bi_ѹá¿U¸ºµop\8djw.\87\ eÚlK\fùjãv,µ¾\85°'\ 6\f\1føòkÀWE\81ï[\10\81Î\10Á\ÃË\17<\ 6\8c3÷/êjº|ÈC.\11,\ 6ÖçX\1aS`\1da\ 6¢\rk>F9DÛâ´¹®[k\e#"\88y\17\96?L\ 4\8d9\ 4;\81B\ efR'nÏÚý·Þº\16î.Øhí³\98yºâ\8a\ 4HòÑâ\91¥ÃöX£o\9bÖ\1d\97Ã\17\fcÕ@+îGK½Ñ\99WeÍ+\88û\1a¼j\96RºD¯,\f?¤?ÝÂ~\ 3ù\0îô£\8b+d(áN#÷.ÊSVõT z7Á\9c¦íÎ\85G\9c!êU\10\90À°TÉ\vg3È:{\0j~       1,õr}Z\13YÍa´\91\92'\1e\1e\ 5\9c¢\bE\10ìRëÏÿå\86Ð04\84¡;\13x\19\f\ 2ñ\ 4£\ 5Ós\a\91\ 3¸\8c\eäjGü´\ e1fÕ{\19\89\11§ãSNbabîIqZM\ e°ûÕm\9fÌÖpA=\ 6á:\ 48L(Óà,#&Ä\1c\f©PZQ(0WÖ\97\b\11\\etH\ 2úä\ 1³NÜ Ùcç<\9e\9cÑ(é\93¡T\17\f%ÿ\1d\r%\v\ 4Êä\98\ 2íÁk\1d+ðÚÕÝ\88\10\vnÛÚÖÒ\91Æ¡§6@Gk"Ð\19oï©\92± Üë\87\ 3~L\83V,\ 2Z\13\80\14\ 3z=Á½Ê\8a\88·¼Y\e\ e\99æì¡ûû}L\90\aë7\ 6\ 3\bDßÚG\8fuàñ\vgâ<\12\12\98ÈcÚ>í!@À'9ûÞ¦½±7Ìy\9a-\0½ÉM\99\10Mg\1eY£ý\ 193¶KåAB°²Ã¼Ì-äIÏ\9c\9fÕ\8cÄÕ¬\89\10\83«·Âë ôâ\16\90/sº\10©ú~\bAø2\rDXÐ)}çߣáð\8p\17ö÷#K}Éÿp§_T\v\f×èä»\95wfÁ-h>\a¸MÄ\9bNá©\83Ï@\v#rÀs\a_Jûæó\9d\14·\9c\86\ 2\15\ 1 \188?\14\0+\e\¹ôjiô[\e÷\f*\94`loð\94ÒÉ:º',0jM\84Xù\Ö@\18\fñØ_\9b#8d¼«ÝÙ^Kgi®Á¸\13k°ÿ·Úig\12\ 5»iD\f\18L\90«v«/!\0¶Ä*        lÎî~\eÃ;lf\92\839>\8d"²        æ\88\81g\10ëÝ8¨1gd°ëÔ¬óG¹\9c\ 1O\f\19\84\1e?\9bI\1aM¿ÒüâU|\8f3L$ËM\92\80\11Ì@}(Õ\7f{ȳ¡<U|£q£\19ÂØÔ\8bÞü²Á{`2\8bsL}\10"p´ysy\8fi\80Ð)Ñ\v¥\9f-\ 2\ 4\8d\10N\ 1""|Þe\89¶vÜTÐ\0sYLôÏ\95ÙÉLê\13À?YØ\1d\1a³;\9ffk\1aðTÊ\r¥X³Å!g/­|QT\15KØE\16@\ 1´\b\102\rE ØßT\13fv:4hD\1cäÁÏË"x.\13ÀL7í§ÕÉ\ 3\8fÉÁl\8f®aÅ\1f×>À\9cé=|À"¹NÉ\12n±øÂ\11ßÊç²yÔ³æ\ fvMñr®Z¯Îâ~{\1fs\8d39O±òÌ\1f\92\9eâ:=Ù\a\93s&ÆÕháéjÓ Î%\91 DÑ\90Æ¡Áa9V&\9cÁaZOæÇ\1a\9cÅé© ¨\93\93\ 5fA\v8«s"WÍÆ_"Ñ\14\95)\f\ 6+)æ\9b^\8e\8b¸V\185z?)2\99ü<\16CÙ5æMÇôWes\19ò÷Ì\ 3­e\83m¦Øö\9aûzHľÅ뫤«ú±\1e
+ûrFP4\1a\97o(\85Ñ\b\8f\8d\e`³Òcçhçûçd\9b\19\848Äy]ptj\11\ f¸$\$·\aa\ e&qpÐ\97w.{mòç,c&\1f\88il\19¤ai®0\rÛڧʵ|Ö\14u\85\ 1
+¾|[Z8\87ýµ\9dï\13Ü>²kmsD\fXFS-ß«\12nÜý\9a«@\85)T»Zצ\ fÿ`ÀÀ\86ÜðÈ\15K³Tèenö\1a\12·_\15\91+ûWâv\8aÁf\90»§\9a&÷]y¨ú"¨Z`«a®faÖ\17Þ|r\14\1e\83ä¨æIß\9eÏ>½\ e\9dûÄg;]ÖÝl\ e\1d>
+\11$e\1f/\ 6a Ye$\91?\97xßõ\89ϳh\989Gj&¦ÊVIAÐÍýþeÛ\rå£ÔÖ\ 5ÿ1\16\93\16à\84¢¶ÿ\11%Áæ\88DaF^ztð<ª\1fo;ÒßD\9eÔµ/E®|\f'\16\9fj±l©P\\86ñÎ\1fW¡"\9e\82|DW\81FXc]Ô¤\8a\94-ºØ\0~Ò2l\9eµ\fßÂ\12\17\ e\1eh\8fU± \8a\90ôa
\14Ó\10Âʸ=Ê\9c\90èN6¿É\14\89\ 5¿h+ðÊa\81îý?\18\ 1]#b6Ä\93\aÅ\88·Ä\ 2hicáú1\16#±®e­\8b+m¹Ô\87)rÅ\8e>\15Å|\910æ+µù \ 4·ÿìîÎ×cMÚd\87ÆòXù\8fg+Ûa*\12 Èø*ò\ 4]pÓö\87j\1cZ;\ 3\ e\v\8e³=U\85\9d`\8bÙÐ\81¦\15\eL\81Û\ f.¦úMÛ¹­ËUm{ªÔ\9aâ\11 G\9bÝÔyòâ¾\1a\0\82õ`\85$åaYùÆ\96X\f\ 1\10¶r\8d\ 2\ e}.º\83-\95C_íþ1\8f-$P½yãZ
+ûçN¼ªÉ\9eªñ\88\99MKãUqIJ ¯N\8dË\9c»\14\1e)\19ñYwüº\80j 4\1eÓ\98×,yfQ\8b&°gðU
\97'ý}U\9e\17û\e\9b{ÅÇ©\9cMm\1e\fÙ\86D\86ÿãüIÀ\röÛì\19\8eÛï{\93ÕzS<²«àç\ 1ñ\8f\r\16\9fhÎß\fh÷Í\80öß\f0\ 2\87´EîÜå\8b    ~JؼìZ'ÐO°ÖK.È1À¥i\96Ï2Ã#\9a\8bÇmw¬\1a·Ç«Þ\1c\94\80H3PM\9a#n7\91\83p\ 4ÿÓÿ\ 1\95\8f
+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\8fÜÆ\11¾çWL|\11\añ´É~\91\94\10\18\89\15\19    \84 pöæ±\ 2îLï\98\0\87\ñ±\a\1dòÛS\8f&Ù#rV\ege\19Èe\86ýîªúªê«ÞÄ"\8e\rý}¿ùóÍ7oÔ&IDn67w\e\15\8b,Ûìl&R¹¹yýcthê­L£\aüqíÉÕ\1f\8aíNÅiT»
+?²¨su×àg\1e\1d]U\15Ü»\87þs¹ÛoÏ®oËC!¶;-óèmÁ3ë¦ë[?\15>ú¾øP6µû\1az\12\19\955\8f¼\1f
+8ÝF}³ýéæo\9bx³K´Ð\9a.Ö=\94Õp\7f_ô°\8bL2¼Oõ¢8ãôÛ\12\16PçÑ\95üѺ¾<4\15µr¾\1a\84#¥N@ÎSU:\9e|.N§²iÏ\8e\ f÷½Õ\v×u$\7fp\17Cw9¢.t\92D7Û,\89\ÓºsÁ\1d^#øù]CÛ]j\12\a^7ç²&9°\85²kÐA ;´ã\bî\8aÍ\9fKwt<\13î×ðÜý\1e´9ô»¥\96ú¡-¾"ÝÛèOd0É&µ¨ö¶lPã±\8d\1a\1c,ÚS3
+N] \83\1fúç}Ù÷®í¸µ÷V\92ÑíÐÔ\ 5\7fv`ÖÂC\ 4\ 6\8a®èýân@E,ï7Û\1eM\9fòa í7¨IÐcE§ÀÀ\8féOû-\8f\ 5ªhP\ 58<Ô<ö°5**ºÞw\17\80\108¢áÁ\1eL\ 30àÆ>:¸¶/HØ\14­¼¸\í\ e`rÔ\12(ÐØè\1e\80\80¶ÃV\1a\91]\8dåM\vî\ 3«º¶¨\1c·Ðø/J\ f¢S;A\g\881\9eS75oCþ\84=\87¢kø«ó\a\1eÊ\15Ëî¥I\ fÍ~\vƵRG\7fEãæqt?°8(d\96³:±»h{ï»AïhQ¼SlÀ w`\rô\b\95æp\805[meäxÑû\ 1Äix!m\0}\ 3\19\1e:öû@Î\1eä\:ÉÝ®¨Nî\16ðør»3àr\ 3Ù\ eNêîQ5¸ã¸s\1cýPºî\ 3\ f\17­7÷\19 ï\97ì#<à\9b7f\ e]R%Â\1a8\13\ fûa»K£W<GÏsà6Rû)ÿZì\90\8a\83Ë¥f^ù\8e\aÕêÊý\16õ\97«è\8cv\18j\8aExåQ2Ö\19t\9c\9bª÷\96ÝI\9b\8a8\rí{_AÔ\1c\1dCfѨ߶.\16w˵\88\93ñ|©Õâ~\89\12Rù  èþ´£«Üèé\r÷ÔnèÛ\86W'Áê8\15£xÉrïxVû>\82@\ 6\9abç×¼sõ¢A0áÞ\rVL\ 3¢?.\84\14ù4NØ\84XËêS\19\8e\85Þ±?4gH\ eåmY¹¯Ðáµ\17\1c>(G%&¢ \89×ån0ÐÇ\88HR)äxèÛå\8d\12L\93£ZÏ\8e÷\99à\fGp8Ó\fg\8e_&rÓyÔ\1cüµî\86\1aU\83á\83\84J22k \15\ 4CW´\ 4\b;f澤¿¡á^
\14ÏN\18\88àH¶æ\85¦¥\88Í&\17Vy_Y\85ón\9a è>\7f¹\ 1²°Ñ\99Ð
+ð*Sa2V\v&`0EçàFGJô\89\8aþ\8e±\8fA0Ô\87\92B°´1§J     Q¥\1fÓ$®EUàÿ[wË!¯;\r\b\1d\99\1a¯X\1c¥`î¿9Ý·Þ}\12¸\8d    \83\re{T\89òùKÉ0Ú)¥8òbÿ\ 3¥(\13\82\8aÖµå\9dkËÐET\1c\15ÌpÔ\94F?bF*ñÌ\bf\8cÌ\b>)\154í±¬Wò\fp%\92ßøtH\82çÞ\90~ÿ\86:ÓQ\7f)\1e\7f×6S°÷«yì8\90\96,\88ÞõåÌb`NÝ ÆÊq\98ÿ×D!Lä\ 134Vä£\7f\12wòº÷\ 3\81<\87­\ 1\ 5\8at\f\14\9eèÝ·\90ܺ"`ZH-GúW\ 3\aó|Ñ\1d¹\8b\87 v\96\1dø­ß\85Ó\83_ÜÂH\ 5$ÄSR÷~(\81\13h0\9cOô%ï4's"±\r$¾zD\13]4ä\9a%\10F\98h!v\94ç²\87¸B\89×\98\84\19í¤XÇ\r\82\1cüÓlßçíÐ\92±¢#\1c8®$¼Ð\16\1d\rãw\v\e6mï»öh \vªpí
+\88^;d\ 4u\19D× \84ÛXÈ1R}ûíZh\9dó\17\ 6\92\98\9c@"í¼o\e\7f\93\8en\f\9dõ\8as«$gpâ\ 4àÁñÄ\83qD       e)\15$\84\19Ý«;ø\83\8a\91\1fî ææ2\14­uÕ\98      5\ 4\84càH\97i0\15\99\993Dº\14S\8b|\8cæeíM Sˤ\eþÏ\rIzl¸é\93\19\9d\v½ìû8\10d\ el¢¹q\86¯2\1a\ f#Ðj¦Ã¨\14Ô\1d\rò6\95Eo_\94\8c`èb¤¢@ ôìá>ú\0§à\9a   Æ*\9acØÓ±ãÒÓ±gÔZé'\ÓÚG¬rT[\12s\1a@½b\ eÜA®ËiÎw+Ä         6\ e?J\9d®ì¯\82í\97i\16Î7óþ\ f¥C$Hð½\ 2 oG\15q\8a1\8cÎ\82'\8ce&~_\94\1aر\a²Üúï\8e²\8dµ¾~à\8d\8aúÐ\8c«\89µá\aù 07\ fV\1d\8b\0\16\8e=\94COÅU¦ájT]¥\976I\ 3\9b@K\81 }Lª}Y\ 33àú®ï/\ 2d* \89Îo1øÕ\84­eX`´!¬~v\v»iàu\99·ÌqEíù8Èñ\ 6F\92t£DÂhþ÷b¿\1d\10\v\v\19a\9c±ÜÓ\8a8\9b\ 2Í+¦,E\15\10\9a .\95yv\99\93¥\89\80\vt\9d§:\1c7%Ub\9c½Ð\89ü E`ø\1f\93¾\98\16JÓe1Î@\98W\1aù+ÞH      ³E¯\ 5ºæ&\ 2\ 1\ 1ça\8bä£\1a\18b¨u¨\1d\e\8e\ 1\90\ å7̳\98#­=¨h\99\89,a÷Á`a)÷aÄ>\9dÊ\ 2Ã\8e\8aÃ\10$\19(µ(Öb_çÆÐg\15\a\1aú?\13²[ß?e@ÜØÏ\99\9f<°Å¸&\19üù{Rà¢Ló¤EC\0\ fdÄðÏ\9d>e÷¾I7ÊÐ\81N\ 3\94:\98=Æ¥e?@x'(c×2Î\95\0º÷å´Ý\ 2Â\81 ø\90\10¼Ý`\8fB?ö¥\ 5·\ 1!~ä8Ôï\89Gj)£±\13\12+\96VØàR\0;§"\1e¾QBH²ÞãÈõ²Õ÷\81ù  
+ÙÀ\82#ëÌ\8e\1cù\1f̬\16¤JBT\eë²\16Y\13\8a\8aÿ\8c½\fì6ã.#Ümu\1eMviF~\1f&9£E2%9N(õ\91A¦Àî\\7f\82òÇêµ\92:Q¹0z.©³+%µy¬¤¶\8f\95Ô沤¾V\8cï\12\bÍ{\99&kÌEfAéíËÁ\18k\97ÀT\90Ñ'.ýrq\96R"\9b¤\©\9d§"/|\13Ñ2¦ÒMK|´C\8aè\18hü¤\ 3½\ fCÓ7¯ÐÛrJØØçÑÇIàc\85H\90&N?Ãû\ 4Öÿ£\fKñ3a\92Kñõ\85\82µZ\94åæ\92;ªëË\ 3xü~¥¾\162¹®y¨\7fG\99°\0 MWÞÄÖ\88$¿x_º(\9f/\8e1\ 6\1dq\94!]}ÃPöª~ì¼zU?J^
+hCg\142½. \9cÝ«óu\ 1\10¹;®^0³ùZ\1f£kð(\v\89\10Yy[º\9e\11\99eQñ\12\14¤tX× Q9ÕËW\r\99ØY±\85÷®[ú\87ºr\89Ê|vb¹4a2¿\90,%\84êÐ\b\v$X¦Bq,LD\98*ÍE\8d\92\80Ó\1a-\91Æ_µU:ß}%di|\bð\92-$É&7_:WB!ãbå\ 5oItP a%þÇ¥^ãY\15¿ìêöK_à)º{÷¿èî\95¯\8d\80z\1ap_I\8f~\84¬OÁÂB¬°_\14\16·\8bCuøî\8bVÉÖ­¢\9eÅ(·\8b\9b§óåÖ¯.\1f³\8a¹´ÊÇ)Q~!$ÉÇÔ\9dý\8aNð¨¾\9fÃ\v¤Âw\17r\ 2_\80\aòDاúÀ\8al¹H\92\92æÏâ\ 6K¥M9þñ\8d\ f\8b\8d\8d\88Õ³\18Ü<WhPëX}vÇ}¢NV]7\9dßY?\aL\9eÇ{WPò$Ïz\ 2H>k\10~\82F\9e\1f\9e\ 1#ÀÅ\0\19\99\fâ\8dþD¼±H\14\7f¥\9c«ÖeûBÉå\91h£ñQ÷\19\91t-'ÿ&HÞ\7f\ 5\8b\19\96|Zj\99écN1nF²ù\14\92u,ôo\9d=J\19ýa¹E\16Ìú\7feb\9fv\95«º³ÏI\ 5¯iÀÃÒ\0\1a¡âÅ K%\8dõ üÝ\7f\0\eïˤ
+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ã¸\11\7fï_aôådôÄ\8aßÔ.¶\ fí^\8b+\ eÅ¡\97·¦»ÐÚÚ¬\0ÙÊÚJ®¸¿¾\1c\92²¨\88\92eGJZܽÄ\8aø9ÃùøÍp´JP\92¬îVæço«?ßüñ¯t\851Jùêæó\8aq\84Õ*\16
+I²ºyÿ¯H õ¿oþ¾úîÆôämO\91 Lý\9e·DbèÛ\99\84­\12Û\1eÙVo\ e\868w­\99mdm£Bʵ}ìM\8b\13$è¤y?õæ\95íÐ\ f½\9101q­\9b޲ܣf}»îM\8d        bÍè["d\7fzÒN¿8¿\ 6ÈúÔ[\94¡T\9dÈzÛ\eL)Z~Ï\1f\82gL®?c6\89\19Ï=c\99\ 4Ï\18\9fá\17\9f\8b\9d±§Ó+¦\10Óz\9c
+\84±iþ~\1dS"¢c~÷\90ï×ú©.à\r\8f>gµ}\14Ñ6?\14\8fkN£l_ÙÆb·Ë·EVg;7(w=³»Ò\rÊ\8eÇ¢Ú¹\7fò2ßo2;\9f\8c\8eÕý!{c7\8dÛMÇX\ 27bÂ\103{û!ßí²uÌ\12\19QÄeÇ6¥\1e\93Äz8I\10·Tý\98\1fôRRDÕ\9a¥Ñݾè3^!,\1aο]ÇX\88è\93ù\95Ñæmï((Fªá(é\1f\86×úOÛêïOoÞ5\1e\8aãCYg}¥\13(%\vIQ\8a\12:fZ\95¸Zí\94\1c\93ÏÓÄW¨\1dE        \1e5­ËY©´\1dúñr²N~jÝ\93\ 3½j3\14­cNÒèýCVÆFªcÊ\13\16b-üÜôѪUçßöEE!Î^É@Ïà\84_Å@¿\98\8e¬\90¤ð\93¤\18ñÀ\82Â\88Ö6þxXóD\9b7øó¹c\19½U\84\ 4\83\18c\9e"*¬ur\ 6(f\82DÅÞ\19y&°¦=»¿/\8bM¶ßVßêW©\88î×±¶Ö`J¡÷1ßA{Qk\85äk¦Ò(3ýX´«Êº²\9dnoËâ\93\eÖ:\87ßÛ%ÊÌɺ\0y0¢n\89¹?h\8fPäÞÌÖÍh\1fR\99É6Ú×8\17d[¶yYf\8d71^\ 2ÜÌ>/íÃÎ\ e\83^\95íµ©\8eõá¡\86Y\b¸\ 57\8bóO\87<+\8bæ ¼C$\9a\81Ds] \9aþZ5N3RFïú¬aH±9]\96\b\11\13B¢?ô©P(\15³l \88\9fä¤\rÈY,Ë$ûÐ9ÝÖ¢1\1c\82#)\9f\933\vÄS!\9aðs\89º\88Û]¢Ò\19¢ÏÅ¢´a-\8ci¬1\95\0ìg3Q]eä\1d]ÀW*#»^\19Õ\vZ\83I°îU\ 4w4ò\9d]\eÏÑ4ý¸\ 3\b\8d\ 3D\9d\93Õ\91\93ºB\1d;\ e\902\12Â\11\93¿)ãoÊø¿«\8cÏõ\8cóéâËÐôêàn
+\86º
+n,wZ×ÄÙ:\8eb(Ig7~\17\84Ûô×l4^Ê\17,³÷p\88\99 \92þ?¤nÂ\8b¾\19ÈÊÐ\ 4²Å\80!à×$º¿ÉÊúPÙ\Ä&;º§£ËNÔ\87¬®]¶£Øw3\1c\91í³²º«N\89 \ 4±ÕÏ+¦×Løi©\9d÷"\ 1?^®~òz\12Ó\80áJ\10z*\93\8ft/B=\15\12Ý\9eæ\85ßS\194ä­Þ¼8­\ e¬Á=ÖÐ\84"¢ü;\0*\19Ü\ 1¨±;\0Ì:#í\1d\0KGî\0LvçÉ\1d@ßò¥@ÖHêÿ$£ÁÔ?Vgrÿ1&Æ<½d\96iÀp\9eó\95#7\0m\96\9e\86s¯;-¹\ 1Ö6\9bþÜÛ\18÷\90æü(z\9a
\v¡àú\9a¸Ö:=\vE?e\8b7ôÎÚÆ w\89~hüÖ.ûOo\1aÝ.Õ\18\8b¤ïαW\f³W\8dn@\)µcìåaö^'\80b\99¼\90\1cå­ð½OÇ\18Å\94*à)\18\9aË/\11(\17(\91öÎXû ÂÓè±8ÔÆ\v\99¼=Ç"z\80\ 6\ 5ywÛÃYox\84\e\ 4n\r~¿ôm!æ\18\8cL\1fÉ*¿8æ\90í\95s?ͨ<\93pù¼|о{ó\9eÏ2^Uâ²Tù\83GÖÇ\8bÉêDxZØò­ýÍö\e¸\0ú\92\a\ 2\18j6ëÝK-\1cyR\1d\vÙ\1dº\´¡øh-\0}þÄáZ\0:M-Ã2èE_áZ\0¼ ÃÆ\8b\ 1ØTs³ôa\a\v\19ð¤½\9f\11T(VÀ4úKqº\9e\85 \83\13\1d\83\1cuhâ\9e\ 3\0$\15->¼
+\80Ìcé\17\ 3 óà;\10\8c \ÇT¤\88âù\fÒb÷SZB\18eÑ÷¥\rF\ fù±î\84°2z\\9b\92\0-B\nÜmý!»+ª=Ô\eØÿÛr\ 3\18±}ÈJ¿Ö` ´¥\8aÁ\8eÚÐ\96JcÅû\ 1+4\10î\ 5¬îE §\9eSvzÚ\17ýÐÖ[ݽhW\ f\87¶,IAã\81oïsàƾøEs!?\85¸é`\88K©©Áõfø©\80\8a¼^\85\10iÕn\99°6mË\98\98Æ\8eï\8bM\91í\8cQH¢MÀµJÑ&¡Bv\8a5\8d¢'g\89ky\17\82\1eì\89\9d\v¦fÒcÀ×c©u
+û1÷6`E\92\89\88¬Ëdß\86\b(¼ébÎ7\ 1/@Ï×tñ×Uñ%j\10\9e\1f=}\985z\92m\15ç\9fBîà$nIÀ\99©`Ú/í\e\0AÀ;\99ð«Ú[½a\8cEž*ë\ 3¤ªúâª4Ú\1d\ 6PúáĬ\80\9ahVÒA5Á^¸óU[ÜÊD\84}\96\fI7²ì\9ceËÖ\vÅÓßüEÚß'kü\9c;¶ád\1f\9bP\9aç\9añ_\1f\8aǬ\84²Ë\81ÚK¬Ù%\17\1d+bÇ­\8d<{'Ë8\rV\8a\bS\ 5ø"hâYõê.'seÍÙ\7ë\vg\a&Æâi¨db(Sã\8aûybÒëÐó\1f\15¤j´|\1f­¡!B#©Òþ>³²}ö¶¦\12\1e7Õ~Ûà\12è»-\9a1\80ø\ fîm\13I\9b!v¨î\92Ýß\a
+Ü)k\rHßÕ¦-[ÍÇ\ 1M\9d¨\86t\1d\89Ý:È\ 4·!$U6ñ\ 4¥¥¹-è\84f\91×M­¨!Pº¯\13xô°oJFó]\11ïòúPl2\83]yôC\ 3X5u;°
+\ 6\91\ 2Ùª\93Þ2e©@·^\81E\99\9e_EuÑùÄBã\99T\9f\82\86\16ªÑ3=Þ\96ñ\1az(¤û¡á;¸µ\93ÑçlS\94¹}Ö\9c?ÖYmy\fÿ\9f\7f\r\8f\rÀ.3{:=s*ië\89ÆìiL\92¤a\1f\89Üb\99eW\11\ 3P\17I~<\16\96L»¼ëu\84¯?\fï4\9b\b\ 3¨¾ÿú\90;
+Smªü#ÛÀ\94_Ü     45»-\ 1\86Ï°\9d\9dfg\17§ÒßÜ\9dái\17¨÷%Iâ\15J?AÙ\1c\13\8d²E2\8c²¹IwrøÔ\r\8f¡lÖ^í\f£l¢\9d=\19\14\eDÙmü®\85TÊ´\ 5ÚL\84\81¶¢Þ\8dVÈ×6Z&Â\99\14Þú¯ V`j\18SëÁBLZû27¯Æ|¦\1cñ8\18\89QZ<\f\rÜSJ_vs\0C=T`.\15C\fHTë¥\9f\rÄ;#éìñ\91çmÀ\ 2j\8a\1aE9Er÷\80\89ªþµ)\ 4ÃdJ4wö£È`ØÆ\9f\88\18ëH\ 3åK P?\ 4\9dºëÉp³÷5Ç ç\16\89ù\ 2Î\1a\1d\9aÿÇc~xtÿ4¶ôéî´­RxÎ\13épUâöDÌ6Üϱ\82\8f+ÌS\7fK\9c{\91ïÌ8S\0³\86ï;\b»\ 4g.\ 1ò¦ßA\ 1º°|¥É$¾
+¹Ø\87o¢µ\17¡û\16Â_\9b­\93±s\1f\11ÀÇ \90Îñ? ªîµ\9d\86µ\198\ eØ\0\ fb\ 3¦\91\eÑjJí\e(O±á²q      6x\1fBfBx±áI\r\ajE,\12\92\16ìèY-rÕKu×0mÛo*óv[4o\8cáÎ\ e¿\14Úm¡\1e¯bóm¥6ù\88Z\14J¤£÷wÿ\ 5\1c¢Ë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ëÆ\11~ï¯\10úR
+­6Üû²A\1f\9a&)Z¤@\90ø­n
+\1e\89>&@\89\ eI\9d\ 2ç×wö"ré%)Z¢l\1f /\96¼÷\9d\9d\99ýæÛÑ*Fq¼ú¸2\1f\7f_}s÷Õ÷É
+c\94ðÕÝÃ\8aÆH©ÕF($ÉêîÛ\7fG?Vk\1eG¥ùó\80Öÿ¹ûçê»;Ó\8b\84D\1cû½þö\98§UºÏ\ ek"¢&Óݾú\9ey\1d\14"«Ø4½'BÚzo@ø¢¼\ 6\ 4\89²õ\86P\19U9\94ÄY]ç\9fÖ\9cF)ZoXÌ£\7f\95uSåé¾Ô­T´Õ3?\863c*\11¾pn\155Uz¨óFÏÌÚ\99\7fÎÓCi\87áÝ0  G2qäÁ2\12ÄD°\b¯7&H\9c\16ñ!Xâ\86\aØ`\86\183\8d²p\ 1\b÷\að¦\añ's§ß\ 6Ós\143W©E@Yô£\96vV­7\14>sûñC¶ß»¯\14q©¿I-GW ì·:·\15\8f\bjT\91pD©[©ÄÁZd·\96û(\18\82!ÎGÏ@!åê~  \ 5\10Ï\14Àý:\18W"%[áÊxR¸ç÷4°«îd_sS\ 4Ï\1a8ÔV\86\12Õ\r¼!RF\7f      \86 ±¯\927>h:¼ôéq·\ 32\91K\88d\(\e\9cè³Þ`\89Ø\826à{n\84\99\7f6\84D\7f\f÷¢P"\179\9bsÊ1 uí¼\f\87\v3_¦\17ƯV\9aÿ.¬4"\99Ô\1a:%+ékMp·\11­&g<\ f^ÒÈú\9aÄ{\9a\84G4I¼\95&ákU\89-¥JïÜu\8e\9eêD×?\8f@C\a(1Ç\88X¤ò]]g\87\9d\86i2\89\8a\14>U\1cíòúøñ\98~,\0K}\ e¡\0¦\1c\11r£ã\ 1\8b\14£\16     @-Y\ 2\a\9c\ 1Y·öë ê:Û?U\99\15÷'\8b×R[s\1f¥\87mY¹£xÒ\85\ 6ÌéÿòÂ~j4g¦\ 1D\16K}\18\ 6|r3\85\86s÷ë?YD·-\ fÛâ¸3P<ÔöØGßï\13ÏÝÌÌļãrr,!Â\19\0ÅÉRaÅ \18h\8bë\9d\88­þ·bÐ\ 6\r\16\__û®\80\9ebõ³×\92¸\8aĶ\84`C¶\ 5\ 3-aLÖki\vü\96
+1Ù\9bÝ\15t³k·\83C·£\0?I\e\92\96UY\14i\95\83ç¡\92\81Î
\8bg\13_L\ 24º×ý\875K@à\e
+\1f\95þ\9e\15éç¼<dáY\8a\ et8-ê\rí¹t\13]ÂZ2;îñ '\80H»?\81©Ûå¶*ÓU¿\1eóOi\91\81§´;\0\80È\90¤`\9aTKî¥q;Ñj!\9c\94öÚ5|È\ f©ñ\15TX\17\r±ïSUZ×PÖ¹[\98-ζٮ\8dôM\88îª\8a?\80\ eg\95\r\96Û.ò\14\9b\83\9e\13¨9d\85m^eM¾-\8bÐkl¨Ð°È\8bv\7f
+¤~²    m<\8cE\96\1a(\8cðb³\ 5Ê0¸¦|ÿTä[ÿäzÖ\ 1r`£F
+\96'úçÚ·,9~\8f'\9dJÔnM\99]R]\16\1eObjê\81X\1ek}\1c·zyÎê\13<gmC$\ 2Q\13,\ 2OæÎ\9b\ e\81èîJw·N\99\83nÈèQÿ\81\89{Ñb±jTdVã)\91Ö\ 5´:a\ e\19ĸ\am¬ó}zº\8dzGnÊ\8cÆiÒÁ\90E2ÚeEQ\9e\9a×Mul4ã]°.äÚöÌâ\85w\19(¸PN·{¨\8dª\83ñ÷ë\11_
+(\14qæùRB©V¿ÐCê
+Å<\ fé
+\ 6\98´×Ò\16\84¾Ô\9bÝ\15\ fûRpVú~0ÎÐ\80\81\rcR»Q:êFu@Òë8L\95\ f\9dôäë5øyð@æS\ e\ 4P\14¶zRw2¤s­¥ü\14z_\90ÛIe\9b´È5\81§¢íc¨ø\ft\97\8dZ\1cèî\19\93£\81Éõ\fvvçm°\87>û&@?ÿº&,\ 2\95\86\9b¡(+{Q\ 5û\91\b¿b\90ÐÛ,\96sw{ÝÊf\ 1ô¤\87\96è¨ç3\1c«\81\87Ù\rì<Vó\84æÔ:\"\16\88\91\17\81Ï\v\96!\9e[×Ð2¨xQü~\854\9e\19·¿\fÞ\19÷À\89yc\9c\90\ f@\1eÉ,òQ/F>4&¦@wë(l\ eÈ%w\17R\93\9d\18êlçèí¢ã·S[eèìçûådqòz4À\e\b=Õ¹8\0¿\11Û1\93ß\9a°\ 4z;\ 6\87pþÃ\10EAg  u2¨³BU·\14ê,\17|\11\83D9@\rÓð\1f\87²h*\b\1f\9e\ f&\13\eδF·\80§\Âa¿\95\85\9dS\86÷É\91þòå+ø\e¾`Lq\80\83OLľ\1a\ýÆ$Þ½Ò\9d§×G_¿Ä"Gôò\eç\95íqâ9ç\16¨\94_\80JϽO^\8dJÅLT:<Æ×Ó\97\18#\18   \vS·yéX\8e6ÃÄ OÇ[hÜ9B\1c¸A:â\80A\b\0\1d +\12åÑ\ 1®` %\8cÉz-mAH\1cx³»\82nöoîVL\19\18Ó\85\86RÔø\99\92è)O·z\93\94Fuöñ\90\16\86aÔÿ\9e^\1fôw@Þ{\a½«Æ¼\ 5\99âS:\ fü\83­\8c p\9f>=\85\91.\91\9e\rÑNñé,k·´ûûZÏ©¢ìóçÜ­i·Ë\9b|ãÈ&\b\13D/\14´d\94!î$\9cÕï¡\13\86}\1d\vC9b\1emÓ&;h\8a\93b\15=¤MSÚò´®óí±J\eK=msÓDF\ fåa×\12\81\8elªE´KÛ\915\ f[åYc5G¹`\1fvä=È\18b\vz\1d5ámc\14Mr9Ýz8\1eÆ\b\aëÓ¾\ eÙJì§+hn\86øÁXË\14é\9c\1fÁ¦\98"ªu)\91ÚïLSE}·!\9fÛí3ª\88NREb\92*\92Ϩ"9J\15M2Eì\fý¡\9eQ¬=\8aB±Q\8aB3¨ã\89\ 6\89\1f\8e\8cL\9c\8cNìÝL\86e"³Y&:ÁSS<\ e\q×up3ôr)z÷¼£\r¨bHõ,úÛ£±:kq,\19bá¥èîÛERúz\a\8dÅ\ 4\vÿüíðº7¿Þ¼-       \9f\9e9\°½\18O-CÎ¥\1c&\ 3ÜYø?\99\ 4\94`°ì¬×0\1epB\9cr\8d\18\16\83{\93»¼(©èf\11áHN\11yÕ,\86\e\ 4ºæÖëò\1aôu\18°x6)Õä³\8aq\8aa\93Pó¤Á\11%·bzØ\9b¨È»É\8e\vÞ8Iñv²»\80\1c\10oÅ(\92\v\9f{º=]ë\8a\1c8\7f\85$_.+öÍy\81ß\14n\19\85»1Ãv\9ez\À1M¦û_ñ0ðò\17¤\99ùþKÿ:\ 2îV\82¤üͼ¿\0ó~\87LæyørcôpAÆÿ\17ñÓ\99\ 5\9e\9a\86ñÞ\99w?\ 1ÛãÉé\89^\ 3ø&µÜX\19Âs\8e\11\7f\857ØadNßÖ\eL(\bëX¤wª .çù×c~8eÛõi¥\89¤ç\17ʯ×\93\8a\17r\16t\82U
+\98z§»\1dS/ô\88CIкBùIЮ` ¥~Êìµ´\ 5!SïÍî
+ºÙ\87\ 4c(\96>që2¥ù8q\8b5\8cð{\8e\10·°\9d\91,$\9fmH:_I\86n 2\9eÛ\97\94\8eâY2\8f±dZx×¾J_÷\vÛë8½«\7f\b\v9÷Ç\17C\92¢\97ó\863:OÉ©õ*³R\95ÆèñàçÙ81)(àÒ4î1ʬ\9c\ 1ýîÿ\ 1>\88\80
+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\8fä¶\15¾çWÔQ\ 5¸dq'=ða\9cÄ\81\83\ 4\98\96\89\eê.M\8f\80Z:µL\80ùõæ¢\12©â"ª\16w\80\ºU\14×Ç·|ïñQ³ª¬ªÙËLÿûËì§\87ï\7f\163\0JAf\ f\9fg¨*9\9f-(/\19\9c=üé_Å\87Ý\9cTÅVÿù\Îÿýð×Ù\9f\1ft+d[QV\12à¶úe½n\96m}¨\7fP-¾ÿ\998uQ    é¬ÒÕ>A\ 6L\ 5§3VVøô¾ð\9aã\92\90îmm^bû\92\97ðôòW¯_ WÌ/ïø4çG¯¥ê\98uo\9f¼aq)úQç\9fæó\ 5d¬øÑë\ 4â\92ã«ÈB\87³w·§\ 4}Óø\ 4ª\12\8aûíË\19ùn·/g\e\1d\8fïËykQ\82îõ\ f\ 1\82òSÛ_6ÛÕa×|7_ \8a\17ûÏ»ãáPo\96[-)\v(p\89¤d\0\b¬ë·+Y\13\93âoÍz]«GZ \92põÄ\8a]û\Ï!+¾¶õzë¯\a\81\12 ì-
+ÐR®    $h)h\8a\96,\93\96^ǬDIáa"³ã\ 5\ 2 Ä¹ ¬ÄMDç)0÷~v\8fW\11%>wp\13¡\e\1f_2]ã/\81\97\15ü=Xêñ^,õë=Xj\81\98d*j\ 4\97Ün{\ 6K (µ\ 4
+s\97po}>2\81\1e\14T%\9eýw\86\8aÌ\16B.\10ÌÖýo.J\ 6f«ÙG§\1e4åÂÔ\93Ê\9c\9d~ûõd\7fØ­g~»õx\89\99;®ùmÇU \ 5xP\a(õÁôZ:\9d\8c+&u2¥\ 3´ã`$ \9fØ áǶÞøú\1a¡\12\9cÈT¿\9b/\0¥Å\93þÏ\8açîÿÒã\v\fJ~B\13Ðg\fçí?Í[gf§ý.ç\v\ 2EñÑ\97wH­äøòª,¦\ 5!\94\ 5LPybËg\7fô\92\9c8º     è       Î£²ÀíËØ°à´¶¥7®\9c5éé,Í«\84ª«ín\8eÅi\85Ã=A(º~QV(¥¯8½É\12\9e\ 3Ê@¤\a&Y«o\ 2\8a\8c#-~V\91\85Ôt¯/ê\b%\96í(\99в¡Ud¡eÓ¼\81ýeS\8bí\8c\9c.(.\19\92\90\v\95\98Nv]\0áJ§éfsH\8bf'M\ 3\95\8cT\9bÿ\1fvÛW©iy±Ý·ßÚí¦1ÅRM\0õ\ 4\8afiþk|'ÿ\9fð\9d|\94\95\88\9f\9e\82ÈNªg¥«\12b    Ø\bs!\10¥²P\96l¤uj\8f\ 4K±¦\0Ã=\1a"{$Ò¬     \91Ë\9a!þb£b5\1c\7f°p.2\e\87ÖÍ\93È\8fÃèº\1dÞ|§6\1e\16Ëãæ?G\9f\ 4X¢§¸s\937üU4»×²\95;Dhñ²«¿µJT¤\b\8c\88\15\f¢¥\a+S%ííûM½Ú¾Ôëf£¤ï ý)\8f]\0'%r]©7Sd!Ã\81éD5\88\ 60\19'\fg
+_ó)\10\12\8dÍ\17Ü¢±Ï%\12Þ\9d\bÝ®_WÒã\r@'â(´7ZvH4XÖ°IÉ\88 eÀ\99\ 2v\16.\ 3&\94âõq0àÚ\1aX Ü\15\84jJû:¬©\v|Ìì\8cÞ\15ØÑè\19Ê\ 2\84\8c\18V\ 2ÍR¨\19àAË\ fÚÊJ\9c¶U`íeÓú
+RZgx\ e¡}û(JÊS\90¹\17m\1f2\ 3\a¤ïÚýqu\b\80FjÙ"Å\8d\8f\13ý8Ë\8d?\86X\11Ã\1cç1=h\1dÂ\8b(\ 5Ó       ½\95ÜÝz¥i\95^\a b\1föì ¢´?ÊýÉÂ\88ÄÃ\88\10á\92G\r\0\1dÓ,ç1\890\ e\ e\88Æv\156$\89íLéÂQ\9bÅx*0vÅ\8cOû¢053`\ea\83\9d\91\8d\8dÊG\85\9d%DÀD\14ÿ8¶\9b\90\ 5b\83\86¤k\88Ï\1aâ\10\88ÀT\ 56rÝ¡Ç;¢\88\v¤\1aå\84ø\15¹$\ 1Þ¯V[I
+\89¦ö\87f¿ï\9e¥ó¡¼\98åéUkþ\7f5>Oû        \12ö\\9b²g\15\89þ\12\b\19Jg\85°\9b-b"\8aº\\ f£T8\8b¥Í3\94H]\9aÔµS 5                \18\82\10Çèv\ 5¡\9aBuåÖÔ\ 5¾yvF?\15ô£GÌ3\83*êå\9bg>j\9e\89æ9µ\9d\97XåÓ[Í£r\ 2_|Ã\f¹5üu\0iöã\87­\ eºÚÒ]o^§Ì\17^Íû9F\12
+aX\1c)^\9b\1aH\81\82*@¥£¢Í˱1\11öe½Ò\91\14ù¨\94\f­¤Fj¿¶\aùHæ\98«H\9d|Y\15ËÆÖkVµ\89´øp\ f)y9W\14hÀ>ý©FÓõ\·¦_%\ fÝ£²\11æmÓ\17\90\98\ 60ër4\0\97RËCr-_`îʵ)\bÔ\14D\ 5\9d\9c\9a¦  \ 1ìè]\81\1d\ 1\90\ 2Åd \ 1$\99å\ 2EJ\ 3 1hi4\0\85I\rÀA\ e@ï=Ü *èÏ\1a\82ªÀFl#ñ3iÔAJ®X\12}\9e«\90á\ 1\16H\1d\1dO?¸N\ 6*\18\9ar0&\ 6\8a\80\ f\ 3)*Á$\95DÆb®!R\10câ,*\8d¥<\9cSÉ9ò}×y\ 6\1c« »\13]Z\1eëÕºÙ\84BQDÒêÎj<\98¾Ò\9b\9déÜv\ 3h\14ä6\86ßÐÖ\85\89\84®?\90Íò©\87ÜF\92ÜFÎL¬´­\0^jb\11a\8a´ªÙ\1f·ë¦CòÛ×]\1d±]]\ 3k»$\9c*)\rX$õ\82SÇ"u\ 5\81\9aD\9fÁ;5M\81\9cÑ»\ 2;zÄvq \ eâ\ÛE\90´]¬\8aÛ®Jé6·¥±]\b%m\17\80ÁóY\1a\88þAa\93\19Âp\96Çm\18´AO\rgå´¾øl\ 4¹ídº\88#\92â^À¦È8vy\9bѬ\8eCqmt¹\90\9f/\aEÎÃ&K9à\17.\878\87ãI)W\87>\88{\16\ 4¹g_\90\94\10ºöær\9d~]ú\88\98\15o\vÒ\a\rÒRx8-\ 5ÝÙþ]\11D\1c[Ô¸j\a\8b\8bU»R\91\ 2wª}³o÷\a¥ÞEUl\1a\15â\12Ò\93j×ÛýaWë\94C\Ñ¢~5\87(:¤#+´¦ÁÉÍ\11½\9b#\8c\9bc
+H×zÕ\15-\8fÝ@ËvÑ!"ªÈâ0èþør¬_Vm½ùÖÙ\9cÀ60hó n\19*ÏåÙÇ\9cí\rë\99\v\8eý¼õÜ\8e_q\16¡Æ\94\94Þ¦P\bo\12Zü_[UàÌ:\1d\ e\86o
+\9d\87,\v®'F\ 4ða\95æä\ 6+°47Á\10\84zAÝ\10DW\10¨iÒÙ\9c\9a¦À\a|Îè]\81\1d=\fø0¡Êû2ÚR%Ú ÊI´Á\84\a¢à\ fk\1dåö\12MÈ£ô\fðu;\ e\80Ité\84\ 3ÉÝë\ e)+ß\84©ó\81E_á,³ïÉëP\9a<9½ó\ e\a¼@\98Ó!\f\1eÅ$#$½r<Ô+©õ1 Ås t\8f\91\97­;\94m\91\b\ 1 O³;kÔþöù\12ÅÀ\95w\97Ø\84X\1eÅ\13N\85]\7fxfggkÎÌ´\18&f&\r\963±r¾ \98\15ïç\10\17ÒâJÏ!\9aJ¨2ª\95o\94\9b\912U\7f8gIYáë±ÝÀ®\ 6ÁÄYt\961\1e\92\94§HJÕûÔf¿ñ)óÕ\ 4ËJ.º\82\a\r\92$8\ fFú'ÕX`åµE\8feØÄS¶!¥\88·\94óPHjïyêðð\82óÓ1¾\8cÏmYoBF\ 2Û        Ö\93\8e½\9düç\9bä\97MàO¬\94gJ ý¹]N·ä\9eÖ\93Ò¦\84=?¼*Y+\93\14Ë\99Ú4\8aQ§w\95­`r\8a!\87:[\ 1ò>\13R\15Ùë\ 6\v(\90jæX\95_6úNØ\'<\1c\1aíéAN\95§\a9+vÇíJ¥E@aÎóUÙ\97Úü\7f\ 2¦\16sçbÂ\ 5\94Ãb\84×(\9bF¹A¸       \0§÷\v\9c2f³åsæ6°\1f\18DÃÙÜ;E\9d$\9fcÌöÖ$à \19¥Y·[5\vb©U\15ëñâùØñâªãÅC³o#þ
+©T¢ÒÚù\r¤ìû>\88*w3&ÌïP=1¨%\ 2^\8a\1dóôû4fØG!\b*BD|\14ÄTÊ\11\83q\1fE\1fI»½D|\14h\9dÙ©>J\9c'®É¿xÖ\90c\13ººHÀÍ\92/&ø\12\97N\ f«² »r\14oyÅ9uÇz$øy\93ñÇ\88\86b\103+\94\89\bT\9d_x£\86Ho\1c Ñ¯\ 1`/Ñ{è\91B\9còûà¨\15C\11\13¦1\15öúB\ fÖ\11RJ\8aýV'Ï©'ß\12P`Õeð²\ e$c×mÄè>&æM\9dyçøVc½\ fÔ\86p:Ï\9d~ø$TÝì\90Rø÷@>uå\9d\9fãð¦Çf\80¯¡\1f¹\8a~$M?\9eC@\1c¥ß\ 2\14³\93 \9awKâ¾ú,+â\1a\81\ewÐt$­é\ 6æ!/
+~\93OnLRÇç\93|s\12Çò\19¾3ôÛî÷m@\94\85{Ù,<\vr+\93z\9fkî7ÜÄ\18¼eú\8e®\83o)\f\aÙÕ\vî\ 6Ù»\82@MÙ'\1aÔ4\ 5\ 1 kGï
+ìè\11¨+°"\9a9\85ÜmW«z×JsHtZ=CQ\8c\v\85¾]á4\8f`\\vÃ2 .\8a\86á¹£j³¢ð(¥»¹\ 6;}\85\0dÆöó+\ 1È\8cm>Z\17\85\97\180\18\85Ç^àbxXÕ+õ\0æ!6õ5Ó<\ròµ\bH\1a?`?Gâûzê%É\9aY<\ 2\8aF" è\ 4\1d¸ºÂ\90\17\85W\97°]\83\99¼\7f\84\86)¬îâ\9d\ f'äi£k¦\91gôÆϤ|©ªTÚÉtÃ\14N\9eì\1c\ 5\8eUlýB?\81"S`\ 2]\1a\84\7fmw\a}¿G§\87\13@\8b£z\81tzx\aÔMÂ\82|xÝ5ÏͲÑ1²Ckê½\9eÝÖ×·\86\182¹W²Mè*\ 1\16ö;
+wã 6ø Oä\83@\1cÜé3\ηzÂWù/?Ì&\16\8a`\10ú\9c\8eзKnõ9\9dû¥Cý^_G\9bvøD¯;­cÓ#\ 3áT\85àî\9a\877£ÍÍ\ fæR´ùÿÑû\11,K1\95¿-\94¥\88\aC°ªÜ½{n~\aêÉþ [OÿöQ¬\1d·ûÝ\8fûÓ\83T\9a\f\16\94Q\95A«á\9bèæÿ\87ß\0]µÍ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ã¸\15¾çW¨r¢jZ\18b\aÆ\95\92J*\87T\8f\91\8b\96h7+\12é&©NÕÌ\9f\ f\1e\0\89¤    ÒZ½LæÐ%\18ÄúÖ\ f\ f\ f=\89Q\1cO\1e&öçï\93\8f×ßþ\84'\18#Í'×÷\13\1a#¥&3¡\90$\93ë\1f~\89þ\95®×ÉtF\19\8f(\92\fM\7f½þçäÇkÛO7ý0\8e\11çí\8eÿNKÓ\8d\88¨\982\1d\19ôüö'Þôa\ 2i9\89mëäj:ÃBDw®\15k\8d¬\91\15é\8da
+Dû¯\9fÜ×öª\bÒØ\7fý\9a¬R×\806\r\bE\82ø\ 67Q\7f\85°'¿ÀÞÂ\14ÂÛuÝö×\15ûOw½9\19ÒÛ~7ÓÞ¨\ 2qýü¨IoT\8d\98ð\1fÿÖïG\10£c\e\91#S¢\18w÷¢Û]Õv/i`ID½CÚöGU\88\8e\92\96\9cg\1f\8f+«q3ª\18RFÁ0C\8c¹ÙòdULy\1c=$ë4¯Ó\ f½uK\81¤>\9a\ 3Û\ 5ÌC2±Ó\9aCy \11\19\1d\97\1e/áäèÍÐAFh\84ù\88\80sùNÉ\e\12ò\9d!}9ò²Æ\ 38Ï2#\92#¦Í/FT;GR\82\90[I/î;þ§µz!\11ÇF;bKuèö}±N\9d\ 3ª\8aÇ2Ùu\8c\11\9büwÂLÏ\98ï:¬w\15Z Á'«ÉÏ­\86ÄÕ+×Î\10Jnÿî·\83\ 1i»¡¯h·T\88ÉÎÔ®¢\99\941áHÓ\8eW\96\f¼2ïP¥ã\1d1¬ÓsÙc¼@ñ\9efºë£[C`\81¨h\84Ò0Q\ 6\84\88Ä\8d\88\9d²\8c\11ù»\1d\97?¿\81$\ 42br¼BÊ'
\91p.º\12\8e\r\9f¥<ZÂ\99DÔ!¬OYµYÕ \ 6TDY~\9fÔu\1fd\19\1f@Î@sK99ÀzÙf½¦aÖï@Ü\r\91¸ïªPÌ\8eçþ(ûåñ¦´Y2Ã!\9b\18ÓËïi~Ê\9eö`ǹ5q?^\8ci">ÃÎ?\80V(£\15N;¾fe\rfÉ0Jð)Ç"ÚxXE%`¤\16¬Z¦+ç6¶6Ö\14Í)\81\ e9\10\81\91\14-\a\829EJ\84<\ 3g(\16mÏà*\ 2\98¼ÓÒU\ 4|H3»¯hf\1fp"\8a\82Kh9\11"\158\111x´\8b\r\90Ç\9d\9eölG$\199ÛñFÂv~Ã\e\91E\8féD#-FÏxjì\8cG¶BQz\8bøt\ 4Ú^MàX ù È©\ 6ãÝ\ 5Ľ1\0B\86,\84À\aLK\83Ó\8eë`\7fQ\1cña\1dTÍÇEoRÞ2h}O&\91Â](Ü\19\93   ¼\b\11\16\85ÅÑ\14\96GR¸5顧>\1e>õí\81\95h\18ç\1c*u²\81\87\80½\88Ò\19XÉçD\80\1c\r\rÉØÉO\f\8a»n8u8\89é¥HLÆHÌ^\9bÄ\8b\1e\89[«Ú\9dþ\8c\17?\16\1a\13ã\ 3\r\14·Ý¦ÆkÛ\0¤6 \0\1cºÖ;\87n\8aÆ¡s8>a\a\b\98À\ 1&ÃéiĺhXã ;\8cÏ"\83\9cÔp\0\18\ 1\ 6z0\10\roÍÄ\8cQ\1e}Ùdù23\98\87aé0\8fÙãSÌÃ\ræ±ôp\b§G\10æJ\8bl{LQOLÏ]RÙÓ\ 6#Ѻ¨ê2)á\80ͨᬡöç\0\ 1\84\16C\82£GåY\8a\11Ç»s7C\12«Ç\14I\8e\ 6<w\13\8fÚ*dÈ­xô}æDHi#¦\968Uú°ñ\94Yö±\88T½ W\97&l\94&üB4yC\14ýÇÊ\11¯L«ºpÅ*ÛÂu\ 3²e[(¿N\8d\84§¥a\ 2\97\v\v×y\94¬VÐÏ|¨ê´ª
+\aâ×\85Õ\86e1\80ä\899Y«v(\88P\rkìãsÂb\b\v6øÜW\84ZJ\88é´[ʧñ%\aÜ[³û\8afö0\92'Âàò.\92W\14\90¼\1c\94vzz$/G\91|\ 3':H^\9c\1fÉÓ­(\18\86Ûe}î+\10\11\8d$\9eõð*\1a7\18\82u{\9c]ec¶ÇFx\ e\ 2Í\8c;ú¦O<\8e0\1eÛ·>}ßó\93÷\1d\1a\17\0&'\88Â\13\1d\9a\13~Hpo\vØ\ 1Á¨Ã\11\8c¶x©\8b`\8cA[¦`Þòì·¬È\ 3\88_\11Äðk\ 4VI\87\80ò\99ÀêíIç\82\19!$¤\15ª   ¿^hïó=ö~ZPù9½0\82¡·H\95DþZcó°\81+m[î[Icä¥ó#\ 4\94h¿ e\80FM8.        ¨'\1dæ­nPê¡\91Wãqèà ª5î¡,}n½|?Q\f¬Ø0ó\99`q\fÌ\88Oâë0\82\f\ 6PZ\ 4;7#Ø~z\ 1\9aaÎ3ß\84âÛ\\9cHí}\16?\7fgR?ÿ£Jýü\9dIýü4©\1f\16×ï\ 6\0\86?3Pj¯ë å\8fU\95æËâ\83\8föl´MÙÊ\9e^\81H{C`\91Ç\84J¤uǯ\9cÙ³ÒC®Z»\17\f±Íã\17üZ¡Íù¥"¹G ¶6j\ 1\11
+D\85äA\90ó|»b/\17<¥á+\8a\8b%6\1c¯)ó\viÊíé\9a\12\9eôê\19\vg\ eCÆg¸°½\95ÀEQMq¬\1c~¦Ê\86|©;W=nÊôÜ6íö½Ù´Û·|]ó\a³ió?mÚ\vxÿùÛõþGÙ4F$$u@Ë\95ÏHù²Ir\88|×Y½»~ðÑo\9bîØ \19`g
+y´N\1e\1e²¢Lj\ fê\ 2×\13\84Ã5ÿAQ\83\13\rÏùoGoOQ\86Ð9\a7\17\18ás\ enBÒï\90\13é5\10\9a#\14qrqª¼%ðK_Y\8aÆr\12¤\1e%\18}å¼\8fá´á\19\8dí¡uf\9c,£ÿ¯6éO\1dÛ×Ró\9e\8eÑ®\8e\89½ÖýÒ2FÞ\82\ 2¾9\19{}ï6f\98 ³\81\9eÝ0uS}ø^W`â,~ãr\16lä¡Ò[ÐÓpvÕ~·\8e§-à5<*±wÔ\17_ýÙ\ 5\ 6¿\f\ 6¿`r«M¶\ f¾Ç /\9dÆ\10\1eã\99û\ 3\1e+x\85is\8eüIt\99¹d@\9b\9b\10¾©^\14ùbµ©\86ÞàùA×­\8aøés\a\97N\ 5\1fdûa\84¯\bµ4\rº-mE?ñª5û¶b7ûÇë       S`Ûg\1c\b ü³«¤ª6ë,Y\17h:\93\1aG?Cy:c\8cG\8fIi\8eä\99ûÃ\1c¯íï&÷\ 5C§M]oJÿçÒ·+Ó:[\14+?Ä\rD,mÃÌ&·\15\8ecÖÍpÞÍ}ã,JV\9b:±yrD\85\ 4\84ÇÍÓÍOÓ\99\86.jb\8d\95V6¦î*pWF\86CP\9d\9eV4\83\8a  /8Ôp\92\8d\82÷ îëc\99}\ 5±ãÔÒ\ e~-m¡PB\ 2[ºÚÊ!å¤ió°I\1eVY\92ÿæÛfy\9d\96y\12øï\0pc$®àé\10\8e\92»;ËÞÝs!!\1c\ fÜ3Ój³X¤U\959^¬S\17\95\ 1E\10t\97·SÃ5\eØâê\1eø\9aäKÈE\14,2«\82\ 2\8f\8cHeÅ:óÍì¦à{Ùl\bZ-3WÝÞ\10¬+nKE\96\87ò\89\9fæݵéoð\1dk^Ðø«ÀÚÊ\94Ô\90M\99¸Ò\17\9fp¢âÈþ\9aªb{qh\97\99¹\8f\99'B\99§ý\ 4A£n1>\97°u¥¨y©m׶]ö:y|ì\aº\ 4i¿-\91A\bÂ\9bGCv$¯pE\99¹¿·¤\16mPH9bªÍ\90 Åw÷ây\91\e½\8f!n·rò#¬ü°\98\99ª¼p\1fï7¹'0\8bEô»«Ì!\91ÛvMóªp\9fÖI\9d\9a\7fÆ\9e¸OKÇ>(\1aÛT¸²\19\ 1\92ÅmDÐÛ\16ê\9e\8fí\16]Âå0Ì\ e:\10ò;\1avy\9aY\11c\9c\1e~¹#;q`»À\8d}çG[\96\94Râè\ 3\ 5O\1fh±X\81ª-|\8b\e\9bh
+¥¯6ßn\99|pÍ\92¥«N«tý\98Ù[rÊܽ¸©]ew¥·\b\8aÁ\7f1Ò~?h3Wiô1+ÿó¹0ú/ào\1eýB\7f½\99B\863VÑ\ f\r\8b\1e³'\8f\12Aÿ\15ÛÙ\1cÛh\99.\v«\8c0J\92o\93íí$«ÄµÉS0BI\99%®ÙÍÍ¢X?\1a1¸ËVí\bñ_ûæ¢.­Qô*ÍqO¥{G65\96½s\92\ 2·^ÜØ¥X\r6¿\ 3\1a\8cáaý\1e°ÉPÝxùèSêÞ/À\1eËd\9dd®lô®N\9cÚ\15\9e\12¾\95\93\89Vn¹ù6ôÖ\81Ä\ 6x\f\838{/)TÛsôòùr\8f¨\8cÈe³uZ\97Ù"ùÎ=ðH\17Fª=~ÂÊfÔ\1a¤\ 5\90\fF¢±\aV\7fù\1few\8e¸
+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Ý\8fܶ\11\7fï_±ÍK´¨\97\11¿DÒn
+$\97¤@\91\16E|}ê5\86n¥\\ 4ìJ\97\95ÖE\9d\7f¾3$%JGj}vÎI\rôeW"Å!9\9cùÍ\1779ÉóÍÝÆþýyóåõgßÐ\r¥ÄÈÍõ\ f\e\9e\13­7»B\13Å6×_ý3ûû©»ßîx\9eu}ó¦éÚ\1a^\94Ì8Q\9alÿuý\97Í××\96\86    4¨à$gs"ßne\9e\950R\98ìXÞßoá¿ÄÑ\9f}#Ã8É\89\11\9bÜ\8e¨\/\ f½\ 5É\8dï¼É\¯\b½\82H9ö2Á"Ú\9cpæû_D\83%a"\1aÌ\93\83o¶®w¶]M\ 4\9fF\17r+\94Èj·×s\8b\9b\86½÷õ±Ù\1dëáÔìÝÞmwÓF뤴 F{rßEs\19\92Sß鸿ãÌ1\eÿ´?1ävg\7f~X\9cÑ\9c\9b\9aHµÙi8"\1d\96n)R\92\17@\17©bÇ×Û\1dS*»-ÛòP»ç}×öC9\94'û®³ý\96©ìÇ:Þ\f,ª0\97NT?8Q\99<ÑòÅvG\8b\8dH\0·x\11\8eÆ®îó\88\14Ë     û\ 5Ë\18'¸õË(\1fµ\8c\91W[V¤xÃ\vÂÔÓ±&±&E$\8fXcÏ+'Û\9d &ûk×\83D\96ÇÎ\1d<3 ^\1c\ 4@\10!ì¸\9fÎM[5 ¬\85Ê\ e\85Ϊ¦?ß\9dË»CS¶o|\eRiïº\ 3H\ 4\90\96E\9e½\84\86.>\bV\10­\1e\9eªýGNEz\a¢8*fyºmìbë\169:ÔnUý¾>\f\8d[ER\9d4aÅR\9døEuÒ\92P=çÁK¤\8egX>s\ f÷ÈĬ>¹·æ\80ÿ*û¶>\1e\ 4Ø(\9fEKÉ\81Á\82\91+ô\8c\bE\15þ»ÎWÑH\838\93\19\ 58,:JÇ÷)\12cg¼w\11Ps\84èÅÒ&©\ 3\9cS     "\ 5ýMy\12\8d,Bç«K¬Ø{íIr\93ñw\98|ÉM5\13$*iö\87\98iêi\10ì\ 3        RqI\90>\82­_V\80K§~Y\87\1e%r\17'\8f\81Z\ 6\9c\1eµ/½ãç+î\88w;©Ê  ×\13ì\8a\1cÝξ>½¶/t4¦Ï\9cù
+@\8c}\bÄ"g#\10c\13x\1f\1c¿e¹ï¥à\88\81óRuîåX\1f\91àí©ssUõáà\87>°r¸ê|n\15ö]Óî\9b
\90Ð\12\1d¢h×°\15Ê>\84\8cÐ<x¯\12\16\8f\18¶zÄ\9a\18þ¨¡ûUÝ\ 2ûÁ×\ 5ìÑÓ_\1e\9a\14±àÍÜláX%\93èH\v]dý¹t\añ\1aϳ;\fþ\15\8fðàÏÈ\7fz\93õ\8d{B_\1cýVð)\1a÷   \b\89ó\805EU\98\1d÷Òº«\84\90\83\ 4çò©L|\82qëÆ\0ä¡à«,W¡3=ôá\89Ç$\0í\f}Ôôo96ÐWÆRpª\ 3èþ\ 2¶½Çæyzós§
+\82Cù«í`Ý¢\19\8cÇVUgv\8e\8d`\ate\aÅ\87\80« ºß_\16Ý\8b\8f£qI\ 2.³íQFí\1d\1d§>\9aR\98\1føí\10á\92dSóÑK¶ú?º¼ë\19$\11^Ë'Q\93\95 sǸ$\85þ\9fÑ\86'\0\99\8f^\fW,ü\a9ÿ§J:<>÷ñk(Ò>©ÏÅSDBLs¢]\ 2öªqiem²\ e]P\f7\8e÷\87\ e©MÌ\81#[5GÌç\956K?å}s"6ÿÞ\b oÝSGö\18\1a\94D¯û°y9û\92Ù\8e\ 2ã\17üRc°;6$¾\ 4\9aÅâK×0ÿR\13¡\16³û\86\97×\ea3é;\9e\17cRúêÇæ\Ù\ 4å\8e\19aw\8aÿ}í+\11ør*÷û\ eâ´\1aº±­q\7f?\94Ãà\1fû\12¿°\99CÛ³¶>\8cÔîÎ!©\88]CÝ\9dêcùÜ\9d߬:\82ð%å<Ù~½\ 5
+îs,\8cp\f\ fÌja\ 4·\8d){Ctá£Ü8q\8b\ 1\16}\94\1c~·ÝéD9\ 3Â\16\9e@QÁÏKVBÖí\80
+Êã\15à\86)\1aë\0#L_*\97¨\11LÎ-ÖAtvÂ\9aH=@<\865\8bCçZ_\97\87óP\ e\9d«\95ø\8aJßÄu#
+:SÈ¥Z\9b\ 5|M\9b²º\ 2´£z\8cKþæ\86(:\8fûnn\1a\10«a(?qÓWñì\85\ eq~à\87\99³m\ 2HÌ»Ã\16¿Ø2\10fx6Ù¡;Í\8aas\9b\ 2kø8\84 \ 6Rxxï\82\99«\97¥$Â<<µ\8eL
+*\b\17^A\rZ\1aø\9c\b\a\9f\80E°N
+\1c¿ò°\89%\ 4\9egV²`j[àP\12æîÜC\7f\8f\18ê\9fÃ\94ÝeÄ\16\e\17X\8f@+eóSm}äÚ[\8a\85Â$\93/¨ÔÃ\0À\81U\ 5e\8b\17¶õ§sÝ[dÇâÆ\88sn\ßTµ+×\8c\84\9a¶¶E8|½\99H\1c˶©O\89¤\15PF ²%\14åÐ\ e\8cʾk÷M_Z«ir\a²¶\19¾>O@\9b»\85ãÃ~ÆGDÍÎ\r¨\1a×mù\88\r#\1f±Ñò1^\91ç,è\852Òåü\ 4P<\ 1pc¾F(K\15Ûl)\15\e\16ëÂ\1e`W[\95§
+3}à|̲\82ÐÙx*ÀkLæ¹Æ1Ï'\90Ý\98 \8aÖuj,\8b^{nc¦©rVÖJ(ì\1a\a\ 2\18õ¾:4\0o;o\87?ÅRi3ö\1cË\ 1x\ e¢ìÍtç\9a«q \96×\99F!¿k¼E¿\ 3\999Áºfvd4\8eBjĺÑvì¸f)|`" ¬\a\b\9b\92Öf\9e¡A\82N\13àaÒ\ 4|\9ek\82mAÁÓ<\rÉŬ\\7f\15\ 3\ 4\9füõçMÛ7õÑ\12£öhFºçý¾î{8èÆÍ\a,suJÁ\880óãº*Ï.\97\87?ÿ\81¯¹W(nRÜ)r\1cø\90;Å[¹\83ð­Xö\ fO¹>Ô3\15À9Ý
+\97ys\89.Ï*#X\0b\87\85\85ã+\10\9b\8a¯|¼H\0\ f\81)õêö(\80ßäÉú³¡¹CnëæR\89U~çÀ´     \87\1e"\86±Û\8a\ 4O^U`p
+tµ´
+G\9c\8f;óéq@eåóüprr2È\82\83Ö\9eºûSS\ fÞÕÕ\99o\1f¯\16¸\8f¬¦XÕ\ 6þtwm\93Ø;8\8f\81¡\f>\ 5±ÿS|°£\85Ë\1d1\0×~ð\99â`Åç\16\17\1c»q?mÒç\99,\1e\88\81\a¡¶\1a\1dK\ 4§Bfm9\9cA³'\ 4öÍUy8\8cExp1\8b\19ÖÕ÷q-\9d³YZ\ fw\1aG¥j\91z\ 5\80\1dÜ\15\ ex\1a¯%Ø\97\0\99Ì\14\1a\e¾;jG¯.m\\e\90àý\ 6_(OI\ 5Õ\91³4O\14äx/e\95ÍÐ;²ùÔôgLô'.VЧ«å.õF Þ(3_\9d\(\ eðbì_f\1aftÐ;Ò3BÇh\91𥠠     \84\12qä,ùøG\17r'%\0D\89Ê\99ë      >ÐW¥;ä¶ó×wL±z}G3¢×õ\9b\119bhß\8c\97'r¼-³ô\9f\8fÇútW\7f\82S)\vÊÌèÌFt`\8e:÷º/[@ù}7}\14Û\13\89áê\1a\8c\9aPéFw*çàX@Ü8\vê\94\ f\1e\95½\7fV&\82\ 4P;O¢\ 1÷    \ 2Ç×±l\89"¤1â\14\92!b$¡~\9fL\r¨w\11½\85ÔRùÀ\9f\9e \94\1d\1a     &(Áø\81$td\8f\17\12x\ f\9dSìô·ÄÄ\0\94\13å\84?"Ñûu±ì\17à!IêñÃ>í»û{tRð¹²mjiÕ±#eÀ
+\13ò\91\8fUD¾¦\88\b~8Q½:\1f+pÀ"¿¶`¯Ño\9b\8eÇÓU~\7fÎ7)&ßDR\99\92p]\84\ 2ûwÉ\ý¨\8b?{æ\82\8aÑkàãöÊÊë"×\ ef&]ôç\ 2\16t:\17\88\82ì2ÙÂ\99IYU\16bÂõ$\1cx\ 4Óu¿¤\12\93\­»B2Ü´û\19Ë»:÷\86©\ 3q±~8®³D[\88­ûÆ\ 2\18î\ 1\8bûØg\97\7f\ 6¼éÜ>Oµwî\97&\86\ 2¯ñòcðBª\84\8cåóC¿J`t>Çè'J["D?ÿ\1cÿevh\8e1QIø/¿Èø~¶\8d?°m*¡+\98kaï¤\9b`\97
+óoÑߣ\1cü\7f\f\96Û骱uǬ\84S\94pAÙ\14\ 1£\88Øx\11zËvrmðÕfùð;ëß\1dýGUí-\16EoKεÄ:f(C\8d\vHP\86|üá"O´\f\rZ\19°\9c\80\1e\b\ 6C\1c\0\83úÁ\a\8eðì\82Y{çÄ\86Q\89¨Æþ/qâE\1c\93ÎF>sN«\85\05\v\1c\9eE~2 \82½\0A]ÄÚ¸ÇòöÖ-\10\9bºõ\8fè¨ã6N\1dú£Ð$]Ô\8f}\83Ó<á¡möùë­\9d-\11ÞC û¦Äà\1e\16k\83{\v>îò0¾a\8aÃ^"Å\8e
+óÜtß\1d\86)ßí?
+'êÓÝøùÌ\8e/ <\ f¥\8c÷Pkpk\84
+òù<ÆéPO¹\8a\93n\fó\87ÓMr\9eºh8ݱºJåì¦k\88Þ\81(\16ÞÜ\14\8b&ã-Á\12\91¤°9\8b1Á)5^±\9f\vU\88ê1ÂÌ\93\91\1e8\82Ó\ 5ùt\f+¦ò\90\ f×\90R\r\1a×â\15)N]Z      ÿ\17\13\81(\8bËU\803!ºH\99\17\1eü¯¤¿\1a\8eÆ*¬ÕH\Qãþ½Û\17\87>\94\bý(º\89EanïA<\97L\87L\e³\80e1¤nûnL\8a\f\13²@\98\Þl_à-5<+Ð\16L!Ʀ\96_º÷\f\13NÆà&ë,\9aA\18ØX,µÒ\83®ÄÙMy\7fª1?x\9c\85²Ü\17\8aÎ>\r\ 5\9e~y×´µGV\93£0Ï\8c¬ã/h¾\8b\ 2Ø1ÅVù\1d3\17'`&,å\1cÂ\93\ e©¥\1dø\94ËôÍÜ\1c\19bÞbÅéÒ\18áÚ\85qÅ)\83¹
+\9bB¦ÞñýÝ\7f\ 1\12¹6\86
+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[³Û¶\11~ï¯Pú\12jb!Ä\85\0\91L\1fÚØî´ãéxl¿ùø\81\91è\13\8c%Ræå4ñ¯ï..¼\88 \8eNâL_$
+\80\80½ï·\vnR\92¦\9bû\8dýúçæ\1fï¾\7fÉ7\94\12\9dmÞ}Ü\88\9c\b¾ÙÉ\9c(¶y÷ü}ò¦l»b»c\9a%\aÿ}nê-SÉÃ6\13\948H\93ý\96Éä\17ÿãX»\95í¹øbÂsy2»SÙ5fïGî\92í\87wÿþþe6\1eÏ\98&\9anR{ôOÛ\1d\8fð)UrpkiºQD+\KaéfGIî\17Ûù  +\8aÐM\98½ÛÂ\91R$wLf[!i\12¨®OçcÙÕÏð§Nê¶5\9eÉÀ\ fìºÙ1%\88\90p\18|  »a}_\19·EÛï÷%ü¯®ÊU¶rM\94ð\\15\vF$¡b#\bçv¾Z0\92\11)6»a\81å\ 5\ e>\18wÞOEï\88E¥üææLµNKJäRÀòk\b\18\ eþÅ\8b¯÷\ 4\1cÍÉt^0¦Z\12\1f©¹<@\13Æý$Ùî\ 4ãÉ+¿ý\ 32\6æ\8eej_¸£«ºrÚâ© \8a:meößç¦lË
\83¶Ì3à\16þ*é¾>vÎ$ò<)~\803´Lö\ 6\97(Gº)Nµûiÿ\98\83Å´]Ó\e4{\1cE>ñûîÎqú×¥Iç\8a° ü_Ý´\18§é¨\ e¶ø/>°[Ä\ 3öËÁ¼»¦8\16íÞ\14Õ¡ö² 9Ñzj¹Gd\ 4¤w\97\9cMßuÀNí\ 6\8e}u_ \1eñÇÁ\9c\90Qt_´k\ e¢Û£ü\9c\89Ô\9a\ 4þ\ e\11ãNs4"¥W­(Õ\9ba>b°\82dÙ5ßÉÐwÄÔw²\99ïpë;n\81·õ_\17\83?\ 4Dp©$Eråg¿Yþ5#,̦Ä\8aýÅ;\88«!\96R&\89pÜý\v­ECè4M\aF\9b»x\94Q\99ônâP\1e­~t\ e\8fUk\82ujk~¸À,å\ f13\ f1óÍ\92<NT°°\88\a\82adôF\13\13@hqp\84¸\0\88\84VE×\83Ý-\rCç$\v'\7f\8aI|p\8b}Ý4¦=\83H`ãêPº\8d{/­ò¸óaX\v"ga¸<y·®\97fÃHªæn7³\e\99\8d±íSÌ-õ\10Ü"\8eÉÇ\80\1e\119Ø[0Ù\ e\13B\8d\19R\b\89ÁeI\13#<\1f\89òº¢tX\90\11\1a´ñ\r\8dø!\9a[ø÷aA\95õÄô÷zÙ$CYiÁÚ\1d\ 46½îwbÃ\88\96\11·\9b¦\18 W/ô0Ë}\94M\93LDO<DHð\15åO`à  \8c¢ïBB°KhpÏ\94\88|óß\rS\94d\90\)\87õbs\82h-\89Î\87\81ãæ­EH\13\92\87¿\88\8c¤Ù\94ìÉ©`§\81ªïèÒ>À4\19¬¡,ä6\ 5fþâç\9f­\ 3\94U\89¾¦\94\rÕh9S\88q)è\1dd@§>ñkÄ\8b\84\1fþ\86g¨(öJ  cOs\98+\8aÂÌ\934Å9¤^éR/à\8d\12\92¶,»Î\0\80äI\11<¸t³Öé©\ 6§\9fø¶Ý,\12ú\18\84VÅW£\17xi*\ 6\93\1fÀ\1d\r0\90%å°µý¾\84RH\90ñ¨\82å\14Ï\9a \8aë^ô\ 6´z\ 1^ùLØ\9c\ f        çnû£\83%\88av\1cU^\1f\ 1\94^n/%ºÕ\1fHµô\ feZñH¦\157fÚüJªÍ1¦\Iµ2̦\88y2\80ðP` \9c\19UzI\19\97\18\87Ò\15ç\80\b\18AF»\80(m\8dÑEk\8bbQ3!E_ø¥\1d\88È\94f|\ 4\ f\17¾\8a_¬c\89Ñ(¹Ô.\\rÞ\7f]­7"þ\e-hKü\ e\e
\80ÚpÄ)\9e\ 6y\e\91\12\ 3=a\rà\95Á-_-v\80³DÐÖÎ\16\90À²Ê\9c\8fÂ÷\eS¶_F\945#\8f§$Ï1$¦¸\87e¡>aÆ\95YR¸`böæ\`HÁ±ÊéR\800\8c\9bnj\e\83\ f½\ 5¾`bY\9a&æè\96\7f\ 4lââ\95\fy\1dF»²nÊSá~ \95¸Ý«Ò\aóö¾/C¾\1cµô`Ê\0«\ 1dw]á@¸\ 6\8a\90M@\86\1dÔÝþ\11+\10\86\80°©üÈaXT7¦ðcÞ.a\13ã(,ïgø\1d\99ý¶8áÔÏÆ\9d\87\16\v\81v·$ð¾\18£²ðþ \92{ ÚB=øÅá\98Ö@\90v6ÉGÇ\10#]vøþhÜpÐ&\8eúo«M,îr\99¼\1eS\85/»`ÁçÞ<[\92\87õ-Ϲ\13\r¨«v?«\12ý±\80³\83\96J7\ 1¥\8c\81êÆ\16ú\b)-¡¹X\949¹eÃÍy½\ 2q2\ 5\85~k\ e¥/\1e']\84        e.)8uú"Ê\7f¿Üæ4\81½\8e\96l\18x/?<{¯>D\8a\ 5Î\18\91\ e«¼F\ 5\94\rÈ&K\1d\14\80hwÀì©*ã    Æ¡²u'â2k~0\16\1a/ö/~Ì9\8e}l\9c\85<81\v¡-¬Ç\19\8cxøý¹/ \1eüìm\17\82\86õêQ\ 1h\9e¾nl{´«æ¾\9eækW`:\17hÜoPîél¬\ 6`\14D0\8d\1fÁ\83A\96\f\ e±g<¿à5g `&2õ}=\ 5U9Öa\10\12)V4¸Á[ä\9cËAhí~\v¬.\13\84ä#\ó\ 1IOc\9e\9eÄ#ÜÁË\96gÀãÁ\9fñfËD\82\12FwÀ\ 1«1ø¶gÖç³)"u\ 2\14\96ÙM\98ü\ 5\1c\ 2÷\ 2ÿ\ 2Ò¤C\8d\ 5a\ 2hb\82á\93\8a 4°.J/\92¯\8e\1e\88\104\83jì!\ 299T*RLÍáÅb+À^Cñçü\ 5bwéBx_¡\89\0
+\9d\8as\8cñ\13aºárÉ6ã\88GG¾\ 5\r|C´ú´ \86ec±é©\11#5\85;µª\9b\93\7flûX«j`hÉ®&\Mz1`ªÅá`\0ãú\r#\95·T#\v/\16\15\84ÆÆØ\90÷¿\8bX%\82½a\81?ÔVÑhã]\17\1a@P\a\ 3¾\99èªÀl¦}\b\94ÖÓ\97:Î&\ 5nT¹RÅÄ    aÓÙ»k«â\b:\89!%±\917\8bLÏh¶[ \85>æ!\85®il-ÅýÃ=\ 3V\86QX\87Á¾ó\81
+\84*f­?S\1dj\17\90á?\87baI\19 051$Æ\82!±¨!¥$\eªè-YÁ!>\98\v@:L\8cÁ¼À
+Ħ,Î\93º)ÜCaÓ&ã\ 2ðEsÂuý1$$\9c/\ f\97ë.²\16NÚ¬\85s¯ÊÓÉol\eÄð\ré\a\84ÔÕ=Y  æo̾n\ e>çÒlìTØ\1f¶$ÁB\bó"\ 5ß0\ eC`G=\812%\ 2y\ 1ËåO³ì9 ÏåÄ´[ãÎ\r¨Æõ\87\80²@\10PX»'ßAjÑñp±\1f\8e5Í ôÊ\v\ 3\9fUÌC[ú\99+\rm\91ñ\0»æ\90Ðê6DóYXä\10?#Qñi¼O\8b(¨Ö\17\91/\e]ïc¤\bÓùj«yÒ\ 6\88\9a\87ÂëE¬c!ÃÆ?,#\19ÉÔ-§Þ1\95\ eÉ7]ºç\98 ï#ÅÑÀí\12Iì(\95\11O¼Ûj\88R\ 1¬\ 3È\11\84­¢ ì\1d \vç\8cdÌ£\89¥Î\19Å\1eÐj\98\14£\1fô\91Ö«\1a;³O\80\1d4ÅP+( ¼\b¦\80\82ph\12^\87\14\8fõxV\8aÑËfÜ,      \ e\95´Mª\96ÆÞFk\e¨\87Z\19y°5uÑùewX\9eøF\vÏmÑ;ú\11T\ 5-FMI]\9cÃÜðmÝà¾\aS\95îr\8fF»ÛiF¨|4\14ñÇ\92,\1f/¡hòwD'>\89:*\96j\10A\aØèµÕ¶©\96îÊ\ 5\11\86\9evJÀzÂtÙ\9aÖÞ³Éè=\9b\10co/b§\f/(ܬß\ 3\92r\7fì\96é\126JÕjO_\8d¾þ\18ß\?\8dqqÑi\1a;\91®\9f9ô~ù\f¨j\92\8b)\1cX\92%âd}º!¶FhVú:Ñ~>º»\9a\aØ\89\82\0û[\97\18BÙë\ 6ý©¶\1f\1f×P\b`!(\84v\19Ïð~è2ѳ|¸´ÇÛï\Ûì\99Ûr\rçf\95¦½\1fOm*f\03ÃMMé\96z¡ª¨®\19×\18\86\9f&8>5s-GÁ\85þuÛ\9f\17[q\8e)lÇHÎÖ/PÄ<\ 3\1c'\a\9f\b\15\fï3üÎ\ 3\9fÓÞ\99@ 9rb\16§3lN]fÂ\99(\ 6h¹ô`åb¯ßüQ9.\11\ fÇË¥Q\8e\11gÉA<³^"Þ¶\v§_\fÕå\97/\85+Ã}«\açf=P\9c\8bõ@\95\1a3Ãï0\81lÆ»-°s÷î\86µØºé<1\93\976.k·\¬w\80ù\982Ѿ2Á®\87/(\8e\86kÑßÁ\ e<ðÉ\95·\ fݾ\9f\9b^\×ïm\ 3\93Ë|¸\11\91®Ã"£7"Z \ eWa\1cTu\ 3\18sÀZê¤ïÌÑXÝâ¯Ï½\1f¶ðZ¥ÉÇÂ\15fR¯Ê\97¢\8fg·¢i¥]ÿ\ eö\86âsíþVR¼¢\9b¡#¾\86\8e\10\19Ùë\06{Ã\ae4tÊ\19\14zSÁ\9e\8b¦\83pxÄ7\98.ãm6açy\89QöP~\82Jri     \94\f\99\1e|ZÆ\11\84§sVú.\0\83FÂÆÂr'E\96¼ýØôP¼V¶¿©U\88»fhb.2yªñÕ\17·\8dGHe³³è«®:Sõ¦ûm\19ÜÔؽp®í\8d\vé!{º\ eÉ"mÊ\ 1ŬUÐÓ\16\94\18ÁÆ\1d\94º]Ù\98Ú¾NÃl)×\96÷}Y}       -T Ç÷¯\8dç¾+­á²h\97\86j5¾Ï\10µÄÁþ·Ïü.¥oÑÏ\98ÂbÚ¾l\0vÃõÍ\90@L«¢I\87*òbE\10B¤Æc£U}ºfú±,\98Úâ^ßò\12A4\afWr H6l\1cK\81;{\83¼Sx%ÿ§¤@K©ßüÖ\14(ÖR`L)|ÐÉ*Ê ö­\86ë\ 2~
+ȸ¼ûÔ«Wì9¡zx\91çO\92¾¾&}öU¥\ f\12Îã¸\9dM^{[1qñ\155ðÿ6q±fâ\7f¬\ 6ù
+ö¿\ 4öÓRP"\1cN\1f¯gþÜjéÇ%\92¥\12p\ e\14>\10¹]ÝÃ\99/\91þò?\81þÔì
+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\12\7f¿¿bq/Õ¢^Uü\94\98 \ fI\93\14-|½ 1p8Ä}PֲͳVòIZ§Í_\7f3$%Q+i×ÞØ×\1cp/»\14?\86äp>~3ä"
+£hqµ0\7f?-^\9dýð\96-\b        \95X\9c].X\14&Éb%\93\8b³×\1f\83µ.\974\ eΩ\14K.i\90-WTñ Oñ_\ 4MVk,Éà<hʪpÕ\97eUg¶~Ûè<³µEÙ¤\95\97T\ 6×\8eZ\91å\96 Ä\91\elÚÚ
+\1eÔåmå¨\9a©¤ÚY\8c\b¶uÚ\94¶¨s·\80´\81ªßÎ~YD\8b\15á!çf7f/wwº|¶\q ~\v½ã «\96+&â ¼*4\8eùá­è9\92Ð0\ 6"8º°\8d¼o$Q¨\88k¥¶Uz­Pp\8d¿ÚF\8fÓ\84\86\9aáüò>«\112\8c¨\eõ¯Ñr\14îÓ6\9eÓ8\1a\8d&,¤l¸\19oE2T\89k<\81%H\1eTºÞæM:\9a\87ó~¢\9b\11\9d8TÒ5êâÒ6\93\b«c³\b\1e\92\18\ e%Ll\17×\81t\1d(\8aàî.<\ 22\14Ép\13Â\9f\ÂR\1cíß'ÆJ1\9aÛÛ\19\v\r¿\ 1\ 4Å-Æ\92j÷êMGUHZ\ 184ÛX|\84¿Ø1#Aº(ï8ieäNW\8d\11\13£\ 4\82\80¦\181_1®B¦¬°\v3äÂj\15\ 3\94 {e¡Ý§\1eóM\81ì´rþÆm\84v\e\ 1ÒrÁCfµèû©\95*\98»ëáM]\80B\8f%Hr¤ØJÐ\8aR
+\eâÔ\96Æ\9c Q\7fæçËÐìøÍ\19Ø0¾ø¼àÐ-\ 2>+8{²Øtß\89
+c²È\17\1f¼~ÔÖ+Û/   iÜ~\8fû\ 1=î÷³ß~¿\ 4yæÍk¿ûy_\9d-8Ô18\15
+k"fý?çÈ\184\9de\95m\1c\97.´­<Í>\ 1\ f\92 «¯¶\99­ºÈ*}·\14,0]y 7\9bìB§MºÉ
\94MÛ/Í-­<ÛX²Â\91\95ÁÛeB\ 20\92Û\13[_V©eâ\8aÄ¡\10¾\89|Wéá¢d`çÙ\16k\9dVyi)Tz]V°\8cMiû8{~âF¦Öú\ eu\ 5&\89äPY\ 6ÆKÅCS*\ 6¦\94&CñdþP\16{\96\v\16P»¥[\93Z\16\0#¢+Êb,\82S   ù@\85éP\85y¨öH>GÁw\1d\9e½À      ã ÞÞ\8em\vXßÖâ_\8e-{o}\7f\7f>\9e\86ôÞ"\9a°#\89p\8dW£¡\1eáçã3IBÉwì\17ñ7/ûÍ\83\82\92\7fOÌ?e\81\8av<\13ä,\13T?õ\8b±\17§!§\9dÇ\99Ú$é\87w.Í'\0.M~\v\87'+\86HA\fü\1c\9dÕD9\1a9@ \9dÀ<{1u\82\91§û+\13\18N_\98¾\9f2\ 3±Ü'®bJ\\að J|qu4<\9bÀâ\ 4\1d\ 4p§Øél     H±3ÖP\ 6ß\85\ 5\ 1\98·utðñcY,Y\14Ü-\19\ 1\fw\95\15_\÷×åF\17`¯=Ç\85¨[ù(B\861Zá$A\8f\8f\93~ÐéXYÁ\v\92¡\11T\ 3p\17·'³\1d;x0ô´=òÓÑ`\ f³­êÛ%WAúE£i\97 S\89&5\1d\1d\18º\82\90ùîã<\18ÍÌÑÃ<\b\19\88\1c-<éÐù\16\83\ fÆa¡Û5n`½\14\11øÑZ\97Ef\er½Ñ\r\1c\ 4~\ 1\80°Ã\16묨K[¼À:\18\98\7fWVHåB\17\19LkÆOÀ&*T¯¡\93\9dX\93æ\99\9dc}í
+\10<ÕMzb?&¨C(\93 uð@Ýx\ eÕ#©\93        y\8f\91MzÜÖn\ 3\8bƶ\82\85\8a\1e<ÀXù'¨F'èÚC\b¼\80½/\97\80dr\fÂ\82Ü2z,\\18e¸i»eùF7éÑñÍ^£{Ï5ó¹5ßL\ 1\8e{y\93û¬kÚðN\8eìNkÄä\15Q f\14$\86\87-\8eCù/ÍÏåÀðøÆ<Fù\84A$\14Ì\ eC\1cgBP\0yÚÁ'\8còDz%      \82þ{\b\97\91­¤Ç\ 4ÞI°È@u\bù¨\7f\14\9eQ\17!aCX\bß}cÇ°q\84m䣣<\17\8aJO\10\8e\8aEÕ¡XÔ\11?(\86zÂ×Æýx§¡Sû &$\1e ô\90\8b|\1f\17ù>.\8a~\11SgHLüÓ\9fá$\17Õ×Eô\1dñ#¸èbzÏ\01\11¼·©\8dÂ\85/ÿÞêâBO\18`\10r\18í¡\81yTÃ\ e\85\bÌ?ÇINRtÃ+p)ä    Î\114½£<%E«\b\11Â*Fhø$Ú`\96Êè\ 16
+\9f\8d\1eñ\b"ë6\86ÖÓLf\18_:\1e³\19]±æ\19\93Gçq\8c(®£<yÂÆÞ*$ò\ 4É/\13ÌuÄ\1f\9bÅ\ 6;w,\9e\8e%ÅApÎî\11K²Cn\ 3\15%þßV\94ä\81\8aBfN±çä\83t\85ì(\8bü6\95å\90®¨GÖ\95¯å²\98S\97g3\bÌ]¸°\88\86ö¼O]xâ\82\95ìË\17Wa²q<\99\8a°\94\b\13þ@´ËæЮ\8dvÀxnns½Ní¤Ýu\rÆA.ïX¥\e¼NÁ\84¥\f\DcC\1cTÚõÚÆ^º\8d¶Æ\11)\ 4719\94,\18æ\9c\87Ü\a%\99Ù\92a¾ñ¦þ\96²Y\ eR\8a\18æ\80íb|¯,ì]\8d\1a¯¦v9É\ 5&ö1\ 5í\85Ñíé\e´Â-*/õ\1aù}íîãä\92Kf¶D\aWGØsêê\880Òg©\8eH¿ªÙô+^+µ\84ï\96\82\a\18éîÒ_Å\12mj\9fkýêØè\98ôÞÍ8\15ÖÇrû3a7SWx\92\1e\1f\a~sy2>\9b'{Ú\bøÐÎ\1f²®\ 4mY43Úg˽\16öÕ<Ûcñ¥Â\9b¡în/á\10\84¤Ö²\8e¯*\84wu2©\80²¿øí/Ç\91(8V\17Å×xIÎ\12\81I±¬Êly*S\b¥\8e\89§û®wWõ-¦        1\81¥T{×\ 2VßÞ
+\ 1ukƪµ¶\9f©M\96BéΦ\19ô9\15ñ:uWQI\8cjìYAkïƶ\84F\b\eîqÿ<\95Î"&¢=äuØ>¯CçòFC·³_k\86ù6>\10\90.\87~\9cáxÌÕO+ȳ       ®\93\96«ï\96\9e/ÒîVò´½\95\8cÇ·\92ö3ýôÉHÎÈs\80ãb\ ft\1c\8fiR\1e\86\92Ø\9eÕ\14¾\8dBÁM\10ód1Ì\9f\18ëÓG\8eõù\ e\9cê\90õ\8dÕ$óJcôn\80ôïsPÕVDÊÉ\e<Öç\9a\1fÃWïª\²Gå\f2\143\12äMý¼÷'­\ fá\9cás óââ»4o*0»\9cª`Ýú\91\13̶\83ݽ5P¾¸Àv\16áK\ 2ÎHp~^Ù\aQF_ëµ.ÿjÇç¥íP7à*Ü\18§¿XDýÅ\7fÐßÈé/\8eòôwøêêv[\8dm¸Rø\16Éëu$ßÙ¼Z+/\99p\ 4fd{àfgë&\95\v\80¶ú\7f\8aé8ÍNv4;ñ\16¹£ÙtW³'_\1dÄý\ 5Ý\91\9e\83\1d«Ú\ fò¦óPQDQ\18[èw§/0ú\8e\83&Û´\ 5\84_\91\fÖÚB¿$       \10}E$X\97\e\87É*sé\19±é\8b´\98\84\11ÿ*\16ý\17àÒã\a\19\8c\1d@\ 4\8c=%"\98æüÏGwÏ'n¢\92vÝ6J\89\ 3\13MDÔ>µ\ 2Ñ2^¤Ì3\9b\ 1p\89\8d\bÖ<|\94¨7\10\88Ti\95ͼâ\13D uí\9fñ\89(FÀ>~\9f\87\r\x\ fô\ÅDOb,\92×ÓV\8cßòy³»\8a~vTNbÞQ\10_9\85\b\9dï³K\88«\8auVOøñľ)¡Öp\7f$¿yî\\18\12        \0]˦\97¹¾­\1c\9fu\8dn<J\82\1fÃס)ªàÕ¶ºÑE}\9d¢\9fÿìÚÿ\1e\9e\8c_ Ä
+±I\e̵WÂæqDê.àÿ\80?B\82\ fe®/lñ=^Ïë¬þbgû`_\84¸\17\15Ø%
+>ëæÚv~y»jß\12\9a¹|Ï\ f°Ã\fmtYà@\eÝÂ\7f\1c¼1-eQnôº>\99\88iIÈÛ8îå\ 6bED5fê¿¥Íu¶\ 1\9a\ 3¨ùP\9aW\93k\9d5Ȳ?0°8± å\1db\1c|7{\81'sâVj\89{+¥QÄÚ'\91 #ÞEúG:qT\12\0£´zø*­\9a¼}øø>üiâ\10â¨Ç\1ag&\8b
+\8c|\93£   ojûU^Úÿ\9f\8b&C¾\\99ë{÷      Þ\bÒÇ°ÿÐyÖn\18\7fÍ>Ûµü\13áYYݸz¢¤p;\14±Á^\9c AA\1a\8c¹-þå?«BA\90
+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\10¼ïW°ö\ 4UY0ñ&s\93ìø\91²³®µ6©Ú(\aJ\82%\94)ÒER~Ä?¿3\0iÑ1µ'\82C`\88éîi \8ai\1cGëÈ?ΣéìøLD\8cÑTE³»HhjD4Ö        5<\9a\9dþ ?ÄÏÑÏÙ\97èó\f¦FJÒôÝç©«î7å\9c+=\1a«\98\93sz\84Ó\8fÏÒ}N\9dRm¢ØÏ¿\1aÉ\94dMã\96#\15\13\v\8bXLf\e\8bá²zi\17÷6\94hʺÅ\93­­Ü2+¯®³fc·\19¤Êò\10¹-Gc\9e\90¥³Í\88\eò2J\189\82OR\91\9bª\1cqM\1eÝØW3fJÑDÂSR)}ò\95-\96\16f\v\98ÆRmh;1¡<\1as\98Æ\ 2\1er\0\ f\16\eªL\vH½)\1f M\1a\93Ï\0ÆXÆ\9aL+·ZÛ:DO\a b\9cÃoB\95'eQ7ÕnÙ¸G\8bË\132\19qI\8a,\7f©]ý\11!Æc*;\88n\1f*W¬m5þ\86ÅÛ*ÏÖ~\ f\8aLáÅ\15G¡*.9rÒ+\9f¥\89úPr¨X\rU,u\87È\89Ë\90ÿl\9d»²\80\1d\v¥É\ 4+\17Z\92S\17\ 2ç.+\808À¶)\vWb\10HÁ=\ e¡\ 1[\11IG:Ì5\ 6\96íª0zrÍ\ 6G@´WM\1f-a4©0jQ^¨\v\Qì¶\1dí!s¯î\85\9f]\ràÊ5Π \9bp 9.b2\9f£\90¼È¬]\ 1Òu\88\97wød\ 4\14\19\ 6ß±´²ºG1|\82]$\86̼&A\1að°íº»²
+óCZ\ 3\89ê\10È\8aÕÛ\97u\95më?;êü¶z\15\}=¹\r²åÜ\98\92½*~HÂz\88Ð4¥AÁg¸õÊn½Z`\v)(öb\80%£¨î4;\e\19I@ö\0z\99\97øX\87\ eG
+8 ü7JØÙú\17¼BøöÁû@0\81:ÄBÅ\8a\91\ 6Y\r\84\a\8fÀ\ 4ÿç\11\\88½I\9cd[\94Ù·\\0@ÄàWi\1f³\7f
\88t\0ñ®õ
+\ fÛMeëº\85ðª,Veñæ\bF\1eh\ f3\80&\17        Ur\0N©$Â9\80¦y3\80ë Þ}ýRÊ^ý\14\ 3\82\90ç»m;áòòrÀ\e\94¡R´yW®\ eê\83\ e\1c×ñ\94<`Ée\18»<<\ 1\94òS+7!©\16\9e\9e\9e(,±Ï4[ÒÝý1Xð¦>®\eï\ 2Çw¡Ô\ 3X%CXAéÐ\93^Ê»g»E:\16»
+}\8b§\92\13ú\85¶/ÿfYa½,S\ 5&s2h\1e\9c\96Ü\93\9d\83ì06\80\9aI°ä\90ákY5\9bñE\99ç Ïv\17\93ÎN¸f4~g'uc«U¶Ý«\86\1djÂt\0
+Á4å¢5r×4Þ\970J¦Cç*x\99\18<4\84H óÖvá½0\83Vô!W4^Dk/,89Ë\ 2?\18o[\a\9b\v\8a\8b»ßL
+`\166$ÈÍ®Â\1f1@ãá!o\8bä&¥B¿3§ríÿ\8e`\b\13\ 6sÂãXÏG\1e$CD\12¿Â¹Ø¥\80¿©¾dX<\ 4\14\1cßq°+ï´v\ 1Ìhhg<î\13E.\ eÀÕµ\18ô?Xï\16&\83½åá>\82ç@\1d"\97\14o\r1\9e=øº¶\85\rHæîW\v\eÆÑõqZSz]}t>\ 5 ï%èë\v»è+æwM\8aÖ
+\85à\873\v8\19¦eø\16ì¢\bA<þ\87.    \00\7fO"ÜKà
+åG\ 6éÌB,Ðé\83LÇ!6\a\f\19\vZöÉz5\bi^\85\19 °Õ:c\ 3\1cÂÍ\ 6Å2È¡`l\90\8dü7\ e\11¨÷\1c\12IÄÁ_\9eº\95­Âk{ih\±sÍK\0­Å[\10û¼Év54\11|\1ah\85$¦J÷Q\fÇ\8b\0Õ«>\1e-®x \ 4\1eW\8e¸ª®\13\0WñÖ  L\88W\ 6%ú´LK*\18À¨\ 4\95I\vs\8bâ\1fÿ\ 1F)ð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Úí\97UT\ÝÖ¦qw\v\10´pBpw\ f\1a \80\ 2
+©B
+\ f\12ÜÝÝÝÝ!\ 4w\ f\ 4\b\12$8|\ 1\82\ 5:ç;ÿù{ô9}Ó£ïzôÞ7{Îùîw>k®=ö\18\8b\99^K\97\1af       V\80Aá\@nà\e\80¬º\8c!\90\ f\0äæÅbf\96u\ 5\83à\10\18T\ e\ 4\a¿\ 1\0EE\81\0iw[\0\1f/\0\86\8d \0\16\163@\16æìí
+±µ\83\ 3ØdÙÿ¡\12\ 6H;\81]!V (@\1d\ 4·\ 3;ý1±\ 29\ 2taV\10\9b\e\0\90vt\ 4èüã\157\80\ eØ\rìê\ 1¶æÆÂ\ 2\ 2\ 1Ö\10+8À\12l\v\81bñü\ 3J\19j\ 3\ 3\bÿ3míîü¯\92\aØÕí\ f\17\80í\ f';à\ f¥5\fêè\r°\ 6Û`ñhÀþt\ 3ÿaù?ÆúßPý»¹\82»££\ 6Èé\1fö\7f\ fê?ê '\88£÷\7f)`NÎîp°+@\1df\rv\85þ»Ô\0üO8\19\98ã\7f´Q\86\83\1c!VÒP[G0\80÷\9f)\88\9b\ 2Ä\v\ 5\81\ 1l@\8enà¿ó`¨õ¿#ü\19Ûß\0<\1a\8aï\fÔt9þkKÿYÕ\ 2A p=oçÿöý\87üï\18ø?ã?ãq\85x\ 1Lx¹yy\81\7f\84\7fî\7f=½ÿ·nòP+\985\ 4j\vÐ\85\83 Ö WëÿNü'\95\8c\fÌË\97K\90\1fÀÅ'\b\ 4\0\81ü¢\0aA^¿ÿU¨\ f\85¸¸\83\95å\0\82¼¼¼ÂB¢\7fg­Ü]]ÁPøß\9fÁ\9f\15ÿ+¶\81ü\99\ f\18ì\ 5¶ÂÊÎ!\85 \9asÒpÜX\\ f,3\18tM¯haõ\96\9ee\bÞ\16\90Í\8e]b;¢r\7f±\ f\ fuк^Å}8Ñ\8aI¿c£\93\8chôW\17K\18¸5ûìíMY³AöÚf²Çd÷æMmì!×<q«1\12Oÿ98¦Óܤ\99£@Ð×\f\15\7fó/ë\ 2¸sßÕ0=EÛãò¨\7fß\9au\8d1Gßøjó^Ô~7Â\e«eyOÕ$\8e\óÛ\ 6\8c¬µ11¹w\ 3\1f±\9fS\10\7fè³þO).ý\80Å\16%\87Ã\ 4Âù\9bþ:S:EèÁ¥YãÂÄ       K¦ac\8a\ eaz3ÑÓÌRXÀÛø^dì/¤«/_i¦åU_iøP¦·æ\1f:\1fx"içæf3®P\ e\840-ë3½\8e)\88Q®û\89\90ò>³3³<çP ¥Îá÷\ 1ãµ\ 2¿\8b\1c\ f\98±ôv\86bL´\1cc\80\99\98\9ba$mlªvï]à>\85KäÜ}\\0®yª\99 ¨ssÒ¬.\96ÝÔ»\ 6ä÷[ý\0G^xß    ºèFO\91\ 1û£Ï1§Iy×>\8e¯Ziê\96\17\0G\90=ýTbßz\8b!¿[ÏíæÇTã\14¢îQùnfÅqQ6d¾\8d¡ñröÉ\90\9dHÉ=\r}\8dPk\12M\9b\bÓy#\1f.vr!w[\97ô03ìa\98\99\13}Ig\ 1"µ@\11µ\1c\80\98Quøaâá\7f­\ 6ç\82\r\0Q6ØGu\17Qûæ.\1d=\1e¢êÞì¶{T«HbÐ\80\18ñÌðå}5Ý~\8en¾P\93\14\16%þ^¯pñ»½Ñ\ 3»\97\17æªîØ\12\92x¸j.*ÓÊdÐG&_^\9d©÷6?¯zîJí%[\14\8e\r}Wûx\99=tf¶\ 5-£Î¶VÙÄ\8c\17¨¢I\ 2k\99V3Ò±Æ
+¿Kè½Ýû>\14\9fw@?<#\11uÄ{\97\80He\85a3\1eaaa·vÄ\98vrCÕ¼\ e\90G}\12Ç\r¦\1cE.TOê~fí\85\136[UÄñW\1c\19\7f¦£?\14\1fæà\17K\8cÅ&r\1eVr+I`àB¡´Ù¦`!êsâ\8cH\8d\8a\84\9c@\ 2ÝǤ¹\ 4T§Û\9aÅA\10\19 gZDï\85\ 6éûâ\ 1Öp\199UâK>óÈìøB3\12\12Âlù{À/ñÏÊ0§íM9òBrZo*åR6\9bÑ\axJßK\0\95\9c4aOÉ\13Ç£«÷\ 3»ÈCöî7\ f\1eÀ\92óÇ·\1aÛȲ.\1f¹\1fóÃ\11åÙÚ\v²÷.éèB¾%q9Ú|¹}I+Iâo\12uÊ¡è0!æ¹\ 1G¾Y,¤Y\8fØ\83\9c\9aHÖþ¦\95ÐJT\12ý¶¿¼Ð&\19ü£<U\84ÿbWù5/P\93o·7Ë=þuo\ 5\81\aùù]Ø\95(êù\fû÷\ 2\96\80R´rW\97±\14­¶IYÀaz\18\96Å\8aÑFA\1aZÍí;»ZGöÔ\18V¦!\ 4¬o\99#8(\8b\19 \1aôÀ:é\8d\98É,J\11¹¬:²#¦JúÀ9r?\8c\1e\13\13\9eH|c;_'í m½¸·\89iÛS\1f¥\7f\16\88ä\83*Wqó_\97\94\92\16\96am²ÿ\15x\994XruØ!6Èb7¾\87ÖÉÕI¸@ö=¨\17\16[;I \9f\ fd\r\ 1HʶO²Äm(\98\9e½\89·Xÿ±à\1e³\19ï£ñ\rñ«\8a\13\9bKQ\14û/Kó>®E$\8c\11U«sK"Ù³\1a\v×7¦\91S+\1ck¥-\86\16#ÏÎK\8eo+   {u\9e\94\ 4]Îf\ 2ÎQÇÍè\92a0×¢7¦\1e\89ë/8j%`üm\ e\99Ð
+³à¥\80Aá>Åâ\80\1cöÜ}Ñ \ e\12,IβYÿ\89\ fùÒrì¬Ú\82ß\86(ä?3\f\912Zz\19sxÕ×ê¸äÇ\14¢.r¼ r¹c+p°ËÊôÆÙg\vT\89¾`\96\ 3\ 5\99K»|\7f\8f'©»\aGTwE°u*»Ó¿\ 2ãÔ[ÐxÆH\8bÐS",2jfKÞ\ 1pZÅ%\ 2/cE\9aK>£\95\ eþ\15°3m\9b\99\82\19ø\e×yv7²tY\954[å.À»_÷Å\87óWÔç#¼yòµ1»Q\12ÚƼڣ(\90À\8b<¢U\b®\89\82\a\80ÂØ#ù¸\8c\1eÃÁ\80*\8b\9e\17פõú\ 2\91\ 3\vì\93Ë\ 5Í\90y1\10-á³î5v¿\a.J\ eÑ\87é¨\8c8+\8eü;\ 6´UBy\1c";/=]u\88Õ²1@dಸ@r¢Í\9fæh1¾²\15\16ZÙÕ \0\89ù°y\82\1a\ 1·éêT\1a'p\83\14¤¼¿é×ç]jÕ\8fËxºN÷ºþð3`\9c=\Ùã·«`\15\8dFÌz\ 6s`Ó1\?B58^\9b\94sQYËl\183õmp\ 6õ7\15[9\8c\9bw¹ÉnÓh¯eª·Ã*-\95«Ò¨¸\164¡¡ub+\8c:\7få\b\93½è\1c¢\83ÒGÔ¹Ú\84Fäy\ 5/¿M    \98\95\86!'½áïpã\búä\93»Ä\9d\[TÊnl\84®~\90[õ£\e\98\17ð]¤R\85W¨¸Wó¥×\7f\80ÇÛ4L\838\14T\fÌàÃÒø¤%\18\90Æ\ f"8?þÀ!øsÇ\ 6\8f\8cálodZýû/¼Ü¯»M\eç\14è\9b`\82\81åy·óèã:K®ç!)\14Káܱ³ç\1f6\85\9b¨ÕA:Þ·Þ£0êÏo\17³Ë\8cM\1fd\ 6
+¸?+\92\ 1x\86Õ\8f\8b8\7f\9e.Ìh\8f\8dM\18\90y\1eþ6ÿ\Vn,cb²ÿ¨ó\14]4V}Ì7\84\17joòSºbÄEç4é\8bÑ>\14%\88 Ê\9c\89üí\b\13·:¾Oæ\ 2\aQ\8c}lÒâ'w~Ʀ\97\8bæ\v\1c¹$¦\9d\16\8c-wÚ\11äM²\90/^ò     \88í\116d»d\82(l»\15\0êäÈ]\r©Ì    \8a\ 6þl-kO\ f´\9fuô.´X\8a}|-u\19   \9dN\8aC\14\18\90Ôv\9a\94©+°ñïA\8e\1c¤iC:8Q\1a]º^æo½}/\19ªªÅû#YÄù\81Õã®fnx´Ç Hºk6O¾J\7f!\ fcb3sù¾²õ'1ó¸ \92Àu\95\8f®¡x\1eP¯ò/T\95\93âÌ8\8aì\ e\81\1dzÓB§ý¡ÂGç´H;­nT.Ý\11Ã8b¢;rn\1f/Iõ\ 2ÕÓ\94\16µ\ 39¨yod\12\ 6¨T/*zñ5¿¢Jvð¯"\8aµ\83hÊ5}±ù\ 5ïýÔá\0.)A\7f/Ýëô\96-Ü5qWÍt¡\14àÝe{P·Ö§\16¨A\v\13\1aÕnfþÆ|\9aå,ÎoQ\15êw³ê"Ó­\88°esø\8b?}\85]Éj\16ÛÏ¡É\9d²¬\8d\fÆ\90Þ\88ãÈ\85¹Ï\94µ\18tô|\9d\182y@O÷dVÑ\1e}\ 5±h´uÖ«qgíÎ\1aÜâî¶×\8bYÍ$â¦Í¤Ó\fjr\1c:~åê\ 1\ ewTM7ó\93\ 4\1e\9a(\ï+\90\ 3í\90ÅI½\ 3x·pï\87´?\96pãzG\9e\86\ 2\82¬ar½È\97q§ã¥¨"}/F:\C¿üK\8fÛ÷P[ðD\a\8b¨\8a{ú÷\95\87¡\84\93:4^sÞ\ eå×\8c¹\ e·:6\g¼Ý \9c[E5\f¾ãª^\ f\1cÔ\19ìø\81Â\93ØÌ\8b÷H¶'¡²\84O\1f\97l[æS\18ÞpÊ)ιo¾\96\16eDò\16t5Z!Ú\83\94Î,\13\9d2\1ah\199Tëi        äÑ\96ø«cT\7fø\1d\ 1ìM\90O\1dÈ8\b\13Èçùàâp\1fÁUM\9a\82ÖÈÎ(\f··Û¤\16ϲ/\9dÖë«­ÁÓks=\9a\11Æe#5;Ç\81ÎI\1aÂr\84¥\1cR\14\92\1eÆÆËí\9c °¿u1âT«ýBü\93Èë!x±\9f\83ó¦\ fIû%Ð\f\ 1\1dW4¿\81G"¯\rþ2l({S\ elºÛ¦\820>èQªz\94ªVq\e\9b\85\88ð­°Ó\¸ô\19\12±Ï ~ç\81ÅiCüL\84êý\95í_J¼içÏ\1fÜV­=\ 2vhsCXçÁ\80\0·áÑÝåäë~g\19\aV\96aTøI\99êï]F/j\99\1f\aIçðã\16\93Nâ¼3Þ\95~¦Z[Û`e\93O\a2\83ÄCÑv~¬\1c¸%°ÆpÕe2fü+=PåóZ\fã©IX\1aâCÒÌôåo9\b\ 6JFý[\ 4M\13\11\99àª\10·»4r8Gï#ä"µ\9d\82\8ab_\0ß¾J&ÈB«ö­\99$]YU\9d$N8¶ &\8eî\r;ãI:1Ç+©W\96/ÂS\9d§U4r';ÜÒ\18¿\ 4r\96²í\17\¾«Û\b\1e\85\96Uf\96¼uÀ)¶û\8dÚJ±QÈM\8b\12="v\81᧣ØNa!\8cáä)I>\88Ûïy\93\1c\9eðã\89=\10¼­¨\ 54úZ±ä>\11\9b.\eº\9f*®ä{¤ç\94Ç\èu_\84C³\¹\15ÍT#ÿÖ\bÙ0\8dâTî8/·è\8b\f¹ÁGÌ\1dê7ý×"lß\84iC¯Q(\83Ó7}~ò\85\1fÞ·e\ 3\14\93°\85Ù]F£;¶\12¢\a\99Å\8e\95\1dÏK}\85\1cc8$ñ\14\97QÉ]\0c\88a\1eôè÷\97¤\17·\v \ 4\v,\r·uæÜ\8c\86ê»r\82\¸{¸d\9b\82àú0\7f ìâÏ\10\84\94µ5^ÍP·ÜΤ\92ÄJ¿:\fi~\~¶\93ê\8b\SG3#Ó\82/Hð4\9a±¿4´Ö;½Ó\fä~wx\11}}¯=¹D½\99´Ù\føF¬L1GÅù!413¹\11\9fó\18É\93j\80\ f\fØ\1e7\1eGszCòzy\8b\90ÛÍæ#n¬ßNÚó+dTvõ«D\b\98³èÕ\0\ 4F\9e\15ãu\86Rår,3ª,\87mRóËA\17EøjÇ·\9c4\9cTa%Ñî¦c\10ök`»jè76\7f!\94é\ 2\85áîák6ëû·\94\9d\97\11\r[DÑ\v ô\89¦H£,ÛÉæÒé\a¦~4\1fR©©F_zÌúùù#j3(\8eÜöÀµ»v\9c\17õäÚ¬:}°è\91÷^\ 1{n\v,w\8fõ\95ÃD\13µ\1fß{úG\97@&(³u+N¸þökÃ8½ÇKM6ôXÚáQ/\ eEKÝ\eã±âIó\90\ 6.D\flËÐ\15|\17\v¯\1dùI~{\8e\80!s;\11Ê*¶\88¶a)KVt\84\19ì&|z['ß\10V»f\11í½zú\86r\vÚ\94\9a`\15\1a£DBÇ\8ei¶¬m¦\99ÃÔ\ f\81eùÁ­dµ\8e\1dÛò1ØY¶\ edüÏÁc\0³¨\99ÆÔ\9c¯_ÐìY\9b²E;¼4\93¥ñSØ{±\vg\0¨gµ86.\f\9c\11Í\e\17\eXw\15F¥Å\87g§>±\17êmÒÇ\bôxCr\91ÆÍ\11¥\9e\a\1cÈÈÂòì 0Cd\97\87+\86\1fô?¦
+én\85    \95\7f\9a\ 5`\9c8       ê²¯ÍæC\11\97\10»/uî\99E$ã\7fZt\18\83ç)¤R\8f\ 5i÷£²\eAóZ\82\88\ 6?\0á»æ\9fnÝÞ9Ï\84NGû¤äñ4\e©¬\97\9d¥¨ï¿èroÅô\12f/³¨\13~\1f:Ni\85\92-\v\88¯\86Ïîð~\19\18`\8d\8cyY\1f1\fF9t\99ÀK\9dªö\15p\8fýýqüG\89
+\ 1\8fY-ö\90R§Ãþ\97ÆÓ\85{\7f\0R²É½îrÇó<1\86\9f=A9¯×¨¯b¤\ 1ò\96É1pÜÉãPÎSöU1\9eös\96\86­\ e\aèIû\13\1a×\8a¡ã«ä\b\98\97yg\89
+×WbPabì\1d\ 46Vûó<°\vF\eç%ÛÌ\8b\eͬ\8e\81\88d±©¬§õ\81D!fE¹ÐÝ¢~Aëù&2\eµ}I\19>ÁǽÏÝ\1eÄ/\re$\v7\95ñðzz·çÚ\ 2:\85Êh,\1d²Ñ=dc^¥}|K\16\94wfCLæJ\8b¯ë1ë\114<\90y\80\84ñ`q\18,r\92ôEJKHko,{St4¿]7½Þ\89\98½\9a\9095Ç\108S­ò9\92H;¤æa®¹ù»}¤!÷¨\0vçBFFÛn`°06ñQÓÜ\8f©÷}\99ï#Fû\0=*®\89\16ì_°\8eNÌé\ 4\1e/ô¿\1c<¬ \19É_\10ßð³»=y\8bKldºR|\ f\1d    àL\9c\14\10Â{ýÝÎÅ-óW\90\9eRõ°\82¾\0E¯ð\93\9a\8a\1e!\95ë¯Ö¿®\1fT\94?RFDw¶¸zuöµò YîÀµ¸\8fÃÛ¸²Ê\95\87ÊK&è\12\1arÓß"_Ì\18¦¾+=§Í\90úæÒ\11\1e\ fóºY¿\80\e­ßïBì\ 6¹8j|i6ìéZfˤ\fL8Ð\9d¹û}\11§¶"\ f \ 5\81É#¦÷Úñ®\ 5Ö\8c5|ò¬TU^³;'&)Jý\ 4¤Ú&fzã ¥Lb[d©z<õ\99¿¢ÞÑ\võ£ß2Nv\16Jÿ\96ÝFHé²\96£\ 1Çè~´ûKôÈæG\85¿)¬ý¨^\1fÙá\93ÓòD¦õ\b°Âð0àîN^\84\bÆpöUrTÅ\1a\18\11¾LPÓ\v¦\17~-ûAÖ\85\16\98\ 6 \93 òI;èñR7V@\ 1¸|ç^P´ãH\1eÕ@Æ\r\aÍ=4oÛÐt¯ý\88\ 4\81æ/eñgozgTçó\10\ 6½|\9e/æbm\86ª\89¼KÀB^\93\ f^r\12äÇÈÉÓHqD\983S\88"ÆA\93\9eG\81¶üU\92õYÓï~!V_\85Õ\93\10º°8=)WX¯K¿«\8d\11ä±X]M«\ 3\1cï\1c\râ-çîS[%\aï\18kú7bCDÀ\15nÆ¥»sQ\10õS\90Ð]NØ\ÚÃÞ>\16Q8µ}×¢î\9bÓWáJeÃTÊZ¯ÃEGó\b}ÆÉZ·<]u\17I2»\81A\9ef8Ö\92ÉÕZ\84åü8ô     \83;Pb\84!G-\8am\18rÐÙ
+rD¥m®$FÎ\80ï\98Æ   &Ýx\0Y\r\82¿3\vá§'\8f ÒP\ 3mÊq±T:V±àÂ\12µÁ\1eY\81\8b\ 6\80o\95\96ü×øCIa\ 5Èíj\109p\98\99\9f\14*      p¼\84j\8bà¢\18ê­a³çJ±þnAßà8ô¬·*ØÅÙ.~Ò+\9cþ±,âù\12K*?hL¨yY\7f#4²é3Òa\9a\búx Û\9cb\81\87Ò\97º¦ù\9d\16\9a¦v@\12!ýy²i\8bYßEh\rd\81I$Á\ 2l\10º<{aÁ&ÏÞ¾³Å<¨Mzq,R1H]HaÓ\82´×·=î¿çM\98¿kD~YKÉñójö«_\8dp+QJe\bág\89\1a\8b\18\88c\919½@¸PùÎóþS«FçzH\80ím?sé\vàÏïHM\9d¶ÒR\85ÖÞív\96\ 5\a\0Zbíî¾ù!&\96¯9æ<^kh(êê\vE\1cÀ\ 5x\87<¦Ð\7fÍÓÑÏØÿ
\ab\8d&nOú       H\ 5\9e\14Y\bñ\17\8e ¯ù©\85îõo\17\01³ñ\15Hw+\f\7fÍiL#÷/ì,n^·WÖ\f\87\8c\19O.\99IOâË^¦jð5m0\97\9e\99wß6Ê×¥ã\91\88u=\vJ5é¡bMÇ\1f\7fO\7fæëÈ?¨{\bÊd¯éÕÿÌwÓ9ê²Q#\16?\91\17~\\11\92\92nx\19!\b¢ç2qeTV¨{!gkà£DÖ·2\98¥ÿ*nGuj7\1d\8b\13\91ãé~\16R\88 \9cÓ\9aq]ZÒ\10±Jeñ\v,þ¹^Ö\1d\98¥$ÂBxúY\ 6Cs¦d\8fV\98ën]gý\91÷[Íõ.ßV*Å\83b$ëCI,\rÒª\19yÛ´\7f&åGûÇ_ú\v;÷ìP¨@ü!Rv\a\9a­OýàìAÿd\9f9µFÚ\18>jkSÃJ\r(\12Í÷Y¿à\99U/pnOÉø\99þ%nxªP!`I-¡É%\8f{\83!ä´h##4®ýYã\v¥¨\98Â\95]-\9cóå-¿YÂ\95öF5w°Ç\10ÔJ/Í\152èûi·¬\1a1¼¤b\e{(\5bITîEå\9d\ fzBϳ4Þ[\bÒ\ 3=Öî¨èù|ò\9b#k\90ìK\87\9fÊ@9xæs\a|J\89¦²þµ7Q\8c\ 3\1eÞ¨¬ÿ5´\8e\95º[£\81\1a[(­,\7f{8 ï(¬îL\8c[\19\íHfÒ°_\17)^Ä\90(½¸Ý#T¬;%Ö÷¼È÷\90\14±¹cËÔÀ!\92ô]\9fçf\81ðÁÕ{\91\82\8eD\91\8ay\90¥\9cR¾0JÈ\f§)Ó6.½\ 1\eT%\10Û<@X\96ÖjÀ\94ËaW\91÷\88`2«:ÿ~Xµc1\1cEJô\ 3\85|\80\97vx(»ôÕdñpO\92r\ 2Ag±° \94õÁ0&xuÛ½\1d\10g|Î\84Ãð\8d³/Ai×
+\rm\0-"Ë£\9f\86Û%ïÄ\1eÞmjwÏ\87\9d±\9c?â9\1dó\92(Õ¸¿ÎÀ\90Ñ%* #vîM`c\82wP»@>\13^¥ú+\bý*¼\ 2Iàiw\1d\13½¦ÓéîÉó8ðCì\92;|já¨^¢\84\91\8eò\84\89\14qc¬<¨©\8fæî\88\1a³á\89\8b\9cæNNa%NbN&¡ÕY^I±?Aè*ó¥\96\19ALy9òGõX\97n0ËïÅ/(¥Ijõ\84ÏÃ\1f<Ê¿¯\8dnàJs«\19Y\85åóÆ×bXJ}\1eÿY¼<7Ù\9f\ fãÃw68R(X8\879\15Ю<^\10@Û;\9aL\89Ú\17\ 2ÒÊQÀÝ¿\81ê2rÖ¶Þ\94\81jTß\88Å_ç\9b<7íMÍ\97Ùg.FLÍGf\8c¼³x~RøÈ\911\18ïò5\87³ÿ,v4\1a\85Í*\8f\8d=<Ñ\9bSe\ f9Ú2r\9b À\ eÿª\19É\9aÍ÷ÝKöEkû4~\90\85ÿ*uh1ÎÃ4X\96\82\8d3_µ\19\854½b¢Þ\89ùæ|%HÖrçiÑüûXNÁ%\85ü\1cÆz6¯ß¦èÌônûs(ê\12\91mV\93åèFü(îõB?eWÁÊÓ\1e0Ë<÷ÃW»£\88ƵÇhàð²:\11Åñ×ÜjS¸\ 4Y9       \99^Àp\96òÖF\1fÖq\eG\Ì\1cÎ\98\9e«qÒ¤ß\1a\9fC\81Nxù\bÒ\9cÙ\16Ã¥mð\9bÈÂ\19T y8=è\12SNYó\9eO\93\15\976<ârIh\9b\81\0³¦9{Þ\85jcúêdS #ódW\1f%<J\15¥\8e\ 3\18¸Oç\ f]®IÖúBï~×U0\93KÅÞÕ\81Î\¸E¨2.\98>\97êM3Ö\9ep\85üsÚ
+\8d3\15eÅa?(ü\94\9f\97eçÍbJ]Ç)Ii\90¿É#}r¢ª\89x0úêýÏ\12ZÍÁ¥)Ç\8f¤\8aþ²\ f¯hÚÍ>g\1eÚPWô\84ò«\9c\91Ô®\92\17Þ?\90 \a3yö\19\93òÏ$zß\89õ_ùÎÈ0\92\80>\99\ 4~F\9b¨\14\87Z>\12¼¢ªÂ_Âî\r¬\9c]¦¤1ezà
+\90\19\91\1ekùE6\1d\8f»\88 P½\1cÕó®þTÔ\83$óõ#\92Sáð¢F\97\14\19o\91\9fáB\1aB\81¢\98á:sepÊj\92>^¦\ ez\9a&Ý.FB@ym9r\91\1e­ü\1d×U\98p\94î¹F5\8bÞ\8d\91ô×X¶Ë¤'\ 61=b\8bº\ 3N|F\1f=½ rß#þÏâ\12\1dû1ë­W8\85º\90Y\8aFÝ*Á\10LEI(K7\r\15ÿ\ 3ø@ÑÉ!®¼¬ª\1cáÜmPý²È~\v\83ø\99;u\83\ 2\96\10K¦oþØB\r\9bSZru5VP%¯\ 2ýQ\85Õ¥\\85\87\14ÓÈ@Û%+5\13?\1cs­ÖÕäu@s\8bâ\98-2eÆÜ\1c?-\1e&£¬øYx(\83M!\15õÊ\8aòþ\98æä­Qì\ 2\8fì\0\9a\aÂt-Õ²Ú\94\92So\14A20MëãêÕ³\98bIo×\9c\18p`öJ¯'O\\1d£È«\8dâùä-j\80¡uÚ\ 3ê#Ñf\9eÈÒl[    G\10a\97\eS¹KÃí¾91\ 1­:«ç  GúuÛW`\13\ 5\89   Üå"\ 2\81ãK\90e\9e\ fW­7\97t\84|\89®Lèí\ 1w@£\ 5¾ï»\93\96"\9aÆP\1d\10å \16Vاg]BQ\91ù}%5D3kÊ!§ùP\90çyq\ 2ô½ó«½Ê\f_ñ{«Í\81\99
\18ùÅÉÌ\10êi Ë\eÏ\9cãÙ¶Þ½­\e~P\88\f\88\98\9a\82r¸&õþelÅÕà\96ÝØ[ºg"8zܸP"øi7\1aÑ\80Ýw¼Â=°\bb\9bï"¤ÇN\83È}\a3\92\13eyý\15\996Ç3Ç\8fòñãDµ\û»Ç¨\8bÒB\93\ fzNë\88\85\94i\1fZêð\fÎË9J\7fãûÝ«+ñ½\18\fß\89©ä8n\ 3g\ 4:¬¹¦\8e¥¢ôI{ssZúËéún¼\9a&\ 6\87´ò\1d2$\98{v\v\11à\94lÉëì\92yë;øò|"\12Aeu-\13ÚC­Ôþ«aM=\1cÛÜl\ 67QùÜNï\ 4ùÎÃãSø¶\9e¢|äÈV|¸æý\84\12½w\13Õ?µ:êk%\1e\97ð?¹4~?ú^\9fu\14åLw\9e½V+\13\1e\94\86°ÊÞS\9c§<\7f\9dÜà\80¬Ò\969üͳÏõ\17£\11kêO­O(xÍ\r\97OiE¨K¤ØÒì\81\9eÛ5óÒ\19è\T¨Á\17\18ÈÆ\ f]\8aí?°\11\ e\v9YŸY\9cº\13§Ïe\13\8d¹ïqÐMn\1aÀÕaã\12|á¾Ë\ 1ý\85dG\8d\8b'¥K®aÁ>m\11\17\81%VL§Ü\82¶Ý׺ÆÎlï|ºüHh\1còU\ 5S$\10\f\96\8b\ e4~ñ\ 6/\96I\ e 3\82ÅT\1ff\8dè\94õ\84\19â*/]\9a\1eiãB\16\ 45f&\ré        w\1d\17(eýxÚÂ\87\87M«ex\180]c\8f|\ e*pfL\9fñ8µî3Úqg\rª\ fxM/\84þ\8aCW\14i,«\ eð/\97Í2#qj8@'\bLYK)´R\88zNËX3¾\bcDÇäJÿð^\ 6\91u\94#y®ùy£`\8b¡¹ûtdðîÍ&½emü\91\8eÍá70\ 3&Y\1dA\7fârîê8¤%3·-ìæ\86\0³¿æ\eÓ\8fòm¦ì\85\97ºÑx\8eêÓvÜ\9a E9E×1\8d
+Å      ÁÊ^ô\9a}\1f\7fI\15³¾Ö<\1eH¢t\1fËv\8f\9b\9a\17m]\13\87\fN\aðeî\ 6\18U²»\1d\ 2èä\8cWÌÔî\97áG¦\1e\8fí¹1v4#ÕDãÕÇ\vÉñ\91º¯\9c>WM~j\bC"t{m\8a~\930".çpÿ`_¦3v\10¢\vû\8bëå\13Íî\0\\\ 1ÌÞD^>\v\80½\rømw»½ù\89\8e\a6ÔÛë0a_zæ\92ý~}éºÐ\84q\96÷\15I9\9fOÿ\86¬\9d\9dtz\8a\1e\v[Y\1f¯ÖÅ­\82ÿÇ\aÉ\9c¬Ï[ÏæU_\1f\rÞf\89\1e\8eC_\ 5\89O\19\87\aîï\80_K\1f5\v\8bH\91=x\1f'\95×\93\167évù¢+Æ-\15§ÑK\91yÑÁT­\99\8fCÜê£~ø&\81©IÉý¤\ 4³a\93õÔÕj\ 6çñ«\9d\12!\ 5Q*(±è\94±ã*¼ÿ\97\17Öÿ7ø\7fÂÀÊ\11\fr\85Ã\9c\ eXXÿ\ 3"\99
+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Úí\92y<\94í\1aÇ\85,3\85LH\18\8fNvÆÌ\18MÆÖ \ 5Ù\1a\13\8dÈ\98y0ÌÂ\98\91%ûK)\95\9a\94T\96W)¥(\94Q©0ö´"²g-ËQ\9d÷=\9fÓ{þ9\9fóßù\9cçþç¹~×ïþÝßûz\1eU\15\a\82.\9eÊò\ 4÷°\98\1c]\14\ 2\85\ 3,l\ f °\0
+\81\84¨ªZ°A2\87ÆbZ\92\ e@\19\1a¢\0\e@#\ 1Ô\ e\9cþN\1c\1a\ 3\81¨\ 2\16,ÿ\106ÍÛ\87\ 3hXh~wa\ 1<\ 3dÓ(d&`Kæø\80\8cµ\10
+\99\ e\10X\14\1aÈ        A\0\0\9eN\a\ e\12\b\1c\0\ 3Av\10HE@ (\14@¥Q8\80'èMcBô¾3Y1½X\0ö§LåúÿÑ
+\ 2Ù\81k\\80Æ\1a§&°FIe1é!\0\15ô\82èÙ±ÖN\ 3×Xþc¬\7fCõkø\1e.\9dnGf|\8fÿ>§¿´É\f\1a\1f\ 6\16Ã\9fË\ 1Ù\80-\8b
\99¿Z\9dÁ\9fl¶ \95ÆeüÚµâ\90é4
+\9eéM\a\ 1äO\89\16¸\87\16\fR\1dh\1c\8a\ fàE¦\a\82?t\90\15bmn?\10ôðæN\ 4\17\9f\9fôgÓ\81Lcr\9cBüÿ\8cýîþQ£þY¯\8d\87M\v\ 6\\91\b$\12µf\[\7f¼¹ýrØn&\85E¥1½\ 1\ 2\87̤\92ÙÔ?\85¿B\99\9b³\82Ãtõõ\ 1\ 1\12\18\0X\8caø¿ú\88LZ\0\17´²\ 4\f\90H$ÖÐà\87Já²Ù \93óã/X»ï\1fµ\17mm: \18\fR YÙ2´uGt\94´g=fêøÛ\9cï>ïp\80Ü/\1aK7\98Ë\97}Ñ4 ¥¯Gtú\1e\8fós\98éÚøõ³CbÚ\82\86²Ù\89\8a\b[£¤º9÷ú\90\90­×ûdµ¼\9eÖ¸¾\9fÅÝ8=¤û
+v\8b$¨W;\ e&V\1fq­ÔÎ7\bs_/ùz\9a\9aÏñ\7f0Õ¨"_õ\8dÿ$âA7õ:Iû\ 1¯«òãÉ\81{\ 28
+\7f÷Q\9b\9c#så"Ì\16\v*        ¶%¤\1c\r\vgÄèÇ­\10¿ìÒ%F¶ÝÜç÷áà£lÜè¹   ¹Ù¶M±\15\1f\13¦¾\123½R¾½\16n\9f\1fN\8fïzz¬\19Ö^\92ý\19sE¬lÛ`vËä\80p}\86?w»AÜØ\1c\94º·é¥âj¹\rÓ¤·$¼(A:>\1e¶íÊ\85áî¤å\83ez\87µ\r¢¶BE\8fÛY×Ë  G·¢ß9X¢ <­Së\1dM¬ñNWsÎÍi>k\13
+r\90t\93-¹ú»ÐÝ\ e\ 3   \eyóý\12úÜéóY\ f\93CY\9e*ªz'SÉg¨¾\ 5åÑ¢\ 4Þ©ÑG~ØØ£Üí5W´£O£vq\1eò\94í\94ñûÚ:\85^éÊå\ e¦AùnÂ%\999isf:á÷¥s\1f\8d\19\15-\88    ú\8f¸8\8dȺÕÔ\91ßÏDn-\13OÓâ]N¸xÕ\13\96\99\9fCò        \vöì|Y³Õ\11ýM;»Hi\8d÷b»Du\9b¢¤\96\12¤NyÔ\88´/\1a³\11     b\9d-ÆðÂ'\12¹àX'-¼âØÛ·Ò7°íB\92úm\90ÀeÐ5\14ᬧ\1f|=ŤÓ!fzÊÇ_û]Öã\r\13~üÉ\e\ 5\9bÅêl"ë«zKWÄ?\89\17o|S´\83!\95²ÑÔ§\99ð\91­<«\1ag¶?Ø^G\a\97/\9d\89é~#Ð_Sº\vû±î[ß\87ô<\83T\9bý¢CÑaQ®+\892\93u\9f§Õ^Ì\89Ti:MÎè®&ªX\83Øk^\fÕ\9dÙ\96½a.^\96ÐÚ\87Ø\0íçÏ\12\1e'¾º±\1cG=\ 5oÍú¶»\88Z®Â\86E\8eÏÇt\b¿í|7\15x,5 »9×&g¹)âPÆ\9dø\ 2R#{\8bÉ\82\8bkî#+ÝÓ!§\8cz\ fö©-TM
+|\96\1d£\98\9aAø ÷t]-»V@G\94¢íxábÂ\85ºß\91\18o¥ÖÕH!\f\87ä&Nõ«\12\fs\12²Çú\8dÈã3ÉÜ\b«Pò\ 5Ø0±\95\b\81o\ 3ÎÎìYäLêxæØ\8d¦\9877À·\9böÄÄ\1f\1fó\82ÏÎôí}\12\91D\16\9b¢ù²ûN}\16¹¸\82áqìZø\8e\87wL\87\16¼\87TXg5Í\fiÈI-v\95åè^¿p\ 3vnQoç\81u^6Ë\9a'B\e\ 6\8d¼\86­\1eGÇäx¬TQ®¦ß:tp\94\14+YhÐW+ã^vRÜ\9a\147\ 1?Dí\1cU<ÐS|µÈjüøí[\9d\9bÅnN¯¶ë·[+I_\1aȶ\92\83\9ae\88¶Æ÷P\ 3Í¿>\92\81\968fYËW>w{)¿çð\1e\f~¨E9\99À\16J53\95ÕAT5  2\8d\9bLï@\94²\12®½\9d¨¾û\95=\15Ý»{È\80xÏaêÌ\849|ªjÓ@k\10²ÿFøSñ-5}èCAV\ 4\8a\18$w³\13©@;³uúãÞlZ\92ì;ý½îÍ\9d/Yúm\ 6\8e[\14o\9a\1dò&­\1c\97½G\14vÑ=%\ 5ݺ\9d®my4­o%a\r®NÀóÎ\82wñÛ\95e\ 4$ÃU'Ò-75å¶ï¹\86rþØ¡Îä\91}\ 2û)áÍ\9bÓ\vB\e\92'D\9då\8f\98¸$u\ 1¬\94\9c²ìnõ\vÜdö{ÌEOõ³Y\95¿Ù\8d\90®;\vXwô+\HõÝ/ÓN\11ÅR\v\88\ 1çCnlA\98\8dΧäiñäÇ\e=; ªâÔ\ 2¥³Ë\8d\9b7.\1dMS\998`9®]U¬Ò+®ñêCíüÎ|G·æ%kòùò\98åLÃÂ\8c\99Rüüj1ßö\95[Å®£ê\ 5b˶±/\97Ô×\8d\1f%\eo¡Â\1d7%\84å={¨\91±TßõÈüS\8fîmÖ-hºiñ\9bÔ±*A\9c\9d¼yè}jI<!]öQ-ánv\91\94Q\83\86ý\17-çK\a\97äãåQ\89Rîç/'â±üí\88×5\13£\e\83ô§ÜkV\9d¿Å       ô¦Í°\81Ì\8b÷ËoÚ%ßLË«©\95\81s\90èé`;Í\8d\95±\81ðÇ\83è tOMR\105èà^u·Â\90nG?¾\15öúü\98¬¡àÝm\90\13¸\97=\ 4\9bü\9cÔR\11\ f\8bHqÂf¹Ë\89²Ho3Cb,\977\ e[\125¬' ß\9c¾}2%rÞü°¯¬)õZ\ e¥¤¼\9c\9e2õΨ\vmZÖÇ\97R\88àê\hC"\e\9e÷\97º«\12êýúð·D\8d\f6l\87¤\1e¹­\8cí\11C>³'<Â\98Qtj¹úÒá\a\v}\92â
\8bñá\bÇõËlFm\12'yZâ\ e.` ëÉ0Z¼¸£E\1dÚÉÐãÅ"\8aßÄíKÐIY\8e¡M\9554Ä=?Y:Ôâ¬!\85|þ·c\175\fC;\89à\84"ôKæT}[\vuÇ·g\vӨѮ\80Î^ ÄÊí$i\eüZïã\eû¥\96õ%B\8f\91ÔN\86ÇG1\9e$\9dQMçíý$¡ù*\95\17g\81a_z\9a\15P\97\15\93ª:Øç¨aqÕÐÍľ×\rW|~3\1aC£WNq­æ\17 Y°¿iùe¡aë¼{÷      ç`\¼\1a\1c\95\9d|üv(T\87V\94\15° Æ\81\9fØñU9V$=ضÕ\87\ 1\86q&|\ 5IãyJµm\1eqIîÒݯ2\ 36ïï*\12S\b'\ 6pûD$«Ä«Ö)\f{ÚÃó\97\9c²òäéWTî/~\18]M¨\b\10z¿nPî\8cmu ¦G¦õÒÔÖÖòÊÆTn\1e\99Á;ë\19\86Zð>"â\9d\918k\b\v5\99\ e\82¼.[\8c\1d§¥45ßÉ\88\8d\8axs\96¹ôú\ 5Þ\95(p\¥çNáÑ\15¯¢®Ìú+W·\88\16ëáì's¸\fcCÁ\ 2\13Ã\16\9f!ðÁ\ 4t¶ü΢ê\ 5§/M\ep\85ÑÁé¹_oMËa'\16ïï\96\82Ýa\15ÎMÞ\7f-½ °\83ò6?à¼É²ï\ 3\99Y0ý´Ge£RCñÀè1éGSùük\92\9dz\1auâ*\ f_\15\91IJ\95|Ú?dä.\ 4+\ f[qG8oЯó\1f,MÀ\\ e+öÕè"nEWm\95Þà\rÿ\18/+\92Ú¢l>s\8fùñ~`¾Æ\92\16\1c\9e<\1c¤=\1dê"Ü´%ÙÙáù&\91ssÙÉ<-õ!|!t0\ fQÐ8¦ &s\ 6\85\16\8eEIVf¹8²\8cÆ´R\15ä\84Ó\9fÀfã©\88þf
+ûòÍ
+Óm¨Ó!¹øC«;Ã¥¿\89Ï^÷ùÍ\ 5#j~¦OÂ>¹èáés\12Ob¹\9eBþ!¬<ÍQX\9f h\90\8cªIïÄ\19\9bÆ?Í©üîQªB\b?ìqÝ\17î%ÿEP:m¸fè4\7f¹_¼u½bî   ;\84t:Òí¤Z\ 5\84ØôÒÄÉ\7f\81\17±.¿A\e&Wûjp\16}E)J8®æ\8a\95¯\12\99m^»Ãß;ê¢\18àn¹\88Ñèö\81ä\a¢Ûëü1\82\92     \9aÏ
+'\96ûmK}¼»Ïf+æùÐN¿%\biqoÚW\ fÕ$]i\7f\7f¼\85AêàÉß\96,Ü ^Ú£vF\93ò\18\9e\8b¢\94È\1exºÉ8¶i»+'6Á\99ç§ÄôKçµU%7\ e\12\ 5\88{\ 5
+Èÿò\81ü?à\7f"\80B\aÉl\ e\8bAfûA \7f\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&íÒ®\89»»óâî\ e\8d»6î\ e/îîîîîÒ¸Ó¸»7îNãî\ eû[kÍ¿'æßs²c\9fMLÕIeæ]÷s=Y\15QY\14$\8a*\f¦öÆ@    {;\17\ 6\16F\16^\80¨¼2\v+\80\85\91\19\8e\82BÔ  häbio'fä\ 2ä\ 5°ðð°\0\84\ 1¬Ì\0\16N^6n^f\ e88
+\80¨½\83§\93¥¹\85\v\80Z\94æ_*.\80°-ÐÉÒÄÈ\ e oäb\ 1´ýÇÄÄÈ\ 6 bob     tñd\ 4\0\84ml\0ÊÿºÅ\19 \ft\ 6\ 1M\19áàXX\0¦\96&.\0c ¹¥\1d\1cÓ¿\98¤íÌì\ 1\ÿI\9bº:üWÉ\rèäü\ f\17\80ú\1fN\1aÀ?\94¦öv6\9e\0\19\1c\93\82ý?«\ 1ÿaùßÆú\7f¡úïæ\12®66
+F¶ÿ²ÿW\9fþ\97²\91­¥\8dçÿ%°·upu\ 1:\ 1äíM\81Nvÿ]ª\ 1ü\ f\9b<ÐÔÒÕö¿W¥]\8cl,M\84íÌm\80\0æÿ¤,\9d%,=\80¦\8a\96.&\16\03#\egà¿ó@;Óÿ\ eñOßþ\8dÀ¤!­®¨­A÷\9f\9f¢¢\91¥\9d\8bª§Ãÿ´ý\97úß1Ëÿ\1dÿÓ\1e'K\ f\80\ e3#33Ë?Â\7fÎÿºÒûo\8b\89Û\99Ø\9b\99\ 3T\\8cìL\8d\9cLÿgâ\7f\85\12\11±÷ðf`c\a0°r°\0x¸¹\ 1\\1c̾ÿO\9d\9a\9d¥£+PZ\fÀÁÌÌÌÅÃþï¬\89«\93\13ÐÎåßoÁ?ûý¯ØÌò\9fî\0\81\1e@\13¸ì\1cLKP\ 3zBºGÃ\87¾%R\8d\8eéeE¸îÒË\f\8e§\ 2¬?c7ð6\90\8c+Vá¡Ö\8a\ f«\88\8a1é/ÔÄ\82\11\r~ò|        }Oú\83\9e\9e\9bX´f\93]:û\8f¼5±Ç\fs迵Á\98\80\ 6:Mt\ 5\1cÞú\90È[w¦\ 5.\ e=·Ã$¸-ïK£~=k¦ÕÚt=ã«M\7f£\ e;AxM\96ÄÝe\93èr\r\9eê¡ìfDMµÑq<ëYÑ}m\83ØB¿Ôî\85\18Ôü\17\9a¥,4\eK~\17L1â?ì\97\14\1cKIýàû£÷×g\98\12\8e7ͧڡ¬X'â·(&.!\ 4Y3\94®\97(Mxr\8cõe\r\9fS\8dÉ@b´\9d6\0\ f\v £\f%ôé#\ fy _*e_Â\8f\94\ e\1d\ eàV[\9f\84ÇbÕ¤nàóqóÂÓ\1có\ 4»Qµ+\15\12\13z\ 3R¦k\ 4\ f¬ThÐÅé)¹u\fg´¥AÁ>$`Õör\99Dö×|Y\11\7f ¨4U¯ÍY\ðRÅ/Þ®Õ\87n2<\83²ÛäÂ\84ó\93Áaa%5Ó\8a\15\8b6_®òl\19ZhkU\96ä\8fè®î×ÐæèV¥²§bÓâå\v-ÝÇ%\91\8b\96ân¥=\99\ 3ð\84¢çVó8\1eª2ö\9fbØÌ®ûeµ¿PpÖÆÄWa\16_výʱBq
+\1d«äíH\1c®ªaóZ¯%ÎÓ\ 3¹å\vß\ 6\9bÐùZqº\ 2`\18kËõ\\94"îÌ\9a\b\11ü<   M\ 4±.SvÕ°\8bIL\8eåºÓ6õêÍîJYømýa%Ôa&\85$Ðwo4¡yo@\ e»ßÞ{s\vú\96úhÙ%ï¦û\1fM\ 3\13\88Ø)u)\17\ 5C»'G\87\89^/wèrpr\94U^\8eE\82\96oTVæ\82k±Ï°õõ»\84\88ÌçñòÏÐs:ï;Ñ5GÑË4E\9b²,+éð¼Ó\rT¾Iç6ùv¼¦±ë
+×IÔ\83QF\82\84\9b\bùÁ{\85d\17àërús\Û5»\8e1\rÀ'\11¾èkÁ©*\17[À©e\94|(·]ÛF\9e*+¶{d.`&dMm=<@ª7Ät~ë¡L\ e\90y\7fWi\16ðdÇáIÂ^\1d\81\92³\82¨\86ÿJÏ©út\9d8+ x@­H\88¶åeô³äò`õ¬ÎRª¶ä\81\r]å¦þº\1a\8e\ 2ú!{\1eE\r\8aãY7\8ceä(1\14\98-oºcJÝ­óyÌ\12\80ï¿Ü!öPX]|9ñ¾Ýv;E\87Ý\13\94Lv\15«¿À\aûdiOÆ+áiXYÇ\14\94\81\9e\97±\9a\80P\94\8bÆ¢{°\98\ 4hÛÅT\1e(mueé\1c!\8dÑÀ{êÝlu\9dÝ`f5\1f»Ú¦y\7f8Ê·ÈÞ/1\b.ÆÒ½~\ 5^nz'GZO\e3-Îyb!-[\v~\85Ô_
+L\81üð°¿vHÛ°2Á\1eïÆÖØ\ 6Ó\9b\18 \922½£S\87\96@V¯öhÆ\1a\10³éo[ål³j-}.g2\17\9f¨ÑA¬
+ï²w¹\12Âb¹\v}\8e\8fQÖ+àn5\96ð!P<\11^:^\92\95*,<ê\88\95\91¢*        \ 3Õo\8fÅþt.Ì\ 43è;iñZÉ.ª+YÕ¸=\81ÝëüPÆÊ»õrh²d}ü<\88Ý\v4ïÀ
+eîGË_d*\ 3q5Ã\983\ f5Å`z\80lFj\1f2}ðó$Çö=¿ur93ù2ì~\84å\15TP\9dç·\ 6©\ 5û!ù*àþÆåÁ\1f±J\14\9b~ßR\81\13\89\ 3²;\95.ïɠ     \8b\96\93ãM\94Îh¹c±ô&*\9a\1e\17ê^k\80Ó ØÆõëhòÕ8á\91\19LÄ?Þ§¿\ 2'\9b»U9:\ 6cx²l¶øXe%\95­Yü«=²²\8fK&?\85\14üG\9f@¾¦v'cp\fÖz\13µn9^\9a\89\89§'\18\ 4r]\13k0h\83@# \96\91´ÄUtA\1a\95$\8dncµq#J\829\9aÿ×ä£D\15\9c/.ñ¥ôcØ%\a\a\14\96,;µäPÍm\87\18\85Åþ\0Ú\ 6G\9eÐ{;H\97Ç\90'¥§4¾ì-\82>cÌ\1c\1a±\10=ýsç2DÓ\10ös
+zú
+\19Ma\8b\9e\15\83ÇË=\9b\ 3®\râ°{XY¹xÄÒö\ 6VÇ«hÍ·gsO\ e\15=?\96\95 U\19ËD\10¿\80ü"ååá4Ó\f³kØuò\95\9b(\ fÉ\90㯨\84\f®\957CæÞ1§HøYu\1dYÌó-\94\95\1c\1eG\19ïêþ\ 1\ 5\99Ì=\99\1cf¸uÄ\ e{\a\95Óê¿à\98\8a0cÍ:\8a\aÄ¢        ù\18Ëá¦Ü\16Q\aaÁV4\11Ú\8bËø\83\85\96¯\89\97i÷YÐ\10 rß\88ÐBÖ\1fj\80\16Ó\14Ý¢.ò`Ñd¸ì4÷^d+cÇü\84+\15Íq\82òý\19¾¦\90\9cMC#ú\98\ 5¿[\7f3e.\ 5Áäþò\85\82F}·+\1dÞ\92Ù\ 1\8et3Æh´öÚ(¿1A$¹ÚÎ
+x\9dz\v\9ccá[õ,\91£yJ9î×\\f\17\94a·²Rá¥\9d;:º%Aé®äµó\ 6­\17\rE\97Ú/FÝiÑ{\9a\ 6\87\19o1\9f\83\15+>Á5&vZ\1f½\98`³_R¶f%\8büÓ\8d\13\ 3´\r\eÒ\a-ãa&Ö\S0\7f\95¢Uþ¨ÿ ?\86X+t/\18\9a\82ZÒ³2v\91QÙcõ\82\9dfl\16\ 2\9c\8b\85á\7f\96¡gs<\909\14&Í5]îç\ fþD\Ñë\rªª7\b7ÁØ\99\83uJ||}\155íÈØ\18¯È\açÆ\8evc`X\9a\8eäyUTi~7\91{S\15\8c\b\eÒ\93g\ 63\1a\9dW :\0\r2\ 5c\14E\9d\81¦ÕÂ\8fϺУB¾?âRJMôÅÿ\89Ãt¦¾¸í\f×3ÎÀÁLTļÒ_[â©.¸k\93\8a©\81×Þòf(uÔ/¿ ë\11ßÐÀ¼Ö\86z«:Sí\909¤/+\8c[\93Dµs°\1d¾\13cÃçA>w&\1d&k\83ǧz\8c½Ch0æ\15å¼=w»\1f|\87\1dÕèñ;ÏåeQç»Ib\9aí(\9d&\84j\91P;?\8d\92\95¾×\8a\94ò]±æ8H\1aÊö\ 6ý·äÊêò\97DLe\9a®\97î\8c`)\93yF\7fP)xvhÖGjæë©ÖCkB+Ö\19üßMùÔ\8a\1f\ 4\8d#$y\18\9b0¤¢?Ói ¾\9fÆ$\rº~DØTM\ 5Cuë\1d\84q*\1d\97\r:èåø\94þ*\17ÐòÒLÃt²\1aW\9f\99\ 2\9d
+ÌÜþ¶°¹\99\19\7f7ísz\98a\1d\aaçÑ6Jz<²\ 3\97\15\f\18\ 4\9d²u\80i'\90þS\7fÒ$f\99HN¤V/vuÚ0\9b\12<b\8b¤CwBCkËý\95-ýÉÜàO¢9\8b\12N\134\1d\93\etuaã\1eì|³!\98_·£·\945hA\17Ü\83k*F-\15\92b¡îî=Pðîà\12\84iõq>¢¤Éòn¹\8e\8e¸©\8b#\e\8f\84aç(\14³Í\8bv\18Aê§ÅpD\9b\19÷h­J\v\148ZìzéÀ²PÕ}¹üQWB¹¶ëdnîn\ 5w\17\85 .`5å\a,\98¼øZK\aÚ\8e      4D\ 5µ±po^Ó\1dÑJ\93Aa\8bÉkuÁjº\16\16â\86yÚ©Ò±0\99¤áR\8b&\96kîN\12xz\ 5\12mr æ\8fPÚá²ä'§¥\8cÚéã\90§     ¸¦1\13\18,F¡§\86x¢Pø\1e\ 5<LÛ»$Y'\80Ï¡\11"\9aã\ e&jÓÌj©Õ-®shGÞ!\84\19en,\ fù\92Yl\ 3\84Wñ%t\vð©~÷~2\1fí\92E?á\f\1dD\ax\93\eMØáòÀ\83èó4×Çî\9déÎeà»KkýírW\9c"%\98}ÞxGÙ¨~ÆzæOaË^ÓåQGsêa"bÎOÂ\16ò¤ôßNV¬"\90\a\9dÈØ\ 3ª\85Q/y\8cØ\10\1a\9e\15\93\12Ö/,F\8b\e×ç\9b\90D\14àÍó
+
+\8d9\13\9fs w\9e@\80:\9e\81\9aR-F\88À×\82\92d\95î²ð\rC\9b/\88ô]'\ 5w3]NCûD-£¦{A¼\91F\fb\99\85\86u\9cAL®az\9727\17kõ        E\80\12j¾>\9aû¨Ê¤|é\ e\19û;kÝ\ 1®R\1fÏ×̦Oøï|\1cÎ2§àI\10\9a\88ÄAbúQ\11§\97\12,|\1e\1fÇß\11\8b\963\12\rÖ\9fݤ~\95gȲ\8b­Ø\11\ 5É#éT1\1dÑ´.*\82ì{)¾Y\12\94Ôà\9c3¯N\14Ìi¸ö%'Ä\1e  &g¾ñªB\1dÔiÿZ\f ê\95FôÍØïû\95z\10
\18\88¯<ÆÆ;ôÒX\92\927#A\94>J\ 61\80µbp]H2Qcf~yþ\8b¾\15ë»cÚ/¥{Q\r^m\rw\99³»BüP_f\0\89\19CNÏx\ e\8b8oÕ\ 3Ò\80¼\84\r\9am\11}\1a/?Z\b\9f\8c\8d¡Q"\1eãpÆ|ï\f)Q¯\ 1A\19\87\eÁ\9d\ 3=#{ÿ\97\19ó\ 2K>\1e&Å,GL²|Æ]ÈL\14jìq3ç+#\17\98{]K/\86â)!ãè³\1doðjXD})î£×Ø\v\7f?$³ïl³\ 3O
+\9aç\13ã\11Â÷\ 6µ!\b3rd\86\8aZ/\1dpa\9e\86cq\8dxwÚ/YÊTJôå\82$uï(¤]\8b\88=¹`¸¸\98.\1e\9e0ò¨£Öì\rÒWsóØ_°\88{à9?I\rhõ´\9b\14\8a\84oX¼ûJ\b£á\99k\96Á\95²%d+ú\81,B\1d$ÞöÕ\10ü|Åë]N\85\82~\80\10\a\99"Æ7\8aþLá\94ANR¸Ib-\10¸ÂI\ eFß­\e4²¹Ôæ}Lv¸¬\19\b\8a´ ²\18CÁ:á\ 5òzW\8aíKä\92HKaxQ\82<!\89¿ÃuJú!A\94zñ%õÆ\92`¹Ù\r\vñ\ 4Å%\10\ f\8e\9fªLÁEj\81\82\1dÌ\12B:;\98µ\93HïÚ
+­O´Î   ¶CZØh\85\1aR\92é\ 5Ñ[ÛP_aÅßKDÎÇZ*ËíÖ=\90¢ý\80Aj»!iT\85\80\1fKc/_?.\80uPÒ\85ê(\97~UPO\ 6[\11\80\ 2\1d¯\86ÈtVtm»x\1d³\89rFÔ÷dÚÕÖ\bîê4½èøsÓs\ 1æùÑÛB¤Ò{2ë6¼ \7f\82
+\ 1\9dê\1aC\ 3¯«©<J\9b\ 6P\ fVn½MouV\1e¹ê»ÖQYÿbŸ.|dps\9fÝ°£\1c\99yLÎ\1fÉH\ fEÓ]\93è%ÂU\ 36#\9aí\86Ñõ=B}}F7
+?|!
+¿þíîeOn\1dÍ×Q\9a©;\8b\9dc}Ú\7fd!Ì`\1a¹ìqÁ§\1f\1ef Ì\ fU\10í³WS\7f\81b\0vO7\92*nc¤À¶´%\19\13T­±K¨\96\83ç1
+d¦\87\90B\b¦;Å zAá¦]ê\ 6K\15ë\ 6¥\\16Ûù\8bí«Â}éE\93ö\9b\9fÓY`×\14¹Â\fÄk°\81ú'àÇ3©åf¸Bã\898|a\80×þ\193}\178¿ý:H0謲\9f¨?\8bê¦@¨\9c\9fD\17\9djÈE5ïñ\11¯\f¥w`\80o\ f\89º­FúÊÇ\93ú6õ×\ e¨¬_?ƪd[ãvÍJ\86ÞãwißãÕp\16û\88]\90¨\Gõ_caó÷\98­\bÓ\8d¥Ãì\8c\f(âç\9fw\13\1a\89®±TØ\94\9f\a\84½o\ 5Ùøs\98ÐÊm\17j.\v\97÷\97©äj(ì>\f«Ûù¢\89Ø)µÞ\8e¾\8f'iÅÙ\99¡±Eët\98Êñäb\97Ä;ßÀ¾'¼\91°Í\fX#¼
+\18ƨ\14Å\87ça"ãþS\9eÑÞù6\98LgjÂ\89ìki\90À@\ 6ä\97\b \eæ0ô\ 2¶¹à%\9c&\96ãéOYÍú\1a\e©möù\81\97\80ß\1e§\83+ua¨#~ \1dEÃÕu:\95jÞy\ 3jµYÃ\12\8b0aZ\ fE\rÓv\9cO+0öÝ\1f\86Ю\ 5Á8&#.OÕ_Ò\1dî°ÖEg.tþ­à\84\89¹À\9fy\82¦YL_~\r±\17\9dæWÛ\ eLáÇ      \8c\9e®p\89÷]Y\eø\86cÄ^Q\99\87Wü¡\87Mè¹a¥\11¦ÑZ\12P\18\ 1sûD\7fúBuµþ<\89^\1c\ e\82É?ãú¹5\86¥2
+\10G4*Eì\9e\få'0³R(ö´\92Å\94\ 5=SÊUÝ[A\ 4¡z2È0\8c\18\86àx\16\97G9¨úT±mò\1e\18è)=ê\9cñ\91I£túÈ¿Àý\ ed¬;\8cØlq9\ 6õªñÑ\v34´Ì\13\8aùØ\7fQ\84q))J\92\94¦cï.-\80\19w,Þ\16v\ 1ø\rFHv=tBÄk½¥Ö\89Un¡z#þx\ 4©ü\89q9wå¢òø\87\8fÆúÊã1å}\ 2\8fé\1c&ɸ_¿áÆö¯MÞÎ\a£?¨ºÛÖó
+´ïl\9c@ôõ\19\9e\1f\88áßäç\92\1eRjé\8b#û}¨bò>äFö`ê/É\17>\96\94á\84²Ñð¨Vq
+i\13\9aþ\evÍJ_Ø     gpÝ)){S\13%IªÅÜ¿*¨£\15\851\íä­1\82\94Ô¹©\91\1d Îse¨F\rα¶~øý\14\8f\18\ 6ÞF\8e\&­[Ë)Å\84N\ 2\9eì¸lz¶º>C´¤\9f'\81$ : m}8¦tè÷^-ýå´²=íkº$ô\91\8d¡Tñ\9a×~\9e¬q2s£2>*#\90\17ëh \822¨Ã\99½-\95&®3léDÁ\rË­õ¬üóQ*3¿ëük\11{GQ¯C¼hpß\98IôfI^<³Û[Y\8axP\16öì>@åk;ü\99a#Ê\1fÑ;RÃ\ 3ïl8Ì\a\88\87P\99,ÐY\v³|xØ\11¨â~\19\113\b^qüõQ.\16\8fk\87\86òɶ¬U¤þ\10Íö\ 3\7fÝ¢\90\84¨\ 6$£9;"\8cÞ¯µ2Ý\80ç\80Èðm³\0iL\8eÈA¿÷T\9d{q\1dÅ\b\aq\9b\88å÷\ 6ë\ 5ªL<RÀ9ý¨ì\11õ¸´ÑLFkvÀ`98û\12¤\ 1c\8fÅ¥Qe7/2à}¾2üI\18ó";\11MàgpQÓAeá|\87\18Uo°­ä¥NÑ\9f⧬í\ 6Å$~\9e0\1aíÝÉ:S¦\ 3a+o\16Ô\9e
+\ 2¸Ø\8bz©h5æj÷`\ elØ'ëZ\18_×Qu\fü\84ð}ò\ 1êÒ¶!¹A\9e°ä;B$Ò.Ñqm\15é·e\eí û\15Ð+½ÈÈDÚ­§\8cä\ 4(ôC[TZ\12ÛìòO\87ujÜ\7fÕ&òJIý.ê¹ÈÛtE}\14Ì6sÖ\b+H\80û§Gá·\927sE\83\91¥Î±\r,ùlLÑU.n¨À-³\8a\12\89\1d|<¿\94kGy\99"5öHþ¥Àþß\9c\7f\89Ï¡\85½lmñ\90v\87å±ÍÔ\82KÆûÿ2´"T@«\9e«\91"ýáf¹\ e¤·æÊáçN¿\9a¨æ½!zQ<c9ºó\\9aGÎv[\92\9d\10§pÜÅð\91Dhg\ 4§¤\12˶øíbü\v~Ú|À¢ã\15Ô\15TGmäT«L÷çnÌ\95åw¥Å4\84\85)\8a\9f&aÜk\1fÍ\98'\88ÔõÖ\80²§À×ó\95\9aC\8et
+G\ e\17%\99Ö|E\89]sk-ZÕÍÜ7è>ɶ\18Ú'®Fá¨wáË7\1f\93]Û:t\11%F\1c\86*\99\8ft2\17\8e65\ 5\ 3ÙÓY\12-ç}\95c\90§&"\86Ø\9br¢Þ³jå~­\81ÙëH\8e̺µ\v×\83Ô\0Írß\9ej\1a¹+\ 1¦P\ 4(\9d\f\90\13\86¯Ú\9ft=*»?\ 5\98\92\93\ 2³\8cͨßÇ\88Aj]¸Þ\86ë.ì~\9f\93ëBh\88\f\11¸æ\15¤Ã¸f7\91ÝKv\18\12\1d;\8bÄ\b}
+âLrôs¬ÙDÉì;A\861¬pD\9d°Ýw\83t\98\15~kZ\bpqÆ¥Ä\ 4û]\0RzX6\18[æKL:êÖ\7fTzYR\14°\8e»2G\14g\rÇ\98QøtKD&Ao÷ú\95  ã?(\96é¥Y\16\ 2\99\90S>\80Æ\91Ú\98ßõQ$[ïçtIÚA´ÞmP\90Ú¸\È\8cÈ~\9d\ 1§ÑO\90\11\85\7f,Æ|Ép¼:ÊT\ fX\98\87t'8b@³a~\92Ó¹\81kÙ÷\86ï\8dEWÓ(2\ f2í·PB>!\9bÂE9<àu7*Uµ_\86E\ 2ááH3-\e¥ÌIñ»Ì\88÷§nÿË\95eg¤on1â}û«\8a\10û\8f\97\0E<â,Æ:¡Á«÷»\1enìO~\83Â7\89\12\vÈ¿S\9a\82v?kÄØ_æÐzÅÒ\19ÄR{y\82\fÓäü:\91½\92"D?äà\9f\v\9aÉíT\15\98ØLê\ 4\90Ì
+Á÷\89\ 1ð»C¤\ 6þ\8f¤=JsÞöÚã\vw\9cuiI'¯¥IJO\8fX%[d\19\ 4X\9d½f\ 1H:\1e{4%    ø3õ¬4Ú\ 4/B\9cb÷wmÅkt[\19\8a¹\1d\9e\ fèN\99lV:\14\83\ 6«s\ 2t\e\f°\14w\81×6{¹\11\8d6\96ÖFd\ 3$lã;Á\1e­lë?Î[pPS\99à¾\8b±\9c\80Å`C\15@Tõ!>\87â:\1aB´V\98\w;åÙí)nï\16/Z<\85÷ë\7f\1c(\98\ 3³Ò\æ»\160ÜPõ)D\10\9c=°_w\bh\14\89\a\8f\ 2p)â\81\15\81e``õ\12\90ÚNÌóc/\8aæ\1d]ða\84e¤Xù\a"0\f\b)ËÒÅ\80Ïý\96r\18MUOAü8@Üáuç\96W¾ä\95¦Kb\8bQeÑ\83\19Cì~ÔE\8b÷i?¹ë\1fÀ·àyXZ\ 5FGËïƶ!]8o\9e\8dæ»}q£H@ÖQ,ËuúQ×\15$]\v°²Z\82\8ciP¬\8f\ 5\9d\\vï%Ü ýh\9999\14ï6ñGe'þ=\1cwN@+\135Û%ã´·ðÂ|òÓ\9e\80\81\vÄ¥U»UL)åJ\ 3\8b\9dÓ×"Op\96\ 3ë\90þ·&S ¿æ,<\19ÄzP³³\80ú8ëÄ\ fÑ-êõÈÃ\1c³W¿N¥4Ç9©×Õp\98\888\83¾¹n²Þ\1f¾°\95®\97\13?ä±\ 5\91/\13Ë6\1c æ\1cÁñT\8dMbä©FµHÀÎÎV\82×Oô­ðÌ·Tx¬@øZæµÍiÍTïQ4jCh¶C1ÏbÑO̱\1e ½NA\9e\ 5g"·Ç\ eÉÀ\1au))'ð.\8fu`\86 \vî#\ 6Ëm/g3\v¢Á`\1a$\8c\86ã\12ÛÙÅ\9daS\a\r®É\1a\8d\8f~?3%uârm\93\19pè0\ 2å\94t¿|i±\86\13©B~¡\e\9dì\81\179¾Ñ\98½\112Lv)\9ft\85.z:
+\r\99°¦\9dÎ\88R²ò­Nå°£\81Ü\94Ú»¼\0¬\9c\99º$\rÄ\a½\96ò÷Ñ!\ 2xPÓg1d¼]\97÷þ\187\f?\92Ý(¨\88æÅ\87\9cR\96\ 6¥\852\9cÏ
+x\84²¸å×;\1d\85\11N*\ 3¡{¦0\95]iF ^uôûR\1c$Ù2¾VëBÑÐÃJ4éUU;¢|\ e¿¯\a¡\85\8a¤=º}µ¼2@»Ã,âF.O\84üÃP¯Ósx\13s;\86Ã\ 6\7f·\14\1d\83×e-h<ÜfÈÇ3\87d.Zn\84Ñ\\9f\914YTN\82²b\8efûòG?\809ö±æ\90Ì]M¸e\83Dh² Ø\1c\9d´¤Þáõ\18ã\aqÃü\96\8eüg>\80Ü\85RÚR\ 4éÝ\93\88òN\7fðìµ²\9e²ËH\1a\8e\ 6       +\92Lé,\15\1dÒ®Fl)jïXå\89c­ïÙ\8e͵ÏOkgù#½Væ¯MkÖÙÔ$üJ[ú·>\1c\vó%\9d6\89ÄÎP×Y\19\14Ø\7f\96
+þ1ûë¶/å³H$\ f)\95ßµÆ<iN×$\18»\19òÓ\93/¿olófu»çÍÒX©r-Ô\a\88¯\174£ò5U(P3E \f9¾a#G¼ú\92\ e\ 5õèÒ²\83·Ï¼Ú=O×\9dºdûÉnÕâ\9d\9b|¶uó\0\1eèÊR÷Í\eÃçFÁ4â-urW\18ä²k³-n@ʵ\1aß«÷æ\83\92T!ùU$n\15ΪëNwaº\ 4«\950­>\12o\1e¡=½è\0
+åQÿÇ\ 3\a\ 3Ó;\8e#»%l\9d\8a£*\1a)\85¢ÂµÊÜ˹wêo\ 1÷sad\9cì÷g|ú\93Gr>\1añJ\ 4{\1e\19\81ËK=l\8f³e\7f*êój\9d\fãô\a8ý¡\1fÚ\86      ëb\9a\ 1Uo°Êþhji\93\ 4\9e?òJ½ýKðc\9a\89\ 3Óâ.¢Yθâr¬B~\17Ç\ eI@Âo3Á;+!\b\9d\90Hþv\ 38_A\8b"êîÛÈh\99øF\ e\83i½sÒ× \ 2\16Ò,\ 6\1f\f«M\8ctZ±\9aHAv\9f\9f«÷\96}Bë\e7\9eÚ\10\1aKxxå\93\87¤\8c\12d\j+9×\84\8c\ e~        ²{Wc2!\0\ 6G\87X®¡r\16\83É@\7f«À\8f\9a\186ÓÜ\8a¯\86)°¨ų̂\ fý¶\18X\f1\86-?ã=2á
+X¨9ZX¼`Ñ\80\ 3\e\88\8bO5ÑËuâF¾\ 4\18\8a\8dL\89\19wmÿ]b¸K¯ám>cÄïkv1\vZ\\83?¾TuôHQ.´4+}<\ 6s½ôùl\fÞmqy£
\88q\91\f\98ÌbÖNµO+\vö3ië\11ÕK\17\8dð \8e\98î/\9d½\ 5Ò
+!\84LøèDq\ 3ºÃ\13¬p \81NÚÐ\ 4xW꣹Pþ\ 1Ð\93\10[\1a)q:Ù\9a\84$e\ eÇóí\ 4ÝF¹$#æ9èf\ 5#_\ 5\91i
+eV61%õÓ¯ç\ f\18W\ 3`\9eö\0z\ 12bùÓ\91\rgÏÛhÝ¥¨ºmúüÖ\bq*g\92ë\8c\8dò\99îËj\r\1câTW#ðY9A!\b\84<KªÏT\Õ\e׳ÔÓÎû\ 2\ e\8b÷B\96\8cq£CÊ¿\12\9fd)¯QÎ\ e·kSäæ>Ø\11»f\ 3âïß!\93V>\ fU¿2\1dcƵ¬=7\10r\92õaV\87\:Ì\91ßCÙ8s¯o\8d®}ýîïO\15ÿÊ\88\13Z[õLèÈA S\8e\94ÿ\85qk£\O!Ý5Þ«åÈzå²4^Â\1fý\eØ\13½|l\1c]ÖUãE¦¢àPv\99=l½\19]ªyäBQæ´.¿\87_FuV 4\9f$µíN£\99µ3=°­\8d\1e4~L\94÷«ÿ\15ï\8d,gMåÉM\9bßFIs×ó×_\15\ 5·Ä\11\15L%Õ½i§2`j\84w   \981$ÇR÷³X"Ûªáó:áµ´\16\1e\11¼Jo±ÍÁ\9bÎB7¡\bU7\92¿\ 2W?ÚÆIãÏoÀ°ùÐóa:÷\9f4÷=Ð\ 1jÉ/þ'>§Ð\83~.¶;xVÏæ@ËÖÝq<¹Ü\80
+\86\ 2¶F#ú.\ 3\1aNËaû»\15\96®\13LïnÖ\eOÓ»\1e;\1e­Ã$î*Ý%¬å\ 6³æ\14¬\1fPÄ#\81ÙÁ0\12î\85ô>\ eå\18\1c   Í\19åD\9d¢³Ä\ 4ra`~\96â\8d'\bÒkq\8e4\89B[+XM×G66\9aÅìÓ\18ç½UµY\8aGãVRÑ~ä\9c²\9a\8fß\85¹¯±V¾¡´N\8f0Q    Àz\1dÖn3y0¥z"!þ\1a\88·î0´¥\ 3ÕÕN\8d\16Þ%̧\8fìÝp\ e¡K\9f\1f\81¹Ã\98'ðÄ\1e¹\92\96\ 3\138
\14º\17\83ß»·\88aµ2ñ\ 5Ö\80}zÕCèY ×@+q\17aV\86\15\ 6\rÛZ±\87\ 4pµ¸×µkÁ»h«2fíd qgiýkJs»­<ïÈ\1fúl\87#\1faøÕÓëÒÊDÈÕ\95@"Õ¢IdVÅEdöÈô\1eê©\99\13Öö*\8aÖÒ=w/\93\ 5>îñ(="dFB@a\fÀIE\92\\ 5÷\97A\1cBõe<{W\95\9f\1dôdõ\94\95>
+â&wßp¦ÍÇá2\ 4\ 4J\7f\15\9bÙZ§6ö¶ÿ/YWë\1cß\96=FRNj¶ì\9b?        \8còójëPÔ\eñ\ 5ãºo\14\85¿u\84Ì;I¼        n£\10\90¤\1ah\90\97r\1dWðÏ¡¸ã¶Ü}\93v®Z¼##¾ÙwN\1e´Óè2Y\1f\ 5³â9½ÔipwS+\b\96D\v.¾Üv|TÝÅ`\\91[[n,(\9a\14ª\v\9fz ÁàyZø\11äô\1d1\840ú È©+Ö¤/XÅ\99\19s´£øâÆ\a}¨ù©jûÉçî:òÖ¿Q ÌZSL\86rëî@À\ 6F\89\86\14ýI\17Ê¿i±3Í\11'Øó\ fpF,ñ/+~Óõd² &\92;"Q\ 4ªó\18\ 6oÊêÛ9¢@l>uEÆî\9f]³Gq¡ä\99´|\ 3=m\17"Lë÷<\88ª¹\18f¥^9X)\92®¿\fñ(Î?\1a_qIº¡\f_]rÄÐL¢+L#\\18\9cßC\ 3ʲ\11SDõì6\ 2P7¼\81û\8dÑqÐ\ 1;²6àÎ\97ãT\b®)°\13\87t>·¿\b\8b~\83\96A\9ec<X}Â\1a\19ý±àOó^ùi +èÚ\ 1bg05>\15\ fûËïs¶yDr%\12ço\8e\94æH0D7¨[ÙÓÒ\16°\9e7°çm\8aaãÖ®{Mh\91I^\1c'Tt¬~ùP¢¨\1f±#\16|\9d\8d=\97#,÷ܶv\1af\94î\8fè\86¼=\r\9eÜ[\94\v6\82\f¶ÏFýI
+\87Ñ\96\81\eà>þ¾©<\9d\92Q63ЭÛ\98\10¾T)\9a¦ÿleMf\19\9c\1f\0\ f¤T6é+>г\a\96\10\ 5íjNµ_Í×د,\16Î\ 4\aU\ð +\11S:Ò\16mýæÔ\16¶µ6ÀItï\134¯í~\9b\v-?v\1e-\16'\17D\83¨
+P\ 2ɱf»\1f»åΠ\91½\7f\aÃG3\9cË\7f\8bû\80§Æâ\85\1d\87Ëo\9f[\94qË´\rÈ\8fÁ\8f\9b³H:\91\ 6=*äZ3j\8fúsÎ[0é\9d\88*"±'\rþÏ?ã\996\b¼Ðu\ 4®¤ä\ 1D\84\16z\85Tѯ\8buT#éÓª\f\98 °BBíìI;Ë>Þkõ±\1fÓéJä¥*ر²e\80\8d§´Â'OO¥¹\84×\9f\1c¬\vÌ´ñ\1fú ö¿\10+¡C@­Øü¥Æ\956-\97²c_Dô¢Ê$j\ad\13*.|\18ø\93Ð\8fzÎYd´\1aQw`9P_È\ 2xßÈeÏc\7fȬËrL\1cU{\9c;Âñg¹HÚFû!ÙÖ-½æ\ eµ,¡\8e\v¹»Èý=P\8cÎ\8bí\ e5C¹¥WÂdwZm\98§\8dDÔ9\Úõ\7f|\8d\1f\94\15\11 ûy'\8c\8fu+óÏ.×\89®o\ 2ù\8a\fà%9\94Ö\eñ´Ø0+h?3\18tSI¯o\93\94ÞinÉìVW \ 27\95\90!tNCÚ~Ó=þàÏZüÓÄ\ f\90äP7\ 6·j\1dÓ[þ1L37ÃÊö\9b4¡ø<Î-dѯ\93ù`ývq3agÔ3¬;Â\1d1\81§'\ 3\ e<      .\87øõêýdw\ f\ fì\15ôlNÀ\81Ø\89\8f\1aB\f\10Jêãô\r6\9dËýÍ\9a<\94OE5\89N!òïP\f¶*ôæY\9c*Dö\ e;:aýY¿ÐHã\8cÂ)rAÚïÃ\99v\f\rAçÙµØ\8c7c«à\94¤y¢ù·²:-ó\8c(Æ|z|K"VHè.µ¤]uÞËp\8e\8a¿ñâ>J\11dôSý\ fu]xqwí\8bb²1wÕ\ 2\8fHç   \0\11\8fÈTШ\14Ê^¤ó\94Äëá£JWö{\80Úø\85UBñ\9cZ\7fOñ6¯ÕÍ\9a{·ý\9d\81âðs8D\bØl\15-\88AD\80\80'ÌüØ\9d©îdçá¤õ°\8cÖÜ\9d\8d\9d¯ü\83¥DCÿ!ÇüÒ\17ÿ\ÞÎ\9b3\96¹»DÞ&L ¼2Ù\89\fò\99¼Èi\9fΰ\9fòkàe&\ 4¼²d\9bq\ 3\8d\17?\92O\97\a¼i\81®¬tú\ 2¥\83\ e|\0á.ÿ\88\ 27 å¹¼eÜzU"˾\9e\8bÜ ëÕ\11\9bÒ#fs\826VvÚ
+ÛL\93hy!l÷-ÜÆø°\ 1òe¥{\8fØ\9cd\ 6\ 6CD=×~âd\9de¿¦ U^\7f\95JRPèx3ôLù!¾"¬½\9cy\1cW\8d±¯\98£¢\85C\16\ 4ãHß=×\13P\8cmô^\1c\8b\e |oCíWÕÄã\10\1ea\oÀ\89Å\8fÂÇ\ 3\81\9e*\ 5\19ñ\fñ$]Áè©ôÖÖ¸\11ayªMèùfÆrT8Û\91îÙ\1d,\0°>8\vÇ\zÜ ½¶\ 5\1düÐxÒ\9f.ML\9eäËóË]QY*Ð,~\94-òF\17Ô\8d®×T_\ 5W[Ò\ 1\15ø©S§S \e\ e)~      \9fÛïô\b   b\8a\ e+µÙ\95¥Òà¨\89\f×TÐ\ 2=\f\99î÷\8a·ÜB\ 2ïÝøÁ:%¼!\13\87b;}¹\11\9e!ã!\1eÙS\16òPÜ)üä\87ú<zT\aN\8cK¶?\8d/Ô¥$T\1e\ 5Ú­zb·¢»¼\98õ\aæ\1cÁØ\93\92=\8e\r\ 5à)\9eÉ·\ f\a\fªÈ~¹#\13\ f¼1\ 4µ\f)2\9fJòSëG-íh\1dØRñ¯·|\9b\ 1Ðu¥\11\98¿yc»+Ròâ«ã/\91FöOÝ\17\1cO\r\9bf÷ðvO\11xíztSê{ã¸\91Q`8èø\ 4\8eب«ª\ 5\8f\a=\1d}@µë"Ý©¨5`n\85±üÖ\9eȽü:jí3f3\ 1é\97ÿsó¸Ã\84EåíbþÛO\945p6QA\ZµWê\ey\ 1\8bNG.9®\ 3íÐL\b\9fÐQ2\8b\8bó¯ãA».ìÙdz'\1ee6\83Ã\17ÿ|E"ÿ\17Úüa%ì\97z2\11ó<A\92:p«´ô\96Ñ@$ö\0Ææ'FÇ,V
+sô?SùMMr)áÖk\1fM"\94Å ê\85â\12ÁÔå*hòì~G5\1d¦ÎÖ\8d\97Î\9eØÚóÅ\8bJ-µàSªõörV\92¸à~Q^WÈ$ø\86è\19ø\96Ù(ض\81eDìÔz\ 5\87\85[¾"\12ÅÚ&'\9eñ±\ 5¶Ì¡\87"ÕÞf\11\ 3B,º¯Í×èFí­i\8bÕH+\82õ\fØ\r¶Å9Ç.\9cÒ\1f\ 6ã\1fBÅç5ß\1a\13ï£z\f¦\ fC¨æ,]ñ\18f\8ayçÄ\86±\13\bÆ\14K\ 2\88!d½\82\8e\ 3\9c\13\182\95ª\ª¿\1fG=\14%«Û\98Æ.Ëû\99\16óû\7f¢ö\18\v¡ë{©cßð\16¸k¥\94Þ\9aÈÆ×\93ëþ\12Ëèɣ\93\e\95¡CÔ»Û2T\e\9c®G!æ~pz\ e×\1aIÏ£C#\10f¹RÃß#\95¾  \8f\1clÕ¹ø\v\1d'¥ãB°æ%õ0Í­l\91\97¥\bxcz Yzé¿ì\91fj"]\9eu\Í£Ì3³2\12 ªÎHÜ2Ú\86¦G\ f\ 1_\0¾éQÌð~8N|\12Ãþ N¿ü\93\12-ªØýçËZJ\ 1ëL   õ\95\91p\15zH\ eÂ3a»¼äCvÒT£çʽ\172\8dáï\e\97ñýF\ f\19\85lJ°\ fö'.i\ f]%Ü?\85:\1e2>\91DÜHá}fmµ¸\922drgÇ4´\11Èt\19î\0\18ªP*­\9f<\b\f,;%?¹ql7
+x_÷½\107\87`©DA4I\ eµû\8d\9bNÓ¨\9c­\12f<ÌûÖ\81'\ 2A\ e@\9fU\7fÍ$P(\9b\ 2¨õ\1e\9b0\12D(Ì\bÅ\82â¥\1c[ÁW²\9f~\86p\19c>È\91\16¦G\ 2b\16È\89fp\10\Ûò\84ie`\92§\9e\aß\95\13&\85\ e\1a¾û.\98\ 6ÛyÅÏbR=ç$_÷\8f/dNÍ\88­å¤¹UO´ÑÔ4\8eËÖþPú\85\fir\ f29+Êy°Èïr~\µ?º\82ºêh\8aW\17Å%\0wQ\ 4î
+¼³%}^\e\1e³\13ìf*Û)\130U±Ôãß\1d\9d8;`¶µ\12\81âsÎIøÑ®÷\9b­.<)ø¼6\b£µÚo\98¼àn\84l\80ãÅ\89\9eä\9aÅÏ\ 5q
+\99      $Ïo'\98n³&¶j
+\ f
+ëU¿ìãÞ·\86@ÅMhק-Ó1KÅTÖ\80\94"ûs\9aß2\81\1aØhe\9cwb\v\ 3?/¶û\³\ 59p\v©   £â\b\8e%²TÁzË[\ 5AA\1c6ªy]K¬o¿\90\9eUXYx&\11ZÔ+\ 5Û3m\19\9cà¢5 yÚ?\ 1ê[\ 5­\96Ê&â_x\7f¿s\9fÊ&Ù\92xìT½UBÀÖ¸SýHÓC¶ö¥t\92ÏDZI×ÍÝÂYD\e \9a¡|èí        u\9f([¶%x(%i'ì"\1cQ\87\a\ 4I\93xLJ¹ø\8dñq\1f\ f\ 1­ç/ÍG½\ 1P\87\ 6\ 4J|\9b (j\96\eù¥\11t³¸ÿÔÈ\vþü\92I]U ¦ËþÒõý.$\99i\98VLVY\eÒƪT\\11zìüÝ\11ì«ÿ­\19Q3>Ç\9aúر\9bí|ÅW\84\ f¿\19\93Þø¼\0j\f\99Òn\82)¥§3#®Vé\84|û¦ûBf ä\1d\19~³Õ\r1T"y\19\8fèN\1cÓ\94
+\968íåú³3Èäºßu\9bÇr\99C\ 4ê6î\ 1ÑÄ\96;\92\9aé*Ð^\83í²Æ\92¶â\8fzjÃ0Y\ 6ÔH·\8b4b\88µ?úäÉQnð\87]ÛQÒý\93\ 3Á{\80=YÏPÇ\ 5\89òÓëÍ;¦\8f\9a¬N mT&Ùt\98åÃ÷Àþ¹Éy\84C[úò¯¢h¼RDÏ>\ 4âþù+\10£e!Í3\97çQÇ_2Í\ 17\9fx;5þÌeÞ½n¨/W\rÜ\9fíWAà\85nã<mÝW\875\17'G\a2Ía\81\9d    OÂÑlå¾]X-Ýö\98²ÃËå8?#Ì#ÊóÊ        MÇsmº$ÇôYjpüÑ\95p\ 4'\89Ç\92Â\vlsðu+ßéI\99\87wPáÆ&0\10Õ"ão\9cQ¼6G\r\93\81ê.W}A¥î\1fÎ?Øý\ fX6æ^Vþf \90Çú\1déø\11ì'qÊm°ò\94Ó\9b\8c»í]F,ü^çxC\9d\19ù¼cô\eú!   /£\97\7fδË»·Bm¿¦©Âw\15\91\ 3ÞH\93Æå{t\18ÌC\14\1aÁ|Î\96_*aí\8a7˶`_¦ \91ÖÃ\9a¢h\912Ú=$\99\91-@à\9a¼MásPÅ!\95ó:÷U>jT¹\8e#ø¥ rë°\81\ 2ì¬\9f\1dö ê\99RÚÜ6ëÙA\87\10\ 1¥\98²V\9d|DhJò.\b]\11Э\16C\ 3a\85.²¥\18,\85\8f4^¯¥à©;%`Jw àßôó_k\97U°(\0\83\ 3¥\17\8a÷|\81®ûE?&a\ 6\9c"\16A6V\14\1c;Yåhs\f'âo\81M§¾c\8f\11\9a\ 5\97ø\14]5#÷\80×\1cø\91\89Å\9d5\8c6~!7@d]¾Ü\83d³qؾs)²w¡vÑ|YPt~E]xÑ\96Þÿ¦\14dns\9dÌúG\10 4s_|ôÒ\86t%Vny\13Ëá\11\0)\v(\7fAÚ;³Ùëyƶ&¯T3"@r\10oW¯N\9d['\87¥\fNñÉB\90ŹkÑ{˱él \10V;­2ÂÅø4©\aN\e\90)~\89Î)\9b\8c\9eÙ\f\11\0ïCñÄ«\95#º:]pt®i2\8f
+px\ 2ÛS7a2\8dÕ\80ÈÒ×iæÏ®\98Pâõï\86\ 3§ ,\8cäÀ\8a\b\9e­"\11\1f·\83[AªáÎ8½\8aÁ\89\92=ÐÄû\108}ºIt\19Ò\10¨MGN<ëb
+Á¥\0\94\87¸1×R¿Î\14¥V¬Ñärï\93±;Á¡F\0ÌõB\19\85>KòØ>YØd\15)åoQ\95M?5k¤\81rH#\87Ùeü ý6ßêQ_¶Whb\1fµÓ8\82\ 3Ã\97\8eø^¾ëÖ\1f\95M?\2\8a@"m~\80ËݾÖ+VpÐÕÿ}\0¶7¤¯¥Ì'*ÞiÞ|ø\18{è9V0Dbózd·\ 5\8f
+\86\1eÈu\84å\10¼hH\96æ\84áÌw\7f@\94ìæ=U6Ô2\90Ó1\8cô
+!èx\1fÕÎÎ:Õý9eÌíä³\9aÂÊwÜ\f#\83»ý»sy\aÏM\90c\13\aKî}â\ 6X%©ÚG»\90\9c1îráåp|Älc\96z\83£ú1>Z}\90\89Ò\18÷\94/~)\98È#\97G\87Â\ 2-|Ïs\1f¢º¿dËFQf\b\1e\16\1c\93V\18¶5\14\v*\98­:³e\98%Î#19¸,*%\ 4
+¦vËi;¼>\9f8j×\1a6\11åÏnJÖ\ 1VÖíw\9fw®Ü_>\fD{µ-\7f§¦ocsöp    ±îç®ë\10ÄõeKv8ã\10Ø-Y|
+H@q1aÁDñ¹M\96\13ïýgäºmÜßñJs¯\9aÚ*\91±\bûÉÔé     YC\1ev\14NL×g\1aËõ,º\ 2.Uë¯\1a\88ÐôYW\9c+ÃT@ù{ÆÊË\8aßHé\91`[\84ÿt\14\8c¹ìå ºî\ f$\aäüÁgtö\84\8bQÞqYR\86\86s\10^Òl\15£\9d M)è7c^Fä\14Ý"\17\8czVý¹5\13bY\15ãtî¡V!È\ 5A).´\1cÍ#T\98`K5\1cÉÔÀØ\88´ôÖ¦ÆHsb°(&M9\8d?p\8dÔ¦\ e¿ö áç׫\91­¼\1cÝ\8dÅ¥ÎIb\906\84ñT\eä-ZËá^\a§\81ù©~.\9b3   ¬!|¦7
+À4Ê\9aªy³°li6eX\1d#\ 2«o]\8bhÜß×ÙμsÏ[®&RO]\99ñ:,Y'`î®÷S6?»^h 2\87ô\ 5\87åv\8b~ÜEÜÜËn\v!g:%Ë IÀc(#¼ùÀªæÀª÷æ\8e2Ï5 
+¶·B×Æ\8e\1fO¼`6K$a£ïF\11FÙïhö@\93ýµ~BÎÈoÆ:Õýp\ 6\14\12\92YX_G±'jc´í/\ 6\9dð\90#a¼¬\90Ñ\ 4®\16Ì©M\15\14é\¥\17\94g\ f\ 1$\85£\8e\85ÃÐ__ÃøãÞëg%\ 4{½ ñuQL\9b\9fC\ ff\9e³À\ 2\92\ e¬\83|HÐÕiW\9b\9eJ¹¾Ì\1e%_N´þ\17pâfôVò\8b\9a\94\91T¤¼ãÉê\ 3^{Ë\e¶ù-¥Å1F¤_¾\e'abé\8aª<îà_"J!\95\ e\a\83u\9eD7°Ó\10»¨Óäâ& J\80Îåi\89T
\86j\89~}TRÒ3Ô½E^&í¼åMEm*\ 4m¶¬À5\14øÖÈ\94®½¥\8dCÄDçôÞ\95Ò½HQe\88\9f¥]r\16<àUsr¸\86,ÆïRHïGY\90s3\ 3øEÛF®÷øq\1a\8av\e\ f*þ;e]v
+ºU¿\1a\8eÛÀ\8a\ f\86éWuÀQ¢ÊÑ>3E\96\91Û¨¹èÃ3½.9m3ÅíÄ\8f± E·E¤\96^/â\v#\9dã³ðÛÇ\1aµkT\95í Zl¸ 'Wë\8c&¾¬¤ñJ.ó>Pð\99.\18F6àª!\12\86\vÜ\ 2ýavC\9d\ 4\10ì\84Ïôô\ 5\ 4³cH¤k\ fN\90ñ\13\18\7f\8c\a\89óö\1d©tÅõ\83\ fM\ eñ5*\a­ê\8d\90§i\14\f\95I÷ö\91άëj$¶¡|q'ø\1aQCögE2\89^06<¨­½\9d\90M\85\16ø=$\ac§è\ e©"\e¼\b\94\9c\96ý\ 2U\812y\ fÓeÚ6ÔË0õ\8cl×=pZOÅd\966üÝ?4\19mú¬©+ÑÖ"y_p\ 1!r\1f!î$ïJLxÐ\9f±Øk>ëå\ra\8b\94\97þ«Óm%C´%atÞÉØ.\8cé\ e'©®ì\14loÓQ\92ÙH\ 1\14k\9aå\e!P¦\ e.kC\9dßÈå1\9apL#:ÓÖY\92\8b#Û´X£ôαMë=×JÂ\90Ê\13\7fþæ\18\9b\85麣²P
+­¢\ 5N\83\ 2\10À'¦mpÀ\vñ´û      ó\83³³\92ÄÏÐEV×ðÅZ±UDÁ\ f\1fµwÞ\8c!\91y8¶![\1dTQ\99¦Ç\bnûyâ¸B'\16'K\8f­÷¯æ\ f~\88â?F\1d\80³3Qý\1a\r]\9bc\94§RXrÒ\17ÀÜ\8fíÆà6P¸ÁÐO>°-7\88_~>A%ÚÊg¬\ eð\b\88FÓVåõkç\1d4\91\10\r+;×1á$ý¿]=\85W\159Ý'\9e\94[¯ðÚã+\83õ·ß!a kÍK×y#øllƱ2öm\ 4\19ðÛ1i\88,'l[ì\12Ѽ{Ö§\95Ï\1a¸!\84¤D\9dDL7\99\90Æ=¯ï\9dß\8eË\96\8a\8cÃJØÿÔØ\1cÒ\1001\ 6¯ê\90mx\ 6\97µGt\12\r_\""t0à@\8a\ 3Ì1,\vÉÛO_ £-Öã\ 4\b^]V»çÃ#\1c\ 4\82\8cÈ\9f\83>¥ÅB\\18\bÈ\90dv¯wW/ÊÒxD©\87øç\ 6ÇkúÙÙ\9a\95:Ì0öu/rrLö!\98/ûm     t{Üï=ú\12\8dçJýD\1cÆ\ 1.\9f\v\90Y¢Á+B\92Q\9am"\91\r\97`\
+Pz5þ\8c\17jáTƵ<·ãÁÖ\94ka\ fÃ3M\84\87+\95:\9dqæã\89*;o\1a\90»c\89ü\ 6O3ÞÛÏ[\13\8cPùº*Ãû'\vÝ\82t\91ÇX*IC\9d¿Ð\9fë\93\89\ 5\1a+[6o<Þ(3ª\89\93KÒû\r\90Ф@É6å\90\ 4¶è\8aªoW¢\8f\8f-¨¹QÖfØ\96Ü YaUÔ\9a\89\94V4È$\95Û¹\98Ê(\ 3Q\87\8el!³¯­\ 6Ýj1õ\83æ\91\97@ô&\14ÝPj/Y|\95Ü·d\aR\11 ¡Rh5\rÇ¡¸\81Uµ!\ foû \10ÉÍQï9-³[_\7fUðS\1eÇ¿¤áp°ö÷®\1dÂ¥c\9dèxÎ9ª\1eô\84:\9b BZ*¯\8aüªß°\9a"9  p4o\1e\86%Põ       Ç\ e¨¸Lo\8er\96¼[Þ\ô|#µ\96ÄÞI\9fÎ;)\ 1í k;P2­"¬Ò$xK«ÅT3\83\9eK^\e\ef.yá\ 3\14õ¥UÏÆ»~af{8Õ×\rJ\98ªNz©E3$Æî7åVbÇÍ\1fÓ\ 6\88ßcñd\ 1\ 4C\ 2óúFDWê?å\7f.\8e\aQ7Æ\854wJgºn¡lý"Lão)\85rÞ§%Î5©âqíQÁýkxð\e
+\8cØE@Õ\ 3\ 2\ 1       µDpe\ 5iù(¤¶\18\ 2Z{¿³÷ïPj{õw\89y«ç§d>>Ùì\8f\ 3\9e¨>Í_n\1eð3V\eèr\b®I\14¤7Ò\1f{°ß·\9eö\85Â^ݽtí\88½Q\92³£\ 5\9f®äôVB²\17·Gc\ f~Ænó4\vÅ*\8dEW\1d:-fjìμ@¶'Y\1c·ËàC\85sBß0mV\13|\93µÂá\83»\9bÇ\86&&bëJR0Õ4\10´\88\83\83-\11\95\1f
+\10·\13\18\a\1c½eI»»\1a\8e§j\ 2"\82\83+"zþÉ\9d\ f\82c\10_ýð\1c\80®°¼. \99ÞH!ºÁ\88Íó\84\ e 1lY\0¢\0\87ÿ!Êfã¬øI\e8ÌJ\12¤#kEi·ö\80\88Ö×Î\b\ 2Ó²Sy?±ÅÑ\9eÁ©íÿË}i\99Ð\8díº_»`<:7ë\b±\9aÇáݵÄ&ÍÖ\99\ e~´RÜq9î'ò\86»8£XúÐ\190»\ 3¹\86\9a Ê_\19©*KÑ\b©Ã\9f\ f\8c\ 4Ì?×æ\bþC\86U
+\8f\8dKx9\80³\9ar\ 4\\83\ 1\7f}3%­¼\85ùÿð\80ûÿ\rþ?a`b\ 34rr±·5r²\86\83û\1fų\v]
+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<\94íÛ&kC(²UÜd+ëÌ`ìkÖ¬É.\8c\9913\8c\19f\ 6#!K$$²\84HYC¶(û£\92-»"KY\12!TÖ\88Þiy\1eÏóüß/ïïýöþÞ\99/÷u\9cÇ}\Çu\9cçu\8b
+YXIk#  n(}\ 2\9e,\r\96\ 1«\0º¦Vö`9\0,#\a\12\15Õ%¢àd,\ 1\7f\ 6NF©\0`ee0 í\8b\ 6À
+\80\1cL\ 5"§¢\0\ 3\81D\ 1]\82w\0\11\8bÆ\90\ 1  ÝS?X0@Û\vEÄ"àxÀ\14NÆ ¼¨"\b8\ e°" °(r\80\f\0hãpÀ¹\1f¯\90\80s(\12\8aè\87\80@`0\80Ä"È\80\e
+\8dÅ\83d\7f\982»\13\0Ø/\18éëýgÉ\ fE$Q}\ 1\12T\9f§\0ªK$\ 1\8f\v\0\90(w\90¬\19\81º\e\8aêå\7flë¿qõoq}_\1cÎ\fîõCþgPÿQ\87{aq\ 1¿\19\ 4/o_2\8a\b\98\12\90("þßT[Ô/s¦($Ö×ëßU#2\1c\87EhãÑ8\14 \r\96\97\91\83*ü*`IúX
+
+i\81%#0\80;\1cGBýÄQxä¿­PãûiDÖÎÖÖè\8c\89äïÖþªZÀ±xòù\0o\14 ·Oÿ¹\ 6ﯩ1\11±\14ÀQNFN\ eL%Rÿ\7f>]ø×nzx\ 4\ 1\89Å£\ 1\88\82"\0'\12á\ 1 ê\14QW
+@ \18Àâ\91(
+\80¢P-ËÊà        dê+\05\9b À\9d@\ 4ýè+X\11\fÈzañ¾¤\1føo\b\ 2ÈzS\eF@"Pxj\8e(äßjP*Ý\17GÆzS\rì£ò\80,\9cD¥bI\9eÔîbö+JTy"Ê\1d\87¢\90|ÝH(òß*T%\1c\8aDBùøRga\1f¦J¡\7f\8c?uß\7fT T>õ|\ 4ÿ_³õ\17,ÿ\e¦>ÿ\85)üÆ\90\ 4\7fü_¨<øOÔ\r÷O\ryùý\8a\eáoöå\95\ 1Y,Þ\1d\8bÇ\92÷O« \aÈ¢p(/j6û\18U\ 1\8fBÿ¼´$\1c\9c´/Aí\83¬\17Ü\9bD&ìCJÔ\93\13Ð?î\0µ%\7fÁÊ\90\1f\9bQÏMB!~èì\17äÿâÃñû½PVø\v&\10÷\ 3\94£Ê¸\11á\bªE÷¿Å-\aý\rÿóè`9E*\ eÿûû°\9f\05\8a}\fB\8d\ e       G£Q¿xÿ9ï::\ 4J 4D\19\90VV¤\8e\1f\18¬\bÀ`
+Aÿ$Zã±>¾(£3Ô\ 4åä\94 ¿æ\1fáK$R\93üù¡¡Þ¥?×îXêýC¡((\ 4(ãöQ,­\8bÔ     Éu×µæW¶uí=#åéâ\ e\95`>³Þ°\9bç\18Â\b\17zzÚ$¥Vï^Mëz+8¢Ð\97\19ªz\10×Z£6a~²6ÿP\95`\9a_        \14\82è`\1e_én4\898°D\93\83'G!L\99ï¼tX˹f\93«-¥ÊR¶½è\13øéí\9d\9d\8b\11®\7f\188 yËÛÔl\ fëõ\89%\13ý¬\18äîí¬´¶ox\9f£\GÓÕ;Ï$C£X:\ 5\ f«¼\86Y¼J­Ñy=\82ÓQ½+®þ\ 6²\9ag\9c\8c\99Ígù{Ê6åE\ 2\14ãÒÖo\93q¥¬~£\99 \8d:ÛÚknÐ\91ùOÏ>±wyJydÜSY\8d\9e\9døn¶÷ì-Ã\908Îs\86Ç[í=3,D4\85mm)¼*\83\86´\9a¯ÜC³j#\9c\81ôÏ\ e½©¹¢ZÃ&\99ù½`Ó\1a]±mJÊð\97\8dC\9bÙøÊ·>¯ÿÜ\v·"6\ 1\15\11ÄÍ"»¦X!¯Æ\89Ð.Pä£×àØüøi©k\9f\ fÛ\12f:\1d.~¥qÎë2\e\vh.v¿nþñl\88CVõ§\99æ«Ý¡×»Ì\17Ïj}\8c\19¸uì\vÔ\95üÈD\97ö\15w\ 4sXuô\eÚÇÏÖrÌ\8eÒ\ fê8¹ö\13í\1eúÏÜÏl\1as>­I7ÿ\9c÷,O¶nº`RC\9c~\fü[¨M½Lü¥\ 5ÃHH¡þe6qD\85Ç\11Ϥå>â0¥=n\86òúJ\1fÛ\17Þ-ÝÕÊ
+n»¾\825°°\1f¼Gas9
\9cý²\9f\80\93\85\1a\1c;\v\9cç\81å\14DÅrõR¸;.\blè'ßà7^ç0<ì×S¨\81\f®Håt\f?~ÐSâ­\15\83\8aÃ\91Ã\98C\ fì\\9b8ÓbÑæ\83\85EEâ\9cO\95¿L2M\95¼\83ÜÑaBY\1f\1eñ '65­ë&\17\egªûqXÔ4\97Ô\8ewÅ}\v\9f=·M\12øtk§æÊ\88ÒqýP\8dÖn\9a-û´nU\89\vF\8c\9a\86,Bª\1cÞ\8e\96\9cO\ep8\8dÔFóìÚ¢EÚãzØ\8a\11\8bÍ\12[×w±Ý\fc\r+ù¯g\9fp9\9d\96F\f\ 5g\9c\9c\ f\18\9eSÇÀð\r©Ñ\9c X6ù\94Ýç\1ec\92\84Êm\1e\11        ¦eµ«Bß\8fjØk£¥\18\ 2\r´1º\1a:âÅ\11+)\1c\14ü÷w\9bzïî\1d;\15pj}q4cÜåáç9£S3\83i8ºó\\1aó_{\vµ­Ì¡\9f@\aOÙi¹\85\9d®\8c¹>¿¦\82¸\ 4\91°B2F2Ô£Ù×ÓÇ)\11K\e\ 5%ÂGå¡ÕÙÃ'\85tvxΡ\93\e%w­y/ì\\f¿`©Í\12\15èTpÿµ§;ý%\87\ eû\91ÝéL¡rÄ\1aO|\15\v\84? öËÊ@\90\97\92b\1a\91Ñ\80s\92\ 1\14þú¼\10.      uZ¯¼-àÀ\ 2͸\8a\v_\8bVÿ6)ßúNÇBÜç\1e>ö#Ë\7f\84$\85®éÕïâÎCØãT¬1\8dîjÅi\82\1e\bP T\82@&h\17\fÄ\ e¯$¼\8aÕ½á·Ü¦{9%Çì°Ï\8e*Í}¡á\97GÎíØCs\10ü\af[:/kî±'ö\92\ eé\1f¨¸\r~ÉÅ÷Õ:grCä5,ÒûÒä\vc6°Or\16tÃ:ß]xÀF\84>ÌQ|*KõÐ\87ï\16Ø®/Aüß^EI_\fYL¦\94£w¸HLÝZð3\1fê7ÕÂ\v\ e\95\84ú¤\1fª?\9e\8eã&\ 5q7¡Ñë\96éuß®»s¬/_:\ 4\7fño®\ f8Iïº$x\19\ 2ÖH\bîÍp\8cI\b\8d¼\1a\82¦c¤\9a\öêiín0\84áó¤ø NÏ4a\18Q?´Ôë%   tå\86:\14\91\90ÜûJ\96KQ\v\1d×i\12\f%o\17°æ¾\ fÄ\7f~\96é¬z\82¡\1c\123ÃÇzî|\91\82þeè\91Ç\95\7f@$ûÔ\83pËõÁüð\96áC§a\,cK\e\ 2{\\17\eK\ 4Î\99±\98géxÆ´ÙÆéFh¸\ fsÖAS\1eÂbAqu\rF\99£sÇ\99|ënß$9Y\9b¶nsäsóåúè5¥\17¨%\1fëÉ9\11mÖ¸%\9b6ìr\ f\8fLß!ço\17\8cf\85\97ÔYM\v´ù\17ûË}¿^\9e´>u´\14\13Û\1ew«2sj¾ù\98mØ*\96çYzÊ·Ù\85õQ\99ç\1aÀæ`(ÿóÔÊÀÏ®\8bQ\8bãõÞÕs\rµtrèâ\1c\16ý¬îb³ÎÈAß\81©/\87¯ÐÃ\19rá}\1f\8fàÛW\17÷\9c)Τ\9bè
+W\86¾\ 51¤NÃpµdÖUtë'Æ«ü;÷³_ã×õªXQ\16ÊÓcÜÚKIs+õ\84ü¸[7+\96Í4¶\aI\89!\19Iú7\88l¤:ï8\85Ü°¨\83\16²/Úò\14ï#\83c9d\14ïó_¸(Õoùý\ 4ÔÏÜ\80N:ð\86\9aER\98á]Æ\96T%\10\91\0¹õÒ\94É®'>\96ÿ!½Ð\1a÷f¼S¨es\87\83M5¿øDCá\93)»à£*¢\9dU\92¨\90ݧÌ6ê᧽Ûfùí\b\9cMO\85\ 6Z\1c\8aæþ p0¯|¿{ó\ 3\93\86,\98æ+pv\ 6ç\87_¥q»Õ\995ÿÑ ýì\1d\93\93\8c\8aaZm\87Ê\9eI\r³ùóÝ\96X\8fÊ 4^P\99=Èl \82\9e·\9c½?¢]Ç\95\14I_ÚZ\87)\8c¤©ëìQ\1c\1dÌ9e½tÊWÜ9gÌ5Ó«\9a\93ît23¯
+÷í¤¼8eF(+/÷\897\9dg\92ù.\97\9bÑ®yô\ 5Èëæ\14I:\ 6\93Î+q   ¤7\84D3JX\1dó¹ÑcE[Ø\9b\1dÑ\1cÒ1_l\1cäõ±Îæð\93n\ 1Öù\8cÅÀáöÁmWHP\8f2]ÿMûó㢾\ 6\17{'·eÙ¢¢[iq\9a\10\90VEü#\8c\93·gÐD[Ì\93¤\9ak\8f\ 2²²\ 3ñ®¹K\8f
+ÖÜ\ f\95Ôt(\ fðñ\8bûê%ó²\1f\90>\18E nyÍz{\99¬ß;\91\920\\16fxóH)ÁÍöNM­\88Q¿ê\ 1\9f`\vtvLs\10Å\15Ã9¼Öz×J\82VÌÃòËÉeÃ\8b\97tè)¢=Ʊ\8d\81^&RÁØ\84ÅÇÕS¨«ÚWò½¾J|-´\9c\95b<f¨Þ½2\rÍ(\88í\15¥\8b×Ó²zå¯Òî\88Ñ\14\98\91²\105>ä\18\1c\ 2¹]¸á¤Wϡöv`\94®/\8c\91þA\83OV9ãsÎâq\ f!\ 4w®Ó³\e£e°Ã\ 5ÕÝé\89c+'#o4.Ù\14FêÒ¶u\95ú¢TdÞi×ô<À\1a\9b\95\1d0(m¹\9b\18Ä·HÇ\1a\14éþüÖåð\98WJ\9c\10´üpªÍ°ñã·ÎDÅ\ 6\99å4Áû±¸¢\87*\ôÜ|ù2¢øÍ7\1eÊ\8c\89ð\95k#IîÆ\17寨\v\95¥VÊè¤Ø¹I\85Á|iÙ¬Ýd̽\87´ÆÑqä\15\97\b²\9a@\7f\10­9Q\11ÖOXÝx\81\98\7f\17Í®î\92\95ꬮ?0
+eÕ·\vwÀò\17H²¾¾ËH\88êMSì\9c\98~tï%\9fg§ÙÚã\89)\85§¹_Ài\97¬\aÂ9äDË<\86úz\e¯\14><Ý\rõö±<>\15róÞ\r#Â^\ 2ÀëRÉå\18ÝQº=è\15\83(ñÛFÔÜ{£Rd*\96©U\12$8ý­8ÓTýÙÖ¬HìÈÆu\8f7êaN    \11\a³j¥m¾mÄç\85`\90\8c\12²)¡¨Î\ e®£ãF2{$Nר
+G\8eë\93\ eÈ=\862q\1d\e\8a\91Jl\7f1ÇóäXôÒ÷,ùÕ\8c\9d÷ù\17;ûS¬w[\83\f\ 2ÍÊ z_0÷=®TØÕl×?°4ï^Z\9fì\15y\ fÇÁXÏäú°
\87¦Ø­9P\8a\9a*ÂL\r7P\90\99\8aäO\ f\83÷æ"0\99ç\ 6\83\8bü=\¦Z\8b\ 2Û%»¶\9b²N\84ñì\94ØÖ§L\8c½'.\el¢ÚD[WV`×è\9f\1c/\ erÕ<cD[\1d\9dg\96ê¨îÌ­\85viÃ]-þ`ÉÇåÐøUÈ*Æ$V\80\88+&\89\9dX/»\0Üͦ,²d\95\87,\97Ú\ 4\95\8c\9eôd~¡b m#\13pgi\94uNVÂËp\b&\bË2geÌ\16~/B\87Pµ÷K1 \19¹
+9+ó\1c%\90nÅäX­\96X ¬9Wì\ f9\81½Í\ 2câú"ÜP\14\7f\96\7fobá1ò\821¿EÂA©Lq¨xKgQk\9c\1a\97ÅCæ\83\132âÛw\e\9c×\15Ω\9f|¬pÐã<Ú,5¾¢É\8f£Â¾\8fi\90·\14C\8bÑ´ékciü¨\88\vUpòxg)\14\9a·\9aÂ]R<~¤\ e\90\11O\8b\81eDÐc®\8d>«¢ét\1cxi1bÕ4\96Ö\92¡x=Èú\8d¾Ñ\r±Öi^ñÚ4\97³³\89\18C\fQôi\b\8eR\1e=¼Ø\96¥³¨N?9\97\9eúªiY%\8d!í±`¶ã\97\8f\0º[\9dY9u×"®?g\8fÔ,|\89\91EjèÙÙ¤`î\fÛO=\f\11àÚÕ\ fÄ\87Â@È\18X¬Ã®[˼øTn)£\ 3Ìjk"¼é\8dsûZçU\ fA¥»­\97úÝ}Ħ3om\975\9f`\9a\8e1fß­ÒõS\ 1\ 52|6hg\89K\rýnØþèHUy+\8d½\ 1bØó\8dd\93²9¥A\90\18r¤$£m°<ë®Ô½wBÛ\ 2`\97ôèbõPU«G³Ö\91«\ 5«*ôÛ\13\8cá\17¶vÊ\14½\8d­Ú·ÎôÓ}W>t;µOsüË)s\13ón\85Õ¾©÷þK^¯9>¯z0\1a¹öóóXoì¾\85\9dÁ\8dï\1e*c{AdÂ$\9a\8aï_Ë0mªüC\ 2Ác´è}áþ\81Ý\8d\ 4#XöÇ\e    b\1a£)\94\80à§×\80      g§µ\81\93ñB©;|±CCù\9c~\8d\1d\82|\8c\1ctgå?\fFE\r=Øb\f\88-à»\1c<md]­Q×"UgÅç\9a\9c²Ð¼\13nc/­/2\15ÔÍþ \8fÅÒñ\81ßÌ\8eíEw\9a\95óBSj\9b7z\96;\1c\ 2â°\8bëzÕRY\8a³Ið\aÙ:Í        \16\8fûME´_\98\93Æ´ª\8aÌKÕ¬*/5õ¤ÔÈ\fr\954\r\ 5\1a\e§÷I\ e\9eç.»ÙÍÀÅ\e9\ 3^úÐt2    ¬\9aÓy£ã\ 3s\803ÈÅ\ 4NÐÖâ\83äà\98E\8fJ$Ñ=\91´
+ÏKe¾Ý±t¹äAǵ\8cS\1eùIç\85°ÓÖ°¸CW\ 6|J\99\ fÙ§®\8b[\8a\ eÅ)Z4\1fyÛÿ&\9aÁy\97}@x§\ú\ 5\9dæÂØ\9d\89¢ñÏtü\ 5ÉsË\ 2\85\9f¾I1mríìÒ\1dMÞ]Í\17Ñ\80\9f\bRÔ«RrOj½¼{¬ccD\81Vuo
+ì«É\1fpàP\1f\96ª\bAÿm\7f\16ü8jAØÆ\82\1cì\985È£\978Æ%¾2³7åaÿ\81m¶ÉyF\9c \96\9dbãÝÃ\1eÈ6/&\7fnV\80ýå \8f\1cëi\vg9|üe¹M"üJe\9a<,MýVEÌ|2OÁÖ&]]v\ XW\88Z\93ÂE£ð\b²x\1f\13¥\96Ït¬ØÊãiÙãTÇ-Ýø\8fé\89«\82³`¾ÓYBÞ)6Ñ\eÍ®Ì\19¸GU-Ç\9e\b§\89\ 5\1c9Y-¨Q\8e»_{\8eAÍUF§vêQÄáNÊ\9aQ'(1\17­§¨Õ\96\9d^öÂ?Jw\92\87Ëà]a\93fDï\94ÉÂ\10×s¹èãÆm\13ë¼\ 5|\92.-¡Î¦F;á$!®Av\99\8f'\È\ f#\14\9a\ 5\8eÎÌ¿£à £g¦³WÕ$}\95\9fmç­/¬FJ\1f<it³\8f\9d9S\8d\ e\9bø¬\ fÜò­iÖ\ 3þBÃø\8cøë\13Ê\9a\1fº\148?^\ 4\ 4\80ÇsÇõh\14ê\9eU|À+^\97e\m\93\97\96\9a_FG\83Îs¸å\896ö¼y\8317\9d´¨\13\7fîjt\ 5\8eñ2i\®«\14ÕÿÊæ³x)vú¦ÈÕ¹\97\88Ò*d­Ç&ë®ÜÇZò\8bªç³½\8bS7YXomo^Iå\ ey'8\9aü@ìØ:ɵ\a\16\9b7~Zái;Ô°\8aQj÷XØ\96\82QÚÂóeqß\97&@ñèÉöò;{\e/\9b\99ÍB°\ 5\15\ f·L\r\ 63Ì[:å¿\83Wx5Á#~\9f§B\f þæV!8\eß÷=\9aJÒS_e\16\1fÚ\92\96\138\9cì/´¸{\9dÖco\92\18­¼Ð^Æ"Å>(âÉg\9aá4\89±·¯ö]JywÛ9\929{F o\8bßó¥ã
+R\96\8eW))\8cY\98\ f7{\81F¼ö©\84;\9e\11¬]GVMÜá\ 2÷sõ\1c\1e\8blâÇèv]\1fÍAÏNË»È\18c8å\95äþ\97?Ðÿ\vü\9f\10@àPp"\99à\ 5'z\82@ÿ\ 5\bßì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Úí\97UX\ݶ¦qBá.A*¸»»»»\ 4§ÐÂÝ%\104Hpw\bîîîÁ\1d\82[\82\9a\7fï}vþ³OßôÓwýtÕÍzÇ\1cò\8d1çZ«\8aâ\83²\1a\83\88\99½  HÒÞÎ\85\81\85\91\85\17(¦  ÃÂ
+|»ff\ 6PP\889\81\8c]¬ìíÄ\8d]@¼@\16\1e\1eN ¬+\18ÈÊ\ 5dææåàâåà\0\0(\80\ e\9eNV\16\96.@j1\9a¿¼¸\80"¶ '+Sc; \82±\8b%Èö-\89©1\18¨foj\ 5rñd\ 4\ 2EÀ` ê_!Î@U\903ÈÉ\r\b\0°°\0ͬL]\80\v+;\0Ó_²dìÌí\81\ÿ4\9b¹:ü×\92\eÈÉùM\17\90ú\1fJi\80o:ÍìíÀ\9e@3\909\80IÑþ­\1eèMÍÿ±°ÿ\8d®ÿL.é
+\ 6+\1aÛþ\95þ\1fÃú\1fëƶV`Ï\7fyØÛ:¸º\80\9c\80
+öf '»ÿtÕ\ 2ýS\9c\ 2ÈÌÊÕö?We\\8cÁV¦"v\16`\10\90\81\85\9d\91\99ý\9fv+gI+\ f\90\99²\95\8b©%ÐÜ\18ì\fú\87\1ddgö\9fJÞæ÷\ f\1dL
+\9a*:\9aòtÿÚÝ\7f®*\e[Ù¹¨{:\80\80Ì\7fÜÿÁ,\7fømJNV\1e@=fFff\967Ç·ï\7f]éÿG5    ;S{3+;\v +\a'ÐØÉÉØ\13Àü\96\8a\95\83\ 3èÍ\ 2´²3\ 3y\0A\1eo\92\99\18íì]ÞB\80o£ñ\ 5\9aÛ;\ 1þÚX\16.v \931ØÁÒø/û¿L\1c@&\13\90Ëß-\@&3\10ø¿\99¸\81\ag+°½\1dË\1f+÷[¨­ë\1fæa\ 629[YØþ      äx\8bsx;\föf\7fL<@&S{Û¿9q¾\85\81AÎÎ\7f\f,oyÀÆÎ\96\7f,¬@&\8b¿î\93·mþ·íM¦Ø\1fzK+ñoú«)¹?Ä        d\92ÿCoq
+\7fèM¡â¿\89û­\8eê\1fz\8bÓüCo\9eÚÿ¦·cÎô§\ 5\9e·5\93?ôW\8b\7fÆÂüÖ\9fÙßð­\86ùß\90í­µ¿á[Më¿á[\19\9b¿á[\1dðßð­\90í\1fdy+d÷7|+äð7|Û{§¿áÛ\88þ\8c\9c\85õ-Öãoø¶\ 5\9e\7f÷T^ÿÀÿyúEEí=¼\19Ø\98\81\f¬\1cÌ\7fµÇù6~fßÿî¨agåè
+\92\11\ar0ss±½\rö/«©«\93\13ÈÎå\1fÏ\9d·;ë¿ØÜêíf\ 4\81<@¦\80\0vÏ 2\1eÑeæM«bddi\16"'\83\84n\8f¹\8c\18Òv)\19).½\rTç_µH=\1c¨®Å\1dæ\82)é9\916Ö78µÔxµÚpî\98¥»Ú\9e\9axA0Á\90ê"ÏÃ\\15˲Ã\8f3P\8c\82Ã\17ØsõmÞþØÜ1¤ãÆ)g\a\96\1dÙßëÄív¿­Q-L`\93\87p+ÞÜÄ\a¾®\88]ΠÅTGäyÕBê¹+Ô \97?O°í£âFIb«aY×Su,®`¨ÉåxT\bxÀ`Å£8}\88dvýúq\v\9f        ý)\84ùi~\a:\9a×Ú¶ví±\92ORí`\93\8a\99E\11ªA\96\98Æ\96î,ÂS\84è+ÅÊbýþÂÃ$\Xcz\1ez|\17Vb\80\9f÷\18B\13\9cbÜoä\13ÒhQ\84Ò]øâÒQ£\1ax\93ÔrÙ\ e²3¨\8bwn\86(\ 2q\ f\8fÏ'\L\93vrX8±Ø¸+1Lu#/^¡í\9dö³àù\86 ¡U\17ÒXÎ"~6É\\ 4A\e4ÎXú÷×L}¸Ã\80.\18(\80T\9dx\9fí.\13l\7flΫx\99­ªÌÑ\8dê7\aï&sbrJñ@aÈa1\94\ e\ 3\ 4ù_ævûb:\v¦;\1aµ\17\ eñ%f\98\99¸Ôþà¢\1cr7¿V¥ÝPn\8dÖN&ø\16l£ÛO\10Õ¶/T\94ò8,\89s\92)H\1cí9õ1\1ep&Ö\a\94\9c:¼°­Âü[Ý÷µßó\8fç?\1f\ 1z|¡å
\1c>Á\¾\1dI\9dǶÇä¹O
\89®²u\97\ff\893X¡sÒÆö¹ß©Ú\95g%ÕYCw>#§Ö³\99\88à·¥\ 2óÐ9aº·\8d\9e©ô
+\rP§3>m¥­÷µæ^1Ù8\ 5C\87I\8c\9f:æ³\10­â6˸Þ\95\ 4w.\ e\1eÓÂíÕq\14\9bN\ 5\ eR       }.0g}\8e\13Éó\84\82W\1a6ÚàelH\ fw\97ws ]mpßAÎ¥îp\87+à½ÿ<Õ«Ù\80Zby\ 6çn]\8eXÈí\17\8bþ\8b\8c½ç\9a\1e\ 1\15.\17ã#Я\88U1ôÚ\f\v\169\fBIS1\9f3G\19g¨I3ËTÈÛ\1f\8bz`\jÅ'T\15o.\17F\91²À©æQõ»iÙC³pó}«Dûd£\9aÅ°ëZç{Àú\19\97ñvÒÚ
+\82ßgI\17Ó19\9a\89\11Ý\15¸\1c)[\14\83\87\ 1ÞBÞï½í\ 6\10óZA_\13âä\86îÉ\8eáid\84a\vt\89     -áýúé;\8aw\11üàË\98\97\80\91D\97¿N\89\11æNF 5Ìój$ÃÏç\v+Z5µ\93\8aHàJë\93\9bÇè¸òµÃ×C\ 3x÷=õȪ4¿%0¶ð.ÜÙ\9dëqÃvq\v]k©\83¾\89\1eÖÏ·Wr
+þü.ì§÷ñ\90Ï"\ 2\92<\99³ü\17\96M¦|Ë{é \952|\bÊXº\95\11󤵺ºÅ\13Å`    LTYÓIÕ×Ãi\18¨Ñº¨ï®ÕÁað\8aG\0\84\9fëf\99\9f\14\ 3ð\17ÈõAC\90Z\84ìèðY°½»äåÎ!\8d\f\r\ 1\fhwãQË·¿l\ eS\15\94Ú~ÕNÀÉÝjèD\10ÜL¨\85å\ 40\ 4³²ëj\9dÐ3&Ê0ò+\ 1ì¶\ 6\96¿\ag:Ëi1Æàº\14\98rÖ@Ü\98þ¼\17\ e"#¶¹\90®*L0\8cT9@|ô<°\96\e\98éQ­Ñ@\ 2\ 5 ×\11\19$g3·%N\17\9a±kªópÇ\1c\18iÙ8.¦Þ®\10.å;\17\85PEé\84­
+A9WCI¿î*÷(Ò\ fðÚ\14\86/+?3\8auþÚÝÑæfϨ\85\OH\81\85²¸\89_\94>cî©\90V¨Áæ\19s°ç\aUuº{\9c\88;ܼ\872Ç+(|!ôÊ\8c/4Q¥¼\9eT¨ß°Ù\9a\16\8b\85\86ò",\%¢\8eFK\8aÝ;{_7o~5l
+õÝ\15ò<6®´ã^.Êã\ eSúÊØ¡\13ô8©b\8cõÅê×\b\11õ÷-]>ñÊÁ¶á½\85ïc1i\få\8b\8d\960g¯ïØù\97)
+\ 1'\8c½\ 3QN/ø\11ñ?\96\92\12{4\9cÛ\12w=½\ f\13ôõÏm\89áb·~\8c¡É\96`± [R³Ð\b5>Ü\ 5\1eÍ\v\ f\1c\êKòy\7f \11Ì1£\86Ë#\1edReWð\8d¬e\96ò\rÙI\937\9d\99\ 1Âãìâï´{H3ÅÂ\16ó»¹'?ÆÇ ¶\84p\99Y"¥(|\7f¥¨AzWX§Ñu\8dû\1eÍÉaÉr\9cã)Ü;lI\ 5{ÃuÆ\9cd\80q\10k\15NBæî i?#þ~C\ 4Vu:\9cg~\925\89ñ·\87§LçÔ'UÝ}Æ\ fø\13\17Lˬ\ fv\99ú\86#¶*q\fn<.\ÞV\1e\ 6Á]I\10E%\92£aÒ\18ò\rg\b\frM\f£\16\157\f¦Þ\ 1v$-R~rcä»\1e\10\1c÷Åt\8f\8d\ ecñ4\81\16ßß\vqaOv\9c`K¶ú'K§\9cóyØX\8f\8d°Z\87´Ñ\18É\9f¾\94\1dm\~ÏXJâC\87\91\ 6Ü\85ù7\e\84\8bsxŵÏ\ 6)\94Üp¡D¬àvf\ÙM6\e'¢f\1e\bÐ@õ½\1aFcPï+ᣪ²Jÿ*\9a4\89Íó(C¸Ûç\84¤R\7f\97>\97vϸ\91Íz*Æ\8a\13\ f\8a\14å®2Ûý\10\9eKÜÃ(*Ákâ°¿\88\14<\11K\1aÎfÈ\985%     Ç\19é\7f¤RC#\8bûöÒ~\7f\1fâ/Á\99\v»(Iî\ 2¿´}:\84äW881ôa;ö[ó<uç°6=ÇLÑþ,B\ 2»\8d\94\ f\ 3²^²\11\7f\14;\99\8b\82\ 1\92òOW\ 4\8d\84\96\1dy\94¼Ê ÙUôõ~]÷ï/ñý¥æ¢%Cvì7ng\8eÏF×$\82ð\8a.\89t\ 3n{ÚÐv-á\8c\90¶B\92+\1c¸÷Áõ\19\ 2VS}f\19)»$MÃÌ\88x\85µÓ·ê\15ïôX\ 4á:¥\923\1e3VZíË,Ö1ãã`\11ù¡GÅ!Üæ\aørTz      QÉ´\8bÐ> '¬!¾\Õ\rQq\9e/Á+De$&5uõÏø\ 6³¾P\11µ­\
+\auì³|6×û\19{¶K8
+£Q\168N?Í\98Wƾ]¢\98\b,
+\1fª"¯\1dó÷'7tr5þDàsð      F4ôè\16\87
+ZE¾YbsÃ_\9eûÎ\83p\81ô¹\80}T§¯XÃïÇÖQ\804³>óGª\18dqú)Ä\1fdaX\ 1fd¥ÕþýÝÃþl~7Ü\15Þ\14\87\98!DÒæZ\1dUÊFÉ\9f+Ø'6²?ÉÌ5ø1Îí\13\b#~K
+hÃÔ¬}xßí=jßX£m\82 @\1d9\17\e67\19\9e\98êG\1eÖ±> ~;0¶_º*ÞVj\80©r_¼ÃÓ¡1¢<\<\ 1&\1ewø¶có9>\9eý\15\19\1eÆÊ\96\9dî\87\b\14Ñ\9dBµâ\93½wo¶ó\89©\eÉ$\16À'%dÔl/"ïü\99*¨tåc\0÷\81d\9an¾ãâ\8a¸\96¹`ÞsÌRÚXxN\82¬ã$Qèø        ïq\aÏ\ 1Içë/SR$\ 6Êu\8bݧo#ßG\ 4Ä\f\94¸åÕçøYËA¿ãÐ?p\93è\13Æ=²u        \ e\9eîsï\v(\1cabDü¼Âd¤Pÿëz¦\9eUZ8yQ\97\1aT\ e·ò\8eC=Ë4\11-?ì\82\83ÍnÏâ8\8c\89\12Çj#c\153{ÙqÀ\a\93\ f\89G«µHt:[Ð\9c¥ØÞ\ 5¢;\1f\87p\9fÍ\9eðK\17
+ês¸tê ÜïLÏ\92Ç\13§\93\9f\5G¡°P\82\9bòD\885\89RS¥¨Óä\9cÉ_\v*\r!úB[ô\15\8cÐFd·§îs.Â\1d³ÛM\1dÏB\8c\9a\ e1DQp\8có`ãòØL:\83\19¨S×\9e'\90ÌÀ@"^\ 1ê\b\9fu³Qñ\v§ýj¼\17\82?P\11\16ê¼ò`j$\12ö\¦V\94ê¤\15Ú\8d\89M\10Eó8 \ 4`<m5\ 4¹\8ffÓòý£wI¤\89'ª÷\ 6\82\98\1f\19\8b\8aí\a§\ 1_!Òv\92T³6kUÍ\avýU××[Â}¤Áº¤\ eüÜ·É°n¡\97    ´(Öhß\93\9e[{iô¤"\8c\ùC\f\13¥sÕU\ eû`>/t\17ÙÊ»î\ 4«¾È8À@1Ü\89\88Ã\8a\9e\81'[¥¯t\99§}Ñ_Èý«\f)4[I\90ñ<qj$\7f/\1cç   Ê$V­õ\8f\8eù\8c\ 2uVaRÓá(ÅPUç\90G\97Cf¾\1e.\9e|]ЭÑÀ\90\ 6ã\16]ÊLn\8e\83qu%\9aô¤Jª·\ f¿Ít\94Ü9\90Ú>Öê\1d/9\8d\9dÂ\ et0Í\r\rÿø\ 5N\8bÌ>+R\bÐ[eD[¢>È\bVO°¼@:ØwÆv\%:\90\16Dÿp\80årN\ 3y
+}\Ã\876ÓE\83+emi­Á¡*ÑE\ 1-c¾\ 5eèÉå4'K¢p¹ueÅ\v\1eO\99c{pB$
+)\84x°YÙÔX¡ý=P¦6\1aéAª\1aô¦\85L-»b\0\ 6\81\16®\9a$Ðudpö#\ 2\ e\81´`\80\93ëÊWåÖ:ÈE´Açw\valo?\1f\8dé¤HÜñ°\17\97V\16\8es­ÍÛì\1eÔÇä¤Ïu$\8dQ²?ºpð}âµ=%³ã×¥! \99\0%Hi\95\8c1ûF\89]\e\9fÈå'\16z~!õÛ®Øÿîµýîsú  bÃoh\1d>Df»ÓÄOÒÏK^¥¹TÐK»\98Éý\89ª\85\16¾\ fïÉ\14ð<êÀ¡E\17{\9cÕ(U¿d\b\84¨00µ\19ý¿\10ÜîÄ\90\8f\96^A6Ü,\8dK\ 5\1eÙÜï\83\vµ÷òù\13ò[ÊxT­÷1\12\1dÆ_\f\1c±\f;\1e0q\9a¡Ðrê\r²ðóÉø\94,G\1az\99Ã\17ɬç\9eè\87{çó\9e\99Û\16\ fÖv»\9b\18\197\95\9f×\16Ihs\8f\16e\f\8aª\16ñ[F\91\a®\8fP\8cÖ³D\8b
+n;6Xj·o¸\fý]k¨Ý:Ä\ 5޻خm\a¾\ f×õ\88\a÷+ß5\93¿½|\84ÛL¿düd\95!¨Î\18Þ¦\7f  ý
+;\8fF\0\ f\8f­¥6\89ð\8e\8b½ê$_s\9c\9bV\0TÙó¥\ 1\11\9df/Ta£!E(é£(²«Níµ\125Eå\8dÌ\96g\9a\98£ª:Ïäý\1a\0\ 4Ã3·CòBy/\r\8dåż¿c/~õ ôy"GôäR½ %@\0\ 6 ´\aÒ\1fçò¯\9fÚÏ6\98x\fªÅ¢J\90\96\85Û\14\ 4\e¤3\7f\ 6 _\16ñ\1e\7f\89kr­\81ã§í.\1càXT\83\11ð³VðÃ+l\11ûêKîU7àç H¤÷cP /ÜD\ 6\82 ÜÒ\ e\8f\88\ e²'g¿\r\97¼\9c¶ð\9a\1eä\10Q\9c\98Ü\ 3ÏÇÂ\8bÁþ\11\87¶t`«ÌM1\ e\ fr\ 4baJÕ}\93\ f¶` \9aö\84Ê\ f\8fØ\14¤\e´5à\1d\ 6\1f))Èð¦b-*\15ý\\8f\12¢<v{Tb\e\97}\ fÅ\11F\89ΠBê<¯Â)\10 \9b)ûKxϾ\ 1CQ2\82rÿ¬ó²z\ 2\91Ñ?;\11£ï&ÖM:AªWúѬGïlô,"ZK²¸1\f\97Ïq\99\81þÛ¡Å=^¤\9b¾W¬[&$\87LÍþ"uúæbr8»\r\1c¢(å\12\85\8f¸þw\16ü27ËV\12ñ|á67|k\80òµIEÏ1k6ýÒn®\0ÞF·óP\17\81§Ê{\8f\8b\17¿Ik\89ûÜhU<o~HDÈ\8dt\88&\19¸¾@F¢\ 2\ 5\9cüäì4¯Ê\86/UR7ÒGÆX\86t\ 3\80áHê(\88Û\1e\1f\9eØáïró\ 2APÞ®\85r¤üÝéyp\18\8f§\83wȽñò ûk\94Íx®ß S\mK¶\9a({Z½æ]Í\1aÇ\17S¯¸\84%®ý®T\ 1Üc&\19\96ÁÉ$\e^´¬ ½Aq9ëÊaOO6¬è\10\91YÓQ\97÷§ø\ 1\8e\ 4Ö¯\ 3¥\15~8¢\ 6GöH2¼\87CµÉ\0Uñguj\91K\ 5\e;\10x5\10P\86ñ\83QºÔ\8a`\1c\vÕkH?\eh\18/\9au$7\19\ 6\13\ eã\97<:bÝ@\16\8dÂ~;hßA\85\7fɽ÷­h)ûi!§á×éûÞÁ\9f²\Ug.¡\aê+ói\ frÓë$Í_\16\8eÎu\ 1\10al²\ 4}#ótYÄvÝW"ë\8dª·%cßê\1d\9e?]l\8ck+0·z\8dQD~\95±ùà\ e\98\19\ 1'ZSÜ0¨#>ŬTkÛ\95Èi\rqYÓxd¬g\10\987¥~ê[kw\8eñ|!z¦Cè\96¿Çk\7fuqM\15\e¨7(\91\13LE\88d¥ð\ fG\1d¡_\93ªü¶ä\9b(óö÷H\93¿ÇRÙ\17\836\83m\11Û\9e¤c\18¦     »\ 1\eá^¡\e&\7f\\81\9c"6ÖîÕçÔ\8f­í$&ý:·°\9aÝïÌ¡ïýï ÂG\8b,[8¯~ùÌ\154ÿüEÇX\10\87R&Ók\v8ÿÞa¥Þ¼\80Ñ·]\17ìr[2\1d\b+\90 tëu°ò0÷ \0S\87ÄÜ4´'ãÒÑù\9a\ ekGD\19/±¥!\89äÊ&\19Ê\fü\ e\84Ô\87.\ fÞÚ#¼s>Ü9·e\7f×D\88¿À\9d« U&0¡Ö\8föâzΧ+ègðÚ\88\99uµ>x\1fV     Þ±½í\8aë\86\7f¤\0¹ki\89\16Óu@\87Ã\7fÝÀþ1EJÝ\1f¢\18\ e\99ÆN\16\89ïôþ"vu4\1cGò,ÍPwª\8c3\1fò"\ 2wDÔòj6~}\10\10Äú\85xòù(ékb\9a\89\0.>Ù\88ò¡\10\ 5
+¤"\v\9cÐ{¡úÊkP\f»H$´k]ɲڹÄ\0¬Ù\15MXðç6^D\10,\1eT\18ÛÁ-\99Kr4â\ 6×}0r\82éÐr\9aªbÐ+ô=\86-»Â×M\19\ 6ÖF×\86R\1e \12\17Ã\9dÓO;\18[,k¼¢ß^\18Héбï\a!$¡øú.iÛ\80\82\11÷'\9a'ÒºY\8a÷Ul\88|ýÕߢ»ò³P︡Çy\11\94q0IwV~\18Î\8eÔ8E44\86l\1f7WÔãÕ\1c/jnÁ\14\91À£äW%Å¥ú\914CBqõêäEË&K ë\1e\9b\80\ fí\ f\9f¾v\13(´l\1aÚ\8fÕÁ%s\r\8f\rÂ\ 4\88«ØÛïx=F\ 2Àã9Ðw+&ò»¾\12§V!w\82ð\8fôøUrª\98Ü\90ª«¦=W\r}óSG;ܲ³Ì\18ÆÌ\82\87å~±\e'µwÙ     J\1fE!5Ë@Ïëcd:`\1cl3ÿG\ 2\85.\8c¨¦dá\1d\ fÚU\82\8eJ(_Õ¤£}\82¹ðU¬Ý}¿\81$¹nÀ\88:õï\8dz±¹#d¬ÑUª\16o\ 5Ta®¥P\96¥ú3 (¼¢ÉÅ\89~S\ 3$\1co8RF¨\13`\91\8föå«3Ó¯ØxÓ Ã\8aRßGÙ\85ezÙ\ f=Ô×\14  \93|zB\98W\a_(\99eo\9eÄx\aî\93\14;\18\95<ÒG\c*\8aÁÉÀ&À`r^^ R{ÐÝo\89ò}.\1amÛïYXUÑ\12¡\84=l\91¡G¹T\1d_K­\1a\fÕ\1f~\86â\94\9f1%¥\86\13µà\93$f¡Ç>\\fÛô\16\1deíÍíA\90ü-ñ8É\91bÕ÷Îù\10\15UO¹l-ÚÒ_k\18¤\ 6;/\12­n\ 6#Êsó\85\8cín\98=X³Z\9a\96\86Z\94¸\1cöÐ\v¼÷P'\8f¹\8b\8cei#\ 3·<Ì\1cÄ\96ܸÊ]ò\ 5\94Ð,\7fæX¸\7f8¼ØH'\86﬷@AÀ¶¶<­Î:J\92\8d\84\ 5Ty6røÈÄsOÐyæé¼þã\9bÎ.äkXSS
+.O1G\17Þo\ f#ëÂxY\8a¥F^5åºLceÈ]\8eDD\8ee\17Ów\98&öɨ,²Ò¤ì¯®>\9cÂ\9b\11´\95¯1áÐî·B¨¿Ô\1cÚ¥\81\r8g7\15#\89\83OúF\84\87ç=aÙÄk\ 2LÞÖC,#°^\1fO®ÌËj,\8f\96\15ù_¬\e\83G\14Å\aü({3IßqÇ)u_Qe\7fJ\87\8eÁ°Zí\86ÿ²\87\17BIy,<÷°EyØV\80BI\a\r"¬éwÚç\1dåcäé%,s4\8cêkÆH\9aìùÕkCÍ.â\8c3%]2\bÇê#\13\ 2_Ö<íaÈ\12\14O¡ÇÉa\11ù+m©!\ 5ÍÅÊ\ f/ùC¾\ 6   \ 1;öú SûÖµC5¦X*\1aAWùô>\18\11åé8\98SMC\8fú&j\97\83\ 6²õÐ\9a}\9dùñû\f¨\7f\85\91ñsèd\fbbè»ý¶YeEp¼æ\11uÖ°\16x\ 1"M~\7fÙJãfqÂ¥7\90\10\bÕÚ2|eªb<\9cñ\9a/÷ð°¤\ 3¿1Óè6\8bºÞ\8enqhdGÔ\ 1\83\ 2;)îs\19\1f\13ÈÜm´Ë¸D\83Ñ\95}|~\83ýa!\8d2WP%\96\vò\8b)\ 2\1eó\aÁ\vV6/Å \8bâuØd\87ÚÐé\16¬Îî|cò×Ò\17\11\99ð\ e¿EÅvß@\92{ÊÈ"\8fl÷@Í\12d{aý ¦E\a\a\7f»S\8b´\8d0\94ªYÖ¦è\97\a<\80\18\ f.£:\17ZÆ$Épý\92OËpí¤@÷بZ
+]BS¼Ñf\ 4q\ 1¾i\1d÷ó­F­é\16a´T56\Å\ 1ù\9e¹øs¸î\82\89\ 16lÃpä²2ês½\ 5\18³àyÌ\8bç.ݨµ@\f¿=Ê\9a\98\94E@ÌøÝ¢d££¢DÒÍ\9b2Øü\ fÈmú\1f\86ª\ 3²\92P\aÖY½Ch&Òz¦rp£\82*\19\ 4H\95­5cP¦æ\ e\8f\97¢RGzì*®Â\9f¤ôK\81¸aùàù\1f\12;Âen×Ôé~Ö·Ô³\v \8b×\bÐø­4)\11\81^\10\82\1dϺÉ\91\9e\1fmÂÜ\8e~B2E\943Ì!ÃÑ¢;þ\82úmÕÇ1ôÃ\9f,/þvÆf\94ÒV¾\10}sìQû©A\85'­?\88Ò\9b/\ 1}\84\f\16},ý\86\rÒ)>\15£®x)\8b¹Là\ 6=6      §\e\8b\83\8f
+a\88Q\98äcw«æïöÞǦ\9b3.}åºÙ\ 5ÓM»ËÔ\1e)ÓL>Ì\12Y\9dÞW¸\8a3ÖÝ\99æHjêïøù\9fO¶°Ñ\ 5\)\8cnGvÜ¡[8©'P­u\92\84ÇÍ10®c\8b\9ciÉäâ\9e¾¸KÆ\87â|N~?ãø\14)\99k        ×Ì\87\0ÏX\90\83OvN¸ßÉ
\18@\8d?YÜreÉ]ªØÌO =Õ\1eÖ
+Óú\80Ò\,\8a\16\85â×OdI\90RÛÉ2:Oß9~5\969-U\12+Ñ'»c\1e\ 6\95BZ\\16ÀØÏNR_~\15~Qëþ\8cßâ.\eét\95\85ÿ\ 2&\91¦z¢è3Ü\19\8c\84\8e\9eF\92¹\8e͹º<Z\8fBa\9cºÑù\92ÿS9h\96÷¤ïs\8c\ 4\9d\1dm´_\9c,\92lO¸\90©ÐÚ§ÖhÚºóßp\80\95ë\ 1m\86\11«ß·Ê_ÅÈS¡¿^Q\84ÑB\8bXçHï|\0×î\97If\8f\b
+\7f\82õCQ
+Þ¼C\85'/ûÞ\86N¾2aT1yGv|'\9bó\83\18'Ñt\97RY\13ÚûÛÏ{céÃù\83¾æ+´ì¼µt\9b|±X8\96¸Ñjvyvá\ 4ªHëP\82±!´\8c0\ 4C\88é.vK\7f\94\ eì'Üe©Lõ¼úWÍêf\7fQ%@ÅãÒPl\19ÉÅöò&\9f\8cÆc\92\1e\9dN2ÕÑÂSà\1dåj^G9\ eù\12\1f3\87±îi{u+ä¼ \11\9d\vË'üÇE%\89\8f\9e\8c\9f¼¿nutÙûâ>ú\ fë¼?¾à.âk~.)Møí{Sî-ßÿÔG©}útϲdÞøâ\91ºÇwT\93\91\18¨IyTp\búðËq\0\17o²»öpÚ:\ 3Ö\81\96U\92jì^¸Ô\8eçÓAü\19+L\ f!ÛsMÌUÀIx\1eÛÂÈ£\87¬ÅG\85Ø\0\9d½áxvã+\85Õz$\80hK{\9dôM1pÌäÞøÚYÕ'¥¼\9b%hû§É6m¢Ø«\1d\88®\83?sàHÍoq_\1a\9fËÕ|£â\85l\f\8a!Á§/\8eU\82\1d\b¿!\9chP9, \e2\10\87ÂO³\8b\17Î&IÏZ0vV$\8aÙX\85\ 5\97¥îâ\13\81ò\83Þ¡P\89Ào\88"\ 4ÜNxK\ 1\8f\852§Ýß\9fY\8a\b.\951%\8dÖ|z\v\83\95ö\88\9ftUø©5OEUqÑm=M\1f½\89Ø\1f\85u     \16\16\14a3á\1aÓjÌ\a\9eV\9803`üs;ÄLçÄùpud#\9dM;dY\a\1d:\9c£¢\92)­b?[Ê<\ 2ÐT¿\89A\1e:m¡-\1d®\97ð?4\90ý\92\19§Ü°)î\½\8bY\88î¶8©râÅa\ 4ðþ¤\ 686¿\1f q¨h28´\91\7f5ÅÈ\17\1dÿÌýQ׸ðñ÷³\e\16\1d×\8aËV^'ü\ f}Y^;9¦¯\8b,è¯ÛcP/Þîà\91\ 1\16\86zHL\90\12\12*é"Ûn%
+\174*ÔMùäs³Vâ±\83¸±²Î+øú{\99Re©bG¸«Cù;·ô´A\1aXGxN²c\83¯µMÙh¦\17
+a`ªÆËØë×\83\8b\16ÇÙ\e®e\9f¹É¾G×ü\10ââbÓ¬s@­\10[\16²ó`wôW\84\ 2Ô\1f\14hS]\16\1fa\11¿ÀaS&õ@Á¬êTG\16\98\87\8fä¿°ª\90¤Ìq3¨Fµ\b\85\ 4¤N\8f\ 6Èû\85©o¶\1d\87\ e|N\88óÊÖü\81~²,zeCpÐ\e\ 5|bbûÉéE&ÈO4~B'\95°p\4\1e á%NºEZO>í@\9bÜ>O\ 3XäiÐToôGbÞ\16ê\14Ê?\1c&çà\båÎ!x¶\81Ü\ fÓBÞ×\13F\1a\9dê½VÓ'cñ\15°^â\1f\9f)eSû\11¹\7f;j¶È\ 4àh\ 3âÉY'~Ã(ày,z$k\bSJv\e"\89V=SÅr\ 4 d·í\89æM\16xW\9eÝôk°Ü£R\1fÞÕè\10óïY\8dG6Gy´jp£~©_Ñ»Pí¤Þ稧\1d\9a~2F((þ=\9b\18íAÏüÊÀSÜå)¼Ç\8dåï£k$ï=^s¯u\83!S¯\12³\83tn\ fYBÙ-f§rcQÕ^n\8b/oÀÍ\a\83øÄ\ 5à7úI\ 1MÑpjÜ\98üs©2n{\11Ø\1fö\8eL Î\97ÒñUh°lmUå\88\11ÐT¹Ä\95à·0\1a©u\9fÑ\f\17²T<ñ¸ñ3\8e|\83¡\1e:Ü¢C\v\80íyôTT¬\84\17KÞl\96±çbää=­ú\11*\ f\ 3ÂF\0ppúq¶+\9dÿÑ­nNJ\1fÒVY¡ÖB±\89m\83\93|\9as^J\9a\89\92\81"ì!\ 3F¥kÌðÑÝ=+U]»;\8a®$ÇG»øw*Ò|ÁÙéþ²¾ÿ'\r\984îmÂZD^\8cÖ1ĬØõ8Ë®ÀyFÚ\16.\8fB±põ`gP5Ä\93\90ÿ,Òv\1dF\vú6¹½\e7\9eoºFPK\89\84};[ÓÝðH\9b%eÿ\ 61\81\ 4\15¡T\8f\18¯õ\f\12V³x\9eXóò-ý\8aÓ;ÿ\96þ\8b}\ 6×5\80\8a\ 3÷¨\ e£õ\1c®2\80\88¯÷\83\89\18;\r\7fÞÙ6¡ù\b»mxH\1fWÂ@ÐÅ.sõ\80/µÇ}á\94\88ï,ÝõéÔûÓ\8e=Ïâqw4\9bñQh_\fØ\12\9bॹ\15¿Jsù)ÓÞã\81\8d\ 5g'0WØZM\aäýj_\15u\fì¬J²Ì¹åG«àü\12*\95\ e\89û+g\86\bõ´sÎðÏw\1f\17\11(|\86$\87\86àe8s\ 5\95A\97b\1e\94Î\162\ 1&\91Ó©Õ\ f¾DjN\f\86½+\16\94õ¥ÆË,\ e\12º\v\94upQU
+\97\ 4U\14}nó¤\8d¢+ÍñÛdÆ\8a¾\8aS%\90\ 3¹Ï\88QËíî&8AY¶Iâ\9aÓ2}íJiÉg\9bÒ\ e\86¯êy»nG.úÓ1ðë8\ 3¿"\9cèwæý\r '\14ù~Rë\0\94væÑßõÁþNßìÇÜÃ;\11]!EýõÔÈÓÃ\ eL\9c\e.·<\9blh´q\87£#\9eã¶ÔEË@½åä\95í\9aA       ?v\93\0|*?)\1c©^bý \8c<\ 1;Ën¹N è\83,\88S\95\12e0B\9fÙÙ\7f\1fJí¼(Þ/¬­ôä¦\12\86\83"Kó\8a\80!u\ f\14úÑ9\1dJüÓÚ,¹Í\84\ 5\1d\99¢2±?\83     \17`\1e;m\v\ 2\18#gW>[´öh\96üF%)Óv3ý\88{-ÏÄ\8cv\®[ÿË@c\ 6ò]ÌÏ\ 4ÊEÿ/\95Ú|)ö\9d¨L\9eic\99¨ê²Éê\10\ 4Å
+I\14©\93\13S\z±Ï\1f:ÔîÖ)S\ 5ª÷s\82\8c¼Z±Õ¨è\94"\82 *\1dÇÄ`-\13|èªÞ»\v½\aâaÂ\91\97 1\v\ f÷SxÈb\86Y\98@mÊÀP~n\f\9aÉMÙ\ f@;½ýÈ\9f%I¹\11Õo¼^Wë\12ã\10\99\90å¸m£À\v\fgõÍ<ùä.\1e ï!þ oML]´\97q\8eóáçÕ÷¥Å*!\85~/]\8aÃÏ:Ívw-y\9bUlZqrîâ·\8eçº\10\a\9ec\89ßa$}ò\17Póî\8d+SfuV\84W\ 4a\bò\ fûéÞÁV    ^&t5¯\85u+-§\9bì}1D µ \19\982\81\v\ 1h]\16Ïbjp¶y\ f,Þì\9c°ôº« Ü§@\15,%\86\ fè,8é)V%GÀ\b\95\ fZ¢6\8bÕ(Ñ4ªJ-\82[?Rû^ÄQ&wj:\91â\11Ô>\95n\94¼8o$ë\e+\ 1\r\vp´º}\9e~\8eWY\98{+(ùû­Ü\0\15\98\9d\11\87ïz\èé\88\12ã¼ü¹GÀ5:7\16'\b\83Þ¨\8f\e.\13S\9dÆîÒ¥-\8b_<_\9d2£Ky4NP\7f1\1c\93ù;\1dvóW\87-Ð+@MÒ¦<õ\85\96\88\84n\11P\ eÌm\13l',ä½\12ͦ3\89:öK×å\8d\13\1dI\8cÚyPì$\82÷7iÛL7g\1d²-C8~Âf9¶Õ¤\13i\8dE°Îä[|Y=Y\8bº\91x$\8aÃÔPf{\9cäÉ3üVlc\f$îßý\8có\ 3}\92Ѳ\9a_®$\v~\9a\80¾>5%ÌÊ\8c\9c\8dÇï^ªÜ`\ 2?o³©\1dØÂãÒ(\84÷k+êÂç5)<\97\80f\85j®fZyÛþ\11\14\9d¼Ó©J\86ø¸ùxo\1d\19WzÂ\18#\ 6\13Øs\ 2þZ¾:à        \89¨\87úE\9b)Wß'ÌÚN¢\10f¦éÒÀÝ\dÍ÷Ü7\92±\ egké\81\ 3±\0\8d÷ù°j\10Õ©\88\ 5:v\16\1e\ 6±o]"þu\97\ 3Ä\ 1×q4ã\13íïó#ïD\19Ã\90\80¸R\12\1f\84ˬ×÷¤þ)\1cgõÙm¶ÔÀ2¼d°\82ðª\82¡Ï@Övpã\98R\9c\81¿{Á7g0\aX\8d\17\9b\13Èä_2A\91\aÍ\11Ã\1aä\1fAíÿ,Åwd\94oоË1ù!\81\859?L`«²\8b\ 1ò\9avv    ÜÒ\7f\9dÉ¡¸\80#®¿\1aé\84L\15\7f³JUr)\8c©,\9dÊ$y\ 6Ûr1ÎáT$\19×$liÖdm@\18$ç&ôã2-Ù]²t\99µ1H\93Xðl\0\13$\ 6²\82¥E\8eÔ-\92\9d\9e7¬æL0xÇ\9aàó3~Kî\97y>&\91\14]iP*¹¼ÖèÊ|NKD'\11\8c\ 3}\19K¢½"\16\ 4\1a\9dTa¤ÉÇ/\8d<\92\\13T?'ËNs(D\10}ôªM%\8b\ 3µûïæ*éW«È\80\12U/CAbí=\8f -_\ 6\e\9czÙ礥\9d\ 4HÜ°r°hci£¡ç\95uó$-4/-\ê¡P:\8csô¥ \1f¤bè
+=\84bèúU\81\e\ 4H`=\8e|\82\83»\9bµ%a\9fÐp´\96c\ eüd\bº2Àà/F¨Dy\91\92\1aJÜí\10*K$E}ÞÃÏűøà\ 3¿\89\83:lJ{Ó¡+r$ò¹#\89\9fù´\82=×"A­¾ÉYÆLq;Y[à\14\a\v¼÷\96ø\ f/¯D]´^­#ð»)ÅÃÎ\93\82\85T}\a,wÅß~p\f¹\ 1å
+!3iQÔó4Ên\82\1f¢p__îø\17\1d\9c&õO,³¼ÁýV\90¨JÂW\12\95øl°n¥^¹ºÝæX\1dù\8e5\bjk\16ãTп\1d3¿oöèÌ]Âû\12/ÅØ\11\90Ë^$+-×¹îß\17\8dj\8c\12T\by>m¤Æ)òÚ\1c\a\8\97¨ôTëºýN\10zص `GÓa5³JÏIL ï¹ç\bbAÕ>\v:\8f¢>\ e\8f\\b9
+»`Z\ 6j[F.\e;\8au\17º¹>5\r¤\84¹îõ\ fç\14ý\9c:løÀc`\87ñ{\8cÃ.²\8c\1fºPG\9f.+D\94ä{{.sù|
+W\82\9cÈ·P4ÐÍÂ|]/ÝÒoïj{\09\v+pz[4>\ 5)\ 5aÉKX¿\1aÿÂ\86\17;>í]?l\96\9b\13Ã776\1a\r\a¥Ç\84\l\vnÁÉ­ô\8a\87ONg°d\8aâ?¤\86Ë\94Ï\1fó\ 4ÒXDÀT\9c\8c\85n{9´\9b&\ 6´õuOP\0\7f\8b§\88³O!à\9bÈ]¢º\ 2ÎUX\ 3ÂÌ\ 3BÒ»\92õ\8f£\ 1\ 6\1e¦\11+f\91q?µ&\17]/\ 2\ 3æÛ\b\8d\96¾Ã¸Þ/)ÐQ4v0\f\rf\8a\99Ñ\12N     !ë\9f u\84p@mO\97\13ÄÃ'¦%£\13È\9fß\f\85\1eh\1dH\11]\8f\8a\8eïâ©\7f\94\83\ 4<\9b\1fE\vÕÖ*´<l\1c©ä\0\12ÉOG­6d°b¿H'Á\8c\13mÎiZF\91\e tÌ¥Ç+\9fæl¯¥\ 44\13Ô§\fÊù\97*­²%æ\98C\96\18x\9b®ÄE¥Q\82\90{âVÒ\91Çu\82¢\1a³¯ýÌ?Ñ&\8bÈ£¡\11"bO&\19\ 4\97\0\1e}kD   à\9f"¹_Ôâ[Î-ç?Ü\912F\1aVg\7f\9a§7gR°¾ö_­\r¬D\95\ e.·µ\15\84Ä\ 4\1ej\9c§³À<\15ú£\8cJ~wZ¼N
+ãâOSrQñ"ÚÇÞA\vhT¹·\9a&[©Ë=p+ñþxÛyË\9e\18õmõLA=/Á:¯kõÛà\9d\1dPrþuY\97¿\9c«\84*\9cBûüD;¨\98X\96<\aì      Gã\85\925<³&Ìj\9cveú\8dÂÔ       M»\1c;;wW8}\ÛÝZA&F¬\81'\ 4køÂê'W²9\8d\ 5\12óÿå\aðÿ\13ü?\91À\14\f2vr±·5v²\ 1\0þ\17i=·c
+endstream
+endobj
+24 0 obj
+<<
+/Type/FontDescriptor
+/CapHeight 850
+/Ascent 850
+/Descent -200
+/FontBBox[-55 -420 2343 920]
+/FontName/NFGEEG+MSBM10
+/ItalicAngle 0
+/StemV 40
+/FontFile 23 0 R
+/Flags 4
+>>
+endobj
+23 0 obj
+<<
+/Filter[/FlateDecode]
+/Length1 841
+/Length2 2106
+/Length3 533
+/Length 2723
+>>
+stream
+xÚíRgTS        \16\ 6A\940È8\10\ 6\14ôÁ\ 2ÒIh!\11é QÀ ¨ \14\ 2O\93\97\90B\bE\9a""\84¢\14\15¥\83\ 2*\f R\ 4\11AP\8aR\14P)CQ\11ÛÐFêFÝÙ=ëì9{öì¿=ûÞ\9f÷ÝûÝï~÷¾«ªDpѱ$Ó}@;:ÌÖAë¢q\80£\8b\95#\1a\ 5èë¢\11ªªÖL\90È\86è°\r\91\râ\04\16k\0¸\80\f\0\8d\ 1Ðh\1c\1a\853À \10ª\80#\91í\a¸ðh>t*@\11\b±\0\ 4\ 1\82|a\90\føð\0\1f\bXÒ@&D"Â_ù M L"R\ 1\17:     \ 2Ù<]\81\8e5\9dÁcB¾~l@ÝZãK7Ì¿©\ 1\0K*\15Øÿ¥\84\ 5ì\aY 3\0$ë"\10h4@\86HlÀ\aô\85`\84Þ\97áð0\85\ e\85É\1cÆ\1f©\0\90É\12Ì\a¨\væÕ\0\ 4Ó\92é0\95'°NAè9Ñ\ 5Ý@\81\97ÿØÖ¿põ½¸\1d\87Ju"Ò\ 4òß\16þ§<\91\ 6Qyß\18\1c*Èü\9ep\büfÉ\11$C\1cÚ÷Y<\9bH\85H\96°/\15\ 4PßB\10Ë\ e
+\ 4É\ 4\88\ 3(D*\vü\1a\aaò÷­\ 5ëúÚXÏÉn·­ín­¿\9dÄ·,\81\bÁlW\1eãïº_è_1ú\1f\16&\14\b\1cAé¢Ph\ 1Qðþñåù]7[\98D'C°/ od\f\10\99L"\ f\81\12\e\19\ 1Áh\0\82É` \0\ 6
+,ëéÂt¶ \ 4`pØ¡\82;c"¾üG\8c\89Àæ\97ÐWd¢\ fèíÿ\8aþ<\92\95\15=0XG «c¨/¸o\ 3C\ 3\0«\8f
+ýgâ\ 1\18òç\80x\eÀ\be\80Æ
+ä¾DI\1c&\13\84Ù_oG°®?0\ 5\12,\17\ 4\ 3A\12\90\17Y\8cµ\1a@\8d@\85\92\92öhEÿÄE\1di\9c\eÚd\81\92r\80\1fôÆ0\1eó°\ 5\94\13{|jGcí\1e1M{£\12L CÓÅþ\932¢ã&\15}:Xáñ Åñ\85d'©òÁY+|\12§¦L\19\1e\86\aY\991ê¯×'Ï\12\9aûîi¶\9eíªO³\9fW\94SÁÉÎæÙ\85mtâk\8dóaÍ
\88\vc\1d\ 5z\9fï/±RhÅg)QÝH\127<®\9c ¶Á,|¿¹{®¤¼w×¥ÌÎ}\8bË´\83ø­C\1d\ fWÚb\0êaÛ ù\1d\12\98ÇÅ\XdªðíAþÔ­ÊW\97§EJ_4$ã4¯\8eÏ\ e\rj\97Z\9f\8a?k½iõ㻤=ákm\11±5Rå\927\8cÏO\94\9crKî»t&,r\8d·üÚÆ\81§¶v\7fJ\88Oªs>cÜ&\1e»¬£ #\82ÐFÖµ©{l=ôz=£{\1eõ£øä®ËC56cª
+\9c\87©²9ÍC\17\87([\90Ï1\15\12¾\8d\17XÖIÚ>³¡Ý{GFvõ\eL\1dí~»NtÃÔG«Õ\1e©\1fô\84S¨Q½´t-ÂË´\f\9d·\7fÚå\81¸\8cmïU×[\bå¿ïë<\9fþË#÷Â÷\aF\b+B£'/i>HÖhmihé¼VÎùÔ\96ºo\12ehËËñ¦\90\89Ò\v»¤\91÷w\7fd4s\86\ 2Ô¨¾¬ÒÍ\98ñ,ì°\97\83\9eü\15¾Aê\87ÌÇÂïëÅ7\89\9a8X\9c\99Î\94Î
+êg\99\1e[àÌê\7frý@\98¶á\8e\9c>z×T\bvÜVö £äv\8aG^éSíÐ\11»5·^tmzT÷©è\ 3ÚÎáWLß9.+¥W\a\rLèæ\9a&U\8f\19]\95¼Äí±Þ$zú\9cÔ\ 5\15\9eºü\97I\¤\84T庥R\87\87×ö­ª¥½Û\90HOYI\7fU®ÚÐðãÔqìJ@ã\84\ 6\11öMÇî­Á\12æ\97\99\83\17\86J\89\9eFíʳ:\r\1eK\8c\17\95ý\92\17f\94\85\8b\7fóòQXUĤ*f zà\99\ 15\a×\0\13¤f=*Bkkzg=¥«z\80ï\94ãä éÈ}§®FT\89\7f\92\0©'M\1e\bÞîcR\97E~Y¶Ó¯'¤\9d=\15ñãÂH\9dþDS¾õ\ 3æ[¥u\ 1\1dåeÃêH1\84¤FÛ¾*re\83\ 5&hNÙþ\99ØèÏCø`Wµ\80í\8e2豸\99ÏcÑ=Þ)$øA|ÅbY§é\82\98\8d\9b*qÔÝkrFï×\90c\9côCï\17ô4:È«Â\1eë\10«!Ì\80æe§Ö\8f¢L\95Ís&Ôí\rwL\ 3s&#<\9fDkT\9c\10\9f\9e\7f5Ã8¶w£TInaݼw\88¦Éæ0à·
+¤FQµ\9f9Q½Áì\ 6Ff.\7fâý\ai±§\8bnôM\rí³\19¡`Ûà\98\11eu A\92ü¸iÌy§í*\9c]\16\8e\9f2K\9f_ú°j\9c\88ñ(\9cë·\99\89\e\15¿\9e\87Í|\9c0ì*v\17M±-"Yêcó¼Ü\9f\f{ò÷\1c\1c\1e\13r\fn[pH¢ðë¬.í±4\1e\8c1Y>\13vDÍ\95\rm\89ÎY¬Ú¦áÁØ\aÇ\85ÐbÆâ4\85ö\ f\85\ 4?7-\9c_½ÖW(#éô8+\91{\8e\1f¿IÃûy\ f\9e¡Q#knîü½r\85\969ùÑúë`ÍÆôÒÈù²\93öVÜ¢#íQ\84
+\84hÊ°\90WþÈóTc0êÉJ.ÓêS\ 1É£Åd/ÖòÅ\86yÕÎø%ÏóÈ­úâ
+½:ìÜ­`ïsJM\84,^Î/6è\86\ f[&d*øè`Qî³·x{ßY±\ e-Ã4¿¦¼\81\90&ÿëÐF i[/ø¶G1[\1d\13yAdé|X»i\8avªaþM«í)²Ùõ\8e4³W'¼\9epnÏ\1ei>mT¥\87êbáÊ0EòÆ\93K\18ý\96\13\ f ¬\15%³]#¢9n\eå5 \82Ò,Í\87WäÞ¬w\8f¿S´²v\98\1dö³F\94\e\80¹£sÓÚ릥t\J\97\87\r`h\12oJorB\1c|}¨\93a,÷ªÝ=u»\ 6\17\ eÁ¨\9bãHýºº\eò"·S[«X\9a\ f·X䨸ç=s\11I&d÷«ÓT
+µÉ\17\ 6\8dÅÜ£_0ë_È\16=};û¨!64Á¿)Î5D©½&»¶uÀu\9bôg­³(¼Hÿòe¥îÚÃÖvÏ\eQ¿öÎ%^7\\8aÛ)Wh\ 3\ fÍ{)^<\928*\ 4\1f\82N\eÜr\97_i\943;³6r»eEXbîe|þSCÿ·iÙè)\877\ 6wÆ-:4Káúú¨³3\ 6Æ+c Õ@&N3múÄ¢ª\8b³\84_\17÷ÖgÄ\9cJ­á\96,÷¥¥F©{\9b\9dÇ3\9d¯oAJJ.8%_ùýR\98JZ`\89j\f\92Z°z+3èV\12iÅý®×\eÏÉL©\e7\15dÍ.\86\9d\19\ 2\8bE¹KYç~ø-ö®BÏhÍýa\91HÂDÇGëù\14ä\13×°\92q|@Ú\93\1d\v\1dx\9dpH¡×­7ÿª6*Z8×ý|H\Y\82ß9\1eC)fCæÙ+ù\84\9ei+\95\15ãë=?\19\rÝXï/\9a'éï¿\16\94}NmD9ª £Ø§öp1+!bxÈêøh_¹_\82\84µp\81ùà"_¥\98=pBö6@j»6oö\v\7fÀ.ÐÌ\ 2N=\87ÿ)yüºEê¯G='îD\9b¥¯Ú>«ªì®tÞ!dÝ»^£\18»e7ï6ßsW6ª"\82»\19\1d£;l³\9eØÎ\ eK:!våuz\93¢wl¿^{Scuþ\96é\82Øg=Èj=ù»ö\95áÒJ\9f§E·\97Ï\9b6&\1cÝùªf\9fPÞ¨e\84~qû\sW¤\1a!ì*háaL Þã\98\fV\97âÓ\88\9ei%\89²á»\8fÕ]\ e\ 5Éè¶üù{çN:\ 4NT\9eTöDÛ\9e¾W\1dÂ\97)Ä:#±\953ýPÞ``oY$\98û¢V\xùÁ£ÚÁú­\a-D¦\99
\9a/\1fÿÙþEns:®d\7f:W\8c¶`\¹³ÿ³ÿ\9aV\15\11\91ýÔòæO9Ì\93ðµ\9cÁ\a¿\9bw·JÕ>\9e\18á#ªüBú^\ 3²\89z\a¼#\ f50"\97\18¾*»{_y^;µ£y° ¨³\8e\12ß\9aµ\91\95¡ÛÒ%³W=,¿\9b\8eÎh      \14\r\91ÿô\11\15SÇþ$w\8a%G-Wú|ðd{\87\9c\84òûò\11\k\86ü\ 1\ 6\86û\17iÎÎ\84SÊICÃMU}QìG-\85r4Fç}¤8®ä\ e]G_\eÌ-u5O[þ% õ_>\88ÿ\vüO\b\90¨ \91ɦÓ\88Ìã\bÄ_\ 1²»\96\1a
+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ÚíRiT\13W\18\ 5¬
+A£\14(`µ>Ô *$3à\18@D!²©\89,"\8a"\84ä\11F\92\19\98L\80\88\b\82»âÒ\88\80\88JdSà\98º£µÚ\82»R°\82@\15¨zê\82\8a
+n Ø\ 1êñ\14û§§ÿzúæÏû¾{ß}wî÷8Ö~\81öîR2\ 2z\91\ 4m\8frQ\17 \10\ 6\ 3\94\8b°8\1c\ 1\ 5Å4N\123Å4t\ 1¨³3
+ÜU2\80b\0á»8 .\98\ 3\8bÅ\ 1\ 22FMá²(\1aØ
+&ô°øÀ]\ 1)\"&\80PLGA\ 5#"\11ËA )Á!­æ\ 2à.\97\83\80\9e#J\10\0\95\90\8a\83R.\8b\85¢@\8aKh\10\ 1e8Áâõxò%"IÀïkKU1\1f¡8H)\19\96ñ9\ 10.¥$!W\ 3)\8cdñD$s\ed¼üc[\7f㪿¸\97J.\17\89\15=ò=9}\ 6\8b\15¸\ý'\81TĨhH\ 1!)\85\14Ñ\9f\1a\fû¼ ¡\14W)ú£¾´X\8eKÜ    \99\1c\ 2{t2\17qÄú\0\85'@©\1fNK¢@¤X®\84½}HHû[aÒë5Â\vò\17x\89B&õ\r\ fô\13ã\ 4=O\1d\ 3\ 1ò\89Ý[£\9fj&$
+O\0\8b\10.\82 \f\91ù>îBû]æIHH)NÈ\80\ 36\ 5\88)J¬f!\8c\94\ 3\86\81D\14à\84\14&\0\98À8æq      \92f\8e\0&\9a$\10IR¬\9e©¢S&\ 3\9e\84\85\99±DõÀ}\88\ 3
+xR±LÆäØÓûü\1f=<È\84D{æIÚ;c(ÃÇ\1c\0ßÉ!é¯Ä \ 2\8fUAß\99\0C\10Ä   å÷v%*\8a\82\ 4Ýû¶\98ü>Ö\918\939\84    PÂÊÙe\8eë\87Ù\8d\9aô2¼ãlí\98à\93\17«\1at;Ç\87\1cB­D?§j\ 2\ 6¦\92¢ÌЪª\v\93ìÚóÖe_m\1aÝ\80Uç®\9cj$?\7fµyîØò¡GFgÇ\95::H.\19Þj»vzÎ*\83'zû\bz­Dh¸çFHǾ\róóÝí¦\1a\1fìl\8dM|Ö´§kÙªð3Þ!2KÝ\ 5×`\13Ïj\9b\f*.p ¢íj;\7fñµ[\ e\9etk\80\7f\1c¦wÇUhÁ.Ö^W\95\19G\8f5J6èLq\1díõ¶tx7;`¹àk\93ïÊ\vØk}v\-´èvã,\f_\15]au9ª¼\1cÉ\ f\r\1dV\11\8dÙM\16\94\90ñ\9aÃévÉå\95F%ê\94GµKöl\89N» ·®¦S\91<Ƭq½í=ã\1d\8e³®S5G\7fÍ5\r*P\1fZ\9a^jýÌú®æf=\7f\7fhkúCn½eñ  ã¬§»nop\r.K"\8e\17ó\ 4\8f
+\1f\a°Û\8a\10®\8a}k¶oXÌ)í8­%÷1ÿyÞ¹[\9bA&2ØÜ\80ßXxfÀ\8d¬TYüÓÖ\96­f­Ý\ 3\8b\95ß\8cð\18ùÎ\7f\9aw\9dòn\830%,tPÔ\a-lÙaw´(d\96¦á\84r\eùÜ\19íZ3x©îõ\91Òmôò]íÒw?\90\1d¹û\1ee\98\86n\b\7f\9b<C>æ±cùìôWN\97\87Þ\1f´ò½Õ\93\8de\ 3pAÙ\86\16þ\10\14É\b\ eÙ^}»yÈ0¿\95CÐðMü\1cǹFiÝ\13Üï\8dlX{½àb~á7ìû[rtÔ\ 3µ!-Óí-uºRvÐ|K«õ»¼S\876go2Wk\8c
+?ìë
+\18\97{@d\ eNQú[9Äͤ\98\19\1en\9a\81ó-5\11\97\7f+_0Â\ 6\833K®U9kg¿Ì\1e\15a:è\1cµú¢þUòAYí<ÃLÐÔí\96>ýÀ¬Õ\97¦\8e[w3\ 44\aµ±Ü\16\17ªDS*Â~t\9dþÊþ§Ã§ë¾_sÍÇÀ'Ba\16vEÓÂrÊ=Ü5f\9d\ eþbc\93\82Ýn¯ó6ô\97\bëcç|±HoÉä±êʺ\8dÖÆ\995z\13
+j*\17´7\af%îîZQþ¨¢è´É.ç4Í\87Òá\19ºãñ3÷\9fp\93Q\eE\15\92\87\ 2Ïk\12ÙS\17\9d¦fd*ûw\8f\vÒèì\17Ú¶(ïøq\94èN\89
+?\8dS]þ\12\93ó9ïù\vÓ8ãgwv¨\16Ë\88;\95MfïÒ\8e\9bÕJTT¿\8eoL\ 5%Ñ_±«ªKZ«óK·?N¾qÌ?\95wÔÊb¸gj¼í3¤©ân\8bQâàLvÁþá\97´¦Í>\970\97¢<\13^\9e\ 5Õ\90%©µ\19¥ ,Íî-\9c\12iõÆS8?\96ÿ"qV£Z_ëûm}g¤Wý\97AG\839h£±ÉI\93³~'ß\f\biÓÛýr"ÂJÞÛº#3xÓÐQñè\93euíI{|Ö\7fx±3búÎ\93IøJåÃ\a\19)Þ¼\89#\8eAìe{m\a\96çã\9f\1dª?O8Ï7WWd[ðö\88ï4N§¡1ò/\17ë\7f\81ÿ\84\80D\ eÅ\14M*ÄT4\8bõ\aÿWC\r
+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Úí\92UT]Á¶¦!¸»ÛÆ\9dàNp\82m\b®\ 16°q6.ÁÝÝ-¸\13Ü!¸;ÁÝ\82»\ 5\97\9bsNßÛ£Ïí\97\1eýÖ£W­±FÍ9ÿõ×W³\8a\96ò\8b\1a«¸©\9d1XÆ\ eâÌÊÁÆ!\b\90\ 4ªr°\ 38ØØÙ%\90ii%\1dÁ gK;\88\14È\19,\bà\10\10à\ 4È\80\8dÿNþ¾\82\82<\9cÈÈ´\0I;ûo\8e\96æ\16Î\0\ 6\7f¨ø\0â¶`GK\13\10\ 4\0\ 49[\80mÿ\9a\98\80l\0jv&\96`çol\0\80¸\8d\r\1f¿8\ 1TÁN`GW°)\e22\a\aÀÔÒÄ\19`\f\84 \7fü\a\95\1cÄÌ\ eÀ÷¯´©\8bý\7f\96\8eN\7f¹\0\fÿ$e\ 4üå4µ\83Ø|\ 3\98\82Í\90?*Ùý]\ fü\97æÿ\18ì\7fÃõïæ2.66J Û\7fØÿ£Wÿ­\f²µ´ùö?\ 4v¶ö.Î`G\0ÐÎ\14ì\bùw©\16ø_l@°©¥\8bí¿Wå\9cA6\96\10s\e0\80ý_)K'\19Kw°é\17Kg\13\v\80\19ÈÆ  üÏ<\18búï\10\7f;÷O\84\8f_\14Äeä\80Ìÿ:Ö\7f\15¿\80,!ÎêßìÿËö\1fê\7fÆ\1cÿ3þÛ\1eGKw\80\1eûßþrü\15þ\1dÿ9ûúo\8bICLìL-!æ\05g\10Ä\14ähú_\89ÿ\ e%!açîÉÊÉÃ\ 1øûù{ÏØÙ\ 5\0\ 2¼\ 2Þÿ«R\ 3béà\ 2\96\93\ 2ð°³³ó  pý3kââè\b\868ÿó&üÝñ\7fÆf\96\7fû\ 3\ 6»\83M\90ýÔT\80\f§\f+øìø\86\15t\f\ 1³/%aþ\ 1Â\1a|o6"+1{-©Û^5ô\7f\86DW\e­\91½h_x°\e\r\ fo~<¿\8fûÊó³\ 6¤\8fÇÎz\v\1fË­t\8c&\ 4y\j¢\88)Ýcq×Ü,§s¿|GQ2\ 2`µNµhö\8a
+ë~ìD\7fÐö¦Ðr\ eÍâTRy©c\bkV¦Áû²(FÞ\1a7wSRm¢\92&A\158ÚÓ4!e»:¶\8c·\9aù\1e\16¤ä®h}Ï\9f\ 6³,\8d\82Jéb\ 5í\ 4/íåcÜ3cy\ 3ßÁýaÇlãEÈÀ;"ú£Þå\9bíºØ´Sü¦r¥¼\11áÚN\ 6s¬%3ãõ\aA/t³\8d\98%}Ü«\a9Js\1e_\95\92\81e6\8cs ÿ\94ïÏè=V6ÏF\a  \18\81ÄÇî(\ eݶ\8dè\9fòNlAÛ\12³\9d{xZñèØ\13\11\ 5\19\ 6Ö¾ª\96\7fâÜ+
+:eÄó\88û£Q\8cõ\ 3iëcºc\14³\r|ÏR­4¿,\7f\ fÀR\96ÊÌÊST\1aѲ§J.ÈH¼H¼#Lo9\86¯IèëÙ\83ÙßåÝ*{¢Ò²    g¯\10\19îÅø\1aÐ\94µþð\ eüñ\94¥Þ9_Pþ©¨\96ñ-¥Ó\84A²µég|\13\9e6qÚ×FkrèQ£sËÑ\84)}Ä\80Ó}¶\95Ùmø%\1eî0*1\f\14³jp,Ó\1ed:6\12
+S\8b\10\ 1*Ó©\ 2»t
+wÔÆáR\98Iv\0êq\81ʬ\1aOÞÄåÝ\b\87(Ü$7.«\85yI²ÿ\0\17\81\r\96\13¯99\9b\94ID*¾\ f[\99©\12Ç1~o%cÜ1×\80\18ôÖ0\1eÄö°Â
+(V\82ã\99ïr\93\1cþ\96¿³\1a YÙ\ 3³ð8\ eãÇWè\13;g9ð\18\8c×!?)6+\ 6\1dIúîM¾TQóC«±1¿\17Y%Ù3¥_í¬ye¯ú5¾Ð61v+\8fË\ 4\8a,\bx&I}unË\ eÍtLTCS¤Ê¡\ 1§¦\1f¼F×6K\8e4\80\ eÆöct\9dIë?B\83\92ê3Þï\12¬7.T?OÜ \9dT\17Ç\8cëÍþî2\8cºc\15$¦°¼!x\8e.\9a@<\10ú\88 Å\1c¨^Ô\87opì\13É\ø\9bË\8f\92óÞ¨\818\ eÕ2¦~Æ)ò\18¹Ú£*¥Hû2\12T54´ Ç\10Þî\99î\87ú~®\97\971\821\89%é¹½þrù³È\1cE](Eª\844\94\aJ·£Õ\ e\82z?ZÎ\91\fíU\8aG\84\82\ 2û@îà\ 5\1fß$èzT§Æ8IGÛ\8c5æùø\9dú\94¹ñ4⢥§ \81ª\12ä)R8\97\12ü*5N\99÷f\80'\8e/X¿­#\ 3½ ì\93æGæ&óYÒm2ñ\ 1\17öF\vùy~õÍM+\ 4.Þ£ÕÒ$Í\aòÂ*\9aþ¤yZeJ¥\95¦ªé\e7\1e·{akçð+8À\1e î¶C      \1dÁ§_*¬Å,\9aÊ¢âÿ+Drr\f6î{Ð\94«\83s}÷ð©e\17yÎæO\8c¡³ÔSó%÷càÊðh\11Õë`"ë=e\vñ\ 3_\85fãç¹o     â\1chf    ñ±S\112\84\19î\v&\11\95^\r2¬¡Î§N¿\82\10ÀÉ#\8a\ 1\\13Ü×Ë\1fí\1e\95\93È^µ¿_°\1cÄÍ\8fQê´ªqE9\ 5\8d\10|ÃF¶èÊGI\17\89\82ÁIóiµb+gÁ\9aZâß/\97-ͶݸyÚΫqïL\rÅý`¯a\95²ã¨\euU)ó¬\9a\18\ eå\ 4­^5\88¡®("wåÊ\ fú£ SÐ\f\83×\0éTéÿXq\1c\95=ÉlJ\8f G\18í\94ë\83Îov\91QU\96ò\94P!%\8cø\1c\11\84vF×fq¤Ø+Üs\97\12\89\13«Ü=0:}_Àyð¨Áà1E\13¬\96å        þèÁ¸¼[Õ\8b\1cóAðlÇzn\bÔÁ\ 3¢Ë)\1f\ 5S¼?RRD_\ 3Ò\81\95\98º       óß\14¯ËU­)%\87ðP\8a\82ò\eSïÒh`\96Ù\9dÆà­53\7f<~ÍU\90øÐA\ 3\97\11Ý1{\16Qv\98I\1fvSã^J¬á9$ÙÃD\ eõzñ
+\83
+Ãæ¿Á!\91\aß}¶ý󻦩ØÏS     #Fýã\89y\85é\1dCëïKOý\14ÒBãN\ 4nÛû?ªùJ    ¢±:IÎ\16,\bñnæÏ£iP¼\8ej\95§ªça)íèÖ\18è\9f1@Úâ\90:åÈE\10¤ý-ÑÝ!\8cf\1c¢\82c\18+\9b\9d¡\91û f\14\91^ÀV¹KKAÿ\1erêË     \1ciä^Ä1`¿>%±M\\\8dOQÙ\12e/\r¸Þ,Ô\9aE¸rSQcZD7a\82-\16Î+Bx±ºEà ë\84¦_²tn »\r\7f7.\12&
+y\85\8dX4U\9fcÞ¶22ÂÄ\16¨åo7    \ 5÷Cjàï\1fÖ9¨ù:\11çø±\1d_.:\9c\9bëN\91"%MÀÚV\81ô\94¹XBÌWKjO\91ðÌçùú\15\83HiS@þ\86\fQ\851>Ê´¼\94\91\13Ûë±½\f\9dà\88\1dl\18Ò\8cÅç־ãý\réµQU
\e\10ÃGÏO\ 3\bÃõÕS\84­æ1í\1f±ºI¿÷õ¿rp\ f\14lZÛ)º\9c¦©\9bõÿ\81\vòÅu\19!ÿ\1aXÜå"Ë·òáñÐâ\ 4m\11Ò?K\1aI¾ÌócÔi{,S<¡\1d9X4É\91¡\ f^)6A0\9eë|d\80Å\18Âhñ}^¹\90«Õ\9e\8e÷yÉë«\7fÿµ;~hà\97ï\86\12\9aC\1eÁú©\85Ñ\84\e\90í9//®£J*\9fÅ\ fW\0v>\8eÎâ\e¸¯®b2ç³VðCÚ\1ae\f\88\8aZNø\11­Á\e%\13®^îÈñ\abû[ac\89s\82²ñÒ0\1f(7ÐIX;\93\95nq[5c\85\18ÿ¼t\1eÑ\97S³gÌ°a>rgÚT\1eäÆýÊL2\12Óßhɼ\ 2y²0zü1NÒ¦6$\89JþóS\8aõ¤\1eX4\83\82udf4\99­ÿ+#¨\ý\96\19ÓnØË\v\16®fì'Mú\97Ù\92\85øEÏ\\8ea±á[A*Ô\17ç¬ß\8aôñëÆ^¹Î.\ 2&3{©Ir¶\1aU#v¯²Ç¯u9\11?£ã\13Yçk(À'+0
+\17Â\8eD[©æð\94p!Æ\ 3íOe\ 2\e]éÙ9\16{ýû\8aí\bÎey!\aâÜ \98\10Ã\8b\9a°ju\17é)7\93\15\944\13·ÆÐ\8bQýìMªS\9c_åv²ÂòÈëo\ 2\86\81j@Ï=\ 6\ 3+\80·Zi\99ÑYøQ\a}õXG¾\10k\9akéÒÔ8czÜ<å\96ëT`è<®\16¢\ 3\9f\rå\97Ìäc¼ñ\17G÷`
\8d@Äf6,ÂÄK® °\9fgÓ×\ fÇ\97Nt]©}\8eÎ:§á\ fؤ)\85\ 6\83"\9f£\91m\8bþì\aÊñ_\90\16\92ÄcÐ\96~¤wþ=zt\15÷½\93ò<\ 6ê\13}\8b¢d}ÎÎç\96íd~ÓX\1a[N5­|\19^½Lf\9c5\8b\89Å]`ú\92\8d)-¸ö\85Ï\96M\rJ¶ÎÃKªÉ\9f\80\b\ e(8\92ÕþÇL÷À\ e\9d$
+\16ÃIZa(©V\92ÍFP»½eì\82û+\87ûð4\995]\97¯¬®¾Ð¬í4\85@\r÷\1e\9a\19ç\89\18ÿËè\96ô§àúÎ¥¾9cd¦ü\95\ eÔeö¸£\96#Óþø¾ª]=\1d6¥Z\96\fJ\ 4äÄTÃ\90\biÃQtV\ 2^î1¸°\b9q:±¢ý\fE4kÏ_l\14:ùþ»\14Rx\15\93Ñ×ÍZ­\12\92$¤hm_\88§"\84tîRÓpÊ5>RLm¶\r7´¾>C¥M\1c\ 1\17\1eB\7f0\8fp\13Ü\94~I¿\7f\9bO\e\92=>Å-Ug\\19^p{,\7f\eÎÿédA`\e\0ë\9b³iµ\b\89H\15\84Á]\r\fk\ra\ 3üº\10\86¢í\99óí%&å\815[Çócn-h\9f;\Ð\vWùdX     \8fV\ e\82¼~ä1âÃu\14á£û\ͱóN\81ùihñ\87\8a\87\vH\fH5Í<G¤Ùä>Ä\9f§RÒOÝ\9e"®å3\ 5ÃûXI@Hß7XAëX\ 2\80Ĭ\v\13º'D&u\8f¤\ fH\88\11¶¦1¶\1c\11WRjRÉ1{nK\1c<77dÆä=Õ7\969\85\8c\8f|V\17\1cùóÂÑÈø \ 4§\1f¯·\9e\98\91\19wD Æò\9d.·÷H\vóVÜ\12\17Ð\fP\89\12Î\80C\85ÑÙ K²·´ÌÛÚ'\97t«_1é\860Iíª°Y&àì2­\ 4$\8e8ÉP      ½\9aa\97\8cx;\9e¥S´a\14\ eä|+^D\ak\bãF»ï4\f\\91\18Ç
+Pyçä4~>û9âÕ¹Wô"\a-?úÁ<­"Â`«=Ïtm³×\82V]\91Òÿê\1cÚ{ôPB\11Ë\8bÊNo\9a$YjB\857\ 4rBÝ\95ã\f´Þ
+\13ãñ    î\91íð\98\1c96\1aË©\10\ 5\18Å\9a½l9i\9e\19v\18/l  Æ\88?\a\80\90R[\87*ÇA[\8a\ 6Â9bhWs\ 3\8dû\11M\9b©\8cÖ\9dí˹o\rF\ 3;H\84\8dHp\r\90Ó\9c\13\ 3 \9dû©¾I¤:Áί\88C\97\16~Ò@jÉñ\a5Rì6>渠©#_`8ùØ3,\84ܽ´\89\ 3*cÜr"R\93«Ñ\7fL\8b\93ÑÓ¹M>¿\1e3\82Ó\ 2\8eh¦s!Và     0\91h\ 1\17\ 1\98ͨ7\12i
+"9\98~   A\12\98T¿Èu"ï\87âXÖ\b§\19,ÞE«©\89ö?ýý|¹óY\88)\92\94ÿëaÈùéò\93?ÍóÞäNÆ\19\88a%~\1f\8dO\ÈÓ^E\1e1ÈrÆ{ÏuÌD­\14r\14\1dÉkú¦L\ fXö%àA\v_\95\ 5ÙqkT<½E"\98%«­ã\8es$ñ6,/=l¤ï.÷¬6ìÓ¡NëR6\1d粬´b\a\10KØ=\83jÎÄ\r¦>p\85\ 4\17\94\a\11\82\ 3C%\1cwwc\87ó\91\rùl·*£/^l\ 1wtið}E²óà`\9fIéó5\ 3\99Åõøw\84û¬GÖZ×8%Ls\98J/Ýä\89!\8fʼê[×¹H\ 3o\a}\99 @º{\ 6\11W\9däãsg]t\92äí\9bÆê`MFÀ\99^æ½\ 4^2^×,\v¯h©Ý^\9dO\9dã5\93K\1dÂÂÊAÕn±ÙGª\11OU'Ö5\1d\ 2þôÝ-!\9a¥ÃeXL\11à|Ü<¹\83p#\9eN\91\97^á£3aøWÒ\8a½îºohºÉ\19\8bw½4c\19UîL.:³\e\\13|
+8ì/\80¯\ 3º\84kŸ¹Q\ 3ÓÖ¿ü´î\84\95^wfwÍHgl\0ZCþàk\93\e\89\92M£dëe\16\8b\17÷Î\12¤\85¦×Ó0ãÔÚý\90\90\11Ög:oR\8ed\99\9bÇìâL%\aÅÍî\84J·{7èOá³ß½(¼¨à\86\1a×R\91¹4¼üÕ±r¶õL\88\bÜ\80âO\19¶OðbwÝÏu¿h(\91GT\7f,7ã&®ùWÜ\9cê9õÛ\98¼f7|Àó|\18¢gsöH\rx÷¤\8d\14o\92s}u\89%Ç      +qM÷D\83c¿\95\85ùõ\15
+-F¶\9c2+"ÅúNµġ|è'Ò+G>b\84Tî}|×Æ(Ì®\J\81\7fj\1c\ 3\v¢\e\87\9bíhè\90âШÍèøv\ ebCõÎ\ 3/vS\1eÝ\8aË\1eð2ä¾åZ\9aÓ&û\8dc¡¿+Rp!Õ\13\1ep\8c\9a;Î*Â\95ΤY¯èT\9a;^]yÀ¹\0oÅ"Y>i\85\8cH,yÆN4äCúI\ f~o@CÚt\83KuA\b\89\81þÇB3\ 5¢ºtçó\801\ 5\94\0d\17ÿ´öMn:Aeø}Ð;®ï,¥ð½\8f\99[=ñç=\87á`\97\94\11¦?î\902¯b\aVa;#\1fOC¨\eêR0·\bÅDÈ\1a\eÅ\95¸÷^\ eAöRÑE\81\ fôÓ¦C#\9bhÙKRÖ/\983\16Ø\17o¡e\1døTåéÙÎLoèËv\973\L\85\86ÕmÃöãóZ°¡\8d¾è«\94Þa\ 1îí7ZìFe\9a®<\19Ôf¨\92\97ç^Mü2Ì+\19\13\1e\1a\ 1þ·\83\83àW\rÙ\12ú±ÞöG\8bõ
+pæn"áÇ\rå Âyº\92æ\98\1f\18âN2¼\ 4Îù\8c1W1ÌÂ.\96c\bÀÓ¸7Ì4-Ê\ 2\9a\90\98\8cÞ\82ä©Û\ 3\91ºD7`{¿o\80\fî1K<qºó\87\85¾¥J½[µâ
+YÙ<Ú\16¬àë\8bÞµÞ\8aæ6ób\92\ e\87G\94\1dÕ?·\ 2ì1´=Ða±\13D\98/´H\93Ò\81Âô ´èÊÑZ,\9d\905\85ØûUb\8a\98%ÿ\eÉ,Í\ 6\9b0F%ôÔ\90\11ó}É\fuвÓêãÉa\11IÔïMF,êÆúvÂ\ 2\ 1É\8bÊ3Ø\96À\\98ì\88<?X\8e\16!\e²\aÑÇÓÑÓCQGd «A\vA\19\ 5ö¨¡÷Ú(¯GVru\86\88ÛðF¤3Ë:èk\r \96\82\bάW$½Þ\bK\97\97ü\95J=[)ÿ\1aÅdÒº·ù®^жr
\9fIîæ=\9a=Þ7Í\9e\r\ 5\95a\91ݨÎsÈÞW\99\8a\9aqþì¥\8e\0q\10¨h\f±\ 2A\9e\8e7ümºÛÜ\97\8c\9a\1dK.K\0#A\15\8cû5Ì\83\vk\8e­vÁ½TcÝÿË1ýû[9ªÂ\15EmV§yn\11Î\98q2Úí\ 1\85\veƽn+}\86\1dË\84R\8c¹V\87è\19¨è¶þ|\1c\1a\15¢³\ e\81ûÀ\84ØÏ\bO\9f\94\8f8j\16æ\90¤\rhü;Ð\ 3Dð8d÷\15õ\12e¢Ì\ e,>Þ0n\81Ðå\9aÔ\99õªñÎU{\10}
+\d.þ¤Ö>-~\15msed¶\8el\97?$\1c\18HPd\11«>³bhÕ\80ÊÆ'\15¡\91è<\97q\8e\ 1¡\rÕPt\a¤5²a~î½U\r<\97b0\98R\ô_ù\ 6ýÅ\f1xßpÆÑ)\91I\v\17q\89\e´Àý:mhþT\89
++ñÚ\1dÂC\94\93gzé\9aµy\1aÌ¡Í\14r=¿\98\92\88\9c_Q\9f\aDéFÅ\91KÁïjÅ\ 3Ó6&(«}Ñ\84®3u϶4æ\7f×O%vÞÄH/±¯®É\1f\91"£ÿ5À¥(M${RýµÔsíG#çjM»°¦\88É\v\97\9cu!µ\ 3aÂlønYϤ\84\ 5tk\9f\84\1aNb=Õ\1d\81º \83\96\80_k)®À®6\964ë+VS3ªmó°\1eRÊõK×\8do\ 2z\f*¿<F\84¦\91úg\10\1fó§\9fô²Ü=ë\ 6E\8e\87­­í»îX+\87Ì\ 4²Rü\1d \18\8dL\84\8dí\a\8c\85ÁtQ\fO\9f\93L\86ËT\ e\1fJì\îð~ñôäȵSÑå0+\1du=jv\99GÌN¾kõû´Ç`ü¦\80÷g\95\13\89Ú»íCß²ã]©¹A\1f\8eÂL5y\8cvU \b\85³\8e|\91¯í\86\86ÅúF[\90\f\e\85ð\94ȨÙß\85ô\v{9Ë°¯[ª\82ò\12\86}l\94¯mñhúí\17\10\11/\10æ\f@y'´\b&}áe=åÊ¢H<\8ah÷%\95´Gâ\19\ 2\92²\bü,\ 2è\8c\eyi]%\8e\8fù\ f\98«é3j8À9ñ\ f¥ÁO\9e3Îë\ 2Fùó-ÔgJW"ñU\ 1á\9dV¿\v19v}!Øg¤g|pF2j}úÕ»F\94AÌ ÎàT,?\ fTpf\91¾7PÙÃ\8b<Ý       \b?S:äE"è ¹\1dÖ\87wA\85Æ\19o\97\98l\15Zi®H¢ÁÞ1µ{ìãyÊA^\13\14\a¥Îå[SÏd:¹ÂGP\8c­j.SrDÈrL\18Î\8bêPéÚqJÆݶ{\11b|\14Π     »\16\93%±ö±\8f:\9e\95Z"\7f\95é\12-a\9e\81\0\95âÒO/îÌ\17½\1eçͱd\9a\0Bãì\95wØM\11c6\80&(ËÙ\8e¯jÆ\ 6ͧÈ\ 3ã\83\eD É-òíèÑ\84\9aJ\ fÝûA\94tÕC\81\9d#\fCÑ×\b\18ìèÖi³\85 Ôdì·\98¹K4h\1có\ 12¼6»H\7f ¼\13\9d\99:Ï'ak\96ïÑo\9cR\8c\99@çJAÏ\10ø!\94\9d\9fSÈ4Äk÷\ 3K\8b\e»ÈÅ^&þ\9e1f\83zIJA\963!Ú\94\ 5­²¬8W\14\90\81'\9dE©üCS+
+Êz7\91\9d°\v07>ÍJáÛÑ\13ý¢ÿ\ fuYQ\84á\ 2/®«\99\8e\ 6¦Í\98¾âÄò\0 \99ö\85-Y\95®<ü\1eho4\7f
+L&\9a\eb5[w\18§¦\1e
+3HÑ\96÷ÉÜÃO
+»M¿\ 3\1f7Î.üÓîÏÌ
+³ä\8fäS}+\9c1ôõ~\953ñÝ/¶H\93ÞGÇ5\87äÓÐ\7fF¿\eûàMt0Ñc·       ñ\9dF\ 1Âý\9eçG\ fªltÄ\87/Tq\9e\ 3>Ë¡Na=ÍýX\17t\82\12qÜ>Ó\97
+PÒV"ù³¹ñ£¶,\84Æ´Ýõû\961\99¤<óò7\eýO Îðòã^Á+ì\18´(Z\9dD\12ôY2¡S\ f³\ e÷(YR-»þ8É\ e»Í\ 5­\ 6^b¾\97¹\1d@=å}ãO\ eKq\r\1dI£c¿Åkv\r\ 1\1d\1f\9aA\81JºÁºô\1d¨ÛæÍ\17\ 5\8e¨]vÞ[\v²Qb\1dÄ\e\1dJ\89úd«m´A\87\1f\1fÜ1«Ö\91\a\8dü\eB-QØL¯\14\9d\12DN2\1f\b\11\85³ÒÐ\80ûÆ\f#¡(Õ\9d]Xöë\92v¯-\16÷Ü.ÍbÈk+\9a U¶¡T¤ë$¾0ÇÂTB\12\8c|~aª¼Faä,WXâ\8d\1e\83\99à\94Mm\87È~.\9bf}\91Ø}âc\9cÆ(¡j\84^ÀE¤.-\9f\87åy1¤åÃ]fé¯7Óݸ\957\17úѧ$Ò\vy½à1\7f ­«ÜØ\1feTÜ=âäR\1düÖ¤®(0RûUM\96W\95ØAüàK¹`\17\97¨\96||\ 2µ\ 1ÞÔmb«.\9cÚ­vó´æ=ÜY\7fÆå\80\1d\91{\103+ê\97ù\83l:*ù­+EtOÎ\ 5ö\0ò&è}ó\8f°\1f¦tÄëíؼb\1fa\82\0{\16F§ãÞ®ù\ 5\8d¿\86QWsIu\ 4ü58ºíΪ¹\90JpþTÞ$¦\90¨\r\83(\82Wk\90l79T4bÞgæ]XÑ\99\88µðè<Í\8bȳ\9bö¾ä\9an.Oq\8f\ fH[\17ï³ñ\86\8bÕ=\10~ni\97\1aÈ}ç[\1e²\12ê_î3h+% D´<ONÎBi+$é¿\1c,qhå<æ 1Zna\82R\80¨\99+3e¨Zåmò\86s»5Á=\88­=\89£,\0©k\ 3\7fõ\ f\9dæ\8br*ÙÒÌ\89ÁÅ\19üÔný\95ú¸Õ£mü-\7f\8f\8d\84þ«\90×®\81\17\9e\16ãþR£Ö\84\88i\9cÈÖÞ7\84¥u\14­Ï\14\r%QÉñ½\91\94Ï\95RêúôìÞ7Ò\9d¹\v{\8aR2Ü\95|ÄÓì)Ó/"+\ 1 °ø      \81çFIÚ\17Jl\90ÍÐ\13ä§v¡A\98õ\94\ 5\ fnVi\82µÜ\8a?và\93Q!Qù3¤I¡\b\7føñuw\rû\f      ÒÁ8À7\1cE}\12\9fÑ\1d?«EQ\80\92\89¼zK\9e5\1e\9aB$ÅfÇ\eÕ^Âë¼\83\ 3áG)\9d3ÿ}~¤:\11\91aó/\8eD9\ 5 _{\14\8aï\fDYj\10Èz/G"¦¯\19\98åj³zsùOî\1côµ\96!3`u
+Ö)¼È\98Á\eݹßÇ_Á\9dç ¬Ê\83K\87¡`6Z¹WàJ\1eo¶OÛá¢é:ëǦß^ÎÌ\91¡tnJ¹\1a碷\93\89\ 4YL\aï\9e>}\92\1f¨\83\93ÅÜôö\17g1 \ 3\8eê=Ô
+\9bý\9az\1fµ\11%¦µbuétz,ú\¬Óø­D"ác\9e\98Rµ;½98u1{½CV\13\15V\17\94\88øò]YØ8bjF'ø\vz3¾fE»&\85â¬?ÏÜ\99âÄy¸<ç\9eLÔdÚ\93ó\98ÖGÇ\a\95\85&:ÆÏø$\10ßc\83pÄr·+\1fu_Xnez72\15m\v\9b¹A\1d
+©0L·­\11ö\16 Õ¡\1c\fNW\0z.Ì\1fïxÃ8³\99C$\8b2}¤£\ eÊ`A  Ï\8cv\8d"»þË\80%Xo¤¡G"¿ÔÙf\85Qùûâ\19á&>µÏA\9fL5\9c`àY \£\10y)xtË&\9aüùdb?H}g\9aApçêÆ\ 4 ï\97Àê_?\11\19ù
+U:3£\93´i_\7fr«Þ^ýdÖÊ\98v÷µF{\10\ 2ê\1e{Z\8d\98\14\19f=\87ñç¨Y\8b§b\91\9f*7!`XõEB\86\ fö\vi\12SöyI\1c=sóãg¾ïzæp¤­ß\7f±VòÛØa\ 5ÜøeÑþ\12\1f\87ö¯öëÁá^hÅMwô\fÓ¯<¿\aì;Ú?­û§btRÕ\90\84x4\97b}\92ã\7f(&Þ \84oPûtÉKùÐ\95se³xS\ 5)£}\95u[ÎÖþ\1d\84ã/h\ eal\ eê hùÙ\1aíx­[|\1d:¨KpgC¢T\96®@8]BzJÛGÑÙï\18²½ gñ\8d5\9b\f\9dßWÒ_X׶GÊÏ\90¨\9bÇ\1c¶Ó¿ÈSç1\8f¾÷G®ô{\8c\12-\9d\ eÍ\14OlQS6½\98\84\ 6Uð×ág9²n,ÏL§\80\enLbÑ.t\9bºß\87åô\18æ±Ï»ß\9bÎèt\aR\9fÜ°Øjpùo\a\98°ç«RÄ\18\96mP\17Ú\1d§ò\85\b¬hÄÕ\18ëÚÒ\15\13É\Y\v\9e
+Rcò±¥·¥j\81$'|B\rQ0\ e\83\e\17Ô6ý{Øá°Dê\r\1fË\1eåÙBô33'¿\83\ 4}0ß\1cä#ªG&æ\847áREÕ_Þ\18O\8c£\16È@¢a[w¢e\83\8e37\ e\ eë4~¿kW׶ñ\85Â\85³äðÓÙ¢°Xú72ù´_\86\86r\fYÑkI7J\84 z¾\84\ eå\12\8co\8eúì!ɾ       Û\1f\a\15Kþôm¯`%\0Ý\93­³Ü\14ñú½¹ôt}\97éz©Û`\97Ý\96þÝ\18~æ&?`Í¥.÷Qæw\95\8f\96edLR¢^¥v\f\99\ e%\98\8a}l\8efô4UF\89\18~÷v~\9e
+\85Þ\93q;|øý3<\0\9aa\8f\14Z\87IZâ\13t@P\15l=G²Z9AÜ3fJ\89¯ÅTk7qÙ¦aÉK\8dÃw?Ôbh°\ f\85\89©Dzy\94î\96fëú¡\82ä:\7fê}2¯
+\9bм¡ei»&\ 6\1e\85ô7\836ÿpó\10¹¶EØÕ%v\81ðø\13Á Ôû\0\®Ñ±¨\vy\9f\86\ 4Év\85\98³<}\8eí;\ fu#P\96Òýf¹uhh\8aùIe\9e\19Sx-Îz·°4\9fY  \8e\83Y\ f:åJ\15Ñ\98;\ 1ø}¯US\19\8c\8eD\88&\1ft\1avÒW~;\86J,Ë;+í\8dþØpH>Þg¿Åú(7Ó\8aÚýH¿ÿ\91\16ÌúÐ\96\87\99âÁqÕßIMq¥\ 6±\18\8aq#>¿~²\15©ó\9dsW\9ct´0<Wó.\1d8\93ö^\10\9f\vMoc\9e\80\8f       cßÌÞK[í ¸ \15Ö\19'\12'Ñæ·ÀR´&u¸³^ò\1dup\8cB¬á;y\1dÕABÕdÊ\99OÖÆ\ 3Û\13     ÈÑ3+\109[Åú\94ÉZf\1e\88Ð`\13Õ[©ãx\87BÛKµ×%\r@Ý´Fª\ 5\9a\16\15ÂS÷öðÂ1KlT­±\14\87¶ºÒë\ 4\98\7f_ib~Aݧ\ 5\11+=?!\ 5w2j /ЬÚèúÁ\8dZ¡&Á)fö)/ZÑÕ\19§W\ 4ïL\9aòI\92~ªj\f\ e\1cÒ\15\94f=h\9bD\8eܽä±pù=Fu>\8b\89\1d£Êü\9cÒI\89z\ 5´\14ÝHØ\9eI[ô·\15dóA|\r4ìU
+\94²:#Í\8cl3Ú\1a:ý`û\92>\bÝ\7fRÏÀ¼»\15\7fÂ);öÛ½\95×bêNÈ\1f½¹\7fñ\10\16\1d6òCÿ#¶\12òÑÍçBte³¶³©\88\9d5ôñèREg\9eÀüÌ\96é·zêDýû[ºr\1f¸\ 6Ò;g\98\8d·P\12\9e-\8eÙOTcù\98\"\96ð\1c{nÛB\ 1e~§PÞ\9bÉ\81q\ÆGXÃ\1a\92\9b\12Ü*ò\ 4RÑx\ 2z,\82a6\1e\8adU@9\89W\90\85ù\e\8bÞ\14Ï!Þ]Ùê\8cäÄ\ 6\ 6Î\eQÃ^uC­"×;\1a÷{f\17
+\1a]\1cÃ\8f\9c\9b\84\80¯\1a£\9b¹Î9p£o\7fR§.%^ªO\bô^ÊÊ\[\93i&\0\ 2ÉÊ¢Ëux\11\ eþ!ÖÙ¹=Ã\9aO\85\9fÕ'àr²Û\93¯C\fî\8ao-0Ò\18\1aÚÄ\1f^\19"F\9aSEÝÓu¹\ 6Â{x\86¼?Ñ\84l\ 3\1föð>\7f\r0\90ä´æ÷\82Ë\ f{B\81Í    h8qf\1dÿÄÊ°1Ó\91Ê&®úòkû
\86|\82&|]ÇU~p9a_}ú\ 6£elÇ\1eK3=¶.j"\8fßÒ\ 2\85¼\12ë\9cúLɹWÄ\fÜ1ÔY\ 2k<T%\eõ&t¢²äÊ\0ÇRu騰\16\87\11G#´\83\fKI3&\1aÚ\ 6-ßNÝ#3õ®®\vuíSÉ_½Ël¢1\ eç\15\13S\89-IG¿º@ENL¾\84ø
+S\17u?ëo²æâ±ûÖB{\14Ç\16pêE\ 1J#0º\96\86\aÒV\ 6çñ¬\8f\iª\97\18ã\88\bÖ\8ai\ f×!0î¿\96\ 2\94\9b¾ñ¥?\18JÂà\9bïâ£Ò\8d^\86×\9e§\84ºNpuï?ÌÞ\95\12¨ÿ\80w]\8f¹@0w\97\1a{â|Û\9aíÙ\16z\9cQ\1eÇ}\ 35e¥Ë·£­\84wJ¨è6\86¹àøuÙ\82Q2Å/\85«\85\9b/¯¼9ëOWqToéz\9cï\1cI?\18%|\1c¤í9 ;ý¤·\97·C(fÜܸ\87Ó\81\aM¥¾\1e\92\82Õú\11W'\82×çnüÏj\18è¹\88Õ7xg¬`µ3¹\869 Þ¦öKSÞ\ 6\91\0J¼ô°\89\9c)\83æ\86èp\93\1dkѦ\ f>\95^m¸\17Vk4µ\ 6r\f\9d\ fÑJ\f,\10\ e1\97\92öÑ\90}t¸ã¸°\86ô\aîO\ f\18Û\87öN°éÊ\89V³í/öE\19Ö%\14\96;D\0!û%\81\ eäl\89|îÀô\94\83½ø\93¼¦SõÜ%\96ëyÓ\18\e¯0·\eËÚ\88\82£ç:æ3zÈ\ 2X=\1e\84\85¨\82ìI\98\8eð 2àÀ4TÀ\9a]\96gñõ4%¹\9f\7f\8f0×À4õ
+Á@\9c\9aÏ©L\8e¦P5\92ð©è4á@Xø\13ñØ~U\93$.,ön\9e¦ZÕôÓ¢Ë\8PIo\1fS8\98XÙ³»\8c××\19\94Z`­\91 Ü{÷íég\1eÀÞíþÕ\1fý\87±\1a\93hQáÖe÷Mç¨Ø@¸c 7O\f\8f\9a¦\ f\87¿\b\8eÌd1£Ïo£À!Õ`¼\1eü\14C²i÷2²\17L\ftz{\93©oN®ð\96A\ 2\19N\1fý(\1f»¿L\1dÛttvo\0-4Ü(\88\1a/(N±õÕ{©Ç\82(b_\8d2ªÌ*½»¨ä½ø¿ã£FÒV\8b§ ¼ª¶\Á÷È\1e­\ e%#\84^m\8dÈÿê½ÓÁµ)õKì\r¸\e¬^ TMó
+\115\9d4T¸b¹¸+\1c9\14%\95\88\19§\ 2îë)x~ºÜáJÍ\19ÌðK\1c¹Z²\8b\99\ó³ÙifFÿ\fÀ\9a³\1eV\1fâ'÷³Â\88*\1e\10Ô¥O\1268Ú´\18\1dþÍËýæý*é£öÈÇÚ\ 2Eq\83¦QÞ\87\ 5»¯Ë\854Éþ\7fù ÿ\7f\83ÿ'\fLlÀ Gg;[\90£52ò\7f\0Gì]é
+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%íÖ¥\99¸»C\ 2\eMÜÝÝÝ\1d6¾qwMÜÝ\9dÄÝ]7\92¸{" \89»Kbý\9dó×ß5êTÝôè»\1e\1dq\13\19ó}bÅ{\11AE¦¢Î(jîhj!åèàÆÈÊÄÊ\a\10\90ee\ 3°2± RQ\89»X\0Ý@\8e\ e\12@7\v>\0+//+@ÔÝ
+ÀÊ\ 3`cåcáâãdGD¤\ 2\88;:y»\80¬¬Ý\04â´ÿrq\ 3Dí-\@f@\a\80"ÐÍÚÂþ\9f\10\1d@ÝÑ\fdáæÍ\ 4\0\88ÚÙ\ 1Ôþu\8b+@ÍÂÕÂÅÃÂ\9c       \11\91\95\15`\ e2s\ 3\98ZX\81\1c\10\99ÿ\ 5%ë`é\bàþ/ÙÜÝé¿[\1e\16.®ÿp\ 1hþá¤\ 5üCiîè`ç\r0·°DdVrüg5\8b\7f\1f\1f¨þ3\ÊÝÎN  hÿ¯ø\7f\ fê\7fë\ 3íAvÞÿÃáhïäîfá\ 2Pt4·pqøO«¶Å\7fÁ)Z\98\83Üíÿ³+ë\ 6´\ 3\99\89:XÙY\0\18Y9\98X8þK\a¹J\81¼,ÌU@nfÖ\0\9d«Å¿u\v\aóÿ$ùgzÿæ`V\91RP\93\97¢ÿ\1foö¿º*@\90\83\9b\86·\93\ 5\80å\7fÚÿ]³þÏú\9f\80¼\0ú,L,,¬ÿ\18ÿ9ÿûÊð?V\93t0s4\a9X\ 1ÔÝ\80\ eæ@\17óÿ[øß©ÄÄ\1c½|\19Ù¹\0\8cl\9c¬\0VV\16v\07'\8bÿÿjÔt\09»[ÈJ\08YXXxØxÿ­\9a¹»¸X8¸ý{7üóÄÿ][\82þ\19\92\85\85\97\85\19bN.\ e\bÂ\98\81\98þÁä~`\99\»kæ ¤t\9c\97W\bâ\e\K\02i\89?\8d\1cÉf\1eDIƪKOÅ\888O¼ýÀüÞpª´\884*\ 2ö£Ñ+\1cwC\18\11}9Ve!\12×\9c\7fYO+- ³5ÿCÇ\93\ 3ÒGÀȲj\91íñgf^Ô\vò;\1d\7fð
\97;µ mo¡|Ïã~\ 4Úe­É\r\80\9e\87\16F]\99\9c-º/\12´xAqdLìP2[wÈ\13H¯+ø\9a\1ay\992&ß<w\rê\eñX7®\16\eKÔÉ^·Êm§JdÄ"ñ\90\83¦\96õºv\f{(ä3X÷1\98\1fÉùprÝ\88\0\8c|\11\9aF¥»ïîy\88Y²®øg°et\98ÐF¸r\8f\95C\9b\92ñH!@\ 1Å\85^\88\\11¿«\9c\9a+MÌ\9a)U·Sµ©Æ,45\12Y¬O\89ÌýÇ\80ÕAªþ\e!Ìâv¬Ptg`PµÉ\97ݧ\ 4°N\87¡@h\ 3ÏêÜC_\18\8aø\aÔ\9eÝN·è\90=ö¤&S¨ô\84UüGÑ\82û±&\14&\1f¹Y£\88§\8eGÈ6¨â¡"Î\12èb\19\8a17÷±ø\9bûR*ü\eÀ\1dæW³îì¦a \9aã\84\ 6îª(\1c[èÃ\16¥óï\ 2]Üûþ\9bJÔSEÌ\10OÖÇ\1f\ eFei÷WCýZ öGÄ6Ø\1d\1d\ 2ì\äh\19¼kûA\17\18q)\ fÉ\8d«\ f        mZ!dh¸ás/mÍ8hµmº\9f®7¢^B;ÁÍ\908uq\8c°tg\ 2\r+ô×ÒAY~¹\90>äQ\8e\92¶^â^\81\fÓKAâîl$ÞR\8b\v\1aj\98²%\vÑ\h\8a¬fItÖ±¸Çp8s\12H\v¾í  \93c9à \9aª¦\87Ôç6Ñ}ý\ݤ ¶t³Ëk()=Jª*å\18Ú\8dmY\16ÈWv}\8a3lUø+¾\ e\1awCnõÓ¸kk6\vY߯­\932
+XO%¿¡þÚ4_\18\8db\1a\*±§\0É\ 5Æáê\ 5Ì\ fªj#\198\1d¬\84ì\8a\9d\93Q³4ò"2Nê\9dòU\95ú>\80UÐ^eh|ô¾\82Ò\1a̽\98fP\7fðð\ f;\7fb,@î<Õ\9fù\11 ÄæÓ©Ui\87*5\ 4\10}$Zý:\9aëYó\v¿?EÈ;£p½¸\91­öÖÌȧ®\15Õ3 \1dÜ\99£7\86õÚ\f\17\14tP÷YlA)· ÝáǪ̃Z½eT¿\bÀÕ\168\ 4ìzß \8d\1dÚ\93\\85ék|ÛËö¹´@ö¾¿ä@"\9a\92»¢æïb\1d£½z]ß±\9e\91êxO\\bB¶ðJsE½<;\1c\ 2K\14\89\8fZÕH\e¥ÿEÕM\ 3hCÌ'°ó\1a-\9aû¯!º}L\93Ðà\9aÇ"§]çûË\ 1\99¤\ 3\ 1\88\82Õò¸Çß\15¾i6cÄP\8a«Õ?¦¯C\ 4×ÅË\1e¿!\90\90\1c\bA¼[?Ó\83Ö
+o,\7fñn\13¦0ýTÉJ,HC-uQ\e\95 E\92Ød¸\85\ e]\99··«\1fZ\1fí<|äÝßw\ fô\ 3ÿÎ\ 1Ð~\ f\9aøgÃrÙ¥Ü=\8fÆ'QèQ #\1a\97w¹7+~I_\gsZÿ+,\93¹\1f.\91um\12ËñÉØ¥*4\92ü\18î(Bh¤é\17¬RÅzDàcçí}\8b¹9\1cÉ\87ÃGÜ÷ë\eZ;CàÅA\ 6s\Bgä|Æ"
+\17UãJÅÌåUø­dΠ\8cR R\87è÷\9b\18¶®N)ÊÒ¥\87Ç\ fúúìÐZ]²i,\13\15N\92ñ\1e\99Ï\\15]ÿºî¨\14\82I\92uZ#\87Ã\b-;v%\95\ 5\ 4Á©.Ñá£Ãi\17ì©\aÉ­\88\11^\aa\98¿\a'öµI8þð\9a±\ 6e\97\83\1eË[¯;
+\1eв\14t]B\e\ 4Ö\98²\9dº6x\ 3ç\85Â\1f$ÕΡ\ 1\ f¼\ 5»ú­\8a!\aÌ5·x\1cÙ!ä
+t\85*G\ 1UÜÝØLKoàd\82Óp)=Ý\1cû!~\e\81\89ý§\8d{\8a\91\8a¨Èô\87DdI4êLÏ\92sãy"\9cälle\9d\85\ 4v=#øóhs\ô\15\85÷Ãr0\b\16\f\9f\1fÇíxgM·HÓÿ\ 3\81\90ó\17\93mî8Ë2®Ð¨\17¹µ7ØÖ^!ù\89»3\9d»\1c\9bP¢ê·;«Ãos¤\86\97¢Ô\83\94Ì-Ó\97³ä@\ 5:°Áp³y¦¤x,Oor\89°ë&I"\1d\rÇfù\ 2L\0·Ë<oÖ³êÇT\1cÄãaë\1cÏ09rL]\8cß1)x:ì\92ã¶WèåÚ\v\86^¸Q\\7f©Ûk,ò\94ܲ\98\e\fØ`ö\93I¿úr\97\1f\b.Ã[µ§§q`%Â\17½\r59E\9f>\7ffÁj\11eæß½t%\1eWA\ 1n\9f$ø<\ eÆÒ´gÎ\b\ 6\96ÇÎ
+£¡Ø\13çQ\88®\89©É\ 5\fÅÌ·Ë\8c¨0²\10\87µzÒ1Ñb\86\9d®\f\A\18$ö53±Sf\83\ 2R#5Ms\9aUèK\86\93\9c/uñrM\7fÏ\99\r\8f\7fÃ\9fU{\97Ü,Ü>ÇÿÛKY>ÍÕ;ª\959[ªÞÏ w§D\1d\9b£X¹×\1cPû<p<Å\1cÞX\82T2Ùݬ¯¹Oñ\83\14*úgÅ\b\86\95µ\11\1aÏ÷\91¯\17\8dÅ\91UNÙôÏ'nIâ\8f|}ÂÍ-0U'\98\b"í+q\aÔ¿Û.Cuå«\16 U7'IÕ~Ý@ªÔÿtéÖ¼`\ e¬({w\13±ñص$ýE-¸{­ÙÜî6\b5;·½ä\1f\ 2²\94mã(\9b"|ÕËâÓ̺_ò\11\1f\85¥ä6fÙ7ô\19^þ*L".úÚM(åî­\83\83ÒÄx2\8dê\91£\9cû\864æ&Sd¨\v×w=¿ü·¶K¶­;þW\84&åëûÇ\8f]\97\vûé;\ 5'\925_^\11ðvU»¶ïa´ÿE³PHªÏ±5ö®å\ 2DµXjG\8cýÎ\80vDú\1f¾\8b\1a5Ï/\97   I|}%3ÃmM5MFãp¤uN\86¤k°>ÐÑ\9eþ-\ 4\8d½UJ\8e\9e\89=ËÊ\0«oùß%×æsb\13\84·R×\ 2\ fek*ÒÝ\8f^\12û:$\ 3½T°á\93³>Ç(ÞÝPøvHqB\19Ì\8d\95\ 5«\9d\97'^©w
+\90\96G\1c\89\84Ïðw~'xª_ë¡Þvee)ZTXSâVM\v
+¬§Ù\8a\1d\9a\9c\98\ 4\15&Cjýɶ\ 5\94U\90ÁÖl\eÁ\94Á\9a\9b²ä\12\ 4¡¯gÙk¢\1dÒHÓ\9e\9e\9b#1
+\f!öo¦Ì}¨ér^\99°´\94\7fìÁ©Ã\9fV*iO9\84ù\88ò5ØÇëßú8!°º\ 5j\bº\1cÅò\92\8cx\84\v[O\84â
+Úü´ÃÆ1íx\8cÎ\0Q\9b\9eáeìý\1eÌ\bæZ{\96\ 3#PV¡Vè\84ü\95\8aÊ\!M^\97\9e\12&U\9cþ©I\1f«g\0\95²\12s¥$\9eë\84#\87\9f;\11\8a\84&\95m\80³Ü¬ \8c7?z8¬þêK\93ã\7f8 QΦ1ÞIoTÄ\DáC§á\81wCòµB\16\16\9e\95Z1{©×
+çà^Á\v$à©\95p\8a
+?2Ñ_\ eÍ(\12°»\85M\13  W@ÍØ£ëDðËÀNO®»®ÞÝ\8aå{ÑèQ\19Jy\1d\86­<\85¹á\1c\99­%èPÔæài\rC\99\ríp\\ 3\1a\8bv^\ 2\8a\rrxÜ8ÝS*Gîn=!5«\12v9
+D\e\17¬(!ì\89 neZäU\1cüÚ\10´ÿ\92Ó\81\8bd3\99£\a¼ìM\94Sv²\92ê/i«\8a\fýË[o\95ø\98&ÍOÙ/d+i0Í\9dÝ\a+@«û£øÔ.âÛÎW\81KùÒ\1c\81\bù\98\81E\80z­40jê\84x\12.(%\83~3\ 4þ}È\94õ\92S±J\ 4\ 3\91gv  ¬4L*Û5D~ÿ³;Ad©\9e\9fítÓ'\8f\89z>i\905)³óQK ±Yæ\ 6úk´\92©çF×UÄ\977[\94\b\91\17ò\85C\87\91oàÛ»\95÷\r\bã\9dt\85ï&FÔyõ\\82M´ï£ì¼\93%\13ÃbnMs\9f³\13\13PKX13ÕÅ÷WU¿úÎ%P¤,ô¾ \95t\18äî«<Ý\0n\17\aÒ0c{ëlt\15<?¹wJ'Ù:Næúï[\7f\86¿\ 6%»¡J7)b{°FU\9a\aàÉ\92i\84  éþú>H\92\1dMV\1c\9f­Ù\8a¶¨bü\8d\98I.rbB:}\fEÌ<§
+Þe}(+-fÝÉÎܯ\ 5O6\1f®¤ë\ fGëøÁlN@Üú\91À\1d\1d\ fT<á«\12\94b0\ 4\87 $\ 1\96k4EJ\1dÃ`\9aî÷\ 1¬5#뤬æ>è\ 6\12V:¨\17+\9d³¥\85ðY\8a¿]-æM\9bp\ 5\ 3IÁÊ3Ý\1a­j1\9cDB\82     \93ug\7fw¹ø\ròlo\96(ÒBß³Vô×Á\8bWCZ\98NM.½W\93\13j\91\18\1ed\15       \9a8\9b®éù
+L\9f}b/ßWû¦¯`Ç1\ fïSÃFøa¶\9b¾¸Ã(ý¢\99¥9*\8d\ f»¿QÕÎ\83Î\ 3WÚ}\15NV7í\v;´°û %\91¤s@X©\9bÈ,ÖKYð\ 2\9b2\ 3Ú\\86\ 3}´HêÂ\93/QW\eåGq¿>Å\11ÍBÈüÕoA3\8fÑ$\12I\18ÏkôHe>mÂãýâ;\93Þzí\98P\97Í#ø1ÁlXC|¬<\8a\14E\12NOêé\99H8|÷\9d\8d\83¬mFÁ\9dyÓ^¨jxH\88ç~?\83\ 2\ fÆ*3b®¾R\11\8dÀ\v5Ç\®ÈD\91\8b\vÆç\9dKÑøgõ\816kdçÈ(BMøfU\80àæà-²B÷Ârë\8c\1d²5Q=eV'ö«3Z»   Qj\8c\17\19C\96²\91\ 2\96â\10
+ù¨ Y\8f^ÔiE[ùVX\9b\83Öòxq$7"Á²üë9>«\7f\80yè$ÚeÎϸ q}»Èa\rB÷o\92\1a¿\8e\13,!ñ+{\v8Z×ð×»l9»m\1e\99äܬ7\12
+(ö\17ÎÁ\1a¬A\vÎé\81ÖäÜýݵ©¬OÌâné̼%\99ý·}L7\e®V\1eý¥úFÁ
+c~¨ñö>\96\7fÂ2Øä\90=ú"\97µ§\86\99g`Ìî^\90\ 1Û\1eK¢Óä\8d\16þC³/BoÝ[ú\1e\ 5\ 4®Êé\9a%\8e\13¯¾¼oï\v­å:ß\14pCh\9bÑd\176~&òB\17º~ú4Â\91)T©²¹ÿÉiú¶=­y\91ÙEö\1e§!û\83@\15PÇSç\0Ûlf\93n-#QA \13x\8bXÿ    ,c\850¾Ûû\f¨Ä_<
+ÕÔ\11NjRo´\ 1 ¬Iæ=ÐÐòúâmðÂ\97ùܵ\ 5Obêl½ba\89²\ 3´hï\19\97\95læ¬üÜ\81\18ÄNA\ 4­G\1d\1a0\92|\83
+9T\a\15Ä\19çþʾÓ\93Õ¹\7fY¿\90y$Rèþ©\9dú¡\97±\94\1csë®ñ    \a)ÇÆÿ4¡ð¡Î\15\15f]6Ë%\8eƼ¥\9e\ 4\9a@í½½\1d +Äf«;\v\12¸g\aM~²f\9dð¬òP\89\vø*rqX!^\]¯UÄúN$¹A\89Ï\99\ 6ú\1d\af·IÔ6ß,=6ªï4/\88ÂÌãð±\a\15Î
+ß¾r2\8e\90Í\1d7\17ûé\91£â\8f\0¯¹[ó\19\94\88jSö«})\8d©þê9v¬»\93É\8dB7\9dË­±\IM^\9e¯ãÔâo XQ\16\18¦É¯¦¶\99D\9c6\ 4:Q\ 5\1fý¬¦\82\ 2]\8fÝ\9b<½xZC±;\þ\ 1\rD\91`\1fÁ\vÍy
+#X\9e½ü]oÓ\89¹÷\7f\14\1d\14£\89\1c\10Ï-ÕØf"Áõ\9d\8dÿY~s:9kÏ\v\16ål7\1aO@µÔxû\96K°A%\16gN\r=eX&ëM\81\ 4]W©\9a.\10\1f:¬fÁ\95Ñå\b¯u ¦fæ\17¦\91ÎñÝ\b\9d\1eÃ?'Ã:}\14i\r\15"CòYôZ4%*\ 6ü:Ë\8eSÑ \ 5I\9cæ±åÅ¿<|ºGâ×r¿eU'U\9e?\e=»á£?Ñî\8cðzâ\82¿ì%øüÕYþ\8c\8b\ fFã5[\9dñMÊJ\92ºH\8a\ 3å.kz5\9bföj\91\1cç³·pÏLü×MN¹¡*éÖ\81¾:\85Î+\ 5Tm¾ÁîßȤÐ)£\fѺL#í\80i!~¿<ß\f_¼º¾\11\10QµÍïÆ:\97Ã\93sËL4ÿàý"8¶{\9f\95\9c\83²5æ:C\9cêm\1dNfÑ=¢â\ 2\81\fèÕ\8d\19ì\ 2
+8E\8eDOª,\ 1\8bÉ.j\ e1»+Æ\1az\96;\0±X4Þ`«Ø³¯\18\8dÖÕ°ñA\bvhÔ}L%¢ÂÓQ\94X\16°  \92ÈÍ\ 4¢aµ,e\ 1\9fì©Ô"¿ªcJo\0\86±c5p¡f    á\11Ýv\82²ÿM~8\ 6\9c\19>Rë\14¦Ôl¨Â\9b\14¸\rC²ÄTú\9d{\ 4ÙNÙ&ðãRRæíS<ë\9aêe }Ì·yÊ+6§ê-Ò¸sY\v»á\ f£p\94Vfd&\86Ur#öá)\a\9f;·¾ºD\8f½\9c(úÙU»»&\1e3F:èÛdg.EO©cç§\1a^\e+'\ 3 Ô48\bnÕ[ؼѥ\ 2\99½\1d\9c\7fy6i¨¨Æ½\ 3\9a¾\fnv¾ÿº¶ \911Ið\8dûïó$°À\eö×=?O%=
+\8c\92ÎÚx\9cÐg\a\90)\ 3\96\1a\10\1d/\0ê%6_"á-\1e¹tYcó8E\93å\ 5Z\ 4«ïµ¥äb\9c?Ëã\98Ô\97Ä@i\87òçÍ}ÁMúp\a´=åµ@V\1ag/îLó;í\98\81\7f\1a\88|9Æg);»Áõßýóͦ­Ã]0N'\rÊÔ\8e5\9b\bd\8b^Wk\8b]Á·Q³l«F¨R\vQзP÷gÕ\8d>\8cùáóïåü(\89^ÒÕGý¬\8fÐîMÔyèAG[M[\13^\884\99þÌçv\19\17Ñ®^\131¬NÍxR\1c}\11ä\\19\96,ç¤\rCæÀX+Ú`ö#\7fùõ¨¬ÈÚVhuÃ<7ëÑ\9cæF?3»Õ\9c\98õº\81\98Ü\rg²VØëg\90\0ù\8f\86MX~E*ÆË\89^\9cfÄT\bUÖ XÐ\ f\82´H\a\97ãy\9ag}n\15\7f0ù,Ç\e\92_3\ e\8b7\ 6å@\7fî¬\ fÌ\13Î\11ýÊÂ,°\89\87áÀw\1e/-"\13"\12ßP·³\12\ 5ÛN׬(qQÆ\98.\10æ8ÓVE¹ù>´\a@\1c&µ2\\ f\8f};\Ë\ 3QI¬¿I\95]\r÷q·xá·W0§'ÉÜTDJ\1fÎ¥è%\ 2Q\1cw\9fÓä\91\9dgÝÆT5ʸ\8b\97^d!G¨|SÓ\81ðØî°X\1a¿åe\1e$eí\8a\b+iùýû§+\ f_&{h¢%7\1dRï·©\1f¿â¾¾­­¼\1az8Êp\10¯OY\96í*P±V\9dê\16\0ú¼~Ià\8d¶Å\8d\13\8fs  
\ e\8d\13H\8b\1aÃF¿-\eêÒE2¦'rz¦s̼\96\10ÜF\1d~ô~[\99\8eQ]\8bXÊq\14\9c\7f\170kq}\8c?\ 5 [\9a8\16)
+ÎûÔ!d3µ\1e\v\93Øwà\91ß\8d@PÑ@¦\92h®þ\ 1\1a V\80²\a(\1d¶ó/ÇZ?}\v\\r\96\a¢\1dD&\ 6\ fWVkî\9b\87í\89\13\92\ÅÁ2\ 4áz\92»j¾\8c3ÇfØ
+\91à\86ñï\8e\9fÖH,gbDx\1a³{àfql¾\8a÷è¾f\87FT \aÐÚºò`Ã2MX0^Fo%z¹\88°øä ï\9e\ 6ªü\94Mv\18\eCÊè:I/ÜGY\9aï,^0rk)n\15Û\84\13\1a\82ʧk|èæÎûb\85\8fß]XáK¼¬Ã\1fà\ 6lw\9cÌÈÞÕ]såHÙ§´\9fL\8c"Oy\96íÐU¤k¢\14ßQ4D\1c\8ch·#>\99\86\v\ 2ÌÚ`U\8aZJx\8f\8dkQ\87\88ÝѽÕ'i°®hÔÚ#\ 2\ 6W쿾°\87&k\14ÓsE2á.EÅÓ<\8cs¸Î¨\96\10­+ì\ e\92K?QÍpÆ
\7f\8a\8f^4iû÷\94M\93U'ÜOÅ-Ø\14(þøH>îìV8\1a ó¯\8d\90k`f\1fþ\b\9cøFS/ÂßhÂÔ¦Ob\82\1f¼\93«ÊBæÚ:ú1BC\19ULáµÐ»\8c¥£\98fÿwÞ}+H\96ÿN¡Ë%$ÀÌ\8bèg\86\1f´¬\80\80@\19¹\9d¡zTL!K ^\17\8b½\8bû\b\bݨ­\9aç\8aXb\91\1fgs\9a\94p­$\88Ôd¢WØ
+\1eü(\féù="\ 1\13ó\11v¸±\80»\ 2¦A\88ç\91ü5C®¤IÙÔþ"Mv©\93ø'ß¹\11)tk\0\16\90\99\8bwgÛ%\89uA¯\17m[¦\9a¦\ 6\17ÜH®²gHåxX\ 3e\9d\a98ɪ7\9anûe\8f<n\14\8aJ\ 6        \ 6¤ÊM>ýê\b\19ê\9cO&\92\8ea`\90½Êð«ß1ýQ\84Î\ 55Mñz± \a\95É\7f¨ÂR\85Q\85ß=
+\11EG]gË\8eo!Öè"\12éÈømyw\94C-y[\85\94\ 4¢äa\f$§a\10È®­1\1df\95ta\89\19Ð\ 5ÄGÅ\9dÃ$\81Áí'%ÀDåû^!Í}Ê\8bÜ\17\1eTH\15yv\8fµ\15P:}gqX^þ£\axæÐJà\1dþÜ|LËÄ¡!°Y\1c\ eû\9aÈ\87!=ͤìSn^Ö× ¹Ù\0\9fkÓ ¯ÑÖNû+Ùaì\9ch¥Þ2­ ¦çÁå-Îþ\82¬þ-\9a\ f\9bd¤{êv²nÿ$ª\fÖµm\8d:*l¢åÌ`ãÂ\99Ѷ:·\93\ 3(%ä\1fïìe\ 6\16¨ÙR?(²ç\9aÃï\r\8cwR\13ÒÀ¾o9_º0=ìÖ×  D\ 5Ü©\8d*\1d6cwïÊ#Ò\18(o^ÖÀ\88   \19h59]\93£\1f¦¾Ô lC+ð\84\94?:Vä\ 4\9bö¦¼P\16Á?\94ÏQ#Ò\a\1cùõÐE¼\1c®Ê\9b\1e°\8bùí\8c\9b´\89ÉCø\vn\8b\9bûaé\87Õ@\1dW5¾íÍɺ\9d¿l.Q+z¦\8fáD&­-Ò\93.
+N\91¬)\92´·â\14´\1c\9b®F,­\11TiÅdoª|\ 4Tz®8\9bÍàÑ\11M\15ÑúWô¾×\17}\83æ@\191(\vwØ|Î\83\bþ³ë\94Æ\12ÊöwLî¤\1a\15\96»\9d¹\8a²}g3\81Ò\9cÁ\1efEî\17\9bÌÔ\8f3\14\9c\15\eK\99á¶j¡Î8 I\90\8eÿµ¶zRN+üaVØV¥{\80Õ\93ë±þË×\aý\8f\0ævïxw\ fC\1e\15V¤d¡\9bz\93ÌÏøÏzÌ\8b\8d\82¨tA¡\85ÌyS1k6Í\15°£æ;DX\eö>£ã±õ\16\r\95Qѵ\ 3?c\1d7ZED\b\7f"\98 ø@\14^ãdð.Ù\bÜ\9bR)þrà9\9b׺-*È\v\13K\ 3=^Ó¡3\83\9dÀ\1aòMnÁY\1fÍ*Ia`\15Â{\ 55£LÔ_;Ö\94ݽ\vá\9aFïÆ\1f\9fvÓu\80ÿyAPu\96ÊÍLÝ\90ÕÐ\93\ fz$J@º=`\ f\92\84\8dWo\8cX\a
+\eí\87\91sþo«U\9f®\9f9\9d\ 2+\88\17QlÍ*Î!u\ 1\9b>\9e\85àjù\8f9\10å!)\8eáÖÂY(¿\9díÕ,Tm\8e¾)î×3¥V\8eÛ=?v³\ f\1eGC3$ eU\94\91Ø´KUÀ«\9a3<,-ôïÚr·Ê\16UIA[V\7f]èëb¢\97/C£\1d
\95öÊD/\9eÜÌÜ\r\17\7fÃ\9eû¡Mpót?!º`8í2×
+}åè\82,él\16\99+
+\85è46Ø´»\ f\ 2_=IJV\84\8f\7f¡\92\1câ;{3}\rôtÁµ¢wwgG]ha¨GD"6kôr:·ÖÖe\141\1e¸Èz©Ö¿¢pJÔ\152\14)]6\8a\98*Ì5¤\96\7f\8d\88ÕáËJAç´¾-\16^W\9e\0\95a@f\87@\ et®©><@s\96¥¸êVËtjû\84â÷\8aØYlæÃÅ@'Ë\8d\f»\9dàædÓB-Ap¿\88\84^ÚIUÆ\1f»k½ôCÁé\rs\f´«ÇMøoUN2@ê+³ÁaiG\19ï\89\17=ï/Õ\a­¢+à\92M:)*¬\84~\87.®èV\v¼\8eÒ?Ò\1d\17;\1eß½\94p\bôi\8cÂ\fBÏÉì¯| ½L=Â\80\9f®\17øÛtä[ä;\15ª#\9ePóIÝRn\86ø ñ2§7\97Ý{´¸\9dx\19\82vâðpj\16j}6fä×ÂÇÅ¿@\ 1\99¥\97hú3-\bN¯ÛZX¬É\85M0k\e¹¼¨\\14mL\14BBáJ3c«\ eÜK\91\19\17\83Z\99\8d\ec»Ûe\86E\14Àò\1e÷ \86áÙ\8cºÖtÑB\83\8c\aiû|\11Þ\90\a\97Ëu¹¼oô\1a£§\r69\14p\1d\84C&9áRPÏ\ 5 ]\16B¨;Á\97è¹UJéF%à¼\ 5³\e\97Ê»Q\87H¢Ç\ 1qD\1d.>\99Fc¥\93ðv\8c\19\ 5¿|DBÛt\93A7#=¤%\88;¡ã\85\95¨[Ò±\ 2\19|Éå\7fÌáÝ\13hAFÃ\118oòç¯ô\b:Yô§ÆËnD\9cª.\9cdsÏ\18`    Ûá\8bG\8bÇ\8b¬*çfúDB\15ký8ÜB×;Ïhɼ\82²Ýl¥8\80öNPçØ®3<¹XÓâwÊÿ
\95\12ÌÆ£îïÀ´Y\86¼z\1e<ØS\99\91Æ3\95H\9eÍ\1f}\ f÷«.¢/\ f\99{m¢\95J.ºP»9y]øºÑ\88Ù«î+\9e\8e¬;bÍù\fä\e\9et½ٴÙMñy\94ó¢Ìj\ 1í;¨Ã\85Kìz|îû\1a\1e-\rÃf\7fõ\97\16\144\98W]Þaò6È]F\9cÒ\1e\ 6ÞÒ}ãÑ\88\15Ø\9a\8esdÉûg~¥Ö{\ 5\897\ fXÅ©g_\e\85\93\94ù\17M:J\ 4k{ö?OÁ\ 1\92\8b8\a§`f¹Fg,\11¡ò\98Ñ\86O!~ì\9aN\16gÄe­\eÛxÚF`41¤Ïx\90\1c2XG/3J\8a<éf¤Ø/e°ÚM\88ÜÎt\rU¯÷ûW'éâ\vÌO3BÍ5³\99àÇÚ¤\ 3åÆ\19\bj1·'\86ÝúàF\9c\11Êɦ|\981Ô8©?,úy´IìS\14\f\89{=j¸\13 8ªÐÚ\1c\ 1M\81\89¯u\91`îèåð°\1fÅ}¥\16UâpÙK\95\0\b$ø,qu$\11¤oEå$>Ù\ 2®\17ýÔ5­5Ñôµn\ 1'\96\a\98?bvéK\9f\ 3¹¥qh\96\963\84\9eÇ/m\ 6¬\85\8fzãÉ>뤠       H£¯lÑÌ\87hTF÷«\ 2Ü[` My­ò9Çò³\ 4é/\96¼\bB3\14\85h\9e¸\15\93]\a|\fæ\7f\8cdív÷\86ÇÁøýl¥\ 1d\969$Kþ*þC\86®Ö0c=ó\1c;YÜ$á\13tU(\\9e\bÉ9ȬÂ\14\9e\96È\82\ e\15ä®D¬\7f\80\10\eà¼TKx\9f#ká>ÅyCáR¨:'Úz[¬\ 4ÀÉd¾\983êSMM\97"9$ø®ú©½NkYh\1eOôùì®y\ 3þbd\9a\12£¥Ü\93åÍë\99oÚã\86|\84[%\8b~Xº3íÙ'Y\84x58RZrkvñ ÃÅ*Ö\96\82ñܹm&¾\9cï\8b\9e! kë@åc\vï\9eBQ´\8e\1d±D\1c\1e\92ý\90k|ã\vµ\1aÄ\86\97z\81¿R¤8\9dø;$\93×äAG;^â\0¥æf£³Vî\ 5M\ 2N\1c\9e¨tR=QÒ\96·P\1a!*Çù\a\ 5\94´YÙ\98³n®5/\ 3-\90ý\ 4Â\8dY\12\1d\992²ðN\8f¡f'±o]'¯`Ót+yòêi½÷ýl\11Ú|Ä\900AA[ÙÇWÅ¡oïöR½ ¶7ÿdwVêÆí§|.\9a\8d\ 5û·vÄj7ãDA¸\9a    t\93\86\91øà\ e\r\90\89>¡Ç\91ß~ã\ 1ÓÊú\9f\99ï,ª;¥Ô\ eK]ÞV¼¿í\1aÈ+^DFVô+Î$¢m\93­Ñ\91û˪ïL"\1d\9d\e\87Ô£(V\17¾w;éW#ðÕÙªQÈð@f;ÆL\90ëûâõ0b¾-Xfs[úà\8f\10©\13³æ\85       ±\9c\ 3Í]ç\9bß/é\90°4\95\7fd9ÆL¶\93îÞÅ?\1cÐ}<\8e\ f\ 5M\ 4ë\83(\10ýÖÚGd\ 4P"%8÷i]GU\ fLÊ¡d\1ak\9dv\9e\95ù?\ 4b¶Ã\81\ 3¥9£\89®n\93\8eóÊ\ 6-\83*¾Ç\18q`\83\96m\a\r\91\8e'ÑäyJ4%jÚD\17çÓ¼\86ñø\14\9dÕÖ$Ø\v\1föï|\15X¸¹I\91ýÙs7¦Ï+úç\9cÀtf£æ\19c·XÑ® \83r\ 4\a/\8a±\95ß\v¦°\8e¡T^\12\92\90\7f\8e\80f\0Ö°Ó²¥Õ\14=0Ã$¶\99\8a®3ÿV\eì.\15°¦\85\ fké$Ët¶ºåk±\85\85\¿
+G[v\15;²ÑYK©ËÎ\ 6`±d\8cÉ\bg\87\97{5q£H­WÌ\99\1dþOLD)óYØ\ 2û¶\14\eΠ¿¼ñsgJy¦ÿóæH Aä¶oG¥\86\ e- ®(\15q¨#\1f6ÈáÛtX_Þd ¢öÂlÞ{ìtUx6~\ 3Xj=Ås{V\99¥ÈµFV·<û¯\7f±ª_^­    _ÕV7(Çu2E\aäG\95\9d¤Ùd(R\18Ö.®º\9fÀþH"åÕB!(±Â¥å£\89\9f(1ñ\aÿ[ëçM}\1dÏû\83\17¦\95Æ\9b5}ýP\ 3ð[z\b|ww\94Èù~e\ 5Õ\1e¾Ïͩؽi\9e¯¢#\18`Êu]×\95ÝÅ·\86Bÿ\11é\1a&â>&ÖÖ¤\1cEJCûw±qî\14O\12\97\8bK<åV;G\r\9dL1Ѻ$º¾ú\8c«ËÜ<\rÓD>\bO©JMXÝê¶{'繯¯²H\ 5:/­\v\83õêPj·ÃV\1fsäð\16Üè3_\8ds$â\9a\11°\14±\8a \9d\83£éê(¯I$ð)aÂåÈ\9c\84c\1fÀ¼\ 1Ë\ 2\8bÒi\81\10nt\8eãª\7fê+²½\18HjN\1c\8b"{H\9bz1nOz \1aÒô\1cã\1f\8b\9cäô\19×\8aÎ\1e$\1cX\8cæ\98\98±pý{¼N\1a7<I¤¯@æ\15\16ì(YÝõýg>·ß8\1d2\8c\e\82ÌX\9c­\1eÝAFùw¥°ÕH  ò¦\9e-¹ \88\12(\97×fº\9bÝGÒyí¥\9cJ\ 6å        \1d
+J>\ e\87Æ?ù\v\9eø³0\88Ëj\8f\1eÙ®U\84\8a\ 4ãø9\88§\vÝÐÚù\81Ëú\b\8dol1yÖ\84\8f\11\9b½\17æ\8bWkµöµÞËà%z?F¤N¤¸>®m\17ä¶_éÖ\87\1dªö{A¤.\8f§m¯\99tÐeçÜ_4]\94B_\19»Qêù\83\7f\8d\b\88»`\8c\88=O²¢>\13Æ}\e·0Q\17B\98Û_/\97?ÿjÍ®±\83©=\9aÊÂØ\9a ÁòPÙF\8f\94yx\12)\b^Zï@\ e\ 5Í´\ 5,æô\91,!>¤ÿL\86Ä!òcw]þ\98\95[G®z\8a7úfUçï\1eªRX\7åÜBÛ}\8b\ 1EgÔg·ï\82w\8bò±ýÌ;\8f~#\8f\82ÍÆÒð{Ð\8fï\87\85Q\89;6=ôá\97\9d\99yé-µò®ît\v£É      ¥\9f®²\97°\94rûÞ\19t´þ\ 5\17SkD\94¡¬\871\7fÿùýÇÈ'(E\9c¸×>¢\99kq\82Jo×Ñ\98\9dÐ\9fëÈ÷\95\86m\8aQï«Õ\84\10\8f\91R);Sæ\8dq\91|­ì-8\ 2<\99\12\8d\9b@q\1f\13pO.ÃçY=\bõ9y\17oªû\92ð¨[¶åQ¼\1dºÁm°\99¯Ò=Èâ×û3\92\99B\85\91"ã¥^^¥Z\93ð\13&ö» ÜñN\97\81q\96Ç®N\1cn%Y¿^~\ 6\81â\96ÆV \0\90\1aë\ e\ f7ù}ÌXxÝñ\8a»    ^̤\926\13/çüý \ f\1a\ 1Æ\ eü§\0/\bÆ-úE¾q©Iq³0\9c\19åÌj\87/\9bª¹hQTT7z\94\9b\88\9d\99¹êéQ\19\9a\12jªÇ¸\87*%\f\13\ä*&\8eX\a`úÕLÚ\94?\ e\8d\ 2Àv    T\11{E\1c<ÿ¨áÇ2\85\88¥Ü\10Å2Ð\84Q\0\14@\9d\90q,è\9ec\9a¯½Þ\87\9bG\8c±\eãoZn®\11Á)4r\85u\8fb\96ìn+l¥í\ f®óÉ\f\ fð`pñÖ\11a\8c\1eíÄ:øù\94ó\90\16Þ¼0\91èý\16\17ªø\9a\f\ e\9a»ä\12-B©õ7T\85(ÒÃÜ×w¼\81\05ab\152¤F¯²8\7f®À8·8}ñ\94C0\93ع>\93¸®R@%îT\1a\9dÿ6/tUËr\1f¿0ßÒø\88\8c¨?Úñ\88ûßKe¸RÖ\94      Ý¹ÑY\81\ 5Ì0¤¾~1\88\b\7fhn\86ñòv§ÍòuûÁC»L\ f¨Cï¦S\ eÝ\13\ fÂñ\9e\11ç G
+Øêý\9bôv\9c'\9e\97£\99/ðÎ"ù³S1ï#\91ûM~\99ß(\99\8fó"\8bq¤·ï;`6\19 \\8a3\16\8cuÈüÎUW\83\86V(ɤ\12¾6\fmød7u)\8a¥¸\96¨ZâaÉvI\7fxÌoI¥ô\99÷~\b\f2å]Ëì|.ñr­¼º+\ eBS®Qw\9b\ 1ª\10Ú\1e\80{¶Û\82&:\f\16'\ fµ\vòYÄé\96è²|öÅë\89³Ý¬}\ 68|*Ì\85É\82\9eª¨ún\ 2#ü e|Ô"\99°E\97Q\12!\9b¯\e\88\1a*Z'»\eüÆMé0°\1f\+\12]; à\9c_ibtèÉ\13ò<Í\1d\95'O?Ýe[`\9aÐÖVÐ/jÙe\94.\9aÒÌ\84,\e|`\8d$"ñgD'\14äоm-\9eWÀpÒ·^\88\16ý\f
+\92Æì3\81\81
+\84KL\1c \ 5K\8f\9dL~&\v\1eo\7faK3®\12Òböø3fxtÂÞ\14;Ä% \ 1{ ®\7fõÄ \80OjÝ7`ÙÔ\9ebèJ»\92ã°H0]»´SJ\83õÅ\12$W7sÿ®t\vë\96\r\9c>ðèmBîSðb"\13~ðy*û¤±ö~\93©þrëöþòe\19ù\80TaÏØ-ññ\91Ô\r\16Ø\13\81­\0÷ùæmÐQexo^îë\83pãdmàTø˶øF\14#\1c'\97\12(³1\94Vzã#è4<\87\1dRcLl\12~w\8a\98÷È\e\97Â\93\19vEýÈYÐ59½\ e\89é\90\87¨\95Ö\8dEÛa\9f\9e\9dG·a\93©_Lé\8e\ 4\9f\89æD\ 1í=áÙò3D)©\1c:\94?FH\82&\91\82Ó½ªÛ`ùO\\82º~W\95!ÙzÓqÕ'\r\ 4\ f°D²µ±À»\94ißnë«Ù\91\8cÒx\bÝ\98©\vÿ¹\bÇí®ð\98 6\14y\19Ϭ¤$ò\8cÍ\ 1½Ôj9Ìv\vL¶n\1eü\ÁTº%Ói\92wÝÂ7ìÙÛ\84R¥Sç¿3P(¢½X\ 5þ¼\ 6\84®sÑaí{h@!       \f2feÙ\82"ô`)¯M    3\97îl?X\19g\ f\11\ fÑý\84¥\8b\9c\92^\82H&ºìÒ%Zd¸\90\83ª_,      ¡\ 66
+\C¥ûMªíY?é#é5Ïä\8f\r
+\8a\11\95<1z\ 4κUË\85a¦R¡\8d¬dc\87MQ\94\ 1\ 3\1f4ZÀÃ/óôg)½\8c©ÈÇ1¶\98a@\82?\8bHG@ÿÔ¿JsJ7?\80cXù±Ã¿»LÉM\ fwB±³?÷\aV\88\ 1t~\80\9e4öR/\8e¥Åäâò7ÆÃÊÚG o¯\81S=   ¬\8b­\ 1>Æ&\9e\9aÆ\99\98¤ÚÚ¶1{úD0yÔNã 9®ü\es\886\ eFÀgú%M\ 2(4\14CFaTù¾S\8d\88\ 1 Bª\96\0î<\r½¡,+\10có®­)z½çÿQW¿9õ%ôÏ  ¤Çêâ-)ó\84\80IåK_\9c\9eåÇ3\97Pã¶\8b\88±Ú§ÇéhÕ2²ZÃÆ\fêó0Ý}\9c\r\1d\91\1e¥¥»Ð±£\ 2§-!Pðy ·^ÆÎýÝ|uä·ä¢Í\16÷Ú£õ\9a\ f|QFj\12\87rk\10'MIÇ\1cÏt(\92
+6\19\14ag·ª\18\9d,gÉ\9bôïG\926Þ2¾ÓÕÞÈ\98Ê.\9f)óþ_O]\8bDÈNØ­ï0É\93EyìDq°\ 6æ\88\18Ì\az\1f63\ 6\94Ê]d6\85(\1d\12äÔ\89\82\v4Up"ü\1a\97\b\1a§\8b\89xÓC\b\9c:oW'Ü\ 5Ä.l}\8c\b\ 5\ e\16L_îb
+\15K\1aíÑTçÕ\9esö]\98@ë·ú\1cy\eý\84Tó½J\94\81â\18`8Á\fj8Õ4¸ß2kCÄÑ\1d¿Ê¼Î0ìL\ 4P´li\9cwÈm!aï\85\1aÏ\ 6\89\ 6qÜÝ¿Ü$7\897j=&¼\11ä\85¢ÑÁC+¾4¤T9gyÁt  ô t\8c°öÒÉÒ\9aóx\16\90²\ 6`¸­w\96\8cÑ9\91\94ÿJ\r3Yø\92N7\127ñ³Ç(%«d\9c¦¤¿E°¶°Ì¨Øý©Ä=\9a\8d f\95.·.wl\14Ñ\8b-\10S¿×\19·sËËNÊ¡¿íÇv\87\90c\äÛõ\15Ôû\9b9\93\91JÑ÷Ã%\ 4\88\17&\rökuò<\86ÏÎîú$lQúï±Iñ\e\ f\17\98[\e\17ó>m\83W·ª5\1a\e)\a\8eèÛj2\15q7ÉWð¢\1dÃ\81§øaÝ\84\83\f\v\9dkRañÆ9vvsÅd*ÜcÔ&oßk8UêØô\10¥f\14\90F\1ei\ 6\e\9dp\ e\93s\12\85±\14ÓL\r4\9dÝ@B\97\83âÎäL\90É\89ëV\1d\8a¹Ò-¡#äM¾\85\U[ËMVÉ\17¥\94¬\ 1õ* Ê¼\ 13ã³(*?GÚ¥Ña?ÇÝe6ª½\1eð\ 5;\94Í\81\ 6Îp\9a\v\83ú\0\9f\9e\90½¨´ÕÂáW¨Ïcõ¬¼«¨\87­Ùß  >\83\1cà<\1a§Kû£?u©¿C,G5~áS+óߪ´«ú­ã\8f\90ò\7f\r }\8dÿé}E\ 1\b\8d¬\1aËÉÒt\14\8e\19\9dîÚÅzÑ\9f=¯Ó`ïY<n¶ÆF¼y£\94\1cgÒì´ÞN8\9db<A5}ñ\92þÝí\9aZYܱ¥v³?°9¤OÃ@<(\84\94façZäXSåÍ·\12³Â&\97\1a\11Í3\e\88ó\95r°AXÿ²Ét¢×¿[*\ e>ÞùR.ý+ÏqánE\ fò\12ʽ%\85®\90\91C|\18òÞ]@¡\8fÁ\12ÐÃ\f­\94Fпv¸°     \8fàt\1e\9bÍîügaÉJ{\8cè\10QÞ£qKc\9c¶$ï!B\17tA%Ö\1d\15]z0ø\9eÙ½\82¦¯w\10±>\99@ÔǤ\8f;²Ú\84åÿå\81øÿ\aü\7f"ÀÌÎ\ 2èâæh\ ft±EDü¿\0\17\12
+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ÚíTy<T}ß.\14\9a²\1cû\1a3\18[L\18M\96ì"D\969\980£1#K¶,\85¨\90\9d¢²e_B²EB¶\90\96%F\96¬=ê~î§û½\9f÷\9f÷óþ÷|\9esþ9×õ½¾×ï:ßïù\1cA^\ 3ãsjh\9c\1d\88Âa  ç`\920%\0©««¥\0\1c=B¡\10AA$\1e´%`pX\r[\ 2¨\ 4À\14\15å\0\v -\ 3\95à2JpY\bD\10@âܼð\18G'\ 2 \82\14ý©\92\aÔ\A<ÆÞ\16\vèÚ\12\9c@×#\13{[\17À\18g\8f\ 1    ^\92\0 æâ\ 2\18ýlq\a\8c@w\10ï\ 1¢%!\10\18\f@cì     \80\1dè\88ÁB¤~¦ÒÂ:à\0ù?h4ÑíÏ\92\a\88w?Ê\ 5\88üJ*
+\1cåDã°.^\0\1at\80Héá\8eÎ\ 3\8fÒü\9f\83ý/¹þn\8e"º¸èÙºþ´ÿ9«\7f+Ûºb\¼þ)À¹º\11    \1eÐÅ¡A<öïR3ð\8flº \1aCtý{U\8b\82±WÃ:º\80À9\98¬$Tö\ f\1eã\8eÂx\82h\ 3\fÁÞ     p°uq\a\7fñ \16ý÷$Gãû\95C
+¥e\8a42\13ÿc·\7f\14\rl1X\82\89\97\e\b@\7f«\7faØo|4#<Æ\13°\84JB¡°#áÑýç\93Õß\ e»\88µÇ¡1XG@\1a.\aØâñ¶^\10è\91\954\1c\ eøÀ\0\f\16\rz\ 2 çQb)I,\8e\ 2\1c\17pÀá!?×
+\93\97\a¤Ð \vÁö'ÿOJ\ 1\90\ 2ÝÜ1.8,ì_¬Ü\91\ eù/$\ f\a¤t~#9@êòotÔ®÷Û\rz$Åü\ 5\1eù8ÿ\ 5*\ 2R®¿!\f
+Haÿ\ 2¥\ 1)·_ðß'¬®\8eóô9'-\v\9c\93\86\1f½ñÏVy8Ô÷\7f
+¯`17\89 \96\ 6\0\87*ÈË(Èübí\89x<\88%üú´\8f¶÷'vÀ\1c-\1c\ 4=A{H\80¬×\9d\97\8aêCÐIL\16-­&\8c\vo\1dDËé±\97.ɤ\89MHI ¼-\17^\8b6ãót\13ÞÐpë\v\16\92\90£\99\18\9b\9033V2«fÛ\86jÖUïW(\81\14ÁÇMÔ\ eZäó\87´[özÈ$\11-$Ö¾²j\1f\7fV\85\a|í¶  «óN5O:K5°3Ù£Âý\1d¬\ 2!
+z\9b\9b1\81?\86\91ë=4\ f\8aÂ3¼K\8e[ÞÒ-¦Í;è\90\99£g¿\8fb5f¹Q&\30Ìd¬óÔ3_Å\93\82%\86\ eÏ\e\ 1%F_\9bâ\90\ f\81î\7fúL\1e¥tõdt¯à<Êx~R\18
+Ó#+×æ\16u\15_\r÷Rã\8a\16\1c\1e(\9bëßé:yïUr\ 6cL\1dËã\0?o\ e\17ÒåÇÏ'¥Rz\86ï\8f\b¢\9a'\8cf\ 5\bæÑS\91O¾{gXë\9d>V=³TjÖ¼zeÅ\95ÜUéXÃ×\0w!\17Þ\9eµ¼\90\97[\~\16úÙ¾ÙËç\8dEgd»{ò_º9«gÌÊ\9c\9d\155N\1c$oÏ#ß\82­ñ(>åÛ\9f°×tvòe]\15Ѿ5¾}0\13\16\82\9c/ß^\16ºeÊ\80¸äor{/\92\9f±©\88\87)Õu+µ¸øÂÓ¨\96Êûg«\vX\9eÐs´)G\16N¥,k\1e:+Àñ¨ÁòÎï§\8c_\97}¨^x\13\1d%¦vUðÁE,Æßæjèq\8a\98u#JÄÌL«1\ f¿¦     k¾sëñê\82LóU7\9e;×u\¯%¯ÐvúØ\aÒ?t\96YÔºbÌ\99¾ÂÓ\0´\9b\8er\v{ËðI47æ\10\8dl|BÍ\82v×®նwO\98lú|´Ë\ e\8eõ\b\86¯d\9dQÄܼOcÎÔËæS\14Ï\8a\1a\90\99\87ç&w\84mæ²¢LÉÏ\94n\1dªÅ.óYt+U¾òN}®T
+6M°¿Exm\854¾:°\ 4õ´qBä.ËJ¡jEåþ1K\8f\15\82Ä\16ß\9eä\81\19O~#\1a*Çës*l\97§\8d¶^b[\ f\95ØæL\12_@R\87\fs\ e2\17O5TÁN 3¾ÔT¾\93\e¹]PÕè}2æ)×\1a\85AÀw~l§Éè®\ f\ 1nw\8bç"\7f\ 2\ 3í\90¥c\ 4\8e\83f|Ýjmº\98\82¿\80Ôã{`I&F\1ffÂ_Pm »h´áLé\ fðMGue2û\8fé0ÇX4ÄclNIÒ¶8CøÍQD\ 6¬Ð×Ìrr¸`Ã@\1a\ 5ö\8bZk¾\1a¤WD5zg\ fo%\87]\b÷¾¼\98Ù¶þã\86D\0!>@\93«,y-ÕÒwàv%¢ÿ½þ4ÿ1\8f%µÙ\85Ë×oê¤\f\148Ë):¿º\9f(ÖÂ\94myw$ ¹í}eA\1dÖ\8bÛÐ`i\95º@\92\85ó±nª#/\87\86\1d1®|?\ 6\95âÆ\98øA|>±GW\90\95\1d#¨´®7jµà»!À>Ö\98 ¦\98:Ü»9\92\9bÐ\7f\ 1\b\9d«(xçT=ûYÓïB±½o\8bM\18÷á¤\9dÄsw±Ä²õÝ\94/\81\v\8f2\90Éz\ f\8dÃ\8e\ fÐ\9c\f\8e'1k\80\ 6õ1úú×\13J\10X\9aO\1d\b,_Ö*vÚÕSüd\ f´\17\8feN§âÂ\89\fÆ캷\ 6\8b\97Æ\86fZ°9    òsf\vä÷ÌÜÃ:ãD7«Åõ\15¹Üo7~\87é\ 6¢b\83h±\=O\97Ä\½\82\1516
+?â\84\9aLJam\9e½äN\1cxD\1fγ\81\18}«ÿÛHhÞ~+y\85ÓÜÈ¡ºÙUÞ8áqz\8dÍ-\ 5Q\ 6\81Bk6k\1e]\17\18\89ñXëki-¶ÕÒ§=\9eµO\9cC\89Y\13\\9f\9fBE8ì*\8dujFñ) \17èÂÓVHx4náÓFÏJîÖgï§íç\ 4\17\1civ\eÙ êôé\87%\vù~æ\1fÇw«\ fª\96ÊàËÔë\82ýÓ}\8c5ê"Â\12g¦(²[\9f\9e4tt}\90WÔ-³$ú4xxêûÊ°ÎÙ&1¾\92õ»\97,8#19ËE\86£°\125FZ/L\ eȵ\a¡Èæª&W8³ÙÙ1fWÕ>YÈá§r7\ 1´û*ÞºÍÇÞÞ0\1cÕ­Õg\815\86\96\9e -ëÞñØæÿæ¡C-Éî\9a0P~\9f¾KèªW\ 5ͦE¸1sC³ßTD;r[e\0;>]\90\9eéí\80ѯ\81Üz½\9e¯\8eÕO\1cº"Â>\103]à\1akY\1dáÏJß\94¡A9P|,\87Lõ°6ëmPÕ©1qE»ÜÈ)ÿàÀÚz$@±ñ<»V\98¥(\89ù*\9b6×C\13U\9d\r\92Á&¹®¥%\1d¯tXN§ 3µ/û\8e]i½\97°òõ§QjU\9c\85Ó\1aí\9d¼o,|.+\ 6w=JÛ:û\15a0\18xÉg¦¼ytSyô¤Ñ£k7Põ\89;·àV\1c\rÝM\8dN\19X\9b¦ÜÖ\94¸I\ 1\15Q|ÅÃÅ|3%ã\96ð!"ËrÏP\9b\97:\ 3×GÞ9i\8e\ 3­­e\86\e\r´\8d¢\9d(E:É.¶éwso\97\1a\87«<¤½OëËugRXÄîù\13¹÷\1d\96\89\82\85\1f\8emÈX\9b4.ÒÃ;-03Mk"%®÷½¦ò¿ÂZöA\ 3V®¹ÚÚëC'Ä\r\92;zmY3LýøR.Ë­\86N\f½â\9e%\e¹êoª4Â\9akøhß+Ño#í$¹0~ÃRøñ3C\97W\1f\818\1d\11mòo.,S¦\8dâeb\r>ï=9hãÃÈÜ\80Ï\8d\97
+?=9n0>C\19\159EýúMá\16ùnshè¥ðÜ\e\12¸5â\e\ 3\89i3Ã>\95\ fÛ\90\8dó;Ýyo¹\ eáðx«ä±\90\f\ewÚÞ(¯\86\10fn\84Ð#øCªÉÂ\84þ64\82ß²\10J63hÙäûÈ\91ÄT\LÑ*\82ûô=\15 H«8\91j·~\19\e\11+~âÇS\90B>\97+Dr¯v:¬\97»\80±2\11\96WÀMøl\93Ù¬¨\e\1e©#ÃÔ#`\9dÓ>×I=GïÈ\14YsW\¥Åw×\84\8c\93\r{\11=^rXaï\1fÛe<÷úN\12³\f4\89\9biP:\8dä\9dåO>Y\87}Ã<\92?{ê\1d\92Ö·×\90ÙôÒ\90ÿ\8btX_ÅÙL\ 4qzµ\87ßi\1f1)RBåYË=\ 6]¬þÀ\18\a\17(3nZ\97Vë¹\80\94\95Ë\12¡{\ eÏÝ>\88\14Õºý¹È£\9eë]ù'ù\8d
+5Õ6qË/)·f@\8b\9eµÖ^\99\19¿%©\8e\99\98\92\88x-¿fº\15\9bÚ"ésUº}T¢\9cç¦]Ý\13Ñ«\ 2\avÅ~)¤+\11r&ÂýÈ\1dz\95ØZ­½'÷Ë7:\94\9b\ræËÔ\16\9a\10î\13ê»}+-«\1c\8fH\ 6 D[~=1O IO*\b\13´ðy{Û+\83\81¡ð\93·\9f\15¢Ú-N8¯2PzB\85Â\9d&ëâUR\84Þ;\94;¯]Wz\81d\\8ff¢yñ³\9e&Êç\9cJ£w¢r¬½\8an\8b\99ïa\18\9b\94\93Ì®<îµ@¾¨\1aä\\8beE4~pÏVλ\94ÇÆ·.\97ª\10,ÙRèý\82;ºñD]ìm\8aÛøïb·Ù/y\8aKÜÍ\ 5\ eÔ\1f\94
+?)/\84\9co\99WnU\80v¼Dk
+\f\94¡{IMÚ\1a¬þ®[\16_lä\91òê³\9f/x\b¿\8b\82j\1c\8b­¡ê\99\ e\1a?nmÙ5Ò_\145v¿ÝÇ9^s\12ÚK\9aÍ*w\9bºyõ\90y9£¸xeNt§\83X\9f#\81\9a`\94Tb¹GÂ8B\1cÛ\18ß\bú¥ñãSî\98\99]+VÙH±¬¥ÂÞ\13Óu{©ì\83\14þðòÌ2w\ 6£\80\87µvä\96\92,R?],Æ\8aG\88Fs¼\ 61ïÜF0-\9ffE¬bL\f\99Ï\vÌ\140\95¯\ f\9bßæ\e\19Õ6\8fläß\rd£èÊÞ÷\17}:Mº\1dïC~)1H¸d\ 4\9c±\b®÷\14\12\9aÿ)6ûd±ù\99'Â?\9eTdC\ fì2Ð$\ 3uYâq[éè\95÷/üÊ\99stÄ\95«¤ÄƬª\ 5NU\9fæÛ\8a£ \84-æÆ\8e¦Ó\91\98\1eÎ9<\ f6¼P·¿wÃÜ>Ëz\88 û\90áýM\8bOg\8cêìR\1eéLûC\ 5¨HL£âà²þìºÿ5°ÒÀ\99e[hp\87öÌ\1dD¿[óÁÐ\ 5ä·ÅNüûÔÎÂy\ 1>ÎRâLFQÖÀu\9a6ªÞ\e\1cKÒëÖ;½¥°\18>Þ \ 4ÊK¯©\1f\95^T\88#ÿªñjQü¡À\a\8fe\8bóý4'B¢\19\183?\ 2ü\86w\8d_ÜW­\10ºl\8e\8b:õðÞÒütö\vN¶CØ®,ë\ 4k#ÑfnpaÈL\19_0Ó8u\8f#<b\rb\0[jÌ|FìT^ÄÖk\a>Xz\18o\87àQ¹+æ¡_\87ê0ß\19ª\1c\96.\9d"\14\88pÜé\9dzq}Õ\9fÅ!r\19Z\16p\8c\95Ö\99nHB\90Ô§ºð\9c±\9f\13\9f~<$8\ 3K©l¤(á\1d\1d\1a0o\9b\9a\1dêT ¹®Í#×°ñ9õ>1à}\96à³°ï!Þq¥çú¸\9d­ê\9fe©´\93î)¢ïusK-u\ 4fzdâ*\16©\10!ó'XÄ\9e\9dzqÓÊ\9cæË{Ænç\8bc\8e©\8b7ÄZ#Ï$&\98Û\84'çjÔ¼{þqI\ 3S\16a¢QB«É°}\18.½*\1f'~ìD\90\94\9c\84ö à\8f\88\0÷Ä\18Í|\8açl\18\19Y;e`Éj\98xô¤6ö\aê\9a¥/ZC\97wèJ³\1a£\1c\95\84Å\13c\akºþg2\ 3Þ\9f\99øEC(ßQ\13\10\1cá#B;<\97¿\9e\97ìæ\v¸[\9c5\ e{9s\87y\8fG3fæ\81²ªÃË´¡f¦gÔ\99UßøM\8c\19\1d\87¾&|ÿ\92*Öó£[γ«\80x\85;w\9bßz¤Õc\13¿-Ñ\95QdßuÅqÝ3=õ®ã\978ÇÔc\82_Ý¿A\9dj<Ù\95\87ñµF§\90²¡ÜÃc§ËZñºÉ.ôá\9f\8eO¼×«\95     \ f\139M3Q¦/Â'ô2é=¥\fÿC3[\r\15\92\0Ç£¿îÓ°Ú\94'\1eBI  7N(#\88ó\1aiºqÜé\13A\8aõ\933Ï"Òê\f³\94©\v=H\8d\fLu>¨\16ºË\95d¢²Z\1dë÷(zd"U\15°ï¹U\r\1e´©\850\1eúRv²ð\97Z("ù\19wküÃí¹^yóqí\fF\84^åÞËáÒ\1e\8c\90yµÛr¯¡È\9a
+ÝF-\19\b^»y&tp\aâ¯wp\15ï\14aÑ1v,9©\95\85søMdMPÓ\19»Fû\81ÔõÊ(lð¬\80md¶À\18ÿJe\81ªhrâ<«ÔÞ\92õ\8fªý\8fÌoúû\84©ÔRغk\9bö\1eé²*-\8a;x\15\\9fu\fÔª{\\9fd'E°,o|Âà7ç/ê\88ÈVÌ>Läq§:.MR\95~\\96¤Ú)\18Ý\9eÑ«ÿÝNg»\9e\98\1dÑÿq2I?41]^$Ç£G\1df\1f.mR\14í\1dq*'P<Ek¢\9fnIë\ 2Ù\87\1dßm¶\14ó\86k\17\93pIë\ 6tÏÛVKµ\98®³Bÿ\9f\17ä¿\ 6ÿ\11\ 6ö. -\9e\80sµÅ;C ÿ\0\880n¼
+endstream
+endobj
+58 0 obj
+<<
+/Type/FontDescriptor
+/CapHeight 850
+/Ascent 850
+/Descent -200
+/FontBBox[-30 -955 1185 779]
+/FontName/LFIHUU+CMSY8
+/ItalicAngle -14.035
+/StemV 89
+/FontFile 57 0 R
+/Flags 68
+>>
+endobj
+57 0 obj
+<<
+/Filter[/FlateDecode]
+/Length1 904
+/Length2 1478
+/Length3 533
+/Length 2126
+>>
+stream
+xÚíR{<\94ù\1e\96"MT4²Rù\19\91û\Ì`\8cjÝM\86,\91û6fÞáÝÞyÇÜì\8ck+Ñ**º¬\88³\94¨S¡\8dJ\96ÔJ%É¢\94D\1dÊý®(\9c\91ÓöÙöüs>ç¿ó9ïûÏû}\9eçûü\9e÷ûýééxx\99Ú²y!\90\13\ f\15\99\12Í\88ÖÀÞÍËÏ
+\10Í\b\18=={\ 1Ä\14Á<Ô\81)\82¬\ 1\91J%\ 2[q( R\0ÁÒ\9aD²&\120\18=`Ï\v\97
+àÐ0\110°7\9cWY\ 2[.$\80YL\14¸1Ea\10WfÂb"À\8bÇ\82!\91Ô\f\0[\ 4\ 1\9eó-Bà          !A\ 4Ä6Ã`\88\86Y"\10\ 2\85Â(\ 6?\9f\89\8erxÀr\ 1f\8bÃ?Q\11\90@(Ë\ 5\fd9\r\81,%\9b\87"RÀ\868\18¼;Ov\1a$Ëò\1fÇú7©¾4w\12#\88;\93;o??§¿ÐL.\8cHÿ%àqÃÅ"H\0ÜxlH\80~)Ý -ds\83Ø°\98û%K\171\11\98e\8b\86"\100%\92Í\bæ\94\ 5\ 2\16\12\88í\ 1\8bXa\80ÃD\84ÐG\1cBÙ_F\91Mïc\10\89îâím¼°Ø\ 5Ò\83     £¢\1dÒp\b\10>«?ÖÄϵlH\ 2X\ 2\ 2\bf\ 4\ 2Q&\94½\9f¾\82¾8Ì\11eñØ0\1a
+H\14\vÀ\14\b\98R\fAfE¢P@\14\11À(\e\92\0H"K\8c7Cy"Y\v\90\8d&\ 6px\ 2ÌüV\89\16D\80ç¨X8\8f/@Væ\0\8f@B!Ä\17Ëvô\19&\ 3|èüµ\84\ 4\7ffÌezÙɼï\17vþ        &[\ 1\0\96Íá\ f\84
+ð0Ê\81QX$ý\ 3¤\10\0\1eB .\84.´þu\96vv<I\94©9\ 1\98Re\7fE$ZQ\80¥%5æÏBo\14æ\8b\83Ì\8f@°"Z}DYb\81@æûñ\ eËöô©æÀ²ÝB\90\ 4ba2³ÔáEß\9a¬7\9eØ5^Õ\8cÛy½¶¾µèä&ÿ\12¢¦ûÃøtO\85x\9eû\89 úú;Æ&c?ïϨk×n¥4\9cú\81\f©¹jób»îµ|\95_´3"þnNbÝUj\ezPÁH\90\1f\90ËCEI,7¥\9c&ÿñ¼d\9fÓ¶&´å\97¦ûøQÃí9ï#\13vU:û\87~UtÇf§ªc\83þ1A\84\97\ 2!÷ýPMí°\9f\92­dâ¼_§\16Ç\a9sÝ®øÈÚ 8­1ûEÁý=ûË
+iõÊ\91ù«\1d\9a\92\a²Òjá\14×è\8cojcVmÝ\88½\9c\8dµ\9cjìRvï\1aýj´\9b\ fë\9fÍ.\94\8cд÷y9j®\7füûúCñÕ¯È6\91¾G[\ 3Úè&\ 6¸0òÐý@µÙ¼ï~«³_\81É_r|\ 3y\7fò\vD\9bºã~5=\15\17tÌf"Ì×s\8d®Ó¸Èß(<©ùñ\ 5\17n'פ 3pP¿C-T+¯âNk`íÝ\ 3e¢  ¥\90àãÉ\83\9bæbÖ*vÓ\1e^9ç\12qëÝ\b\8dPW7(¼uoüµÊOÝ\ 3x;ÓrºG¥äø\9e\ e¶ú²cG×渵$ïô£'DÆ,2¾¶ªrñ\ 5IÞ®\83\ 1¾Óÿîö\8eé/\91soê\ f\169d\86ì>\12?þMR\ 1'Í×6'=µÏwéL¿æ\84\vör[\96\94<Ô­\9d\11§Ø\9bvì@Û\1d\ 6\9a©°­ù\aÕC/¢\9b|¹:ËÔ=·\14{\9d¿vúíÓÖ.eF\87a_8GòÀJÎj0\e¤\ eÜ\eK!»\84°®Bç÷\ 5$òý\92Õ{+ZÞò\83ò\82G\fÞõ´N5\8fk\8eö\9dZ|\98Q\14\90t¯j\ 4\1486(Ç:çSuõk·\14\9c\98ñµÜW}Ã\8eÓ@S f¯1%LGÞ:Xu=®oè­w\0rA¹¥\1fk´ý\8c\rü«`6\1ec\17j\87Ó\9eÃÄ\14u¬ù.Ê.xo\9f\1cÕ\99ÔÕ6¼ª%\95qS½\ 6/$_\94\10H»mJ5Whn¸\11«\9at°©gÒ´ \7f¸åURÔbÇ\96RÿS\1aµNèoÝ\ 6û§ÊoZ¥®c6ÎhRz\8c\94§Z4'ÕØÕ\17Òõ\v\b\173\8bt\\e\9f>«==Ùq(µ\8eÔ\91/gñl«Ó¹ai¯Ëä¨\9e<ã>7ä\1f\16\11\16/ä}âÒ\9b.ú#:·\9f}p\9e4 ¹i>\9e\93r[Nµ°Ør5M|ïfâ\96HÒl_8˺>Âî\ù\9a..µj.\90>¢ÃQ>¹\ 1\19Â\1a\1d®i\99KL\88{Ög9 }Å¢ ±\91Ì\8eÐ\7f÷£\14\18\9c\8b\8f\e\1cïø\h³\ 3§Rò°}ã\8cK~Wì\878\13ì\87\ÿèå\15ùNÍÔu'4ÎδLga\96óù¬Íɤ\8dùÞKèí\ 5®n×\0Ö0­ò\80F\93Ç&^\14c\8fO{\93\12Ö*\8d1\19²\ 2Ú·¤>±5åÁÍè7f¥ÍÅ°½Á¶b÷\95lW¯Z¥e÷8Q}ÝéRd]\80n\1c«ºP¨\îtûÐ,\8a\vÄY>\1cRê/×5Rä\1c]\1dáNWzY_Û;SöÞ´ÜÑ÷Ì\92¬X!\16·§
+)ÛÙ\91\82\f\1f8¬ ¯\ 6?ï/\16j\8d\18h©8û%ô¼üÛ\93õ?\93É3©KÍ=±%\ 5|Ã×Å\ 5ú<ðk\ 6d\9akv~\a\8eüD\ 1ÊY©¾TqK5mõÚ,%~a1ZPÕ»\19£aìf{ºh´\8c¯Æ\98ÕéÜû\b¹{y%\7f¬Fã¥vãñ±+Ôâ¦=S×lCç²³ã·<R~'ÿ\1e°Î¥©ªße<\19Ws\8dºÙ{¤áRga\89\15çá63\13¿\8b\1d>k«ÍÓ©$\87¼Ä\aÛ\ẩt¢¥µxC\ 3\9cá×[\15å¿\ 6?:W\85Ó|ÎʹÈ\8dÐ\89&#-Ò#ì«%\8c¨\91\8c\9e°\12e{·¶ÑUÛ¹\81\1c\9f\f¼óÐÃ8õ<N\90¨á0Ǻ{ýÙ÷\99\89u\ 6\9e\8e¹·¶ÝX&@'sV\9a\8aUhÛ+ß\8f\85G\96$ë&Þ7`\97'Æ­.]1û\9c\97 \97æðº"¶S9\8b"ÌÒ\9aK\8f.i×û\90Ù\82/Ä«7>Ù§þ\80Òãà÷ZnùÛ\86¼REîÉuÝÁèÞñé\97ú£*¯\ 3TºÊHòØ\ 3\eÊ\ f\ 5\86¬§\ 4ï\99      \1aÎm\1d?\9c»)R\ fÛU¡\95u\16×v©hàMìdÍ\9cèÑ\84ÊvÇh^ê+cîÜì\99\9aÇoK\v\a5~\82¢Ì;B°Ó4»ß+këä9Á\82o'cTפØürÁãä`çl\82\11á¿|0ÿ7ø\9f0`!\10S âq\99\82Ý\18Ì?\ 1Þàh\ 1
+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Úí\92y<\94í\1aÇ\11Ñ Þ(YâA¼\96w\16\93u\94eìɾfmÌ<Æ\98\8d1b*¦Tö-Idi\14MeM£d/dÉ\9a\84JS\14\85z%\1c\11\8eê¼ïù\9cÞóÏù\9cÿÎç<Ï?Ïuý~ÏïþÞ×}«(:º@MqÔ\0Ð\92J¡Cµ`Z(ÀÌÎY\1fÐ\82! **f4\10C'P)æ\18:\88\ 2´\f\f´\0Óp<\80D\0Zº¨}\ 6(m\ 4\ 4¢\ 2\98QC\184\ 2>\88\ e¨\99©\7f\ 1¦d\90FÀb(\80\1d\86\1e\ 4\927C°\18\12àBÅ\12@:\ 3\ 6\0¦$\12àüí\97\19\f\ 3iGA\1c\f\ 2ÑÒ\ 2p\ 4,\1d\b\0ñ\ 4
+\ 4þ\rÉ\86\12H\ 5ô~´qá!\7fHGAZØ&\17 ¶É©\ elRâ¨\14\12\ 3À\81\81\10¸=us5p\93å?Æú7T?\87[\86\93\18ò·øÍ1ýEÅ\90   $Æ?t*9$\9c\ eÒ\0;*\ e¤Q~¶z\80?Ðì@\1c!\9cü³jCÇ\90\bXS
+\9e\ 4\ 2\88\1f-B\98%!\12Ä9\12èØ  \10C
+\ 3¿÷A
+îg\88ͱ}G\80\9b\1f:äåxPóû\81þÐ\1c1\ 4
\95\11ògê7ó÷Zë\9fõæph\84\e\ 1C ´6\8d\9bï\1f_¾?­eAÁRq\ 4
+\1ep¡c(8\f\r÷gã¯Lh45ò8t\9f.\0Eêl^ \84\1e\ 2ÐÓADý«Ñ\8dB\b\r\a\ 1\1d\ 4\ 2¡gð\83
+\e\81\14ú÷K°¹ß?ê@Âæt@0\12ÄBróv\12\7fÛ£¹xd¡yHÉ£¶ç©#¤¡øC¶Î\12kW_Ç\9c0I\06\1c\1cw\96è¸0"º2ã\98|qYMÁ8þV´\9dazó\92_\v\83!Súb\97Fà£zïñETYÊ\14t@¢Ú\8b\ fÞô\11L¾çï}[\93¥sÜO@ll\1eÇ¢\874~jS\94¾³:Ô\1eÝ8\8a+õÒlì\1c¹ý&ñm\1d\ f
+;d\11a\9b¡\99ï¿T¹\95Òk\86ó\92ØͨDJD\91\9d]wûl\ 2uc\ e\83\8aªYÝ0Ù\85ñ"Ö\94µõ~Ã>ß7'ÚT!¨¬\13¥!ì«ÞñÕf;¥÷ð+s¶ú\1c3S\8f;\9fLüPfH+Ã>8\97\ 2¤,¢Eíë\ 1Ûm\16¦\9f-fu\8f½ó¹Ñ°×=\91wðÞò6\7f:0ÙªÜ*yûE/¹(e ã\92{\7fä«þñù\80B]\13\16\8dýD,I;tÕs\9dëe\18¡n!\ 5Êíj\18V\8d2(¶\ f\r\r\876L¢îçrnóɽ÷«^Ç\e\bo+·+x2Ì\7f\8dn¶èÛ+U:\9au\7fñ\95rçÛÂäÆÙ\96mL壨G±=Ã=\12ú2SöÖ6~í+Î\ 2\ 6#ÌÄ\94Gûc\ 2Â-s\83\82-¢£ä½ßáÛou\97\11è\1aɹ\90Q3kÍù¢2È\a\93Ú\19\ 2KÙ°L\97Ó\ 5\85²\91êîí[Â\a\9cA\1d\9eªy¨Æ\9d\1c\91²\97ÐB[\e©¿9ùáê\ fd5E8{~\8d*·G\17uÞy\96:6{ð¤HbYÇ°\9fu×[E½W>[ðLßà\98\15ËÑù¯L÷§0\9f#^²\91Ù5\ 3&r¿\95Êð*]é`ß|\95%8ß6\9fq\9e\95\9bsØ ãtc\82\80¤sB\8cþÝ\88çÙ\88\r³ÝW²«\14\ 3í<]Y\ e\9d\ 5Ä=\ 5\95µ_\r\1a/Ýà®À¯ªV\15\ 5ÊãUeo?ïð4\9f¢\9e\97(q1zM|du*ð¥\eß\9dTÊýi\8cø"rk\9fÜz\91´\87,\9fÙ^[ä´~\8d\1aK> Ò°Ï*\18ù@[n¶\86µ¢al¼ïüΡÏ7#øMÒ\ 2¥ú÷\ 6°<=s\1d¦Ûê.\92\88¨   )=ÕØ[õ\85)\13¢ÐÝ*.¥ã>\18«Ó\92ï]ï\18xÇ­ûFúÎ\9aö½ßI
+\13N\82½W~¯Xucd\9a)Z¶÷´ \13\92èû\85;dÅ\Í1\f\90¾^5\86¶Y\8d{*±CA\90í\7f/=ö \11\82
+*zèqz\12´\88s.\8ct\11\979r\82p=ÑøÃ\1e©ó*«jm\83×\v\8e(ÝH\ 3^Ê)C'\9e\89u3Ùé6\995\9dϲáA\13lïQµ#góO:Wà\99É_ôж7\9bOôñ¶Y\vª<ÌZ{Çã|¿¢^\94ãp·­p»9ì\15\16¥ù\91Í\1d\80'_¿\14\8a\15\9d᳸ë\95p\ 6Ý\96¢\ 2o
+\15\9dD\9eé\85GZ;×h\16£\8cà"¼FM\98\ 3\98}\a\99/oÑãÈo/i\82\1cÇí\8a\91O!\9btÊ:Å¥yl|~ðLßÕ¦\16\9d³¾±6\1c\14'­Ë\12v\82C«û'S§\ 2²\9f*ëwQä\98Ý\ eB\z\94@Nõ
+\83<D\11_år\13¸¦\9d`\ 51ߨW\ 3[³ãS\91Ø¥\97[¢[³Ñ®üÀø\96\80\11ëÌaCU=Ý\8d<\8dÃEÝ|¹g\ eG&Õ\1c+*âJ÷ÝZ£¤Z1ö\98=è"W°§³|\85.\e]Ì¡«\18c\9fè\Ë«C¾Zè\88Í\1e\14\19¯kܨu[\82ïì+÷áþ*â40\13oÇ}<X\e\vÏõ|»\11ÐÜ ÇâÙ\8fc\9dºÐ#+L,f\ 2^¨cÚ\13åÀ\8bÊ%Cösý\13\8c\1d\93È\87R{
+\97§"¢\9f\1dAE$\9dv?§\1aÿ./¹¿>\rDgêg\84NÕT`¶v\97ðcÛôÊq¿¼»Å¯SñJR;gçR!\96\84\ fº¤\10¨ö\v\91!®ýE qï¹ú\84\8e%lZ\f2Dmnú\80\82`×kÛ4íã2(ù\vaüêú\8b\9d«\8fS1»òË\aâË_X±r\9e\16 I\0¯n)A^÷ÂÓ\94 kì&\ 5Õ£5Cj.Å)á0.?K¬<+\ 6\8e\9f6DÍ
+åß=ì\1elx \8cï¥ÈРÂQ\9d
+ãÕ7\8a:<\96o¾â\91YY1ÇB\ax
+*\83\v÷ß_\8b}6¥ôZ¡õÂA0_YíÚþ¥9m}ÎL^yÏ\v1Ó·\89gZÒÄ.E²/om\11.õ]éÆç¶\9b!ýÅ\au\15Ø%¬zêÒn!\87Èí#3\1fóÆ\1a8y½8¢¦÷Cé\9bÊl7áíZÂ\ 5å¡íõÞÌ^åwY\9a!!÷²×MÇL\1a¸¡Ç¹¿÷¡sЧäOÖ5\9b\88\1aÎ6'Û-\9cºgþ\81G"­qýu\9cï\ 19\91]gª8û\89pl¸zÏÜÁ\85®Ôð¹û®\99N\93»Ç\17]\ fMx´z; J\1eÙ\95¥ÊÜm\1d]0S\8d Uïhsj¼\91©D^³\8bZHGÔ\eà\19!-+÷Ø\82líS¦\8a~¥2ÚV¶ÝÑ­ÃÓó\88ø\80L¥nÝ°W\88V\13ÿ\12àrÒs¥\ 6\93,\1e\1f\a<ÿØH\89#®½ûr´nisÃô\9c\9aø,ºªåmÔ5ÕA¿\d\83»M\8cÒZ`°\13É?\80Ìi\94ÍlÒù\r\96ñiçî«¿N^Õ8n¹\ 6\e¬åìUÉíõ\bÌ\88o\8b|\8cg$hK\87ù\15bÕK\8dF\92I\1cSæ|tº{\82¼&<z¡n±r°Ã=áò\ eÅ\84\13\17õÞ\93%O\16\13,°ìkÄü\99¿\8d]½î\93l\98Í»\w©\17#4"Ù³Ï\b=äeÈ?Pm£v\16-\91A\1c
+"^@"üî%J~X\8e\\9bqÅmôK\9eÀ<nú¸Ü\ f\9d®kLg`\16Æ\8c\ 2y\19¡\8b\8a#\1e2\8f­\96WÞ,7ë\82âÄ´©\ 2¨\r\13¾¹ÅXö\11bÇù\ f\8dËЪ'\ 6\ 1ã\8c\°ï\13v®ãK%\85\ 4g¡<\14Û\ f\ f¿ôTá\9c\14²É\98ô\14ÆÌú\9dâU\98A|ä\1es\13\11Ú:\9avÅUA¨WÆå®üÎ\87b\97WïP®
+n\85á¶\89\8d\81,Ͷ³qÆ[ÐÅ.#Ì`\ 1\87G\96Sþi|öb!zÉ\85ü-º%Æ\9eÛª\0­F©\9c\89£ê\ 6Âq\88¯Nð\17¿»º^\19x&Ø­\15õ\96ì0 þ«\ 6\84áTd)ê|¬Ø^=¨?ïÌ\eXÎIÄ\7fù@þ\1fð?\11\80%\81\18\1a\9dJÆÐ\88\10Èß\ 1íâKT
+endstream
+endobj
+94 0 obj
+<<
+/Type/FontDescriptor
+/CapHeight 850
+/Ascent 850
+/Descent -200
+/FontBBox[-24 -2960 1454 772]
+/FontName/SJGZEG+CMEX10
+/ItalicAngle 0
+/StemV 47
+/FontFile 93 0 R
+/Flags 4
+>>
+endobj
+93 0 obj
+<<
+/Filter[/FlateDecode]
+/Length1 921
+/Length2 1989
+/Length3 534
+/Length 2624
+>>
+stream
+xÚíRi<\94{\eî0T#\15"Ôä©8a,3\93=\92}\89IJ\86B³<3F3ó0\v&Y*\8eÝ¡ì*ÊR"\8e%IÖc+e=´0$[Q\9dÂ\1c¢ä\1d:k½_Þßûíý½Ïóå¹ï뺯ÿõ\÷_i§Ã\11u\13\12D\0-!\ 6[\1d­\816\0Ìì-ph\14\80Ö@¡àJJfL\10ϦB\fs<\e4\0Ðúú\18À\96C\ 30{\ 1\fÚ\0\831ÐÒ\83Ã\95\0\9bˤR<Ù\80²\99Ê
+K\17\83L*\11Ï\0ìñlO\90.\10!âiÀ\11\88H\ 5Ù\\r\00¡Ñ\0Ç\95\11\16à\b²@¦/HÒ\80ÃÑh\80D%²\ 1\ 2H¡2à\9a+®l\18d\bÐýÒ&q¼ÿ\80|A&Kà\vP^1ª\ 2\bl\92 \ 6\8d\v\90@2\\13\v     \8e\ 3\ 5fþc_ÿÆÖ×â\96\1c\1a\r\8b§¯È¯Fõ\r\8e§SiÜß\19\10Ý\9bÃ\ 6\99\80=D\ 2\99\8c¯©Îà\17sö \89Ê¡\7f\8dÚ°ñ4*Ñ\84\81\0êK\8bʲ¤ú\83$\a*\9bè        \90ñ4\16¸Ú\a\19¤¯M\b\92[µ yÄÖÊÕÂ
+ùûZ¿ \ ex*\83}\94ëý§î
+}µFÿU\v\ 2bRý\81ã(AÀh\ 1QðþñåöÕi\16\f"D¢2(\0F[\aÀ3\99x.\p\83\ 4\956\10\80\ 6¨\f\12è\ f\80þ\ 2Ë\9a\1a\f\88-\18\ 1\ 4©\ 4\ 2d\88       _Y©\1e
+ÐdqèôÕ\9bÆ\ 6ýÙ+ð\17\ 4\ 3h
\82\14&\9eöO@ïo#$*Ë\9b\86çþ     ê£þ\9aú\ 6Ó\ 24i\10eeëx\ 6é\eTûO\14\1dü6]SSÈ?@\1d£\ 5¨côu\ 4\7f«¥­\ 5èêb\ 2ÿÉtbP}8 \8d\8dB¡tuµV»D\ e\93        2Ø«WZ°º?j2U°h\10ô\a\89ð\10-î¹\ 2}Óg¨aêuqqk4Â'~Q]Ê\0\87Ö\9b''9Å\9d\9eÔ\8aÕmk\ 1eE»Âö4ܳ\15UµÖ.Ôõ·kL\7f\1aº\ 56¦WÞ§®ÿÝØiÄØü\ 5즲~¾©M\ 2§ªd\17ã9UÕæ\18+3Bù\95È\ 5¾CsßϪ÷£;kS¬ç\10²\8a\ 6\1cËàuØ8ä\18\83\1fܼÝàlÚh{\9eæBÓGV\12½ \9a|¾G\9aè\17\12SæðýÚý!\8eÆ.Ùâr\1e\9d\19\99\1d\87\16\8fÙ\90M\85\v\14\vïêõÅ*RÖ.¿|¬    «mº³aç;Nmi¥$\ 1\9e¤>Q7ìÞöd3!1ÿR±\98\8cJu ýÄ]Ú\r\15Ôy\ 4ÉÙc7ÿ\96\98;ú8B_Q¢6\96Îz\90ê\9f9\83Ë:m\18\ 38c\9cC\ fÛ\85:­©ëÎ÷Aoø$Ñ»]^&°Æã½d\v|\10\e\8eñ`8¦  «\9e¿<áQbe ãU$ë\9bcbkvhWC\8f\89\8bB\19\14\168·xQt\1dgÓ§\rGù6\89d¤Â\9aé\ 3\8eS±ç\97\9b\1eú]\8b¯VOK\95\1fO\97Ûj]u"àj~\ fθG*Õ\ 2     ýöÔ@$3èV»Æ¼ùäà®\9a\85ÖË°\8c÷\9eÚ¯ü\e\91~`KÆ`\1c\7f¨|êÌ2¿óâÑ\9cÁå¼È¡d\84\8c\9fbBkqMðò\90é\81µ¤\96¸$ìx\93S®'×å\Fc\99\96À©\ 2\1de²Z\bªyXsjýÉôZìMÉ\91­Õ\ 6s¬éj\9dëÂWJ\8cÛ\1e\9aÊ~ÞÔ\9c½`¡\8e}nù(a\80R¡Ø;ó\vGèc¦D±ýÕ\98\1c1üúà¤^3\15Ý£\94·RÍ\ fqîÍÆ\84Êý\v\ ej­NÅæu\98Ê\80¨ÉÙ\99\ f\ 3óê\ 5ñ\85ÅUíÊâ\157\97\8b\96\96éîËß\933
+\8f\93DN\8evmÝR¥\aflÄ*×Åð\14¤\97\83öç?sõúXk\14G\15¹I?\828Eo«¼\ 2è<²Q\ 3çé¼ÆÎÎYã!£Ì¥Íóù"¨%7Ø´Ú\9b\95}~¡\9fÊ\vÓ|º\95ÐAöôâ\1dÝR­IÍ4ÈÙÒusØE\13þæH\99Dàùë¢ëÞMKc\8f$
+k»¶d\8f¼¦½\95I|\87ª{s(ä\ 4i·²\91¢y\8a\87\a¡Ðºò¬Ä¯'¸×½°¤\ 2ÍÄ\88\81\89\11D½X\9b\19¬q \vÊ\13/\1f\8c\18ñôþ)úiHE W\87Ô6§KuiWRg弬0bM\92C\15-mi°°v­\8aôÎ\96\99k·1àÉ\9dìÝÇ[\b\ 4\17Æ`Þþb±_/óx\9f6\ 6A;\8c
+\1a^ì|g\18\82\9a\17ÞýÊ\16TM\80®\96fD]F^\9d\97\98|5Ô»×fS7j\0§#Â\17ö¶\9a×K\9fz\0TÉ|WqêqCÿð\9a¾ \9dÂ\90\89»6/\iÎ\10\fáx\90øº àð\8c\88\9d2vZ\8cLló\11\17B\8d\9e\80\r\1eØQ\92$\81\9c\9d*²·è\8ev\9eÖÈÑøiÍ\89Ço}c£æ¡\96Â\1fä·6"ë²cP^\81å\8b¦¢\1a­\88ØjWuc¡-7Ôð¾I\9e貶8¶\82Aåz\97\1cÜÜÐ\1e¯ª±üþ%§\ 5\87»\990lVø\1dxq\91æÇÞ\17'Þê\12^`ã\12eQ@v\8a\9c\13U[÷CÕQ5»î\8a5[\18ÉÖÎ\8c"¿×<pliÜ?j0õ\fG¿Ç\8e\17Ééø\8c\1d\ 2Çâý\ 6   cü¦\98\evh᧹¬\e÷eC\85Bc>l·?\90 \1fÓ¾\19~RsâJÖg׸\8bÜs\92î\92¡)±·UXÏý®óƸøË¢ç\bZK\ 6ܧ¸-oÝm\7fÞ¸GìFô[d°P[ólÙæá4ß\93ÃYÆ\16
+Kä{¸awbGªªÃ\ 6^f\9e\9dP_äÙÀ\v»­\9b×\1elm4_¿\8dô\8c¸>\11j=¨ró\98¯øô        \ 5çlÕuã(»Qçæ\84×,yÑ)\8am\84vÉÁÏ\86\8e\e\92ÍÈÊ#^22Û`gð[%OM(¾Ô  7eâ\8bÖ\86\r4d"/µ\91\9da6ÌÚ¦¸¹5éù·f\10~Èq\8fñ¬\87£\99@éxç\\9f\93Û½Z¯\80\87½¹Â©J\8cò\a\91ñ\9b6\18\1fMiìØCÊu«\89\1dÎ\bi\8c\eíÔ\v\879\99§eÿ¶äÀ\9bã\94\ fÿ(3\19Ó\9a\ 5óxV:ý{\8fõæ\8c\85   \1fn\9c+ð¹¿-_JÌð\ 69\19Vy\bÀU\84x]¬³¸Ï\v\86ÍÜj\10\96Ï\97¼»\8e¦ß¥øÎê   ;W¹»mûQ\89£3É[h&\88öâûÛ\13Üpéò\15ÐpâLôx|\9f\8dH '´t°ôýî1Â\85¹VÒÚ\f~o\fÀ5j}P3\eo\1cõ£èmcU¦ZqÒé\88{S¼\97É>>¦Í\19\96\ 5\ 1´\1fÂsfx\1eZsm\11ÕÇÊ\ eÞÞù4Ô#8S*¹\15Êkï·Yðú04¿Ã\86M\b\9e»³ÎòÅ`ë\8fÍmAγ\1f\1a\bÈ+Q»ºSXÓ\1dÚUPâ\84´n\91ñr¥Ú%ý}¯É¯XRõ\84\11¥8\17\7f
+ïæ\80\1a¾ªaÉ©¬ì}\1dQ<Q\12!âYði±ê3\16îâ\9e\1d¢û¸<¹ê±\9f\10î·ÐbéyÊ\87íýx¹q{s\83Î{\1e\1cÈ0Ë0l㼫Âdf\97G\95Ô:[¿yy\90oÕ]Ó\17\9e\84S!$I\9bu]3^²u\13¾\93x÷}tpÊbÓ\e!CÃ!é\11{mù°
+óßX\818  ¹'u=A©\91{\15v}\ e¨\8dâ\14º\88,\80\99¢¾\aê\a
+?z\15ÖÖõÊyã\0d\a¦Æó\9eZ\7fÑ<x\82ú¸B²dÑÕ\94Þ\13u-¨bAiã:WÛÁ\1e»X±3ìÒà\85úì¦r\84#}jòø\85\94CH^\80\936vÿM\r\98\90\13ê\8cpÖÐ\99å='Ã\ 2l¤§_W?Ê\f\8eÈ¿ òü\Oyÿðó_\ 6\7f    \ 5ÑÑ\9bö¿TÐñNÖ%üljýÊc8Küú\eûÑÑ\88:²ëºz\ 37¶ÑÔèÈ\91í\8a?ôã(%\ 6ôzÓ0\ 4¥ËA\9aß\r\97Ïÿ\ 5þ7\ 4\884\10ÏdCt<ó\14\1cþ/7øx'
+endstream
+endobj
+117 0 obj
+<<
+/Type/FontDescriptor
+/CapHeight 850
+/Ascent 850
+/Descent -200
+/FontBBox[11 -250 1241 750]
+/FontName/IQPPWN+CMMI6
+/ItalicAngle -14.04
+/StemV 85
+/FontFile 116 0 R
+/Flags 68
+>>
+endobj
+116 0 obj
+<<
+/Filter[/FlateDecode]
+/Length1 786
+/Length2 1526
+/Length3 533
+/Length 2113
+>>
+stream
+xÚíR{8\94i\1f^\87d'js\b)½Îª5\a\8ca\1cú\8cs\8c\184Z\1d¼Í¼x\99\19Í\90ó1D(\87$ÅV\94\12)[\12\83²v\1c\93´E±9Ô&  ÙÁ×µ××~ÿ|×÷ß^û¾ÿ<÷ïw?÷ï~îçÑÕt÷4´¡³÷C\ el\16×\10\87Æ\11\ 1[2ÙÙ\14\10/±X\94®®-\ 2\81\\98Ͳ\ 3¹\10\11À\99\9b\9b\ 2Ûy\fÀÈ\18À\12\88xc"Þ\b\85Ò\ 5\1c\ 1\ 2\a\ 4r\ 1\ 3ÛÍ\8b,\ 2\84\10\98\ 6²\0\r\84\98b\11\1aÈ\0<Ù4\18â
\0`Ã`\0\94Å-!\0\ 5
+\81\90P\88\8eF¡p8\80\ eÓ¸À~(\0f¡0\8b®\9cYþl\80°\¦ó8_Z¡\10\12\ 5\18,9Ý\f\88}ÒÙ,\86\0 Cþ(\8c\e[<\ f\12»ù\9f\8dý\17__\8b\18\f7\90¹(¿\98Õ_Ú \13f\bþM`39<.\84\0d6\1dBX_S©Ð²72D\87y̯»Î\\90\ 1ÓlX\ 1\f\b\99 ±&Ëu8Ä\ 1æCtw\98K\v\ 4üAF\b´T\87Xô¯\9d\88ã[ò\81qöpw§ºm]¾Ûå¦;\b³¸^\ 2\ e\ 4`ÿd/aÜ\9fX\9c\11\ 2ó\ 1_,\1a\8bÅ\89\89âÿËjÏWÃìY46\1df\ 5\0FxS\0D\10P\80Â\8a¥\8cðx \1c\aÀ,:Ä\a ¾Ø1\ 6ÍbsÅ[\0q2\11\80?\eA-^+\ eK\0\8bµe\88Ã\ 2\18Ö\12üë\99H$6?\üT\f\8dðâ\11F&8\80\80ÇFü'Ï\9b\ 5\1fàAÎv\0\1ekF06[>\13\8d\87 \10\8b»ô\96Äq}Áþ°8a\bâC4T´\89 ö¢9©\17;\b\9f\97\97wÂmDöÆÉo\b\9d=\83Vpbå\9dÌã6^Ó\9fÌ¢jñ9úïí8¢x½ïMå\9e=}fJõ$Rk×Mc\9dêkçj\88\90\84\97Í|+áRïöÖÙ\ eI´uë[eQumx\94²Y\86ÖC0oâU`]Ñ£«v¬\97¥ýú]mÊ:  fnSSÙ1\v}¶ï:ä2®¤\14\87UIø\1e$WÊ\97Ï·\19\ f¯QIsPöT
+ªÖ¯ëîSðt9Í¿dÅ\97VÊ^\8dh¦byY»\9f«aÖÎ%`ç:_H¥\13\83\98Uý³\97-\1c<_\rêcqn\92׶klfn\9dH\11ØlÌÒíë®\1eî\9ay,\93|½ xmv½ÒñèÈ0\8d\80±H\9b\87ºå\r\8e\92\1fÒ§¥^\88¨ZwÊ6\rL\7f\87r¢­\97<7¹E¶¥r¦úYÜwf¾\89\89F\a2z\ e¨\15\e¿SëµQ\8c«ùTdí\18ÝÓ\18\89><xÿu\\17½iôn\18qâprñÈäGá\945*ºnÎ\ 1øU!©Ý|µ\1aÏ<Á.Êú\1c]BÒe\94÷¼ºÙ6<¼2y\9a\9dsCµüPP÷ëËQ\9a=\8d\82\ f\1fÝ\93þì4a>\94;F&\11îü<\953u4Xm\14\e\rL\97ì^\97n\14Ù¤\13¼ñÓíLL0óBC>7\89i\9e3\14¡*        ®\95¿²OùÅëñÚ\92ÞUTz\83ÕïRD\8d.þo-\82\9d'0U¹\84T][×5\80§â\9b\9fÊ(\93\bé\97ñ\10u¹~Ù »\18\95\14+Há¤cC\81ÖH3î¹:Áñ\86«ÞyjÓ\11\99oTòZÎ\ 6b­¼\14\13t\r",T\12ÇF?ø^³tżÚ뢮Ü(<\92½\8a\94ÓºFöf\8f\9f\82½F\7fz\91¬WÓÕ£gXú\95êVöeÓè\85ÔKcZ¤þ¬\140p\8f`0'æ\1eW×÷è\8fy ë\94ß'_\15Õ<Åd½Ôb\992øðpû5QBoùÙ]Û\87#º¯\92SLO<\91¡G¥,$+uõ¶5lwÂg¦{\1fàÞ½ýæ\;9Ê¡L\93\1fçú Nf¢\9cü/üC?\r\10\8etÞznè\81ð\83¬íLñÔYÑ\90\89DÓ!\85{\8f\1a\ 2u:<´\17\fÚ|~:Ô\1eï¶s\9d\0¡Þ}ßÜ|Þxäsµ\9c\8a²DïøúñjQÓ¨wÈ\15\16r\1dI{\80cè7Pò:\94k2â\15ìR ÌÃ\94øä~+?³æ©;ªIß\96zK¯t\89õÐyRx¼³\83\11¥ìs´{¯<û\98\93áÖÊ\96z\1c\ e¤l°x\99Ö\:Éhj¬\96Éß\85\94Õ³©4\96ß:×Ï:\9f.>"fpØ\87\9fQ(;\1eÇ6Ô \98°ðEé½$\1f=\9e\9cµ½¡Y\8bºÇ\8fÒQsÚú³\f©ð\98̤mĨhú\91¸Í5\19's\ fæÉs¯§k'ùP¿9>¿KF-£®Õ¢h¶Ì*f&~\9bå\98ÂSRÎXù\190M1?ëúøÅ\MÛÄÎ+\1a6óYÏÛ(³ÇD     Jc°\8fÈ\8b\87å\12\9c¸¦äÜ*\1dh\82<F\99\9dYðÚñ\e\90¢¯\85VS\1f\90\92fæ¼Mz\95QÀ°§fSúà\ fQªë½\82Îo\9a·0\9du\uö\86\87Êx?IP¯Ï¿o\9a/\81\8b¸õ6e"ó\ 2aðH¯I%\87µòñèí\9bà-\87Â×\9a.s\92\84û=iQ\92\ f.\e÷áбÏev\fí$¥¶Z~ÞRk\17dºñ\97öM\ 6\8aó[\84Ù·\14}^:VÌ_\1d   >\18¯Õ\9fàmï\16ù46ëÐiF©âX¶ªß\ac|\16^O\98\96fR±Ç0õ]¡ÁÇ\12\83°\Qpù\98\13\87ò«ýlò$\ e>ݨ^Ô­³?t\96¤\14,\m~Ì\ 5\9b\16Qulã\ f\ f|[\ e\98ÃNëD\8e\ 1\12\ 3¹²r6\1e\85\8f{«Ôö\19tP0+øfè÷\87\9fxûve±SfßûÉ\97õ½©R°÷cî2\f*õ/p  iÛOy%ºµ·¨Ó¿ tOIÀHèNɵþ.§ªî«2\87Û¨êÊÂ7\ 3
+g\99±\97\1c¯W¤\vnØ5ÑJÜ룸`_\96\8cjElg\85\16Ñ£ð]
+ùC&fRµ^÷\16\9a\97¨\84~\8e\8fÏ\13\9cܳ¡¶ãfa³ö©º}\98ÝHû\80\95º³~kw¶\ fÞÈz0å4\85\18ü\12\88\91²\\99\99s|úö\fjй"þÁeÌ wð÷ã§`\F¦|YX\18¦¶6Ôä\86û@Ï«k\16^\17ôg(\9bî»%içßJW\18àô¿C~÷l¥vÖþ|û½ä\99\rÓ*ë\8fY\\f\7fûî­e²ó4#¶@¯ns¶£\9b¥¬¦\1cöÿüPÿ\bü-\ 4h\f\bD¸l&\88\ 4£P\7f\0ß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Úí\92{<\94ù\1eÇC¨Ùl4®Yëa\97d\183îF§\8cÉ`å\12e0Â\98y0Ì<3Í%\84áTÖÝ*צu©\86R¬Êes©\90»Y\85\95R      ¹\1cÖý\92Rq&\9dö¼N{þÙ×þw^çyþy¾\9fïçùüÞÏ÷ùji¸¸éc)\f\7f\10Ï\808úh$\1a\ 3à\1c]M\ 14\12\ 5ÓÒ±@\12\87Ê\80\ e\92\ 6@[X \ 1,7\100D\ 1hS\8c\91\ 5\ 6e\b\83i\ 18\ 63\9cE\r\fâ\0:¸½\1f\f\0\96\ e²¨d\12\ 48\928A ]\14B&Ñ\07\ 6\99
+rÂ\91\0\80¥Ñ\0×\ f¯°\ 1W\90\r²N\80\14$\f\86F\ 3\14*\99\ 3ø\83\81T\b\ 1É\1e
+`\0f\1fe
+\97ù©u\ 2d±E\\80\8e\88s/ ¢¤0 Z8@\ 1\ 3`\ 6N\fÑi \88åOcý\17ªÏÃñ\\1aÍ\89Dÿ\10/\1aÓ\1fº$:\95\16þ¯>\83Îär@\16àÈ \80,ès+\ 1ü\88æ\bR¨\úç]{\ e\89F%c¡@\1a\b >JT6\9e\1a\ 6R\¨\1cr\10\10@¢±ÁM\1d\84(\9fC\88ƶ\89`@8Dð<\84ElþÐ\8f=\17\12\15â\1c gþ\9eúÁ¼Y£ÿ]\8b\86â\86\ 1D\14\12\85B\8b\8c¢ûÓÓ±Ïβ\81È\f
+\15
+\ 4Ü8$\88BbQ~\17þÈdmÍ\b\8bÐ\17í\8e¾¡\89h\81Ð\16F\80\99        *ê?\8dG!êq.h\7f\100A¡Pfæ\16\9b*\99Ëb\81\10gs    Dßû©\ e \8a¦\ 3\82\19váG\ 5ª\98¯\9e\1abÅo¹¾O\93PóË#\17Ø\9dÂ\99\1c\93W\ 5\8a\ fÚæ¿ I"û\83ãbC\\96\1fˬýæ\92\9cýZGý@üM\9e£eZý+\9fûáá»K\9e\ 6\11GV0¥)\13úÝðJ/q\83{³`rµ/±\1cQ`\12á#¹óù"¥\80ü»Ð¬¡Rõ¶¯\95w÷ ¥Ä\vq·ýqùhâXí\16\f¹Ï&Ôá\1c"×÷Õ\r\v\82+\87ß0\84GÑO\19Å®\1f]²Ò?\1aÝ[a\17äqKPY Dª.\8f\b
+&ììöY>86\1aÙ¬\rÃdE\960¯\&ÆWâ\14TÔ¶~S!å}\12·7.=9d¦Ô\92UJn<\9b\ 4y\ 1J6<\19§:ÀABý@KÃߢ®ì9\99Q#\96z>§üy|\8c\a\7f\13`\9f°´3-)ÓÍrà\f\ 1_ž~|\8a\0\16t;ã\\98<Û¶=dÉ[±ðÎáZ\99;Ú|·ã\17\ 6ðc¦AÇ^\84u\88᫪÷\9f\10wÿÙ1=×ɤr\82e>\7fèÜÞ\94÷ÝñëS¨!·Ù·\9d\95\ 6\80\(\ 2ó\93ÅJÌÑìÚ\86\7fÔr\ 5ø.1+Ôòâür~^\16rô¢øw\1cF±®©ÎSW&\eqdôÀØô\9a«ó.\9e¯0,5tÜ/Ç(øQô¨°c^Ë\90Õ÷"ü{\87å\9f\8d\1e\9e}\84Çur·\87Ä5~k@f\ f:¨ã¡ÒÓ\82\ff:¹®xëVÙB}O¤ñ¬\95\90ç³vN\12_ý÷k`&ü\92\83jl£ÆÅ8¢ÿÃÛy\84ËA\86ª1¸Â\e\19CfÙ~\ 2Ü#Ã\ 4\84|)]e@\98\1c¶Ý\10W\1a8~yÛ\18\14\12\84E\8e§Ý\94)\81\94\98qG
+d\ e¿Ë\8cpùò¶\18÷84ç wqîû\13òà\85Ù\ 3\b¶Êd\ 4ãÅ×ïÎD,u½T`°\16\95\ e\ f¤úV%$¨\8c\87ç\0½\83RÖýîC¹\8c\9f\9cçSz\a\aÐì{˵r«g··G=\93L8¹º}J\85\9fön6y´õr\ 3QYi\a¶Þq¤÷íÕ%ë¬bbê×)/Ù\17\94ö\1cøA/vR\9eä\8d^\93\19@i\8e7éH\84¶¾\93ìWR-c©¸\91\827\b\8d
\9aÍ\89¼Ò®\8d\ 5M\rú\esB­÷òû:¦\0áçT¯\r\8cÄ¢\16\13hYsê   \8b\92\ eͶ§|8=º_\8aç\93.á\{òÈu\8eÚ]vâ\13Ê\92Ð\®\1e¿ïW«3ö6Jâû&»Ê\98]åe\85\9c¶Ú¤ÐÓÙÒºðêîýxóKÍ\82)¨S8³u\97¾ú\86{ÝàÃ[B\9fâøSC¯ÅÆÁû§åÇ%\9eÞ,´l\1d)nóx\90´:ø\85[Çlú·ô¹f¯m-\ 3&í=½1Ãüu\87ýï_jr\85»s^]67j}\9a#\93·çXí@¨\92\9c ²©\a©\81\0mÔx\90~à'³¥æº\ eibGî°\94\1e6ôà\8bà¢f\1fN\aán¯tTVHlÑÁ¥©+SÄh\9cZcÕRÕó°DcUÛõô\8a2uI?¥S\93ú52¶ÒaѾÆÜ\1a.n¹Sw8¬]z\87ü #ÖÌ|Ä®Bm`úY\84\1aiêÞ=y\86wy\123m2ÒÅh¯á0Ü=(Nsçy\1fÿ\93ÎK:E\eZâ.\ 5êìÞ#¬ê_z<å'O¨4¥\16rT$ðU¡ÚGO½q²\86\92\151+
+´â\8e\98\87\v¬Âèø
+d\91¤{ÿWfE\98D\13ß ¾Î¡¥_\89\19Ⱦm\83¾Í\1f;[i+¾æáÁ[ݲªÜµÖ\8f÷v\95«\b\94½*£w\ fåj\94\99é\8b\13î\9e«.ù\ 6aÏg<\1d+»ÒN®*Ê5æry¾\1dÃÏ5\ 1çζ-\v×ù!ãM\89ÅÝN\eÃlw½FÐÊ0?Nö\9a¢\1e{]È\9by$$ùûëæ·´Ögk¨¼)\18Ì\80_±êæ*¦ÏÀl\7f\88*>\9bûã¶Ãp>¡sW\v»\15"ê­Èí0\85¿·1óò|\93\95EX÷îî"Ⱥ\vÆü¿\8b ØÞ\99Æn,ÅJ+i\89\ 5\13\93\ fã#Ï\a;íÛ}'!¸/çÌ>Ë\17µ)\ 4ØJQ_ñ\9ach\86ÍL\90ÇzG÷Dí2¥!/¯Ð)àü\82ÄévxÖ\1aa\8dîëº\ 5vUï\9cÍ !d×ëkýC§ï\aJåD$´f¦+\1f\95Nßí\14\b\9açùÝV7¹:-\7fëIZçî=Û'·éÖ#M\9aÛS\12n¶n(ÎÆD\18?\19Þï9gônÁ\9cÌ_¤¹©£þâ\ 5û\7fÀÿD\0\99\ 6\92X\1c\ 6\9dÄ
+\81Áþ    ç\ 3
+endstream
+endobj
+192 0 obj
+<<
+/Filter[/FlateDecode]
+/Length 270
+>>
+stream
+xÚUÌ¿JÄ@\10\ 6ðØn#\96V\99\17póçrYR-\9c\8a¦\10´º\a8ÅÊ"¢  .\96VÁ'¸g¹*¥¯à\11Áv\97k\12XvÜÙ`á\fü\86¯\98Oä9ÏsHy\9aÂ,åY\ 6GÓ)«\9cÏ+(\85àó\19\gÐ@Yæ¼\10\90ú\15©àeñÿcuÇ\165K\96P\14,9\87B°¤¾\80\87ûÇ\e\96,.\8f!óy\8aõ    D\11Ú(\9aì­Âom\9cÄ/= D£­\8a\ 6;2þ!÷{òÌ\90·\ 3¹²dc\95÷ÉIï\vƤZ{_e\eÚ:rÝ\93í\8eì\fÙ\ fäÎ6^ãÈÁe^«\ e¼N}\90òÍ\8bñ\86l·ä'}aèÄ~$Mp\f\ eAûLº\8aÄÉÃà»\1e$âF\8fÞ­\8eöþ4\1aý\8c\9a\9dÖìê\17Jãõ\8e
+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 (file)
index 0000000..d8cf097
--- /dev/null
@@ -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 (file)
index 0000000..0e2668c
--- /dev/null
@@ -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 (file)
index 0000000..768c86d
--- /dev/null
@@ -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 (file)
index 0000000..ce86d13
--- /dev/null
@@ -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 (file)
index 0000000..0bfc3db
--- /dev/null
@@ -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 (file)
index 0000000..e2112d6
--- /dev/null
@@ -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 (file)
index 0000000..a6c13e1
--- /dev/null
@@ -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<e → 0 < e/n.
+intros; elim n; [apply (lt_rewr ???? (div1 ??));assumption]
+unfold divide; elim (dg_prop G e (S n1)); simplify; simplify in f;
+apply (ltmul_lt ??? (S n1)); simplify; apply (lt_rewr ???? f);
+apply (lt_rewl ???? (zero_neutral ??)); 
+apply (lt_rewl ???? (zero_neutral ??)); 
+apply (lt_rewl ???? (mulzero ?n1));
+assumption;
+qed.
+
+lemma muleqplus_lt: ∀G:todgroup.∀x,y:G.∀n,m.
+   0<x → 0<y → S n * x ≈ S (n + S m) * y → y < x.
+intros (G x y n m H1 H2 H3); apply (ltmul_lt ??? n); apply (lt_rewr ???? H3);
+clear H3; elim m; [
+  rewrite > 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 (file)
index 0000000..2129aa5
--- /dev/null
@@ -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 (file)
index 0000000..d985ec2
--- /dev/null
@@ -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 (file)
index 0000000..5f1a062
--- /dev/null
@@ -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 (file)
index 0000000..21499ee
--- /dev/null
@@ -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<e *)
+apply (le_lt_transitive ???? main_ineq);
+apply (Lt≫ (e/2+e/2+e/2)); [apply (divpow ?e 2)]
+repeat (apply ltplus; try assumption);
+qed.
diff --git a/matita/dama/sequence.ma b/matita/dama/sequence.ma
new file mode 100644 (file)
index 0000000..9990f8c
--- /dev/null
@@ -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                  *)
+(*                                                                        *)
+(**************************************************************************)
+
+set "baseuri" "cic:/matita/sequence/".
+
+include "excess.ma".
+
+definition sequence := λO:excess.nat → O.
+
+definition fun_of_sequence: ∀O:excess.sequence O → nat → O.
+intros; apply s; assumption;
+qed.
+
+coercion cic:/matita/sequence/fun_of_sequence.con 1.
+
+definition upper_bound ≝ 
+  λO:excess.λa:sequence O.λu:O.∀n:nat.a n ≤ u.
+  
+definition lower_bound ≝ 
+  λO:excess.λa:sequence O.λu:O.∀n:nat.u ≤ a n.
+
+definition strong_sup ≝
+  λO:excess.λs:sequence O.λx.
+    upper_bound ? s x ∧ (∀y:O.x ≰ y → ∃n.s n ≰ y).
+  
+definition strong_inf ≝
+  λO:excess.λs:sequence O.λx.
+    lower_bound ? s x ∧ (∀y:O.y ≰ x → ∃n.y ≰ s n).
+
+definition weak_sup ≝
+  λO:excess.λs:sequence O.λx.
+    upper_bound ? s x ∧ (∀y:O.upper_bound ? s y → x ≤ y).
+  
+definition weak_inf ≝
+  λO:excess.λs:sequence O.λx.
+    lower_bound ? s x ∧ (∀y:O.lower_bound ? s y → y ≤ x).
+
+lemma strong_sup_is_weak: 
+  ∀O:excess.∀s:sequence O.∀x:O.strong_sup ? s x → weak_sup ? s x.
+intros (O s x Ssup); elim Ssup (Ubx M); clear Ssup; split; [assumption]
+intros 3 (y Uby E); cases (M ? E) (n En); unfold in Uby; cases (Uby ? En);
+qed.
+lemma strong_inf_is_weak: 
+  ∀O:excess.∀s:sequence O.∀x:O.strong_inf ? s x → weak_inf ? s x.
+intros (O s x Ssup); elim Ssup (Ubx M); clear Ssup; split; [assumption]
+intros 3 (y Uby E); cases (M ? E) (n En); unfold in Uby; cases (Uby ? En);
+qed.
+
+include "ordered_group.ma".
+include "nat/orders.ma".
+
+definition tends0 ≝ 
+  λO:pogroup.λs:sequence O.
+    ∀e:O.0 < e → ∃N.∀n.N < n → -e < s n ∧ s n < e.
+    
+definition increasing ≝ 
+  λO:excess.λa:sequence O.∀n:nat.a n ≤ a (S n).
+
+definition decreasing ≝ 
+  λO:excess.λa:sequence O.∀n:nat.a (S n) ≤ a n.
+
+
+
+
+(*
+
+definition is_upper_bound ≝ λO:excess.λa:sequence O.λu:O.∀n:nat.a n ≤ u.
+definition is_lower_bound ≝ λO:excess.λa:sequence O.λu:O.∀n:nat.u ≤ a n.
+
+record is_sup (O:excess) (a:sequence O) (u:O) : Prop ≝
+ { sup_upper_bound: is_upper_bound O a u; 
+   sup_least_upper_bound: ∀v:O. is_upper_bound O a v → u≤v
+ }.
+
+record is_inf (O:excess) (a:sequence O) (u:O) : Prop ≝
+ { inf_lower_bound: is_lower_bound O a u; 
+   inf_greatest_lower_bound: ∀v:O. is_lower_bound O a v → v≤u
+ }.
+
+record is_bounded_below (O:excess) (a:sequence O) : Type ≝
+ { ib_lower_bound: O;
+   ib_lower_bound_is_lower_bound: is_lower_bound ? a ib_lower_bound
+ }.
+
+record is_bounded_above (O:excess) (a:sequence O) : Type ≝
+ { ib_upper_bound: O;
+   ib_upper_bound_is_upper_bound: is_upper_bound ? a ib_upper_bound
+ }.
+
+record is_bounded (O:excess) (a:sequence O) : Type ≝
+ { ib_bounded_below:> 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 (file)
index 0000000..bed8ec6
--- /dev/null
@@ -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 (file)
index 0000000..9619b94
--- /dev/null
@@ -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 (file)
index 0000000..b451a0a
--- /dev/null
@@ -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 (file)
index 0000000..61952d1
--- /dev/null
@@ -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 (file)
index 0000000..ce86d13
--- /dev/null
@@ -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 (file)
index 0000000..966747c
--- /dev/null
@@ -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 (file)
index 0000000..66b64e5
--- /dev/null
@@ -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 (executable)
index 0000000..813b2af
--- /dev/null
@@ -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 (file)
index 0000000..3590348
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<dictionary>
+ <operator name="(" form="prefix" fence="true" stretchy="false" lspace="0em" rspace="0em"/>
+ <operator name="(" form="infix" fence="true" stretchy="false" lspace="0em" rspace="0em"/>
+ <operator name=")" form="postfix" fence="true" stretchy="false" lspace="0em" rspace="0em"/>
+ <operator name=")" form="infix" fence="true" stretchy="false" lspace="0em" rspace="0em"/>
+ <operator name="[" form="prefix" fence="true" stretchy="false" lspace="0em" rspace="0em"/>
+ <operator name="[" form="infix" fence="true" stretchy="false" lspace="0em" rspace="0em"/>
+ <operator name="]" form="postfix" fence="true" stretchy="false" lspace="0em" rspace="0em"/>
+ <operator name="]" form="infix" fence="true" stretchy="false" lspace="0em" rspace="0em"/>
+ <operator name="{" form="prefix" fence="true" stretchy="false" lspace="0em" rspace="0em"/>
+ <operator name="{" form="infix" fence="true" stretchy="false" lspace="0em" rspace="0em"/>
+ <operator name="}" form="postfix" fence="true" stretchy="false" lspace="0em" rspace="0em"/>
+ <operator name="}" form="infix" fence="true" stretchy="false" lspace="0em" rspace="0em"/>
+</dictionary>
diff --git a/matita/dist/BUGS b/matita/dist/BUGS
new file mode 100644 (file)
index 0000000..6a6bbb6
--- /dev/null
@@ -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 (file)
index 0000000..b7b5f53
--- /dev/null
@@ -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.
+\f
+                   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.)
+\f
+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.
+\f
+  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.
+\f
+  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
+\f
+           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.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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.
+
+  <signature of Ty Coon>, 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 (file)
index 0000000..a8d380a
--- /dev/null
@@ -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 (file)
index 0000000..dfec3e1
--- /dev/null
@@ -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 (file)
index 0000000..33aeac7
--- /dev/null
@@ -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 (file)
index 0000000..a27350d
--- /dev/null
@@ -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 (file)
index 0000000..cae098b
--- /dev/null
@@ -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 (executable)
index 0000000..1ae28d3
--- /dev/null
@@ -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 (file)
index 0000000..5a02bb3
--- /dev/null
@@ -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 (file)
index 0000000..8b1d576
--- /dev/null
@@ -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 (file)
index 0000000..e6d4c40
--- /dev/null
@@ -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 (file)
index 0000000..54eaea4
--- /dev/null
@@ -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 (file)
index 0000000..d44c08d
--- /dev/null
@@ -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 (file)
index 0000000..f762adb
--- /dev/null
@@ -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 (file)
index 0000000..5935eaa
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<math-engine-configuration>
+  <section name="dictionary">
+    <key name="path">@RT_BASE_DIR@/dictionary-matita.xml</key>
+  </section>
+<!--
+  <section name="gtk-backend">
+    <section name="pango-default-shaper">
+      <section name="variants">
+        <section name="italic">
+          <key name="style">normal</key>
+        </section>
+      </section>
+    </section>
+  </section>
+-->
+<!--
+  <section name="gtk-backend">
+    <section name="pango-default-shaper">
+      <section name="variants">
+       <section name="normal">
+         <key name="family">courier</key>
+       </section>
+       <section name="italic">
+         <key name="family">courier</key>
+       </section>
+      </section>
+    </section>
+  </section>
+-->
+</math-engine-configuration>
diff --git a/matita/help/C/Makefile b/matita/help/C/Makefile
new file mode 100644 (file)
index 0000000..491bae6
--- /dev/null
@@ -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 (file)
index 0000000..73c4146
--- /dev/null
@@ -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 (file)
index 0000000..2d09883
--- /dev/null
@@ -0,0 +1,71 @@
+<table frame="topbot" rowsep="0" colsep="0" role="grammar">
+  <title>tactics</title>
+  <tgroup cols="3">
+    <tbody>
+      <row>
+        <entry id="grammar.declarative_tactic">&tactic;</entry>
+        <entry>::=</entry>
+        <entry><emphasis role="bold">we need to prove</emphasis> <emphasis><link linkend="grammar.term">term</link></emphasis> </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><emphasis role="bold">we proceed by induction on</emphasis> <emphasis><link linkend="grammar.term">term</link></emphasis> <emphasis role="bold"> to prove </emphasis> <emphasis><link linkend="grammar.term">term</link></emphasis> </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_assume"><emphasis role="bold">assume</emphasis></link> <emphasis><link linkend="grammar.id">id</link></emphasis> <emphasis role="bold"> : </emphasis> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><emphasis role="bold">by</emphasis> <emphasis><link linkend="grammar.term">term</link></emphasis> <emphasis role="bold"> done </emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><emphasis role="bold">by induction hypothesis we know</emphasis> <emphasis><link linkend="grammar.term">term</link></emphasis> <emphasis role="bold"> (</emphasis> <emphasis><link linkend="grammar.id">id</link></emphasis> <emphasis role="bold">)</emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><emphasis role="bold">by</emphasis> <emphasis><link linkend="grammar.term">term</link></emphasis> <emphasis role="bold">we proved</emphasis> <emphasis><link linkend="grammar.term">term</link></emphasis> 
+                  <emphasis role="bold">(</emphasis> <emphasis><link linkend="grammar.id">id</link></emphasis> <emphasis role="bold">)</emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_case"><emphasis role="bold">case</emphasis></link> <emphasis><link linkend="grammar.id">id</link></emphasis> <emphasis role="bold">(</emphasis> <emphasis><link linkend="grammar.id">id</link></emphasis> <emphasis role="bold">:</emphasis> <emphasis><link linkend="grammar.term">term</link></emphasis> <emphasis role="bold">)</emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><emphasis role="bold">by</emphasis> <emphasis><link linkend="grammar.term">term</link></emphasis> <emphasis role="bold">let</emphasis> <emphasis><link linkend="grammar.id">id</link></emphasis> 
+                   <emphasis role="bold">:</emphasis> <emphasis><link linkend="grammar.term">term</link></emphasis> <emphasis role="bold">such that</emphasis> <emphasis><link linkend="grammar.term">term</link></emphasis> 
+                    <emphasis role="bold">(</emphasis> <emphasis><link linkend="grammar.id">id</link></emphasis> <emphasis role="bold">)</emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>[<emphasis role="bold">obtain</emphasis> <emphasis><link linkend="grammar.id">id</link></emphasis> | <emphasis role="bold">conclude</emphasis> <emphasis><link linkend="grammar.term">term</link></emphasis>] <emphasis role="bold">=</emphasis> <emphasis><link linkend="grammar.term">term</link></emphasis> <emphasis role="bold">by</emphasis> [ <emphasis><link linkend="grammar.term">term</link></emphasis> | <emphasis role="bold">_</emphasis> [<emphasis role="bold">(</emphasis><emphasis><link linkend="grammar.autoparams">auto_params</link></emphasis><emphasis role="bold">)</emphasis>]] [<emphasis role="bold">done</emphasis>]</entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_suppose"><emphasis role="bold">suppose</emphasis></link> <emphasis><link linkend="grammar.term">term</link></emphasis> <emphasis role="bold"> (</emphasis> <emphasis><link linkend="grammar.id">id</link></emphasis> 
+            <emphasis role="bold">) </emphasis> [ that is equivalent to  <emphasis><link linkend="grammar.term">term</link></emphasis> ]</entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><emphasis role="bold">the thesis becomes</emphasis> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis> </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><emphasis role="bold">we proceed by cases on </emphasis> <emphasis><link linkend="grammar.term">term</link></emphasis> <emphasis role="bold">to prove</emphasis> <emphasis><link linkend="grammar.term">term</link></emphasis> </entry>
+      </row>
+    </tbody>
+  </tgroup>
+</table>
diff --git a/matita/help/C/docbook.css b/matita/help/C/docbook.css
new file mode 100644 (file)
index 0000000..a6ea52f
--- /dev/null
@@ -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 (file)
index 0000000..652ea01
Binary files /dev/null and b/matita/help/C/figures/database.dia differ
diff --git a/matita/help/C/figures/database.png b/matita/help/C/figures/database.png
new file mode 100644 (file)
index 0000000..7e9b1ca
Binary files /dev/null and b/matita/help/C/figures/database.png differ
diff --git a/matita/help/C/figures/developments.png b/matita/help/C/figures/developments.png
new file mode 100644 (file)
index 0000000..f724589
Binary files /dev/null and b/matita/help/C/figures/developments.png differ
diff --git a/matita/help/C/legal.xml b/matita/help/C/legal.xml
new file mode 100644 (file)
index 0000000..115ae00
--- /dev/null
@@ -0,0 +1,20 @@
+<para> 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. </para>
+
+<para> HELM is free software; you can redistribute it and/or modify it under
+  the terms of the GNU General Public License as published by the Free Software
+  Foundation; either version 2 of the License, or (at your option) any later
+  version.  </para>
+
+<para> HELM is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+  A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+</para>
+
+<para> 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 <ulink
+    url="http://www.gnu.org/copyleft/gpl.html">this link</ulink>. </para>
+
diff --git a/matita/help/C/matita.xml b/matita/help/C/matita.xml
new file mode 100644 (file)
index 0000000..30d37b3
--- /dev/null
@@ -0,0 +1,180 @@
+<?xml version="1.0"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
+"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
+
+  <!ENTITY legal SYSTEM "legal.xml">
+  <!ENTITY license SYSTEM "sec_license.xml">
+  <!ENTITY install SYSTEM "sec_install.xml">
+  <!ENTITY gettingstarted SYSTEM "sec_gettingstarted.xml">
+  <!ENTITY intro SYSTEM "sec_intro.xml">
+  <!ENTITY terms SYSTEM "sec_terms.xml">
+  <!ENTITY tacticals SYSTEM "sec_tacticals.xml">
+  <!ENTITY tactics SYSTEM "sec_tactics.xml">
+  <!ENTITY declarative_tactics SYSTEM "sec_declarative_tactics.xml">
+  <!ENTITY othercommands SYSTEM "sec_commands.xml">
+  <!ENTITY usernotation SYSTEM "sec_usernotation.xml">
+
+  <!ENTITY tacticref SYSTEM "tactics_quickref.xml">
+  <!ENTITY declarativetacticref SYSTEM "declarative_tactics_quickref.xml">
+
+  <!ENTITY manrevision "1&alpha;">
+  <!ENTITY date "12/07/2006">
+  <!ENTITY app "<application>Matita</application>">
+  <!ENTITY appname "Matita">
+  <!ENTITY appversion SYSTEM "version.txt">
+
+  <!ENTITY TODO "<emphasis>TODO</emphasis>">
+  <!ENTITY MYSQL "<application> <ulink type='http'
+      url='http://www.mysql.com'>MySQL</ulink> </application>">
+  <!ENTITY Sqlite "<application> <ulink type='http'
+      url='http://www.sqlite.org'>Sqlite</ulink> </application>">
+
+  <!-- Entities for BNF -->
+  <!ENTITY id "<emphasis><link linkend='grammar.id'>id</link></emphasis>">
+  <!ENTITY uri "<emphasis><link linkend='grammar.uri'>uri</link></emphasis>">
+  <!ENTITY char "<emphasis><link linkend='grammar.char'>char</link></emphasis>">
+  <!ENTITY uri-step "<emphasis><link linkend='grammar.uri-step'>uri-step</link></emphasis>">
+  <!ENTITY nat "<emphasis><link linkend='grammar.nat'>nat</link></emphasis>">
+  <!ENTITY term "<emphasis><link linkend='grammar.term'>term</link></emphasis>">
+  <!ENTITY rec_def "<emphasis><link linkend='grammar.rec_def'>rec_def</link></emphasis>">
+  <!ENTITY match_pattern "<emphasis><link linkend='grammar.match_pattern'>match_pattern</link></emphasis>">
+  <!ENTITY match_branch "<emphasis><link linkend='grammar.match_branch'>match_branch</link></emphasis>">
+  <!ENTITY args "<emphasis><link linkend='grammar.args'>args</link></emphasis>">
+  <!ENTITY args2 "<emphasis><link linkend='grammar.args2'>args2</link></emphasis>">
+  <!ENTITY sterm "<emphasis><link linkend='grammar.sterm'>sterm</link></emphasis>">
+  <!ENTITY intros-spec "<emphasis><link linkend='grammar.intros-spec'>intros-spec</link></emphasis>">
+  <!ENTITY pattern "<emphasis><link linkend='grammar.pattern'>pattern</link></emphasis>">
+  <!ENTITY reduction-kind "<emphasis><link linkend='grammar.reduction-kind'>reduction-kind</link></emphasis>">
+  <!ENTITY path "<emphasis><link linkend='grammar.path'>path</link></emphasis>">
+  <!ENTITY proofscript "<emphasis><link linkend='grammar.proofscript'>proof-script</link></emphasis>">
+  <!ENTITY proofstep "<emphasis><link linkend='grammar.proofstep'>proof-step</link></emphasis>">
+  <!ENTITY tactic "<emphasis><link linkend='grammar.tactic'>tactic</link></emphasis>">
+  <!ENTITY LCFtactical "<emphasis><link linkend='grammar.LCFtactical'>LCF-tactical</link></emphasis>">
+  <!ENTITY qstring "<emphasis><link linkend='grammar.qstring'>qstring</link></emphasis>">
+  <!ENTITY interpretation "<emphasis><link linkend='grammar.interpretation'>interpretation</link></emphasis>">
+  <!ENTITY autoparams "<emphasis><link linkend='grammar.autoparams'>auto_params</link></emphasis>">
+]>
+
+<?yelp:chunk-depth 3?>
+
+<book id="matita_manual" lang="en">
+
+  <title>&app; V&appversion; User Manual (rev. &manrevision;)</title>
+
+  <bookinfo>
+
+    <copyright>
+      <year>2006</year>
+      <holder>The HELM team.</holder>
+    </copyright>
+
+    <authorgroup> 
+      <author> 
+       <firstname>Andrea</firstname> 
+       <surname>Asperti</surname> 
+       <affiliation> 
+         <address> <email>asperti@cs.unibo.it</email> </address> 
+       </affiliation> 
+      </author> 
+      <author> 
+       <firstname>Claudio</firstname> 
+       <surname>Sacerdoti Coen</surname> 
+       <affiliation> 
+         <address> <email>sacerdot@cs.unibo.it</email> </address> 
+       </affiliation> 
+      </author> 
+      <author> 
+       <firstname>Ferruccio</firstname> 
+       <surname>Guidi</surname> 
+       <affiliation> 
+         <address> <email>fguidi@cs.unibo.it</email> </address> 
+       </affiliation> 
+      </author>       
+      <author> 
+       <firstname>Enrico</firstname> 
+       <surname>Tassi</surname> 
+       <affiliation> 
+         <address> <email>tassi@cs.unibo.it</email> </address> 
+       </affiliation> 
+      </author> 
+      <author> 
+       <firstname>Stefano</firstname> 
+       <surname>Zacchiroli</surname> 
+       <affiliation> 
+         <address> <email>zacchiro@cs.unibo.it</email> </address> 
+       </affiliation> 
+      </author>
+    </authorgroup>
+
+    <legalnotice>
+      <para> 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 <xref
+         linkend="sec_license" /> for more information. </para>
+    </legalnotice>
+
+    <revhistory>
+      <revision>
+       <revnumber>&manrevision;</revnumber>
+       <date>&date;</date>
+      </revision>
+    </revhistory>
+
+  </bookinfo>
+
+<!-- ============= Document Body ============================= -->
+
+&intro;
+&install;
+&gettingstarted;
+&terms;
+&usernotation;
+&tacticals;
+&tactics;
+&declarative_tactics;
+&othercommands;
+&license;
+
+</book>
+
+<!-- CSC: valid element tags
+<sect1 id="intro"> <title>Introduction</title> ...
+<sect2 id="what"> <title>What is Matita?</title>
+<para>
+<note> <title>Note:</title> <para> ...
+<footnote> <para> ...
+<itemizedlist mark="opencircle">
+    <listitem>
+     <para>
+       The computer player for Iagno is easy to beat.
+     </para>
+    </listitem>
+ </itemizedlist>
+
+<ulink type="http" url="http://www.gnome.org/gdp">
+<email>itp@gnu.org</email>
+<application>Matita</application>
+<command>iagno</command> on the command line
+<citetitle>Othello</citetitle>
+
+<guimenuitem>Iagno</guimenuitem>
+<guisubmenu>Games</guisubmenu>
+<guibutton>none</guibutton>
+<menuchoice> <guimenu>Settings</guimenu> <guisubmenu>Preferences </guisubmenu> </menuchoice>
+
+<xref linkend="start-shot"/>. 
+<figure id="start-shot">
+ <title>Starting Position</title>
+ <screenshot>
+   <mediaobject> 
+   <imageobject>
+ <imagedata fileref="figures/START.png" format="PNG" srccredit="Eric Baudais"/>
+  </imageobject>
+   <textobject> 
+     <phrase>Screenshot of the starting position.</phrase> 
+   </textobject> 
+ </mediaobject>
+ </screenshot>
+</figure>
+
+-->
diff --git a/matita/help/C/sec_commands.xml b/matita/help/C/sec_commands.xml
new file mode 100644 (file)
index 0000000..5e55de9
--- /dev/null
@@ -0,0 +1,374 @@
+
+<!-- ============ Commands ====================== -->
+<chapter id="sec_commands">
+ <title>Other commands</title>
+ <sect1 id="command_alias">
+   <title>alias</title>
+   <para><userinput>alias id &quot;s&quot; = &quot;def&quot;</userinput></para>
+   <para><userinput>alias symbol &quot;s&quot; (instance n) = &quot;def&quot;</userinput></para>
+   <para><userinput>alias num (instance n) = &quot;def&quot;</userinput></para>
+   <para>
+     <variablelist>
+       <varlistentry>
+         <term>Synopsis:</term>
+         <listitem>
+           <para><emphasis role="bold">alias</emphasis>
+            [<emphasis role="bold">id</emphasis> &qstring; <emphasis role="bold">=</emphasis> &qstring;
+            | <emphasis role="bold">symbol</emphasis> &qstring; [<emphasis role="bold">(instance</emphasis> &nat;<emphasis role="bold">)</emphasis>] <emphasis role="bold">=</emphasis> &qstring;
+            | <emphasis role="bold">num</emphasis> [<emphasis role="bold">(instance</emphasis> &nat;<emphasis role="bold">)</emphasis>] <emphasis role="bold">=</emphasis> &qstring;
+            ]
+           </para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>Action:</term>
+         <listitem>
+           <para>Used to give an hint to the disambiguating parser.
+            When the parser is faced to the identifier (or symbol)
+            <command>s</command> or to any number, it will prefer
+            interpretations that &quot;map <command>s</command> (or the
+            number) to <command>def</command>&quot;. For identifiers,
+            &quot;def&quot; is the URI of the interpretation.
+            E.g.: <command>cic:/matita/nat/nat.ind#xpointer(1/1/1)</command>
+            for the first constructor of the first inductive type defined
+            in the block of inductive type(s)
+            <command>cic:/matita/nat/nat.ind</command>.
+            For symbols and numbers, &quot;def&quot; is the label used to
+            mark the wanted
+            <link linkend="interpretation">interpretation</link>.
+           </para>
+          <para>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 <command>n</command>. When the instance is omitted,
+           the hint is valid for every occurrence.
+          </para>
+          <para>
+           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.</para>
+         </listitem>
+       </varlistentry>
+     </variablelist>
+   </para>
+ </sect1>
+ <sect1 id="command_check">
+   <title>check</title>
+   <para><userinput>check t</userinput></para>
+   <para>
+     <variablelist>
+       <varlistentry>
+         <term>Synopsis:</term>
+         <listitem>
+           <para><emphasis role="bold">check</emphasis> &term;</para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>Action:</term>
+         <listitem>
+           <para>Opens a CIC browser window that shows <command>t</command>
+            together with its type. The command is immediately removed from
+            the script.</para>
+         </listitem>
+       </varlistentry>
+     </variablelist>
+   </para>
+ </sect1>
+ <sect1 id="command_coercion">
+   <title>coercion</title>
+   <para><userinput>coercion u</userinput></para>
+   <para>
+     <variablelist>
+       <varlistentry>
+         <term>Synopsis:</term>
+         <listitem>
+           <para><emphasis role="bold">coercion</emphasis> &uri;</para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>Action:</term>
+         <listitem>
+           <para>Declares <command>u</command> as an implicit coercion
+            from the type of its last argument (source)
+            to its codomain (target). Every time a term <command>x</command>
+            of type source is used with expected type target, Matita
+            automatically replaces <command>x</command> with
+            <command>(u ? … ? x)</command> to avoid a typing error.</para>
+           <para>Implicit coercions are not displayed to the user:
+            <command>(u ? … ? x)</command> is rendered simply
+            as <command>x</command>.</para>
+           <para>When a coercion <command>u</command> is declared
+            from source <command>s</command> to target <command>t</command>
+            and there is already a coercion <command>u'</command> of
+            target <command>s</command> or source <command>t</command>,
+            a composite implicit coercion is automatically computed
+            by Matita.</para>
+         </listitem>
+       </varlistentry>
+     </variablelist>
+   </para>
+ </sect1>
+ <sect1 id="command_default">
+   <title>default</title>
+   <para><userinput>default &quot;s&quot; u<subscript>1</subscript> … u<subscript>n</subscript></userinput></para>
+   <para>
+     <variablelist>
+       <varlistentry>
+         <term>Synopsis:</term>
+         <listitem>
+           <para><emphasis role="bold">default</emphasis>
+            &qstring; &uri; [&uri;]…
+           </para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>Action:</term>
+         <listitem>
+           <para>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.</para>
+           <para>
+            <command>s</command> is an identifier of the cluster and
+            <command>u<subscript>1</subscript> … u<subscript>n</subscript></command>
+            are the URIs of the definitions and theorems of the cluster.
+            The number <command>n</command> of required URIs depends on the
+            cluster. The following clusters are supported.
+           </para>
+           <table>
+            <title>clusters</title>
+            <tgroup cols="6">
+            <thead>
+             <row>
+              <entry>name</entry>
+              <entry>expected object for 1st URI</entry>
+              <entry>expected object for 2nd URI</entry>
+              <entry>expected object for 3rd URI</entry>
+              <entry>expected object for 4th URI</entry>
+              <entry>expected object for 5th URI</entry>
+              <entry>expected object for 6th URI</entry>
+              <entry>expected object for 7th URI</entry>
+              <entry>expected object for 8th URI</entry>
+              <entry>expected object for 9th URI</entry>
+              <entry>expected object for 10th URI</entry>
+              <entry>expected object for 11th URI</entry>
+             </row>
+            </thead>
+            <tbody>
+             <row>
+              <entry>equality</entry>
+              <entry>an inductive type (say, of type <command>eq</command>) of type ∀A:Type.A <emphasis role="bold">→</emphasis> <emphasis role="bold">Prop</emphasis> with one family parameter and one constructor of type ∀x:A.eq A x</entry>
+              <entry>a theorem of type <emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>x,y:A.eq A x y <emphasis role="bold">→</emphasis> eq A y x</entry>
+              <entry>a theorem of type <emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>x,y,z:A.eq A x y <emphasis role="bold">→</emphasis> eq A y z <emphasis role="bold">→</emphasis> eq A x z</entry>
+              <entry><emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>a.<emphasis role="bold">∀</emphasis> P:A <emphasis role="bold">→</emphasis> <emphasis role="bold">Prop</emphasis>.P x <emphasis role="bold">→</emphasis> <emphasis role="bold">∀</emphasis>y.eq A x y <emphasis role="bold">→</emphasis> P y</entry>
+              <entry><emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>a.<emphasis role="bold">∀</emphasis> P:A <emphasis role="bold">→</emphasis> <emphasis role="bold">Prop</emphasis>.P x <emphasis role="bold">→</emphasis> <emphasis role="bold">∀</emphasis>y.eq A y x <emphasis role="bold">→</emphasis> P y</entry>
+              <entry><emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>a.<emphasis role="bold">∀</emphasis> P:A <emphasis role="bold">→</emphasis> <emphasis role="bold">Set</emphasis>.P x <emphasis role="bold">→</emphasis> <emphasis role="bold">∀</emphasis>y.eq A x y <emphasis role="bold">→</emphasis> P y</entry>
+              <entry><emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>a.<emphasis role="bold">∀</emphasis> P:A <emphasis role="bold">→</emphasis> <emphasis role="bold">Set</emphasis>.P x <emphasis role="bold">→</emphasis> <emphasis role="bold">∀</emphasis>y.eq A y x <emphasis role="bold">→</emphasis> P y</entry>
+              <entry><emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>a.<emphasis role="bold">∀</emphasis> P:A <emphasis role="bold">→</emphasis> <emphasis role="bold">Type</emphasis>.P x <emphasis role="bold">→</emphasis> <emphasis role="bold">∀</emphasis>y.eq A x y <emphasis role="bold">→</emphasis> P y</entry>
+              <entry><emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>a.<emphasis role="bold">∀</emphasis> P:A <emphasis role="bold">→</emphasis> <emphasis role="bold">Type</emphasis>.P x <emphasis role="bold">→</emphasis> <emphasis role="bold">∀</emphasis>y.eq A y x <emphasis role="bold">→</emphasis> P y</entry>
+              <entry><emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>B.<emphasis role="bold">∀</emphasis> f:A <emphasis role="bold">→</emphasis> B.<emphasis role="bold">∀</emphasis>x,y:A.eq A x y <emphasis role="bold">→</emphasis> eq B (f x) (f y)</entry>
+              <entry><emphasis role="bold">∀</emphasis>A.<emphasis role="bold">∀</emphasis>B.<emphasis role="bold">∀</emphasis> f:A <emphasis role="bold">→</emphasis> B.<emphasis role="bold">∀</emphasis>x,y:A.eq A x y <emphasis role="bold">→</emphasis> eq B (f y) (f x)</entry>
+             </row>
+             <row>
+              <entry>true</entry>
+              <entry>an inductive type of type <emphasis role="bold">Prop</emphasis> with only one constructor that has no arguments</entry>
+              <entry/>
+              <entry/>
+              <entry/>
+              <entry/>
+             </row>
+             <row>
+              <entry>false</entry>
+              <entry>an inductive type of type <emphasis role="bold">Prop</emphasis> without constructors</entry>
+              <entry/>
+              <entry/>
+              <entry/>
+              <entry/>
+             </row>
+             <row>
+              <entry>absurd</entry>
+              <entry>a theorem of type <emphasis role="bold">∀</emphasis>A:Prop.<emphasis role="bold">∀</emphasis>B:Prop.A <emphasis role="bold">→</emphasis> Not A <emphasis role="bold">→</emphasis> B</entry>
+              <entry/>
+              <entry/>
+              <entry/>
+              <entry/>
+             </row>
+            </tbody>
+            </tgroup>
+           </table>
+         </listitem>
+       </varlistentry>
+     </variablelist>
+   </para>
+ </sect1>
+ <sect1 id="command_hint">
+   <title>hint</title>
+   <para><userinput>hint</userinput></para>
+   <para>
+     <variablelist>
+       <varlistentry>
+         <term>Synopsis:</term>
+         <listitem>
+           <para><emphasis role="bold">hint</emphasis>
+           </para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>Action:</term>
+         <listitem>
+           <para>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.
+           </para>
+         </listitem>
+       </varlistentry>
+     </variablelist>
+   </para>
+ </sect1>
+ <sect1 id="command_include">
+   <title>include</title>
+   <para><userinput>include &quot;s&quot;</userinput></para>
+   <para>
+     <variablelist>
+       <varlistentry>
+         <term>Synopsis:</term>
+         <listitem>
+           <para><emphasis role="bold">include</emphasis> &qstring;</para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>Action:</term>
+         <listitem>
+           <para>Every <link linkend="command_coercion">coercion</link>,
+            <link linkend="notation">notation</link> and
+            <link linkend="interpretation">interpretation</link> that was active
+            when the file <command>s</command> was compiled last time
+            is made active. The same happens for declarations of
+            <link linkend="command_default">default definitions and
+            theorems</link> and disambiguation
+            hints (<link linkend="command_alias">aliases</link>).
+            On the contrary, theorem and definitions declared in a file can be
+           immediately used without including it.</para>
+          <para>The file <command>s</command> is automatically compiled
+           if it is not compiled yet and if it is handled by a
+           <link linkend="developments">development</link>.
+          </para>
+         </listitem>
+       </varlistentry>
+     </variablelist>
+   </para>
+ </sect1>
+ <sect1 id="command_include_first">
+   <title>include' &quot;s&quot;</title>
+   <para><userinput></userinput></para>
+   <para>
+     <variablelist>
+       <varlistentry>
+         <term>Synopsis:</term>
+         <listitem>
+           <para><emphasis role="bold">include'</emphasis> &qstring;</para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>Action:</term>
+         <listitem>
+           <para>Not documented (&TODO;), do not use it.</para>
+         </listitem>
+       </varlistentry>
+     </variablelist>
+   </para>
+ </sect1>
+ <sect1 id="command_set">
+   <title>set</title>
+   <para><userinput>set &quot;baseuri&quot; &quot;s&quot;</userinput></para>
+   <para>
+     <variablelist>
+       <varlistentry>
+         <term>Synopsis:</term>
+         <listitem>
+           <para><emphasis role="bold">set</emphasis> &qstring; &qstring;</para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>Action:</term>
+         <listitem>
+           <para>Sets to <command>s</command> the baseuri of all the
+            theorems and definitions stated in the current file.
+            The baseuri should be <command>a/b/c/foo</command>
+            if the file is named <command>foo</command> and it is in
+            the subtree <command>a/b/c</command> of the current
+            <link linkend="developments">development</link>.
+            This requirement is not enforced, but it could be in the future.
+           </para>
+           <para>Currently, <command>baseuri</command> is the only
+            property that can be set even if the parser accepts
+            arbitrary property names.</para>
+         </listitem>
+       </varlistentry>
+     </variablelist>
+   </para>
+ </sect1>
+ <sect1 id="command_whelp">
+   <title>whelp</title>
+   <para><userinput>whelp locate &quot;s&quot;</userinput></para>
+   <para><userinput>whelp hint t</userinput></para>
+   <para><userinput>whelp elim t</userinput></para>
+   <para><userinput>whelp match t</userinput></para>
+   <para><userinput>whelp instance t</userinput></para>
+   <para>
+     <variablelist>
+       <varlistentry>
+         <term>Synopsis:</term>
+         <listitem>
+           <para><emphasis role="bold">whelp</emphasis>
+            [<emphasis role="bold">locate</emphasis> &qstring;
+            | <emphasis role="bold">hint</emphasis> &term;
+            | <emphasis role="bold">elim</emphasis> &term;
+            | <emphasis role="bold">match</emphasis> &term;
+            | <emphasis role="bold">instance</emphasis> &term;
+            ]
+           </para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>Action:</term>
+         <listitem>
+           <para>Performs the corresponding <link linkend="whelp">query</link>,
+            showing the result in the CIC browser. The command is removed
+            from the script.
+           </para>
+         </listitem>
+       </varlistentry>
+     </variablelist>
+   </para>
+ </sect1>
+ <sect1 id="command_qed">
+   <title>qed</title>
+   <para><userinput></userinput></para>
+   <para>
+     <variablelist>
+       <varlistentry>
+         <term>Synopsis:</term>
+         <listitem>
+           <para><emphasis role="bold">qed</emphasis>
+           </para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>Action:</term>
+         <listitem>
+           <para>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.</para>
+         </listitem>
+       </varlistentry>
+     </variablelist>
+   </para>
+ </sect1>
+</chapter>
+
diff --git a/matita/help/C/sec_declarative_tactics.xml b/matita/help/C/sec_declarative_tactics.xml
new file mode 100644 (file)
index 0000000..b8b8777
--- /dev/null
@@ -0,0 +1,471 @@
+<!-- ================= Tactics ========================= -->
+<chapter id="sec_declarative_tactics">
+  <title>Declarative Tactics</title>
+
+  <sect1
+  id="declarative_tactics_quickref">
+    <title>Quick reference card</title>
+    <para>
+      &declarativetacticref;
+    </para>
+  </sect1>
+
+  
+  <sect1 id="tac_assume">
+    <title>assume</title>
+    <titleabbrev>assume</titleabbrev>
+    <para><userinput>assume x : t</userinput></para>
+  <para>
+    <variablelist>
+      <varlistentry role="tactic.synopsis">
+       <term>Synopsis:</term>
+       <listitem>
+         <para><emphasis role="bold">assume</emphasis> &id; <emphasis role="bold"> : </emphasis> &sterm;</para>
+       </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>Pre-conditions:</term>
+       <listitem>
+         <para>The conclusion of the current proof must be
+          <command>∀x:T.P</command> or
+          <command>T→P</command> where <command>T</command> is
+          a data type (i.e. <command>T</command> has type
+          <command>Set</command> or <command>Type</command>).</para>
+       </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>Action:</term>
+       <listitem>
+         <para>It adds to the context of the current sequent to prove a new
+          declaration <command>x : T </command>. The new conclusion becomes
+          <command>P</command>.</para>
+       </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>New sequents to prove:</term>
+       <listitem>
+         <para>None.</para>
+       </listitem>
+      </varlistentry>
+    </variablelist>
+   </para>
+  </sect1>
+
+  <sect1 id="tac_suppose">
+    <title>suppose</title>
+    <titleabbrev>suppose</titleabbrev>
+    <para><userinput>suppose t(x) </userinput></para>
+  <para>
+     <variablelist>
+       <varlistentry role="tactic.synopsis">
+         <term>Synopsis:</term>
+        <listitem>
+          <para><emphasis role="bold">suppose</emphasis> &term; <emphasis role="bold"> (</emphasis> &id; 
+            <emphasis role="bold">) </emphasis> [ that is equivalent to  &term; ]</para>
+        </listitem>
+       </varlistentry>
+      <varlistentry>
+         <term>Pre-condition:</term>
+        <listitem>
+          <para> Da Fare </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>Action:</term>
+         <listitem>
+           <para> Da Fare </para>
+         </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term>New sequents to prove:</term>
+        <listitem>
+            <para>None.</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+   </para>
+  </sect1>
+
+ <sect1 id="tac_bydone">
+   <title>by done</title>
+   <titleabbrev>by done</titleabbrev>
+   <para><userinput>by [ t | _ ] done</userinput></para>
+   <para>
+     <variablelist>
+       <varlistentry role="tactic.synopsis">
+         <term>Synopsis:</term>
+        <listitem>
+          <para><emphasis role="bold">by</emphasis> &term; <emphasis role="bold"> done </emphasis></para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>Pre-condition:</term>
+        <listitem>
+          <para>The term can be omitted with a "_", the running term will come found automatically. </para>
+        </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>Action:</term>
+          <listitem> 
+            <para>It closes the current sequent by applying <command>t</command>, taht it can be one under proof or the main proof.</para>
+          </listitem>
+       </varlistentry>
+       <varlistentry>
+           <term>New sequents to prove:</term>
+           <listitem>
+               <para>None.</para>
+           </listitem>
+       </varlistentry>
+   </variablelist>
+     </para>
+  </sect1>
+
+  <sect1 id="tac_weneedtoprove">
+    <title> we need to prove</title>
+    <titleabbrev>we need to prove</titleabbrev>
+    <para><userinput>we need to prove t [(id)] [or equivalent t]</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+         <term>Synopsis:</term>
+         <listitem>
+            <para><emphasis role="bold">we need to prove</emphasis> &term; </para>
+         </listitem>
+       </varlistentry>
+        <varlistentry>
+          <term>Pre-condition:</term>
+         <listitem>
+           <para> Da Fare </para>
+         </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+           <listitem>
+             <para> Da Fare </para>
+           </listitem>
+        </varlistentry>
+        <varlistentry>
+           <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+       </varlistentry>     
+     </variablelist>
+    </para>
+  </sect1>
+
+  <sect1 id="tac_weproceedbyinduction">
+    <title> we proceed by induction</title>
+    <titleabbrev>we proceed by induction</titleabbrev>
+    <para><userinput>we proceed by induction on t to prove th</userinput></para>        
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+         <term>Synopsis:</term>
+         <listitem>
+           <para><emphasis role="bold">we proceed by induction on</emphasis> &term; <emphasis role="bold"> to prove </emphasis> &term; </para>
+         </listitem>
+       </varlistentry>
+        <varlistentry>
+         <term>Pre-condition:</term>
+         <listitem>
+           <para><command>t</command> must inhabit an inductive type and <command>th</command> must be an elimination principle for that inductive type.</para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>Action:</term>
+           <listitem>
+             <para>It proceed on the values of <command>t</command>.</para>
+           </listitem>
+       </varlistentry>
+        <varlistentry>
+            <term>New sequents to prove:</term>
+            <listitem>
+               <para>It opens one new sequent to demonstrate.</para>
+            </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+
+  <sect1 id="tac_weproceedbycases">
+    <title>we proceed by cases</title>
+      <titleabbrev>we proceed by cases</titleabbrev>
+      <para><userinput>we proceed by cases on t to prove t</userinput></para>
+      <para>
+        <variablelist>
+         <varlistentry role="tactic.synopsis">
+           <term>Synopsis:</term>
+           <listitem>
+             <para><emphasis role="bold">we proceed by cases on </emphasis> &term; <emphasis role="bold">to prove</emphasis> &term; </para>
+            </listitem>
+          </varlistentry>
+         <varlistentry>
+           <term>Pre-condition:</term>
+           <listitem>
+             <para> Da Fare </para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term>Action:</term>
+             <listitem>
+               <para> Da Fare </para>
+              </listitem>
+         </varlistentry>
+          <varlistentry>
+            <term>New sequents to prove:</term>
+           <listitem>
+              <para>None.</para>
+           </listitem>
+         </varlistentry>
+         </variablelist>
+       </para>
+    </sect1>
+
+    <sect1 id="tac_byinduction">
+      <title>by induction</title>
+      <titleabbrev>by induction</titleabbrev>
+      <para><userinput>by induction hypothesis we know t (id)</userinput></para>
+      <para>
+        <variablelist>
+         <varlistentry role="tactic.synopsis">
+           <term>Synopsis:</term>
+           <listitem>
+             <para><emphasis role="bold">by induction hypothesis we know</emphasis> &term; <emphasis role="bold"> (</emphasis> &id; <emphasis role="bold">)</emphasis></para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term>Pre-condition:</term>
+           <listitem>
+             <para> Da Fare </para>
+           </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term>Action:</term>
+             <listitem>
+               <para> Da Fare </para>
+             </listitem>
+         </varlistentry>
+          <varlistentry>
+             <term>New sequents to prove:</term>
+                <listitem>
+                <para>None.</para>
+                </listitem>
+         </varlistentry>
+         </variablelist>
+      </para>
+    </sect1>  
+
+   <sect1 id="tac_thesisbecomes">
+     <title>thesis becomes</title>
+     <titleabbrev>thesis becomes</titleabbrev>
+     <para><userinput>the thesis becomes t</userinput></para>
+     <para>
+        <variablelist>
+          <varlistentry role="tactic.synopsis">
+            <term>Synopsis:</term>
+            <listitem>
+              <para><emphasis role ="bold">the thesis becomes</emphasis> &sterm; </para>
+            </listitem>
+          </varlistentry>
+          <varlistentry>
+            <term>Pre-condition:</term>
+            <listitem>
+              <para>Each subterm must be convertible with the term <command>t</command> disambiguate in the context of the matched subterm.</para>
+            </listitem>
+          </varlistentry>
+          <varlistentry>
+            <term>Action:</term>
+            <listitem>
+              <para>It replaces the subterm of the current sequent with the new term</para>
+            </listitem>
+          </varlistentry>
+          <varlistentry>
+            <term>New sequence to prove:</term>
+            <listitem>
+              <para>None.</para>
+            </listitem>
+          </varlistentry>
+        </variablelist>
+       </para>
+   </sect1>
+   
+   <sect1 id="tac_case">
+     <title>case</title>
+     <titleabbrev>case</titleabbrev>
+     <para><userinput>case id (id:t)list</userinput></para>
+     <para>
+       <variablelist>
+         <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">case</emphasis> &id; <emphasis role="bold">(</emphasis> &id; <emphasis role="bold">:</emphasis> &term; <emphasis role="bold">)</emphasis></para>
+          </listitem>
+        </varlistentry>
+         <varlistentry>
+            <term>Pre-condition:</term>
+           <listitem>
+               <para> Da Fare </para>
+           </listitem>
+        </varlistentry>
+         <varlistentry>
+            <term>Action:</term>
+            <listitem>
+              <para> Da Fare </para>
+            </listitem>
+         </varlistentry>
+         <varlistentry>
+           <term>New sequents to prove:</term>
+           <listitem>
+               <para>Da Fare</para>
+           </listitem>
+         </varlistentry>
+       </variablelist>
+     </para>
+  </sect1> 
+
+  <sect1 id="tac_obtain">
+    <title>obtain/conclude</title>
+    <titleabbrev>obtain/conclude</titleabbrev>
+    <para><userinput>obtain H t=t by [t|_] done</userinput></para>
+    <para>
+      <variablelist>
+         <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para>[<emphasis role="bold">obtain</emphasis> &id; | <emphasis role="bold">conclude</emphasis> &term;] <emphasis role="bold">=</emphasis> &term; <emphasis role="bold">by</emphasis> [ &term; | <emphasis role="bold">_</emphasis> [<emphasis role="bold">(</emphasis>&autoparams;<emphasis role="bold">)</emphasis>]] [<emphasis role="bold">done</emphasis>]</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-condition:</term>
+            <listitem>
+              <para> Da Fare </para>
+            </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+             <para> Da Fare </para>
+           </listitem>
+         </varlistentry>
+        <varlistentry>
+          <term>New sequence to prove:</term>
+            <listitem>
+               <para> Da Fare </para>
+            </listitem>
+        </varlistentry>
+       </variablelist>
+     </para>
+   </sect1>
+
+ <sect1 id="tac_bytermweproved">
+   <title>by term we proved</title>
+     <titleabbrev>by term we proved</titleabbrev>
+     <para><userinput>by th we proved t [""|(id)]</userinput></para>
+     <para>
+       <variablelist>
+         <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">by</emphasis> &term; <emphasis role="bold">we proved</emphasis> &term; 
+                  <emphasis role="bold">(</emphasis> &id; <emphasis role="bold">)</emphasis></para>
+           </listitem>
+          </varlistentry>
+          <varlistentry>
+            <term>Pre-condition:</term>
+            <listitem>
+              <para><command>th</command>must have type <command>Prop</command>.
+                    <command>id</command>can to be omitted with null</para>
+            </listitem>
+          </varlistentry>
+          <varlistentry>
+            <term>Action:</term>
+            <listitem>
+              <para>It closes the current sequent by applying<command>th</command> to <command>t</command>.</para>
+            </listitem>
+          </varlistentry>
+          <varlistentry>
+            <term>New sequence to prove:</term>
+            <listitem>
+              <para> Da fare </para>
+            </listitem>
+          </varlistentry>
+        </variablelist>
+       </para>
+    </sect1>
+
+  <sect1 id="tac_exitselim">
+    <title>exits elim</title>
+    <titleabbrev>exits elim</titleabbrev>
+    <para><userinput>by t let id:t such that t (id)</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+         <term>Synopsis:</term>
+         <listitem>
+           <para><emphasis role="bold">by</emphasis> &term; <emphasis role="bold">let</emphasis> &id; 
+                   <emphasis role="bold">:</emphasis> &term; <emphasis role="bold">such that</emphasis> &term; 
+                    <emphasis role="bold">(</emphasis> &id; <emphasis role="bold">)</emphasis></para>
+          </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>Pre-condition:</term>
+         <listitem>
+           <para><command>t</command> must be an inductive type,existential and 
+              <command>t (id)</command> must be an elimanation priciple for that inductive type.
+           </para>
+         </listitem>  
+       </varlistentry>
+       <varlistentry>
+         <term>Action:</term>
+         <listitem>
+           <para>it proceeds on <command>t</command> to the elimination of the existential one </para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>New sequence to prove:</term>
+         <listitem>
+           <para>It opens one new sequent. The names of the new hypotheses are picked by<command>t (id)</command> </para>
+         </listitem>
+       </varlistentry>
+     </variablelist>
+    </para>
+  </sect1>
+
+  <sect1 id="tac_andelim">
+    <title>and elim</title>
+    <titleabbrev>and elim</titleabbrev>
+    <para><userinput>by t we have t (id) and t (id)</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic_synopsis">
+         <term>Synopsis:</term>
+         <listitem>
+           <para><emphasis role="bold">by</emphasis> &term; <emphasis role="bold">we have</emphasis> &term; 
+                   <emphasis role="bold">( </emphasis> &id; <emphasis role="bold"> ) and </emphasis> &term; 
+                     <emphasis role="bold"> ( </emphasis> &id; <emphasis role="bold">)</emphasis></para>
+          </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>Pre-condition:</term>
+         <listitem>
+           <para><command>t</command> must be an logical type,type and  </para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>Action:</term>
+         <listitem>
+           <para>It proceeds on the values of <command>t</command>, according to the elimination principle </para>
+         </listitem>
+       </varlistentry>
+       <varlistentry>
+         <term>New sequence to prove:</term>
+         <listitem>
+            <para>It opens one new sequent, the names of the new hypotheses are picked by <command>t(id) and t(id)</command> </para>
+          </listitem>
+       </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+
+</chapter>
diff --git a/matita/help/C/sec_gettingstarted.xml b/matita/help/C/sec_gettingstarted.xml
new file mode 100644 (file)
index 0000000..0066449
--- /dev/null
@@ -0,0 +1,226 @@
+
+<!-- ============= Getting started ============================== -->
+
+<chapter id="sec_gettingstarted">
+  <title>Getting started</title>
+  <para> 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.</para>
+
+  <sect1 id="unicode">
+   <title>How to type Unicode symbols</title>
+   <para>Unicode characters can be typed in several ways:</para>
+    <itemizedlist>
+      <listitem><para>Using the &quot;Ctrl+Shift+Unicode code&quot; standard Gnome shortcut. E.g. Ctrl+Shift+3a9 generates &quot;Ω&quot;.</para>
+     </listitem>
+     <listitem><para>Typing the ligature &quot;\name&quot; where &quot;name&quot;
+      is a standard Unicode or LaTeX name for the character. Pressing
+      &quot;Alt+L&quot; 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 &quot;\name&quot;
+      sequences. E.g. &quot;\Omega&quot; followed by Alt+L generates
+      &quot;Ω&quot;.</para>
+     </listitem>
+     <listitem><para>Typing one of the following ligatures (and optionally
+         converting the ligature to the Unicode character has described before):
+         &quot;:=&quot; (which stands for ≝); &quot;->&quot; (which stands for
+         &quot;→&quot;); &quot;=>&quot; (which stands for &quot;⇒&quot;).</para>
+     </listitem>
+    </itemizedlist>
+  </sect1>
+  <sect1 id="cicbrowser">
+   <title>Browsing and searching</title>
+   <para>The CIC browser is used to browse and search the library.
+    You can open a new CIC browser selecting &quot;New Cic Browser&quot;
+    from the &quot;View&quot; menu of Matita, or by pressing &quot;F3&quot;.
+    The CIC browser is similar to a traditional Web browser.</para>
+   <sect2 id="browsinglib">
+    <title>Browsing the library</title>
+    <para>To browse the library, type in the location bar the absolute URI of
+    the theorem, definition or library fragment you are interested in.
+    &quot;cic:/&quot; is the root of the library. Contributions developed
+    in Matita are under &quot;cic:/matita&quot;; all the others are
+    part of the library of Coq.</para>
+    <para>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.</para>
+   </sect2>
+   <sect2 id="aboutproof">
+    <title>Looking at a proof under development</title>
+    <para>A proof under development is not yet part of the library.
+     The special URI &quot;about:proof&quot; can be used to browse the
+     proof currently under development, if there is one.
+     The &quot;home&quot; button of the CIC browser sets the location bar to
+     &quot;about:proof&quot;.
+    </para>
+   </sect2>
+   <sect2 id="whelp">
+    <title>Searching the library</title>
+    <para>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.</para>
+    <sect3 id="locate">
+     <title>Searching by name</title>
+     <para>     &TODO;</para>
+   </sect3>
+    <sect3 id="hint">
+     <title>List of lemmas that can be applied</title>
+     <para>     &TODO;</para>
+   </sect3>
+    <sect3 id="match">
+     <title>Searching by exact match</title>
+     <para>     &TODO;</para>
+   </sect3>
+    <sect3 id="elim">
+     <title>List of elimination principles for a given type</title>
+     <para>     &TODO;</para>
+   </sect3>
+    <sect3 id="instance">
+     <title>Searching by instantiation</title>
+     <para>     &TODO;</para>
+   </sect3>
+   </sect2>
+  </sect1>
+  <sect1 id="authoring">
+   <title>Authoring</title>
+   <sect2 id="developments">
+   <title>How to use developments</title>
+   <para>
+     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. 
+   </para>
+   <para>
+     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.
+   </para>
+   <para>
+     The &quot;Developments...&quot; item the File menu (or pressing
+     Ctrl+D) opens the Developments window.
+   </para>
+   <figure><title>The Developments window</title>
+     <mediaobject>
+       <imageobject>
+         <imagedata fileref="figures/developments.png" /> 
+       </imageobject>
+       <textobject><phrase>Screenshot of the Developments window.</phrase></textobject>
+     </mediaobject>
+   </figure>
+   <para> 
+    <variablelist><title>Developments window buttons</title>
+      <varlistentry><term><filename>New</filename></term>
+        <listitem>
+          <para>
+            To create a new Development the user needs to specify a name<footnote>
+              <para>
+                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.
+              </para>
+            </footnote>
+            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 &quot;makefile&quot;
+            file is placed in the specified root directory. That makefile
+            supports the following targets:
+            <variablelist>
+              <varlistentry><term><filename>all</filename></term>
+                <listitem>
+                  <para>
+                    Build the whole development.
+                  </para>
+                </listitem>
+              </varlistentry>
+              <varlistentry><term><filename>clean</filename></term>
+                <listitem>
+                  <para>
+                    Cleans the whole development.
+                  </para>
+                </listitem>
+              </varlistentry>
+              <varlistentry><term><filename>cleanall</filename></term>
+                <listitem>
+                  <para>
+                    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.
+                  </para>
+                </listitem>
+              </varlistentry>
+              <varlistentry><term><filename>scriptname.mo</filename></term>
+                <listitem>
+                  <para>
+                    Compiles &quot;scriptname.ma&quot;
+                  </para>
+                </listitem>
+              </varlistentry>
+            </variablelist>
+          </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry><term><filename>Delete</filename></term>
+        <listitem>
+          <para>
+            Decompiles the whole development and removes it.
+          </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry><term><filename>Build</filename></term>
+        <listitem>
+          <para>
+            Compiles all the scripts in the development.
+          </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry><term><filename>Clean</filename></term>
+        <listitem>
+          <para>
+            Decompiles the whole development.
+          </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry><term><filename>Publish</filename></term>
+        <listitem>
+          <para>
+            All the user developments live in the &quot;user&quot; 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 &quot;library&quot; 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 &quot;distributed
+            library&quot; space (making your development public).
+          </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry><term><filename>Close</filename></term>
+        <listitem>
+          <para>
+            Closes the Developments window
+          </para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+    </para>
+ </sect2>
+   <sect2 id="authoringinterface">
+    <title>The authoring interface</title>
+    <para>&TODO;</para>
+   </sect2>
+ </sect1>
+</chapter>
+
+
diff --git a/matita/help/C/sec_install.xml b/matita/help/C/sec_install.xml
new file mode 100644 (file)
index 0000000..7dc3793
--- /dev/null
@@ -0,0 +1,501 @@
+
+<!-- ============= Installation ============================== -->
+
+<chapter id="sec_install">
+  <title>Installation</title>
+
+  <sect1 id="inst_from_src">
+    <title>Installing from sources</title>
+
+    <para>Currently, the only intended way to install &appname; is starting
+      from its source code.  </para>
+
+    <sect2 id="get_source_code">
+      <title>Getting the source code</title>
+
+      <para>You can get the &appname; source code in two ways:
+       <orderedlist>
+
+         <listitem> <para> go to the <ulink type="http"
+               url="http://matita.cs.unibo.it/download.shtml">download
+               page</ulink> and get the <ulink type="http"
+               url="http://matita.cs.unibo.it/sources/matita-latest.tar.gz"
+               >latest released source tarball</ulink>;</para> </listitem>
+
+         <listitem> <para> get the development sources from <ulink type="http"
+               url="http://helm.cs.unibo.it/websvn/listing.php?repname=helm&amp;path=%2F&amp;sc=0">our
+               SVN repository</ulink>. You will need the
+             <application>components/</application> and
+             <application>matita/</application> directories from the
+             <filename>trunk/helm/software/</filename> directory, plus the
+             <filename>configure</filename> and <filename>Makefile*</filename>
+             stuff from the same directory.  </para>
+
+             <para>In this case you will need to run
+               <command>autoconf</command> before proceding with the building
+               instructions below.</para> </listitem>
+
+       </orderedlist>
+      </para>
+      
+    </sect2>
+
+    <sect2 id="build_requirements">
+      <title>Requirements</title>
+
+      <para>In order to build &appname; from sources you will need some
+       tools and libraries. They are listed below.
+
+       <note>
+         <title>Note for Debian (and derivatives) users</title>
+
+         <para>If you are running a 
+                 <ulink type="http"
+                         url="http://www.debian.org">Debian GNU/Linux</ulink>
+                 distribution,
+                 or any of its derivative like <ulink type="http"
+                         url="http://ubuntu.com">Ubuntu</ulink>, 
+                 you can use APT to install all the required tools and
+                 libraries since they are all part of the Debian archive. 
+         </para>         
+         <para>          
+                 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
+         </para>         
+         <para>          
+                 An official debian package is going to be added to the
+                 archive too.
+         </para>
+
+       </note>
+
+       <variablelist>
+         <title>Required tools and libraries</title>
+
+         <varlistentry>
+           <term>
+             <application> <ulink type="http"
+                 url="http://caml.inria.fr">OCaml</ulink> </application>
+           </term>
+           <listitem>
+             <para> the Objective Caml compiler, version 3.09 or above </para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term>
+             <application> <ulink type="http"
+                 url="http://www.ocaml-programming.de/packages/">Findlib</ulink>
+             </application>
+           </term>
+           <listitem>
+             <para> OCaml package manager, version 1.1.1 or above</para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term>
+             <application> <ulink type="http"
+                 url="http://www.xs4all.nl/~mmzeeman/ocaml/">OCaml
+                 Expat</ulink> </application>
+           </term>
+           <listitem>
+             <para>OCaml bindings for the <application><ulink type="http"
+                   url="http://expat.sourceforge.net/">expat</ulink>
+                 library</application> </para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term>
+             <application> <ulink type="http"
+                 url="http://gmetadom.sourceforge.net/">GMetaDOM</ulink>
+             </application>
+           </term>
+           <listitem>
+             <para>OCaml bindings for the <application><ulink type="http"
+                   url="http://gdome2.cs.unibo.it/">Gdome 2</ulink>
+                 library</application></para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term>
+             <application> <ulink type="http"
+                 url="http://www.bononia.it/~zack/ocaml-http.en.html">OCaml
+                 HTTP</ulink> </application>
+           </term>
+           <listitem>
+             <para> OCaml library to write HTTP daemons (and clients) </para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term>
+             <application> <ulink type="http"
+                 url="http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/lablgtk.html">LablGTK</ulink>
+             </application>
+           </term>
+           <listitem>
+             <para> OCaml bindings for the <application> <ulink type="http"
+                   url="http://www.gtk.org"> GTK+</ulink> library
+             </application>, version 2.6.0 or above </para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term>
+             <application> <ulink type="http"
+                 url="http://helm.cs.unibo.it/mml-widget/">GtkMathView</ulink>
+             </application>
+           </term>
+           <term>
+             <application> <ulink type="http"
+                 url="http://helm.cs.unibo.it/mml-widget/">LablGtkMathView</ulink>
+             </application>
+           </term>
+           <listitem>
+             <para> GTK+ widget to render <ulink type="http"
+                 url="http://www.w3.org/Math/">MathML</ulink> documents and its
+               OCaml bindings </para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term>
+             <application> <ulink type="http"
+                 url="http://gtksourceview.sourceforge.net/">GtkSourceView</ulink>
+             </application>
+           </term>
+           <term>
+             <application> <ulink type="http"
+                 url="http://helm.cs.unibo.it/software/lablgtksourceview/">LablGtkSourceView</ulink>
+             </application>
+           </term>
+           <listitem>
+             <para> extension for the GTK+ text widget (adding the typical
+               features of source code editors) and its OCaml bindings </para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term> &MYSQL; </term>
+           <term>
+             <application> <ulink type="http"
+                 url="http://raevnos.pennmush.org/code/ocaml-mysql/">OCaml
+                 MySQL</ulink> </application>
+           </term>
+           <listitem>
+             <para> SQL database and OCaml bindings for its client-side library
+             </para>
+             <para> The SQL database itself is not strictly needed to run
+               &appname;, but the client libraries are.</para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term> &Sqlite; </term>
+           <term>
+                   <application> 
+                         <ulink type="http"
+                             url="http://ocaml.info/home/ocaml_sources.html">
+               OCaml Sqlite3
+             </ulink> </application>
+           </term>
+           <listitem>
+             <para> Sqlite database and OCaml bindings
+             </para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term>
+             <application> <ulink type="http"
+                 url="http://ocamlnet.sourceforge.net/">Ocamlnet</ulink>
+             </application>
+           </term>
+           <listitem>
+             <para> collection of OCaml libraries to deal with
+               application-level Internet protocols and conventions </para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term>
+             <application> <ulink type="http"
+                 url="http://www.cduce.org/download.html">ulex</ulink>
+             </application>
+           </term>
+           <listitem>
+             <para> Unicode lexer generator for OCaml </para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term>
+             <application> <ulink type="http"
+                 url="http://cristal.inria.fr/~xleroy/software.html">CamlZip</ulink>
+             </application>
+           </term>
+           <listitem>
+             <para> OCaml library to access <filename>.gz</filename> files
+             </para>
+           </listitem>
+         </varlistentry>
+
+       </variablelist> </para>
+
+    </sect2>
+
+    <sect2 id="database_setup">
+      <title>(optional) &MYSQL; setup</title>
+
+      <para> 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 <ulink type="http"
+         url="http://dev.mysql.com/doc/">MySQL documentation</ulink>. Here you
+       can find a quick howto. </para>
+
+      <para> 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
+       <userinput>mysqladmin create matita</userinput>
+       (<emphasis>matita</emphasis> is the default database name, you can
+       change it using the <parameter>db.user</parameter> key of the
+       configuration file). </para>
+
+      <para> Then you need to grant the necessary access permissions to the
+       database user of &appname;, typing <userinput>echo "grant all privileges
+         on matita.* to helm;" | mysql matita</userinput> should do the trick
+       (<emphasis>helm</emphasis> is the default user name used by &appname; to
+       access the database, you can change it using the
+       <parameter>db.user</parameter> key of the configuration file).
+      </para>
+
+      <note>
+       <para> This way you create a database named <emphasis>matita</emphasis>
+         on which anyone claiming to be the <emphasis>helm</emphasis> 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.</para>
+      </note>
+      
+    </sect2>
+
+    <sect2 id="build_instructions">
+      <title>Compiling and installing</title>
+
+      <para> Once you get the source code the installations steps should be
+       quite familiar.</para>
+
+      <para> First of all you need to configure the build process executing
+       <userinput>./configure</userinput>. This will check that all needed
+       tools and library are installed and prepare the sources for compilation
+       and installation. </para>
+       
+      <para> Quite a few (optional) arguments may be passed to the
+       <application>configure</application> command line to change build time
+       parameters. They are listed below, together with their
+       default values: </para>
+
+       <variablelist>
+         <title> <application>configure</application> command line
+           arguments</title>
+
+         <varlistentry>
+           <term>
+             <userinput>--with-runtime-dir=<replaceable>dir</replaceable></userinput>
+           </term>
+           <listitem>
+             <para>
+               (<emphasis>Default:</emphasis>
+               <filename>/usr/local/matita</filename>) Runtime base directory
+               where all &appname; stuff (executables, configuration files,
+               standard library, ...) will be installed
+             </para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term>
+             <userinput>--with-dbhost=<replaceable>host</replaceable></userinput>
+           </term>
+           <listitem>
+             <para>
+               (<emphasis>Default:</emphasis> 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.
+             </para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term>
+             <userinput>--enable-debug</userinput>
+           </term>
+           <listitem>
+             <para>
+               (<emphasis>Default:</emphasis> disabled) Enable debugging code.
+               Not for the casual user.
+             </para>
+           </listitem>
+         </varlistentry>
+       </variablelist>
+
+      <para> Then you will manage the build and install process using
+       <application><ulink type="http"
+           url="http://www.gnu.org/software/make/">make</ulink></application>
+       as usual. Below are reported the targets you have to invoke in sequence
+       to build and install:
+      </para>
+
+       <variablelist>
+         <title><application>make</application> targets</title>
+
+         <varlistentry>
+           <term><userinput>world</userinput></term>
+           <listitem>
+             <para>builds components needed by &appname; and &appname; itself
+               (in bytecode or native code depending
+               on the availability of the OCaml native code compiler) </para>
+           </listitem>
+         </varlistentry>
+
+         <varlistentry>
+           <term><userinput>install</userinput></term>
+           <listitem>
+             <para>installs &appname; related tools, standard library and the
+               needed runtime stuff in the proper places on the filesystem.
+             </para>
+             <para>As a part of the installation process the &appname;
+               standard library will be compiled, thus testing that the just
+               built <application>matitac</application> compiler works
+               properly.</para>
+             <para>For this step you will need a working SQL database (for
+               indexing the standard library while you are compiling it). See
+               <ulink type="http" url="#database_setup">Database setup</ulink>
+               for instructions on how to set it up.
+             </para>
+           </listitem>
+         </varlistentry>
+
+       </variablelist>
+      
+    </sect2>
+
+  </sect1>
+
+  <sect1 id="matita.conf.xml">
+    <title>Configuring &appname;</title>
+    <para>
+           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.
+          <programlisting>
+<![CDATA[
+  <section name="user">
+    <key name="home">$(HOME)</key>
+    <key name="name">$(USER)</key>
+  </section>
+  <section name="matita">
+    <key name="basedir">$(user.home)/.matita</key>
+    <key name="rt_base_dir">/usr/share/matita/</key>
+    <key name="owner">$(user.name)</key>
+  </section>
+]]></programlisting>
+    </para>
+   <para>
+          &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.
+   </para>
+   <para>
+          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.
+   </para>
+   <figure><title>Configuring the Databases</title>
+     <mediaobject>
+       <imageobject>
+         <imagedata fileref="figures/database.png" format="PNG" srccredit="Enrico Tassi"/>
+       </imageobject>
+       <textobject><phrase>How to configure the databases.</phrase></textobject>
+     </mediaobject>
+   </figure>
+   <para>The getter</para>
+   <para>
+          Consider the following snippet and the URI
+          <userinput>cic:/matita/foo/bar.con</userinput>. 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
+          <userinput>file://$(matita.rt_base_dir)/xml/standard-library/foo/bar.con</userinput>
+          and then <userinput>file://$(user.home)/.matita/xml/matita/foo/bar.con</userinput>
+          are inspected.
+          <programlisting>
+<![CDATA[
+  <section name="getter">
+    <key name="cache_dir">$(user.home)/.matita/getter/cache</key>
+    <key name="prefix">
+      cic:/matita/
+      file://$(matita.rt_base_dir)/xml/standard-library/
+      ro
+    </key>
+    <key name="prefix">
+      cic:/matita/
+      file://$(user.home)/.matita/xml/matita/
+    </key>
+    <key name="prefix">
+      cic:/Coq/
+      http://mowgli.cs.unibo.it/xml/
+      legacy
+    </key>
+  </section>
+]]>    
+       </programlisting> 
+       if the same URI has to be written, the former prefix is skipped
+       since it is marked as readonly (<userinput>ro</userinput>).
+       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 <userinput>ro</userinput> are considered for
+       writing when &appname; is started in system mode (used to publish user
+       developments in the library space).
+   </para>
+         <para>The db</para>
+       <para>
+          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.
+          <programlisting>
+<![CDATA[
+  <section name="db">
+    <key name="metadata">mysql://mowgli.cs.unibo.it matita helm none legacy</key>
+    <key name="metadata">file://$(matita.rt_base_dir) metadata.db helm helm library</key>
+    <key name="metadata">file://$(matita.basedir) user.db helm helm user</key>
+  </section>
+]]>    
+       </programlisting> 
+       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 <userinput>none</userinput>) and the name of the front 
+       end to which it is attached.
+   </para>
+  </sect1>
+
+</chapter>
+
diff --git a/matita/help/C/sec_intro.xml b/matita/help/C/sec_intro.xml
new file mode 100644 (file)
index 0000000..6c22f46
--- /dev/null
@@ -0,0 +1,96 @@
+
+<!-- ============= Introduction ============================== -->
+
+<chapter id="sec_intro">
+  <title>Introduction</title>
+  <sect1 id="Features">
+    <title>Features</title>
+    <para><application>Matita</application> is an interactive theorem prover
+      (or proof assistant) with the following characteristics:</para>
+    <itemizedlist>
+      <listitem>
+        <para>It is based on a variant of the Calculus of (Co)Inductive Constructions (CIC). CIC is also the logic of the Coq proof assistant.</para>
+      </listitem>
+      <listitem>
+        <para>It adopts a procedural proof language, but it has a new set of small step tacticals that improve proof structuring and debugging.</para>
+      </listitem>
+      <listitem>
+        <para>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:</para>
+        <itemizedlist>
+          <listitem>
+            <para>It is based and fully integrated with Gtk/Gnome.</para>
+          </listitem>
+          <listitem>
+            <para>An on-line help can be browsed via the Gnome documentation browser.</para>
+          </listitem>
+          <listitem>
+            <para>Mathematical formulae are rendered in two dimensional notation via MathML and Unicode.</para>
+          </listitem>
+        </itemizedlist>
+      </listitem>
+      <listitem>
+        <para>It integrates advanced browsing and searching procedures.</para>
+      </listitem>
+      <listitem>
+        <para>It allows the use of the typical ambiguous mathematical notation by means of a disambiguating parser.</para>
+      </listitem>
+      <listitem>
+        <para>It is compatible with the library of Coq (definitions and proof objects).</para>
+      </listitem>
+    </itemizedlist>
+  </sect1>
+  <sect1 id="WrtCoq">
+    <title>Matita vs Coq</title>
+    <para>
+      The system shares a common look&amp;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:
+    </para>
+    <itemizedlist>
+      <listitem>
+        <para>proof extraction;</para>
+      </listitem>
+      <listitem>
+        <para>an extensible language of tactics;</para>
+      </listitem>
+      <listitem>
+        <para>automatic implicit arguments;</para>
+      </listitem>
+      <listitem>
+        <para>several ad-hoc decision procedures;</para>
+      </listitem>
+      <listitem>
+        <para>several rarely used variants for most of the tactics;</para>
+      </listitem>
+      <listitem>
+        <para>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.</para>
+      </listitem>
+    </itemizedlist>
+    <para>
+      Still from the user point of view, the main differences with respect
+      to Coq are:
+    </para>
+    <itemizedlist>
+      <listitem>
+        <para>the language of tacticals that allows execution of partial tactical application;</para>
+      </listitem>
+      <listitem>
+        <para>the unification of the concept of metavariable and existential variable;</para>
+      </listitem>
+      <listitem>
+        <para>terms with subterms that cannot be inferred are always allowed as arguments of tactics or other commands;</para>
+      </listitem>
+      <listitem>
+        <para>ambiguous terms are disambiguated by direct interaction with the user;</para>
+      </listitem>
+      <listitem>
+        <para>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.</para>
+      </listitem>
+    </itemizedlist>
+  </sect1>
+</chapter>
diff --git a/matita/help/C/sec_license.xml b/matita/help/C/sec_license.xml
new file mode 100644 (file)
index 0000000..47e1461
--- /dev/null
@@ -0,0 +1,8 @@
+
+<!-- ============= Application License ============================= -->
+
+<chapter id="sec_license">
+  <title>License</title>
+  &legal;
+</chapter>
+
diff --git a/matita/help/C/sec_tacticals.xml b/matita/help/C/sec_tacticals.xml
new file mode 100644 (file)
index 0000000..2f84ae7
--- /dev/null
@@ -0,0 +1,305 @@
+
+<!-- ============ Tacticals ====================== -->
+<chapter id="sec_tacticals">
+ <title>Tacticals</title>
+ <sect1>
+   <title>Interactive proofs and definitions</title>
+   <para>
+    An interactive definition is started by giving a
+    <link linkend="definition">definition</link> command omitting
+    the definiens.
+    An interactive proof is started by using one of the
+    <link linkend="proofs">proof commands</link> omitting
+    an explicit proof term.
+   </para>
+   <para>An interactive proof or definition can and must be terminated by
+    a <link linkend="command_qed">qed</link> 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 <link linkend="sec_tactics">tactics</link> structured by means of
+    <link linkend="tacticals">tacticals</link>.</para>
+   <para>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.</para>
+ </sect1>
+ <sect1 id="proofstatus">
+  <title>The proof status</title>
+  <para>
+   During an interactive proof, the proof status is made of
+   the set of sequents to prove and the partial proof built so far.
+  </para>
+  <para>The partial proof can be <link linkend="aboutproof">inspected</link>
+   on demand in the CIC browser. It will be shown in pseudo-natural language
+   produced on the fly from the proof term.</para>
+  <para>The set of sequents to prove is shown in the notebook of the
+   <link linkend="authoringinterface">authoring interface</link>, 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.
+  </para>
+  <orderedlist>
+   <listitem id="selectedsequents">
+    <para>
+     <emphasis role="bold">Selected sequents</emphasis>
+      (name in boldface, e.g. <emphasis role="bold">?3</emphasis>).
+      The next tactic will be applied to every selected sequent, producing
+      new selected sequents. <link linkend="tacticals">Tacticals</link>
+      such as branching (&quot;<emphasis role="bold">[</emphasis>&quot;)
+      or &quot;<emphasis role="bold">focus</emphasis>&quot; can be used
+      to change the set of selected sequents.
+    </para>
+   </listitem>
+   <listitem id="siblingsequents">
+    <para>
+     <emphasis role="bold">Sibling sequents</emphasis>
+     (name prefixed by a vertical bar and their position, e.g.
+      |<subscript>3</subscript>?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 <link linkend="tacticals">tactical</link>
+     (&quot;<emphasis role="bold">[</emphasis>&quot;) selects the first
+     sequent only, marking every previously selected sequent as a sibling
+     sequent. Each sibling sequent is given a different position. The
+     tactical &quot;<emphasis role="bold">2,3:</emphasis>&quot; 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 (&quot;<emphasis role="bold">|</emphasis>&quot;)
+     tactical is used to end work on the current one.
+    </para>
+   </listitem>
+   <listitem id="solvedsequents">
+    <para>
+     <emphasis role="bold">Automatically solved sibling sequents</emphasis>
+     (name strokethrough, e.g. |<subscript>3</subscript><emphasis role="strikethrough">?2</emphasis>).
+     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 &quot;<emphasis role="bold">skip</emphasis>&quot;
+     <link linkend="tacticals">tactical</link>) 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.
+    </para>
+   </listitem>
+  </orderedlist>
+ </sect1>
+ <sect1 id="tacticals">
+  <title>Tacticals</title>
+   <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+     <title>proof script</title>
+     <tgroup cols="4">
+     <tbody>
+      <row>
+       <entry id="grammar.proofscript">&proofscript;</entry>
+       <entry>::=</entry>
+       <entry>&proofstep; [&proofstep;]…</entry>
+      </row>
+     </tbody>
+    </tgroup>
+   </table>
+   <para>Every proof step can be immediately executed.</para>
+   <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+     <title>proof steps</title>
+     <tgroup cols="4">
+     <tbody>
+      <row>
+       <entry id="grammar.proofstep">&proofstep;</entry>
+       <entry>::=</entry>
+       <entry>&LCFtactical;</entry>
+       <entry>The tactical is applied to each
+        <link linkend="selectedsequents">selected sequent</link>.
+        Each new sequent becomes a selected sequent.</entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry><emphasis role="bold">.</emphasis></entry>
+       <entry>The first
+        <link linkend="selectedsequents">selected sequent</link> becomes
+        the only one selected. All the remaining previously selected sequents
+        are proposed to the user one at a time when the next
+        &quot;<emphasis role="bold">.</emphasis>&quot; is used.
+       </entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry><emphasis role="bold">;</emphasis></entry>
+       <entry>Nothing changes. Use this proof step as a separator in
+        concrete syntax.</entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry><emphasis role="bold">[</emphasis></entry>
+       <entry>Every <link linkend="selectedsequents">selected sequent</link>
+        becomes a <link linkend="siblingsequents">sibling sequent</link>
+        that constitute a branch in the proof.
+        Moreover, the first sequent is also selected.
+       </entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry><emphasis role="bold">|</emphasis></entry>
+       <entry>Stop working on the current branch of the innermost branching
+        proof.
+        The sibling branches become the <link linkend="siblingsequents">sibling
+        sequents</link> and the first one is also selected.
+       </entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry>&nat;[<emphasis role="bold">,</emphasis>&nat;]…<emphasis role="bold">:</emphasis></entry>
+       <entry>The <link linkend="siblingsequents">sibling sequents</link>
+        specified by the user become the next
+        <link linkend="selectedsequents">selected sequents</link>.
+       </entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry><emphasis role="bold">*:</emphasis></entry>
+       <entry>Every sibling branch not considered yet in the innermost
+        branching proof becomes a
+        <link linkend="selectedsequents">selected sequent</link>.
+       </entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry><emphasis role="bold">skip</emphasis></entry>
+       <entry>Accept the automatically provided instantiation (not shown
+        to the user) for the currently selected
+        <link linkend="solvedsequents">automatically closed sibling sequent</link>.
+       </entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry><emphasis role="bold">]</emphasis></entry>
+       <entry>Stop analyzing branches for the innermost branching proof.
+        Every sequent opened during the branching proof and not closed yet
+        becomes a <link linkend="selectedsequents">selected sequent</link>.
+       </entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry><emphasis role="bold">focus</emphasis>&nbsp;&nat;&nbsp;[&nat;]…</entry>
+       <entry>
+        Selects the sequents specified by the user. The selected sequents
+        must be completely closed (no new sequents left open) before doing an
+        &quot;<emphasis role="bold">unfocus</emphasis> that restores
+        the current set of sibling branches.
+       </entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry><emphasis role="bold">unfocus</emphasis></entry>
+       <entry>
+        Used to match the innermost
+        &quot;<emphasis role="bold">focus</emphasis>&quot; tactical
+        when all the sequents selected by it have been closed.
+        Until &quot;<emphasis role="bold">unfocus</emphasis>&quot; is
+        performed, it is not possible to progress in the rest of the
+        proof.
+       </entry>
+      </row>
+     </tbody>
+    </tgroup>
+   </table>
+   <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+     <title>tactics and LCF tacticals</title>
+     <tgroup cols="4">
+     <tbody>
+      <row>
+       <entry id="grammar.LCFtactical">&LCFtactical;</entry>
+       <entry>::=</entry>
+       <entry>&tactic;</entry>
+       <entry>Applies the specified tactic.</entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry>&LCFtactical; <emphasis role="bold">;</emphasis> &LCFtactical;</entry>
+       <entry>Applies the first tactical first and the second tactical
+        to each sequent opened by the first one.</entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry>&LCFtactical;
+        <emphasis role="bold">[</emphasis>
+        [&LCFtactical;]
+        [<emphasis role="bold">|</emphasis> &LCFtactical;]…
+        <emphasis role="bold">]</emphasis>
+       </entry>
+       <entry>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.</entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry><emphasis role="bold">do</emphasis> &nat;
+        &LCFtactical;
+       </entry>
+       <entry>&TODO;</entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry><emphasis role="bold">repeat</emphasis>
+        &LCFtactical;
+       </entry>
+       <entry>&TODO;</entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry>
+        <emphasis role="bold">first [</emphasis>
+        [&LCFtactical;]
+        [<emphasis role="bold">|</emphasis> &LCFtactical;]…
+        <emphasis role="bold">]</emphasis>
+       </entry>
+       <entry>&TODO;</entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry><emphasis role="bold">try</emphasis> &LCFtactical;</entry>
+       <entry>&TODO;</entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry>
+        <emphasis role="bold">solve [</emphasis>
+        [&LCFtactical;]
+        [<emphasis role="bold">|</emphasis> &LCFtactical;]…
+        <emphasis role="bold">]</emphasis>
+       </entry>
+       <entry>&TODO;</entry>
+      </row>
+      <row>
+       <entry/>
+       <entry>|</entry>
+       <entry><emphasis role="bold">(</emphasis>&LCFtactical;<emphasis role="bold">)</emphasis></entry>
+       <entry>Used for grouping during parsing.</entry>
+      </row>
+     </tbody>
+    </tgroup>
+   </table>
+ </sect1>
+</chapter>
+
diff --git a/matita/help/C/sec_tactics.xml b/matita/help/C/sec_tactics.xml
new file mode 100644 (file)
index 0000000..364401a
--- /dev/null
@@ -0,0 +1,1824 @@
+
+<!-- ============ Tactics ====================== -->
+<chapter id="sec_tactics">
+  <title>Tactics</title>
+
+  <sect1 id="tactics_quickref">
+    <title>Quick reference card</title>
+    <para>
+      &tacticref;
+    </para>
+  </sect1>
+
+  <sect1 id="tac_absurd">
+    <title>absurd</title>
+    <titleabbrev>absurd</titleabbrev>
+    <para><userinput>absurd P</userinput></para>
+     <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">absurd</emphasis> &sterm;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para><command>P</command> must have type <command>Prop</command>.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It closes the current sequent by eliminating an
+             absurd term.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>It opens two new sequents of conclusion <command>P</command>
+             and <command>¬P</command>.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+     </para>
+  </sect1>
+  <sect1 id="tac_apply">
+    <title>apply</title>
+    <titleabbrev>apply</titleabbrev>
+    <para><userinput>apply t</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">apply</emphasis> &sterm;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para><command>t</command> must have type
+             <command>T<subscript>1</subscript> → ... →
+              T<subscript>n</subscript> → G</command>
+             where <command>G</command> can be unified with the conclusion
+             of the current sequent.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It closes the current sequent by applying <command>t</command> to <command>n</command> implicit arguments (that become new sequents).</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>It opens a new sequent for each premise 
+             <command>T<subscript>i</subscript></command> that is not
+             instantiated by unification. <command>T<subscript>i</subscript></command> is
+             the conclusion of the <command>i</command>-th new sequent to
+             prove.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_applyS">
+    <title>applyS</title>
+    <titleabbrev>applyS</titleabbrev>
+    <para><userinput>applyS t auto_params</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">applyS</emphasis> &sterm; &autoparams;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para><command>t</command> must have type
+             <command>T<subscript>1</subscript> → ... →
+              T<subscript>n</subscript> → G</command>.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para><command>applyS</command> is useful when
+             <command>apply</command> 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 <command>P(n*O+m)</command> and
+             the theorem to be applied proves <command>∀m.P(m+O)</command>.
+            </para>
+            <para>
+             It tries to automatically rewrite the current goal using
+             <link linkend="tac_auto">auto paramodulation</link>
+             to make it unifiable with <command>G</command>.
+             Then it closes the current sequent by applying
+             <command>t</command> to <command>n</command>
+             implicit arguments (that become new sequents).
+             The <command>auto_params</command> parameters are passed
+             directly to <command>auto paramodulation</command>.
+            </para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>It opens a new sequent for each premise 
+             <command>T<subscript>i</subscript></command> that is not
+             instantiated by unification. <command>T<subscript>i</subscript></command> is
+             the conclusion of the <command>i</command>-th new sequent to
+             prove.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_assumption">
+    <title>assumption</title>
+    <titleabbrev>assumption</titleabbrev>
+    <para><userinput>assumption </userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">assumption</emphasis></para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>There must exist an hypothesis whose type can be unified with
+             the conclusion of the current sequent.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It closes the current sequent exploiting an hypothesis.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_auto">
+    <title>auto</title>
+    <titleabbrev>auto</titleabbrev>
+    <para><userinput>auto params</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">auto</emphasis> &autoparams;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>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 <command>params</command>.
+             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;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It closes the current sequent by repeated application of
+             rewriting steps (unless <command>paramodulation</command> is
+             omitted), hypothesis and lemmas in the library.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_cases">
+    <title>cases</title>
+    <titleabbrev>cases</titleabbrev>
+    <para><userinput>
+     cases t hyps
+    </userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para>
+            <emphasis role="bold">cases</emphasis>
+            &term; [<emphasis role="bold">(</emphasis>[&id;]…<emphasis role="bold">)</emphasis>]
+           </para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>
+            <command>t</command> must inhabit an inductive type
+           </para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>
+            It proceed by cases on <command>t</command>. The new generated
+             hypothesis in each branch are named according to
+             <command>hyps</command>.
+           </para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>One new sequent for each constructor of the type of
+             <command>t</command>. Each sequent has a new hypothesis for
+             each argument of the constructor.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_clear">
+    <title>clear</title>
+    <titleabbrev>clear</titleabbrev>
+    <para><userinput>
+     clear H<subscript>1</subscript> ... H<subscript>m</subscript>
+    </userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para>
+            <emphasis role="bold">clear</emphasis>
+            &id; [&id;…]
+           </para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>
+            <command>
+             H<subscript>1</subscript> ... H<subscript>m</subscript>
+            </command> must be hypotheses of the
+             current sequent to prove.
+           </para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>
+            It hides the hypotheses 
+             <command>
+             H<subscript>1</subscript> ... H<subscript>m</subscript>
+             </command> from the current sequent.
+           </para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_clearbody">
+    <title>clearbody</title>
+    <titleabbrev>clearbody</titleabbrev>
+    <para><userinput>clearbody H</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">clearbody</emphasis> &id;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para><command>H</command> must be an hypothesis of the
+             current sequent to prove.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It hides the definiens of a definition in the current
+             sequent context. Thus the definition becomes an hypothesis.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_compose">
+    <title>compose</title>
+    <titleabbrev>compose</titleabbrev>
+    <para><userinput>compose n t1 with t2 hyps</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">compose</emphasis> [&nat;] &sterm; [<emphasis role="bold">with</emphasis> &sterm;] [&intros-spec;]</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para></para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>Composes t1 with t2 in every possible way
+              <command>n</command> times introducing generated terms
+              as if <command>intros hyps</command> was issued.</para>
+            <para>If <command>t1:∀x:A.B[x]</command> and
+            <command>t2:∀x,y:A.B[x]→B[y]→C[x,y]</command> it generates:
+             <itemizedlist>
+                <listitem>
+                  <para><command>λx,y:A.t2 x y (t1 x) : ∀x,y:A.B[y]→C[x,y]</command></para>
+                </listitem>
+                <listitem>
+                  <para><command>λx,y:A.λH:B[x].t2 x y H (t1 y) : ∀x,y:A.B[x]→C[x,y]
+                  </command></para>
+                </listitem>
+             </itemizedlist>
+          </para>
+          <para>If <command>t2</command> is omitted it composes 
+            <command>t1</command>
+              with every hypothesis that can be introduced.  
+              <command>n</command> iterates the process.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>The same, but with more hypothesis eventually introduced
+            by the &intros-spec;.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_change">
+    <title>change</title>
+    <titleabbrev>change</titleabbrev>
+    <para><userinput>change patt with t</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">change</emphasis> &pattern; <emphasis role="bold">with</emphasis> &sterm;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>Each subterm matched by the pattern must be convertible
+             with the term <command>t</command> disambiguated in the context
+             of the matched subterm.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It replaces the subterms of the current sequent matched by
+             <command>patt</command> with the new term <command>t</command>.
+             For each subterm matched by the pattern, <command>t</command> is
+             disambiguated in the context of the subterm.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_constructor">
+    <title>constructor</title>
+    <titleabbrev>constructor</titleabbrev>
+    <para><userinput>constructor n</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">constructor</emphasis> &nat;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>The conclusion of the current sequent must be
+             an inductive type or the application of an inductive type with
+             at least <command>n</command> constructors.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It applies the <command>n</command>-th constructor of the
+             inductive type of the conclusion of the current sequent.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>It opens a new sequent for each premise of the constructor
+             that can not be inferred by unification. For more details,
+             see the <command>apply</command> tactic.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_contradiction">
+    <title>contradiction</title>
+    <titleabbrev>contradiction</titleabbrev>
+    <para><userinput>contradiction </userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">contradiction</emphasis></para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>There must be in the current context an hypothesis of type
+             <command>False</command>.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It closes the current sequent by applying an hypothesis of
+             type <command>False</command>.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_cut">
+    <title>cut</title>
+    <titleabbrev>cut</titleabbrev>
+    <para><userinput>cut P as H</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">cut</emphasis> &sterm; [<emphasis role="bold">as</emphasis> &id;]</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para><command>P</command> must have type <command>Prop</command>.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It closes the current sequent.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>It opens two new sequents. The first one has an extra
+             hypothesis <command>H:P</command>. If <command>H</command> is
+             omitted, the name of the hypothesis is automatically generated.
+             The second sequent has conclusion <command>P</command> and
+             hypotheses the hypotheses of the current sequent to prove.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_decompose">
+    <title>decompose</title>
+    <titleabbrev>decompose</titleabbrev>
+    <para><userinput>
+     decompose as H<subscript>1</subscript> ... H<subscript>m</subscript>
+    </userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para>
+            <emphasis role="bold">decompose</emphasis>
+            [<emphasis role="bold">as</emphasis> &id;…]
+           </para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>
+            For each each premise <command>H</command> of type 
+            <command>T</command> in the current context where
+            <command>T</command> is a non-recursive inductive type without
+            right parameters and of sort Prop or CProp, the tactic runs
+            <command> 
+             elim H as H<subscript>1</subscript> ... H<subscript>m</subscript>
+            </command>, clears <command>H</command>  and runs itself
+            recursively on each new premise introduced by 
+            <command>elim</command> in the opened sequents. 
+           </para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>
+            The ones generated by all the <command>elim</command> tactics run.
+           </para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_demodulate">
+    <title>demodulate</title>
+    <titleabbrev>demodulate</titleabbrev>
+    <para><userinput>demodulate</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">demodulate</emphasis></para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>&TODO;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_destruct">
+    <title>destruct</title>
+    <titleabbrev>destruct</titleabbrev>
+    <para><userinput>destruct p</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">destruct</emphasis> &sterm;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para><command>p</command> must have type <command>E<subscript>1</subscript> = E<subscript>2</subscript></command> where the two sides of the equality are possibly applied constructors of an inductive type.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>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 <command>p</command>. 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.
+            </para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_elim">
+    <title>elim</title>
+    <titleabbrev>elim</titleabbrev>
+    <para><userinput>elim t using th hyps</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">elim</emphasis> &sterm; [<emphasis role="bold">using</emphasis> &sterm;] &intros-spec;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para><command>t</command> must inhabit an inductive type and
+             <command>th</command> must be an elimination principle for that
+             inductive type. If <command>th</command> is omitted the appropriate
+             standard elimination principle is chosen.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It proceeds by cases on the values of <command>t</command>,
+             according to the elimination principle <command>th</command>.
+            </para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>It opens one new sequent for each case. The names of
+             the new hypotheses are picked by <command>hyps</command>, 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.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_elimType">
+    <title>elimType</title>
+    <titleabbrev>elimType</titleabbrev>
+    <para><userinput>elimType T using th hyps</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">elimType</emphasis> &sterm; [<emphasis role="bold">using</emphasis> &sterm;] &intros-spec;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para><command>T</command> must be an inductive type.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>TODO (severely bugged now).</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>TODO</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_exact">
+    <title>exact</title>
+    <titleabbrev>exact</titleabbrev>
+    <para><userinput>exact p</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">exact</emphasis> &sterm;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>The type of <command>p</command> must be convertible
+             with the conclusion of the current sequent.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It closes the current sequent using <command>p</command>.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_exists">
+    <title>exists</title>
+    <titleabbrev>exists</titleabbrev>
+    <para><userinput>exists </userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">exists</emphasis></para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>The conclusion of the current sequent must be
+             an inductive type or the application of an inductive type
+             with at least one constructor.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>Equivalent to <command>constructor 1</command>.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>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 <command>constructor</command> tactic.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_fail">
+    <title>fail</title>
+    <titleabbrev>fail</titleabbrev>
+    <para><userinput>fail</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">fail</emphasis></para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>This tactic always fail.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>N.A.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_fold">
+    <title>fold</title>
+    <titleabbrev>fold</titleabbrev>
+    <para><userinput>fold red t patt</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">fold</emphasis> &reduction-kind; &sterm; &pattern;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>The pattern must not specify the wanted term.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>First of all it locates all the subterms matched by
+             <command>patt</command>. In the context of each matched subterm
+             it disambiguates the term <command>t</command> and reduces it
+             to its <command>red</command> normal form; then it replaces with
+             <command>t</command> every occurrence of the normal form in the
+             matched subterm.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_fourier">
+    <title>fourier</title>
+    <titleabbrev>fourier</titleabbrev>
+    <para><userinput>fourier </userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">fourier</emphasis></para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>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.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It closes the current sequent by applying the Fourier method.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_fwd">
+    <title>fwd</title>
+    <titleabbrev>fwd</titleabbrev>
+    <para><userinput>fwd H as H<subscript>0</subscript> ... H<subscript>n</subscript></userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">fwd</emphasis> &id; [<emphasis role="bold">as</emphasis> &id; [&id;]…]</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>
+              The type of <command>H</command> must be the premise of a
+               forward simplification theorem.
+           </para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>
+            This tactic is under development.
+             It simplifies the current context by removing
+            <command>H</command> using the following methods:
+            forward application (by <command>lapply</command>) of a suitable
+            simplification theorem, chosen automatically, of which the type
+            of <command>H</command> is a premise, 
+            decomposition (by <command>decompose</command>),
+            rewriting (by <command>rewrite</command>).
+            <command>H<subscript>0</subscript> ... H<subscript>n</subscript></command>
+            are passed to the tactics <command>fwd</command> invokes, as
+             names for the premise they introduce.
+           </para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>
+            The ones opened by the tactics <command>fwd</command> invokes.
+           </para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_generalize">
+    <title>generalize</title>
+    <titleabbrev>generalize</titleabbrev>
+    <para><userinput>generalize patt as H</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">generalize</emphasis> &pattern; [<emphasis role="bold">as</emphasis> &id;]</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>All the terms matched by <command>patt</command> must be
+             convertible and close in the context of the current sequent.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It closes the current sequent by applying a stronger
+             lemma that is proved using the new generated sequent.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>It opens a new sequent where the current sequent conclusion
+             <command>G</command> is generalized to
+             <command>∀x.G{x/t}</command> where <command>{x/t}</command>
+             is a notation for the replacement with <command>x</command> of all
+             the occurrences of the term <command>t</command> matched by
+             <command>patt</command>. If <command>patt</command> matches no
+             subterm then <command>t</command> is defined as the
+             <command>wanted</command> part of the pattern.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_id">
+    <title>id</title>
+    <titleabbrev>id</titleabbrev>
+    <para><userinput>id </userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">id</emphasis></para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>This identity tactic does nothing without failing.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_intro">
+    <title>intro</title>
+    <titleabbrev>intro</titleabbrev>
+    <para><userinput>intro H</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">intro</emphasis> [&id;]</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>The conclusion of the sequent to prove must be an implication
+             or a universal quantification.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It applies the right introduction rule for implication,
+             closing the current sequent.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>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 <command>H</command> if provided; otherwise it
+             is automatically generated.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_intros">
+    <title>intros</title>
+    <titleabbrev>intros</titleabbrev>
+    <para><userinput>intros hyps</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">intros</emphasis> &intros-spec;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>If <command>hyps</command> 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.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It applies several times the right introduction rule for
+             implication, closing the current sequent.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>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.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_inversion">
+    <title>inversion</title>
+    <titleabbrev>inversion</titleabbrev>
+    <para><userinput>inversion t</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">inversion</emphasis> &sterm;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>The type of the term <command>t</command> must be an inductive
+             type or the application of an inductive type.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It proceeds by cases on <command>t</command> paying attention
+             to the constraints imposed by the actual &quot;right arguments&quot;
+             of the inductive type.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>It opens one new sequent to prove for each case in the
+             definition of the type of <command>t</command>. With respect to
+             a simple elimination, each new sequent has additional hypotheses
+             that states the equalities of the &quot;right parameters&quot;
+             of the inductive type with terms originally present in the
+             sequent to prove.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_lapply">
+    <title>lapply</title>
+    <titleabbrev>lapply</titleabbrev>
+    <para><userinput>
+     lapply linear depth=d t 
+     to t<subscript>1</subscript>, ..., t<subscript>n</subscript> as H
+    </userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para>
+            <emphasis role="bold">lapply</emphasis> 
+            [<emphasis role="bold">linear</emphasis>]
+            [<emphasis role="bold">depth=</emphasis>&nat;] 
+            &sterm; 
+            [<emphasis role="bold">to</emphasis>
+             &sterm;
+             [<emphasis role="bold">,</emphasis>&sterm;…]
+            ] 
+            [<emphasis role="bold">as</emphasis> &id;]
+           </para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>
+            <command>t</command> must have at least <command>d</command>
+            independent premises and <command>n</command> must not be
+            greater than <command>d</command>.
+           </para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>
+            Invokes <command>letin H ≝ (t ? ... ?)</command>
+            with enough <command>?</command>'s to reach the 
+            <command>d</command>-th independent premise of
+            <command>t</command>
+            (<command>d</command> is maximum if unspecified).       
+            Then istantiates (by <command>apply</command>) with
+            t<subscript>1</subscript>, ..., t<subscript>n</subscript>
+            the <command>?</command>'s corresponding to the first 
+            <command>n</command> independent premises of
+            <command>t</command>.
+            Usually the other <command>?</command>'s preceding the 
+            <command>n</command>-th independent premise of
+            <command>t</command> are istantiated as a consequence.
+            If the <command>linear</command> flag is specified and if 
+            <command>t, t<subscript>1</subscript>, ..., t<subscript>n</subscript></command>
+            are (applications of) premises in the current context, they are
+             <command>clear</command>ed. 
+           </para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>
+            The ones opened by the tactics <command>lapply</command> invokes.
+           </para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_left">
+    <title>left</title>
+    <titleabbrev>left</titleabbrev>
+    <para><userinput>left </userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">left</emphasis></para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>The conclusion of the current sequent must be
+             an inductive type or the application of an inductive type
+             with at least one constructor.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>Equivalent to <command>constructor 1</command>.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>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 <command>constructor</command> tactic.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_letin">
+    <title>letin</title>
+    <titleabbrev>letin</titleabbrev>
+    <para><userinput>letin x ≝ t</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">letin</emphasis> &id; <emphasis role="bold">≝</emphasis> &sterm;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It adds to the context of the current sequent to prove a new
+             definition <command>x ≝ t</command>.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_normalize">
+    <title>normalize</title>
+    <titleabbrev>normalize</titleabbrev>
+    <para><userinput>normalize patt</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">normalize</emphasis> &pattern;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It replaces all the terms matched by <command>patt</command>
+             with their βδιζ-normal form.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_reduce">
+    <title>reduce</title>
+    <titleabbrev>reduce</titleabbrev>
+    <para><userinput>reduce patt</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">reduce</emphasis> &pattern;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It replaces all the terms matched by <command>patt</command>
+             with their βδιζ-normal form.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_reflexivity">
+    <title>reflexivity</title>
+    <titleabbrev>reflexivity</titleabbrev>
+    <para><userinput>reflexivity </userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">reflexivity</emphasis></para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>The conclusion of the current sequent must be
+             <command>t=t</command> for some term <command>t</command></para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It closes the current sequent by reflexivity
+             of equality.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_replace">
+    <title>replace</title>
+    <titleabbrev>change</titleabbrev>
+    <para><userinput>change patt with t</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">replace</emphasis> &pattern; <emphasis role="bold">with</emphasis> &sterm;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It replaces the subterms of the current sequent matched by
+             <command>patt</command> with the new term <command>t</command>.
+             For each subterm matched by the pattern, <command>t</command> is
+             disambiguated in the context of the subterm.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>For each matched term <command>t'</command> it opens
+             a new sequent to prove whose conclusion is
+             <command>t'=t</command>.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_rewrite">
+    <title>rewrite</title>
+    <titleabbrev>rewrite</titleabbrev>
+    <para><userinput>rewrite dir p patt</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">rewrite</emphasis> [<emphasis role="bold">&lt;</emphasis>|<emphasis role="bold">&gt;</emphasis>] &sterm; &pattern;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para><command>p</command> must be the proof of an equality,
+             possibly under some hypotheses.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It looks in every term matched by <command>patt</command>
+             for all the occurrences of the
+             left hand side of the equality that <command>p</command> proves
+             (resp. the right hand side if <command>dir</command> is
+             <command>&lt;</command>). Every occurence found is replaced with
+             the opposite side of the equality.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>It opens one new sequent for each hypothesis of the
+             equality proved by <command>p</command> that is not closed
+             by unification.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_right">
+    <title>right</title>
+    <titleabbrev>right</titleabbrev>
+    <para><userinput>right </userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">right</emphasis></para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>The conclusion of the current sequent must be
+             an inductive type or the application of an inductive type with
+             at least two constructors.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>Equivalent to <command>constructor 2</command>.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>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 <command>constructor</command> tactic.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_ring">
+    <title>ring</title>
+    <titleabbrev>ring</titleabbrev>
+    <para><userinput>ring </userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">ring</emphasis></para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>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.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It closes the current sequent veryfying the equality by
+             means of computation (i.e. this is a reflexive tactic, implemented
+             exploiting the &quot;two level reasoning&quot; technique).</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_simplify">
+    <title>simplify</title>
+    <titleabbrev>simplify</titleabbrev>
+    <para><userinput>simplify patt</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">simplify</emphasis> &pattern;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It replaces all the terms matched by <command>patt</command>
+             with other convertible terms that are supposed to be simpler.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_split">
+    <title>split</title>
+    <titleabbrev>split</titleabbrev>
+    <para><userinput>split </userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">split</emphasis></para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>The conclusion of the current sequent must be
+             an inductive type or the application of an inductive type with
+             at least one constructor.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>Equivalent to <command>constructor 1</command>.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>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 <command>constructor</command> tactic.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  
+  <sect1 id="tac_subst">
+    <title>subst</title>
+    <titleabbrev>subst</titleabbrev>
+    <para><userinput>subst</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">subst</emphasis></para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem><para>
+           None.
+         </para></listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem><para>
+           For each premise of the form 
+           <command>H: x = t</command> or <command>H: t = x</command>
+           where <command>x</command> is a local variable and 
+           <command>t</command> does not depend on <command>x</command>,
+           the tactic rewrites <command>H</command> wherever 
+           <command>x</command> appears clearing <command>H</command> and
+           <command>x</command> afterwards.
+         </para></listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem><para>
+           The one opened by the applied tactics.
+          </para></listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_symmetry">
+    <title>symmetry</title>
+    <titleabbrev>symmetry</titleabbrev>
+    <para>The tactic <command>symmetry</command> </para>
+    <para><userinput>symmetry </userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">symmetry</emphasis></para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>The conclusion of the current proof must be an equality.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It swaps the two sides of the equalityusing the symmetric
+             property.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_transitivity">
+    <title>transitivity</title>
+    <titleabbrev>transitivity</titleabbrev>
+    <para><userinput>transitivity t</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">transitivity</emphasis> &sterm;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>The conclusion of the current proof must be an equality.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It closes the current sequent by transitivity of the equality.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>It opens two new sequents <command>l=t</command> and
+             <command>t=r</command> where <command>l</command> and <command>r</command> are the left and right hand side of the equality in the conclusion of
+the current sequent to prove.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_unfold">
+    <title>unfold</title>
+    <titleabbrev>unfold</titleabbrev>
+    <para><userinput>unfold t patt</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">unfold</emphasis> [&sterm;] &pattern;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It finds all the occurrences of <command>t</command>
+             (possibly applied to arguments) in the subterms matched by
+             <command>patt</command>. Then it δ-expands each occurrence,
+             also performing β-reduction of the obtained term. If
+             <command>t</command> is omitted it defaults to each
+             subterm matched by <command>patt</command>.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+  <sect1 id="tac_whd">
+    <title>whd</title>
+    <titleabbrev>whd</titleabbrev>
+    <para><userinput>whd patt</userinput></para>
+    <para>
+      <variablelist>
+        <varlistentry role="tactic.synopsis">
+          <term>Synopsis:</term>
+          <listitem>
+            <para><emphasis role="bold">whd</emphasis> &pattern;</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Pre-conditions:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>Action:</term>
+          <listitem>
+            <para>It replaces all the terms matched by <command>patt</command>
+             with their βδιζ-weak-head normal form.</para>
+          </listitem>
+        </varlistentry>
+        <varlistentry>
+          <term>New sequents to prove:</term>
+          <listitem>
+            <para>None.</para>
+          </listitem>
+        </varlistentry>
+      </variablelist>
+    </para>
+  </sect1>
+
+</chapter>
+
diff --git a/matita/help/C/sec_terms.xml b/matita/help/C/sec_terms.xml
new file mode 100644 (file)
index 0000000..3cae2f8
--- /dev/null
@@ -0,0 +1,760 @@
+
+<!-- =========== Terms, declarations and definitions ============ -->
+
+<chapter id="sec_terms">
+  <title>Syntax</title>
+  <para>To describe syntax in this manual we use the following conventions:</para>
+  <orderedlist>
+    <listitem><para>Non terminal symbols are emphasized and have a link to their
+       definition. E.g.: &term;</para></listitem>
+    <listitem><para>Terminal symbols are in bold. E.g.:
+       <emphasis role="bold">theorem</emphasis></para></listitem>
+    <listitem><para>Optional sequences of elements are put in square brackets.
+       E.g.: [<emphasis role="bold">in</emphasis> &term;]</para></listitem>
+    <listitem><para>Alternatives are put in square brakets and they are
+       separated by vertical bars. E.g.: [<emphasis role="bold">&lt;</emphasis>|<emphasis role="bold">&gt;</emphasis>]</para></listitem>
+    <listitem><para>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.: [<emphasis role="bold">and</emphasis> &term;]…</para></listitem>
+    <listitem><para>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.: [<emphasis role="bold">a</emphasis>-<emphasis role="bold">zA</emphasis>-<emphasis role="bold">Z0</emphasis>-<emphasis role="bold">9_-</emphasis>]</para></listitem>
+  </orderedlist>
+  <sect1 id="terms_and_co">
+  <title>Terms &amp; co.</title>
+  <sect2 id="lexical">
+  <title>Lexical conventions</title>
+    <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+      <title>qstring</title>
+      <tgroup cols="4">
+      <tbody>
+       <row>
+       <entry id="grammar.qstring">&qstring;</entry>
+       <entry>::=</entry>
+        <entry><emphasis role="bold">&quot;</emphasis><emphasis>〈〈any sequence of characters excluded &quot;〉〉</emphasis><emphasis role="bold">&quot;</emphasis></entry>
+       </row>
+      </tbody>
+     </tgroup>
+    </table>
+    <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+      <title>id</title>
+      <tgroup cols="4">
+      <tbody>
+       <row>
+       <entry id="grammar.id">&id;</entry>
+       <entry>::=</entry>
+        <entry><emphasis>〈〈any sequence of letters, underscores or valid <ulink type="http" url="http://www.w3.org/TR/2004/REC-xml-20040204/#NT-Digit">XML digits</ulink> prefixed by a latin letter ([a-zA-Z]) and post-fixed by a possible empty sequence of decorators ([?'`])〉〉</emphasis></entry>
+       </row>
+      </tbody>
+     </tgroup>
+    </table>
+    <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+      <title>nat</title>
+      <tgroup cols="4">
+      <tbody>
+       <row>
+       <entry id="grammar.nat">&nat;</entry>
+       <entry>::=</entry>
+       <entry><emphasis>〈〈any sequence of valid <ulink type="http" url="http://www.w3.org/TR/2004/REC-xml-20040204/#NT-Digit">XML digits</ulink>〉〉</emphasis></entry>
+       </row>
+      </tbody>
+     </tgroup>
+    </table>
+    <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+      <title>char</title>
+      <tgroup cols="4">
+      <tbody>
+       <row>
+       <entry id="grammar.char">&char;</entry>
+       <entry>::=</entry>
+       <entry>[<emphasis role="bold">a</emphasis>-<emphasis role="bold">zA</emphasis>-<emphasis role="bold">Z0</emphasis>-<emphasis role="bold">9_-</emphasis>]</entry>
+       </row>
+      </tbody>
+     </tgroup>
+    </table>
+    <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+      <title>uri-step</title>
+      <tgroup cols="4">
+      <tbody>
+       <row>
+       <entry id="grammar.uri-step">&uri-step;</entry>
+       <entry>::=</entry>
+       <entry>&char;[&char;]…</entry>
+       </row>
+      </tbody>
+     </tgroup>
+    </table>
+    <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+      <title>uri</title>
+      <tgroup cols="4">
+      <tbody>
+       <row>
+       <entry id="grammar.uri">&uri;</entry>
+       <entry>::=</entry>
+       <entry>[<emphasis role="bold">cic:/</emphasis>|<emphasis role="bold">theory:/</emphasis>]&uri-step;[<emphasis role="bold">/</emphasis>&uri-step;]…<emphasis role="bold">.</emphasis>&id;[<emphasis role="bold">.</emphasis>&id;]…[<emphasis role="bold">#xpointer(</emphasis>&nat;<emphasis role="bold">/</emphasis>&nat;[<emphasis role="bold">/</emphasis>&nat;]…<emphasis role="bold">)</emphasis>]</entry>
+       </row>
+      </tbody>
+     </tgroup>
+    </table>
+  </sect2>
+  <sect2 id="terms">
+  <title>Terms</title>
+
+  <!-- ZACK: Sample EBNF snippet, see:
+  http://www.docbook.org/tdg/en/html/productionset.html -->
+  <!--
+  <productionset>
+    <title>Terms</title>
+    <production id="grammar.term">
+      <lhs>&term;</lhs>
+      <rhs>&sterm;</rhs>
+      <lineannotation></lineannotation>
+    </production>
+  </productionset>
+  -->
+
+  <para>
+  <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+    <title>Terms</title>
+    <tgroup cols="4">
+    <tbody>
+     <row>
+      <entry id="grammar.term">&term;</entry>
+      <entry>::=</entry>
+      <entry>&sterm;</entry>
+      <entry>simple or delimited term</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry>&term; &term;</entry>
+      <entry>application</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry><emphasis role="bold">λ</emphasis>&args;<emphasis role="bold">.</emphasis>&term;</entry>
+      <entry>λ-abstraction</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry><emphasis role="bold">Π</emphasis>&args;<emphasis role="bold">.</emphasis>&term;</entry>
+      <entry>dependent product meant to define a datatype</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry><emphasis role="bold">∀</emphasis>&args;<emphasis role="bold">.</emphasis>&term;</entry>
+      <entry>dependent product meant to define a proposition</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry>&term; <emphasis role="bold">→</emphasis> &term;</entry>
+      <entry>non-dependent product (logical implication or function space)</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry><emphasis role="bold">let</emphasis> [&id;|(&id;<emphasis role="bold">:</emphasis> &term;)] <emphasis role="bold">≝</emphasis> &term; <emphasis role="bold">in</emphasis> &term;</entry>
+      <entry>local definition</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry>
+       <emphasis role="bold">let</emphasis>
+       [<emphasis role="bold">co</emphasis>]<emphasis role="bold">rec</emphasis>
+       &rec_def;
+      </entry>
+      <entry>(co)recursive definitions</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry/>
+      <entry>
+      [<emphasis role="bold">and</emphasis> &rec_def;]…
+      </entry>
+      <entry/>
+     </row>
+     <row>
+      <entry/>
+      <entry/>
+      <entry>
+      <emphasis role="bold">in</emphasis> &term;
+      </entry>
+      <entry/>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry>…</entry>
+      <entry>user provided notation</entry>
+     </row>
+      <row>
+       <entry id="grammar.rec_def">&rec_def;</entry>
+       <entry>::=</entry>
+       <entry>
+         &id; [&id;|<emphasis role="bold">_</emphasis>|<emphasis role="bold">(</emphasis>&id;[<emphasis role="bold">,</emphasis>&id;]… <emphasis role="bold">:</emphasis>&term;<emphasis role="bold">)</emphasis>]…
+       </entry>
+       <entry />
+      </row>
+      <row>
+       <entry />
+       <entry />
+       <entry>
+         [<emphasis role="bold">on</emphasis> &id;]
+         [<emphasis role="bold">:</emphasis> &term;]
+         <emphasis role="bold">≝</emphasis> &term;]
+       </entry>
+       <entry />
+      </row>
+    </tbody>
+   </tgroup>
+  </table>
+
+  <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+    <title>Simple terms</title>
+    <tgroup cols="4">
+    <tbody>
+     <row>
+      <entry id="grammar.sterm">&sterm;</entry>
+      <entry>::=</entry>
+      <entry><emphasis role="bold">(</emphasis>&term;<emphasis role="bold">)</emphasis></entry>
+      <entry/>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry>&id;[<emphasis role="bold">\subst[</emphasis>
+       &id;<emphasis role="bold">≔</emphasis>&term;
+       [<emphasis role="bold">;</emphasis>&id;<emphasis role="bold">≔</emphasis>&term;]…
+       <emphasis role="bold">]</emphasis>]
+      </entry>
+      <entry>identifier with optional explicit named substitution</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry>&uri;</entry>
+      <entry>a qualified reference</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry><emphasis role="bold">Prop</emphasis></entry>
+      <entry>the impredicative sort of propositions</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry><emphasis role="bold">Set</emphasis></entry>
+      <entry>the impredicate sort of datatypes</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry><emphasis role="bold">CProp</emphasis></entry>
+      <entry>one fixed predicative sort of constructive propositions</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry><emphasis role="bold">Type</emphasis></entry>
+      <entry>one predicative sort of datatypes</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry><emphasis role="bold">?</emphasis></entry>
+      <entry>implicit argument</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry><emphasis role="bold">?n</emphasis>
+      [<emphasis role="bold">[</emphasis>
+      [<emphasis role="bold">_</emphasis>|&term;]…
+      <emphasis role="bold">]</emphasis>]</entry>
+      <entry>metavariable</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+        <entry><emphasis role="bold">match</emphasis> &term; 
+        [ <emphasis role="bold">in</emphasis> &id; ]
+        [ <emphasis role="bold">return</emphasis> &term; ]
+        <emphasis role="bold">with</emphasis>
+      </entry>
+      <entry>case analysis</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry/>
+      <entry>
+       <emphasis role="bold">[</emphasis> 
+       &match_branch;[<emphasis role="bold">|</emphasis>&match_branch;]…
+       <emphasis role="bold">]</emphasis> 
+      </entry>
+      <entry/>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry><emphasis role="bold">(</emphasis>&term;<emphasis role="bold">:</emphasis>&term;<emphasis role="bold">)</emphasis></entry>
+      <entry>cast</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry>…</entry>
+      <entry>user provided notation at precedence 90</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+
+  <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+    <title>Arguments</title>
+    <tgroup cols="4">
+    <tbody>
+     <row>
+      <entry id="grammar.args">&args;</entry>
+      <entry>::=</entry>
+      <entry>
+       <emphasis role="bold">_</emphasis>[<emphasis role="bold">:</emphasis> &term;]
+      </entry>
+      <entry>ignored argument</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry>
+       <emphasis role="bold">(</emphasis><emphasis role="bold">_</emphasis>[<emphasis role="bold">:</emphasis> &term;]<emphasis role="bold">)</emphasis>
+      </entry>
+      <entry>ignored argument</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry>&id;[<emphasis role="bold">,</emphasis>&id;]…[<emphasis role="bold">:</emphasis> &term;]</entry>
+      <entry></entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry><emphasis role="bold">(</emphasis>&id;[<emphasis role="bold">,</emphasis>&id;]…[<emphasis role="bold">:</emphasis> &term;]<emphasis role="bold">)</emphasis></entry>
+      <entry/>
+     </row>
+     <row>
+      <entry id="grammar.args2">&args2;</entry>
+      <entry>::=</entry>
+      <entry>&id;</entry>
+      <entry/>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry><emphasis role="bold">(</emphasis>&id;[<emphasis role="bold">,</emphasis>&id;]…<emphasis role="bold">:</emphasis> &term;<emphasis role="bold">)</emphasis></entry>
+      <entry/>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+
+  <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+    <title>Pattern matching</title>
+    <tgroup cols="4">
+    <tbody>
+      <row>
+       <entry id="grammar.match_branch">&match_branch;</entry>
+       <entry>::=</entry>
+       <entry>&match_pattern; <emphasis role="bold">⇒</emphasis> &term;</entry>
+       <entry />
+      </row>
+     <row>
+      <entry id="grammar.match_pattern">&match_pattern;</entry>
+      <entry>::=</entry>
+      <entry>&id;</entry>
+      <entry>0-ary constructor</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry><emphasis role="bold">(</emphasis>&id; &id; [&id;]…<emphasis role="bold">)</emphasis></entry>
+      <entry>n-ary constructor (binds the n arguments)</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry>&id; &id; [&id;]…</entry>
+      <entry>n-ary constructor (binds the n arguments)</entry>
+     </row>
+     <row>
+      <entry/>
+      <entry>|</entry>
+      <entry><emphasis role="bold">_</emphasis></entry>
+      <entry>any remaining constructor (ignoring its arguments)</entry>
+     </row>
+    </tbody>
+   </tgroup>
+  </table>
+  </para>
+
+  </sect2>
+  </sect1>
+
+  <sect1 id="axiom_definition_declaration">
+   <title>Definitions and declarations</title>
+   <sect2 id="axiom">
+    <title><emphasis role="bold">axiom</emphasis> &id;<emphasis role="bold">:</emphasis> &term;</title>
+    <titleabbrev>axiom</titleabbrev>
+    <para><userinput>axiom H: P</userinput></para>
+    <para><command>H</command> is declared as an axiom that states <command>P</command></para>
+  </sect2>
+  <sect2 id="definition">
+    <title><emphasis role="bold">definition</emphasis> &id;[<emphasis role="bold">:</emphasis> &term;] [<emphasis role="bold">≝</emphasis> &term;]</title>
+    <titleabbrev>definition</titleabbrev>
+    <para><userinput>definition f: T ≝ t</userinput></para>
+    <para><command>f</command> is defined as <command>t</command>;
+     <command>T</command> is its type. An error is raised if the type of
+     <command>t</command> is not convertible to <command>T</command>.</para>
+    <para><command>T</command> is inferred from <command>t</command> if
+      omitted.</para>
+    <para><command>t</command> can be omitted only if <command>T</command> is
+     given. In this case Matita enters in interactive mode and
+     <command>f</command> must be defined by means of tactics.</para>
+    <para>Notice that the command is equivalent to <command>theorem f: T ≝ t</command>.</para>
+  </sect2>
+  <sect2 id="letrec">
+    <title><emphasis role="bold">letrec</emphasis> &TODO;</title>
+    <titleabbrev>&TODO;</titleabbrev>
+    <para>&TODO;</para>
+  </sect2>
+  <sect2 id="inductive">
+    <title>[<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;]…]…
+</title>
+    <titleabbrev>(co)inductive types declaration</titleabbrev>
+    <para><userinput>inductive i x y z: S ≝ k1:T1 | … | kn:Tn with i' : S' ≝ k1':T1' | … | km':Tm'</userinput></para>
+    <para>Declares a family of two mutually inductive types
+     <command>i</command> and <command>i'</command> whose types are
+     <command>S</command> and <command>S'</command>, which must be convertible
+     to sorts.</para>
+    <para>The constructors <command>ki</command> of type <command>Ti</command>
+     and <command>ki'</command> of type <command>Ti'</command> are also
+     simultaneously declared. The declared types <command>i</command> and
+     <command>i'</command> may occur in the types of the constructors, but
+     only in strongly positive positions according to the rules of the
+     calculus.</para>
+    <para>The whole family is parameterized over the arguments <command>x,y,z</command>.</para>
+    <para>If the keyword <command>coinductive</command> is used, the declared
+     types are considered mutually coinductive.</para>
+    <para>Elimination principles for the record are automatically generated
+     by Matita, if allowed by the typing rules of the calculus according to
+     the sort <command>S</command>. If generated,
+     they are named <command>i_ind</command>, <command>i_rec</command> and
+     <command>i_rect</command> according to the sort of their induction
+     predicate.</para> 
+  </sect2>
+  <sect2 id="record">
+    <title><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">:&gt;</emphasis>] &term;] [<emphasis role="bold">;</emphasis>&id; [<emphasis role="bold">:</emphasis>|<emphasis role="bold">:&gt;</emphasis>] &term;]…<emphasis role="bold">}</emphasis></title>
+    <titleabbrev>record</titleabbrev>
+    <para><userinput>record id x y z: S ≝ { f1: T1; …; fn:Tn }</userinput></para>
+    <para>Declares a new record family <command>id</command> parameterized over
+     <command>x,y,z</command>.</para>
+    <para><command>S</command> is the type of the record
+     and it must be convertible to a sort.</para>
+    <para>Each field <command>fi</command> is declared by giving its type
+     <command>Ti</command>. A record without any field is admitted.</para>
+    <para>Elimination principles for the record are automatically generated
+     by Matita, if allowed by the typing rules of the calculus according to
+     the sort <command>S</command>. If generated,
+     they are named <command>i_ind</command>, <command>i_rec</command> and
+     <command>i_rect</command> according to the sort of their induction
+     predicate.</para> 
+    <para>For each field <command>fi</command> a record projection
+     <command>fi</command> is also automatically generated if projection
+     is allowed by the typing rules of the calculus according to the
+     sort <command>S</command>, the type <command>T1</command> and
+     the definability of depending record projections.</para>
+    <para>If the type of a field is declared with <command>:&gt;</command>,
+     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.</para>
+  </sect2>
+  </sect1>
+
+  <sect1 id="proofs">
+   <title>Proofs</title>
+   <sect2 id="theorem">
+    <title><emphasis role="bold">theorem</emphasis> &id;[<emphasis role="bold">:</emphasis> &term;] [<emphasis role="bold">≝</emphasis> &term;]</title>
+    <titleabbrev>theorem</titleabbrev>
+    <para><userinput>theorem f: P ≝ p</userinput></para>
+    <para>Proves a new theorem <command>f</command> whose thesis is
+     <command>P</command>.</para>
+    <para>If <command>p</command> is provided, it must be a proof term for
+     <command>P</command>. Otherwise an interactive proof is started.</para>
+    <para><command>P</command> can be omitted only if the proof is not
+     interactive.</para>
+    <para>Proving a theorem already proved in the library is an error.
+     To provide an alternative name and proof for the same theorem, use
+     <command>variant f: P ≝ p</command>.</para>
+    <para>A warning is raised if the name of the theorem cannot be obtained
+      by mangling the name of the constants in its thesis.</para>
+    <para>Notice that the command is equivalent to <command>definition f: T ≝ t</command>.</para>
+   </sect2>
+   <sect2 id="variant">
+    <title><emphasis role="bold">variant</emphasis> &id;<emphasis role="bold">:</emphasis> &term; <emphasis role="bold">≝</emphasis> &term;</title>
+    <titleabbrev>variant</titleabbrev>
+    <para><userinput>variant f: T ≝ t</userinput></para>
+    <para>Same as <command>theorem f: T ≝ t</command>, 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.</para>
+   </sect2>
+   <sect2 id="lemma">
+    <title><emphasis role="bold">lemma</emphasis> &id;[<emphasis role="bold">:</emphasis> &term;] [<emphasis role="bold">≝</emphasis> &term;]</title>
+    <titleabbrev>lemma</titleabbrev>
+    <para><userinput>lemma f: T ≝ t</userinput></para>
+    <para>Same as <command>theorem f: T ≝ t</command></para>
+   </sect2>
+   <sect2 id="fact">
+    <title><emphasis role="bold">fact</emphasis> &id;[<emphasis role="bold">:</emphasis> &term;] [<emphasis role="bold">≝</emphasis> &term;]</title>
+    <titleabbrev>fact</titleabbrev>
+    <para><userinput>fact f: T ≝ t</userinput></para>
+    <para>Same as <command>theorem f: T ≝ t</command></para>
+   </sect2>
+   <sect2 id="remark">
+    <title><emphasis role="bold">remark</emphasis> &id;[<emphasis role="bold">:</emphasis> &term;] [<emphasis role="bold">≝</emphasis> &term;]</title>
+    <titleabbrev>remark</titleabbrev>
+    <para><userinput>remark f: T ≝ t</userinput></para>
+    <para>Same as <command>theorem f: T ≝ t</command></para>
+   </sect2>
+  </sect1>
+
+  <sect1 id="tacticargs">
+   <title>Tactic arguments</title>
+   <para>This section documents the syntax of some recurring arguments for
+    tactics.</para>
+
+    <sect2 id="introsspec">
+    <title>intros-spec</title>
+    <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+      <title>intros-spec</title>
+      <tgroup cols="4">
+      <tbody>
+       <row>
+       <entry id="grammar.intros-spec">&intros-spec;</entry>
+       <entry>::=</entry>
+        <entry>[&nat;] [<emphasis role="bold">(</emphasis>[&id;]…<emphasis role="bold">)</emphasis>]</entry>
+       </row>
+      </tbody>
+     </tgroup>
+    </table>
+        <para>The natural number is the number of new hypotheses to be introduced. The list of identifiers gives the name for the first hypotheses.</para>
+    </sect2>
+
+    <sect2 id="pattern">
+    <title>pattern</title>
+    <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+      <title>pattern</title>
+      <tgroup cols="4">
+      <tbody>
+       <row>
+       <entry id="grammar.pattern">&pattern;</entry>
+       <entry>::=</entry>
+        <entry><emphasis role="bold">in</emphasis>
+          [&id;[<emphasis role="bold">:</emphasis> &path;]]…
+          [<emphasis role="bold">⊢</emphasis> &path;]]</entry>
+        <entry>simple pattern</entry>
+       </row>
+       <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><emphasis role="bold">in match</emphasis> &path;
+          [<emphasis role="bold">in</emphasis>
+          [&id;[<emphasis role="bold">:</emphasis> &path;]]…
+          [<emphasis role="bold">⊢</emphasis> &path;]]</entry>
+        <entry>full pattern</entry>
+       </row>
+      </tbody>
+     </tgroup>
+    </table>
+    <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+      <title>path</title>
+      <tgroup cols="4">
+      <tbody>
+       <row>
+       <entry id="grammar.path">&path;</entry>
+       <entry>::=</entry>
+        <entry><emphasis>〈〈any &sterm; without occurrences of <emphasis role="bold">Set</emphasis>, <emphasis role="bold">Prop</emphasis>, <emphasis role="bold">CProp</emphasis>, <emphasis role="bold">Type</emphasis>, &id;, &uri; and user provided notation; however, <emphasis role="bold">%</emphasis> is now an additional production for &sterm;〉〉</emphasis></entry>
+       </row>
+      </tbody>
+     </tgroup>
+    </table>
+    <para>A <emphasis>path</emphasis> locates zero or more subterms of a given term by mimicking the term structure up to:</para>
+    <orderedlist>
+      <listitem><para>Occurrences of the subterms to locate that are
+       represented by <emphasis role="bold">%</emphasis>.</para></listitem>
+      <listitem><para>Subterms without any occurrence of subterms to locate
+       that can be represented by <emphasis role="bold">?</emphasis>.
+       </para></listitem>
+    </orderedlist>
+    <para>Warning: the format for a path for a <emphasis role="bold">match</emphasis> … <emphasis role="bold">with</emphasis>
+     expression is restricted to: <emphasis role="bold">match</emphasis> &path;
+     <emphasis role="bold">with</emphasis>
+     <emphasis role="bold">[</emphasis>
+     <emphasis role="bold">_</emphasis>
+     <emphasis role="bold">⇒</emphasis>
+     &path;
+     <emphasis role="bold">|</emphasis> …
+     <emphasis role="bold">|</emphasis>
+     <emphasis role="bold">_</emphasis>
+     <emphasis role="bold">⇒</emphasis>
+     &path;
+     <emphasis role="bold">]</emphasis>
+     Its semantics is the following: the n-th 
+     &quot;<emphasis role="bold">_</emphasis>
+     <emphasis role="bold">⇒</emphasis>
+     &path;&quot; 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. 
+    </para>
+    <para>For instance, the path
+      <userinput>∀_,_:?.(? ? % ?)→(? ? ? %)</userinput>
+       locates at once the subterms
+      <userinput>x+y</userinput> and <userinput>x*y</userinput> in the
+      term <userinput>∀x,y:nat.x+y=1→0=x*y</userinput>
+      (where the notation <userinput>A=B</userinput> hides the term
+      <userinput>(eq T A B)</userinput> for some type <userinput>T</userinput>).
+    </para>
+    <para>A <emphasis>simple pattern</emphasis> extends paths to locate
+     subterms in a whole sequent. In particular, the pattern
+     <userinput>in H: p  K: q ⊢ r</userinput> locates at once all the subterms
+     located by the pattern <userinput>r</userinput> in the conclusion of the
+     sequent and by the patterns <userinput>p</userinput> and
+     <userinput>q</userinput> in the hypotheses <userinput>H</userinput>
+     and <userinput>K</userinput> of the sequent.
+    </para>
+    <para>If no list of hypotheses is provided in a simple pattern, no subterm
+     is selected in the hypothesis. If the <userinput>⊢ p</userinput>
+     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.
+    </para>
+    <para>Finally, a <emphasis>full pattern</emphasis> is interpreted in three
+     steps. In the first step the <userinput>match T in</userinput>
+     part is ignored and a set <emphasis>S</emphasis> of subterms is
+     located as for the case of
+     simple patterns. In the second step the term <userinput>T</userinput>
+     is parsed and interpreted in the context of each subterm
+     <emphasis>s ∈ S</emphasis>. In the last term for each
+     <emphasis>s ∈ S</emphasis> the interpreted term <userinput>T</userinput>
+     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 <userinput>T</userinput> in the subterms <emphasis>s</emphasis>.
+    </para>
+    <para>A full pattern can always be replaced by a simple pattern,
+      often at the cost of increased verbosity or decreased readability.</para>
+    <para>Example: the pattern
+      <userinput>⊢ in match x+y in ∀_,_:?.(? ? % ?)</userinput>
+      locates only the first occurrence of <userinput>x+y</userinput>
+      in the sequent <userinput>x,y: nat ⊢ ∀z,w:nat. (x+y) * (z+w) =
+      z * (x+y) + w * (x+y)</userinput>. The corresponding simple pattern
+      is <userinput>⊢ ∀_,_:?.(? ? (? % ?) ?)</userinput>.
+    </para>
+    <para>Every tactic that acts on subterms of the selected sequents have
+     a pattern argument for uniformity. To automatically generate a simple
+     pattern:</para>
+    <orderedlist>
+     <listitem><para>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.</para></listitem>
+     <listitem><para>From the contextual menu select &quot;Copy&quot;.</para></listitem>
+     <listitem><para>From the &quot;Edit&quot; or the contextual menu select
+      &quot;Paste as pattern&quot;</para></listitem>
+    </orderedlist>
+    </sect2>
+
+    <sect2 id="reduction-kind">
+    <title>reduction-kind</title>
+    <para>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.</para>
+    <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+      <title>reduction-kind</title>
+      <tgroup cols="4">
+      <tbody>
+       <row>
+       <entry id="grammar.reduction-kind">&reduction-kind;</entry>
+       <entry>::=</entry>
+        <entry><emphasis role="bold">normalize</emphasis></entry>
+        <entry>Computes the βδιζ-normal form</entry>
+       </row>
+       <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><emphasis role="bold">reduce</emphasis></entry>
+        <entry>Computes the βδιζ-normal form</entry>
+       </row>
+       <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><emphasis role="bold">simplify</emphasis></entry>
+        <entry>Computes a form supposed to be simpler</entry>
+       </row>
+       <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><emphasis role="bold">unfold</emphasis> [&sterm;]</entry>
+        <entry>δ-reduces the constant or variable if specified, or that
+         in head position</entry>
+       </row>
+       <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><emphasis role="bold">whd</emphasis></entry>
+        <entry>Computes the βδιζ-weak-head normal form</entry>
+       </row>
+      </tbody>
+     </tgroup>
+    </table>
+    </sect2>
+
+    <sect2 id="auto-params">
+    <title>auto-params</title>
+    <para>&TODO;</para>
+    <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+      <title>reduction-kind</title>
+      <tgroup cols="4">
+      <tbody>
+       <row>
+       <entry id="grammar.autoparams">&autoparams;</entry>
+       <entry>::=</entry>
+        <entry><emphasis role="bold">depth=&nat;</emphasis></entry>
+        <entry>&TODO;</entry>
+       </row>
+       <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><emphasis role="bold">width=&nat;</emphasis></entry>
+        <entry>&TODO;</entry>
+       </row>
+       <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><emphasis role="bold">&TODO;</emphasis></entry>
+        <entry>&TODO;</entry>
+       </row>
+      </tbody>
+     </tgroup>
+    </table>
+    </sect2>
+  </sect1>
+
+</chapter>
+
diff --git a/matita/help/C/sec_usernotation.xml b/matita/help/C/sec_usernotation.xml
new file mode 100644 (file)
index 0000000..147edc0
--- /dev/null
@@ -0,0 +1,18 @@
+
+<!-- ============ User Notation ====================== -->
+<chapter id="sec_usernotation">
+ <title>Extending the syntax</title>
+ <sect1>
+   <title>Introduction</title>
+   <para>
+     &TODO;
+   </para>
+   <para id="notation">
+     notation: &TODO;
+   </para>
+   <para id="interpretation">
+     interpretation: &TODO;
+   </para>
+ </sect1>
+</chapter>
+
diff --git a/matita/help/C/tactic_quickref.xml b/matita/help/C/tactic_quickref.xml
new file mode 100644 (file)
index 0000000..e1ff24b
--- /dev/null
@@ -0,0 +1,6 @@
+<table frame="topbot" rowsep="0" colsep="0" role="grammar">
+  <title>tacticssec__tactics</title>
+  <tgroup cols="3">
+    <tbody/>
+  </tgroup>
+</table>
diff --git a/matita/help/C/tactics_quickref.xml b/matita/help/C/tactics_quickref.xml
new file mode 100644 (file)
index 0000000..e6f2e2f
--- /dev/null
@@ -0,0 +1,312 @@
+<table frame="topbot" rowsep="0" colsep="0" role="grammar">
+  <title>tactics</title>
+  <tgroup cols="3">
+    <tbody>
+      <row>
+        <entry id="grammar.tactic">&tactic;</entry>
+        <entry>::=</entry>
+        <entry><link linkend="tac_absurd"><emphasis role="bold">absurd</emphasis></link> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_apply"><emphasis role="bold">apply</emphasis></link> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_applyS"><emphasis role="bold">applyS</emphasis></link> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis> <emphasis><link linkend="grammar.autoparams">auto_params</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+          <link linkend="tac_assumption">
+            <emphasis role="bold">assumption</emphasis>
+          </link>
+        </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_auto"><emphasis role="bold">auto</emphasis></link> <emphasis><link linkend="grammar.autoparams">auto_params</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+            <link linkend="tac_cases"><emphasis role="bold">cases</emphasis></link>
+            <emphasis><link linkend="grammar.term">term</link></emphasis> [<emphasis role="bold">(</emphasis>[<emphasis><link linkend="grammar.id">id</link></emphasis>]…<emphasis role="bold">)</emphasis>]
+           </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_change"><emphasis role="bold">change</emphasis></link> <emphasis><link linkend="grammar.pattern">pattern</link></emphasis> <emphasis role="bold">with</emphasis> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+            <link linkend="tac_clear"><emphasis role="bold">clear</emphasis></link>
+            <emphasis><link linkend="grammar.id">id</link></emphasis> [<emphasis><link linkend="grammar.id">id</link></emphasis>…]
+           </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_clearbody"><emphasis role="bold">clearbody</emphasis></link> <emphasis><link linkend="grammar.id">id</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_compose"><emphasis role="bold">compose</emphasis></link> [<emphasis><link linkend="grammar.nat">nat</link></emphasis>] <emphasis><link linkend="grammar.sterm">sterm</link></emphasis> [<emphasis role="bold">with</emphasis> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis>] [<emphasis><link linkend="grammar.intros-spec">intros-spec</link></emphasis>]</entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_constructor"><emphasis role="bold">constructor</emphasis></link> <emphasis><link linkend="grammar.nat">nat</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+          <link linkend="tac_contradiction">
+            <emphasis role="bold">contradiction</emphasis>
+          </link>
+        </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_cut"><emphasis role="bold">cut</emphasis></link> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis> [<emphasis role="bold">as</emphasis> <emphasis><link linkend="grammar.id">id</link></emphasis>]</entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+            <link linkend="tac_decompose"><emphasis role="bold">decompose</emphasis></link>
+            [<emphasis role="bold">as</emphasis> <emphasis><link linkend="grammar.id">id</link></emphasis>…]
+           </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+          <link linkend="tac_demodulate">
+            <emphasis role="bold">demodulate</emphasis>
+          </link>
+        </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_destruct"><emphasis role="bold">destruct</emphasis></link> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_elim"><emphasis role="bold">elim</emphasis></link> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis> [<emphasis role="bold">using</emphasis> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis>] <emphasis><link linkend="grammar.intros-spec">intros-spec</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_elimType"><emphasis role="bold">elimType</emphasis></link> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis> [<emphasis role="bold">using</emphasis> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis>] <emphasis><link linkend="grammar.intros-spec">intros-spec</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_exact"><emphasis role="bold">exact</emphasis></link> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+          <link linkend="tac_exists">
+            <emphasis role="bold">exists</emphasis>
+          </link>
+        </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+          <link linkend="tac_fail">
+            <emphasis role="bold">fail</emphasis>
+          </link>
+        </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_fold"><emphasis role="bold">fold</emphasis></link> <emphasis><link linkend="grammar.reduction-kind">reduction-kind</link></emphasis> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis> <emphasis><link linkend="grammar.pattern">pattern</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+          <link linkend="tac_fourier">
+            <emphasis role="bold">fourier</emphasis>
+          </link>
+        </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_fwd"><emphasis role="bold">fwd</emphasis></link> <emphasis><link linkend="grammar.id">id</link></emphasis> [<emphasis role="bold">as</emphasis> <emphasis><link linkend="grammar.id">id</link></emphasis> [<emphasis><link linkend="grammar.id">id</link></emphasis>]…]</entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_generalize"><emphasis role="bold">generalize</emphasis></link> <emphasis><link linkend="grammar.pattern">pattern</link></emphasis> [<emphasis role="bold">as</emphasis> <emphasis><link linkend="grammar.id">id</link></emphasis>]</entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+          <link linkend="tac_id">
+            <emphasis role="bold">id</emphasis>
+          </link>
+        </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_intro"><emphasis role="bold">intro</emphasis></link> [<emphasis><link linkend="grammar.id">id</link></emphasis>]</entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_intros"><emphasis role="bold">intros</emphasis></link> <emphasis><link linkend="grammar.intros-spec">intros-spec</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_inversion"><emphasis role="bold">inversion</emphasis></link> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+            <link linkend="tac_lapply"><emphasis role="bold">lapply</emphasis></link> 
+            [<emphasis role="bold">linear</emphasis>]
+            [<emphasis role="bold">depth=</emphasis><emphasis><link linkend="grammar.nat">nat</link></emphasis>] 
+            <emphasis><link linkend="grammar.sterm">sterm</link></emphasis> 
+            [<emphasis role="bold">to</emphasis>
+             <emphasis><link linkend="grammar.sterm">sterm</link></emphasis>
+             [<emphasis role="bold">,</emphasis><emphasis><link linkend="grammar.sterm">sterm</link></emphasis>…]
+            ] 
+            [<emphasis role="bold">as</emphasis> <emphasis><link linkend="grammar.id">id</link></emphasis>]
+           </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+          <link linkend="tac_left">
+            <emphasis role="bold">left</emphasis>
+          </link>
+        </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_letin"><emphasis role="bold">letin</emphasis></link> <emphasis><link linkend="grammar.id">id</link></emphasis> <emphasis role="bold">≝</emphasis> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_normalize"><emphasis role="bold">normalize</emphasis></link> <emphasis><link linkend="grammar.pattern">pattern</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_reduce"><emphasis role="bold">reduce</emphasis></link> <emphasis><link linkend="grammar.pattern">pattern</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+          <link linkend="tac_reflexivity">
+            <emphasis role="bold">reflexivity</emphasis>
+          </link>
+        </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_replace"><emphasis role="bold">replace</emphasis></link> <emphasis><link linkend="grammar.pattern">pattern</link></emphasis> <emphasis role="bold">with</emphasis> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_rewrite"><emphasis role="bold">rewrite</emphasis></link> [<emphasis role="bold">&lt;</emphasis>|<emphasis role="bold">&gt;</emphasis>] <emphasis><link linkend="grammar.sterm">sterm</link></emphasis> <emphasis><link linkend="grammar.pattern">pattern</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+          <link linkend="tac_right">
+            <emphasis role="bold">right</emphasis>
+          </link>
+        </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+          <link linkend="tac_ring">
+            <emphasis role="bold">ring</emphasis>
+          </link>
+        </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_simplify"><emphasis role="bold">simplify</emphasis></link> <emphasis><link linkend="grammar.pattern">pattern</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+          <link linkend="tac_split">
+            <emphasis role="bold">split</emphasis>
+          </link>
+        </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+          <link linkend="tac_subst">
+            <emphasis role="bold">subst</emphasis>
+          </link>
+        </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry>
+          <link linkend="tac_symmetry">
+            <emphasis role="bold">symmetry</emphasis>
+          </link>
+        </entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_transitivity"><emphasis role="bold">transitivity</emphasis></link> <emphasis><link linkend="grammar.sterm">sterm</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_unfold"><emphasis role="bold">unfold</emphasis></link> [<emphasis><link linkend="grammar.sterm">sterm</link></emphasis>] <emphasis><link linkend="grammar.pattern">pattern</link></emphasis></entry>
+      </row>
+      <row>
+        <entry/>
+        <entry>|</entry>
+        <entry><link linkend="tac_whd"><emphasis role="bold">whd</emphasis></link> <emphasis><link linkend="grammar.pattern">pattern</link></emphasis></entry>
+      </row>
+    </tbody>
+  </tgroup>
+</table>
diff --git a/matita/help/C/version.txt.in b/matita/help/C/version.txt.in
new file mode 100644 (file)
index 0000000..c275a8c
--- /dev/null
@@ -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 (file)
index 0000000..388a594
--- /dev/null
@@ -0,0 +1,1717 @@
+<!--
+   Extensible HTML version 1.0 Transitional DTD
+
+   This is the same as HTML 4 Transitional except for
+   changes due to the differences between XML and SGML.
+
+   Namespace = http://www.w3.org/1999/xhtml
+
+   For further information, see: http://www.w3.org/TR/xhtml1
+
+   Copyright (c) 1998-2002 W3C (MIT, INRIA, Keio),
+   All Rights Reserved. 
+
+   This DTD module is identified by the PUBLIC and SYSTEM identifiers:
+
+   PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+   SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+
+   $Revision: 1.2 $
+   $Date: 2002/08/01 18:37:55 $
+
+-->
+
+<!--================ Character mnemonic entities =========================-->
+
+<!-- <!ENTITY % HTMLlat1 PUBLIC
+   "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+   "xhtml-lat1.ent">
+%HTMLlat1;
+
+<!ENTITY % HTMLsymbol PUBLIC
+   "-//W3C//ENTITIES Symbols for XHTML//EN"
+   "xhtml-symbol.ent">
+%HTMLsymbol;
+
+<!ENTITY % HTMLspecial PUBLIC
+   "-//W3C//ENTITIES Special for XHTML//EN"
+   "xhtml-special.ent">
+%HTMLspecial; -->
+
+
+<!-- Portions (C) International Organization for Standardization 1986
+     Permission to copy in any form is granted for use with
+     conforming SGML systems and applications as defined in
+     ISO 8879, provided this notice is included in all copies.
+-->
+<!-- Character entity set. Typical invocation:
+    <!ENTITY % HTMLlat1 PUBLIC
+       "-//W3C//ENTITIES Latin 1 for XHTML//EN"
+       "http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent">
+    %HTMLlat1;
+-->
+
+<!ENTITY nbsp   "&#160;"> <!-- no-break space = non-breaking space,
+                                  U+00A0 ISOnum -->
+<!ENTITY iexcl  "&#161;"> <!-- inverted exclamation mark, U+00A1 ISOnum -->
+<!ENTITY cent   "&#162;"> <!-- cent sign, U+00A2 ISOnum -->
+<!ENTITY pound  "&#163;"> <!-- pound sign, U+00A3 ISOnum -->
+<!ENTITY curren "&#164;"> <!-- currency sign, U+00A4 ISOnum -->
+<!ENTITY yen    "&#165;"> <!-- yen sign = yuan sign, U+00A5 ISOnum -->
+<!ENTITY brvbar "&#166;"> <!-- broken bar = broken vertical bar,
+                                  U+00A6 ISOnum -->
+<!ENTITY sect   "&#167;"> <!-- section sign, U+00A7 ISOnum -->
+<!ENTITY uml    "&#168;"> <!-- diaeresis = spacing diaeresis,
+                                  U+00A8 ISOdia -->
+<!ENTITY copy   "&#169;"> <!-- copyright sign, U+00A9 ISOnum -->
+<!ENTITY ordf   "&#170;"> <!-- feminine ordinal indicator, U+00AA ISOnum -->
+<!ENTITY laquo  "&#171;"> <!-- left-pointing double angle quotation mark
+                                  = left pointing guillemet, U+00AB ISOnum -->
+<!ENTITY not    "&#172;"> <!-- not sign = angled dash,
+                                  U+00AC ISOnum -->
+<!ENTITY shy    "&#173;"> <!-- soft hyphen = discretionary hyphen,
+                                  U+00AD ISOnum -->
+<!ENTITY reg    "&#174;"> <!-- registered sign = registered trade mark sign,
+                                  U+00AE ISOnum -->
+<!ENTITY macr   "&#175;"> <!-- macron = spacing macron = overline
+                                  = APL overbar, U+00AF ISOdia -->
+<!ENTITY deg    "&#176;"> <!-- degree sign, U+00B0 ISOnum -->
+<!ENTITY plusmn "&#177;"> <!-- plus-minus sign = plus-or-minus sign,
+                                  U+00B1 ISOnum -->
+<!ENTITY sup2   "&#178;"> <!-- superscript two = superscript digit two
+                                  = squared, U+00B2 ISOnum -->
+<!ENTITY sup3   "&#179;"> <!-- superscript three = superscript digit three
+                                  = cubed, U+00B3 ISOnum -->
+<!ENTITY acute  "&#180;"> <!-- acute accent = spacing acute,
+                                  U+00B4 ISOdia -->
+<!ENTITY micro  "&#181;"> <!-- micro sign, U+00B5 ISOnum -->
+<!ENTITY para   "&#182;"> <!-- pilcrow sign = paragraph sign,
+                                  U+00B6 ISOnum -->
+<!ENTITY middot "&#183;"> <!-- middle dot = Georgian comma
+                                  = Greek middle dot, U+00B7 ISOnum -->
+<!ENTITY cedil  "&#184;"> <!-- cedilla = spacing cedilla, U+00B8 ISOdia -->
+<!ENTITY sup1   "&#185;"> <!-- superscript one = superscript digit one,
+                                  U+00B9 ISOnum -->
+<!ENTITY ordm   "&#186;"> <!-- masculine ordinal indicator,
+                                  U+00BA ISOnum -->
+<!ENTITY raquo  "&#187;"> <!-- right-pointing double angle quotation mark
+                                  = right pointing guillemet, U+00BB ISOnum -->
+<!ENTITY frac14 "&#188;"> <!-- vulgar fraction one quarter
+                                  = fraction one quarter, U+00BC ISOnum -->
+<!ENTITY frac12 "&#189;"> <!-- vulgar fraction one half
+                                  = fraction one half, U+00BD ISOnum -->
+<!ENTITY frac34 "&#190;"> <!-- vulgar fraction three quarters
+                                  = fraction three quarters, U+00BE ISOnum -->
+<!ENTITY iquest "&#191;"> <!-- inverted question mark
+                                  = turned question mark, U+00BF ISOnum -->
+<!ENTITY Agrave "&#192;"> <!-- latin capital letter A with grave
+                                  = latin capital letter A grave,
+                                  U+00C0 ISOlat1 -->
+<!ENTITY Aacute "&#193;"> <!-- latin capital letter A with acute,
+                                  U+00C1 ISOlat1 -->
+<!ENTITY Acirc  "&#194;"> <!-- latin capital letter A with circumflex,
+                                  U+00C2 ISOlat1 -->
+<!ENTITY Atilde "&#195;"> <!-- latin capital letter A with tilde,
+                                  U+00C3 ISOlat1 -->
+<!ENTITY Auml   "&#196;"> <!-- latin capital letter A with diaeresis,
+                                  U+00C4 ISOlat1 -->
+<!ENTITY Aring  "&#197;"> <!-- latin capital letter A with ring above
+                                  = latin capital letter A ring,
+                                  U+00C5 ISOlat1 -->
+<!ENTITY AElig  "&#198;"> <!-- latin capital letter AE
+                                  = latin capital ligature AE,
+                                  U+00C6 ISOlat1 -->
+<!ENTITY Ccedil "&#199;"> <!-- latin capital letter C with cedilla,
+                                  U+00C7 ISOlat1 -->
+<!ENTITY Egrave "&#200;"> <!-- latin capital letter E with grave,
+                                  U+00C8 ISOlat1 -->
+<!ENTITY Eacute "&#201;"> <!-- latin capital letter E with acute,
+                                  U+00C9 ISOlat1 -->
+<!ENTITY Ecirc  "&#202;"> <!-- latin capital letter E with circumflex,
+                                  U+00CA ISOlat1 -->
+<!ENTITY Euml   "&#203;"> <!-- latin capital letter E with diaeresis,
+                                  U+00CB ISOlat1 -->
+<!ENTITY Igrave "&#204;"> <!-- latin capital letter I with grave,
+                                  U+00CC ISOlat1 -->
+<!ENTITY Iacute "&#205;"> <!-- latin capital letter I with acute,
+                                  U+00CD ISOlat1 -->
+<!ENTITY Icirc  "&#206;"> <!-- latin capital letter I with circumflex,
+                                  U+00CE ISOlat1 -->
+<!ENTITY Iuml   "&#207;"> <!-- latin capital letter I with diaeresis,
+                                  U+00CF ISOlat1 -->
+<!ENTITY ETH    "&#208;"> <!-- latin capital letter ETH, U+00D0 ISOlat1 -->
+<!ENTITY Ntilde "&#209;"> <!-- latin capital letter N with tilde,
+                                  U+00D1 ISOlat1 -->
+<!ENTITY Ograve "&#210;"> <!-- latin capital letter O with grave,
+                                  U+00D2 ISOlat1 -->
+<!ENTITY Oacute "&#211;"> <!-- latin capital letter O with acute,
+                                  U+00D3 ISOlat1 -->
+<!ENTITY Ocirc  "&#212;"> <!-- latin capital letter O with circumflex,
+                                  U+00D4 ISOlat1 -->
+<!ENTITY Otilde "&#213;"> <!-- latin capital letter O with tilde,
+                                  U+00D5 ISOlat1 -->
+<!ENTITY Ouml   "&#214;"> <!-- latin capital letter O with diaeresis,
+                                  U+00D6 ISOlat1 -->
+<!ENTITY times  "&#215;"> <!-- multiplication sign, U+00D7 ISOnum -->
+<!ENTITY Oslash "&#216;"> <!-- latin capital letter O with stroke
+                                  = latin capital letter O slash,
+                                  U+00D8 ISOlat1 -->
+<!ENTITY Ugrave "&#217;"> <!-- latin capital letter U with grave,
+                                  U+00D9 ISOlat1 -->
+<!ENTITY Uacute "&#218;"> <!-- latin capital letter U with acute,
+                                  U+00DA ISOlat1 -->
+<!ENTITY Ucirc  "&#219;"> <!-- latin capital letter U with circumflex,
+                                  U+00DB ISOlat1 -->
+<!ENTITY Uuml   "&#220;"> <!-- latin capital letter U with diaeresis,
+                                  U+00DC ISOlat1 -->
+<!ENTITY Yacute "&#221;"> <!-- latin capital letter Y with acute,
+                                  U+00DD ISOlat1 -->
+<!ENTITY THORN  "&#222;"> <!-- latin capital letter THORN,
+                                  U+00DE ISOlat1 -->
+<!ENTITY szlig  "&#223;"> <!-- latin small letter sharp s = ess-zed,
+                                  U+00DF ISOlat1 -->
+<!ENTITY agrave "&#224;"> <!-- latin small letter a with grave
+                                  = latin small letter a grave,
+                                  U+00E0 ISOlat1 -->
+<!ENTITY aacute "&#225;"> <!-- latin small letter a with acute,
+                                  U+00E1 ISOlat1 -->
+<!ENTITY acirc  "&#226;"> <!-- latin small letter a with circumflex,
+                                  U+00E2 ISOlat1 -->
+<!ENTITY atilde "&#227;"> <!-- latin small letter a with tilde,
+                                  U+00E3 ISOlat1 -->
+<!ENTITY auml   "&#228;"> <!-- latin small letter a with diaeresis,
+                                  U+00E4 ISOlat1 -->
+<!ENTITY aring  "&#229;"> <!-- latin small letter a with ring above
+                                  = latin small letter a ring,
+                                  U+00E5 ISOlat1 -->
+<!ENTITY aelig  "&#230;"> <!-- latin small letter ae
+                                  = latin small ligature ae, U+00E6 ISOlat1 -->
+<!ENTITY ccedil "&#231;"> <!-- latin small letter c with cedilla,
+                                  U+00E7 ISOlat1 -->
+<!ENTITY egrave "&#232;"> <!-- latin small letter e with grave,
+                                  U+00E8 ISOlat1 -->
+<!ENTITY eacute "&#233;"> <!-- latin small letter e with acute,
+                                  U+00E9 ISOlat1 -->
+<!ENTITY ecirc  "&#234;"> <!-- latin small letter e with circumflex,
+                                  U+00EA ISOlat1 -->
+<!ENTITY euml   "&#235;"> <!-- latin small letter e with diaeresis,
+                                  U+00EB ISOlat1 -->
+<!ENTITY igrave "&#236;"> <!-- latin small letter i with grave,
+                                  U+00EC ISOlat1 -->
+<!ENTITY iacute "&#237;"> <!-- latin small letter i with acute,
+                                  U+00ED ISOlat1 -->
+<!ENTITY icirc  "&#238;"> <!-- latin small letter i with circumflex,
+                                  U+00EE ISOlat1 -->
+<!ENTITY iuml   "&#239;"> <!-- latin small letter i with diaeresis,
+                                  U+00EF ISOlat1 -->
+<!ENTITY eth    "&#240;"> <!-- latin small letter eth, U+00F0 ISOlat1 -->
+<!ENTITY ntilde "&#241;"> <!-- latin small letter n with tilde,
+                                  U+00F1 ISOlat1 -->
+<!ENTITY ograve "&#242;"> <!-- latin small letter o with grave,
+                                  U+00F2 ISOlat1 -->
+<!ENTITY oacute "&#243;"> <!-- latin small letter o with acute,
+                                  U+00F3 ISOlat1 -->
+<!ENTITY ocirc  "&#244;"> <!-- latin small letter o with circumflex,
+                                  U+00F4 ISOlat1 -->
+<!ENTITY otilde "&#245;"> <!-- latin small letter o with tilde,
+                                  U+00F5 ISOlat1 -->
+<!ENTITY ouml   "&#246;"> <!-- latin small letter o with diaeresis,
+                                  U+00F6 ISOlat1 -->
+<!ENTITY divide "&#247;"> <!-- division sign, U+00F7 ISOnum -->
+<!ENTITY oslash "&#248;"> <!-- latin small letter o with stroke,
+                                  = latin small letter o slash,
+                                  U+00F8 ISOlat1 -->
+<!ENTITY ugrave "&#249;"> <!-- latin small letter u with grave,
+                                  U+00F9 ISOlat1 -->
+<!ENTITY uacute "&#250;"> <!-- latin small letter u with acute,
+                                  U+00FA ISOlat1 -->
+<!ENTITY ucirc  "&#251;"> <!-- latin small letter u with circumflex,
+                                  U+00FB ISOlat1 -->
+<!ENTITY uuml   "&#252;"> <!-- latin small letter u with diaeresis,
+                                  U+00FC ISOlat1 -->
+<!ENTITY yacute "&#253;"> <!-- latin small letter y with acute,
+                                  U+00FD ISOlat1 -->
+<!ENTITY thorn  "&#254;"> <!-- latin small letter thorn,
+                                  U+00FE ISOlat1 -->
+<!ENTITY yuml   "&#255;"> <!-- latin small letter y with diaeresis,
+                                  U+00FF ISOlat1 -->
+<!-- Mathematical, Greek and Symbolic characters for XHTML -->
+
+<!-- Character entity set. Typical invocation:
+     <!ENTITY % HTMLsymbol PUBLIC
+        "-//W3C//ENTITIES Symbols for XHTML//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent">
+     %HTMLsymbol;
+-->
+
+<!-- Portions (C) International Organization for Standardization 1986:
+     Permission to copy in any form is granted for use with
+     conforming SGML systems and applications as defined in
+     ISO 8879, provided this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+     New names (i.e., not in ISO 8879 list) do not clash with any
+     existing ISO 8879 entity names. ISO 10646 character numbers
+     are given for each character, in hex. values are decimal
+     conversions of the ISO 10646 values and refer to the document
+     character set. Names are Unicode names. 
+-->
+
+<!-- Latin Extended-B -->
+<!ENTITY fnof     "&#402;"> <!-- latin small letter f with hook = function
+                                    = florin, U+0192 ISOtech -->
+
+<!-- Greek -->
+<!ENTITY Alpha    "&#913;"> <!-- greek capital letter alpha, U+0391 -->
+<!ENTITY Beta     "&#914;"> <!-- greek capital letter beta, U+0392 -->
+<!ENTITY Gamma    "&#915;"> <!-- greek capital letter gamma,
+                                    U+0393 ISOgrk3 -->
+<!ENTITY Delta    "&#916;"> <!-- greek capital letter delta,
+                                    U+0394 ISOgrk3 -->
+<!ENTITY Epsilon  "&#917;"> <!-- greek capital letter epsilon, U+0395 -->
+<!ENTITY Zeta     "&#918;"> <!-- greek capital letter zeta, U+0396 -->
+<!ENTITY Eta      "&#919;"> <!-- greek capital letter eta, U+0397 -->
+<!ENTITY Theta    "&#920;"> <!-- greek capital letter theta,
+                                    U+0398 ISOgrk3 -->
+<!ENTITY Iota     "&#921;"> <!-- greek capital letter iota, U+0399 -->
+<!ENTITY Kappa    "&#922;"> <!-- greek capital letter kappa, U+039A -->
+<!ENTITY Lambda   "&#923;"> <!-- greek capital letter lamda,
+                                    U+039B ISOgrk3 -->
+<!ENTITY Mu       "&#924;"> <!-- greek capital letter mu, U+039C -->
+<!ENTITY Nu       "&#925;"> <!-- greek capital letter nu, U+039D -->
+<!ENTITY Xi       "&#926;"> <!-- greek capital letter xi, U+039E ISOgrk3 -->
+<!ENTITY Omicron  "&#927;"> <!-- greek capital letter omicron, U+039F -->
+<!ENTITY Pi       "&#928;"> <!-- greek capital letter pi, U+03A0 ISOgrk3 -->
+<!ENTITY Rho      "&#929;"> <!-- greek capital letter rho, U+03A1 -->
+<!-- there is no Sigmaf, and no U+03A2 character either -->
+<!ENTITY Sigma    "&#931;"> <!-- greek capital letter sigma,
+                                    U+03A3 ISOgrk3 -->
+<!ENTITY Tau      "&#932;"> <!-- greek capital letter tau, U+03A4 -->
+<!ENTITY Upsilon  "&#933;"> <!-- greek capital letter upsilon,
+                                    U+03A5 ISOgrk3 -->
+<!ENTITY Phi      "&#934;"> <!-- greek capital letter phi,
+                                    U+03A6 ISOgrk3 -->
+<!ENTITY Chi      "&#935;"> <!-- greek capital letter chi, U+03A7 -->
+<!ENTITY Psi      "&#936;"> <!-- greek capital letter psi,
+                                    U+03A8 ISOgrk3 -->
+<!ENTITY Omega    "&#937;"> <!-- greek capital letter omega,
+                                    U+03A9 ISOgrk3 -->
+
+<!ENTITY alpha    "&#945;"> <!-- greek small letter alpha,
+                                    U+03B1 ISOgrk3 -->
+<!ENTITY beta     "&#946;"> <!-- greek small letter beta, U+03B2 ISOgrk3 -->
+<!ENTITY gamma    "&#947;"> <!-- greek small letter gamma,
+                                    U+03B3 ISOgrk3 -->
+<!ENTITY delta    "&#948;"> <!-- greek small letter delta,
+                                    U+03B4 ISOgrk3 -->
+<!ENTITY epsilon  "&#949;"> <!-- greek small letter epsilon,
+                                    U+03B5 ISOgrk3 -->
+<!ENTITY zeta     "&#950;"> <!-- greek small letter zeta, U+03B6 ISOgrk3 -->
+<!ENTITY eta      "&#951;"> <!-- greek small letter eta, U+03B7 ISOgrk3 -->
+<!ENTITY theta    "&#952;"> <!-- greek small letter theta,
+                                    U+03B8 ISOgrk3 -->
+<!ENTITY iota     "&#953;"> <!-- greek small letter iota, U+03B9 ISOgrk3 -->
+<!ENTITY kappa    "&#954;"> <!-- greek small letter kappa,
+                                    U+03BA ISOgrk3 -->
+<!ENTITY lambda   "&#955;"> <!-- greek small letter lamda,
+                                    U+03BB ISOgrk3 -->
+<!ENTITY mu       "&#956;"> <!-- greek small letter mu, U+03BC ISOgrk3 -->
+<!ENTITY nu       "&#957;"> <!-- greek small letter nu, U+03BD ISOgrk3 -->
+<!ENTITY xi       "&#958;"> <!-- greek small letter xi, U+03BE ISOgrk3 -->
+<!ENTITY omicron  "&#959;"> <!-- greek small letter omicron, U+03BF NEW -->
+<!ENTITY pi       "&#960;"> <!-- greek small letter pi, U+03C0 ISOgrk3 -->
+<!ENTITY rho      "&#961;"> <!-- greek small letter rho, U+03C1 ISOgrk3 -->
+<!ENTITY sigmaf   "&#962;"> <!-- greek small letter final sigma,
+                                    U+03C2 ISOgrk3 -->
+<!ENTITY sigma    "&#963;"> <!-- greek small letter sigma,
+                                    U+03C3 ISOgrk3 -->
+<!ENTITY tau      "&#964;"> <!-- greek small letter tau, U+03C4 ISOgrk3 -->
+<!ENTITY upsilon  "&#965;"> <!-- greek small letter upsilon,
+                                    U+03C5 ISOgrk3 -->
+<!ENTITY phi      "&#966;"> <!-- greek small letter phi, U+03C6 ISOgrk3 -->
+<!ENTITY chi      "&#967;"> <!-- greek small letter chi, U+03C7 ISOgrk3 -->
+<!ENTITY psi      "&#968;"> <!-- greek small letter psi, U+03C8 ISOgrk3 -->
+<!ENTITY omega    "&#969;"> <!-- greek small letter omega,
+                                    U+03C9 ISOgrk3 -->
+<!ENTITY thetasym "&#977;"> <!-- greek theta symbol,
+                                    U+03D1 NEW -->
+<!ENTITY upsih    "&#978;"> <!-- greek upsilon with hook symbol,
+                                    U+03D2 NEW -->
+<!ENTITY piv      "&#982;"> <!-- greek pi symbol, U+03D6 ISOgrk3 -->
+
+<!-- General Punctuation -->
+<!ENTITY bull     "&#8226;"> <!-- bullet = black small circle,
+                                     U+2022 ISOpub  -->
+<!-- bullet is NOT the same as bullet operator, U+2219 -->
+<!ENTITY hellip   "&#8230;"> <!-- horizontal ellipsis = three dot leader,
+                                     U+2026 ISOpub  -->
+<!ENTITY prime    "&#8242;"> <!-- prime = minutes = feet, U+2032 ISOtech -->
+<!ENTITY Prime    "&#8243;"> <!-- double prime = seconds = inches,
+                                     U+2033 ISOtech -->
+<!ENTITY oline    "&#8254;"> <!-- overline = spacing overscore,
+                                     U+203E NEW -->
+<!ENTITY frasl    "&#8260;"> <!-- fraction slash, U+2044 NEW -->
+
+<!-- Letterlike Symbols -->
+<!ENTITY weierp   "&#8472;"> <!-- script capital P = power set
+                                     = Weierstrass p, U+2118 ISOamso -->
+<!ENTITY image    "&#8465;"> <!-- black-letter capital I = imaginary part,
+                                     U+2111 ISOamso -->
+<!ENTITY real     "&#8476;"> <!-- black-letter capital R = real part symbol,
+                                     U+211C ISOamso -->
+<!ENTITY trade    "&#8482;"> <!-- trade mark sign, U+2122 ISOnum -->
+<!ENTITY alefsym  "&#8501;"> <!-- alef symbol = first transfinite cardinal,
+                                     U+2135 NEW -->
+<!-- alef symbol is NOT the same as hebrew letter alef,
+     U+05D0 although the same glyph could be used to depict both characters -->
+
+<!-- Arrows -->
+<!ENTITY larr     "&#8592;"> <!-- leftwards arrow, U+2190 ISOnum -->
+<!ENTITY uarr     "&#8593;"> <!-- upwards arrow, U+2191 ISOnum-->
+<!ENTITY rarr     "&#8594;"> <!-- rightwards arrow, U+2192 ISOnum -->
+<!ENTITY darr     "&#8595;"> <!-- downwards arrow, U+2193 ISOnum -->
+<!ENTITY harr     "&#8596;"> <!-- left right arrow, U+2194 ISOamsa -->
+<!ENTITY crarr    "&#8629;"> <!-- downwards arrow with corner leftwards
+                                     = carriage return, U+21B5 NEW -->
+<!ENTITY lArr     "&#8656;"> <!-- leftwards double arrow, U+21D0 ISOtech -->
+<!-- Unicode does not say that lArr is the same as the 'is implied by' arrow
+    but also does not have any other character for that function. So lArr can
+    be used for 'is implied by' as ISOtech suggests -->
+<!ENTITY uArr     "&#8657;"> <!-- upwards double arrow, U+21D1 ISOamsa -->
+<!ENTITY rArr     "&#8658;"> <!-- rightwards double arrow,
+                                     U+21D2 ISOtech -->
+<!-- Unicode does not say this is the 'implies' character but does not have 
+     another character with this function so rArr can be used for 'implies'
+     as ISOtech suggests -->
+<!ENTITY dArr     "&#8659;"> <!-- downwards double arrow, U+21D3 ISOamsa -->
+<!ENTITY hArr     "&#8660;"> <!-- left right double arrow,
+                                     U+21D4 ISOamsa -->
+
+<!-- Mathematical Operators -->
+<!ENTITY forall   "&#8704;"> <!-- for all, U+2200 ISOtech -->
+<!ENTITY part     "&#8706;"> <!-- partial differential, U+2202 ISOtech  -->
+<!ENTITY exist    "&#8707;"> <!-- there exists, U+2203 ISOtech -->
+<!ENTITY empty    "&#8709;"> <!-- empty set = null set, U+2205 ISOamso -->
+<!ENTITY nabla    "&#8711;"> <!-- nabla = backward difference,
+                                     U+2207 ISOtech -->
+<!ENTITY isin     "&#8712;"> <!-- element of, U+2208 ISOtech -->
+<!ENTITY notin    "&#8713;"> <!-- not an element of, U+2209 ISOtech -->
+<!ENTITY ni       "&#8715;"> <!-- contains as member, U+220B ISOtech -->
+<!ENTITY prod     "&#8719;"> <!-- n-ary product = product sign,
+                                     U+220F ISOamsb -->
+<!-- prod is NOT the same character as U+03A0 'greek capital letter pi' though
+     the same glyph might be used for both -->
+<!ENTITY sum      "&#8721;"> <!-- n-ary summation, U+2211 ISOamsb -->
+<!-- sum is NOT the same character as U+03A3 'greek capital letter sigma'
+     though the same glyph might be used for both -->
+<!ENTITY minus    "&#8722;"> <!-- minus sign, U+2212 ISOtech -->
+<!ENTITY lowast   "&#8727;"> <!-- asterisk operator, U+2217 ISOtech -->
+<!ENTITY radic    "&#8730;"> <!-- square root = radical sign,
+                                     U+221A ISOtech -->
+<!ENTITY prop     "&#8733;"> <!-- proportional to, U+221D ISOtech -->
+<!ENTITY infin    "&#8734;"> <!-- infinity, U+221E ISOtech -->
+<!ENTITY ang      "&#8736;"> <!-- angle, U+2220 ISOamso -->
+<!ENTITY and      "&#8743;"> <!-- logical and = wedge, U+2227 ISOtech -->
+<!ENTITY or       "&#8744;"> <!-- logical or = vee, U+2228 ISOtech -->
+<!ENTITY cap      "&#8745;"> <!-- intersection = cap, U+2229 ISOtech -->
+<!ENTITY cup      "&#8746;"> <!-- union = cup, U+222A ISOtech -->
+<!ENTITY int      "&#8747;"> <!-- integral, U+222B ISOtech -->
+<!ENTITY there4   "&#8756;"> <!-- therefore, U+2234 ISOtech -->
+<!ENTITY sim      "&#8764;"> <!-- tilde operator = varies with = similar to,
+                                     U+223C ISOtech -->
+<!-- tilde operator is NOT the same character as the tilde, U+007E,
+     although the same glyph might be used to represent both  -->
+<!ENTITY cong     "&#8773;"> <!-- approximately equal to, U+2245 ISOtech -->
+<!ENTITY asymp    "&#8776;"> <!-- almost equal to = asymptotic to,
+                                     U+2248 ISOamsr -->
+<!ENTITY ne       "&#8800;"> <!-- not equal to, U+2260 ISOtech -->
+<!ENTITY equiv    "&#8801;"> <!-- identical to, U+2261 ISOtech -->
+<!ENTITY le       "&#8804;"> <!-- less-than or equal to, U+2264 ISOtech -->
+<!ENTITY ge       "&#8805;"> <!-- greater-than or equal to,
+                                     U+2265 ISOtech -->
+<!ENTITY sub      "&#8834;"> <!-- subset of, U+2282 ISOtech -->
+<!ENTITY sup      "&#8835;"> <!-- superset of, U+2283 ISOtech -->
+<!ENTITY nsub     "&#8836;"> <!-- not a subset of, U+2284 ISOamsn -->
+<!ENTITY sube     "&#8838;"> <!-- subset of or equal to, U+2286 ISOtech -->
+<!ENTITY supe     "&#8839;"> <!-- superset of or equal to,
+                                     U+2287 ISOtech -->
+<!ENTITY oplus    "&#8853;"> <!-- circled plus = direct sum,
+                                     U+2295 ISOamsb -->
+<!ENTITY otimes   "&#8855;"> <!-- circled times = vector product,
+                                     U+2297 ISOamsb -->
+<!ENTITY perp     "&#8869;"> <!-- up tack = orthogonal to = perpendicular,
+                                     U+22A5 ISOtech -->
+<!ENTITY sdot     "&#8901;"> <!-- dot operator, U+22C5 ISOamsb -->
+<!-- dot operator is NOT the same character as U+00B7 middle dot -->
+
+<!-- Miscellaneous Technical -->
+<!ENTITY lceil    "&#8968;"> <!-- left ceiling = APL upstile,
+                                     U+2308 ISOamsc  -->
+<!ENTITY rceil    "&#8969;"> <!-- right ceiling, U+2309 ISOamsc  -->
+<!ENTITY lfloor   "&#8970;"> <!-- left floor = APL downstile,
+                                     U+230A ISOamsc  -->
+<!ENTITY rfloor   "&#8971;"> <!-- right floor, U+230B ISOamsc  -->
+<!ENTITY lang     "&#9001;"> <!-- left-pointing angle bracket = bra,
+                                     U+2329 ISOtech -->
+<!-- lang is NOT the same character as U+003C 'less than sign' 
+     or U+2039 'single left-pointing angle quotation mark' -->
+<!ENTITY rang     "&#9002;"> <!-- right-pointing angle bracket = ket,
+                                     U+232A ISOtech -->
+<!-- rang is NOT the same character as U+003E 'greater than sign' 
+     or U+203A 'single right-pointing angle quotation mark' -->
+
+<!-- Geometric Shapes -->
+<!ENTITY loz      "&#9674;"> <!-- lozenge, U+25CA ISOpub -->
+
+<!-- Miscellaneous Symbols -->
+<!ENTITY spades   "&#9824;"> <!-- black spade suit, U+2660 ISOpub -->
+<!-- black here seems to mean filled as opposed to hollow -->
+<!ENTITY clubs    "&#9827;"> <!-- black club suit = shamrock,
+                                     U+2663 ISOpub -->
+<!ENTITY hearts   "&#9829;"> <!-- black heart suit = valentine,
+                                     U+2665 ISOpub -->
+<!ENTITY diams    "&#9830;"> <!-- black diamond suit, U+2666 ISOpub -->
+
+<!-- Special characters for XHTML -->
+
+<!-- Character entity set. Typical invocation:
+     <!ENTITY % HTMLspecial PUBLIC
+        "-//W3C//ENTITIES Special for XHTML//EN"
+        "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent">
+     %HTMLspecial;
+-->
+
+<!-- Portions (C) International Organization for Standardization 1986:
+     Permission to copy in any form is granted for use with
+     conforming SGML systems and applications as defined in
+     ISO 8879, provided this notice is included in all copies.
+-->
+
+<!-- Relevant ISO entity set is given unless names are newly introduced.
+     New names (i.e., not in ISO 8879 list) do not clash with any
+     existing ISO 8879 entity names. ISO 10646 character numbers
+     are given for each character, in hex. values are decimal
+     conversions of the ISO 10646 values and refer to the document
+     character set. Names are Unicode names. 
+-->
+
+<!-- C0 Controls and Basic Latin -->
+<!ENTITY quot    "&#34;"> <!--  quotation mark, U+0022 ISOnum -->
+<!ENTITY amp     "&#38;#38;"> <!--  ampersand, U+0026 ISOnum -->
+<!ENTITY lt      "&#38;#60;"> <!--  less-than sign, U+003C ISOnum -->
+<!ENTITY gt      "&#62;"> <!--  greater-than sign, U+003E ISOnum -->
+<!ENTITY apos   "&#39;"> <!--  apostrophe = APL quote, U+0027 ISOnum -->
+
+<!-- Latin Extended-A -->
+<!ENTITY OElig   "&#338;"> <!--  latin capital ligature OE,
+                                    U+0152 ISOlat2 -->
+<!ENTITY oelig   "&#339;"> <!--  latin small ligature oe, U+0153 ISOlat2 -->
+<!-- ligature is a misnomer, this is a separate character in some languages -->
+<!ENTITY Scaron  "&#352;"> <!--  latin capital letter S with caron,
+                                    U+0160 ISOlat2 -->
+<!ENTITY scaron  "&#353;"> <!--  latin small letter s with caron,
+                                    U+0161 ISOlat2 -->
+<!ENTITY Yuml    "&#376;"> <!--  latin capital letter Y with diaeresis,
+                                    U+0178 ISOlat2 -->
+
+<!-- Spacing Modifier Letters -->
+<!ENTITY circ    "&#710;"> <!--  modifier letter circumflex accent,
+                                    U+02C6 ISOpub -->
+<!ENTITY tilde   "&#732;"> <!--  small tilde, U+02DC ISOdia -->
+
+<!-- General Punctuation -->
+<!ENTITY ensp    "&#8194;"> <!-- en space, U+2002 ISOpub -->
+<!ENTITY emsp    "&#8195;"> <!-- em space, U+2003 ISOpub -->
+<!ENTITY thinsp  "&#8201;"> <!-- thin space, U+2009 ISOpub -->
+<!ENTITY zwnj    "&#8204;"> <!-- zero width non-joiner,
+                                    U+200C NEW RFC 2070 -->
+<!ENTITY zwj     "&#8205;"> <!-- zero width joiner, U+200D NEW RFC 2070 -->
+<!ENTITY lrm     "&#8206;"> <!-- left-to-right mark, U+200E NEW RFC 2070 -->
+<!ENTITY rlm     "&#8207;"> <!-- right-to-left mark, U+200F NEW RFC 2070 -->
+<!ENTITY ndash   "&#8211;"> <!-- en dash, U+2013 ISOpub -->
+<!ENTITY mdash   "&#8212;"> <!-- em dash, U+2014 ISOpub -->
+<!ENTITY lsquo   "&#8216;"> <!-- left single quotation mark,
+                                    U+2018 ISOnum -->
+<!ENTITY rsquo   "&#8217;"> <!-- right single quotation mark,
+                                    U+2019 ISOnum -->
+<!ENTITY sbquo   "&#8218;"> <!-- single low-9 quotation mark, U+201A NEW -->
+<!ENTITY ldquo   "&#8220;"> <!-- left double quotation mark,
+                                    U+201C ISOnum -->
+<!ENTITY rdquo   "&#8221;"> <!-- right double quotation mark,
+                                    U+201D ISOnum -->
+<!ENTITY bdquo   "&#8222;"> <!-- double low-9 quotation mark, U+201E NEW -->
+<!ENTITY dagger  "&#8224;"> <!-- dagger, U+2020 ISOpub -->
+<!ENTITY Dagger  "&#8225;"> <!-- double dagger, U+2021 ISOpub -->
+<!ENTITY permil  "&#8240;"> <!-- per mille sign, U+2030 ISOtech -->
+<!ENTITY lsaquo  "&#8249;"> <!-- single left-pointing angle quotation mark,
+                                    U+2039 ISO proposed -->
+<!-- lsaquo is proposed but not yet ISO standardized -->
+<!ENTITY rsaquo  "&#8250;"> <!-- single right-pointing angle quotation mark,
+                                    U+203A ISO proposed -->
+<!-- rsaquo is proposed but not yet ISO standardized -->
+
+<!-- Currency Symbols -->
+<!ENTITY euro   "&#8364;"> <!--  euro sign, U+20AC NEW -->
+
+<!--================== Imported Names ====================================-->
+
+<!ENTITY % ContentType "CDATA">
+    <!-- media type, as per [RFC2045] -->
+
+<!ENTITY % ContentTypes "CDATA">
+    <!-- comma-separated list of media types, as per [RFC2045] -->
+
+<!ENTITY % Charset "CDATA">
+    <!-- a character encoding, as per [RFC2045] -->
+
+<!ENTITY % Charsets "CDATA">
+    <!-- a space separated list of character encodings, as per [RFC2045] -->
+
+<!ENTITY % LanguageCode "NMTOKEN">
+    <!-- a language code, as per [RFC3066] -->
+
+<!ENTITY % Character "CDATA">
+    <!-- a single character, as per section 2.2 of [XML] -->
+
+<!ENTITY % Number "CDATA">
+    <!-- one or more digits -->
+
+<!ENTITY % LinkTypes "CDATA">
+    <!-- space-separated list of link types -->
+
+<!ENTITY % MediaDesc "CDATA">
+    <!-- single or comma-separated list of media descriptors -->
+
+<!ENTITY % URI "CDATA">
+    <!-- a Uniform Resource Identifier, see [RFC2396] -->
+
+<!ENTITY % UriList "CDATA">
+    <!-- a space separated list of Uniform Resource Identifiers -->
+
+<!ENTITY % Datetime "CDATA">
+    <!-- date and time information. ISO date format -->
+
+<!ENTITY % Script "CDATA">
+    <!-- script expression -->
+
+<!ENTITY % StyleSheet "CDATA">
+    <!-- style sheet data -->
+
+<!ENTITY % Text "CDATA">
+    <!-- used for titles etc. -->
+
+<!ENTITY % FrameTarget "NMTOKEN">
+    <!-- render in this frame -->
+
+<!ENTITY % Length "CDATA">
+    <!-- nn for pixels or nn% for percentage length -->
+
+<!ENTITY % MultiLength "CDATA">
+    <!-- pixel, percentage, or relative -->
+
+<!ENTITY % Pixels "CDATA">
+    <!-- integer representing length in pixels -->
+
+<!-- these are used for image maps -->
+
+<!ENTITY % Shape "(rect|circle|poly|default)">
+
+<!ENTITY % Coords "CDATA">
+    <!-- comma separated list of lengths -->
+
+<!-- used for object, applet, img, input and iframe -->
+<!ENTITY % ImgAlign "(top|middle|bottom|left|right)">
+
+<!-- a color using sRGB: #RRGGBB as Hex values -->
+<!ENTITY % Color "CDATA">
+
+<!-- There are also 16 widely known color names with their sRGB values:
+
+    Black  = #000000    Green  = #008000
+    Silver = #C0C0C0    Lime   = #00FF00
+    Gray   = #808080    Olive  = #808000
+    White  = #FFFFFF    Yellow = #FFFF00
+    Maroon = #800000    Navy   = #000080
+    Red    = #FF0000    Blue   = #0000FF
+    Purple = #800080    Teal   = #008080
+    Fuchsia= #FF00FF    Aqua   = #00FFFF
+-->
+
+<!--=================== Generic Attributes ===============================-->
+
+<!-- core attributes common to most elements
+  id       document-wide unique id
+  class    space separated list of classes
+  style    associated style info
+  title    advisory title/amplification
+-->
+<!ENTITY % coreattrs
+ "id          ID             #IMPLIED
+  class       CDATA          #IMPLIED
+  style       %StyleSheet;   #IMPLIED
+  title       %Text;         #IMPLIED"
+  >
+
+<!-- internationalization attributes
+  lang        language code (backwards compatible)
+  xml:lang    language code (as per XML 1.0 spec)
+  dir         direction for weak/neutral text
+-->
+<!ENTITY % i18n
+ "lang        %LanguageCode; #IMPLIED
+  xml:lang    %LanguageCode; #IMPLIED
+  dir         (ltr|rtl)      #IMPLIED"
+  >
+
+<!-- attributes for common UI events
+  onclick     a pointer button was clicked
+  ondblclick  a pointer button was double clicked
+  onmousedown a pointer button was pressed down
+  onmouseup   a pointer button was released
+  onmousemove a pointer was moved onto the element
+  onmouseout  a pointer was moved away from the element
+  onkeypress  a key was pressed and released
+  onkeydown   a key was pressed down
+  onkeyup     a key was released
+-->
+<!ENTITY % events
+ "onclick     %Script;       #IMPLIED
+  ondblclick  %Script;       #IMPLIED
+  onmousedown %Script;       #IMPLIED
+  onmouseup   %Script;       #IMPLIED
+  onmouseover %Script;       #IMPLIED
+  onmousemove %Script;       #IMPLIED
+  onmouseout  %Script;       #IMPLIED
+  onkeypress  %Script;       #IMPLIED
+  onkeydown   %Script;       #IMPLIED
+  onkeyup     %Script;       #IMPLIED"
+  >
+
+<!-- attributes for elements that can get the focus
+  accesskey   accessibility key character
+  tabindex    position in tabbing order
+  onfocus     the element got the focus
+  onblur      the element lost the focus
+-->
+<!ENTITY % focus
+ "accesskey   %Character;    #IMPLIED
+  tabindex    %Number;       #IMPLIED
+  onfocus     %Script;       #IMPLIED
+  onblur      %Script;       #IMPLIED"
+  >
+
+<!ENTITY % attrs "%coreattrs; %i18n; %events;">
+
+<!-- text alignment for p, div, h1-h6. The default is
+     align="left" for ltr headings, "right" for rtl -->
+
+<!ENTITY % TextAlign "align (left|center|right|justify) #IMPLIED">
+
+<!--=================== Text Elements ====================================-->
+
+<!ENTITY % special.extra
+   "object | applet | img | map | iframe">
+       
+<!ENTITY % special.basic
+       "br | span | bdo">
+
+<!ENTITY % special
+   "%special.basic; | %special.extra;">
+
+<!ENTITY % fontstyle.extra "big | small | font | basefont">
+
+<!ENTITY % fontstyle.basic "tt | i | b | u
+                      | s | strike ">
+
+<!ENTITY % fontstyle "%fontstyle.basic; | %fontstyle.extra;">
+
+<!ENTITY % phrase.extra "sub | sup">
+<!ENTITY % phrase.basic "em | strong | dfn | code | q |
+                   samp | kbd | var | cite | abbr | acronym">
+
+<!ENTITY % phrase "%phrase.basic; | %phrase.extra;">
+
+<!ENTITY % inline.forms "input | select | textarea | label | button">
+
+<!-- these can occur at block or inline level -->
+<!ENTITY % misc.inline "ins | del | script">
+
+<!-- these can only occur at block level -->
+<!ENTITY % misc "noscript | %misc.inline;">
+
+<!ENTITY % inline "a | %special; | %fontstyle; | %phrase; | %inline.forms;">
+
+<!-- %Inline; covers inline or "text-level" elements -->
+<!ENTITY % Inline "(#PCDATA | %inline; | %misc.inline;)*">
+
+<!--================== Block level elements ==============================-->
+
+<!ENTITY % heading "h1|h2|h3|h4|h5|h6">
+<!ENTITY % lists "ul | ol | dl | menu | dir">
+<!ENTITY % blocktext "pre | hr | blockquote | address | center | noframes">
+
+<!ENTITY % block
+    "p | %heading; | div | %lists; | %blocktext; | isindex |fieldset | table">
+
+<!-- %Flow; mixes block and inline and is used for list items etc. -->
+<!ENTITY % Flow "(#PCDATA | %block; | form | %inline; | %misc;)*">
+
+<!--================== Content models for exclusions =====================-->
+
+<!-- a elements use %Inline; excluding a -->
+
+<!ENTITY % a.content
+   "(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; | %misc.inline;)*">
+
+<!-- pre uses %Inline excluding img, object, applet, big, small,
+     font, or basefont -->
+
+<!ENTITY % pre.content
+   "(#PCDATA | a | %special.basic; | %fontstyle.basic; | %phrase.basic; |
+          %inline.forms; | %misc.inline;)*">
+
+<!-- form uses %Flow; excluding form -->
+
+<!ENTITY % form.content "(#PCDATA | %block; | %inline; | %misc;)*">
+
+<!-- button uses %Flow; but excludes a, form, form controls, iframe -->
+
+<!ENTITY % button.content
+   "(#PCDATA | p | %heading; | div | %lists; | %blocktext; |
+      table | br | span | bdo | object | applet | img | map |
+      %fontstyle; | %phrase; | %misc;)*">
+
+<!--================ Document Structure ==================================-->
+
+<!-- the namespace URI designates the document profile -->
+
+<!ELEMENT html (head, body)>
+<!ATTLIST html
+  %i18n;
+  id          ID             #IMPLIED
+  xmlns       %URI;          #FIXED 'http://www.w3.org/1999/xhtml'
+  >
+
+<!--================ Document Head =======================================-->
+
+<!ENTITY % head.misc "(script|style|meta|link|object|isindex)*">
+
+<!-- content model is %head.misc; combined with a single
+     title and an optional base element in any order -->
+
+<!ELEMENT head (%head.misc;,
+     ((title, %head.misc;, (base, %head.misc;)?) |
+      (base, %head.misc;, (title, %head.misc;))))>
+
+<!ATTLIST head
+  %i18n;
+  id          ID             #IMPLIED
+  profile     %URI;          #IMPLIED
+  >
+
+<!-- The title element is not considered part of the flow of text.
+       It should be displayed, for example as the page header or
+       window title. Exactly one title is required per document.
+    -->
+<!ELEMENT title (#PCDATA)>
+<!ATTLIST title 
+  %i18n;
+  id          ID             #IMPLIED
+  >
+
+<!-- document base URI -->
+
+<!ELEMENT base EMPTY>
+<!ATTLIST base
+  id          ID             #IMPLIED
+  href        %URI;          #IMPLIED
+  target      %FrameTarget;  #IMPLIED
+  >
+
+<!-- generic metainformation -->
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+  %i18n;
+  id          ID             #IMPLIED
+  http-equiv  CDATA          #IMPLIED
+  name        CDATA          #IMPLIED
+  content     CDATA          #REQUIRED
+  scheme      CDATA          #IMPLIED
+  >
+
+<!--
+  Relationship values can be used in principle:
+
+   a) for document specific toolbars/menus when used
+      with the link element in document head e.g.
+        start, contents, previous, next, index, end, help
+   b) to link to a separate style sheet (rel="stylesheet")
+   c) to make a link to a script (rel="script")
+   d) by stylesheets to control how collections of
+      html nodes are rendered into printed documents
+   e) to make a link to a printable version of this document
+      e.g. a PostScript or PDF version (rel="alternate" media="print")
+-->
+
+<!ELEMENT link EMPTY>
+<!ATTLIST link
+  %attrs;
+  charset     %Charset;      #IMPLIED
+  href        %URI;          #IMPLIED
+  hreflang    %LanguageCode; #IMPLIED
+  type        %ContentType;  #IMPLIED
+  rel         %LinkTypes;    #IMPLIED
+  rev         %LinkTypes;    #IMPLIED
+  media       %MediaDesc;    #IMPLIED
+  target      %FrameTarget;  #IMPLIED
+  >
+
+<!-- style info, which may include CDATA sections -->
+<!ELEMENT style (#PCDATA)>
+<!ATTLIST style
+  %i18n;
+  id          ID             #IMPLIED
+  type        %ContentType;  #REQUIRED
+  media       %MediaDesc;    #IMPLIED
+  title       %Text;         #IMPLIED
+  xml:space   (preserve)     #FIXED 'preserve'
+  >
+
+<!-- script statements, which may include CDATA sections -->
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+  id          ID             #IMPLIED
+  charset     %Charset;      #IMPLIED
+  type        %ContentType;  #REQUIRED
+  language    CDATA          #IMPLIED
+  src         %URI;          #IMPLIED
+  defer       (defer)        #IMPLIED
+  xml:space   (preserve)     #FIXED 'preserve'
+  >
+
+<!-- alternate content container for non script-based rendering -->
+
+<!ELEMENT noscript %Flow;>
+<!ATTLIST noscript
+  %attrs;
+  >
+
+<!--======================= Frames =======================================-->
+
+<!-- inline subwindow -->
+
+<!ELEMENT iframe %Flow;>
+<!ATTLIST iframe
+  %coreattrs;
+  longdesc    %URI;          #IMPLIED
+  name        NMTOKEN        #IMPLIED
+  src         %URI;          #IMPLIED
+  frameborder (1|0)          "1"
+  marginwidth %Pixels;       #IMPLIED
+  marginheight %Pixels;      #IMPLIED
+  scrolling   (yes|no|auto)  "auto"
+  align       %ImgAlign;     #IMPLIED
+  height      %Length;       #IMPLIED
+  width       %Length;       #IMPLIED
+  >
+
+<!-- alternate content container for non frame-based rendering -->
+
+<!ELEMENT noframes %Flow;>
+<!ATTLIST noframes
+  %attrs;
+  >
+
+<!--=================== Document Body ====================================-->
+
+<!ELEMENT body %Flow;>
+<!ATTLIST body
+  %attrs;
+  onload      %Script;       #IMPLIED
+  onunload    %Script;       #IMPLIED
+  background  %URI;          #IMPLIED
+  bgcolor     %Color;        #IMPLIED
+  text        %Color;        #IMPLIED
+  link        %Color;        #IMPLIED
+  vlink       %Color;        #IMPLIED
+  alink       %Color;        #IMPLIED
+  >
+
+<!ELEMENT div %Flow;>  <!-- generic language/style container -->
+<!ATTLIST div
+  %attrs;
+  %TextAlign;
+  >
+
+<!--=================== Paragraphs =======================================-->
+
+<!ELEMENT p %Inline;>
+<!ATTLIST p
+  %attrs;
+  %TextAlign;
+  >
+
+<!--=================== Headings =========================================-->
+
+<!--
+  There are six levels of headings from h1 (the most important)
+  to h6 (the least important).
+-->
+
+<!ELEMENT h1  %Inline;>
+<!ATTLIST h1
+  %attrs;
+  %TextAlign;
+  >
+
+<!ELEMENT h2 %Inline;>
+<!ATTLIST h2
+  %attrs;
+  %TextAlign;
+  >
+
+<!ELEMENT h3 %Inline;>
+<!ATTLIST h3
+  %attrs;
+  %TextAlign;
+  >
+
+<!ELEMENT h4 %Inline;>
+<!ATTLIST h4
+  %attrs;
+  %TextAlign;
+  >
+
+<!ELEMENT h5 %Inline;>
+<!ATTLIST h5
+  %attrs;
+  %TextAlign;
+  >
+
+<!ELEMENT h6 %Inline;>
+<!ATTLIST h6
+  %attrs;
+  %TextAlign;
+  >
+
+<!--=================== Lists ============================================-->
+
+<!-- Unordered list bullet styles -->
+
+<!ENTITY % ULStyle "(disc|square|circle)">
+
+<!-- Unordered list -->
+
+<!ELEMENT ul (li)+>
+<!ATTLIST ul
+  %attrs;
+  type        %ULStyle;     #IMPLIED
+  compact     (compact)     #IMPLIED
+  >
+
+<!-- Ordered list numbering style
+
+    1   arabic numbers      1, 2, 3, ...
+    a   lower alpha         a, b, c, ...
+    A   upper alpha         A, B, C, ...
+    i   lower roman         i, ii, iii, ...
+    I   upper roman         I, II, III, ...
+
+    The style is applied to the sequence number which by default
+    is reset to 1 for the first list item in an ordered list.
+-->
+<!ENTITY % OLStyle "CDATA">
+
+<!-- Ordered (numbered) list -->
+
+<!ELEMENT ol (li)+>
+<!ATTLIST ol
+  %attrs;
+  type        %OLStyle;      #IMPLIED
+  compact     (compact)      #IMPLIED
+  start       %Number;       #IMPLIED
+  >
+
+<!-- single column list (DEPRECATED) --> 
+<!ELEMENT menu (li)+>
+<!ATTLIST menu
+  %attrs;
+  compact     (compact)     #IMPLIED
+  >
+
+<!-- multiple column list (DEPRECATED) --> 
+<!ELEMENT dir (li)+>
+<!ATTLIST dir
+  %attrs;
+  compact     (compact)     #IMPLIED
+  >
+
+<!-- LIStyle is constrained to: "(%ULStyle;|%OLStyle;)" -->
+<!ENTITY % LIStyle "CDATA">
+
+<!-- list item -->
+
+<!ELEMENT li %Flow;>
+<!ATTLIST li
+  %attrs;
+  type        %LIStyle;      #IMPLIED
+  value       %Number;       #IMPLIED
+  >
+
+<!-- definition lists - dt for term, dd for its definition -->
+
+<!ELEMENT dl (dt|dd)+>
+<!ATTLIST dl
+  %attrs;
+  compact     (compact)      #IMPLIED
+  >
+
+<!ELEMENT dt %Inline;>
+<!ATTLIST dt
+  %attrs;
+  >
+
+<!ELEMENT dd %Flow;>
+<!ATTLIST dd
+  %attrs;
+  >
+
+<!--=================== Address ==========================================-->
+
+<!-- information on author -->
+
+<!ELEMENT address (#PCDATA | %inline; | %misc.inline; | p)*>
+<!ATTLIST address
+  %attrs;
+  >
+
+<!--=================== Horizontal Rule ==================================-->
+
+<!ELEMENT hr EMPTY>
+<!ATTLIST hr
+  %attrs;
+  align       (left|center|right) #IMPLIED
+  noshade     (noshade)      #IMPLIED
+  size        %Pixels;       #IMPLIED
+  width       %Length;       #IMPLIED
+  >
+
+<!--=================== Preformatted Text ================================-->
+
+<!-- content is %Inline; excluding 
+        "img|object|applet|big|small|sub|sup|font|basefont" -->
+
+<!ELEMENT pre %pre.content;>
+<!ATTLIST pre
+  %attrs;
+  width       %Number;      #IMPLIED
+  xml:space   (preserve)    #FIXED 'preserve'
+  >
+
+<!--=================== Block-like Quotes ================================-->
+
+<!ELEMENT blockquote %Flow;>
+<!ATTLIST blockquote
+  %attrs;
+  cite        %URI;          #IMPLIED
+  >
+
+<!--=================== Text alignment ===================================-->
+
+<!-- center content -->
+<!ELEMENT center %Flow;>
+<!ATTLIST center
+  %attrs;
+  >
+
+<!--=================== Inserted/Deleted Text ============================-->
+
+<!--
+  ins/del are allowed in block and inline content, but its
+  inappropriate to include block content within an ins element
+  occurring in inline content.
+-->
+<!ELEMENT ins %Flow;>
+<!ATTLIST ins
+  %attrs;
+  cite        %URI;          #IMPLIED
+  datetime    %Datetime;     #IMPLIED
+  >
+
+<!ELEMENT del %Flow;>
+<!ATTLIST del
+  %attrs;
+  cite        %URI;          #IMPLIED
+  datetime    %Datetime;     #IMPLIED
+  >
+
+<!--================== The Anchor Element ================================-->
+
+<!-- content is %Inline; except that anchors shouldn't be nested -->
+
+<!ELEMENT a %a.content;>
+<!ATTLIST a
+  %attrs;
+  %focus;
+  charset     %Charset;      #IMPLIED
+  type        %ContentType;  #IMPLIED
+  name        NMTOKEN        #IMPLIED
+  href        %URI;          #IMPLIED
+  hreflang    %LanguageCode; #IMPLIED
+  rel         %LinkTypes;    #IMPLIED
+  rev         %LinkTypes;    #IMPLIED
+  shape       %Shape;        "rect"
+  coords      %Coords;       #IMPLIED
+  target      %FrameTarget;  #IMPLIED
+  >
+
+<!--===================== Inline Elements ================================-->
+
+<!ELEMENT span %Inline;> <!-- generic language/style container -->
+<!ATTLIST span
+  %attrs;
+  >
+
+<!ELEMENT bdo %Inline;>  <!-- I18N BiDi over-ride -->
+<!ATTLIST bdo
+  %coreattrs;
+  %events;
+  lang        %LanguageCode; #IMPLIED
+  xml:lang    %LanguageCode; #IMPLIED
+  dir         (ltr|rtl)      #REQUIRED
+  >
+
+<!ELEMENT br EMPTY>   <!-- forced line break -->
+<!ATTLIST br
+  %coreattrs;
+  clear       (left|all|right|none) "none"
+  >
+
+<!ELEMENT em %Inline;>   <!-- emphasis -->
+<!ATTLIST em %attrs;>
+
+<!ELEMENT strong %Inline;>   <!-- strong emphasis -->
+<!ATTLIST strong %attrs;>
+
+<!ELEMENT dfn %Inline;>   <!-- definitional -->
+<!ATTLIST dfn %attrs;>
+
+<!ELEMENT code %Inline;>   <!-- program code -->
+<!ATTLIST code %attrs;>
+
+<!ELEMENT samp %Inline;>   <!-- sample -->
+<!ATTLIST samp %attrs;>
+
+<!ELEMENT kbd %Inline;>  <!-- something user would type -->
+<!ATTLIST kbd %attrs;>
+
+<!ELEMENT var %Inline;>   <!-- variable -->
+<!ATTLIST var %attrs;>
+
+<!ELEMENT cite %Inline;>   <!-- citation -->
+<!ATTLIST cite %attrs;>
+
+<!ELEMENT abbr %Inline;>   <!-- abbreviation -->
+<!ATTLIST abbr %attrs;>
+
+<!ELEMENT acronym %Inline;>   <!-- acronym -->
+<!ATTLIST acronym %attrs;>
+
+<!ELEMENT q %Inline;>   <!-- inlined quote -->
+<!ATTLIST q
+  %attrs;
+  cite        %URI;          #IMPLIED
+  >
+
+<!ELEMENT sub %Inline;> <!-- subscript -->
+<!ATTLIST sub %attrs;>
+
+<!ELEMENT sup %Inline;> <!-- superscript -->
+<!ATTLIST sup %attrs;>
+
+<!ELEMENT tt %Inline;>   <!-- fixed pitch font -->
+<!ATTLIST tt %attrs;>
+
+<!ELEMENT i %Inline;>   <!-- italic font -->
+<!ATTLIST i %attrs;>
+
+<!ELEMENT b %Inline;>   <!-- bold font -->
+<!ATTLIST b %attrs;>
+
+<!ELEMENT big %Inline;>   <!-- bigger font -->
+<!ATTLIST big %attrs;>
+
+<!ELEMENT small %Inline;>   <!-- smaller font -->
+<!ATTLIST small %attrs;>
+
+<!ELEMENT u %Inline;>   <!-- underline -->
+<!ATTLIST u %attrs;>
+
+<!ELEMENT s %Inline;>   <!-- strike-through -->
+<!ATTLIST s %attrs;>
+
+<!ELEMENT strike %Inline;>   <!-- strike-through -->
+<!ATTLIST strike %attrs;>
+
+<!ELEMENT basefont EMPTY>  <!-- base font size -->
+<!ATTLIST basefont
+  id          ID             #IMPLIED
+  size        CDATA          #REQUIRED
+  color       %Color;        #IMPLIED
+  face        CDATA          #IMPLIED
+  >
+
+<!ELEMENT font %Inline;> <!-- local change to font -->
+<!ATTLIST font
+  %coreattrs;
+  %i18n;
+  size        CDATA          #IMPLIED
+  color       %Color;        #IMPLIED
+  face        CDATA          #IMPLIED
+  >
+
+<!--==================== Object ======================================-->
+<!--
+  object is used to embed objects as part of HTML pages.
+  param elements should precede other content. Parameters
+  can also be expressed as attribute/value pairs on the
+  object element itself when brevity is desired.
+-->
+
+<!ELEMENT object (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST object
+  %attrs;
+  declare     (declare)      #IMPLIED
+  classid     %URI;          #IMPLIED
+  codebase    %URI;          #IMPLIED
+  data        %URI;          #IMPLIED
+  type        %ContentType;  #IMPLIED
+  codetype    %ContentType;  #IMPLIED
+  archive     %UriList;      #IMPLIED
+  standby     %Text;         #IMPLIED
+  height      %Length;       #IMPLIED
+  width       %Length;       #IMPLIED
+  usemap      %URI;          #IMPLIED
+  name        NMTOKEN        #IMPLIED
+  tabindex    %Number;       #IMPLIED
+  align       %ImgAlign;     #IMPLIED
+  border      %Pixels;       #IMPLIED
+  hspace      %Pixels;       #IMPLIED
+  vspace      %Pixels;       #IMPLIED
+  >
+
+<!--
+  param is used to supply a named property value.
+  In XML it would seem natural to follow RDF and support an
+  abbreviated syntax where the param elements are replaced
+  by attribute value pairs on the object start tag.
+-->
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+  id          ID             #IMPLIED
+  name        CDATA          #REQUIRED
+  value       CDATA          #IMPLIED
+  valuetype   (data|ref|object) "data"
+  type        %ContentType;  #IMPLIED
+  >
+
+<!--=================== Java applet ==================================-->
+<!--
+  One of code or object attributes must be present.
+  Place param elements before other content.
+-->
+<!ELEMENT applet (#PCDATA | param | %block; | form | %inline; | %misc;)*>
+<!ATTLIST applet
+  %coreattrs;
+  codebase    %URI;          #IMPLIED
+  archive     CDATA          #IMPLIED
+  code        CDATA          #IMPLIED
+  object      CDATA          #IMPLIED
+  alt         %Text;         #IMPLIED
+  name        NMTOKEN        #IMPLIED
+  width       %Length;       #REQUIRED
+  height      %Length;       #REQUIRED
+  align       %ImgAlign;     #IMPLIED
+  hspace      %Pixels;       #IMPLIED
+  vspace      %Pixels;       #IMPLIED
+  >
+
+<!--=================== Images ===========================================-->
+
+<!--
+   To avoid accessibility problems for people who aren't
+   able to see the image, you should provide a text
+   description using the alt and longdesc attributes.
+   In addition, avoid the use of server-side image maps.
+-->
+
+<!ELEMENT img EMPTY>
+<!ATTLIST img
+  %attrs;
+  src         %URI;          #REQUIRED
+  alt         %Text;         #REQUIRED
+  name        NMTOKEN        #IMPLIED
+  longdesc    %URI;          #IMPLIED
+  height      %Length;       #IMPLIED
+  width       %Length;       #IMPLIED
+  usemap      %URI;          #IMPLIED
+  ismap       (ismap)        #IMPLIED
+  align       %ImgAlign;     #IMPLIED
+  border      %Length;       #IMPLIED
+  hspace      %Pixels;       #IMPLIED
+  vspace      %Pixels;       #IMPLIED
+  >
+
+<!-- usemap points to a map element which may be in this document
+  or an external document, although the latter is not widely supported -->
+
+<!--================== Client-side image maps ============================-->
+
+<!-- These can be placed in the same document or grouped in a
+     separate document although this isn't yet widely supported -->
+
+<!ELEMENT map ((%block; | form | %misc;)+ | area+)>
+<!ATTLIST map
+  %i18n;
+  %events;
+  id          ID             #REQUIRED
+  class       CDATA          #IMPLIED
+  style       %StyleSheet;   #IMPLIED
+  title       %Text;         #IMPLIED
+  name        CDATA          #IMPLIED
+  >
+
+<!ELEMENT area EMPTY>
+<!ATTLIST area
+  %attrs;
+  %focus;
+  shape       %Shape;        "rect"
+  coords      %Coords;       #IMPLIED
+  href        %URI;          #IMPLIED
+  nohref      (nohref)       #IMPLIED
+  alt         %Text;         #REQUIRED
+  target      %FrameTarget;  #IMPLIED
+  >
+
+<!--================ Forms ===============================================-->
+
+<!ELEMENT form %form.content;>   <!-- forms shouldn't be nested -->
+
+<!ATTLIST form
+  %attrs;
+  action      %URI;          #REQUIRED
+  method      (get|post)     "get"
+  name        NMTOKEN        #IMPLIED
+  enctype     %ContentType;  "application/x-www-form-urlencoded"
+  onsubmit    %Script;       #IMPLIED
+  onreset     %Script;       #IMPLIED
+  accept      %ContentTypes; #IMPLIED
+  accept-charset %Charsets;  #IMPLIED
+  target      %FrameTarget;  #IMPLIED
+  >
+
+<!--
+  Each label must not contain more than ONE field
+  Label elements shouldn't be nested.
+-->
+<!ELEMENT label %Inline;>
+<!ATTLIST label
+  %attrs;
+  for         IDREF          #IMPLIED
+  accesskey   %Character;    #IMPLIED
+  onfocus     %Script;       #IMPLIED
+  onblur      %Script;       #IMPLIED
+  >
+
+<!ENTITY % InputType
+  "(text | password | checkbox |
+    radio | submit | reset |
+    file | hidden | image | button)"
+   >
+
+<!-- the name attribute is required for all but submit & reset -->
+
+<!ELEMENT input EMPTY>     <!-- form control -->
+<!ATTLIST input
+  %attrs;
+  %focus;
+  type        %InputType;    "text"
+  name        CDATA          #IMPLIED
+  value       CDATA          #IMPLIED
+  checked     (checked)      #IMPLIED
+  disabled    (disabled)     #IMPLIED
+  readonly    (readonly)     #IMPLIED
+  size        CDATA          #IMPLIED
+  maxlength   %Number;       #IMPLIED
+  src         %URI;          #IMPLIED
+  alt         CDATA          #IMPLIED
+  usemap      %URI;          #IMPLIED
+  onselect    %Script;       #IMPLIED
+  onchange    %Script;       #IMPLIED
+  accept      %ContentTypes; #IMPLIED
+  align       %ImgAlign;     #IMPLIED
+  >
+
+<!ELEMENT select (optgroup|option)+>  <!-- option selector -->
+<!ATTLIST select
+  %attrs;
+  name        CDATA          #IMPLIED
+  size        %Number;       #IMPLIED
+  multiple    (multiple)     #IMPLIED
+  disabled    (disabled)     #IMPLIED
+  tabindex    %Number;       #IMPLIED
+  onfocus     %Script;       #IMPLIED
+  onblur      %Script;       #IMPLIED
+  onchange    %Script;       #IMPLIED
+  >
+
+<!ELEMENT optgroup (option)+>   <!-- option group -->
+<!ATTLIST optgroup
+  %attrs;
+  disabled    (disabled)     #IMPLIED
+  label       %Text;         #REQUIRED
+  >
+
+<!ELEMENT option (#PCDATA)>     <!-- selectable choice -->
+<!ATTLIST option
+  %attrs;
+  selected    (selected)     #IMPLIED
+  disabled    (disabled)     #IMPLIED
+  label       %Text;         #IMPLIED
+  value       CDATA          #IMPLIED
+  >
+
+<!ELEMENT textarea (#PCDATA)>     <!-- multi-line text field -->
+<!ATTLIST textarea
+  %attrs;
+  %focus;
+  name        CDATA          #IMPLIED
+  rows        %Number;       #REQUIRED
+  cols        %Number;       #REQUIRED
+  disabled    (disabled)     #IMPLIED
+  readonly    (readonly)     #IMPLIED
+  onselect    %Script;       #IMPLIED
+  onchange    %Script;       #IMPLIED
+  >
+
+<!--
+  The fieldset element is used to group form fields.
+  Only one legend element should occur in the content
+  and if present should only be preceded by whitespace.
+-->
+<!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
+<!ATTLIST fieldset
+  %attrs;
+  >
+
+<!ENTITY % LAlign "(top|bottom|left|right)">
+
+<!ELEMENT legend %Inline;>     <!-- fieldset label -->
+<!ATTLIST legend
+  %attrs;
+  accesskey   %Character;    #IMPLIED
+  align       %LAlign;       #IMPLIED
+  >
+
+<!--
+ Content is %Flow; excluding a, form, form controls, iframe
+--> 
+<!ELEMENT button %button.content;>  <!-- push button -->
+<!ATTLIST button
+  %attrs;
+  %focus;
+  name        CDATA          #IMPLIED
+  value       CDATA          #IMPLIED
+  type        (button|submit|reset) "submit"
+  disabled    (disabled)     #IMPLIED
+  >
+
+<!-- single-line text input control (DEPRECATED) -->
+<!ELEMENT isindex EMPTY>
+<!ATTLIST isindex
+  %coreattrs;
+  %i18n;
+  prompt      %Text;         #IMPLIED
+  >
+
+<!--======================= Tables =======================================-->
+
+<!-- Derived from IETF HTML table standard, see [RFC1942] -->
+
+<!--
+ The border attribute sets the thickness of the frame around the
+ table. The default units are screen pixels.
+
+ The frame attribute specifies which parts of the frame around
+ the table should be rendered. The values are not the same as
+ CALS to avoid a name clash with the valign attribute.
+-->
+<!ENTITY % TFrame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">
+
+<!--
+ The rules attribute defines which rules to draw between cells:
+
+ If rules is absent then assume:
+     "none" if border is absent or border="0" otherwise "all"
+-->
+
+<!ENTITY % TRules "(none | groups | rows | cols | all)">
+  
+<!-- horizontal placement of table relative to document -->
+<!ENTITY % TAlign "(left|center|right)">
+
+<!-- horizontal alignment attributes for cell contents
+
+  char        alignment char, e.g. char=':'
+  charoff     offset for alignment char
+-->
+<!ENTITY % cellhalign
+  "align      (left|center|right|justify|char) #IMPLIED
+   char       %Character;    #IMPLIED
+   charoff    %Length;       #IMPLIED"
+  >
+
+<!-- vertical alignment attributes for cell contents -->
+<!ENTITY % cellvalign
+  "valign     (top|middle|bottom|baseline) #IMPLIED"
+  >
+
+<!ELEMENT table
+     (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>
+<!ELEMENT caption  %Inline;>
+<!ELEMENT thead    (tr)+>
+<!ELEMENT tfoot    (tr)+>
+<!ELEMENT tbody    (tr)+>
+<!ELEMENT colgroup (col)*>
+<!ELEMENT col      EMPTY>
+<!ELEMENT tr       (th|td)+>
+<!ELEMENT th       %Flow;>
+<!ELEMENT td       %Flow;>
+
+<!ATTLIST table
+  %attrs;
+  summary     %Text;         #IMPLIED
+  width       %Length;       #IMPLIED
+  border      %Pixels;       #IMPLIED
+  frame       %TFrame;       #IMPLIED
+  rules       %TRules;       #IMPLIED
+  cellspacing %Length;       #IMPLIED
+  cellpadding %Length;       #IMPLIED
+  align       %TAlign;       #IMPLIED
+  bgcolor     %Color;        #IMPLIED
+  >
+
+<!ENTITY % CAlign "(top|bottom|left|right)">
+
+<!ATTLIST caption
+  %attrs;
+  align       %CAlign;       #IMPLIED
+  >
+
+<!--
+colgroup groups a set of col elements. It allows you to group
+several semantically related columns together.
+-->
+<!ATTLIST colgroup
+  %attrs;
+  span        %Number;       "1"
+  width       %MultiLength;  #IMPLIED
+  %cellhalign;
+  %cellvalign;
+  >
+
+<!--
+ col elements define the alignment properties for cells in
+ one or more columns.
+
+ The width attribute specifies the width of the columns, e.g.
+
+     width=64        width in screen pixels
+     width=0.5*      relative width of 0.5
+
+ The span attribute causes the attributes of one
+ col element to apply to more than one column.
+-->
+<!ATTLIST col
+  %attrs;
+  span        %Number;       "1"
+  width       %MultiLength;  #IMPLIED
+  %cellhalign;
+  %cellvalign;
+  >
+
+<!--
+    Use thead to duplicate headers when breaking table
+    across page boundaries, or for static headers when
+    tbody sections are rendered in scrolling panel.
+
+    Use tfoot to duplicate footers when breaking table
+    across page boundaries, or for static footers when
+    tbody sections are rendered in scrolling panel.
+
+    Use multiple tbody sections when rules are needed
+    between groups of table rows.
+-->
+<!ATTLIST thead
+  %attrs;
+  %cellhalign;
+  %cellvalign;
+  >
+
+<!ATTLIST tfoot
+  %attrs;
+  %cellhalign;
+  %cellvalign;
+  >
+
+<!ATTLIST tbody
+  %attrs;
+  %cellhalign;
+  %cellvalign;
+  >
+
+<!ATTLIST tr
+  %attrs;
+  %cellhalign;
+  %cellvalign;
+  bgcolor     %Color;        #IMPLIED
+  >
+
+<!-- Scope is simpler than headers attribute for common tables -->
+<!ENTITY % Scope "(row|col|rowgroup|colgroup)">
+
+<!-- th is for headers, td for data and for cells acting as both -->
+
+<!ATTLIST th
+  %attrs;
+  abbr        %Text;         #IMPLIED
+  axis        CDATA          #IMPLIED
+  headers     IDREFS         #IMPLIED
+  scope       %Scope;        #IMPLIED
+  rowspan     %Number;       "1"
+  colspan     %Number;       "1"
+  %cellhalign;
+  %cellvalign;
+  nowrap      (nowrap)       #IMPLIED
+  bgcolor     %Color;        #IMPLIED
+  width       %Length;       #IMPLIED
+  height      %Length;       #IMPLIED
+  >
+
+<!ATTLIST td
+  %attrs;
+  abbr        %Text;         #IMPLIED
+  axis        CDATA          #IMPLIED
+  headers     IDREFS         #IMPLIED
+  scope       %Scope;        #IMPLIED
+  rowspan     %Number;       "1"
+  colspan     %Number;       "1"
+  %cellhalign;
+  %cellvalign;
+  nowrap      (nowrap)       #IMPLIED
+  bgcolor     %Color;        #IMPLIED
+  width       %Length;       #IMPLIED
+  height      %Length;       #IMPLIED
+  >
+
diff --git a/matita/help/C/xsl/matita-fo.xsl b/matita/help/C/xsl/matita-fo.xsl
new file mode 100644 (file)
index 0000000..3e564b4
--- /dev/null
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+  <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
+  <xsl:output method="xml" encoding="utf-8" indent="yes"/>
+</xsl:stylesheet>
diff --git a/matita/help/C/xsl/matita-tex.xsl b/matita/help/C/xsl/matita-tex.xsl
new file mode 100644 (file)
index 0000000..5f51e7c
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+  <xsl:import href="http://db2latex.sourceforge.net/xsl/docbook.xsl"/>
+  <xsl:output method="text" encoding="utf-8" indent="yes"/>
+
+  <xsl:param name="admon.graphics.path">/usr/share/xml/docbook/stylesheet/db2latex/latex/figures</xsl:param>
+
+  <xsl:param name="latex.inputenc">utf8x</xsl:param>
+  <xsl:param name="latex.book.preamble.post">\usepackage{txfonts}
+\SetUnicodeOption{mathletters} % prefer math-mode letters
+</xsl:param>
+  <xsl:param name="ulink.show">0</xsl:param>
+
+  <!-- proper alignment of tables used for grammars -->
+
+  <xsl:template match="tgroup[../@role='grammar']">
+    <xsl:text>\begin{tabular}{rcll}
+</xsl:text>
+    <xsl:apply-templates />
+    <xsl:text>\end{tabular}
+</xsl:text>
+  </xsl:template>
+
+  <xsl:template match="variablelist/title">
+    <xsl:text>\paragraph*{</xsl:text>
+    <xsl:apply-templates />
+    <xsl:text>} </xsl:text>
+  </xsl:template>
+
+</xsl:stylesheet>
diff --git a/matita/help/C/xsl/matita-xhtml.xsl b/matita/help/C/xsl/matita-xhtml.xsl
new file mode 100644 (file)
index 0000000..099c390
--- /dev/null
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+  <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/>
+  <xsl:output method="xml" encoding="utf-8" indent="yes"/>
+
+  <xsl:param name="use.id.as.filename" select="1" />
+  <xsl:param name="html.stylesheet">docbook.css</xsl:param>
+  <xsl:param name="table.borders.with.css" select="1" />
+  <!--
+  <xsl:param name="header.rule" select="0" />
+  <xsl:param name="footer.rule" select="0" />
+  -->
+
+  <!-- more quiet output of author information -->
+
+  <xsl:template match="authorgroup" mode="titlepage.mode">
+    <ul class="authorgroup">
+      <xsl:apply-templates mode="matita.manual.mode" />
+    </ul>
+  </xsl:template>
+  <xsl:template match="author" mode="matita.manual.mode">
+    <li class="author">
+      <xsl:value-of select="firstname" />
+      <xsl:text> </xsl:text>
+      <xsl:value-of select="surname" />
+      <xsl:text> &lt;</xsl:text>
+      <xsl:element name="a">
+       <xsl:attribute name="href">
+         <xsl:text>mailto:</xsl:text>
+         <xsl:value-of select="affiliation/address/email" />
+       </xsl:attribute>
+       <xsl:value-of select="affiliation/address/email" />
+      </xsl:element>
+      <xsl:text>&gt;</xsl:text>
+    </li>
+  </xsl:template>
+
+  <!-- only print the latest revision instead of all of them -->
+  <!-- XXX ZACK: right now it just assumes that only one revision does exist -->
+
+  <xsl:template match="revhistory" mode="titlepage.mode">
+    <div class="revhistory">
+      <xsl:apply-templates mode="matita.manual.mode" />
+    </div>
+  </xsl:template>
+  <xsl:template match="revision" mode="matita.manual.mode">
+    <span class="revision">
+      <xsl:text>Revision: </xsl:text>
+      <span class="revnumber">
+       <xsl:value-of select="revnumber" />
+      </span>
+      <xsl:text>, </xsl:text>
+      <span class="date">
+       <xsl:value-of select="date" />
+      </span>
+    </span>
+  </xsl:template>
+
+  <!-- Matita logo on the top left corner -->
+
+  <xsl:template name="user.header.navigation">
+    <a href="../../">
+      <div class="matita_logo">
+       <img src="../../images/matita-tiny.png" alt="Tiny Matita logo" />
+       <span>Matita Home</span>
+      </div>
+    </a>
+  </xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/matita/help/C/xsl/tactic_quickref.xsl b/matita/help/C/xsl/tactic_quickref.xsl
new file mode 100644 (file)
index 0000000..3a46261
--- /dev/null
@@ -0,0 +1,75 @@
+<xsl:stylesheet version="1.0"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+  <xsl:output
+    method="xml"
+    indent="yes"
+    omit-xml-declaration="yes"
+    />
+
+  <xsl:param name="declarative" value=""/>
+
+  <xsl:template match="/">
+    <table frame="topbot" rowsep="0" colsep="0" role="grammar">
+      <title>tactics</title>
+      <tgroup cols="3">
+      <tbody>
+       <xsl:apply-templates select="//chapter[@id=concat('sec_',$declarative,'tactics')]//varlistentry[@role='tactic.synopsis']">
+        <xsl:sort select="ancestor::sect1/title" />
+       </xsl:apply-templates>
+      </tbody>
+     </tgroup>
+    </table>
+  </xsl:template>
+
+  <xsl:template match="varlistentry">
+
+    <xsl:variable name="tactic">
+      <xsl:value-of select="ancestor::sect1/title" />
+    </xsl:variable>
+
+    <row>
+      <entry>
+       <xsl:choose>
+        <xsl:when test="position()=1">
+         <xsl:attribute name="id">grammar.<xsl:value-of select="$declarative"/>tactic</xsl:attribute>
+         <xsl:text disable-output-escaping='yes'>&amp;tactic;</xsl:text>
+        </xsl:when>
+       </xsl:choose>
+      </entry>
+      <entry>
+       <xsl:choose>
+        <xsl:when test="position()=1">
+         <xsl:text>::=</xsl:text>
+        </xsl:when>
+        <xsl:otherwise>
+         <xsl:text>|</xsl:text>
+        </xsl:otherwise>
+       </xsl:choose>
+      </entry>
+      <entry>
+       <xsl:for-each select="listitem/para/* | listitem/para/child::text()">
+         <xsl:choose>
+
+           <xsl:when test="string(.) = $tactic">
+             <xsl:element name="link">
+               <xsl:attribute name="linkend">
+                 <xsl:text>tac_</xsl:text>
+                 <xsl:value-of select="$tactic" />
+               </xsl:attribute>
+               <xsl:copy-of select="." />
+             </xsl:element>
+           </xsl:when>
+
+           <xsl:otherwise>
+             <xsl:copy-of select="." />
+           </xsl:otherwise>
+
+         </xsl:choose>
+       </xsl:for-each>
+      </entry>
+    </row>
+
+  </xsl:template>
+
+</xsl:stylesheet>
diff --git a/matita/icons/matita-32.xpm b/matita/icons/matita-32.xpm
new file mode 100644 (file)
index 0000000..a33050e
--- /dev/null
@@ -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 (file)
index 0000000..03b6e7f
Binary files /dev/null and b/matita/icons/matita-bulb-high.png differ
diff --git a/matita/icons/matita-bulb-low.png b/matita/icons/matita-bulb-low.png
new file mode 100644 (file)
index 0000000..f97302e
Binary files /dev/null and b/matita/icons/matita-bulb-low.png differ
diff --git a/matita/icons/matita-bulb-medium.png b/matita/icons/matita-bulb-medium.png
new file mode 100644 (file)
index 0000000..d3d449f
Binary files /dev/null and b/matita/icons/matita-bulb-medium.png differ
diff --git a/matita/icons/matita-folder.png b/matita/icons/matita-folder.png
new file mode 100644 (file)
index 0000000..ec0cc08
Binary files /dev/null and b/matita/icons/matita-folder.png differ
diff --git a/matita/icons/matita-object.png b/matita/icons/matita-object.png
new file mode 100644 (file)
index 0000000..fe89a30
Binary files /dev/null and b/matita/icons/matita-object.png differ
diff --git a/matita/icons/matita-theory.png b/matita/icons/matita-theory.png
new file mode 100644 (file)
index 0000000..389152e
Binary files /dev/null and b/matita/icons/matita-theory.png differ
diff --git a/matita/icons/matita.png b/matita/icons/matita.png
new file mode 100644 (file)
index 0000000..342bcb4
Binary files /dev/null and b/matita/icons/matita.png differ
diff --git a/matita/icons/matita_medium.png b/matita/icons/matita_medium.png
new file mode 100644 (file)
index 0000000..335688a
Binary files /dev/null and b/matita/icons/matita_medium.png differ
diff --git a/matita/icons/matita_small.png b/matita/icons/matita_small.png
new file mode 100644 (file)
index 0000000..cfb017b
Binary files /dev/null and b/matita/icons/matita_small.png differ
diff --git a/matita/icons/matita_very_small.png b/matita/icons/matita_very_small.png
new file mode 100644 (file)
index 0000000..5a68071
Binary files /dev/null and b/matita/icons/matita_very_small.png differ
diff --git a/matita/icons/meegg.png b/matita/icons/meegg.png
new file mode 100644 (file)
index 0000000..4c2be73
Binary files /dev/null and b/matita/icons/meegg.png differ
diff --git a/matita/icons/whelp.png b/matita/icons/whelp.png
new file mode 100644 (file)
index 0000000..f67ea8b
Binary files /dev/null and b/matita/icons/whelp.png differ
diff --git a/matita/icons/whelp.svg b/matita/icons/whelp.svg
new file mode 100644 (file)
index 0000000..c1da66f
--- /dev/null
@@ -0,0 +1,221 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+   xmlns:xml="http://www.w3.org/XML/1998/namespace"
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://web.resource.org/cc/"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   inkscape:export-ydpi="2.8499999"
+   inkscape:export-xdpi="2.8499999"
+   inkscape:export-filename="/home/tassi/helm/matita/icons/whelp.png"
+   sodipodi:docname="whelp.svg"
+   sodipodi:docbase="/home/tassi/helm/matita/icons"
+   inkscape:version="0.41"
+   sodipodi:version="0.32"
+   id="svg2"
+   height="297mm"
+   width="210mm">
+  <defs
+     id="defs3" />
+  <sodipodi:namedview
+     inkscape:window-y="47"
+     inkscape:window-x="538"
+     inkscape:window-height="743"
+     inkscape:window-width="697"
+     inkscape:current-layer="layer1"
+     inkscape:document-units="px"
+     inkscape:cy="526.18109"
+     inkscape:cx="-47.832055"
+     inkscape:zoom="0.53878789"
+     inkscape:pageshadow="2"
+     inkscape:pageopacity="0.0"
+     borderopacity="1.0"
+     bordercolor="#666666"
+     pagecolor="#ffffff"
+     id="base" />
+  <metadata
+     id="metadata4">
+    <rdf:RDF
+       id="RDF5">
+      <cc:Work
+         id="Work6"
+         rdf:about="">
+        <dc:format
+           id="format7">image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage"
+           id="type9" />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     id="layer1"
+     inkscape:groupmode="layer"
+     inkscape:label="Layer 1">
+    <g
+       transform="translate(7.424147,-25.98425)"
+       id="g2113">
+      <path
+         transform="matrix(3.092445,0.000000,0.000000,3.244102,-1367.216,-1102.351)"
+         d="M 277.14285 465.21933 A 21.428572 18.571428 0 1 1  234.28571,465.21933 A 21.428572 18.571428 0 1 1  277.14285 465.21933 z"
+         sodipodi:ry="18.571428"
+         sodipodi:rx="21.428572"
+         sodipodi:cy="465.21933"
+         sodipodi:cx="255.71428"
+         id="path1310"
+         style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.31571975;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
+         sodipodi:type="arc" />
+      <path
+         transform="matrix(3.577041,0.000000,0.000000,3.764523,-1365.700,-1442.358)"
+         d="M 277.14285 465.21933 A 21.428572 18.571428 0 1 1  234.28571,465.21933 A 21.428572 18.571428 0 1 1  277.14285 465.21933 z"
+         sodipodi:ry="18.571428"
+         sodipodi:rx="21.428572"
+         sodipodi:cy="465.21933"
+         sodipodi:cx="255.71428"
+         id="path1316"
+         style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.27251038;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
+         sodipodi:type="arc" />
+      <path
+         transform="matrix(3.536915,0.000000,0.000000,3.972675,-1343.944,-1485.563)"
+         d="M 322.85714 442.36218 A 22.857143 18.571428 0 1 1  277.14286,442.36218 A 22.857143 18.571428 0 1 1  322.85714 442.36218 z"
+         sodipodi:ry="18.571428"
+         sodipodi:rx="22.857143"
+         sodipodi:cy="442.36218"
+         sodipodi:cx="300.00000"
+         id="path1322"
+         style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.26677564;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
+         sodipodi:type="arc" />
+      <path
+         transform="matrix(3.750966,0.000000,0.000000,3.972675,-1450.760,-1408.096)"
+         d="M 382.85716 436.64789 A 24.285715 21.428572 0 1 1  334.28573,436.64789 A 24.285715 21.428572 0 1 1  382.85716 436.64789 z"
+         sodipodi:ry="21.428572"
+         sodipodi:rx="24.285715"
+         sodipodi:cy="436.64789"
+         sodipodi:cx="358.57144"
+         id="path1328"
+         style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.25905198;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
+         sodipodi:type="arc" />
+      <path
+         transform="matrix(3.536915,0.000000,0.000000,3.972675,-1478.347,-1461.727)"
+         d="M 394.28573 513.79077 A 65.714287 52.857143 0 1 1  262.85715,513.79077 A 65.714287 52.857143 0 1 1  394.28573 513.79077 z"
+         sodipodi:ry="52.857143"
+         sodipodi:rx="65.714287"
+         sodipodi:cy="513.79077"
+         sodipodi:cx="328.57144"
+         id="path1334"
+         style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.26677564;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"
+         sodipodi:type="arc" />
+    </g>
+    <g
+       id="g3923"
+       transform="matrix(3.536915,0.000000,0.000000,3.972675,-801.3348,-1982.086)"
+       inkscape:export-filename="/projects/helm/daemons/searchEngine/html/whelp.png"
+       inkscape:export-xdpi="100.84000"
+       inkscape:export-ydpi="100.84000">
+      <path
+         transform="matrix(0.874334,0.000000,0.000000,0.816604,44.53485,211.7504)"
+         d="M 277.14285 465.21933 A 21.428572 18.571428 0 1 1  234.28571,465.21933 A 21.428572 18.571428 0 1 1  277.14285 465.21933 z"
+         sodipodi:ry="18.571428"
+         sodipodi:rx="21.428572"
+         sodipodi:cy="465.21933"
+         sodipodi:cx="255.71428"
+         id="path2998"
+         style="fill:#780000;fill-opacity:0.48627451;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
+         sodipodi:type="arc" />
+      <text
+         id="text3000"
+         y="600.53583"
+         x="257.61462"
+         style="font-size:36.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:0.78431374;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Domestic Manners;text-anchor:start;writing-mode:lr-tb"
+         xml:space="preserve"><tspan
+           y="600.53583"
+           x="257.61462"
+           id="tspan3002"
+           sodipodi:role="line">h</tspan></text>
+      <path
+         transform="matrix(1.011345,0.000000,0.000000,0.947604,44.96344,126.1641)"
+         d="M 277.14285 465.21933 A 21.428572 18.571428 0 1 1  234.28571,465.21933 A 21.428572 18.571428 0 1 1  277.14285 465.21933 z"
+         sodipodi:ry="18.571428"
+         sodipodi:rx="21.428572"
+         sodipodi:cy="465.21933"
+         sodipodi:cx="255.71428"
+         id="path3004"
+         style="fill:#780000;fill-opacity:0.48627451;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
+         sodipodi:type="arc" />
+      <text
+         id="text3006"
+         y="573.53583"
+         x="292.11462"
+         style="font-size:36.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:0.78431374;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Domestic Manners;text-anchor:start;writing-mode:lr-tb"
+         xml:space="preserve"><tspan
+           y="573.53583"
+           x="292.11462"
+           id="tspan3008"
+           sodipodi:role="line">e</tspan></text>
+      <path
+         transform="translate(51.11460,115.2886)"
+         d="M 322.85714 442.36218 A 22.857143 18.571428 0 1 1  277.14286,442.36218 A 22.857143 18.571428 0 1 1  322.85714 442.36218 z"
+         sodipodi:ry="18.571428"
+         sodipodi:rx="22.857143"
+         sodipodi:cy="442.36218"
+         sodipodi:cx="300.00000"
+         id="path3010"
+         style="fill:#780000;fill-opacity:0.48627451;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
+         sodipodi:type="arc" />
+      <text
+         id="text3012"
+         y="570.53583"
+         x="345.11462"
+         style="font-size:36.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:0.78431374;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Domestic Manners;text-anchor:start;writing-mode:lr-tb"
+         xml:space="preserve"><tspan
+           y="570.53583"
+           x="345.11462"
+           id="tspan3014"
+           sodipodi:role="line">l</tspan></text>
+      <path
+         transform="matrix(1.060519,0.000000,0.000000,1.000000,20.91431,134.7886)"
+         d="M 382.85716 436.64789 A 24.285715 21.428572 0 1 1  334.28573,436.64789 A 24.285715 21.428572 0 1 1  382.85716 436.64789 z"
+         sodipodi:ry="21.428572"
+         sodipodi:rx="24.285715"
+         sodipodi:cy="436.64789"
+         sodipodi:cx="358.57144"
+         id="path3016"
+         style="fill:#780000;fill-opacity:0.48627451;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
+         sodipodi:type="arc" />
+      <text
+         id="text3018"
+         y="575.03583"
+         x="392.11462"
+         style="font-size:36.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:0.78431374;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Domestic Manners;text-anchor:start;writing-mode:lr-tb"
+         xml:space="preserve"><tspan
+           y="575.03583"
+           x="392.11462"
+           id="tspan3020"
+           sodipodi:role="line">p</tspan></text>
+      <path
+         transform="translate(13.11460,121.2886)"
+         d="M 394.28573 513.79077 A 65.714287 52.857143 0 1 1  262.85715,513.79077 A 65.714287 52.857143 0 1 1  394.28573 513.79077 z"
+         sodipodi:ry="52.857143"
+         sodipodi:rx="65.714287"
+         sodipodi:cy="513.79077"
+         sodipodi:cx="328.57144"
+         id="path3024"
+         style="fill:#000050;fill-opacity:0.31372550;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"
+         sodipodi:type="arc" />
+      <text
+         id="text3026"
+         y="655.03577"
+         x="317.61459"
+         style="font-size:64.000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;fill:#000000;fill-opacity:0.78431374;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Domestic Manners;text-anchor:start;writing-mode:lr-tb"
+         xml:space="preserve"><tspan
+           y="655.03577"
+           x="317.61459"
+           id="tspan3028"
+           sodipodi:role="line">W</tspan></text>
+    </g>
+  </g>
+</svg>
diff --git a/matita/lablGraphviz.ml b/matita/lablGraphviz.ml
new file mode 100644 (file)
index 0000000..d67584c
--- /dev/null
@@ -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  (* <key, value> 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 (file)
index 0000000..7b90eec
--- /dev/null
@@ -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  (* <key, value> 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 (file)
index 0000000..4ea9919
--- /dev/null
@@ -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 (file)
index 0000000..a1dd3ca
--- /dev/null
@@ -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 (file)
index 0000000..4ab638b
--- /dev/null
@@ -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 (file)
index 0000000..7ceee15
--- /dev/null
@@ -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 (file)
index 0000000..af39f4a
--- /dev/null
@@ -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 (file)
index 0000000..c3ce75b
--- /dev/null
@@ -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 (file)
index 0000000..b7bca88
--- /dev/null
@@ -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 (file)
index 0000000..a6bb71f
--- /dev/null
@@ -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 (file)
index 0000000..7fe6024
--- /dev/null
@@ -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<n1
+      | EQ \Rightarrow n=n1
+      | GT \Rightarrow n1<n] \to 
+      match (nat_compare n n1) with
+      [ LT \Rightarrow (S n) \leq n1
+      | EQ \Rightarrow pos n = pos n1
+      | GT \Rightarrow (S n1) \leq n]). 
+        apply Hcut.apply nat_compare_to_Prop. 
+        elim (nat_compare n n1).
+          simplify.exact H.
+          simplify.apply eq_f.exact H.
+          simplify.exact H.
+    simplify.exact I.    
+  elim y. 
+    simplify.exact I.
+    simplify.exact I.
+    simplify. 
+      cut (match (nat_compare n1 n) with
+      [ LT \Rightarrow n1<n
+      | EQ \Rightarrow n1=n
+      | GT \Rightarrow n<n1] \to 
+      match (nat_compare n1 n) with
+      [ LT \Rightarrow (S n1) \leq n
+      | EQ \Rightarrow neg n = neg n1
+      | GT \Rightarrow (S n) \leq n1]). 
+        apply Hcut. apply nat_compare_to_Prop. 
+        elim (nat_compare n1 n).
+          simplify.exact H.
+          simplify.apply eq_f.apply sym_eq.exact H.
+          simplify.exact H.
+qed.
diff --git a/matita/library/Z/dirichlet_product.ma b/matita/library/Z/dirichlet_product.ma
new file mode 100644 (file)
index 0000000..fcaddcf
--- /dev/null
@@ -0,0 +1,520 @@
+(**************************************************************************)
+(*       ___                                                               *)
+(*      ||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 "Z/sigma_p.ma".
+include "Z/times.ma".
+
+definition dirichlet_product : (nat \to Z) \to (nat \to Z) \to nat \to Z \def
+\lambda f,g.\lambda n.
+sigma_p (S n) 
+ (\lambda d.divides_b d n) (\lambda d. (f d)*(g (div n d))).
+
+(* dirichlet_product is associative only up to extensional equality *)
+theorem associative_dirichlet_product: 
+\forall f,g,h:nat\to Z.\forall n:nat.O < n \to
+dirichlet_product (dirichlet_product f g) h n
+ = dirichlet_product f (dirichlet_product g h) n.
+intros.
+unfold dirichlet_product.
+unfold dirichlet_product.
+apply (trans_eq ? ? 
+(sigma_p (S n) (\lambda d:nat.divides_b d n)
+(\lambda d:nat
+ .sigma_p (S n) (\lambda d1:nat.divides_b d1 d) (\lambda d1:nat.f d1*g (d/d1)*h (n/d)))))
+  [apply eq_sigma_p1
+    [intros.reflexivity
+    |intros.
+     apply (trans_eq ? ? 
+     (sigma_p (S x) (\lambda d1:nat.divides_b d1 x) (\lambda d1:nat.f d1*g (x/d1)*h (n/x))))
+      [apply Ztimes_sigma_pr
+      |(* hint solleva unification uncertain ?? *)
+       apply sym_eq.
+       apply false_to_eq_sigma_p
+        [assumption
+        |intros.
+         apply not_divides_to_divides_b_false
+          [apply (lt_to_le_to_lt ? (S x))
+            [apply lt_O_S|assumption]
+          |unfold Not. intro.
+           apply (lt_to_not_le ? ? H3).
+           apply divides_to_le
+            [apply (divides_b_true_to_lt_O ? ? H H2).
+            |assumption
+            ]
+          ]
+        ]
+      ]
+    ]
+  |apply (trans_eq ? ?
+   (sigma_p (S n) (\lambda d:nat.divides_b d n)
+    (\lambda d:nat
+      .sigma_p (S n) (\lambda d1:nat.divides_b d1 (n/d))
+      (\lambda d1:nat.f d*g d1*h ((n/d)/d1)))))
+    [apply (trans_eq ? ?
+      (sigma_p (S n) (\lambda d:nat.divides_b d n)
+       (\lambda d:nat
+        .sigma_p (S n) (\lambda d1:nat.divides_b d1 (n/d))
+        (\lambda d1:nat.f d*g ((times d d1)/d)*h ((n/times d d1))))))
+      [apply (sigma_p2_eq 
+        (\lambda d,d1.f d1*g (d/d1)*h (n/d))
+        (\lambda d,d1:nat.times d d1) 
+        (\lambda d,d1:nat.d) 
+        (\lambda d,d1:nat.d1) 
+        (\lambda d,d1:nat.d/d1)
+        (S n)
+        (S n)
+        (S n)
+        (S n)
+        ?
+        ?
+        (\lambda d,d1:nat.divides_b d1 d)
+        (\lambda d,d1:nat.divides_b d1 (n/d))
+        )
+        [intros.
+         split
+          [split
+            [split
+              [split
+                [split
+                  [apply divides_to_divides_b_true1
+                    [assumption
+                    |apply (witness ? ? ((n/i)/j)).
+                     rewrite > 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 (file)
index 0000000..3aa994d
--- /dev/null
@@ -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 (file)
index 0000000..a82b68e
--- /dev/null
@@ -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 (file)
index 0000000..8802d88
--- /dev/null
@@ -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<m
+    | (neg m) \Rightarrow False ]
+  | (neg n) \Rightarrow 
+    match y with 
+    [ OZ \Rightarrow True
+    | (pos m) \Rightarrow True
+    | (neg m) \Rightarrow m<n ]].
+    
+(*CSC: the URI must disappear: there is a bug now *)
+interpretation "integer 'less than'" 'lt x y = (cic:/matita/Z/orders/Zlt.con x y).
+(*CSC: the URI must disappear: there is a bug now *)
+interpretation "integer 'not less than'" 'nless x y =
+  (cic:/matita/logic/connectives/Not.con (cic:/matita/Z/orders/Zlt.con x y)).
+
+theorem irreflexive_Zlt: irreflexive Z Zlt.
+unfold irreflexive.unfold Not.
+intro.elim x.exact H.
+cut (neg n < neg n \to False).
+apply Hcut.apply H.simplify.unfold lt.apply not_le_Sn_n.
+cut (pos n < pos n \to False).
+apply Hcut.apply H.simplify.unfold lt.apply not_le_Sn_n.
+qed.
+
+(* transitivity *)
+theorem transitive_Zle : transitive Z Zle.
+unfold transitive.
+intros 3.
+elim x 0
+[ (* x = OZ *)
+  elim y 0
+  [ intros. assumption 
+  | intro.
+    elim z
+    [ simplify. apply I 
+    | simplify. apply I
+    | simplify. simplify in H1. assumption
+    ]
+  | intro.
+    elim z
+    [ simplify. apply I
+    | simplify. apply I
+    | simplify. simplify in H. assumption
+    ]
+  ]
+| (* x = (pos n) *)
+  intro.
+  elim y 0
+  [ intros. apply False_ind. apply H
+  | intros 2. 
+    elim z 0
+    [ simplify. intro. assumption
+    | intro. generalize in match H. simplify. apply trans_le 
+    | intro. simplify. intro. assumption
+    ]
+  | intros 2. apply False_ind. apply H
+  ]
+| (* x = (neg n) *)
+  intro.
+  elim y 0
+  [ elim z 0
+    [ simplify. intros. assumption
+    | intro. simplify. intros. assumption
+    | intro. simplify. intros. apply False_ind. apply H1
+    ]
+  | intros 2.
+    elim z
+    [ apply False_ind. apply H1 
+    | simplify. apply I
+    | apply False_ind. apply H1
+    ]
+  | intros 2.
+    elim z 0
+    [ simplify. intro. assumption
+    | intro. simplify. intro. assumption
+    | intros. simplify. simplify in H. simplify in H1. 
+      generalize in match H. generalize in match H1. apply trans_le
+    ]
+  ]
+]
+qed.
+
+variant trans_Zle: transitive Z Zle
+\def transitive_Zle.
+
+theorem transitive_Zlt: transitive Z Zlt.
+unfold.
+intros 3.
+elim x 0
+[ (* x = OZ *)
+  elim y 0
+  [ intros. apply False_ind. apply H 
+  | intro.
+    elim z
+    [ simplify. apply H1 
+    | simplify. apply I
+    | simplify. apply H1
+    ]
+  | intros 2. apply False_ind. apply H
+  ]
+| (* x = (pos n) *)
+  intro.
+  elim y 0
+  [ intros. apply False_ind. apply H
+  | intros 2. 
+    elim z 0
+    [ simplify. intro. assumption
+    | intro. generalize in match H. simplify. apply trans_lt 
+    | intro. simplify. intro. assumption
+    ]
+  | intros 2. apply False_ind. apply H
+  ]
+| (* x = (neg n) *)
+  intro.
+  elim y 0
+  [ elim z 0
+    [ intros. simplify. apply I
+    | intro. simplify. intros. assumption
+    | intro. simplify. intros. apply False_ind. apply H1
+    ]
+  | intros 2.
+    elim z
+    [ apply False_ind. apply H1 
+    | simplify. apply I
+    | apply False_ind. apply H1
+    ]
+  | intros 2.
+    elim z 0
+    [ simplify. intro. assumption
+    | intro. simplify. intro. assumption
+    | intros. simplify. simplify in H. simplify in H1. 
+      generalize in match H. generalize in match H1. apply trans_lt
+    ]
+  ]
+]
+qed.
+
+variant trans_Zlt: transitive Z Zlt
+\def transitive_Zlt.
+theorem irrefl_Zlt: irreflexive Z Zlt
+\def irreflexive_Zlt.
+
+theorem Zlt_neg_neg_to_lt: 
+\forall n,m:nat. neg n < neg m \to m < n.
+intros.apply H.
+qed.
+
+theorem lt_to_Zlt_neg_neg: \forall n,m:nat.m < n \to neg n < neg m. 
+intros.
+simplify.apply H.
+qed.
+
+theorem Zlt_pos_pos_to_lt: 
+\forall n,m:nat. pos n < pos m \to n < m.
+intros.apply H.
+qed.
+
+theorem lt_to_Zlt_pos_pos: \forall n,m:nat.n < m \to pos n < pos m. 
+intros.
+simplify.apply H.
+qed.
+
+theorem Zlt_to_Zle: \forall x,y:Z. x < y \to Zsucc x \leq y.
+intros 2.
+elim x.
+(* goal: x=OZ *)
+  cut (OZ < y \to Zsucc OZ \leq y).
+    apply Hcut. assumption.
+    simplify.elim y. 
+      simplify.exact H1.
+      simplify.apply le_O_n.
+      simplify.exact H1.
+(* goal: x=pos *)      
+  exact H.
+(* goal: x=neg *)      
+  cut (neg n < y \to Zsucc (neg n) \leq y).
+    apply Hcut. assumption.
+    elim n.
+      cut (neg O < y \to Zsucc (neg O) \leq y).
+        apply Hcut. assumption.
+        simplify.elim y.
+          simplify.exact I.
+          simplify.exact I.
+          simplify.apply (not_le_Sn_O n1 H2).
+      cut (neg (S n1) < y \to (Zsucc (neg (S n1))) \leq y).
+        apply Hcut. assumption.simplify.
+        elim y.
+          simplify.exact I.
+          simplify.exact I.
+          simplify.apply (le_S_S_to_le n2 n1 H3).
+qed.
diff --git a/matita/library/Z/plus.ma b/matita/library/Z/plus.ma
new file mode 100644 (file)
index 0000000..32a00f8
--- /dev/null
@@ -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         *)
+(*                                                                        *)
+(**************************************************************************)
+
+
+
+include "Z/z.ma".
+include "nat/minus.ma".
+
+definition Zplus :Z \to Z \to Z \def
+\lambda x,y.
+  match x with
+    [ OZ \Rightarrow y
+    | (pos m) \Rightarrow
+        match y with
+         [ OZ \Rightarrow x
+         | (pos n) \Rightarrow (pos (pred ((S m)+(S n))))
+         | (neg n) \Rightarrow 
+              match nat_compare m n with
+                [ LT \Rightarrow (neg (pred (n-m)))
+                | EQ \Rightarrow OZ
+                | GT \Rightarrow (pos (pred (m-n)))] ]
+    | (neg m) \Rightarrow
+        match y with
+         [ OZ \Rightarrow x
+         | (pos n) \Rightarrow 
+              match nat_compare m n with
+                [ LT \Rightarrow (pos (pred (n-m)))
+                | EQ \Rightarrow OZ
+                | GT \Rightarrow (neg (pred (m-n)))]     
+         | (neg n) \Rightarrow (neg (pred ((S m)+(S n))))] ].
+
+(*CSC: the URI must disappear: there is a bug now *)
+interpretation "integer plus" 'plus x y = (cic:/matita/Z/plus/Zplus.con x y).
+         
+theorem Zplus_z_OZ:  \forall z:Z. z+OZ = z.
+intro.elim z.
+simplify.reflexivity.
+simplify.reflexivity.
+simplify.reflexivity.
+qed.
+
+(* theorem symmetric_Zplus: symmetric Z Zplus. *)
+
+theorem sym_Zplus : \forall x,y:Z. x+y = y+x.
+intros.elim x.rewrite > 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 (file)
index 0000000..9d5ffeb
--- /dev/null
@@ -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 (file)
index 0000000..f9ffc7a
--- /dev/null
@@ -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 (file)
index 0000000..a08fcd8
--- /dev/null
@@ -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 (file)
index 0000000..149e4b9
--- /dev/null
@@ -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 (file)
index 0000000..cdc6af0
--- /dev/null
@@ -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{%#<i>#a
+priori#</i>#%}% 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(&lang;s,H&rang;)#; 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(&lang;s,H&rang;)# 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 (file)
index 0000000..16bc9ac
--- /dev/null
@@ -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}% #&sube;# *)
+
+(* 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 (file)
index 0000000..669d5e2
--- /dev/null
@@ -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 (file)
index 0000000..4048803
--- /dev/null
@@ -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 (file)
index 0000000..7774508
--- /dev/null
@@ -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 (file)
index 0000000..582ba39
--- /dev/null
@@ -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 (file)
index 0000000..2e653ef
--- /dev/null
@@ -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 (file)
index 0000000..9b48268
--- /dev/null
@@ -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 (file)
index 0000000..a8227b3
--- /dev/null
@@ -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 (file)
index 0000000..fb384d2
--- /dev/null
@@ -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 (file)
index 0000000..61e8be4
--- /dev/null
@@ -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 (file)
index 0000000..ebe6219
--- /dev/null
@@ -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 (file)
index 0000000..80b3d72
--- /dev/null
@@ -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 (file)
index 0000000..bfef10a
--- /dev/null
@@ -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 (file)
index 0000000..2ec0a5c
--- /dev/null
@@ -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 (file)
index 0000000..9bb82f0
--- /dev/null
@@ -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 (file)
index 0000000..27037b2
--- /dev/null
@@ -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 (file)
index 0000000..98987dc
--- /dev/null
@@ -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 (file)
index 0000000..b16faa9
--- /dev/null
@@ -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 (file)
index 0000000..1f73192
--- /dev/null
@@ -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 (file)
index 0000000..ba62c67
--- /dev/null
@@ -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 (file)
index 0000000..64a9a70
--- /dev/null
@@ -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 (file)
index 0000000..ede2604
--- /dev/null
@@ -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 (file)
index 0000000..ce0f9ac
--- /dev/null
@@ -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 (file)
index 0000000..3824652
--- /dev/null
@@ -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 (file)
index 0000000..01dc078
--- /dev/null
@@ -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 (file)
index 0000000..eb32e36
--- /dev/null
@@ -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 (file)
index 0000000..b7a38ed
--- /dev/null
@@ -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 (file)
index 0000000..180daa4
--- /dev/null
@@ -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 (file)
index 0000000..5c686e6
--- /dev/null
@@ -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 (file)
index 0000000..5cc4c76
--- /dev/null
@@ -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 (file)
index 0000000..afaf275
--- /dev/null
@@ -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 (file)
index 0000000..55840cd
--- /dev/null
@@ -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 (file)
index 0000000..ec9f8cb
--- /dev/null
@@ -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 (file)
index 0000000..606d6e8
--- /dev/null
@@ -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 (file)
index 0000000..9ee9e40
--- /dev/null
@@ -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 (file)
index 0000000..40e5f57
--- /dev/null
@@ -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 (file)
index 0000000..31f2f01
--- /dev/null
@@ -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 (file)
index 0000000..d4f3897
--- /dev/null
@@ -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 (file)
index 0000000..dae9905
--- /dev/null
@@ -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<p \to n \mod p = (n \mod p) \mod p.
+intros.
+rewrite > (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<p \to O<m \to n \mod p = (n \mod (m*p)) \mod p.
+intros.
+apply (div_mod_spec_to_eq2 n p (n/p) (n \mod p) 
+(n/(m*p)*m + (n \mod (m*p)/p))).
+apply div_mod_spec_div_mod.assumption.
+constructor 1.
+apply lt_mod_m_m.assumption.
+rewrite > 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 (file)
index 0000000..be199ca
--- /dev/null
@@ -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 (file)
index 0000000..944f559
--- /dev/null
@@ -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)<q) \land S n= (div n q) * q + S (n\mod q))).
+intros.
+elim (le_to_or_lt_eq ? ? (lt_mod_m_m n q H))
+  [right.split
+    [assumption
+    |rewrite < plus_n_Sm.
+     apply eq_f.
+     apply div_mod.
+     assumption
+    ]
+  |left.split
+    [assumption
+    |simplify.
+     rewrite > 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 = <q,r> 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 (file)
index 0000000..eceb275
--- /dev/null
@@ -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 (file)
index 0000000..546e92e
--- /dev/null
@@ -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 = <q,r> 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 (file)
index 0000000..bf1aac2
--- /dev/null
@@ -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 (file)
index 0000000..6c25461
--- /dev/null
@@ -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 (file)
index 0000000..a1fbc86
--- /dev/null
@@ -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 (file)
index 0000000..b6c3076
--- /dev/null
@@ -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 (file)
index 0000000..e9193c4
--- /dev/null
@@ -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<r).
+rewrite > 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 (file)
index 0000000..e14a8e4
--- /dev/null
@@ -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 (file)
index 0000000..8e067de
--- /dev/null
@@ -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 (file)
index 0000000..88abb47
--- /dev/null
@@ -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 (file)
index 0000000..c139568
--- /dev/null
@@ -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 (file)
index 0000000..c0e0edb
--- /dev/null
@@ -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 (file)
index 0000000..7e101cc
--- /dev/null
@@ -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 (file)
index 0000000..8ae0957
--- /dev/null
@@ -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 (file)
index 0000000..514163b
--- /dev/null
@@ -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<q.
+intro.elim n.
+rewrite > 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<q.
+intros.apply (lt_plus_to_lt_l n). 
+rewrite > 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<q \to p*(S n) < q*(S n)
+\def monotonic_lt_times_l.
+
+theorem lt_times:\forall n,m,p,q:nat. n<m \to p<q \to n*p < m*q.
+intro.
+elim n.
+apply (lt_O_n_elim m H).
+intro.
+cut (lt O q).
+apply (lt_O_n_elim q Hcut).
+intro.change with (O < (S m1)*(S m2)).
+apply lt_O_times_S_S.
+apply (ltn_to_ltO p q H1).
+apply (trans_lt ? ((S n1)*q)).
+apply lt_times_r.assumption.
+cut (lt O q).
+apply (lt_O_n_elim q Hcut).
+intro.
+apply lt_times_l.
+assumption.
+apply (ltn_to_ltO p q H2).
+qed.
+
+theorem lt_times_r1: 
+\forall n,m,p. O < n \to m < p \to n*m < n*p.
+intros.
+elim H;apply lt_times_r;assumption.
+qed.
+
+theorem lt_times_l1: 
+\forall n,m,p. O < n \to m < p \to m*n < p*n.
+intros.
+elim H;apply lt_times_l;assumption.
+qed.
+
+theorem lt_to_le_to_lt_times : 
+\forall n,n1,m,m1. n < n1 \to m \le m1 \to O < m1 \to n*m < n1*m1.
+intros.
+apply (le_to_lt_to_lt ? (n*m1))
+  [apply le_times_r.assumption
+  |apply lt_times_l1
+    [assumption|assumption]
+  ]
+qed.
+
+theorem lt_times_to_lt_l: 
+\forall n,p,q:nat. p*(S n) < q*(S n) \to p < q.
+intros.
+cut (p < q \lor p \nlt q).
+elim Hcut.
+assumption.
+absurd (p * (S n) < q * (S n)).
+assumption.
+apply le_to_not_lt.
+apply le_times_l.
+apply not_lt_to_le.
+assumption.
+exact (decidable_lt p q).
+qed.
+
+theorem lt_times_n_to_lt: 
+\forall n,p,q:nat. O < n \to p*n < q*n \to p < q.
+intro.
+apply (nat_case n)
+  [intros.apply False_ind.apply (not_le_Sn_n ? H)
+  |intros 4.apply lt_times_to_lt_l
+  ]
+qed.
+
+theorem lt_times_to_lt_r: 
+\forall n,p,q:nat. (S n)*p < (S n)*q \to lt p q.
+intros.
+apply (lt_times_to_lt_l n).
+rewrite < sym_times.
+rewrite < (sym_times (S n)).
+assumption.
+qed.
+
+theorem lt_times_n_to_lt_r: 
+\forall n,p,q:nat. O < n \to n*p < n*q \to lt p q.
+intro.
+apply (nat_case n)
+  [intros.apply False_ind.apply (not_le_Sn_n ? H)
+  |intros 4.apply lt_times_to_lt_r
+  ]
+qed.
+
+
+
+theorem nat_compare_times_l : \forall n,p,q:nat. 
+nat_compare p q = nat_compare ((S n) * p) ((S n) * q).
+intros.apply nat_compare_elim.intro.
+apply nat_compare_elim.
+intro.reflexivity.
+intro.absurd (p=q).
+apply (inj_times_r n).assumption.
+apply lt_to_not_eq. assumption.
+intro.absurd (q<p).
+apply (lt_times_to_lt_r n).assumption.
+apply le_to_not_lt.apply lt_to_le.assumption.
+intro.rewrite < H.rewrite > nat_compare_n_n.reflexivity.
+intro.apply nat_compare_elim.intro.
+absurd (p<q).
+apply (lt_times_to_lt_r n).assumption.
+apply le_to_not_lt.apply lt_to_le.assumption.
+intro.absurd (q=p).
+symmetry.
+apply (inj_times_r n).assumption.
+apply lt_to_not_eq.assumption.
+intro.reflexivity.
+qed.
+
+(* times and plus *)
+theorem lt_times_plus_times: \forall a,b,n,m:nat. 
+a < n \to b < m \to a*m + b < n*m.
+intros 3.
+apply (nat_case n)
+  [intros.apply False_ind.apply (not_le_Sn_O ? H)
+  |intros.simplify.
+   rewrite < sym_plus.
+   unfold.
+   change with (S b+a*m1 \leq m1+m*m1).
+   apply le_plus
+    [assumption
+    |apply le_times
+      [apply le_S_S_to_le.assumption
+      |apply le_n
+      ]
+    ]
+  ]
+qed.
+
+(* div *) 
+
+theorem eq_mod_O_to_lt_O_div: \forall n,m:nat. O < m \to O < n\to n \mod m = O \to O < n / m. 
+intros 4.apply (lt_O_n_elim m H).intros.
+apply (lt_times_to_lt_r m1).
+rewrite < times_n_O.
+rewrite > (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 (file)
index 0000000..04eb502
--- /dev/null
@@ -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<i)[assumption|apply le_to_not_lt.assumption]
+      ]
+    |intro.left.
+     intros.apply (le_n_O_elim m H1).assumption
+    ]
+  |apply (bool_elim ? (p (S n1)))
+    [intro.right.
+     apply (ex_intro ? ? (S n1)).
+     split
+      [split[apply le_n|assumption]
+      |intros.absurd (S n1<i)[assumption|apply le_to_not_lt.assumption]
+      ]
+    |elim H
+      [left.
+       intros.
+       elim (le_to_or_lt_eq m (S n1) H3)
+        [apply H1.apply le_S_S_to_le.assumption
+        |rewrite > 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 (file)
index 0000000..3e60d46
--- /dev/null
@@ -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 (file)
index 0000000..415dcca
--- /dev/null
@@ -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 (file)
index 0000000..a15827a
--- /dev/null
@@ -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 (file)
index 0000000..6662742
--- /dev/null
@@ -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 (file)
index 0000000..bf63644
--- /dev/null
@@ -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 (file)
index 0000000..9dd28ea
--- /dev/null
@@ -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 = <q,r> 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<m \to O<n \to prime p \to
+ord (m*n) p = ord m p+ord n p.
+intros.unfold ord.
+rewrite > (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 (file)
index 0000000..6b96485
--- /dev/null
@@ -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<n.
+
+interpretation "natural 'greater than'" 'gt x y = (cic:/matita/nat/orders/gt.con x y).
+
+interpretation "natural 'not greater than'" 'ngtr x y =
+  (cic:/matita/logic/connectives/Not.con (cic:/matita/nat/orders/gt.con x y)).
+
+theorem transitive_le : transitive nat le.
+unfold transitive.intros.elim H1.
+assumption.
+apply le_S.assumption.
+qed.
+
+theorem trans_le: \forall n,m,p:nat. n \leq m \to m \leq p \to n \leq p
+\def transitive_le.
+
+theorem transitive_lt: transitive nat lt.
+unfold transitive.unfold lt.intros.elim H1.
+apply le_S. assumption.
+apply le_S.assumption.
+qed.
+
+theorem trans_lt: \forall n,m,p:nat. lt n m \to lt m p \to lt n p
+\def transitive_lt.
+
+theorem le_S_S: \forall n,m:nat. n \leq m \to S n \leq S m.
+intros.elim H.
+apply le_n.
+apply le_S.assumption.
+qed.
+
+theorem le_O_n : \forall n:nat. O \leq n.
+intros.elim n.
+apply le_n.apply 
+le_S. assumption.
+qed.
+
+theorem le_n_Sn : \forall n:nat. n \leq S n.
+intros. apply le_S.apply le_n.
+qed.
+
+theorem le_pred_n : \forall n:nat. pred n \leq n.
+intros.elim n.
+simplify.apply le_n.
+simplify.apply le_n_Sn.
+qed.
+
+theorem le_S_S_to_le : \forall n,m:nat. S n \leq S m \to n \leq m.
+intros.change with (pred (S n) \leq pred (S m)).
+elim H.apply le_n.apply (trans_le ? (pred n1)).assumption.
+apply le_pred_n.
+qed.
+
+theorem lt_S_S_to_lt: \forall n,m. 
+  S n < S m \to n < m.
+intros. apply le_S_S_to_le. assumption.
+qed.
+
+theorem lt_to_lt_S_S: ∀n,m. n < m → S n < S m.
+intros;
+unfold lt in H;
+apply (le_S_S ? ? H).
+qed.
+
+theorem leS_to_not_zero : \forall n,m:nat. S n \leq m \to not_zero m.
+intros.elim H.exact I.exact I.
+qed.
+
+(* not le *)
+theorem not_le_Sn_O: \forall n:nat. S n \nleq O.
+intros.unfold Not.simplify.intros.apply (leS_to_not_zero ? ? H).
+qed.
+
+theorem not_le_Sn_n: \forall n:nat. S n \nleq n.
+intros.elim n.apply not_le_Sn_O.unfold Not.simplify.intros.cut (S n1 \leq n1).
+apply H.assumption.
+apply le_S_S_to_le.assumption.
+qed.
+
+theorem lt_pred: \forall n,m. 
+  O < n \to n < m \to pred n < pred m. 
+apply nat_elim2
+  [intros.apply False_ind.apply (not_le_Sn_O ? H)
+  |intros.apply False_ind.apply (not_le_Sn_O ? H1)
+  |intros.simplify.unfold.apply le_S_S_to_le.assumption
+  ]
+qed.
+
+theorem S_pred: \forall n:nat.lt O n \to eq nat n (S (pred n)).
+intro.elim n.apply False_ind.exact (not_le_Sn_O O H).
+apply eq_f.apply pred_Sn.
+qed.
+
+theorem le_pred_to_le:
+ ∀n,m. O < m → pred n ≤ pred m → n ≤ m.
+intros 2;
+elim n;
+[ apply le_O_n
+| simplify in H2;
+  rewrite > (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<m \to n \neq m.
+unfold Not.intros.cut ((le (S n) m) \to False).
+apply Hcut.assumption.rewrite < H1.
+apply not_le_Sn_n.
+qed.
+
+(*not lt*)
+theorem eq_to_not_lt: \forall a,b:nat.
+a = b \to a \nlt b.
+intros.
+unfold Not.
+intros.
+rewrite > 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<m \to n \leq m.
+simplify.intros.unfold lt in H.elim H.
+apply le_S. apply le_n.
+apply le_S. assumption.
+qed.
+
+theorem lt_S_to_le : \forall n,m:nat. n < S m \to n \leq m.
+simplify.intros.
+apply le_S_S_to_le.assumption.
+qed.
+
+theorem not_le_to_lt: \forall n,m:nat. n \nleq m \to m<n.
+intros 2.
+apply (nat_elim2 (\lambda n,m.n \nleq m \to m<n)).
+intros.apply (absurd (O \leq n1)).apply le_O_n.assumption.
+unfold Not.unfold lt.intros.apply le_S_S.apply le_O_n.
+unfold Not.unfold lt.intros.apply le_S_S.apply H.intros.apply H1.apply le_S_S.
+assumption.
+qed.
+
+theorem lt_to_not_le: \forall n,m:nat. n<m \to m \nleq n.
+unfold Not.unfold lt.intros 3.elim H.
+apply (not_le_Sn_n n H1).
+apply H2.apply lt_to_le. apply H3.
+qed.
+
+theorem not_lt_to_le: \forall n,m:nat. Not (lt n m) \to le m n.
+simplify.intros.
+apply lt_S_to_le.
+apply not_le_to_lt.exact H.
+qed.
+
+theorem le_to_not_lt: \forall n,m:nat. le n m \to Not (lt m n).
+intros.unfold Not.unfold lt.
+apply lt_to_not_le.unfold lt.
+apply le_S_S.assumption.
+qed.
+
+theorem not_eq_to_le_to_lt: ∀n,m. n≠m → n≤m → n<m.
+intros;
+elim (le_to_or_lt_eq ? ? H1);
+[ assumption
+| elim (H H2)
+].
+qed.
+
+(* le elimination *)
+theorem le_n_O_to_eq : \forall n:nat. n \leq O \to O=n.
+intro.elim n.reflexivity.
+apply False_ind.
+apply not_le_Sn_O;
+[2: apply H1 | skip].
+qed.
+
+theorem le_n_O_elim: \forall n:nat.n \leq O \to \forall P: nat \to Prop.
+P O \to P n.
+intro.elim n.
+assumption.
+apply False_ind.
+apply  (not_le_Sn_O ? H1).
+qed.
+
+theorem le_n_Sm_elim : \forall n,m:nat.n \leq S m \to 
+\forall P:Prop. (S n \leq S m \to P) \to (n=S m \to P) \to P.
+intros 4.elim H.
+apply H2.reflexivity.
+apply H3. apply le_S_S. assumption.
+qed.
+
+(* le and eq *)
+lemma le_to_le_to_eq: \forall n,m. n \le m \to m \le n \to n = m.
+apply nat_elim2
+  [intros.apply le_n_O_to_eq.assumption
+  |intros.apply sym_eq.apply le_n_O_to_eq.assumption
+  |intros.apply eq_f.apply H
+    [apply le_S_S_to_le.assumption
+    |apply le_S_S_to_le.assumption
+    ]
+  ]
+qed.
+
+(* lt and le trans *)
+theorem lt_O_S : \forall n:nat. O < S n.
+intro. unfold. apply le_S_S. apply le_O_n.
+qed.
+
+theorem lt_to_le_to_lt: \forall n,m,p:nat. lt n m \to le m p \to lt n p.
+intros.elim H1.
+assumption.unfold lt.apply le_S.assumption.
+qed.
+
+theorem le_to_lt_to_lt: \forall n,m,p:nat. le n m \to lt m p \to lt n p.
+intros 4.elim H.
+assumption.apply H2.unfold lt.
+apply lt_to_le.assumption.
+qed.
+
+theorem lt_S_to_lt: \forall n,m. S n < m \to n < m.
+intros.
+apply (trans_lt ? (S n))
+  [apply le_n|assumption]
+qed.
+
+theorem ltn_to_ltO: \forall n,m:nat. lt n m \to lt O m.
+intros.apply (le_to_lt_to_lt O n).
+apply le_O_n.assumption.
+qed.
+
+theorem lt_SO_n_to_lt_O_pred_n: \forall n:nat.
+(S O) \lt n \to O \lt (pred n).
+intros.
+apply (ltn_to_ltO (pred (S O)) (pred n) ?).
+ apply (lt_pred (S O) n);
+ [ apply (lt_O_S O) 
+ | assumption
+ ]
+qed.
+
+theorem lt_O_n_elim: \forall n:nat. lt O n \to 
+\forall P:nat\to Prop. (\forall m:nat.P (S m)) \to P n.
+intro.elim n.apply False_ind.exact (not_le_Sn_O O H).
+apply H2.
+qed.
+
+(* other abstract properties *)
+theorem antisymmetric_le : antisymmetric nat le.
+unfold antisymmetric.intros 2.
+apply (nat_elim2 (\lambda n,m.(n \leq m \to m \leq n \to n=m))).
+intros.apply le_n_O_to_eq.assumption.
+intros.apply False_ind.apply (not_le_Sn_O ? H).
+intros.apply eq_f.apply H.
+apply le_S_S_to_le.assumption.
+apply le_S_S_to_le.assumption.
+qed.
+
+theorem antisym_le: \forall n,m:nat. n \leq m \to m \leq n \to n=m
+\def antisymmetric_le.
+
+theorem le_n_m_to_lt_m_Sn_to_eq_n_m: ∀n,m. n ≤ m → m < S n → n=m.
+intros;
+unfold lt in H1;
+generalize in match (le_S_S_to_le ? ? H1);
+intro;
+apply antisym_le;
+assumption.
+qed.
+
+theorem decidable_le: \forall n,m:nat. decidable (n \leq m).
+intros.
+apply (nat_elim2 (\lambda n,m.decidable (n \leq m))).
+intros.unfold decidable.left.apply le_O_n.
+intros.unfold decidable.right.exact (not_le_Sn_O n1).
+intros 2.unfold decidable.intro.elim H.
+left.apply le_S_S.assumption.
+right.unfold Not.intro.apply H1.apply le_S_S_to_le.assumption.
+qed.
+
+theorem decidable_lt: \forall n,m:nat. decidable (n < m).
+intros.exact (decidable_le (S n) m).
+qed.
+
+(* well founded induction principles *)
+
+theorem nat_elim1 : \forall n:nat.\forall P:nat \to Prop. 
+(\forall m.(\forall p. (p \lt m) \to P p) \to P m) \to P n.
+intros.cut (\forall q:nat. q \le n \to P q).
+apply (Hcut n).apply le_n.
+elim n.apply (le_n_O_elim q H1).
+apply H.
+intros.apply False_ind.apply (not_le_Sn_O p H2).
+apply H.intros.apply H1.
+cut (p < S n1).
+apply lt_S_to_le.assumption.
+apply (lt_to_le_to_lt p q (S n1) H3 H2).
+qed.
+
+(* some properties of functions *)
+
+definition increasing \def \lambda f:nat \to nat. 
+\forall n:nat. f n < f (S n).
+
+theorem increasing_to_monotonic: \forall f:nat \to nat.
+increasing f \to monotonic nat lt f.
+unfold monotonic.unfold lt.unfold increasing.unfold lt.intros.elim H1.apply H.
+apply (trans_le ? (f n1)).
+assumption.apply (trans_le ? (S (f n1))).
+apply le_n_Sn.
+apply H.
+qed.
+
+theorem le_n_fn: \forall f:nat \to nat. (increasing f) 
+\to \forall n:nat. n \le (f n).
+intros.elim n.
+apply le_O_n.
+apply (trans_le ? (S (f n1))).
+apply le_S_S.apply H1.
+simplify in H. unfold increasing in H.unfold lt in H.apply H.
+qed.
+
+theorem increasing_to_le: \forall f:nat \to nat. (increasing f) 
+\to \forall m:nat. \exists i. m \le (f i).
+intros.elim m.
+apply (ex_intro ? ? O).apply le_O_n.
+elim H1.
+apply (ex_intro ? ? (S a)).
+apply (trans_le ? (S (f a))).
+apply le_S_S.assumption.
+simplify in H.unfold increasing in H.unfold lt in H.
+apply H.
+qed.
+
+theorem increasing_to_le2: \forall f:nat \to nat. (increasing f) 
+\to \forall m:nat. (f O) \le m \to 
+\exists i. (f i) \le m \land m <(f (S i)).
+intros.elim H1.
+apply (ex_intro ? ? O).
+split.apply le_n.apply H.
+elim H3.elim H4.
+cut ((S n1) < (f (S a)) \lor (S n1) = (f (S a))).
+elim Hcut.
+apply (ex_intro ? ? a).
+split.apply le_S. assumption.assumption.
+apply (ex_intro ? ? (S a)).
+split.rewrite < H7.apply le_n.
+rewrite > 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 (file)
index 0000000..bd447ca
--- /dev/null
@@ -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 (file)
index 0000000..882b671
--- /dev/null
@@ -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 (file)
index 0000000..265d207
--- /dev/null
@@ -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 (file)
index 0000000..540654c
--- /dev/null
@@ -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<m).assumption.
+rewrite > 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<i).assumption.apply (le_n_O_elim i H1).
+apply (not_le_Sn_O O).
+change with (i \divides (S n1)*n1!).
+apply (le_n_Sm_elim i n1 H2).
+intro.
+apply (transitive_divides ? n1!).
+apply H1.apply le_S_S_to_le. assumption.
+apply (witness ? ? (S n1)).apply sym_times.
+intro.
+rewrite > 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 (file)
index 0000000..5a64fba
--- /dev/null
@@ -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 (file)
index 0000000..dc4cfed
--- /dev/null
@@ -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 (file)
index 0000000..df5c088
--- /dev/null
@@ -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 (file)
index 0000000..88b0517
--- /dev/null
@@ -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 (file)
index 0000000..2883af0
--- /dev/null
@@ -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 (file)
index 0000000..db2502c
--- /dev/null
@@ -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 (file)
index 0000000..eee29ac
--- /dev/null
@@ -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 (file)
index 0000000..4096af1
--- /dev/null
@@ -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<n1
+    | EQ \Rightarrow n=n1
+    | GT \Rightarrow n1<n] \to 
+    match (nat_compare n n1) with
+    [ LT \Rightarrow (S n) \leq n1
+    | EQ \Rightarrow pos n = pos n1
+    | GT \Rightarrow (S n1) \leq n]) 
+    [ apply Hcut.
+      (*NB qui autobatch non chiude il goal*)
+      apply nat_compare_to_Prop 
+    | elim (nat_compare n n1)
+      [ simplify.
+        (*NB qui autobatch non chiude il goal*)
+        exact H
+      | simplify.
+        apply eq_f.
+        (*NB qui autobatch non chiude il goal*)
+        exact H
+      | simplify.
+        (*NB qui autobatch non chiude il goal*)
+        exact H
+      ]
+    ]
+  | simplify.
+    exact I    
+  ]
+| elim y
+  [ simplify.
+    exact I
+  | simplify.
+    exact I
+  | simplify.
+    cut (match (nat_compare n1 n) with
+    [ LT \Rightarrow n1<n
+    | EQ \Rightarrow n1=n
+    | GT \Rightarrow n<n1] \to 
+    match (nat_compare n1 n) with
+    [ LT \Rightarrow (S n1) \leq n
+    | EQ \Rightarrow neg n = neg n1
+    | GT \Rightarrow (S n) \leq n1])
+    [ apply Hcut.
+      (*NB qui autobatch non chiude il goal*) 
+      apply nat_compare_to_Prop
+    | elim (nat_compare n1 n)
+      [ simplify.
+        (*NB qui autobatch non chiude il goal*)
+        exact H
+      | simplify.
+        apply eq_f.
+        apply sym_eq.
+        (*NB qui autobatch non chiude il goal*)
+        exact H
+      | simplify.
+        (*NB qui autobatch non chiude il goal*)
+        exact H
+      ]
+    ]
+  ]
+]
+qed.
diff --git a/matita/library_auto/auto/Z/orders.ma b/matita/library_auto/auto/Z/orders.ma
new file mode 100644 (file)
index 0000000..a90cead
--- /dev/null
@@ -0,0 +1,188 @@
+(**************************************************************************)
+(*       ___                                                               *)
+(*      ||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/orders".
+
+include "auto/Z/z.ma".
+include "auto/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/library_autobatch/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/library_autobatch/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<m
+    | (neg m) \Rightarrow False ]
+  | (neg n) \Rightarrow 
+    match y with 
+    [ OZ \Rightarrow True
+    | (pos m) \Rightarrow True
+    | (neg m) \Rightarrow m<n ]].
+    
+(*CSC: the URI must disappear: there is a bug now *)
+interpretation "integer 'less than'" 'lt x y = (cic:/matita/library_autobatch/Z/orders/Zlt.con x y).
+(*CSC: the URI must disappear: there is a bug now *)
+interpretation "integer 'not less than'" 'nless x y =
+  (cic:/matita/logic/connectives/Not.con (cic:/matita/library_autobatch/Z/orders/Zlt.con x y)).
+
+theorem irreflexive_Zlt: irreflexive Z Zlt.
+unfold irreflexive.
+unfold Not.
+intro.
+elim x
+[ (*qui autobatch non chiude il goal*)
+  exact H
+| cut (neg n < neg n \to False)
+  [ apply Hcut.
+    (*qui autobatch non chiude il goal*)
+    apply H
+  | autobatch
+    (*simplify.
+    unfold lt.
+    apply not_le_Sn_n*)
+  ]
+| cut (pos n < pos n \to False)
+  [ apply Hcut.
+    (*qui autobatch non chiude il goal*)
+    apply H
+  | autobatch
+    (*simplify.
+    unfold lt.
+    apply not_le_Sn_n*)
+  ]
+]
+qed.
+
+theorem irrefl_Zlt: irreflexive Z Zlt
+\def irreflexive_Zlt.
+
+theorem Zlt_neg_neg_to_lt: 
+\forall n,m:nat. neg n < neg m \to m < n.
+intros.
+(*qui autobatch non chiude il goal*)
+apply H.
+qed.
+
+theorem lt_to_Zlt_neg_neg: \forall n,m:nat.m < n \to neg n < neg m. 
+intros.
+simplify.
+apply H.
+qed.
+
+theorem Zlt_pos_pos_to_lt: 
+\forall n,m:nat. pos n < pos m \to n < m.
+intros.
+(*qui autobatch non chiude il goal*)
+apply H.
+qed.
+
+theorem lt_to_Zlt_pos_pos: \forall n,m:nat.n < m \to pos n < pos m. 
+intros.
+simplify.
+apply H.
+qed.
+
+theorem Zlt_to_Zle: \forall x,y:Z. x < y \to Zsucc x \leq y.
+intros 2.
+elim x
+[ (* goal: x=OZ *)
+  cut (OZ < y \to Zsucc OZ \leq y)
+  [ autobatch
+    (*apply Hcut. 
+    assumption*)
+  | simplify.
+    elim y 
+    [ simplify.
+      (*qui autobatch non chiude il goal*)
+      exact H1
+    | simplify.
+      apply le_O_n
+    | simplify.
+      (*qui autobatch non chiude il goal*)    
+      exact H1
+    ]
+  ]
+| (* goal: x=pos *)      
+  exact H
+| (* goal: x=neg *)      
+  cut (neg n < y \to Zsucc (neg n) \leq y)
+  [ autobatch
+    (*apply Hcut. 
+    assumption*)
+  | elim n
+    [ cut (neg O < y \to Zsucc (neg O) \leq y)
+      [ autobatch
+        (*apply Hcut. 
+        assumption*)
+      | simplify.
+        elim y
+        [ simplify.
+          exact I
+        | simplify.
+          exact I
+        | simplify.
+          (*qui autobatch non chiude il goal*)
+          apply (not_le_Sn_O n1 H2)
+        ]
+      ]
+    | cut (neg (S n1) < y \to (Zsucc (neg (S n1))) \leq y)
+      [ autobatch
+        (*apply Hcut. 
+        assumption*)
+      | simplify.
+        elim y
+        [ simplify.
+          exact I
+        | simplify.
+          exact I
+        | simplify.
+          (*qui autobatch non chiude il goal*)
+          apply (le_S_S_to_le n2 n1 H3)
+        ]
+      ] 
+    ]
+  ]
+]
+qed.
diff --git a/matita/library_auto/auto/Z/plus.ma b/matita/library_auto/auto/Z/plus.ma
new file mode 100644 (file)
index 0000000..2b60912
--- /dev/null
@@ -0,0 +1,470 @@
+(**************************************************************************)
+(*       ___                                                               *)
+(*      ||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/plus".
+
+include "auto/Z/z.ma".
+include "auto/nat/minus.ma".
+
+definition Zplus :Z \to Z \to Z \def
+\lambda x,y.
+  match x with
+    [ OZ \Rightarrow y
+    | (pos m) \Rightarrow
+        match y with
+         [ OZ \Rightarrow x
+         | (pos n) \Rightarrow (pos (pred ((S m)+(S n))))
+         | (neg n) \Rightarrow 
+              match nat_compare m n with
+                [ LT \Rightarrow (neg (pred (n-m)))
+                | EQ \Rightarrow OZ
+                | GT \Rightarrow (pos (pred (m-n)))] ]
+    | (neg m) \Rightarrow
+        match y with
+         [ OZ \Rightarrow x
+         | (pos n) \Rightarrow 
+              match nat_compare m n with
+                [ LT \Rightarrow (pos (pred (n-m)))
+                | EQ \Rightarrow OZ
+                | GT \Rightarrow (neg (pred (m-n)))]     
+         | (neg n) \Rightarrow (neg (pred ((S m)+(S n))))] ].
+
+(*CSC: the URI must disappear: there is a bug now *)
+interpretation "integer plus" 'plus x y = (cic:/matita/library_autobatch/Z/plus/Zplus.con x y).
+         
+theorem Zplus_z_OZ:  \forall z:Z. z+OZ = z.
+intro.
+elim z;autobatch.
+  (*simplify;reflexivity.*)
+qed.
+
+(* theorem symmetric_Zplus: symmetric Z Zplus. *)
+
+theorem sym_Zplus : \forall x,y:Z. x+y = y+x.
+intros.
+elim x
+[ autobatch
+  (*rewrite > 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 (file)
index 0000000..1fa633d
--- /dev/null
@@ -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 (file)
index 0000000..079d570
--- /dev/null
@@ -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 (file)
index 0000000..8098810
--- /dev/null
@@ -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 (file)
index 0000000..dca43d1
--- /dev/null
@@ -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 (file)
index 0000000..305778b
--- /dev/null
@@ -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<p \to n \mod p = (n \mod p) \mod p.
+intros.
+autobatch.
+(*rewrite > (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<p \to O<m \to n \mod p = (n \mod (m*p)) \mod p.
+intros.
+apply (div_mod_spec_to_eq2 n p (n/p) (n \mod p) 
+(n/(m*p)*m + (n \mod (m*p)/p)))
+[ autobatch. 
+  (*apply div_mod_spec_div_mod.
+  assumption*)
+| constructor 1
+  [ autobatch
+    (*apply lt_mod_m_m.
+    assumption*)
+  | rewrite > 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 (file)
index 0000000..de2e528
--- /dev/null
@@ -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 (file)
index 0000000..bbb3d49
--- /dev/null
@@ -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 = <q,r> 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 (file)
index 0000000..71c1481
--- /dev/null
@@ -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 (file)
index 0000000..69667b7
--- /dev/null
@@ -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 (file)
index 0000000..a5610ae
--- /dev/null
@@ -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 (file)
index 0000000..e09a30e
--- /dev/null
@@ -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<r)
+        [ rewrite > 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 (file)
index 0000000..a04adaa
--- /dev/null
@@ -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 (file)
index 0000000..e9c4752
--- /dev/null
@@ -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 (file)
index 0000000..13b4f3a
--- /dev/null
@@ -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 (file)
index 0000000..4c24196
--- /dev/null
@@ -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<q.
+intro.elim n
+[ rewrite > 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<q.
+intros.
+apply (lt_plus_to_lt_l n). 
+rewrite > 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<q \to p*(S n) < q*(S n)
+\def monotonic_lt_times_l.
+
+theorem lt_times:\forall n,m,p,q:nat. n<m \to p<q \to n*p < m*q.
+intro.
+elim n
+[ apply (lt_O_n_elim m H).
+  intro.
+  cut (lt O q)
+  [ apply (lt_O_n_elim q Hcut).
+    intro.
+    autobatch
+    (*change with (O < (S m1)*(S m2)).
+    apply lt_O_times_S_S.*)
+  | apply (ltn_to_ltO p q H1). (*funziona anche autobatch*)
+  ]
+| apply (trans_lt ? ((S n1)*q))
+  [ autobatch
+    (*apply lt_times_r.
+    assumption.*)
+  | cut (lt O q)
+    [ apply (lt_O_n_elim q Hcut).
+      intro.
+      autobatch
+      (*apply lt_times_l.
+      assumption.*)
+    |apply (ltn_to_ltO p q H2). (*funziona anche autobatch*)
+    ]
+  ]
+]
+qed.
+
+theorem lt_times_to_lt_l: 
+\forall n,p,q:nat. p*(S n) < q*(S n) \to p < q.
+intros.
+cut (p < q \lor p \nlt q)
+[ elim Hcut
+  [ assumption
+  | absurd (p * (S n) < q * (S n))
+    [ assumption
+    | apply le_to_not_lt.
+      autobatch
+      (*apply le_times_l.
+      apply not_lt_to_le.
+      assumption.*)
+    ]
+  ]
+|exact (decidable_lt p q).
+]
+qed.
+
+theorem lt_times_to_lt_r: 
+\forall n,p,q:nat. (S n)*p < (S n)*q \to lt p q.
+intros.
+apply (lt_times_to_lt_l n).
+rewrite < sym_times.
+rewrite < (sym_times (S n)).
+assumption.
+qed.
+
+theorem nat_compare_times_l : \forall n,p,q:nat. 
+nat_compare p q = nat_compare ((S n) * p) ((S n) * q).
+intros.
+apply nat_compare_elim
+[ intro.
+  apply nat_compare_elim
+  [ intro.
+    reflexivity
+  | intro.
+    absurd (p=q)
+    [ autobatch.
+      (*apply (inj_times_r n).
+      assumption*)
+    | autobatch
+      (*apply lt_to_not_eq. 
+      assumption*)
+    ]
+  | intro.
+    absurd (q<p)
+    [ autobatch.
+      (*apply (lt_times_to_lt_r n).
+      assumption.*)
+    | autobatch
+      (*apply le_to_not_lt.
+      apply lt_to_le.
+      assumption*)
+    ]
+  ]. 
+| intro.
+  autobatch
+  (*rewrite < H.
+  rewrite > nat_compare_n_n.
+  reflexivity*)
+| intro.
+  apply nat_compare_elim
+  [ intro.
+    absurd (p<q)
+    [ autobatch
+      (*apply (lt_times_to_lt_r n).
+      assumption.*)
+    | autobatch 
+      (*apply le_to_not_lt.
+      apply lt_to_le. 
+      assumption.*)
+    ]
+  | intro.
+    absurd (q=p)
+    [ autobatch. 
+      (*symmetry.
+      apply (inj_times_r n).
+      assumption*)
+    | autobatch
+      (*apply lt_to_not_eq.
+      assumption*)
+    ]
+  | intro.
+    reflexivity
+  ]
+].
+qed.
+
+(* div *) 
+
+theorem eq_mod_O_to_lt_O_div: \forall n,m:nat. O < m \to O < n\to n \mod m = O \to O < n / m. 
+intros 4.
+apply (lt_O_n_elim m H).
+intros.
+apply (lt_times_to_lt_r m1).
+rewrite < times_n_O.
+rewrite > (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 (file)
index 0000000..d5ab380
--- /dev/null
@@ -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<i)
+      [ assumption
+      | autobatch
+        (*apply le_to_not_lt.
+        assumption*)
+      ]
+    ]
+  | intro.
+    left.
+    intros.
+    apply (le_n_O_elim m H1).
+    assumption
+  ]
+| apply (bool_elim ? (p (S n1)))
+  [ intro.
+    right.
+    apply (ex_intro ? ? (S n1)).
+    split
+    [ split
+      [ apply le_n
+      | assumption
+      ]
+    | intros.
+      absurd (S n1<i)
+      [ assumption
+      | autobatch
+        (*apply le_to_not_lt.
+        assumption*)
+      ]
+    ]
+  | elim H
+    [ left.
+      intros.
+      elim (le_to_or_lt_eq m (S n1) H3)
+      [ autobatch
+        (*apply H1.
+        apply le_S_S_to_le.
+        assumption*)
+      | autobatch
+        (*rewrite > 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 (file)
index 0000000..61cbaf4
--- /dev/null
@@ -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 (file)
index 0000000..8a3d893
--- /dev/null
@@ -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 (file)
index 0000000..f915759
--- /dev/null
@@ -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 (file)
index 0000000..8823415
--- /dev/null
@@ -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 (file)
index 0000000..8a4de9f
--- /dev/null
@@ -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 = <q,r> 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<m.
+
+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.
+  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 (file)
index 0000000..0f99c1a
--- /dev/null
@@ -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<n.
+
+(*CSC: the URI must disappear: there is a bug now *)
+interpretation "natural 'greater than'" 'gt x y = (cic:/matita/library_autobatch/nat/orders/gt.con x y).
+(*CSC: the URI must disappear: there is a bug now *)
+interpretation "natural 'not greater than'" 'ngtr x y =
+  (cic:/matita/logic/connectives/Not.con (cic:/matita/library_autobatch/nat/orders/gt.con x y)).
+
+theorem transitive_le : transitive nat le.
+unfold transitive.
+intros.
+elim H1;autobatch.
+(*[ assumption
+| apply le_S.
+  assumption
+]*)
+qed.
+
+theorem trans_le: \forall n,m,p:nat. n \leq m \to m \leq p \to n \leq p
+\def transitive_le.
+
+theorem transitive_lt: transitive nat lt.
+unfold transitive.
+unfold lt.
+intros.
+elim H1;autobatch.
+  (*apply le_S;assumption.*)
+  
+qed.
+
+theorem trans_lt: \forall n,m,p:nat. lt n m \to lt m p \to lt n p
+\def transitive_lt.
+
+theorem le_S_S: \forall n,m:nat. n \leq m \to S n \leq S m.
+intros.
+elim H;autobatch.
+(*[ apply le_n.
+| apply le_S.
+  assumption
+]*)
+qed.
+
+theorem le_O_n : \forall n:nat. O \leq n.
+intros.
+elim n;autobatch.
+(*[ apply le_n
+| apply le_S. 
+  assumption
+]*)
+qed.
+
+theorem le_n_Sn : \forall n:nat. n \leq S n.
+intros.autobatch.
+(*apply le_S.
+apply le_n.*)
+qed.
+
+theorem le_pred_n : \forall n:nat. pred n \leq n.
+intros.
+elim n;autobatch.
+(*[ simplify.
+  apply le_n
+| simplify.
+  apply le_n_Sn
+]*)
+qed.
+
+theorem le_S_S_to_le : \forall n,m:nat. S n \leq S m \to n \leq m.
+intros.
+change with (pred (S n) \leq pred (S m)).
+elim H;autobatch.
+(*[ apply le_n
+| apply (trans_le ? (pred n1))
+  [ assumption
+  | apply le_pred_n
+  ]
+]*)
+qed.
+
+theorem leS_to_not_zero : \forall n,m:nat. S n \leq m \to not_zero m.
+intros.
+elim H
+[ (*qui autobatch non chiude il goal*)
+  exact I
+| (*qui autobatch non chiude il goal*)
+  exact I
+]
+qed.
+
+(* not le *)
+theorem not_le_Sn_O: \forall n:nat. S n \nleq O.
+intros.
+unfold Not.
+simplify.
+intros.
+(*qui autobatch NON chiude il goal*)
+apply (leS_to_not_zero ? ? H).
+qed.
+
+theorem not_le_Sn_n: \forall n:nat. S n \nleq n.
+intros.
+elim n
+[ apply not_le_Sn_O
+| unfold Not.
+  simplify.
+  intros.autobatch
+  (*cut (S n1 \leq n1).
+  [ apply H.
+    assumption
+  | 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
+[ autobatch
+  (*right.
+  reflexivity*)
+| left.
+  unfold lt.
+  autobatch
+  (*apply le_S_S.
+  assumption*)
+]
+qed.
+
+(* not eq *)
+theorem lt_to_not_eq : \forall n,m:nat. n<m \to n \neq m.
+unfold Not.
+intros.
+cut ((le (S n) m) \to False)
+[ autobatch
+  (*apply Hcut.
+  assumption*)
+| rewrite < H1.
+  apply not_le_Sn_n
+]
+qed.
+
+(* le vs. lt *)
+theorem lt_to_le : \forall n,m:nat. n<m \to n \leq m.
+simplify.
+intros.
+autobatch.
+(*unfold lt in H.
+elim H
+[ apply le_S. 
+  apply le_n
+| apply le_S. 
+  assumption
+]*)
+qed.
+
+theorem lt_S_to_le : \forall n,m:nat. n < S m \to n \leq m.
+autobatch.
+(*simplify.
+intros.
+apply le_S_S_to_le.
+assumption.*)
+qed.
+
+theorem not_le_to_lt: \forall n,m:nat. n \nleq m \to m<n.
+intros 2.
+apply (nat_elim2 (\lambda n,m.n \nleq m \to m<n))
+[ intros.
+  apply (absurd (O \leq n1));autobatch
+  (*[ apply le_O_n
+  | assumption
+  ]*)
+| unfold Not.
+  unfold lt.
+  intros.autobatch
+  (*apply le_S_S.
+  apply le_O_n*)
+| unfold Not.
+  unfold lt.
+  intros.
+  apply le_S_S.
+  apply H.
+  intros.
+  autobatch
+  (*apply H1.
+  apply le_S_S.
+  assumption*)
+]
+qed.
+
+theorem lt_to_not_le: \forall n,m:nat. n<m \to m \nleq n.
+unfold Not.
+unfold lt.
+intros 3.
+elim H;autobatch.
+(*[ apply (not_le_Sn_n n H1)
+| apply H2.
+  apply lt_to_le. 
+  apply H3
+]*)
+qed.
+
+theorem not_lt_to_le: \forall n,m:nat. Not (lt n m) \to le m n.
+simplify.
+intros.
+apply lt_S_to_le.
+apply not_le_to_lt.
+(*qui autobatch non chiude il goal*)
+exact H.
+qed.
+
+theorem le_to_not_lt: \forall n,m:nat. le n m \to Not (lt m n).
+intros.
+unfold Not.
+unfold lt.
+apply lt_to_not_le.
+unfold lt.autobatch.
+(*apply le_S_S.
+assumption.*)
+qed.
+
+(* le elimination *)
+theorem le_n_O_to_eq : \forall n:nat. n \leq O \to O=n.
+intro.
+elim n
+[ reflexivity
+| apply False_ind.autobatch
+  (*apply not_le_Sn_O.
+  goal 17. apply H1.*)
+]
+qed.
+
+theorem le_n_O_elim: \forall n:nat.n \leq O \to \forall P: nat \to Prop.
+P O \to P n.
+intro.
+elim n
+[ assumption
+| apply False_ind.
+  apply  (not_le_Sn_O ? H1)
+]
+qed.
+
+theorem le_n_Sm_elim : \forall n,m:nat.n \leq S m \to 
+\forall P:Prop. (S n \leq S m \to P) \to (n=S m \to P) \to P.
+intros 4.
+elim H;autobatch.
+(*[ apply H2.
+  reflexivity
+| apply H3. 
+  apply le_S_S. 
+  assumption
+]*)
+qed.
+
+(* le to eq *)
+lemma le_to_le_to_eq: \forall n,m. n \le m \to m \le n \to n = m.
+apply nat_elim2
+[ intros.
+  autobatch
+  (*apply le_n_O_to_eq.
+  assumption*)
+| intros.autobatch
+  (*apply sym_eq.
+  apply le_n_O_to_eq.
+  assumption*)
+| intros.
+  apply eq_f.autobatch
+  (*apply H
+  [ apply le_S_S_to_le.assumption
+  | apply le_S_S_to_le.assumption
+  ]*)
+]
+qed.
+
+(* lt and le trans *)
+theorem lt_O_S : \forall n:nat. O < S n.
+intro.autobatch.
+(*unfold.
+apply le_S_S.
+apply le_O_n.*)
+qed.
+
+theorem lt_to_le_to_lt: \forall n,m,p:nat. lt n m \to le m p \to lt n p.
+intros.
+elim H1;autobatch.
+(*[ assumption
+| unfold lt.
+  apply le_S.
+  assumption
+]*)
+qed.
+
+theorem le_to_lt_to_lt: \forall n,m,p:nat. le n m \to lt m p \to lt n p.
+intros 4.
+elim H
+[ assumption
+| apply H2.autobatch
+  (*unfold lt.
+  apply lt_to_le.
+  assumption*)
+]
+qed.
+
+theorem lt_S_to_lt: \forall n,m. S n < m \to n < m.
+intros.autobatch.
+(*apply (trans_lt ? (S n))
+[ apply le_n
+| assumption
+]*)
+qed.
+
+theorem ltn_to_ltO: \forall n,m:nat. lt n m \to lt O m.
+intros.
+apply (le_to_lt_to_lt O n)
+[ apply le_O_n
+| assumption
+]
+qed.
+
+theorem lt_O_n_elim: \forall n:nat. lt O n \to 
+\forall P:nat\to Prop. (\forall m:nat.P (S m)) \to P n.
+intro.
+elim n
+[ apply False_ind.
+  exact (not_le_Sn_O O H)
+| apply H2
+]
+qed.
+
+(* other abstract properties *)
+theorem antisymmetric_le : antisymmetric nat le.
+unfold antisymmetric.
+autobatch.
+(*intros 2.
+apply (nat_elim2 (\lambda n,m.(n \leq m \to m \leq n \to n=m)))
+[ intros.
+  apply le_n_O_to_eq.
+  assumption
+| intros.
+  apply False_ind.
+  apply (not_le_Sn_O ? H)
+| intros.
+  apply eq_f.
+  apply H;
+    apply le_S_S_to_le;assumption
+]*)
+qed.
+
+(*NOTA:
+ * autobatch chiude il goal prima della tattica intros 2, tuttavia non chiude gli ultimi
+ * 2 rami aperti dalla tattica apply (nat_elim2 (\lambda n,m.(n \leq m \to m \leq n \to n=m))).
+ * evidentemente autobatch sfrutta una dimostrazione diversa rispetto a quella proposta
+ * nella libreria
+ *)
+
+theorem antisym_le: \forall n,m:nat. n \leq m \to m \leq n \to n=m
+\def antisymmetric_le.
+
+theorem decidable_le: \forall n,m:nat. decidable (n \leq m).
+intros.
+apply (nat_elim2 (\lambda n,m.decidable (n \leq m)))
+[ intros.
+  unfold decidable.autobatch
+  (*left.
+  apply le_O_n*)
+| intros.
+  unfold decidable.
+  autobatch
+  (*right.
+  exact (not_le_Sn_O n1)*)
+| intros 2.
+  unfold decidable.
+  intro.
+  elim H
+  [ autobatch
+    (*left.
+    apply le_S_S.
+    assumption*)
+  | right.
+    unfold Not.
+    autobatch
+    (*intro.
+    apply H1.
+    apply le_S_S_to_le.
+    assumption*)
+  ]
+]
+qed.
+
+theorem decidable_lt: \forall n,m:nat. decidable (n < m).
+intros.
+(*qui autobatch non chiude il goal*)
+exact (decidable_le (S n) m).
+qed.
+
+(* well founded induction principles *)
+
+theorem nat_elim1 : \forall n:nat.\forall P:nat \to Prop. 
+(\forall m.(\forall p. (p \lt m) \to P p) \to P m) \to P n.
+intros.
+cut (\forall q:nat. q \le n \to P q)
+[ autobatch
+  (*apply (Hcut n).
+  apply le_n*)
+| elim n
+  [ apply (le_n_O_elim q H1).
+    apply H.
+    intros.
+    apply False_ind.
+    apply (not_le_Sn_O p H2)
+  | apply H.
+    intros.
+    apply H1.
+    autobatch
+    (*cut (p < S n1)
+    [ apply lt_S_to_le.
+      assumption
+    | apply (lt_to_le_to_lt p q (S n1) H3 H2).
+    ]*)
+  ]
+]
+qed.
+
+(* some properties of functions *)
+
+definition increasing \def \lambda f:nat \to nat. 
+\forall n:nat. f n < f (S n).
+
+theorem increasing_to_monotonic: \forall f:nat \to nat.
+increasing f \to monotonic nat lt f.
+unfold monotonic.
+unfold lt.
+unfold increasing.
+unfold lt.
+intros.
+elim H1;autobatch.
+(*[ apply H
+| apply (trans_le ? (f n1))
+  [ assumption
+  | apply (trans_le ? (S (f n1)))
+    [ apply le_n_Sn
+    | apply H
+    ]
+  ]
+]*)
+qed.
+
+theorem le_n_fn: \forall f:nat \to nat. (increasing f) 
+\to \forall n:nat. n \le (f n).
+intros.
+elim n;autobatch.
+(*[ apply le_O_n
+| apply (trans_le ? (S (f n1)))
+  [ apply le_S_S.
+    apply H1
+  | simplify in H.
+    unfold increasing in H.
+    unfold lt in H.
+    apply H
+  ]
+]*)
+qed.
+
+theorem increasing_to_le: \forall f:nat \to nat. (increasing f) 
+\to \forall m:nat. \exists i. m \le (f i).
+intros.autobatch.
+(*elim m
+[ apply (ex_intro ? ? O).
+  apply le_O_n
+| elim H1.
+  apply (ex_intro ? ? (S a)).
+  apply (trans_le ? (S (f a)))
+  [ apply le_S_S.
+    assumption
+  | simplify in H.
+    unfold increasing in H.
+    unfold lt in H.
+    apply H
+  ]
+]*)
+qed.
+
+theorem increasing_to_le2: \forall f:nat \to nat. (increasing f) 
+\to \forall m:nat. (f O) \le m \to 
+\exists i. (f i) \le m \land m <(f (S i)).
+intros.
+elim H1
+[ autobatch.
+  (*apply (ex_intro ? ? O).
+  split
+  [ apply le_n
+  | apply H
+  ]*)
+| elim H3.
+  elim H4.  
+  cut ((S n1) < (f (S a)) \lor (S n1) = (f (S a)))
+  [ elim Hcut
+    [ apply (ex_intro ? ? a).
+      autobatch
+      (*split
+      [ apply le_S.
+        assumption
+      | assumption
+      ]*)
+    | apply (ex_intro ? ? (S a)).
+      split
+      [ rewrite < H7.
+        apply le_n
+      | autobatch
+        (*rewrite > 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 (file)
index 0000000..01e340c
--- /dev/null
@@ -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 (file)
index 0000000..59259ca
--- /dev/null
@@ -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 (file)
index 0000000..21d752f
--- /dev/null
@@ -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<m)
+    [ assumption
+    | rewrite > 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<i)
+  [ assumption
+  | autobatch
+    (*apply (le_n_O_elim i H1).
+    apply (not_le_Sn_O O)*)
+  ]
+| change with (i \divides (S n1)*n1!).
+  apply (le_n_Sm_elim i n1 H2)
+  [ intro.
+    apply (transitive_divides ? n1!)
+    [ autobatch
+      (*apply H1.
+      apply le_S_S_to_le. 
+      assumption*)
+    | autobatch
+      (*apply (witness ? ? (S n1)).
+      apply sym_times*)
+    ]
+  | intro.
+    autobatch
+    (*rewrite > 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 (file)
index 0000000..8dee78c
--- /dev/null
@@ -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 (file)
index 0000000..2bf73d4
--- /dev/null
@@ -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 (file)
index 0000000..c8e2a40
--- /dev/null
@@ -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 (file)
index 0000000..98b3746
--- /dev/null
@@ -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 (file)
index 0000000..ec9f8cb
--- /dev/null
@@ -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 (file)
index 0000000..3d26301
--- /dev/null
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="utf-8"?>
+<helm_registry>
+  <section name="user">
+    <!-- User home directory. Here a ".matita" directory will be created
+    and used to store the part of the library developed by the user. -->
+    <key name="home">$(HOME)</key>
+    <!-- User name. It is used down in this configuration file.  If left
+    unspecified, name of the user executing matita will be used (as per
+    getent) -->
+    <key name="name">$(USER)</key>
+  </section>
+  <section name="matita">
+    <!-- Debug only. Stay away. -->
+    <!-- <key name="auto_disambiguation">true</key> -->
+    <!-- Debug only. Stay away. -->
+    <!-- <key name="environment_trust">true</key> -->
+    <key name="basedir">$(user.home)/.matita</key>
+    <!-- Where support files are installed -->
+    <key name="rt_base_dir">@RT_BASE_DIR@</key>
+    <!-- Metadata owner. It will be used to create user-specific tables
+    in the SQL database. -->
+    <key name="owner">$(user.name)</key>
+    <!-- Initial GUI font size. -->
+    <!-- <key name="font_size">10</key> -->
+    <!--  Perform heavy checks when run interactively (like duplicate check) -->
+    <!-- <key name="do_heavy_checks">false</key> -->
+  </section>
+  <section name="db">
+    <!-- 
+    Every metadata key must have the following fields:
+      1) dbhost: a file:// or a mysql:// path
+      2) database name: use extension .db for file:// dbs
+      3) username
+      4) password: use 'none' for no password
+      5) dbtype: one of the following
+           'legacy' 
+              are read only dbs, used for the Coq/contribs stuff
+           'library' 
+             is the standard library, becames writable in publish (-system)
+             mode
+           'user' 
+              is the user own db (can be the same of marked as ro, tables
+              have different names and can coexist)
+
+    Note that:
+      exactly one 'user'    db must be specified
+      exactly one 'library' db must be specified
+      exactly one 'legacy'  db can  be specified
+    -->
+
+    <!-- The following snippet is used by the helm team
+         note that user's tables are named diffrently from library tables,
+        so they can coexists on the same db -->
+
+    <key name="metadata">@DBHOST@ matita helm none legacy</key>
+    <key name="metadata">@DBHOST@ public helm none library</key>
+    <key name="metadata">@DBHOST@ matita helm none user</key>
+
+    <!-- The following snippet it what you want to use a local sqlite db
+         and acess remotely to the coq library trought mowgli
+    <key name="metadata">@DBHOST@ matita helm none legacy</key>
+    <key name="metadata">file://$(matita.rt_base_dir) metadata.db helm helm library</key>
+    <key name="metadata">file://$(matita.basedir) user.db helm helm user</key>
+    -->
+
+    <!-- 
+    If you have a large amount of metadata, you may be interested in using
+    MySql instead of Sqlite. The simplest way to create a MySql database is:
+      0) # become an user with database administration privileges
+      1) mysqladmin create matita
+      2) echo "grant all privileges on matita.* to helm;" | mysql matita
+      Note that this way the database will be open to anyone, apply
+      stricter permissions if needed.
+    -->
+  </section>
+  <section name="getter">
+    <!-- Cache dir for CIC XML documents downloaded from the net.
+    Beware that this dir may become really space-consuming. It wont be
+    used if all prefexises below are local (i.e. "file:///" URI scheme).
+    -->
+    <key name="cache_dir">$(user.home)/.matita/getter/cache</key>
+    <!-- "Prefixes", i.e.: mappings URI -> URL of the global library
+    Each prefix mapps an URI of the cic:/ namespace to an URL where the
+    documents can actually be accessed. URL can be in the "file://" or
+    "http://" scheme. Only "file://" scheme can be used to store
+    documents created by the user.
+    Each prefix may be given a list of attributes. Currently supported
+    attributes are:
+    - "legacy" for parts of the library not generated by Matita (e.g.
+      exported from Coq)
+    - "ro" for parts of the library which are not writable by the user
+      (e.g. the Matita standard library)
+    "legacy" implies "ro"
+    -->
+    <key name="prefix">
+      cic:/matita/
+      file:///projects/helm/library/matita_contribs/matita
+      ro
+    </key>
+    <key name="prefix">
+      cic:/matita/
+      file://$(matita.rt_base_dir)/xml/standard-library/
+      ro
+    </key>
+    <key name="prefix">
+      cic:/matita/
+      file://$(user.home)/.matita/xml/matita/
+    </key>
+    <key name="prefix">
+      cic:/
+      file://@RT_BASE_DIR@/xml/legacy-library/coq/
+      legacy
+    </key>
+    <key name="prefix">
+      cic:/
+      file:///projects/helm/library/coq_contribs/
+      legacy
+    </key>
+    <key name="prefix">
+      cic:/
+      http://mowgli.cs.unibo.it/xml/
+      legacy
+    </key>
+  </section>
+</helm_registry>
diff --git a/matita/matita.glade b/matita/matita.glade
new file mode 100644 (file)
index 0000000..72ba3db
--- /dev/null
@@ -0,0 +1,3393 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--*- mode: xml -*-->
+<glade-interface>
+  <widget class="GtkWindow" id="BrowserWin">
+    <property name="visible">True</property>
+    <property name="title" translatable="yes">Cic browser</property>
+    <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
+    <property name="default_width">500</property>
+    <property name="default_height">500</property>
+    <child>
+      <widget class="GtkEventBox" id="BrowserWinEventBox">
+        <property name="visible">True</property>
+        <child>
+          <widget class="GtkVBox" id="BrowserVBox">
+            <property name="visible">True</property>
+            <child>
+              <widget class="GtkMenuBar" id="menubar2">
+                <property name="visible">True</property>
+                <child>
+                  <widget class="GtkMenuItem" id="BrowserFileMenu">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">_File</property>
+                    <property name="use_underline">True</property>
+                    <child>
+                      <widget class="GtkMenu" id="BrowserFileMenu_menu">
+                        <child>
+                          <widget class="GtkImageMenuItem" id="BrowserNewMenuItem">
+                            <property name="visible">True</property>
+                            <property name="label">gtk-new</property>
+                            <property name="use_underline">True</property>
+                            <property name="use_stock">True</property>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkMenuItem" id="BrowserUrlMenuItem">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Open _Location ...</property>
+                            <property name="use_underline">True</property>
+                            <accelerator key="L" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkSeparatorMenuItem" id="separatormenuitem1">
+                            <property name="visible">True</property>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkImageMenuItem" id="BrowserCloseMenuItem">
+                            <property name="visible">True</property>
+                            <property name="label">gtk-close</property>
+                            <property name="use_underline">True</property>
+                            <property name="use_stock">True</property>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+                <child>
+                  <widget class="GtkMenuItem" id="BrowserEditMenu">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">_Edit</property>
+                    <property name="use_underline">True</property>
+                    <child>
+                      <widget class="GtkMenu" id="BrowserEditMenu_menu">
+                        <child>
+                          <widget class="GtkImageMenuItem" id="BrowserCopyMenuItem">
+                            <property name="visible">True</property>
+                            <property name="label">gtk-copy</property>
+                            <property name="use_underline">True</property>
+                            <property name="use_stock">True</property>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+                <child>
+                  <widget class="GtkMenuItem" id="BrowserViewMenu">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">_View</property>
+                    <property name="use_underline">True</property>
+                    <child>
+                      <widget class="GtkMenu" id="BrowserViewMenu_menu">
+                        <child>
+                          <widget class="GtkMenuItem" id="BrowserMetadataMenuItem">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">_Metadata</property>
+                            <property name="use_underline">True</property>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkMenuItem" id="DepGraphMenuItem">
+                            <property name="visible">True</property>
+                            <property name="tooltip" translatable="yes">View the graph of objects on which the current one depends on</property>
+                            <property name="label" translatable="yes">(Direct) Dependencies</property>
+                            <property name="use_underline">True</property>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkMenuItem" id="InvDepGraphMenuItem">
+                            <property name="visible">True</property>
+                            <property name="tooltip" translatable="yes">View the graph of objects which depends on the current one</property>
+                            <property name="label" translatable="yes">(Inverse) Dependencies</property>
+                            <property name="use_underline">True</property>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkSeparatorMenuItem" id="separator11">
+                            <property name="visible">True</property>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkMenuItem" id="HBugsTutorsMenuItem">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">HBugs Tutors</property>
+                            <property name="use_underline">True</property>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkFrame" id="frame2">
+                <property name="visible">True</property>
+                <property name="label_xalign">0</property>
+                <property name="label_yalign">0</property>
+                <property name="shadow_type">GTK_SHADOW_NONE</property>
+                <child>
+                  <widget class="GtkHBox" id="BrowserHBox">
+                    <property name="visible">True</property>
+                    <child>
+                      <widget class="GtkButton" id="BrowserNewButton">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="relief">GTK_RELIEF_NONE</property>
+                        <property name="response_id">0</property>
+                        <child>
+                          <widget class="GtkImage" id="image303">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-new</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkButton" id="BrowserBackButton">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="relief">GTK_RELIEF_NONE</property>
+                        <property name="response_id">0</property>
+                        <child>
+                          <widget class="GtkImage" id="image304">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-go-back</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkButton" id="BrowserForwardButton">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="relief">GTK_RELIEF_NONE</property>
+                        <property name="response_id">0</property>
+                        <child>
+                          <widget class="GtkImage" id="image305">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-go-forward</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkButton" id="BrowserRefreshButton">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="can_default">True</property>
+                        <property name="tooltip" translatable="yes">refresh</property>
+                        <property name="relief">GTK_RELIEF_NONE</property>
+                        <property name="response_id">0</property>
+                        <child>
+                          <widget class="GtkImage" id="image229">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-refresh</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkButton" id="BrowserHomeButton">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="can_default">True</property>
+                        <property name="tooltip" translatable="yes">home</property>
+                        <property name="relief">GTK_RELIEF_NONE</property>
+                        <property name="response_id">0</property>
+                        <child>
+                          <widget class="GtkImage" id="image190">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-home</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">4</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkImage" id="image301">
+                        <property name="visible">True</property>
+                        <property name="stock">gtk-jump-to</property>
+                        <property name="icon_size">2</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="padding">3</property>
+                        <property name="position">5</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkHBox" id="UriHBox">
+                        <property name="visible">True</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="position">6</property>
+                      </packing>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkHBox" id="whelpBarBox">
+                <property name="visible">True</property>
+                <property name="border_width">3</property>
+                <property name="spacing">6</property>
+                <child>
+                  <widget class="GtkImage" id="WhelpBarImage">
+                    <property name="visible">True</property>
+                    <property name="stock">gtk-missing-image</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkEntry" id="queryInputText">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">*</property>
+                  </widget>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkVBox" id="whelpBarComboVbox">
+                    <property name="visible">True</property>
+                    <child>
+                      <widget class="GtkAlignment" id="alignment4">
+                        <property name="visible">True</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkNotebook" id="mathOrListNotebook">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <child>
+                  <widget class="GtkScrolledWindow" id="ScrolledBrowser">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                    <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="tab_expand">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="mathLabel">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">MathView</property>
+                  </widget>
+                  <packing>
+                    <property name="type">tab</property>
+                    <property name="tab_expand">False</property>
+                    <property name="tab_fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkScrolledWindow" id="scrolledwindow9">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                    <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                    <property name="shadow_type">GTK_SHADOW_IN</property>
+                    <child>
+                      <widget class="GtkTreeView" id="whelpResultTreeview">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="headers_visible">False</property>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="position">1</property>
+                    <property name="tab_expand">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="listLabel">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">WhelpResults</property>
+                  </widget>
+                  <packing>
+                    <property name="type">tab</property>
+                    <property name="position">1</property>
+                    <property name="tab_expand">False</property>
+                    <property name="tab_fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkScrolledWindow" id="scrolledwindow11">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                    <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                    <child>
+                      <widget class="GtkViewport" id="viewport2">
+                        <property name="visible">True</property>
+                        <property name="shadow_type">GTK_SHADOW_NONE</property>
+                        <child>
+                          <widget class="GtkImage" id="BrowserImage">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-missing-image</property>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="position">2</property>
+                    <property name="tab_expand">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="EasterEggLabel">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">WhelpEasterEgg</property>
+                  </widget>
+                  <packing>
+                    <property name="type">tab</property>
+                    <property name="position">2</property>
+                    <property name="tab_expand">False</property>
+                    <property name="tab_fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkScrolledWindow" id="GraphScrolledWin">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                    <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="position">3</property>
+                    <property name="tab_expand">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="label26">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">Graph</property>
+                  </widget>
+                  <packing>
+                    <property name="type">tab</property>
+                    <property name="position">3</property>
+                    <property name="tab_expand">False</property>
+                    <property name="tab_fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkVBox" id="vbox16">
+                    <property name="visible">True</property>
+                    <child>
+                      <widget class="GtkScrolledWindow" id="scrolledwindow13">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <child>
+                          <widget class="GtkTreeView" id="HBugsTutorsList">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkToolbar" id="toolbar3">
+                        <property name="visible">True</property>
+                        <property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
+                        <child>
+                          <widget class="GtkToolItem" id="toolitem47">
+                            <property name="visible">True</property>
+                            <child>
+                              <widget class="GtkButton" id="HBugsRefreshButton">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="label">gtk-refresh</property>
+                                <property name="use_stock">True</property>
+                                <property name="response_id">0</property>
+                              </widget>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="homogeneous">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkToolItem" id="toolitem48">
+                            <property name="visible">True</property>
+                            <child>
+                              <widget class="GtkButton" id="HBugsUnsubscribeButton">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="label">gtk-remove</property>
+                                <property name="use_stock">True</property>
+                                <property name="response_id">0</property>
+                              </widget>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="homogeneous">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkToolItem" id="toolitem49">
+                            <property name="visible">True</property>
+                            <child>
+                              <widget class="GtkButton" id="HBugsSubscribeButton">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="label">gtk-add</property>
+                                <property name="use_stock">True</property>
+                                <property name="response_id">0</property>
+                              </widget>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="homogeneous">False</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="position">4</property>
+                    <property name="tab_expand">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="label29">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">HBugs</property>
+                  </widget>
+                  <packing>
+                    <property name="type">tab</property>
+                    <property name="position">4</property>
+                    <property name="tab_expand">False</property>
+                    <property name="tab_fill">False</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </widget>
+        </child>
+      </widget>
+    </child>
+  </widget>
+  <widget class="GtkDialog" id="ConfirmationDialog">
+    <property name="title" translatable="yes">DUMMY</property>
+    <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="window_position">GTK_WIN_POS_CENTER</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <child>
+          <widget class="GtkLabel" id="ConfirmationDialogLabel">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">DUMMY</property>
+            <property name="justify">GTK_JUSTIFY_CENTER</property>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <widget class="GtkButton" id="ConfirmationDialogCancelButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-cancel</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">-6</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkButton" id="ConfirmationDialogOkButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-ok</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">-5</property>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+  <widget class="GtkDialog" id="EmptyDialog">
+    <property name="visible">True</property>
+    <property name="title" translatable="yes">DUMMY</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="EmptyDialogVBox">
+        <property name="visible">True</property>
+        <child>
+          <widget class="GtkLabel" id="EmptyDialogLabel">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">DUMMY</property>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="dialog-action_area5">
+            <property name="visible">True</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <widget class="GtkButton" id="EmptyDialogCancelButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-cancel</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">-6</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkButton" id="EmptyDialogOkButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-ok</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">-5</property>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+  <widget class="GtkFileSelection" id="FileSelectionWin">
+    <property name="border_width">10</property>
+    <property name="title" translatable="yes">Select File</property>
+    <property name="modal">True</property>
+    <property name="window_position">GTK_WIN_POS_CENTER</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+    <property name="show_fileops">True</property>
+    <child internal-child="cancel_button">
+      <widget class="GtkButton" id="fileSelCancelButton">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="can_default">True</property>
+        <property name="response_id">0</property>
+      </widget>
+    </child>
+    <child internal-child="ok_button">
+      <widget class="GtkButton" id="fileSelOkButton">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="can_default">True</property>
+        <property name="response_id">0</property>
+      </widget>
+    </child>
+  </widget>
+  <widget class="GtkWindow" id="MainWin">
+    <property name="title" translatable="yes">Matita</property>
+    <child>
+      <widget class="GtkEventBox" id="MainWinEventBox">
+        <property name="visible">True</property>
+        <child>
+          <widget class="GtkVBox" id="vbox8">
+            <property name="visible">True</property>
+            <child>
+              <widget class="GtkHandleBox" id="menuBarHandleBox">
+                <property name="visible">True</property>
+                <property name="shadow_type">GTK_SHADOW_OUT</property>
+                <child>
+                  <widget class="GtkMenuBar" id="menubar1">
+                    <property name="visible">True</property>
+                    <child>
+                      <widget class="GtkMenuItem" id="fileMenu">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_File</property>
+                        <property name="use_underline">True</property>
+                        <child>
+                          <widget class="GtkMenu" id="fileMenu_menu">
+                            <child>
+                              <widget class="GtkImageMenuItem" id="newMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_New</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="n" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1047">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-new</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkImageMenuItem" id="openMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Open...</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="o" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1048">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-open</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkImageMenuItem" id="saveMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Save</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="s" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1049">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-save</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkImageMenuItem" id="saveAsMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Save _as ...</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="s" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK" signal="activate"/>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1050">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-save-as</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkImageMenuItem" id="developmentsMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Developments...</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="d" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1051">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-execute</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkSeparatorMenuItem" id="separator2">
+                                <property name="visible">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkImageMenuItem" id="quitMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Quit</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1052">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-quit</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkMenuItem" id="editMenu">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_Edit</property>
+                        <property name="use_underline">True</property>
+                        <child>
+                          <widget class="GtkMenu" id="editMenu_menu">
+                            <child>
+                              <widget class="GtkImageMenuItem" id="undoMenuItem">
+                                <property name="visible">True</property>
+                                <property name="sensitive">False</property>
+                                <property name="label" translatable="yes">_Undo</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="z" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1053">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-undo</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkImageMenuItem" id="redoMenuItem">
+                                <property name="visible">True</property>
+                                <property name="sensitive">False</property>
+                                <property name="label" translatable="yes">_Redo</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="z" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK" signal="activate"/>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1054">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-redo</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkSeparatorMenuItem" id="separator3">
+                                <property name="visible">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkImageMenuItem" id="cutMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Cu_t</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="x" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1055">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-cut</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkImageMenuItem" id="copyMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Copy</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="c" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1056">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-copy</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkImageMenuItem" id="pasteMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Paste</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="v" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1057">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-paste</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkMenuItem" id="pastePatternMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Paste as pattern</property>
+                                <property name="use_underline">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkCheckMenuItem" id="unicodeAsTexMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Paste Unicode as TeX</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">False</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkImageMenuItem" id="deleteMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Delete</property>
+                                <property name="use_underline">True</property>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1058">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-delete</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkSeparatorMenuItem" id="separator4">
+                                <property name="visible">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkMenuItem" id="selectAllMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Select _All</property>
+                                <property name="use_underline">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkSeparatorMenuItem" id="separator7">
+                                <property name="visible">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkImageMenuItem" id="findReplMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Find &amp; replace ...</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="f" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1059">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-find-and-replace</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkSeparatorMenuItem" id="separator8">
+                                <property name="visible">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkMenuItem" id="LigatureButton">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Next ligature</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="l" modifiers="GDK_MOD1_MASK" signal="activate"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkMenuItem" id="externalEditorMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Edit with e_xternal editor</property>
+                                <property name="use_underline">True</property>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkMenuItem" id="scriptMenu">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_Script</property>
+                        <property name="use_underline">True</property>
+                        <child>
+                          <widget class="GtkMenu" id="scriptMenu_menu">
+                            <child>
+                              <widget class="GtkMenuItem" id="scriptAdvanceMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Execute 1 phrase</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="Page_Down" modifiers="GDK_CONTROL_MASK | GDK_MOD1_MASK" signal="activate"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkMenuItem" id="scriptRetractMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Retract 1 phrase</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="Page_Up" modifiers="GDK_CONTROL_MASK | GDK_MOD1_MASK" signal="activate"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkSeparatorMenuItem" id="separator9">
+                                <property name="visible">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkMenuItem" id="scriptBottomMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Execute all</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="End" modifiers="GDK_CONTROL_MASK | GDK_MOD1_MASK" signal="activate"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkMenuItem" id="scriptTopMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Restart</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="Home" modifiers="GDK_CONTROL_MASK | GDK_MOD1_MASK" signal="activate"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkSeparatorMenuItem" id="separator10">
+                                <property name="visible">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkMenuItem" id="scriptJumpMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Execute until cursor</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="period" modifiers="GDK_CONTROL_MASK | GDK_MOD1_MASK" signal="activate"/>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkMenuItem" id="viewMenu">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_View</property>
+                        <property name="use_underline">True</property>
+                        <child>
+                          <widget class="GtkMenu" id="viewMenu_menu">
+                            <child>
+                              <widget class="GtkCheckMenuItem" id="tacticsBarMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Show _tactics bar</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                                <accelerator key="F2" modifiers="" signal="activate"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkMenuItem" id="newCicBrowserMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">New CIC _browser</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="F3" modifiers="" signal="activate"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkSeparatorMenuItem" id="separator5">
+                                <property name="visible">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkCheckMenuItem" id="fullscreenMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Fullscreen</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="F11" modifiers="" signal="activate"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkSeparatorMenuItem" id="separator1">
+                                <property name="visible">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkImageMenuItem" id="increaseFontSizeMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Zoom _in</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="plus" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1060">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-zoom-in</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkImageMenuItem" id="decreaseFontSizeMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Zoom _out</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="minus" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1061">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-zoom-out</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkImageMenuItem" id="normalFontSizeMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Normal size</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="equal" modifiers="GDK_CONTROL_MASK" signal="activate"/>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1062">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-zoom-100</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkSeparatorMenuItem" id="separator12">
+                                <property name="visible">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkCheckMenuItem" id="ppNotationMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Pretty print notation</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkCheckMenuItem" id="hideCoercionsMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Hide coercions</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkSeparatorMenuItem" id="separator13">
+                                <property name="visible">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkMenuItem" id="showCoercionsGraphMenuItem">
+                                <property name="visible">True</property>
+                                <property name="tooltip" translatable="yes">Displays the graph of coercions</property>
+                                <property name="label" translatable="yes">Coercions Graph</property>
+                                <property name="use_underline">True</property>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkImageMenuItem" id="showAutoGuiMenuItem">
+                                <property name="visible">True</property>
+                                <property name="tooltip" translatable="yes">Displays a window helpful to drive automation</property>
+                                <property name="label" translatable="yes">Auto GUI</property>
+                                <property name="use_underline">True</property>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="menu-item-image19">
+                                    <property name="stock">gtk-media-pause</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkMenuItem" id="debugMenu">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_Debug</property>
+                        <property name="use_underline">True</property>
+                        <child>
+                          <widget class="GtkMenu" id="debugMenu_menu">
+                            <child>
+                              <widget class="GtkSeparatorMenuItem" id="separator6">
+                                <property name="visible">True</property>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkMenuItem" id="helpMenu">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">_Help</property>
+                        <property name="use_underline">True</property>
+                        <child>
+                          <widget class="GtkMenu" id="helpMenu_menu">
+                            <child>
+                              <widget class="GtkImageMenuItem" id="contentsMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Contents</property>
+                                <property name="use_underline">True</property>
+                                <accelerator key="F1" modifiers="" signal="activate"/>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1063">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-help</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkImageMenuItem" id="aboutMenuItem">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_About</property>
+                                <property name="use_underline">True</property>
+                                <child internal-child="image">
+                                  <widget class="GtkImage" id="image1064">
+                                    <property name="visible">True</property>
+                                    <property name="stock">gtk-about</property>
+                                    <property name="icon_size">1</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkHBox" id="hbox9">
+                <property name="visible">True</property>
+                <child>
+                  <widget class="GtkHPaned" id="hpaneScriptSequent">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox18">
+                        <property name="visible">True</property>
+                        <child>
+                          <widget class="GtkHandleBox" id="TacticsButtonsHandlebox">
+                            <property name="visible">True</property>
+                            <property name="shadow_type">GTK_SHADOW_OUT</property>
+                            <property name="handle_position">GTK_POS_TOP</property>
+                            <child>
+                              <widget class="GtkTable" id="ToolBarTable">
+                                <property name="visible">True</property>
+                                <property name="n_rows">17</property>
+                                <property name="n_columns">2</property>
+                                <property name="row_spacing">4</property>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                                <child>
+                                  <widget class="GtkAlignment" id="alignment12">
+                                    <property name="visible">True</property>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">15</property>
+                                    <property name="bottom_attach">16</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkAlignment" id="alignment11">
+                                    <property name="visible">True</property>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">13</property>
+                                    <property name="bottom_attach">14</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkAlignment" id="alignment10">
+                                    <property name="visible">True</property>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">10</property>
+                                    <property name="bottom_attach">11</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkAlignment" id="alignment9">
+                                    <property name="visible">True</property>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">7</property>
+                                    <property name="bottom_attach">8</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkAlignment" id="alignment8">
+                                    <property name="visible">True</property>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">5</property>
+                                    <property name="bottom_attach">6</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkAlignment" id="alignment7">
+                                    <property name="visible">True</property>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">3</property>
+                                    <property name="bottom_attach">4</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkAlignment" id="alignment6">
+                                    <property name="visible">True</property>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">1</property>
+                                    <property name="bottom_attach">2</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkHBox" id="hbox17">
+                                    <property name="visible">True</property>
+                                    <property name="homogeneous">True</property>
+                                    <child>
+                                      <widget class="GtkButton" id="splitButton">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="tooltip" translatable="yes">Split</property>
+                                        <property name="label" translatable="yes">∧</property>
+                                        <property name="use_underline">True</property>
+                                        <property name="response_id">0</property>
+                                      </widget>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkButton" id="leftButton">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="tooltip" translatable="yes">Left</property>
+                                        <property name="label" translatable="yes">L</property>
+                                        <property name="use_underline">True</property>
+                                        <property name="response_id">0</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">6</property>
+                                    <property name="bottom_attach">7</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options">GTK_FILL</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkHBox" id="hbox18">
+                                    <property name="visible">True</property>
+                                    <property name="homogeneous">True</property>
+                                    <child>
+                                      <widget class="GtkButton" id="rightButton">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="tooltip" translatable="yes">Right</property>
+                                        <property name="label" translatable="yes">R</property>
+                                        <property name="use_underline">True</property>
+                                        <property name="response_id">0</property>
+                                      </widget>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkButton" id="existsButton">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="tooltip" translatable="yes">Exists</property>
+                                        <property name="label" translatable="yes">∃</property>
+                                        <property name="use_underline">True</property>
+                                        <property name="response_id">0</property>
+                                      </widget>
+                                      <packing>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">6</property>
+                                    <property name="bottom_attach">7</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options">GTK_FILL</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkButton" id="elimTypeButton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="tooltip" translatable="yes">ElimType</property>
+                                    <property name="label" translatable="yes">elimTy</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="response_id">0</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">4</property>
+                                    <property name="bottom_attach">5</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkButton" id="replaceButton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="tooltip" translatable="yes">Replace</property>
+                                    <property name="label" translatable="yes">repl</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="response_id">0</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">16</property>
+                                    <property name="bottom_attach">17</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkButton" id="cutButton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="tooltip" translatable="yes">Cut</property>
+                                    <property name="label" translatable="yes">cut</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="response_id">0</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">16</property>
+                                    <property name="bottom_attach">17</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkButton" id="autoButton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="tooltip" translatable="yes">Auto</property>
+                                    <property name="label" translatable="yes">auto</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="response_id">0</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">14</property>
+                                    <property name="bottom_attach">15</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkButton" id="assumptionButton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="tooltip" translatable="yes">Assumption</property>
+                                    <property name="label" translatable="yes">assum</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="response_id">0</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">14</property>
+                                    <property name="bottom_attach">15</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkButton" id="whdButton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="tooltip" translatable="yes">Whd</property>
+                                    <property name="label" translatable="yes">whd</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="response_id">0</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">12</property>
+                                    <property name="bottom_attach">13</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkButton" id="reduceButton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="tooltip" translatable="yes">Reduce</property>
+                                    <property name="label" translatable="yes">red</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="response_id">0</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">11</property>
+                                    <property name="bottom_attach">12</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkButton" id="simplifyButton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="tooltip" translatable="yes">Simplify</property>
+                                    <property name="label" translatable="yes">simpl</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="response_id">0</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">11</property>
+                                    <property name="bottom_attach">12</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkButton" id="transitivityButton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="tooltip" translatable="yes">Transitivity</property>
+                                    <property name="label" translatable="yes">trans</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="response_id">0</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">9</property>
+                                    <property name="bottom_attach">10</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkButton" id="symmetryButton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="tooltip" translatable="yes">Symmetry</property>
+                                    <property name="label" translatable="yes">sym</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="response_id">0</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="top_attach">8</property>
+                                    <property name="bottom_attach">9</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkButton" id="reflexivityButton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="tooltip" translatable="yes">Reflexivity</property>
+                                    <property name="label" translatable="yes">refl</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="response_id">0</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">8</property>
+                                    <property name="bottom_attach">9</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkButton" id="elimButton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="tooltip" translatable="yes">Elim</property>
+                                    <property name="label" translatable="yes">elim</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="response_id">0</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">4</property>
+                                    <property name="bottom_attach">5</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkButton" id="exactButton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="tooltip" translatable="yes">Exact</property>
+                                    <property name="label" translatable="yes">exact</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="response_id">0</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="top_attach">2</property>
+                                    <property name="bottom_attach">3</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkButton" id="introsButton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="tooltip" translatable="yes">Intros</property>
+                                    <property name="label" translatable="yes">intro</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="response_id">0</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkButton" id="applyButton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="tooltip" translatable="yes">Apply</property>
+                                    <property name="label" translatable="yes">apply</property>
+                                    <property name="use_underline">True</property>
+                                    <property name="response_id">0</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="left_attach">1</property>
+                                    <property name="right_attach">2</property>
+                                    <property name="x_options">GTK_FILL</property>
+                                    <property name="y_options"></property>
+                                  </packing>
+                                </child>
+                              </widget>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkVBox" id="vboxScript">
+                            <property name="width_request">400</property>
+                            <property name="visible">True</property>
+                            <child>
+                              <widget class="GtkHBox" id="hbox28">
+                                <property name="visible">True</property>
+                                <child>
+                                  <widget class="GtkToolbar" id="buttonsToolbar">
+                                    <property name="visible">True</property>
+                                    <property name="toolbar_style">GTK_TOOLBAR_BOTH</property>
+                                    <child>
+                                      <widget class="GtkToolItem" id="toolitem41">
+                                        <property name="visible">True</property>
+                                        <child>
+                                          <widget class="GtkButton" id="scriptTopButton">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="tooltip" translatable="yes">Restart</property>
+                                            <property name="relief">GTK_RELIEF_NONE</property>
+                                            <property name="response_id">0</property>
+                                            <child>
+                                              <widget class="GtkImage" id="image920">
+                                                <property name="visible">True</property>
+                                                <property name="stock">gtk-goto-top</property>
+                                              </widget>
+                                            </child>
+                                          </widget>
+                                        </child>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="homogeneous">False</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkToolItem" id="toolitem42">
+                                        <property name="visible">True</property>
+                                        <child>
+                                          <widget class="GtkButton" id="scriptRetractButton">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="tooltip" translatable="yes">Retract 1 phrase</property>
+                                            <property name="relief">GTK_RELIEF_NONE</property>
+                                            <property name="response_id">0</property>
+                                            <child>
+                                              <widget class="GtkImage" id="image921">
+                                                <property name="visible">True</property>
+                                                <property name="stock">gtk-go-up</property>
+                                              </widget>
+                                            </child>
+                                          </widget>
+                                        </child>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="homogeneous">False</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkToolItem" id="toolitem43">
+                                        <property name="visible">True</property>
+                                        <child>
+                                          <widget class="GtkButton" id="scriptJumpButton">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="tooltip" translatable="yes">Execute until point</property>
+                                            <property name="relief">GTK_RELIEF_NONE</property>
+                                            <property name="response_id">0</property>
+                                            <child>
+                                              <widget class="GtkImage" id="image922">
+                                                <property name="visible">True</property>
+                                                <property name="stock">gtk-jump-to</property>
+                                              </widget>
+                                            </child>
+                                          </widget>
+                                        </child>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="homogeneous">False</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkToolItem" id="toolitem44">
+                                        <property name="visible">True</property>
+                                        <child>
+                                          <widget class="GtkButton" id="scriptAdvanceButton">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="tooltip" translatable="yes">Execute 1 phrase</property>
+                                            <property name="relief">GTK_RELIEF_NONE</property>
+                                            <property name="response_id">0</property>
+                                            <child>
+                                              <widget class="GtkImage" id="image923">
+                                                <property name="visible">True</property>
+                                                <property name="stock">gtk-go-down</property>
+                                              </widget>
+                                            </child>
+                                          </widget>
+                                        </child>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="homogeneous">False</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <widget class="GtkToolItem" id="toolitem45">
+                                        <property name="visible">True</property>
+                                        <child>
+                                          <widget class="GtkButton" id="scriptBottomButton">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="tooltip" translatable="yes">Execute all</property>
+                                            <property name="relief">GTK_RELIEF_NONE</property>
+                                            <property name="response_id">0</property>
+                                            <child>
+                                              <widget class="GtkImage" id="image924">
+                                                <property name="visible">True</property>
+                                                <property name="stock">gtk-goto-bottom</property>
+                                              </widget>
+                                            </child>
+                                          </widget>
+                                        </child>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="homogeneous">False</property>
+                                      </packing>
+                                    </child>
+                                  </widget>
+                                </child>
+                                <child>
+                                  <widget class="GtkToolbar" id="toolbar2">
+                                    <property name="visible">True</property>
+                                    <property name="orientation">GTK_ORIENTATION_VERTICAL</property>
+                                    <child>
+                                      <widget class="GtkToolItem" id="toolitem46">
+                                        <property name="visible">True</property>
+                                        <child>
+                                          <widget class="GtkButton" id="scriptAbortButton">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="relief">GTK_RELIEF_NONE</property>
+                                            <property name="response_id">0</property>
+                                            <child>
+                                              <widget class="GtkImage" id="image927">
+                                                <property name="visible">True</property>
+                                                <property name="stock">gtk-stop</property>
+                                              </widget>
+                                            </child>
+                                          </widget>
+                                        </child>
+                                      </widget>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="homogeneous">False</property>
+                                      </packing>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="expand">False</property>
+                                    <property name="position">1</property>
+                                  </packing>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkNotebook" id="scriptNotebook">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="tab_pos">GTK_POS_BOTTOM</property>
+                                <child>
+                                  <widget class="GtkScrolledWindow" id="ScriptScrolledWin">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                                    <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="tab_expand">False</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkLabel" id="scriptLabel">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">script</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="type">tab</property>
+                                    <property name="tab_expand">False</property>
+                                    <property name="tab_fill">False</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkScrolledWindow" id="scrolledwindow8">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                                    <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                                    <child>
+                                      <widget class="GtkViewport" id="viewport1">
+                                        <property name="visible">True</property>
+                                        <child>
+                                          <widget class="GtkLabel" id="label25">
+                                            <property name="visible">True</property>
+                                            <property name="label" translatable="yes">Not implemented.</property>
+                                          </widget>
+                                        </child>
+                                      </widget>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">1</property>
+                                    <property name="tab_expand">False</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkLabel" id="label13">
+                                    <property name="visible">True</property>
+                                    <property name="label" translatable="yes">outline</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="type">tab</property>
+                                    <property name="position">1</property>
+                                    <property name="tab_expand">False</property>
+                                    <property name="tab_fill">False</property>
+                                  </packing>
+                                </child>
+                              </widget>
+                              <packing>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="resize">False</property>
+                        <property name="shrink">True</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkVPaned" id="vpaned1">
+                        <property name="width_request">250</property>
+                        <property name="height_request">500</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="position">380</property>
+                        <child>
+                          <widget class="GtkNotebook" id="sequentsNotebook">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                          </widget>
+                          <packing>
+                            <property name="resize">False</property>
+                            <property name="shrink">True</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkHBox" id="hbox9">
+                            <property name="visible">True</property>
+                            <child>
+                              <widget class="GtkScrolledWindow" id="logScrolledWin">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+                                <property name="shadow_type">GTK_SHADOW_IN</property>
+                                <child>
+                                  <widget class="GtkTextView" id="logTextView">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="editable">False</property>
+                                    <property name="wrap_mode">GTK_WRAP_CHAR</property>
+                                    <property name="cursor_visible">False</property>
+                                  </widget>
+                                </child>
+                              </widget>
+                            </child>
+                          </widget>
+                          <packing>
+                            <property name="resize">True</property>
+                            <property name="shrink">True</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="resize">True</property>
+                        <property name="shrink">True</property>
+                      </packing>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkHBox" id="hbox10">
+                <property name="visible">True</property>
+                <child>
+                  <widget class="GtkStatusbar" id="StatusBar">
+                    <property name="visible">True</property>
+                    <property name="has_resize_grip">False</property>
+                  </widget>
+                </child>
+                <child>
+                  <widget class="GtkNotebook" id="HintNotebook">
+                    <property name="visible">True</property>
+                    <property name="show_tabs">False</property>
+                    <child>
+                      <widget class="GtkImage" id="HintLowImage">
+                        <property name="visible">True</property>
+                        <property name="stock">gtk-missing-image</property>
+                      </widget>
+                      <packing>
+                        <property name="tab_expand">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label14">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">label14</property>
+                      </widget>
+                      <packing>
+                        <property name="type">tab</property>
+                        <property name="tab_expand">False</property>
+                        <property name="tab_fill">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkImage" id="HintMediumImage">
+                        <property name="visible">True</property>
+                        <property name="stock">gtk-missing-image</property>
+                      </widget>
+                      <packing>
+                        <property name="position">1</property>
+                        <property name="tab_expand">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label15">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">label15</property>
+                      </widget>
+                      <packing>
+                        <property name="type">tab</property>
+                        <property name="position">1</property>
+                        <property name="tab_expand">False</property>
+                        <property name="tab_fill">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkImage" id="HintHighImage">
+                        <property name="visible">True</property>
+                        <property name="stock">gtk-missing-image</property>
+                      </widget>
+                      <packing>
+                        <property name="position">2</property>
+                        <property name="tab_expand">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label16">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">label16</property>
+                      </widget>
+                      <packing>
+                        <property name="type">tab</property>
+                        <property name="position">2</property>
+                        <property name="tab_expand">False</property>
+                        <property name="tab_fill">False</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </widget>
+        </child>
+      </widget>
+    </child>
+  </widget>
+  <widget class="GtkDialog" id="TextDialog">
+    <property name="title" translatable="yes">DUMMY</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="vbox5">
+        <property name="visible">True</property>
+        <child>
+          <widget class="GtkLabel" id="TextDialogLabel">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">DUMMY</property>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkScrolledWindow" id="scrolledwindow2">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+            <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+            <property name="shadow_type">GTK_SHADOW_IN</property>
+            <child>
+              <widget class="GtkTextView" id="TextDialogTextView">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+              </widget>
+            </child>
+          </widget>
+          <packing>
+            <property name="position">3</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="hbuttonbox1">
+            <property name="visible">True</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <widget class="GtkButton" id="TextDialogCancelButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-cancel</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">-6</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkButton" id="TextDialogOkButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-ok</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">-5</property>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+  <widget class="GtkDialog" id="UriChoiceDialog">
+    <property name="height_request">280</property>
+    <property name="title" translatable="yes">Uri choice</property>
+    <property name="modal">True</property>
+    <property name="window_position">GTK_WIN_POS_CENTER</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="dialog-vbox3">
+        <property name="visible">True</property>
+        <property name="spacing">4</property>
+        <child>
+          <widget class="GtkVBox" id="vbox2">
+            <property name="visible">True</property>
+            <property name="spacing">3</property>
+            <child>
+              <widget class="GtkLabel" id="UriChoiceLabel">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">some informative message here ...</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkScrolledWindow" id="scrolledwindow1">
+                <property name="width_request">400</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                <child>
+                  <widget class="GtkTreeView" id="UriChoiceTreeView">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="headers_visible">False</property>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkHBox" id="uriEntryHBox">
+                <property name="visible">True</property>
+                <child>
+                  <widget class="GtkLabel" id="label2">
+                    <property name="visible">True</property>
+                    <property name="label" translatable="yes">URI: </property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkEntry" id="entry1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">*</property>
+                  </widget>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="dialog-action_area3">
+            <property name="visible">True</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <widget class="GtkButton" id="UriChoiceAbortButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-cancel</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">-6</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkButton" id="UriChoiceSelectedButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="response_id">0</property>
+                <child>
+                  <widget class="GtkAlignment" id="alignment2">
+                    <property name="visible">True</property>
+                    <property name="xscale">0</property>
+                    <property name="yscale">0</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox3">
+                        <property name="visible">True</property>
+                        <property name="spacing">2</property>
+                        <child>
+                          <widget class="GtkImage" id="image19">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-index</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label3">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Try _Selected</property>
+                            <property name="use_underline">True</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="UriChoiceConstantsButton">
+                <property name="visible">True</property>
+                <property name="sensitive">False</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label" translatable="yes">Try Constants</property>
+                <property name="use_underline">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="copyButton">
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-copy</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="position">3</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="uriChoiceAutoButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="response_id">0</property>
+                <child>
+                  <widget class="GtkAlignment" id="alignment5">
+                    <property name="visible">True</property>
+                    <property name="xscale">0</property>
+                    <property name="yscale">0</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox16">
+                        <property name="visible">True</property>
+                        <property name="spacing">2</property>
+                        <child>
+                          <widget class="GtkImage" id="image302">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-ok</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="okLabel">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">bla bla bla</property>
+                            <property name="use_underline">True</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">4</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="uriChoiceForwardButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-go-forward</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="position">5</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+  <widget class="GtkWindow" id="FindReplWin">
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">Find &amp; Replace</property>
+    <property name="resizable">False</property>
+    <property name="window_position">GTK_WIN_POS_MOUSE</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+    <child>
+      <widget class="GtkTable" id="table1">
+        <property name="visible">True</property>
+        <property name="n_rows">3</property>
+        <property name="n_columns">2</property>
+        <property name="row_spacing">5</property>
+        <child>
+          <widget class="GtkHBox" id="hbox19">
+            <property name="visible">True</property>
+            <property name="spacing">5</property>
+            <child>
+              <widget class="GtkVBox" id="vbox9">
+                <property name="visible">True</property>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkButton" id="findButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label">gtk-find</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="findReplButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="response_id">0</property>
+                <child>
+                  <widget class="GtkAlignment" id="alignment13">
+                    <property name="visible">True</property>
+                    <property name="xscale">0</property>
+                    <property name="yscale">0</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox20">
+                        <property name="visible">True</property>
+                        <property name="spacing">2</property>
+                        <child>
+                          <widget class="GtkImage" id="image357">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-find-and-replace</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label19">
+                            <property name="visible">True</property>
+                            <property name="label">_Replace</property>
+                            <property name="use_underline">True</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="cancelButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label">gtk-cancel</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="right_attach">2</property>
+            <property name="top_attach">2</property>
+            <property name="bottom_attach">3</property>
+            <property name="y_padding">5</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkEntry" id="replaceEntry">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="invisible_char">*</property>
+          </widget>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="right_attach">2</property>
+            <property name="top_attach">1</property>
+            <property name="bottom_attach">2</property>
+            <property name="y_options"></property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkEntry" id="findEntry">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="has_focus">True</property>
+            <property name="can_default">True</property>
+            <property name="has_default">True</property>
+            <property name="invisible_char">*</property>
+          </widget>
+          <packing>
+            <property name="left_attach">1</property>
+            <property name="right_attach">2</property>
+            <property name="y_options"></property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkLabel" id="label18">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">Replace with: </property>
+          </widget>
+          <packing>
+            <property name="top_attach">1</property>
+            <property name="bottom_attach">2</property>
+            <property name="x_options">GTK_FILL</property>
+            <property name="y_options"></property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkLabel" id="label17">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">Find:</property>
+          </widget>
+          <packing>
+            <property name="x_options">GTK_FILL</property>
+            <property name="y_options"></property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+  <widget class="GtkWindow" id="NewDevelWin">
+    <property name="title" translatable="yes">Create development</property>
+    <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_UTILITY</property>
+    <child>
+      <widget class="GtkVBox" id="vbox10">
+        <property name="visible">True</property>
+        <child>
+          <widget class="GtkTable" id="table2">
+            <property name="visible">True</property>
+            <property name="border_width">3</property>
+            <property name="n_rows">2</property>
+            <property name="n_columns">3</property>
+            <property name="column_spacing">5</property>
+            <property name="row_spacing">5</property>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <widget class="GtkButton" id="chooseRootButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label" translatable="yes">...</property>
+                <property name="use_underline">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="right_attach">3</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkEntry" id="rootEntry">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">*</property>
+              </widget>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkEntry" id="nameEntry">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="invisible_char">*</property>
+              </widget>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label21">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Root directory</property>
+              </widget>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label20">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Name</property>
+              </widget>
+              <packing>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkHSeparator" id="hseparator1">
+            <property name="visible">True</property>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="padding">2</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkHBox" id="hbox21">
+            <property name="visible">True</property>
+            <property name="border_width">3</property>
+            <property name="spacing">5</property>
+            <child>
+              <widget class="GtkVBox" id="vbox11">
+                <property name="visible">True</property>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkButton" id="addButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label">gtk-add</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="cancelButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label">gtk-cancel</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+  <widget class="GtkWindow" id="DevelListWin">
+    <property name="title" translatable="yes">Developments</property>
+    <property name="window_position">GTK_WIN_POS_CENTER</property>
+    <child>
+      <widget class="GtkVBox" id="vbox12">
+        <property name="visible">True</property>
+        <child>
+          <widget class="GtkScrolledWindow" id="scrolledwindow10">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+            <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+            <property name="shadow_type">GTK_SHADOW_IN</property>
+            <child>
+              <widget class="GtkTreeView" id="developmentsTreeview">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="headers_visible">False</property>
+              </widget>
+            </child>
+          </widget>
+        </child>
+        <child>
+          <widget class="GtkHSeparator" id="hseparator2">
+            <property name="visible">True</property>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="padding">2</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkHBox" id="buttonsHbox">
+            <property name="visible">True</property>
+            <property name="border_width">3</property>
+            <property name="spacing">4</property>
+            <child>
+              <widget class="GtkVBox" id="vbox13">
+                <property name="visible">True</property>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkButton" id="newButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label">gtk-new</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="deleteButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label">gtk-delete</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="buildButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="response_id">0</property>
+                <child>
+                  <widget class="GtkAlignment" id="alignment14">
+                    <property name="visible">True</property>
+                    <property name="xscale">0</property>
+                    <property name="yscale">0</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox23">
+                        <property name="visible">True</property>
+                        <property name="spacing">2</property>
+                        <child>
+                          <widget class="GtkImage" id="image358">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-execute</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label22">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">_Build</property>
+                            <property name="use_underline">True</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="cleanButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="response_id">0</property>
+                <child>
+                  <widget class="GtkAlignment" id="alignment15">
+                    <property name="visible">True</property>
+                    <property name="xscale">0</property>
+                    <property name="yscale">0</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox24">
+                        <property name="visible">True</property>
+                        <property name="spacing">2</property>
+                        <child>
+                          <widget class="GtkImage" id="image359">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-clear</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label23">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">C_lean</property>
+                            <property name="use_underline">True</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">4</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="publishButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="response_id">0</property>
+                <child>
+                  <widget class="GtkAlignment" id="alignment16">
+                    <property name="visible">True</property>
+                    <property name="xscale">0</property>
+                    <property name="yscale">0</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox25">
+                        <property name="visible">True</property>
+                        <property name="spacing">2</property>
+                        <child>
+                          <widget class="GtkImage" id="image907">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-convert</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label24">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Publish</property>
+                            <property name="use_underline">True</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">5</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="graphButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="response_id">0</property>
+                <child>
+                  <widget class="GtkAlignment" id="alignment17">
+                    <property name="visible">True</property>
+                    <property name="xscale">0</property>
+                    <property name="yscale">0</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox26">
+                        <property name="visible">True</property>
+                        <property name="spacing">2</property>
+                        <child>
+                          <widget class="GtkImage" id="image908">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-zoom-fit</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label27">
+                            <property name="visible">True</property>
+                            <property name="label" translatable="yes">Graph</property>
+                            <property name="use_underline">True</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">6</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="closeButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label">gtk-close</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">7</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+  <widget class="GtkDialog" id="DisambiguationErrors">
+    <property name="width_request">450</property>
+    <property name="height_request">400</property>
+    <property name="title" translatable="yes">title</property>
+    <property name="modal">True</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="vbox14">
+        <property name="visible">True</property>
+        <child>
+          <widget class="GtkVBox" id="vbox15">
+            <property name="visible">True</property>
+            <child>
+              <widget class="GtkLabel" id="disambiguationErrorsLabel">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">some informative message here ...</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkScrolledWindow" id="scrolledwindow12">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                <property name="shadow_type">GTK_SHADOW_IN</property>
+                <child>
+                  <widget class="GtkTreeView" id="treeview">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="headers_visible">False</property>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="hbuttonbox2">
+            <property name="visible">True</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <widget class="GtkButton" id="button6">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-help</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">-11</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkButton" id="disambiguationErrorsMoreErrors">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="response_id">-6</property>
+                <child>
+                  <widget class="GtkAlignment" id="alignment18">
+                    <property name="visible">True</property>
+                    <property name="xscale">0</property>
+                    <property name="yscale">0</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox29">
+                        <property name="visible">True</property>
+                        <property name="spacing">2</property>
+                        <child>
+                          <widget class="GtkImage" id="image926">
+                            <property name="visible">True</property>
+                            <property name="stock">gtk-zoom-in</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label28">
+                            <property name="visible">True</property>
+                            <property name="label">More</property>
+                            <property name="use_underline">True</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="disambiguationErrorsCancelButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="label">gtk-cancel</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">-6</property>
+              </widget>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="disambiguationErrorsOkButton">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-ok</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">-5</property>
+              </widget>
+              <packing>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+  <widget class="GtkWindow" id="AutoWin">
+    <property name="width_request">600</property>
+    <property name="height_request">400</property>
+    <property name="visible">True</property>
+    <property name="title" translatable="yes">Auto</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+    <property name="gravity">GDK_GRAVITY_SOUTH_EAST</property>
+    <child>
+      <widget class="GtkVBox" id="vbox17">
+        <property name="visible">True</property>
+        <child>
+          <widget class="GtkHBox" id="hbox30">
+            <property name="visible">True</property>
+            <property name="spacing">2</property>
+            <child>
+              <widget class="GtkScrolledWindow" id="scrolledwindowAREA">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                <property name="shadow_type">GTK_SHADOW_IN</property>
+                <child>
+                  <widget class="GtkViewport" id="viewportAREA">
+                    <property name="visible">True</property>
+                    <child>
+                      <widget class="GtkTable" id="table">
+                        <property name="visible">True</property>
+                        <property name="n_rows">3</property>
+                        <property name="n_columns">3</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkVBox" id="vbox18">
+                <property name="visible">True</property>
+                <child>
+                  <widget class="GtkButton" id="buttonUP">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="response_id">0</property>
+                    <child>
+                      <widget class="GtkAlignment" id="alignment19">
+                        <property name="visible">True</property>
+                        <property name="xscale">0</property>
+                        <property name="yscale">0</property>
+                        <child>
+                          <widget class="GtkHBox" id="hbox31">
+                            <property name="visible">True</property>
+                            <property name="spacing">2</property>
+                            <child>
+                              <widget class="GtkImage" id="image1066">
+                                <property name="visible">True</property>
+                                <property name="stock">gtk-go-up</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="label30">
+                                <property name="visible">True</property>
+                                <property name="use_underline">True</property>
+                              </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="buttonDOWN">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="response_id">0</property>
+                    <child>
+                      <widget class="GtkImage" id="image1065">
+                        <property name="visible">True</property>
+                        <property name="stock">gtk-go-down</property>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+        </child>
+        <child>
+          <widget class="GtkHSeparator" id="hseparator3">
+            <property name="visible">True</property>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="padding">3</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkHBox" id="hbox32">
+            <property name="visible">True</property>
+            <child>
+              <widget class="GtkLabel" id="labelLAST">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Last:</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkHButtonBox" id="hbuttonbox3">
+                <property name="visible">True</property>
+                <property name="border_width">4</property>
+                <property name="spacing">4</property>
+                <property name="layout_style">GTK_BUTTONBOX_END</property>
+                <child>
+                  <widget class="GtkButton" id="buttonPAUSE">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="can_default">True</property>
+                    <property name="label">gtk-media-pause</property>
+                    <property name="use_stock">True</property>
+                    <property name="response_id">0</property>
+                  </widget>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="buttonPLAY">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="can_default">True</property>
+                    <property name="label">gtk-media-play</property>
+                    <property name="use_stock">True</property>
+                    <property name="response_id">0</property>
+                  </widget>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="buttonNEXT">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="can_default">True</property>
+                    <property name="label">gtk-media-next</property>
+                    <property name="use_stock">True</property>
+                    <property name="response_id">0</property>
+                  </widget>
+                  <packing>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkButton" id="buttonCLOSE">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="can_default">True</property>
+                    <property name="label">gtk-close</property>
+                    <property name="use_stock">True</property>
+                    <property name="response_id">0</property>
+                  </widget>
+                  <packing>
+                    <property name="position">3</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
+</glade-interface>
diff --git a/matita/matita.gtkrc b/matita/matita.gtkrc
new file mode 100644 (file)
index 0000000..91081c3
--- /dev/null
@@ -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 "<ctrl>b" { "move-cursor" (logical-positions, -1, 0) }
+  bind "<shift><ctrl>b" { "move-cursor" (logical-positions, -1, 1) }
+  bind "<ctrl>f" { "move-cursor" (logical-positions, 1, 0) }
+  bind "<shift><ctrl>f" { "move-cursor" (logical-positions, 1, 1) }
+
+  bind "<alt>b" { "move-cursor" (words, -1, 0) }
+  bind "<shift><alt>b" { "move-cursor" (words, -1, 1) }
+  bind "<alt>f" { "move-cursor" (words, 1, 0) }
+  bind "<shift><alt>f" { "move-cursor" (words, 1, 1) }
+
+  bind "<ctrl>a" { "move-cursor" (paragraph-ends, -1, 0) }
+  bind "<shift><ctrl>a" { "move-cursor" (paragraph-ends, -1, 1) }
+  bind "<ctrl>e" { "move-cursor" (paragraph-ends, 1, 0) }
+  bind "<shift><ctrl>e" { "move-cursor" (paragraph-ends, 1, 1) }
+
+  bind "<ctrl>w" { "cut-clipboard" () }
+  bind "<ctrl>y" { "paste-clipboard" () }
+
+  bind "<ctrl>d" { "delete-from-cursor" (chars, 1) }
+  bind "<alt>d" { "delete-from-cursor" (word-ends, 1) }
+  bind "<ctrl>k" { "delete-from-cursor" (paragraph-ends, 1) }
+  bind "<alt>backslash" { "delete-from-cursor" (whitespace, 1) }
+
+  bind "<alt>space" { "delete-from-cursor" (whitespace, 1)
+                      "insert-at-cursor" (" ") }
+  bind "<alt>KP_Space" { "delete-from-cursor" (whitespace, 1)
+                         "insert-at-cursor" (" ")  }
+
+  #
+  # Some non-Emacs keybindings people are attached to
+  #
+  bind "<ctrl>u" {
+     "move-cursor" (paragraph-ends, -1, 0)
+     "delete-from-cursor" (paragraph-ends, 1)
+  }
+  bind "<ctrl>h" { "delete-from-cursor" (chars, -1) }
+  bind "<ctrl>w" { "delete-from-cursor" (word-ends, -1) }
+}
+
+#
+# Bindings for GtkTextView
+#
+binding "gtk-emacs-text-view"
+{
+#  bind "<ctrl>p" { "move-cursor" (display-lines, -1, 0) }
+  bind "<shift><ctrl>p" { "move-cursor" (display-lines, -1, 1) }
+#  bind "<ctrl>n" { "move-cursor" (display-lines, 1, 0) }
+  bind "<shift><ctrl>n" { "move-cursor" (display-lines, 1, 1) }
+
+  bind "<ctrl>space" { "set-anchor" () }
+  bind "<ctrl>KP_Space" { "set-anchor" () }
+}
+
+#
+# Bindings for GtkTreeView
+#
+binding "gtk-emacs-tree-view"
+{
+  bind "<ctrl>s" { "start-interactive-search" () }
+  bind "<ctrl>f" { "move-cursor" (logical-positions, 1) }
+  bind "<ctrl>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 (file)
index 0000000..5f2c09b
--- /dev/null
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<language _name="grafite" version="1.0" _section="Sources" mimetypes="text/x-matita">
+
+  <escape-char>\</escape-char>
+
+  <block-comment _name = "Commented Code" style = "Comment">
+    <start-regex>\(\*\*[^\)]</start-regex>
+    <end-regex>[^\(]\*\*\)</end-regex>
+  </block-comment>
+
+  <block-comment _name = "Block Comment" style = "Comment">
+    <start-regex>\(\*</start-regex>
+    <end-regex>\*\)</end-regex>
+  </block-comment>
+
+  <keyword-list _name = "Theorem Kinds" style = "Keyword" case-sensitive="TRUE">
+    <keyword>theorem</keyword>
+    <keyword>definition</keyword>
+    <keyword>lemma</keyword>
+    <keyword>fact</keyword>
+    <keyword>remark</keyword>
+    <keyword>variant</keyword>
+    <keyword>axiom</keyword>
+  </keyword-list>
+    
+  <keyword-list _name = "Commands" style = "Keyword" case-sensitive="TRUE">
+    <keyword>alias</keyword>
+    <keyword>and</keyword>
+    <keyword>as</keyword>
+    <keyword>coercion</keyword>
+    <keyword>nocomposites</keyword>
+    <keyword>coinductive</keyword>
+    <keyword>corec</keyword>
+    <keyword>default</keyword>
+    <keyword>for</keyword>
+    <keyword>include</keyword>
+    <keyword>include'</keyword>
+    <keyword>inductive</keyword>
+    <keyword>in</keyword>
+    <keyword>interpretation</keyword>
+    <keyword>let</keyword>
+    <keyword>match</keyword>
+    <keyword>names</keyword>
+    <keyword>notation</keyword>
+    <keyword>on</keyword>
+    <keyword>qed</keyword>
+    <keyword>rec</keyword>
+    <keyword>record</keyword>
+    <keyword>return</keyword>
+    <keyword>to</keyword>
+    <keyword>using</keyword>
+    <keyword>with</keyword>
+  </keyword-list>
+
+  <pattern-item _name = "Command [" style = "Keyword">
+    <regex>\[</regex>
+  </pattern-item>
+  <pattern-item _name = "Command |" style = "Keyword">
+    <regex>\|</regex>
+  </pattern-item>
+  <pattern-item _name = "Command ]" style = "Keyword">
+    <regex>\]</regex>
+  </pattern-item>
+  <pattern-item _name = "Command {" style = "Keyword">
+    <regex>\{</regex>
+  </pattern-item>
+  <pattern-item _name = "Command }" style = "Keyword">
+    <regex>\}</regex>
+  </pattern-item>
+  <pattern-item _name = "Notation ast mark" style = "Keyword">
+    <regex>@</regex>
+  </pattern-item>
+  <pattern-item _name = "Notation meta mark" style = "Keyword">
+    <regex>\$</regex>
+  </pattern-item>
+
+  <keyword-list _name = "Sorts" style = "Data Type" case-sensitive="TRUE">
+    <keyword>Set</keyword>
+    <keyword>Prop</keyword>
+    <keyword>Type</keyword>
+  </keyword-list>
+
+  <keyword-list _name = "Tactics" style = "Others 2" case-sensitive="TRUE">
+    <keyword>absurd</keyword>
+    <keyword>apply</keyword>
+    <keyword>assumption</keyword>
+    <keyword>autobatch</keyword>
+    <keyword>cases</keyword>
+    <keyword>clear</keyword>
+    <keyword>clearbody</keyword>
+    <keyword>change</keyword>
+    <keyword>compose</keyword>
+    <keyword>constructor</keyword>
+    <keyword>contradiction</keyword>
+    <keyword>cut</keyword>
+    <keyword>decompose</keyword>
+    <keyword>destruct</keyword>
+    <keyword>elim</keyword>
+    <keyword>elimType</keyword>
+    <keyword>exact</keyword>
+    <keyword>exists</keyword>
+    <keyword>fail</keyword>
+    <keyword>fold</keyword>
+    <keyword>fourier</keyword>
+    <keyword>fwd</keyword>
+    <keyword>generalize</keyword>
+    <keyword>id</keyword>
+    <keyword>intro</keyword>
+    <keyword>intros</keyword>
+    <keyword>inversion</keyword>
+    <keyword>lapply</keyword>
+    <keyword>linear</keyword>
+    <keyword>left</keyword>
+    <keyword>letin</keyword>
+    <keyword>normalize</keyword>
+    <keyword>reduce</keyword>
+    <keyword>reflexivity</keyword>
+    <keyword>replace</keyword>
+    <keyword>rewrite</keyword>
+    <keyword>ring</keyword>
+    <keyword>right</keyword>
+    <keyword>symmetry</keyword>
+    <keyword>simplify</keyword>
+    <keyword>split</keyword>
+    <keyword>to</keyword>
+    <keyword>transitivity</keyword>
+    <keyword>unfold</keyword>
+    <keyword>whd</keyword>
+    <keyword>assume</keyword>
+    <keyword>suppose</keyword>
+    <keyword>by</keyword>
+    <keyword>is</keyword>
+    <keyword>or</keyword>
+    <keyword>equivalent</keyword>
+    <keyword>equivalently</keyword>
+    <keyword>we</keyword> 
+    <keyword>prove</keyword>
+    <keyword>proved</keyword>
+    <keyword>need</keyword>
+    <keyword>proceed</keyword>
+    <keyword>induction</keyword>
+    <keyword>inductive</keyword>
+    <keyword>case</keyword>
+    <keyword>base</keyword>
+    <keyword>let</keyword>
+    <keyword>such</keyword>
+    <keyword>that</keyword>
+    <keyword>by</keyword>
+    <keyword>have</keyword>
+    <keyword>and</keyword>
+    <keyword>the</keyword>
+    <keyword>thesis</keyword>
+    <keyword>becomes</keyword>
+    <keyword>hypothesis</keyword>
+    <keyword>know</keyword>
+    <keyword>case</keyword>             
+    <keyword>obtain</keyword>           
+    <keyword>conclude</keyword>                 
+    <keyword>done</keyword>             
+</keyword-list>
+
+  <keyword-list _name = "Tacticals" style = "Keyword" case-sensitive="TRUE">
+    <keyword>try</keyword>
+    <keyword>solve</keyword>
+    <keyword>do</keyword>
+    <keyword>repeat</keyword>
+    <keyword>first</keyword>
+    <keyword>focus</keyword>
+    <keyword>unfocus</keyword>
+    <keyword>progress</keyword>
+    <keyword>skip</keyword>
+  </keyword-list>
+
+
+  <keyword-list _name = "Matita Macro" style = "Others 3" case-sensitive="TRUE">
+    <keyword>inline</keyword>
+    <keyword>procedural</keyword>
+    <keyword>check</keyword>
+    <keyword>hint</keyword>
+    <keyword>set</keyword>
+    <keyword>auto</keyword>
+  </keyword-list>
+  
+  <keyword-list _name = "Whelp Macro" style = "Others 3"
+    case-sensitive="TRUE" 
+    beginning-regex="whelp *" 
+    match-empty-string-at-beginning="FALSE"
+    match-empty-string-at-end="FALSE" >
+    <keyword>elim</keyword>
+    <keyword>hint</keyword>
+    <keyword>instance</keyword>
+    <keyword>locate</keyword>
+    <keyword>match</keyword>
+  </keyword-list>
+    
+  <keyword-list _name = "TeX Macro" style = "Preprocessor" 
+    case-sensitive="TRUE" 
+    beginning-regex="\\" 
+    match-empty-string-at-beginning="FALSE"
+    match-empty-string-at-end="FALSE" >
+     <keyword>def</keyword>
+     <keyword>forall</keyword>
+     <keyword>lambda</keyword>
+     <keyword>to</keyword>
+     <keyword>exists</keyword>
+     <keyword>Rightarrow</keyword>
+     <keyword>Assign</keyword>
+     <keyword>land</keyword>
+     <keyword>lor</keyword>
+     <keyword>lnot</keyword>
+     <keyword>liff</keyword>
+     <keyword>subst</keyword>
+     <keyword>vdash</keyword>
+     <keyword>iforall</keyword>
+     <keyword>iexists</keyword>
+  </keyword-list>
+
+  <string _name = "String" style = "String" >
+    <start-regex>&quot;</start-regex>
+    <end-regex>&quot;</end-regex>
+  </string>
+</language>
diff --git a/matita/matita.ma.templ b/matita/matita.ma.templ
new file mode 100644 (file)
index 0000000..ec1bc80
--- /dev/null
@@ -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 (file)
index 0000000..60b112d
--- /dev/null
@@ -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 (file)
index 0000000..378fa5a
--- /dev/null
@@ -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:
+  >      <keyword>iforall</keyword>
+  >      <keyword>iexists</keyword>
+
+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 <stato, statement>. 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 (file)
index 0000000..c7b0664
--- /dev/null
@@ -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:("<span stretch=\"ultracondensed\">" ^ string_of_int n ^ "<sub>(" ^
+             string_of_int id ^ "|" ^ string_of_int k ^ ")</sub></span>") 
+    ~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 (file)
index 0000000..6715298
--- /dev/null
@@ -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 (file)
index 0000000..74c857c
--- /dev/null
@@ -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 (file)
index 0000000..83b549e
--- /dev/null
@@ -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 (file)
index 0000000..8888b8d
--- /dev/null
@@ -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\" \"<uri>\".' 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 (file)
index 0000000..419b04c
--- /dev/null
@@ -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 (file)
index 0000000..9c00dfd
--- /dev/null
@@ -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 (file)
index 0000000..0f78a4a
--- /dev/null
@@ -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 (file)
index 0000000..1b1c136
--- /dev/null
@@ -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.\n<i>Should I generate it?</i>"
+           (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 <b>unsaved</b>!\n\n"^
+         "<i>Do you want to save the script before continuing?</i>")
+    ()
+
+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 :> <check_widgets: unit -> 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 ^ "<b>" ^ str2 ^ "</b>" ^ 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 (file)
index 0000000..388c79e
--- /dev/null
@@ -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 (file)
index 0000000..67d4310
--- /dev/null
@@ -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 (file)
index 0000000..e9d447c
--- /dev/null
@@ -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, "<path::uri> forces the baseuri of path";
+        "-I", Arg.String (add_l includes),
+          ("<path> Adds path to the list of searched paths for the "
+           ^ "include command");
+        "-conffile", Arg.Set_string conffile,
+          (Printf.sprintf ("<filename> 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 (file)
index 0000000..ac0dc6a
--- /dev/null
@@ -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 (file)
index 0000000..23f5782
--- /dev/null
@@ -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.
+   * <m:mi xlink:href="...">bool</m:mi> *)
+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
+    (* <statusbar ctxt, statusbar msg> *)
+
+  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>%s</s>" (aux m)
+    | `Current m -> sprintf "<b>%s</b>" (aux m)
+    | `Shift (pos, m) -> sprintf "|<sub>%d</sub>: %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 (file)
index 0000000..ea0c077
--- /dev/null
@@ -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 (file)
index 0000000..bb745f7
--- /dev/null
@@ -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 (file)
index 0000000..b912756
--- /dev/null
@@ -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 (file)
index 0000000..182f6e1
--- /dev/null
@@ -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 <b>" ^ name ^ "</b>.\n\n" ^
+      "<i>Should I compile it and Its dependencies?</i>"
+    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 <b>not</b> handled by a development.\n" ^
+     "All dependencies are automatically solved for a development.\n\n" ^
+     "<i>Do you want to set up a development?</i>"
+    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 (file)
index 0000000..2dd58b5
--- /dev/null
@@ -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 (file)
index 0000000..23d0d83
--- /dev/null
@@ -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 (file)
index 0000000..c71c99d
--- /dev/null
@@ -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 (file)
index 0000000..3c5607b
--- /dev/null
@@ -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 -> "<div style='color:blue'>Debug: " ^ msg ^ "</div><br/>\n"
+       | `Message -> "<div style='color:green'>Info: " ^ msg ^ "</div><br/>\n"
+       | `Warning -> "<div style='color:yellow'>Warn: " ^ msg ^ "</div><br/>\n"
+       | `Error -> "<div style='color:red'>Error: " ^ msg ^ "</div><br/>\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 (file)
index 0000000..179a0ba
--- /dev/null
@@ -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 = "<filename> Dump source with expanded macros to <filename>" 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 (file)
index 0000000..3cb8ae4
--- /dev/null
@@ -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 "\e[0;32mOK\e[0m" else "\e[0;31mFAIL\e[0m" 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 (file)
index 0000000..5e8a263
--- /dev/null
@@ -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 (file)
index 0000000..5425a22
--- /dev/null
@@ -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 (file)
index 0000000..45d57a8
--- /dev/null
@@ -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 (file)
index 0000000..f6ea9da
--- /dev/null
@@ -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,
+      "<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 (file)
index 0000000..45d57a8
--- /dev/null
@@ -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 (file)
index 0000000..ad43687
--- /dev/null
@@ -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 (file)
index 0000000..47ea2fe
--- /dev/null
@@ -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 (file)
index 0000000..499d0ea
--- /dev/null
@@ -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 "\e\\[[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 (file)
index 0000000..8f6fda2
--- /dev/null
@@ -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 (file)
index 0000000..7a6503a
--- /dev/null
@@ -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 (file)
index 0000000..e0b9cbf
--- /dev/null
@@ -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 (file)
index 0000000..0aba1e9
--- /dev/null
@@ -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 (file)
index 0000000..dfb6403
--- /dev/null
@@ -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 (executable)
index 0000000..da46675
--- /dev/null
@@ -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 (file)
index 0000000..831fbbd
--- /dev/null
@@ -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 (file)
index 0000000..2a49a2d
--- /dev/null
@@ -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 (executable)
index 0000000..0d07675
--- /dev/null
@@ -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 (file)
index 0000000..c44a1e4
--- /dev/null
@@ -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 (file)
index 0000000..06cb816
--- /dev/null
@@ -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 <<EOT
+
+    Unable to calculate total time amounts:
+    
+      `printf "$SQLQTIME" "$MARK"`
+      
+    or
+
+      `printf "$SQLQTIME" "$LASTMARK"`
+      
+    gave an empty result
+    
+EOT
+fi
+
+((DELTA= $CUR_TIME - $OLD_TIME))
+if [ "$DELTA" -lt 0 ]; then
+  PERC=0
+else
+  PERC=`lua5.1 scripts/functions.lua proportion $DELTA x $OLD_TIME 100`
+fi
+if [ "$PERC" -ge 5 ]; then
+  cat <<EOT
+  
+  Performance loss detected (MARK $MARK vs MARK $LASTMARK)
+  
+  Is: `lua5.1 scripts/functions.lua t2s $CUR_TIME` 
+  Was: `lua5.1 scripts/functions.lua t2s $OLD_TIME`
+  
+  For details: $URL
+EOT
+fi
+
+#check for more broken tests
+CUR_FAIL=`printf "$SQLQFAILCOUNT" "$MARK" | $MYSQL | tail -n 1`
+OLD_FAIL=`printf "$SQLQFAILCOUNT" "$LASTMARK" | $MYSQL | tail -n 1`
+
+if [ "$CUR_FAIL" -gt "$OLD_FAIL" ]; then
+  TMP1=`mktemp`
+  TMP2=`mktemp`
+  TMP3=`mktemp`
+  printf "$SQLQFAIL" "$MARK" | $MYSQL > $TMP1
+  printf "$SQLQFAIL" "$LASTMARK" | $MYSQL > $TMP2
+  combine $TMP1 not $TMP2 > $TMP3
+
+  cat <<EOT
+
+  More broken tests detected (MARK $MARK vs MARK $LASTMARK)
+  Is: $CUR_FAIL
+  Was: $OLD_FAIL 
+
+  Tests that are broken in $MARK but where not broken in $LASTMARK:
+`cat $TMP3`
+
+  List of broken tests in mark $MARK: 
+`cat $TMP1`
+
+  List of broken tests in old mark $LASTMARK:
+`cat $TMP2`
+  
+  For details: $URL
+EOT
+
+  rm $TMP1 $TMP2 $TMP3
+fi
+
+cd $OLD
+#rm -rf $TMPDIRNAME
+
diff --git a/matita/scripts/functions.lua b/matita/scripts/functions.lua
new file mode 100755 (executable)
index 0000000..e6935fb
--- /dev/null
@@ -0,0 +1,101 @@
+#!/usr/bin/lua5.1
+
+local tool_re = "^([%w%.]+)"
+local test_re = "([%w%./_-]+)"
+local rc_re = string.char(27).."%[%d+;%d+m([%a]+)"..string.char(27).."%[0m"
+local time_re = "(%d+m%d+%.%d+s)"
+local mark_re = "(%d+)"
+local opt_re = "(gc%-%a+)$"
+local sep = "%s+"
+
+local fmt = "INSERT bench "..
+       "(result, compilation, test, time, timeuser, mark, options) "..
+       "VALUES ('%s', '%s', '%s', %d, %d, '%s', '%s');\n"
+
+-- build the huge regex
+local re = tool_re .. sep .. test_re .. sep .. rc_re .. sep .. 
+       time_re .. sep ..time_re .. sep ..time_re .. sep .. 
+       mark_re .. sep .. opt_re 
+
+-- the string to cents of seconds function
+function s2t(s)
+       local _,_,min,sec,cents = string.find(s,"(%d+)m(%d+)%.(%d+)s")
+       return min * 6000 + sec * 100 + cents
+end
+function t2s(s)
+  s = tonumber(s)
+  local min, sec, cents
+  cents = s % 100
+  min = math.floor(s / 6000)
+  sec = math.floor((s - min * 6000 - cents) / 100)
+  return string.format("%dm%02d.%02ds",min,sec,cents)
+end
+
+-- logfile to sql conversion
+function log2sql(file)
+local t = {}
+local f = io.stdin
+if file ~= "-" then 
+       f = io.open(file,"r")
+end
+for l in f:lines() do
+       local x,_,tool,test,rc,real,user,_,mark,opt = string.find(l,re)
+
+       if x == nil then
+    error("regex failed on '"..l.."'")
+       end
+
+       -- check the result is valid
+       if tool ~= "matitac" and tool ~= "matitac.opt" then
+               error("unknown tool " .. tool)
+       else
+               if tool == "matitac" then tool = "byte" else tool = "opt" end
+       end
+       if rc ~= "OK" and rc ~= "FAIL" then
+               error("unknown result " .. rc)
+       else
+               rc = string.lower(rc)
+       end
+       if opt ~= "gc-on" and opt ~= "gc-off" then
+               error("unknown option "..opt)
+       end
+       real = s2t(real)
+       user = s2t(user)
+
+       -- print the sql statement
+       table.insert(t,string.format(fmt,rc,tool,test,real,user,mark,opt))
+end
+return table.concat(t)
+end
+
+-- proportions
+function proportion(x,y,a,b)
+  local rc
+  if x == "x" then
+    rc = y * a / b
+  elseif y == "x" then
+    rc = x * b / a
+  elseif a == "x" then
+    rc = x * b / y
+  elseif b == "x" then
+    rc = y * a / x
+  end
+  return string.format("%d",rc)
+end
+
+-- conversion from the old db to the new one
+function convertsql(file)
+  local f = io.open(file)
+  return string.gsub(f:read("*a"),time_re,
+    function(s)
+      return s2t(s)
+    end)
+end
+
+-- call the desired function and print the result
+fun = arg[1]
+table.remove(arg,1)
+f = _G[fun] or error("no " .. fun .. " defined")
+print(f(unpack(arg)) or "")
+
+-- eof
diff --git a/matita/scripts/profile_svn.sh b/matita/scripts/profile_svn.sh
new file mode 100755 (executable)
index 0000000..72105b2
--- /dev/null
@@ -0,0 +1,79 @@
+#!/bin/bash
+
+#configuration
+MARK=`date +%Y%m%d%H%M`
+TMPDIRNAME=__${MARK}_compilation
+SVNROOT="svn+ssh://mowgli.cs.unibo.it/local/svn/helm/trunk/"
+MYSQL="mysql -u helm -h mowgli.cs.unibo.it matita"
+SVNLOG=LOG.svn
+
+#helpers
+function testit {
+  LOGTOOPT=/dev/null
+  LOGTOBYTE=/dev/null
+  export BENCH_EXTRA_TEXT="$MARK $@"
+  make tests 
+  make tests.opt 
+}
+
+function compile {
+  LOCALOLD=$PWD
+  cd $1
+  autoconf 1>/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 (file)
index 0000000..1009ace
--- /dev/null
@@ -0,0 +1,430 @@
+<?php require("common.php"); 
+  
+// syntax
+//
+// queries ::= query | query "###" queries
+// query ::= name "@@@" sql
+//
+$limits = array("20","50","100");
+
+$query_last_mark = "select mark from bench order by mark desc limit 1;";
+$last_mark = "";
+function set_last_mark($a) {
+ global $last_mark;
+ foreach ($a as $k => $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 "<li>$name :&nbsp;&nbsp;&nbsp;";
+  if (strpos($q, urlencode("***")) === false) {
+    echo "<a href=\"showquery.php?query=$q;\">all</a>";
+  } else {
+    foreach($limits as $l) {
+      $q1 = str_replace(urlencode("***"), " LIMIT 0,$l", $q);
+      echo "<a href=\"showquery.php?query=$q1;\">" . 
+            minus1_to_all($l) . "</a>&nbsp;&nbsp;";
+    }
+      $q1 = str_replace(urlencode("***"), " ", $q);
+      echo "<a href=\"showquery.php?query=$q1;\">" . 
+            minus1_to_all("-1") . "</a>&nbsp;&nbsp;";
+  }
+  echo "</li>";
+}
+
+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 "<pre>";
+ foreach ($res as $k => $v) { echo "$v\n"; }
+ echo "</pre>";
+}
+
+?>
+
+<html>
+  <head>
+  <link type="text/css" rel="stylesheet" href="style.css"/>
+  </head>
+  <body>
+    <h1>QUERY the benchmark system</h1>
+    <h2>Last Commits</h2>
+    <? last_commits() ?>
+    <h2>Common Queries</h2>
+    <p>
+      <ul>
+      <? links_of("Broken tests",$query_fail,$limits) ?>
+      <? links_of("Time diff",$query_time_diff,$limits) ?>
+      <? links_of("Result diff",$query_result_diff,$limits) ?>
+      <? links_of("Garbage collector killer",$query_gc,$limits) ?>
+      <? links_of("Auto performances",$query_auto,$limits) ?>
+      <? links_of("Global performances",$query_csc,$limits) ?>
+      <? links_of("Number of compiled tests",$query_total,$limits) ?>
+      <? links_of("All table contents",$quey_all,$limits) ?>
+      </ul>
+    </p>
+    <h2>Custom Query - Simple Interface</h2>
+    <form action="composequery.php" method="get">
+    <table>
+  <tr>
+    <td>Marks:</td>
+    <td> 
+      <select name="mark">";
+        <option value="--">--</option>";
+        <?query("select distinct mark from bench order by mark desc;",
+            "array_to_combo");?>
+      </select>      
+    </td>
+  </tr>
+  <tr>
+    <td>Compilations:</td>
+    <td> 
+      <select name="compilation">";
+        <option value="--">--</option>";
+          <?query("select distinct compilation from bench;","array_to_combo");?>
+      </select>      
+    </td>
+  </tr>
+  <tr>
+    <td>Options:</td>
+    <td>  
+      <select name="options">";
+        <option value="--">--</option>";
+          <?query("select distinct options from bench;","array_to_combo");?>
+      </select>      
+    </td>
+  </tr>
+  <tr>
+    <td>Tests:</td>
+    <td>    
+      <select name="test">";
+        <option value="--">--</option>";
+          <?query("select distinct test from bench order by test;","array_to_combo");?>
+      </select>      
+    </td>
+  </tr>
+  <tr>
+    <td>Test results:</td>
+    <td>
+      <select name="result">";
+        <option value="--">--</option>";
+          <?query("select distinct result from bench;","array_to_combo"); ?>
+      </select>      
+    </td>
+  </tr>
+  <tr>
+    <td>Group By: </td>
+    <td>
+      <select name="groupby">";
+        <option value="--">--</option>";
+        <? array_to_combo(array("mark"));array_to_combo(array("options")); ?>
+      </select>      
+    </td>
+  </tr>
+  <tr>
+    <td>Limit: </td>
+    <td>
+      <select name="limit">";
+        <option value="--">--</option>";
+      <? foreach(array($limits) as $l) {array_to_combo($l);} ?>
+      </select>      
+    </td>
+  </tr>
+  <tr>
+    <td><input type="submit" value="Submit" class="button" /></td>
+  </tr>
+ </table>
+</form>
+<h2>Custom Query - raw SQL</h2>
+<form action="showquery.php" method="get">
+<table>
+<tr><td>'bench' table description:</td></tr>
+</tr>
+<? query("describe bench","printer"); $i=0; ?>
+</tr>
+<tr><td></td></tr>
+<tr><td></td></tr>
+<tr><td>'bench_svn' table description:</td></tr>
+</tr>
+<? query("describe bench_svn","printer"); $i=0; ?>
+</tr>
+<tr><td></td></tr>
+<tr><td colspan="7">
+SQL (only one query, ';' if present must terminate the query, no characters allowed after it):</td></tr>
+<tr><td colspan="7">
+<textarea rows="10" cols="120" name="query"/>
+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 = '<?php echo $before_last_mark ?>' and b2.mark= '<?php echo $last_mark ?>' and
+  ABS(b2.timeuser - b1.timeuser) &lt; 100
+order by diff desc;
+</textarea>
+</td>
+</tr>
+<tr><td>
+<input type="submit" value="Submit" class="button" /></td>
+</tr>
+</table>
+</form>
+
+</body>
+</html>
diff --git a/matita/scripts/public_html/common.php b/matita/scripts/public_html/common.php
new file mode 100644 (file)
index 0000000..d56c9d4
--- /dev/null
@@ -0,0 +1,80 @@
+<?php
+
+$i = 0;
+  
+function array_to_combo($a) {
+  foreach($a as $k => $v){
+    echo "<option value=\"{$v}\">{$v}</option>";
+  }
+}
+
+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 "<tr>";
+  if ( $i == 0) {
+      foreach( $q as $name => $txt) {
+          echo "<th>$name</th>";
+      }
+  }
+  echo "</tr>\n";
+  if ( $i%2 == 0)
+     echo "<tr class=\"even\">";      
+  else
+     echo "<tr class=\"odd\">";
+  foreach( $q as $name => $txt) {
+     echo "<td>" . prettify($txt,$name) . "</td>";
+  }
+  echo "</tr>\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!<pre>" . $q . "</pre>");
+    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 (file)
index 0000000..1c7366d
--- /dev/null
@@ -0,0 +1,46 @@
+<?php require("common.php"); 
+  
+  $c = array("mark", "options", "test", "result", "compilation");
+
+  function clause_for($c) {
+    $fst = true;
+    $rc = "";
+    foreach($c as $fake => $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 (file)
index 0000000..12fd7be
--- /dev/null
@@ -0,0 +1,15 @@
+<?php require("common.php"); ?>
+
+<html>
+  <head>
+  <link type="text/css" rel="stylesheet" href="style.css"/>
+  </head>
+  <body>
+    <h1>MATITA BENCHMARKING SYSTEM</h1>
+    <p> 
+    <center> <!-- Yes, It sucks! :P -->
+      <a href="bench.php">Go to the benchmark query page</a>
+    </center>
+    </p>
+  </body>
+</html>
diff --git a/matita/scripts/public_html/showquery.php b/matita/scripts/public_html/showquery.php
new file mode 100644 (file)
index 0000000..dfa0b47
--- /dev/null
@@ -0,0 +1,35 @@
+<?php require("common.php"); 
+
+  $query = stripslashes($_GET['query']);
+
+  $nqs = explode('###',$query);
+
+  $qs = array();
+  foreach($nqs as $v){
+    $x = explode("@@@",$v);
+    if ($x[1] == NULL) {
+      $qs["Unnamed"] = $x[0];
+    } else {
+      $qs[$x[0]] = $x[1];
+    }
+  }
+
+?>
+<html>
+  <head>
+  <link type="text/css" rel="stylesheet" href="style.css"/>
+  </head>
+  <body>
+    <h1>QUERY results</h1>
+<? foreach( $qs as $name => $q) { $i=0;?>
+    <h2><? echo $name; ?></h2>
+    <p>
+    <tt><? echo $q; ?></tt>
+    </p>
+    <table border=1>
+    <?  query($q,"printer"); ?>
+    </table>
+<? } ?>
+    <p><a href="bench.php">BACK to the query page</a></p>
+  </body>
+</html>
diff --git a/matita/scripts/public_html/style.css b/matita/scripts/public_html/style.css
new file mode 100644 (file)
index 0000000..dc2df47
--- /dev/null
@@ -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 (file)
index 0000000..ac3e144
--- /dev/null
@@ -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 (file)
index 0000000..98b7c1f
--- /dev/null
@@ -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 (file)
index 0000000..e5d4b04
--- /dev/null
@@ -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 (file)
index 0000000..87ee6a7
--- /dev/null
@@ -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 (file)
index 0000000..a964a96
--- /dev/null
@@ -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 (file)
index 0000000..efeca01
--- /dev/null
@@ -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 (file)
index 0000000..ff3cd85
--- /dev/null
@@ -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 (file)
index 0000000..1821077
--- /dev/null
@@ -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 (file)
index 0000000..5e3def4
--- /dev/null
@@ -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 (file)
index 0000000..9bd9ce8
--- /dev/null
@@ -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 (file)
index 0000000..77ea2d7
--- /dev/null
@@ -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 (file)
index 0000000..c05bd84
--- /dev/null
@@ -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 (file)
index 0000000..ce93dc2
--- /dev/null
@@ -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 (file)
index 0000000..67631be
--- /dev/null
@@ -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 (file)
index 0000000..9517fa3
--- /dev/null
@@ -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 (file)
index 0000000..6cd030d
--- /dev/null
@@ -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 (file)
index 0000000..33f8f9a
--- /dev/null
@@ -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 (file)
index 0000000..5855e8a
--- /dev/null
@@ -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 (file)
index 0000000..3572d87
--- /dev/null
@@ -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 (file)
index 0000000..fb67030
--- /dev/null
@@ -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 (file)
index 0000000..0f538a7
--- /dev/null
@@ -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 (file)
index 0000000..f4b986a
--- /dev/null
@@ -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 (file)
index 0000000..ee7c996
--- /dev/null
@@ -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 (file)
index 0000000..5691fcf
--- /dev/null
@@ -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 (file)
index 0000000..32fe9a4
--- /dev/null
@@ -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 (file)
index 0000000..adab6c4
--- /dev/null
@@ -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 (file)
index 0000000..38bbe0e
--- /dev/null
@@ -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 (file)
index 0000000..1cddbb9
--- /dev/null
@@ -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 (file)
index 0000000..971fa23
--- /dev/null
@@ -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 (file)
index 0000000..f9a7712
--- /dev/null
@@ -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 (file)
index 0000000..655b2a2
--- /dev/null
@@ -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 (file)
index 0000000..a3ff086
--- /dev/null
@@ -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 (file)
index 0000000..45bd7de
--- /dev/null
@@ -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 (file)
index 0000000..866be51
--- /dev/null
@@ -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 (file)
index 0000000..07d594e
--- /dev/null
@@ -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 (file)
index 0000000..6e61873
--- /dev/null
@@ -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 (file)
index 0000000..fcff692
--- /dev/null
@@ -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 (file)
index 0000000..37a3765
--- /dev/null
@@ -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 (file)
index 0000000..36d03e6
--- /dev/null
@@ -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 (file)
index 0000000..e218bae
--- /dev/null
@@ -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 (file)
index 0000000..e8f9c35
--- /dev/null
@@ -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 (file)
index 0000000..a311f14
--- /dev/null
@@ -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 (file)
index 0000000..c38e405
--- /dev/null
@@ -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 (file)
index 0000000..a7fa258
--- /dev/null
@@ -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 (file)
index 0000000..df48469
--- /dev/null
@@ -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 (file)
index 0000000..a0435b2
--- /dev/null
@@ -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 (file)
index 0000000..10f25dc
--- /dev/null
@@ -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 (file)
index 0000000..5b216a3
--- /dev/null
@@ -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 (file)
index 0000000..2235cb5
--- /dev/null
@@ -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 (file)
index 0000000..da15181
--- /dev/null
@@ -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 (file)
index 0000000..d1ff7bc
--- /dev/null
@@ -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 (file)
index 0000000..81adc26
--- /dev/null
@@ -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 (file)
index 0000000..0359b3c
--- /dev/null
@@ -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 (file)
index 0000000..383a285
--- /dev/null
@@ -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 (file)
index 0000000..8b65e0c
--- /dev/null
@@ -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 (file)
index 0000000..02f91ef
--- /dev/null
@@ -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 (file)
index 0000000..70205ee
--- /dev/null
@@ -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 (file)
index 0000000..38bb353
--- /dev/null
@@ -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 (file)
index 0000000..4c98273
--- /dev/null
@@ -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 (file)
index 0000000..19fbd39
--- /dev/null
@@ -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 (file)
index 0000000..4e6d8af
--- /dev/null
@@ -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 (file)
index 0000000..5644d38
--- /dev/null
@@ -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 (file)
index 0000000..34fbe93
--- /dev/null
@@ -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 (file)
index 0000000..4148875
--- /dev/null
@@ -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 (file)
index 0000000..4d054e0
--- /dev/null
@@ -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 (file)
index 0000000..1c3ddc2
--- /dev/null
@@ -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 (file)
index 0000000..120a6d0
--- /dev/null
@@ -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 (file)
index 0000000..07591bb
--- /dev/null
@@ -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 (file)
index 0000000..89d9917
--- /dev/null
@@ -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 (file)
index 0000000..4d2d057
--- /dev/null
@@ -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 (file)
index 0000000..7fd4279
--- /dev/null
@@ -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 (file)
index 0000000..e4527c4
--- /dev/null
@@ -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 (file)
index 0000000..d4e79c7
--- /dev/null
@@ -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 (file)
index 0000000..544eaf1
--- /dev/null
@@ -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 (file)
index 0000000..b6a3f51
--- /dev/null
@@ -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 (file)
index 0000000..6391656
--- /dev/null
@@ -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 (file)
index 0000000..ed53388
--- /dev/null
@@ -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 (file)
index 0000000..db2519f
--- /dev/null
@@ -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 (file)
index 0000000..4ad3522
--- /dev/null
@@ -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 (file)
index 0000000..6c605ee
--- /dev/null
@@ -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 (file)
index 0000000..3cc4b57
--- /dev/null
@@ -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 (file)
index 0000000..8768d0e
--- /dev/null
@@ -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 (file)
index 0000000..4d01353
--- /dev/null
@@ -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 (file)
index 0000000..e108ae5
--- /dev/null
@@ -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 (file)
index 0000000..322702c
--- /dev/null
@@ -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 (file)
index 0000000..cf868c3
--- /dev/null
@@ -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 (file)
index 0000000..3706a25
--- /dev/null
@@ -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 (file)
index 0000000..1f13705
--- /dev/null
@@ -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 (file)
index 0000000..be00186
--- /dev/null
@@ -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 (file)
index 0000000..be20f19
--- /dev/null
@@ -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 (file)
index 0000000..032cdfd
--- /dev/null
@@ -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 (file)
index 0000000..6bacee1
--- /dev/null
@@ -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 (file)
index 0000000..e6c7d4f
--- /dev/null
@@ -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 (file)
index 0000000..f612ede
--- /dev/null
@@ -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 (file)
index 0000000..240c266
--- /dev/null
@@ -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 (file)
index 0000000..d9078e5
--- /dev/null
@@ -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 (file)
index 0000000..7dc86aa
--- /dev/null
@@ -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 (file)
index 0000000..5183288
--- /dev/null
@@ -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 (file)
index 0000000..7a940e5
--- /dev/null
@@ -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 (file)
index 0000000..544290f
--- /dev/null
@@ -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 (file)
index 0000000..63868e1
--- /dev/null
@@ -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 (file)
index 0000000..710c30a
--- /dev/null
@@ -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 (file)
index 0000000..ca0b0ff
--- /dev/null
@@ -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 (file)
index 0000000..1d49bce
--- /dev/null
@@ -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 (file)
index 0000000..ff4878f
--- /dev/null
@@ -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 (file)
index 0000000..4d4fa4e
--- /dev/null
@@ -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 (file)
index 0000000..3065332
--- /dev/null
@@ -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 (file)
index 0000000..9052578
--- /dev/null
@@ -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 (file)
index 0000000..8e66972
--- /dev/null
@@ -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 (file)
index 0000000..d6b6159
--- /dev/null
@@ -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 (file)
index 0000000..bd8fecc
--- /dev/null
@@ -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 (file)
index 0000000..fe03f9f
--- /dev/null
@@ -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 (file)
index 0000000..153ac58
--- /dev/null
@@ -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 (file)
index 0000000..b2166c2
--- /dev/null
@@ -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 (file)
index 0000000..f8955ab
--- /dev/null
@@ -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 (file)
index 0000000..fa4e6ce
--- /dev/null
@@ -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 (file)
index 0000000..95fb312
--- /dev/null
@@ -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 (file)
index 0000000..a395431
--- /dev/null
@@ -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 (file)
index 0000000..be8354b
--- /dev/null
@@ -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 (file)
index 0000000..da64fde
--- /dev/null
@@ -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 (file)
index 0000000..771056e
--- /dev/null
@@ -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 (file)
index 0000000..183e7b7
--- /dev/null
@@ -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 (file)
index 0000000..0b47a16
--- /dev/null
@@ -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 (file)
index 0000000..01ca783
--- /dev/null
@@ -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 (file)
index 0000000..9c5b5bc
--- /dev/null
@@ -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 (file)
index 0000000..257fdd4
--- /dev/null
@@ -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 (file)
index 0000000..deaa9a2
--- /dev/null
@@ -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 (file)
index 0000000..228a4f3
--- /dev/null
@@ -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 (file)
index 0000000..acd2050
--- /dev/null
@@ -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 (file)
index 0000000..44091f5
--- /dev/null
@@ -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 (file)
index 0000000..303f737
--- /dev/null
@@ -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 (file)
index 0000000..698ac8a
--- /dev/null
@@ -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 (file)
index 0000000..fcd04c0
--- /dev/null
@@ -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 (file)
index 0000000..1107f4b
--- /dev/null
@@ -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 (file)
index 0000000..bf063d5
--- /dev/null
@@ -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 (file)
index 0000000..e8588f9
--- /dev/null
@@ -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 (file)
index 0000000..2a015e1
--- /dev/null
@@ -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 (file)
index 0000000..ccdaf0e
--- /dev/null
@@ -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 (file)
index 0000000..a26acef
--- /dev/null
@@ -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 (file)
index 0000000..ff1c3c1
--- /dev/null
@@ -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 (file)
index 0000000..78e9587
--- /dev/null
@@ -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 (file)
index 0000000..221fdb5
--- /dev/null
@@ -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 (file)
index 0000000..e9f198d
--- /dev/null
@@ -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 (file)
index 0000000..fc0bf16
--- /dev/null
@@ -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 (file)
index 0000000..ea86306
--- /dev/null
@@ -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 (file)
index 0000000..2250284
--- /dev/null
@@ -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 (file)
index 0000000..efe2d3a
--- /dev/null
@@ -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 (file)
index 0000000..c2f5d7b
--- /dev/null
@@ -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 (file)
index 0000000..c5875b0
--- /dev/null
@@ -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 (file)
index 0000000..25618b4
--- /dev/null
@@ -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 (file)
index 0000000..1003a40
--- /dev/null
@@ -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 (file)
index 0000000..ff8c9f4
--- /dev/null
@@ -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 (file)
index 0000000..19a8c4a
--- /dev/null
@@ -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 (file)
index 0000000..03409c9
--- /dev/null
@@ -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 (file)
index 0000000..90593b6
--- /dev/null
@@ -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 (file)
index 0000000..7b526ef
--- /dev/null
@@ -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 (file)
index 0000000..af15eb7
--- /dev/null
@@ -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 (file)
index 0000000..a488717
--- /dev/null
@@ -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 (file)
index 0000000..a953ab6
--- /dev/null
@@ -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 (file)
index 0000000..ea992df
--- /dev/null
@@ -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 (file)
index 0000000..a8f428a
--- /dev/null
@@ -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 (file)
index 0000000..848748d
--- /dev/null
@@ -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 (file)
index 0000000..cfc5bab
--- /dev/null
@@ -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 (file)
index 0000000..96fb69f
--- /dev/null
@@ -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 (file)
index 0000000..302fb89
--- /dev/null
@@ -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 (file)
index 0000000..2488a94
--- /dev/null
@@ -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 (file)
index 0000000..24ede0f
--- /dev/null
@@ -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 (file)
index 0000000..a065d3f
--- /dev/null
@@ -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 (file)
index 0000000..0bf4dbf
--- /dev/null
@@ -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 (file)
index 0000000..a7482f9
--- /dev/null
@@ -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 (file)
index 0000000..3144369
--- /dev/null
@@ -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 (file)
index 0000000..9a776c9
--- /dev/null
@@ -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 (file)
index 0000000..f314261
--- /dev/null
@@ -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 (file)
index 0000000..35670d9
--- /dev/null
@@ -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 (file)
index 0000000..113f49e
--- /dev/null
@@ -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 (file)
index 0000000..dc788b1
--- /dev/null
@@ -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 (file)
index 0000000..99ea927
--- /dev/null
@@ -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 (file)
index 0000000..63b1c2d
--- /dev/null
@@ -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 (file)
index 0000000..ad4f935
--- /dev/null
@@ -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 (file)
index 0000000..71a827e
--- /dev/null
@@ -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 (file)
index 0000000..6fbd349
--- /dev/null
@@ -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 (file)
index 0000000..884ed5e
--- /dev/null
@@ -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 (file)
index 0000000..931c933
--- /dev/null
@@ -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 (file)
index 0000000..d6bdbbf
--- /dev/null
@@ -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 (file)
index 0000000..c3e517c
--- /dev/null
@@ -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 (file)
index 0000000..8076345
--- /dev/null
@@ -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 (file)
index 0000000..e6f9dfc
--- /dev/null
@@ -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 (file)
index 0000000..aed52d2
--- /dev/null
@@ -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 (file)
index 0000000..ad7c58b
--- /dev/null
@@ -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 (file)
index 0000000..7c9843d
--- /dev/null
@@ -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 (file)
index 0000000..4d729b9
--- /dev/null
@@ -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 (file)
index 0000000..d826e2a
--- /dev/null
@@ -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 (file)
index 0000000..4c09bb3
--- /dev/null
@@ -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 (file)
index 0000000..fa95c33
--- /dev/null
@@ -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 (file)
index 0000000..db36e33
--- /dev/null
@@ -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 (file)
index 0000000..f38467e
--- /dev/null
@@ -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 (file)
index 0000000..1d13edf
--- /dev/null
@@ -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 (file)
index 0000000..f678b3d
--- /dev/null
@@ -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 (file)
index 0000000..5612e27
--- /dev/null
@@ -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 (file)
index 0000000..e97f64c
--- /dev/null
@@ -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 (file)
index 0000000..1d8e313
--- /dev/null
@@ -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 (file)
index 0000000..5923b8e
--- /dev/null
@@ -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 (file)
index 0000000..133ed30
--- /dev/null
@@ -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 (file)
index 0000000..31716a7
--- /dev/null
@@ -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 (file)
index 0000000..07535f9
--- /dev/null
@@ -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 (file)
index 0000000..620ddb9
--- /dev/null
@@ -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 (file)
index 0000000..6d7b92f
--- /dev/null
@@ -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 (file)
index 0000000..9e22885
--- /dev/null
@@ -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 (file)
index 0000000..89084a0
--- /dev/null
@@ -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 (file)
index 0000000..09742e1
--- /dev/null
@@ -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 (file)
index 0000000..de59453
--- /dev/null
@@ -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 (file)
index 0000000..3dec267
--- /dev/null
@@ -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 (file)
index 0000000..206e1ed
--- /dev/null
@@ -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 (file)
index 0000000..203d3f2
--- /dev/null
@@ -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 (file)
index 0000000..2fe6234
--- /dev/null
@@ -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 (file)
index 0000000..6649a53
--- /dev/null
@@ -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 (file)
index 0000000..a8ee942
--- /dev/null
@@ -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 (file)
index 0000000..e1897a4
--- /dev/null
@@ -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 (file)
index 0000000..37ce834
--- /dev/null
@@ -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 (file)
index 0000000..8ad8654
--- /dev/null
@@ -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 (file)
index 0000000..de4e55f
--- /dev/null
@@ -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 (file)
index 0000000..a4ff6ef
--- /dev/null
@@ -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 (file)
index 0000000..0b58207
--- /dev/null
@@ -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 (file)
index 0000000..442ce59
--- /dev/null
@@ -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 (file)
index 0000000..473cf32
--- /dev/null
@@ -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 (file)
index 0000000..c310916
--- /dev/null
@@ -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 (file)
index 0000000..46cc017
--- /dev/null
@@ -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 (file)
index 0000000..158fef7
--- /dev/null
@@ -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 (file)
index 0000000..330e403
--- /dev/null
@@ -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 (file)
index 0000000..acd9538
--- /dev/null
@@ -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 (file)
index 0000000..d400f7c
--- /dev/null
@@ -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 (file)
index 0000000..9a982d8
--- /dev/null
@@ -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 (file)
index 0000000..21a3011
--- /dev/null
@@ -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 (file)
index 0000000..c5148d2
--- /dev/null
@@ -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 (file)
index 0000000..5f816e9
--- /dev/null
@@ -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 (file)
index 0000000..827b992
--- /dev/null
@@ -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 (file)
index 0000000..169be88
--- /dev/null
@@ -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 (file)
index 0000000..d5cb7fb
--- /dev/null
@@ -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 (file)
index 0000000..3d5df92
--- /dev/null
@@ -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 (file)
index 0000000..97ea2ca
--- /dev/null
@@ -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 (file)
index 0000000..32a4518
--- /dev/null
@@ -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 (file)
index 0000000..3961b05
--- /dev/null
@@ -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 (file)
index 0000000..8850280
--- /dev/null
@@ -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 (file)
index 0000000..48e8b32
--- /dev/null
@@ -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 (file)
index 0000000..534a5a9
--- /dev/null
@@ -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 (file)
index 0000000..a9cdabd
--- /dev/null
@@ -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 (file)
index 0000000..c56142d
--- /dev/null
@@ -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 (file)
index 0000000..f7df333
--- /dev/null
@@ -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 (file)
index 0000000..e69e403
--- /dev/null
@@ -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 (file)
index 0000000..49260d0
--- /dev/null
@@ -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 (file)
index 0000000..bdb4c04
--- /dev/null
@@ -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 (file)
index 0000000..afb63d9
--- /dev/null
@@ -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 (file)
index 0000000..81aabc9
--- /dev/null
@@ -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 (file)
index 0000000..e3e2ad2
--- /dev/null
@@ -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 (file)
index 0000000..76f06f1
--- /dev/null
@@ -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 (file)
index 0000000..3039f34
--- /dev/null
@@ -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 (file)
index 0000000..72fe9de
--- /dev/null
@@ -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 (file)
index 0000000..c8ac354
--- /dev/null
@@ -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 (executable)
index 0000000..54634e7
--- /dev/null
@@ -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 (file)
index 0000000..14f5524
Binary files /dev/null and b/matita/tests/TPTP/compare.ods differ
diff --git a/matita/tests/TPTP/da_indagare_perche_non_astrarre_i_letin_sulle_meta_del_body_spacca_tutto.txt b/matita/tests/TPTP/da_indagare_perche_non_astrarre_i_letin_sulle_meta_del_body_spacca_tutto.txt
new file mode 100644 (file)
index 0000000..8cdcba5
--- /dev/null
@@ -0,0 +1,8 @@
+Unsatisfiable/BOO025-1.ma
+Unsatisfiable/BOO072-1.ma
+Unsatisfiable/BOO074-1.ma
+Unsatisfiable/GRP424-1.ma
+Unsatisfiable/GRP441-1.ma
+Unsatisfiable/GRP500-1.ma
+Unsatisfiable/LAT096-1.ma
+Unsatisfiable/LAT097-1.ma
diff --git a/matita/tests/TPTP/elenco_CASC.txt b/matita/tests/TPTP/elenco_CASC.txt
new file mode 100644 (file)
index 0000000..2a4f8f0
--- /dev/null
@@ -0,0 +1,119 @@
+Unsatisfiable/BOO023-1.ma 
+Unsatisfiable/BOO073-1.ma
+Unsatisfiable/COL002-5.ma
+Unsatisfiable/COL004-1.ma
+Unsatisfiable/COL006-1.ma
+Unsatisfiable/COL006-6.ma
+Unsatisfiable/COL006-7.ma
+Unsatisfiable/COL034-1.ma
+Unsatisfiable/COL036-1.ma
+Unsatisfiable/COL041-1.ma
+Unsatisfiable/COL042-1.ma
+Unsatisfiable/COL043-3.ma
+Unsatisfiable/COL044-1.ma
+Unsatisfiable/COL044-9.ma
+Unsatisfiable/COL046-1.ma
+Unsatisfiable/COL049-1.ma
+Unsatisfiable/COL060-1.ma
+Unsatisfiable/COL061-1.ma
+Unsatisfiable/COL064-1.ma
+Unsatisfiable/COL066-1.ma
+Unsatisfiable/GRP114-1.ma
+Unsatisfiable/GRP167-4.ma
+Unsatisfiable/GRP177-2.ma
+Unsatisfiable/GRP179-1.ma
+Unsatisfiable/GRP179-2.ma
+Unsatisfiable/GRP179-3.ma
+Unsatisfiable/GRP180-1.ma
+Unsatisfiable/GRP181-1.ma
+Unsatisfiable/GRP181-3.ma
+Unsatisfiable/GRP183-1.ma
+Unsatisfiable/GRP183-3.ma
+Unsatisfiable/GRP183-4.ma
+Unsatisfiable/GRP184-1.ma
+Unsatisfiable/GRP184-3.ma
+Unsatisfiable/GRP186-1.ma
+Unsatisfiable/GRP186-2.ma
+Unsatisfiable/GRP196-1.ma
+Unsatisfiable/GRP200-1.ma
+Unsatisfiable/GRP201-1.ma
+Unsatisfiable/GRP205-1.ma
+Unsatisfiable/GRP405-1.ma
+Unsatisfiable/GRP410-1.ma
+Unsatisfiable/GRP419-10.ma
+Unsatisfiable/GRP422-1.ma 
+Unsatisfiable/GRP423-1.ma
+Unsatisfiable/GRP444-1.ma
+Unsatisfiable/GRP475-1.ma
+Unsatisfiable/GRP476-1.ma
+Unsatisfiable/GRP505-1.ma
+Unsatisfiable/GRP506-1.ma
+Unsatisfiable/GRP508-1.ma
+Unsatisfiable/LAT080-1.ma
+Unsatisfiable/LAT081-1.ma
+Unsatisfiable/LAT083-1.ma
+Unsatisfiable/LAT084-1.ma
+Unsatisfiable/LAT086-1.ma
+Unsatisfiable/LAT087-1.ma
+Unsatisfiable/LAT092-1.ma
+Unsatisfiable/LAT093-1.ma
+Unsatisfiable/LAT094-1.ma
+Unsatisfiable/LAT096-1.ma
+Unsatisfiable/LAT145-1.ma
+Unsatisfiable/LAT147-1.ma
+Unsatisfiable/LAT148-1.ma
+Unsatisfiable/LAT151-1.ma
+Unsatisfiable/LAT152-1.ma
+Unsatisfiable/LAT154-10.ma
+Unsatisfiable/LAT156-1.ma 
+Unsatisfiable/LAT160-1.ma
+Unsatisfiable/LAT162-1.ma
+Unsatisfiable/LAT164-1.ma
+Unsatisfiable/LAT165-1.ma
+Unsatisfiable/LAT169-1.ma
+Unsatisfiable/LCL138-1.ma
+Unsatisfiable/RNG009-5.ma
+Unsatisfiable/RNG009-7.ma
+Unsatisfiable/RNG019-6.ma
+Unsatisfiable/RNG020-6.ma
+Unsatisfiable/RNG021-7.ma
+Unsatisfiable/RNG025-4.ma
+Unsatisfiable/RNG025-5.ma
+Unsatisfiable/RNG025-6.ma
+Unsatisfiable/RNG026-6.ma
+Unsatisfiable/RNG026-7.ma
+Unsatisfiable/RNG027-5.ma
+Unsatisfiable/RNG027-7.ma
+Unsatisfiable/RNG027-8.ma
+Unsatisfiable/RNG027-9.ma
+Unsatisfiable/RNG028-7.ma
+Unsatisfiable/RNG028-8.ma
+Unsatisfiable/RNG029-6.ma
+Unsatisfiable/RNG029-7.ma
+Unsatisfiable/RNG035-7.ma
+Unsatisfiable/ROB006-1.ma
+Unsatisfiable/GRP187-1.ma
+Unsatisfiable/LAT020-1.ma
+Unsatisfiable/GRP164-1.ma
+Unsatisfiable/BOO067-1.ma
+Unsatisfiable/LAT171-1.ma
+Unsatisfiable/LAT150-1.ma
+Unsatisfiable/BOO076-1.ma
+Unsatisfiable/LAT146-1.ma
+Unsatisfiable/LAT172-1.ma
+Unsatisfiable/LAT175-1.ma
+Unsatisfiable/LAT144-1.ma
+Unsatisfiable/LAT157-1.ma
+Unsatisfiable/LAT155-1.ma
+Unsatisfiable/LAT158-1.ma
+Unsatisfiable/LAT166-1.ma
+Unsatisfiable/LAT153-1.ma
+Unsatisfiable/LAT174-1.ma
+Unsatisfiable/LAT142-1.ma
+Unsatisfiable/LAT173-1.ma
+Unsatisfiable/LAT167-1.ma
+Unsatisfiable/LAT163-1.ma
+Unsatisfiable/LAT176-1.ma
+Unsatisfiable/LAT159-1.ma
+Unsatisfiable/LAT149-1.ma
+Unsatisfiable/LAT170-1.ma
diff --git a/matita/tests/TPTP/elenco_problemi_rating0_ancora_da_risolvere.txt b/matita/tests/TPTP/elenco_problemi_rating0_ancora_da_risolvere.txt
new file mode 100644 (file)
index 0000000..e396ca7
--- /dev/null
@@ -0,0 +1,13 @@
+Unsatisfiable/COL023-1.ma
+Unsatisfiable/COL027-1.ma
+Unsatisfiable/COL052-1.ma
+Unsatisfiable/COL059-1.ma
+Unsatisfiable/GRP195-1.ma
+Unsatisfiable/GRP406-1.ma
+Unsatisfiable/GRP407-1.ma
+Unsatisfiable/GRP408-1.ma
+Unsatisfiable/GRP415-1.ma
+Unsatisfiable/LAT010-1.ma
+Unsatisfiable/LAT019-1.ma
+Unsatisfiable/LAT021-1.ma
+Unsatisfiable/LCL162-1.ma
diff --git a/matita/tests/TPTP/elenco_problemi_veloci_per_test.txt b/matita/tests/TPTP/elenco_problemi_veloci_per_test.txt
new file mode 100644 (file)
index 0000000..355142b
--- /dev/null
@@ -0,0 +1,255 @@
+COL007-1.p 
+COL012-1.p 
+COL013-1.p 
+COL058-2.p 
+COL060-2.p 
+COL060-3.p 
+COL061-2.p 
+COL061-3.p 
+COL062-2.p 
+COL062-3.p 
+COL063-2.p 
+COL063-3.p 
+COL063-4.p 
+COL063-5.p 
+COL063-6.p 
+COL064-2.p 
+COL064-3.p 
+COL064-4.p 
+COL064-5.p 
+COL064-6.p 
+COL064-7.p 
+COL064-8.p 
+COL064-9.p 
+COL085-1.p 
+COL086-1.p 
+GRP023-2.p 
+GRP136-1.p 
+GRP137-1.p 
+GRP160-1.p 
+GRP161-1.p 
+GRP454-1.p 
+GRP457-1.p 
+GRP460-1.p 
+GRP463-1.p 
+GRP541-1.p 
+GRP545-1.p 
+GRP549-1.p 
+LAT033-1.p 
+LAT034-1.p 
+ROB030-1.p 
+SYN083-1.p 
+BOO006-4.p 
+BOO011-2.p 
+BOO011-4.p 
+COL004-3.p 
+COL008-1.p 
+COL016-1.p 
+COL022-1.p 
+COL045-1.p 
+COL048-1.p 
+COL050-1.p 
+COL058-3.p 
+COL083-1.p 
+COL084-1.p 
+GRP010-4.p 
+GRP022-2.p 
+GRP151-1.p 
+GRP496-1.p 
+GRP542-1.p 
+GRP546-1.p 
+RNG007-4.p 
+ROB010-1.p 
+ROB013-1.p 
+BOO018-4.p 
+COL015-1.p 
+COL017-1.p 
+COL025-1.p 
+GRP011-4.p 
+GRP012-4.p 
+GRP182-1.p 
+GRP481-1.p 
+GRP487-1.p 
+GRP493-1.p 
+GRP550-1.p 
+GRP552-1.p 
+BOO003-2.p 
+BOO006-2.p 
+COL018-1.p 
+COL024-1.p 
+GRP001-4.p 
+GRP115-1.p 
+GRP117-1.p 
+GRP182-3.p 
+GRP455-1.p 
+GRP458-1.p 
+GRP490-1.p 
+GRP494-1.p 
+GRP544-1.p 
+GRP573-1.p 
+GRP581-1.p 
+LCL132-1.p 
+ROB002-1.p 
+GRP001-2.p 
+GRP142-1.p 
+GRP144-1.p 
+GRP189-1.p 
+GRP206-1.p 
+GRP562-1.p 
+GRP566-1.p 
+GRP569-1.p 
+GRP570-1.p 
+LDA001-1.p 
+GRP173-1.p 
+GRP182-2.p 
+GRP188-2.p 
+GRP484-1.p 
+GRP491-1.p 
+GRP548-1.p 
+GRP558-1.p 
+GRP565-1.p 
+LCL133-1.p 
+LCL134-1.p 
+LCL135-1.p 
+BOO004-2.p 
+BOO009-2.p 
+GRP150-1.p 
+GRP153-1.p 
+GRP174-1.p 
+GRP182-4.p 
+GRP189-2.p 
+BOO010-2.p 
+BOO010-4.p 
+GRP118-1.p 
+GRP143-1.p 
+GRP145-1.p 
+GRP152-1.p 
+GRP188-1.p 
+GRP485-1.p 
+GRP510-1.p 
+GRP577-1.p 
+LCL161-1.p 
+GRP518-1.p 
+GRP520-1.p 
+BOO003-4.p 
+BOO004-4.p 
+GRP514-1.p 
+GRP516-1.p 
+GRP574-1.p 
+GRP586-1.p 
+LDA007-3.p 
+BOO005-4.p 
+COL014-1.p 
+GRP139-1.p 
+GRP141-1.p 
+BOO005-2.p 
+GRP497-1.p 
+GRP512-1.p 
+GRP561-1.p 
+GRP564-1.p 
+GRP582-1.p 
+LCL164-1.p 
+GRP590-1.p 
+GRP595-1.p 
+GRP146-1.p 
+GRP149-1.p 
+GRP162-1.p 
+GRP576-1.p 
+RNG024-6.p 
+GRP157-1.p 
+GRP163-1.p 
+GRP456-1.p 
+RNG008-4.p 
+RNG023-6.p 
+GRP459-1.p 
+GRP578-1.p 
+BOO017-2.p 
+GRP159-1.p 
+GRP186-3.p 
+GRP192-1.p 
+GRP560-1.p 
+GRP598-1.p 
+GRP543-1.p 
+BOO016-2.p 
+GRP158-1.p 
+GRP186-4.p 
+GRP572-1.p 
+GRP592-1.p 
+RNG011-5.p 
+GRP495-1.p 
+GRP596-1.p 
+GRP614-1.p 
+LCL156-1.p 
+LCL110-2.p 
+LCL154-1.p 
+LCL157-1.p 
+GRP154-1.p 
+GRP616-1.p 
+LCL112-2.p 
+LCL140-1.p 
+GRP168-1.p 
+GRP612-1.p 
+LCL113-2.p 
+BOO009-4.p 
+GRP116-1.p 
+LCL155-1.p 
+RNG023-7.p 
+RNG024-7.p 
+GRP600-1.p 
+LCL153-1.p 
+LCL158-1.p 
+GRP498-1.p 
+COL021-1.p 
+GRP155-1.p 
+GRP176-2.p 
+LCL139-1.p 
+GRP486-1.p 
+GRP606-1.p 
+LCL114-2.p 
+BOO013-2.p 
+GRP156-1.p 
+GRP176-1.p 
+LAT045-1.p 
+GRP168-2.p 
+GRP608-1.p 
+GRP551-1.p 
+GRP588-1.p 
+LAT039-1.p 
+LAT039-2.p 
+GRP584-1.p 
+BOO012-2.p 
+GRP568-1.p 
+GRP492-1.p 
+GRP602-1.p 
+GRP603-1.p 
+GRP467-1.p 
+GRP613-1.p 
+GRP547-1.p 
+BOO012-4.p 
+GRP580-1.p 
+GRP597-1.p 
+GRP517-1.p 
+BOO075-1.p 
+LCL115-2.p 
+LCL141-1.p 
+GRP605-1.p 
+GRP515-1.p 
+GRP509-1.p 
+GRP604-1.p 
+GRP513-1.p 
+GRP556-1.p 
+BOO013-4.p 
+GRP615-1.p 
+BOO001-1.p 
+GRP488-1.p 
+GRP583-1.p 
+GRP511-1.p 
+LAT008-1.p 
+BOO069-1.p 
+ROB009-1.p 
+BOO071-1.p 
+GRP567-1.p 
+BOO034-1.p 
+LAT040-1.p 
+GRP599-1.p 
+COL010-1.p 
diff --git a/matita/tests/TPTP/elenco_unsatisfiable.txt b/matita/tests/TPTP/elenco_unsatisfiable.txt
new file mode 100644 (file)
index 0000000..e70ebb5
--- /dev/null
@@ -0,0 +1,698 @@
+ALG005-1.p
+ALG006-1.p
+ALG007-1.p
+BOO001-1.p
+BOO002-1.p
+BOO002-2.p
+BOO003-2.p
+BOO003-4.p
+BOO004-2.p
+BOO004-4.p
+BOO005-2.p
+BOO005-4.p
+BOO006-2.p
+BOO006-4.p
+BOO007-2.p
+BOO007-4.p
+BOO008-2.p
+BOO008-4.p
+BOO009-2.p
+BOO009-4.p
+BOO010-2.p
+BOO010-4.p
+BOO011-2.p
+BOO011-4.p
+BOO012-2.p
+BOO012-4.p
+BOO013-2.p
+BOO013-4.p
+BOO014-2.p
+BOO014-4.p
+BOO015-2.p
+BOO015-4.p
+BOO016-2.p
+BOO017-2.p
+BOO018-4.p
+BOO021-1.p
+BOO022-1.p
+BOO023-1.p
+BOO024-1.p
+BOO025-1.p
+BOO026-1.p
+BOO028-1.p
+BOO029-1.p
+BOO031-1.p
+BOO034-1.p
+BOO067-1.p
+BOO068-1.p
+BOO069-1.p
+BOO070-1.p
+BOO071-1.p
+BOO072-1.p
+BOO073-1.p
+BOO074-1.p
+BOO075-1.p
+BOO076-1.p
+COL001-1.p
+COL001-2.p
+COL002-1.p
+COL002-4.p
+COL002-5.p
+COL003-1.p
+COL004-1.p
+COL004-3.p
+COL006-1.p
+COL006-5.p
+COL006-6.p
+COL006-7.p
+COL007-1.p
+COL008-1.p
+COL009-1.p
+COL010-1.p
+COL011-1.p
+COL012-1.p
+COL013-1.p
+COL014-1.p
+COL015-1.p
+COL016-1.p
+COL017-1.p
+COL018-1.p
+COL019-1.p
+COL020-1.p
+COL021-1.p
+COL022-1.p
+COL023-1.p
+COL024-1.p
+COL025-1.p
+COL026-1.p
+COL027-1.p
+COL029-1.p
+COL030-1.p
+COL031-1.p
+COL032-1.p
+COL033-1.p
+COL034-1.p
+COL035-1.p
+COL036-1.p
+COL037-1.p
+COL038-1.p
+COL039-1.p
+COL041-1.p
+COL042-1.p
+COL042-6.p
+COL042-7.p
+COL042-8.p
+COL042-9.p
+COL043-1.p
+COL043-3.p
+COL044-1.p
+COL044-6.p
+COL044-7.p
+COL044-8.p
+COL044-9.p
+COL045-1.p
+COL046-1.p
+COL048-1.p
+COL049-1.p
+COL050-1.p
+COL051-1.p
+COL052-1.p
+COL053-1.p
+COL056-1.p
+COL057-1.p
+COL058-1.p
+COL058-2.p
+COL058-3.p
+COL059-1.p
+COL060-1.p
+COL060-2.p
+COL060-3.p
+COL061-1.p
+COL061-2.p
+COL061-3.p
+COL062-1.p
+COL062-2.p
+COL062-3.p
+COL063-1.p
+COL063-2.p
+COL063-3.p
+COL063-4.p
+COL063-5.p
+COL063-6.p
+COL064-1.p
+COL064-2.p
+COL064-3.p
+COL064-4.p
+COL064-5.p
+COL064-6.p
+COL064-7.p
+COL064-8.p
+COL064-9.p
+COL065-1.p
+COL066-1.p
+COL066-2.p
+COL066-3.p
+COL070-1.p
+COL075-2.p
+COL083-1.p
+COL084-1.p
+COL085-1.p
+COL086-1.p
+GRP001-2.p
+GRP001-4.p
+GRP002-2.p
+GRP002-3.p
+GRP002-4.p
+GRP010-4.p
+GRP011-4.p
+GRP012-4.p
+GRP014-1.p
+GRP022-2.p
+GRP023-2.p
+GRP024-5.p
+GRP114-1.p
+GRP115-1.p
+GRP116-1.p
+GRP117-1.p
+GRP118-1.p
+GRP119-1.p
+GRP120-1.p
+GRP121-1.p
+GRP122-1.p
+GRP136-1.p
+GRP137-1.p
+GRP138-1.p
+GRP139-1.p
+GRP140-1.p
+GRP141-1.p
+GRP142-1.p
+GRP143-1.p
+GRP144-1.p
+GRP145-1.p
+GRP146-1.p
+GRP147-1.p
+GRP148-1.p
+GRP149-1.p
+GRP150-1.p
+GRP151-1.p
+GRP152-1.p
+GRP153-1.p
+GRP154-1.p
+GRP155-1.p
+GRP156-1.p
+GRP157-1.p
+GRP158-1.p
+GRP159-1.p
+GRP160-1.p
+GRP161-1.p
+GRP162-1.p
+GRP163-1.p
+GRP164-1.p
+GRP164-2.p
+GRP165-1.p
+GRP165-2.p
+GRP166-1.p
+GRP166-2.p
+GRP166-3.p
+GRP166-4.p
+GRP167-1.p
+GRP167-2.p
+GRP167-3.p
+GRP167-4.p
+GRP167-5.p
+GRP168-1.p
+GRP168-2.p
+GRP169-1.p
+GRP169-2.p
+GRP170-1.p
+GRP170-2.p
+GRP170-3.p
+GRP170-4.p
+GRP171-1.p
+GRP171-2.p
+GRP172-1.p
+GRP172-2.p
+GRP173-1.p
+GRP174-1.p
+GRP175-1.p
+GRP175-2.p
+GRP175-3.p
+GRP175-4.p
+GRP176-1.p
+GRP176-2.p
+GRP177-2.p
+GRP178-1.p
+GRP178-2.p
+GRP179-1.p
+GRP179-2.p
+GRP179-3.p
+GRP180-1.p
+GRP180-2.p
+GRP181-1.p
+GRP181-2.p
+GRP181-3.p
+GRP181-4.p
+GRP182-1.p
+GRP182-2.p
+GRP182-3.p
+GRP182-4.p
+GRP183-1.p
+GRP183-2.p
+GRP183-3.p
+GRP183-4.p
+GRP184-1.p
+GRP184-2.p
+GRP184-3.p
+GRP184-4.p
+GRP185-1.p
+GRP185-2.p
+GRP185-3.p
+GRP185-4.p
+GRP186-1.p
+GRP186-2.p
+GRP186-3.p
+GRP186-4.p
+GRP187-1.p
+GRP188-1.p
+GRP188-2.p
+GRP189-1.p
+GRP189-2.p
+GRP190-1.p
+GRP190-2.p
+GRP191-1.p
+GRP191-2.p
+GRP192-1.p
+GRP193-1.p
+GRP193-2.p
+GRP195-1.p
+GRP196-1.p
+GRP200-1.p
+GRP201-1.p
+GRP202-1.p
+GRP203-1.p
+GRP205-1.p
+GRP206-1.p
+GRP403-1.p
+GRP404-1.p
+GRP405-1.p
+GRP406-1.p
+GRP407-1.p
+GRP408-1.p
+GRP409-1.p
+GRP410-1.p
+GRP411-1.p
+GRP412-1.p
+GRP413-1.p
+GRP414-1.p
+GRP415-1.p
+GRP416-1.p
+GRP417-1.p
+GRP418-1.p
+GRP419-1.p
+GRP420-1.p
+GRP421-1.p
+GRP422-1.p
+GRP423-1.p
+GRP424-1.p
+GRP425-1.p
+GRP426-1.p
+GRP427-1.p
+GRP428-1.p
+GRP429-1.p
+GRP430-1.p
+GRP431-1.p
+GRP432-1.p
+GRP433-1.p
+GRP434-1.p
+GRP435-1.p
+GRP436-1.p
+GRP437-1.p
+GRP438-1.p
+GRP439-1.p
+GRP440-1.p
+GRP441-1.p
+GRP442-1.p
+GRP443-1.p
+GRP444-1.p
+GRP445-1.p
+GRP446-1.p
+GRP447-1.p
+GRP448-1.p
+GRP449-1.p
+GRP450-1.p
+GRP451-1.p
+GRP452-1.p
+GRP453-1.p
+GRP454-1.p
+GRP455-1.p
+GRP456-1.p
+GRP457-1.p
+GRP458-1.p
+GRP459-1.p
+GRP460-1.p
+GRP461-1.p
+GRP462-1.p
+GRP463-1.p
+GRP464-1.p
+GRP465-1.p
+GRP466-1.p
+GRP467-1.p
+GRP468-1.p
+GRP469-1.p
+GRP470-1.p
+GRP471-1.p
+GRP472-1.p
+GRP473-1.p
+GRP474-1.p
+GRP475-1.p
+GRP476-1.p
+GRP477-1.p
+GRP478-1.p
+GRP479-1.p
+GRP480-1.p
+GRP481-1.p
+GRP482-1.p
+GRP483-1.p
+GRP484-1.p
+GRP485-1.p
+GRP486-1.p
+GRP487-1.p
+GRP488-1.p
+GRP489-1.p
+GRP490-1.p
+GRP491-1.p
+GRP492-1.p
+GRP493-1.p
+GRP494-1.p
+GRP495-1.p
+GRP496-1.p
+GRP497-1.p
+GRP498-1.p
+GRP499-1.p
+GRP500-1.p
+GRP501-1.p
+GRP502-1.p
+GRP503-1.p
+GRP504-1.p
+GRP505-1.p
+GRP506-1.p
+GRP507-1.p
+GRP508-1.p
+GRP509-1.p
+GRP510-1.p
+GRP511-1.p
+GRP512-1.p
+GRP513-1.p
+GRP514-1.p
+GRP515-1.p
+GRP516-1.p
+GRP517-1.p
+GRP518-1.p
+GRP519-1.p
+GRP520-1.p
+GRP521-1.p
+GRP522-1.p
+GRP523-1.p
+GRP524-1.p
+GRP525-1.p
+GRP526-1.p
+GRP527-1.p
+GRP528-1.p
+GRP529-1.p
+GRP530-1.p
+GRP531-1.p
+GRP532-1.p
+GRP533-1.p
+GRP534-1.p
+GRP535-1.p
+GRP536-1.p
+GRP537-1.p
+GRP538-1.p
+GRP539-1.p
+GRP540-1.p
+GRP541-1.p
+GRP542-1.p
+GRP543-1.p
+GRP544-1.p
+GRP545-1.p
+GRP546-1.p
+GRP547-1.p
+GRP548-1.p
+GRP549-1.p
+GRP550-1.p
+GRP551-1.p
+GRP552-1.p
+GRP553-1.p
+GRP554-1.p
+GRP555-1.p
+GRP556-1.p
+GRP557-1.p
+GRP558-1.p
+GRP559-1.p
+GRP560-1.p
+GRP561-1.p
+GRP562-1.p
+GRP563-1.p
+GRP564-1.p
+GRP565-1.p
+GRP566-1.p
+GRP567-1.p
+GRP568-1.p
+GRP569-1.p
+GRP570-1.p
+GRP571-1.p
+GRP572-1.p
+GRP573-1.p
+GRP574-1.p
+GRP575-1.p
+GRP576-1.p
+GRP577-1.p
+GRP578-1.p
+GRP579-1.p
+GRP580-1.p
+GRP581-1.p
+GRP582-1.p
+GRP583-1.p
+GRP584-1.p
+GRP585-1.p
+GRP586-1.p
+GRP587-1.p
+GRP588-1.p
+GRP589-1.p
+GRP590-1.p
+GRP591-1.p
+GRP592-1.p
+GRP593-1.p
+GRP594-1.p
+GRP595-1.p
+GRP596-1.p
+GRP597-1.p
+GRP598-1.p
+GRP599-1.p
+GRP600-1.p
+GRP601-1.p
+GRP602-1.p
+GRP603-1.p
+GRP604-1.p
+GRP605-1.p
+GRP606-1.p
+GRP607-1.p
+GRP608-1.p
+GRP609-1.p
+GRP610-1.p
+GRP611-1.p
+GRP612-1.p
+GRP613-1.p
+GRP614-1.p
+GRP615-1.p
+GRP616-1.p
+LAT006-1.p
+LAT007-1.p
+LAT008-1.p
+LAT009-1.p
+LAT010-1.p
+LAT011-1.p
+LAT012-1.p
+LAT013-1.p
+LAT014-1.p
+LAT017-1.p
+LAT018-1.p
+LAT019-1.p
+LAT020-1.p
+LAT021-1.p
+LAT022-1.p
+LAT023-1.p
+LAT026-1.p
+LAT027-1.p
+LAT028-1.p
+LAT031-1.p
+LAT032-1.p
+LAT033-1.p
+LAT034-1.p
+LAT038-1.p
+LAT039-1.p
+LAT039-2.p
+LAT040-1.p
+LAT042-1.p
+LAT043-1.p
+LAT044-1.p
+LAT045-1.p
+LAT070-1.p
+LAT072-1.p
+LAT074-1.p
+LAT075-1.p
+LAT076-1.p
+LAT077-1.p
+LAT078-1.p
+LAT079-1.p
+LAT080-1.p
+LAT081-1.p
+LAT082-1.p
+LAT083-1.p
+LAT084-1.p
+LAT085-1.p
+LAT086-1.p
+LAT087-1.p
+LAT088-1.p
+LAT089-1.p
+LAT090-1.p
+LAT091-1.p
+LAT092-1.p
+LAT093-1.p
+LAT094-1.p
+LAT095-1.p
+LAT096-1.p
+LAT097-1.p
+LAT138-1.p
+LAT139-1.p
+LAT140-1.p
+LAT141-1.p
+LAT142-1.p
+LAT143-1.p
+LAT144-1.p
+LAT145-1.p
+LAT146-1.p
+LAT147-1.p
+LAT148-1.p
+LAT149-1.p
+LAT150-1.p
+LAT151-1.p
+LAT152-1.p
+LAT153-1.p
+LAT154-1.p
+LAT155-1.p
+LAT156-1.p
+LAT157-1.p
+LAT158-1.p
+LAT159-1.p
+LAT160-1.p
+LAT161-1.p
+LAT162-1.p
+LAT163-1.p
+LAT164-1.p
+LAT165-1.p
+LAT166-1.p
+LAT167-1.p
+LAT168-1.p
+LAT169-1.p
+LAT170-1.p
+LAT171-1.p
+LAT172-1.p
+LAT173-1.p
+LAT174-1.p
+LAT175-1.p
+LAT176-1.p
+LAT177-1.p
+LCL109-2.p
+LCL109-6.p
+LCL110-2.p
+LCL111-2.p
+LCL112-2.p
+LCL113-2.p
+LCL114-2.p
+LCL115-2.p
+LCL116-2.p
+LCL132-1.p
+LCL133-1.p
+LCL134-1.p
+LCL135-1.p
+LCL138-1.p
+LCL139-1.p
+LCL140-1.p
+LCL141-1.p
+LCL153-1.p
+LCL154-1.p
+LCL155-1.p
+LCL156-1.p
+LCL157-1.p
+LCL158-1.p
+LCL159-1.p
+LCL160-1.p
+LCL161-1.p
+LCL162-1.p
+LCL163-1.p
+LCL164-1.p
+LDA001-1.p
+LDA002-1.p
+LDA007-3.p
+RNG007-4.p
+RNG008-3.p
+RNG008-4.p
+RNG008-7.p
+RNG009-5.p
+RNG009-7.p
+RNG011-5.p
+RNG012-6.p
+RNG013-6.p
+RNG014-6.p
+RNG015-6.p
+RNG016-6.p
+RNG017-6.p
+RNG018-6.p
+RNG019-6.p
+RNG019-7.p
+RNG020-6.p
+RNG020-7.p
+RNG021-6.p
+RNG021-7.p
+RNG023-6.p
+RNG023-7.p
+RNG024-6.p
+RNG024-7.p
+RNG025-4.p
+RNG025-5.p
+RNG025-6.p
+RNG025-7.p
+RNG026-6.p
+RNG026-7.p
+RNG027-5.p
+RNG027-7.p
+RNG027-8.p
+RNG027-9.p
+RNG028-5.p
+RNG028-7.p
+RNG028-8.p
+RNG028-9.p
+RNG029-5.p
+RNG029-6.p
+RNG029-7.p
+RNG035-7.p
+ROB001-1.p
+ROB002-1.p
+ROB003-1.p
+ROB004-1.p
+ROB005-1.p
+ROB006-1.p
+ROB006-2.p
+ROB008-1.p
+ROB009-1.p
+ROB010-1.p
+ROB013-1.p
+ROB022-1.p
+ROB023-1.p
+ROB026-1.p
+ROB030-1.p
+ROB031-1.p
+ROB032-1.p
+SYN080-1.p
+SYN083-1.p
diff --git a/matita/tests/TPTP/fetch_results_tptp.lua b/matita/tests/TPTP/fetch_results_tptp.lua
new file mode 100755 (executable)
index 0000000..87aa91a
--- /dev/null
@@ -0,0 +1,43 @@
+#! /usr/bin/lua50
+
+require "luasocket"
+
+SYSTEM = "Matita---0.1.0.UNS-Ref.s"
+URL = "http://www.cs.miami.edu/~tptp/cgi-bin/DVTPTP2WWW/view_file.pl?Category=Solutions&Domain=%s&File=%s&System=%s"
+
+function url_for(system, problem)
+       local domain = string.sub(problem,1,3)
+       local url = string.format(URL,domain,problem,system)
+       return url
+end
+
+function load_todo_list(file)
+       local f = io.open(file,"r")
+       local todo = {}
+       for l in f:lines() do
+               table.insert(todo,l)
+       end
+       f:close()
+       return todo
+end
+
+function main(argv)
+       assert(table.getn(argv) == 1,
+               "Only one paarmeter: the file containing the problems")
+       local todo = load_todo_list(argv[1])
+       local todo_size = table.getn(todo)
+       for i=1,todo_size do
+               local filename = todo[i]
+               local url = url_for(SYSTEM,filename)
+               print("Fetching "..filename.." ("..i.."/"..todo_size..") "..url)
+               local data,err = socket.http.get(url)
+               assert(data,err)
+               local logfilename = "log."..filename
+               local f = io.open(logfilename,"w")
+               f:write(data)
+               f:close()
+               os.execute("gzip -f "..logfilename)
+       end
+end
+
+main(arg)
diff --git a/matita/tests/TPTP/hne_problems.txt b/matita/tests/TPTP/hne_problems.txt
new file mode 100644 (file)
index 0000000..7e54a9d
--- /dev/null
@@ -0,0 +1,90 @@
+Unsatisfiable/ANA003-2.ma
+Unsatisfiable/LCL001-1.ma
+Unsatisfiable/LCL002-1.ma
+Unsatisfiable/LCL005-1.ma
+Unsatisfiable/LCL019-1.ma
+Unsatisfiable/LCL020-1.ma
+Unsatisfiable/LCL021-1.ma
+Unsatisfiable/LCL024-1.ma
+Unsatisfiable/LCL032-1.ma
+Unsatisfiable/LCL037-1.ma
+Unsatisfiable/LCL038-1.ma
+Unsatisfiable/LCL061-1.ma
+Unsatisfiable/LCL062-1.ma
+Unsatisfiable/LCL063-1.ma
+Unsatisfiable/LCL074-1.ma
+Unsatisfiable/LCL084-2.ma
+Unsatisfiable/LCL084-3.ma
+Unsatisfiable/LCL085-1.ma
+Unsatisfiable/LCL105-1.ma
+Unsatisfiable/LCL119-1.ma
+Unsatisfiable/LCL122-1.ma
+Unsatisfiable/LCL124-1.ma
+Unsatisfiable/LCL125-1.ma
+Unsatisfiable/LCL166-1.ma
+Unsatisfiable/LCL167-1.ma
+Unsatisfiable/LCL218-1.ma
+Unsatisfiable/LCL227-1.ma
+Unsatisfiable/LCL230-1.ma
+Unsatisfiable/LCL231-1.ma
+Unsatisfiable/LCL249-1.ma
+Unsatisfiable/LCL253-1.ma
+Unsatisfiable/LCL369-1.ma
+Unsatisfiable/LCL375-1.ma
+Unsatisfiable/LCL377-1.ma
+Unsatisfiable/LCL393-1.ma
+Unsatisfiable/LCL394-1.ma
+Unsatisfiable/LCL395-1.ma
+Unsatisfiable/LCL423-1.ma
+Unsatisfiable/LCL425-1.ma
+Unsatisfiable/NUM017-1.ma
+Unsatisfiable/PLA001-1.ma
+Unsatisfiable/PLA004-1.ma
+Unsatisfiable/PLA004-2.ma
+Unsatisfiable/PLA005-1.ma
+Unsatisfiable/PLA005-2.ma
+Unsatisfiable/PLA007-1.ma
+Unsatisfiable/PLA008-1.ma
+Unsatisfiable/PLA009-1.ma
+Unsatisfiable/PLA009-2.ma
+Unsatisfiable/PLA010-1.ma
+Unsatisfiable/PLA011-1.ma
+Unsatisfiable/PLA011-2.ma
+Unsatisfiable/PLA012-1.ma
+Unsatisfiable/PLA013-1.ma
+Unsatisfiable/PLA014-1.ma
+Unsatisfiable/PLA014-2.ma
+Unsatisfiable/PLA015-1.ma
+Unsatisfiable/PLA016-1.ma
+Unsatisfiable/PLA018-1.ma
+Unsatisfiable/PLA019-1.ma
+Unsatisfiable/PLA021-1.ma
+Unsatisfiable/PLA023-1.ma
+Unsatisfiable/PUZ039-1.ma
+Unsatisfiable/PUZ040-1.ma
+Unsatisfiable/PUZ042-1.ma
+Unsatisfiable/PUZ050-1.ma
+Unsatisfiable/RNG001-2.ma
+Unsatisfiable/RNG004-3.ma
+Unsatisfiable/SWV014-1.ma
+Unsatisfiable/SYN556-1.ma
+Unsatisfiable/SYN598-1.ma
+Unsatisfiable/SYN599-1.ma
+Unsatisfiable/SYN600-1.ma
+Unsatisfiable/SYN614-1.ma
+Unsatisfiable/SYN615-1.ma
+Unsatisfiable/SYN617-1.ma
+Unsatisfiable/SYN628-1.ma
+Unsatisfiable/SYN631-1.ma
+Unsatisfiable/SYN639-1.ma
+Unsatisfiable/SYN640-1.ma
+Unsatisfiable/SYN646-1.ma
+Unsatisfiable/SYN647-1.ma
+Unsatisfiable/SYN649-1.ma
+Unsatisfiable/SYN653-1.ma
+Unsatisfiable/SYN654-1.ma
+Unsatisfiable/SYN655-1.ma
+Unsatisfiable/SYN704-1.ma
+Unsatisfiable/SYN707-1.ma
+Unsatisfiable/SYN708-1.ma
+Unsatisfiable/SYN711-1.ma
diff --git a/matita/tests/TPTP/log.120.orsay.txt b/matita/tests/TPTP/log.120.orsay.txt
new file mode 100644 (file)
index 0000000..2bf838a
--- /dev/null
@@ -0,0 +1,698 @@
+Unsatisfiable/ALG005-1.ma ... OK TIME NEEDED: 31.22 Rating : 0.07 1
+Unsatisfiable/ALG006-1.ma ... OK TIME NEEDED: 2.24 Rating : 0.00 2
+Unsatisfiable/ALG007-1.ma ... OK TIME NEEDED: 3.39 Rating : 0.00 3
+Unsatisfiable/BOO001-1.ma ... OK TIME NEEDED: 0.98 Rating : 0.00 4
+Unsatisfiable/BOO002-1.ma ... OK TIME NEEDED: 9.58 Rating : 0.07 5
+Unsatisfiable/BOO002-2.ma ... OK TIME NEEDED: 6.35 Rating : 0.00 6
+Unsatisfiable/BOO003-2.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 7
+Unsatisfiable/BOO003-4.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 8
+Unsatisfiable/BOO004-2.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 9
+Unsatisfiable/BOO004-4.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 10
+Unsatisfiable/BOO005-2.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 11
+Unsatisfiable/BOO005-4.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 12
+Unsatisfiable/BOO006-2.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 13
+Unsatisfiable/BOO006-4.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 14
+Unsatisfiable/BOO007-2.ma ... FAIL Rating : 0.14 15
+Unsatisfiable/BOO007-4.ma ... OK TIME NEEDED: 63.00 Rating : 0.07 16
+Unsatisfiable/BOO008-2.ma ... FAIL Rating : 0.07 17
+Unsatisfiable/BOO008-4.ma ... OK TIME NEEDED: 23.48 Rating : 0.00 18
+Unsatisfiable/BOO009-2.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 19
+Unsatisfiable/BOO009-4.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 20
+Unsatisfiable/BOO010-2.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 21
+Unsatisfiable/BOO010-4.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 22
+Unsatisfiable/BOO011-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 23
+Unsatisfiable/BOO011-4.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 24
+Unsatisfiable/BOO012-2.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 25
+Unsatisfiable/BOO012-4.ma ... OK TIME NEEDED: 0.35 Rating : 0.00 26
+Unsatisfiable/BOO013-2.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 27
+Unsatisfiable/BOO013-4.ma ... OK TIME NEEDED: 0.55 Rating : 0.00 28
+Unsatisfiable/BOO014-2.ma ... OK TIME NEEDED: 3.38 Rating : 0.00 29
+Unsatisfiable/BOO014-4.ma ... OK TIME NEEDED: 16.30 Rating : 0.00 30
+Unsatisfiable/BOO015-2.ma ... OK TIME NEEDED: 1.98 Rating : 0.00 31
+Unsatisfiable/BOO015-4.ma ... OK TIME NEEDED: 16.72 Rating : 0.00 32
+Unsatisfiable/BOO016-2.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 33
+Unsatisfiable/BOO017-2.ma ... OK TIME NEEDED: 0.51 Rating : 0.00 34
+Unsatisfiable/BOO018-4.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 35
+Unsatisfiable/BOO021-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.07 36
+Unsatisfiable/BOO022-1.ma ... FAIL Rating : 0.07 37
+Unsatisfiable/BOO023-1.ma ... FAIL Rating : 0.50 38
+Unsatisfiable/BOO024-1.ma ... OK TIME NEEDED: 2.11 Rating : 0.00 39
+Unsatisfiable/BOO025-1.ma ... OK TIME NEEDED: 4.28 Rating : 0.07 40
+Unsatisfiable/BOO026-1.ma ... OK Rating : 0.07 41
+Unsatisfiable/BOO028-1.ma ... FAIL Rating : 0.07 42
+Unsatisfiable/BOO029-1.ma ... OK TIME NEEDED: 85.32 Rating : 0.00 43
+Unsatisfiable/BOO031-1.ma ... FAIL Rating : 0.21 44
+Unsatisfiable/BOO034-1.ma ... OK TIME NEEDED: 16.86 Rating : 0.21 45
+Unsatisfiable/BOO067-1.ma ... FAIL Rating : 0.21 46
+Unsatisfiable/BOO068-1.ma ... OK TIME NEEDED: 1.54 Rating : 0.00 47
+Unsatisfiable/BOO069-1.ma ... OK TIME NEEDED: 0.82 Rating : 0.00 48
+Unsatisfiable/BOO070-1.ma ... OK TIME NEEDED: 1.74 Rating : 0.00 49
+Unsatisfiable/BOO071-1.ma ... OK TIME NEEDED: 0.82 Rating : 0.00 50
+Unsatisfiable/BOO072-1.ma ... FAIL Rating : 0.07 51
+Unsatisfiable/BOO073-1.ma ... FAIL Rating : 0.36 52
+Unsatisfiable/BOO074-1.ma ... FAIL Rating : 0.07 53
+Unsatisfiable/BOO075-1.ma ... OK TIME NEEDED: 0.61 Rating : 0.00 54
+Unsatisfiable/BOO076-1.ma ... FAIL Rating : 0.71 55
+Unsatisfiable/COL001-1.ma ... OK TIME NEEDED: 79.85 Rating : 0.07 56
+Unsatisfiable/COL001-2.ma ... OK TIME NEEDED: 5.70 Rating : 0.07 57
+Unsatisfiable/COL002-1.ma ... OK TIME NEEDED: 2.99 Rating : 0.00 58
+Unsatisfiable/COL002-4.ma ... FAIL Rating : 0.07 59
+Unsatisfiable/COL002-5.ma ... FAIL Rating : 0.43 60
+Unsatisfiable/COL003-1.ma ... FAIL Rating : 0.79 61
+Unsatisfiable/COL004-1.ma ... FAIL Rating : 0.57 62
+Unsatisfiable/COL004-3.ma ... OK TIME NEEDED: 0.01 Rating : 0.21 63
+Unsatisfiable/COL006-1.ma ... FAIL Rating : 0.57 64
+Unsatisfiable/COL006-5.ma ... FAIL Rating : 0.64 65
+Unsatisfiable/COL006-6.ma ... FAIL Rating : 0.64 66
+Unsatisfiable/COL006-7.ma ... FAIL Rating : 0.64 67
+Unsatisfiable/COL007-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 68
+Unsatisfiable/COL008-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 69
+Unsatisfiable/COL009-1.ma ... OK TIME NEEDED: 5.59 Rating : 0.07 70
+Unsatisfiable/COL010-1.ma ... OK TIME NEEDED: 1.01 Rating : 0.07 71
+Unsatisfiable/COL011-1.ma ... FAIL Rating : 0.36 72
+Unsatisfiable/COL012-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 73
+Unsatisfiable/COL013-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 74
+Unsatisfiable/COL014-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 75
+Unsatisfiable/COL015-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 76
+Unsatisfiable/COL016-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 77
+Unsatisfiable/COL017-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 78
+Unsatisfiable/COL018-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 79
+Unsatisfiable/COL019-1.ma ... FAIL Rating : 0.00 80
+Unsatisfiable/COL020-1.ma ... FAIL Rating : 0.07 81
+Unsatisfiable/COL021-1.ma ... OK TIME NEEDED: 0.28 Rating : 0.00 82
+Unsatisfiable/COL022-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 83
+Unsatisfiable/COL023-1.ma ... FAIL Rating : 0.00 84
+Unsatisfiable/COL024-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 85
+Unsatisfiable/COL025-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 86
+Unsatisfiable/COL026-1.ma ... FAIL Rating : 0.07 87
+Unsatisfiable/COL027-1.ma ... FAIL Rating : 0.00 88
+Unsatisfiable/COL029-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 89
+Unsatisfiable/COL030-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.14 90
+Unsatisfiable/COL031-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 91
+Unsatisfiable/COL032-1.ma ... FAIL Rating : 0.14 92
+Unsatisfiable/COL033-1.ma ... FAIL Rating : 0.07 93
+Unsatisfiable/COL034-1.ma ... FAIL Rating : 0.43 94
+Unsatisfiable/COL035-1.ma ... FAIL Rating : 0.14 95
+Unsatisfiable/COL036-1.ma ... FAIL Rating : 0.57 96
+Unsatisfiable/COL037-1.ma ... FAIL Rating : 0.29 97
+Unsatisfiable/COL038-1.ma ... FAIL Rating : 0.64 98
+Unsatisfiable/COL039-1.ma ... FAIL Rating : 0.00 99
+Unsatisfiable/COL041-1.ma ... FAIL Rating : 0.36 100
+Unsatisfiable/COL042-1.ma ... FAIL Rating : 0.86 101
+Unsatisfiable/COL042-6.ma ... FAIL Rating : 0.14 102
+Unsatisfiable/COL042-7.ma ... FAIL Rating : 0.14 103
+Unsatisfiable/COL042-8.ma ... FAIL Rating : 0.14 104
+Unsatisfiable/COL042-9.ma ... FAIL Rating : 0.14 105
+Unsatisfiable/COL043-1.ma ... FAIL Rating : 0.86 106
+Unsatisfiable/COL043-3.ma ... FAIL Rating : 0.71 107
+Unsatisfiable/COL044-1.ma ... FAIL Rating : 0.21 108
+Unsatisfiable/COL044-6.ma ... FAIL Rating : 0.64 109
+Unsatisfiable/COL044-7.ma ... FAIL Rating : 0.50 110
+Unsatisfiable/COL044-8.ma ... FAIL Rating : 0.71 111
+Unsatisfiable/COL044-9.ma ... FAIL Rating : 0.64 112
+Unsatisfiable/COL045-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 113
+Unsatisfiable/COL046-1.ma ... FAIL Rating : 0.64 114
+Unsatisfiable/COL048-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 115
+Unsatisfiable/COL049-1.ma ... FAIL Rating : 0.29 116
+Unsatisfiable/COL050-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 117
+Unsatisfiable/COL051-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 118
+Unsatisfiable/COL052-1.ma ... FAIL Rating : 0.00 119
+Unsatisfiable/COL053-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 120
+Unsatisfiable/COL056-1.ma ... FAIL Rating : 0.07 121
+Unsatisfiable/COL057-1.ma ... FAIL Rating : 0.36 122
+Unsatisfiable/COL058-1.ma ... FAIL Rating : 0.00 123
+Unsatisfiable/COL058-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 124
+Unsatisfiable/COL058-3.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 125
+Unsatisfiable/COL059-1.ma ... FAIL Rating : 0.00 126
+Unsatisfiable/COL060-1.ma ... FAIL Rating : 0.36 127
+Unsatisfiable/COL060-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 128
+Unsatisfiable/COL060-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 129
+Unsatisfiable/COL061-1.ma ... FAIL Rating : 0.36 130
+Unsatisfiable/COL061-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 131
+Unsatisfiable/COL061-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 132
+Unsatisfiable/COL062-1.ma ... FAIL Rating : 0.50 133
+Unsatisfiable/COL062-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 134
+Unsatisfiable/COL062-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 135
+Unsatisfiable/COL063-1.ma ... FAIL Rating : 0.50 136
+Unsatisfiable/COL063-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 137
+Unsatisfiable/COL063-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 138
+Unsatisfiable/COL063-4.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 139
+Unsatisfiable/COL063-5.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 140
+Unsatisfiable/COL063-6.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 141
+Unsatisfiable/COL064-1.ma ... FAIL Rating : 0.64 142
+Unsatisfiable/COL064-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 143
+Unsatisfiable/COL064-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 144
+Unsatisfiable/COL064-4.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 145
+Unsatisfiable/COL064-5.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 146
+Unsatisfiable/COL064-6.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 147
+Unsatisfiable/COL064-7.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 148
+Unsatisfiable/COL064-8.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 149
+Unsatisfiable/COL064-9.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 150
+Unsatisfiable/COL065-1.ma ... FAIL Rating : 0.71 151
+Unsatisfiable/COL066-1.ma ... FAIL Rating : 0.93 152
+Unsatisfiable/COL066-2.ma ... OK TIME NEEDED: 1.31 Rating : 0.00 153
+Unsatisfiable/COL066-3.ma ... OK TIME NEEDED: 1.31 Rating : 0.00 154
+Unsatisfiable/COL070-1.ma ... FAIL Rating : 0.07 155
+Unsatisfiable/COL075-2.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 156
+Unsatisfiable/COL083-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 157
+Unsatisfiable/COL084-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 158
+Unsatisfiable/COL085-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 159
+Unsatisfiable/COL086-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 160
+Unsatisfiable/GRP001-2.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 161
+Unsatisfiable/GRP001-4.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 162
+Unsatisfiable/GRP002-2.ma ... OK TIME NEEDED: 7.77 Rating : 0.00 163
+Unsatisfiable/GRP002-3.ma ... OK TIME NEEDED: 13.93 Rating : 0.00 164
+Unsatisfiable/GRP002-4.ma ... OK TIME NEEDED: 12.69 Rating : 0.00 165
+Unsatisfiable/GRP010-4.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 166
+Unsatisfiable/GRP011-4.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 167
+Unsatisfiable/GRP012-4.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 168
+Unsatisfiable/GRP014-1.ma ... FAIL Rating : 0.14 169
+Unsatisfiable/GRP022-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 170
+Unsatisfiable/GRP023-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 171
+Unsatisfiable/GRP024-5.ma ... FAIL Rating : 0.50 172
+Unsatisfiable/GRP114-1.ma ... OK TIME NEEDED: 8.76 Rating : 0.29 173
+Unsatisfiable/GRP115-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 174
+Unsatisfiable/GRP116-1.ma ... OK TIME NEEDED: 0.62 Rating : 0.00 175
+Unsatisfiable/GRP117-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 176
+Unsatisfiable/GRP118-1.ma ... OK TIME NEEDED: 0.40 Rating : 0.00 177
+Unsatisfiable/GRP119-1.ma ... OK TIME NEEDED: 37.45 Rating : 0.00 178
+Unsatisfiable/GRP120-1.ma ... OK TIME NEEDED: 54.47 Rating : 0.00 179
+Unsatisfiable/GRP121-1.ma ... OK TIME NEEDED: 37.92 Rating : 0.00 180
+Unsatisfiable/GRP122-1.ma ... OK Rating : 0.07 181
+Unsatisfiable/GRP136-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 182
+Unsatisfiable/GRP137-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 183
+Unsatisfiable/GRP138-1.ma ... OK TIME NEEDED: 1.85 Rating : 0.00 184
+Unsatisfiable/GRP139-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 185
+Unsatisfiable/GRP140-1.ma ... OK TIME NEEDED: 2.00 Rating : 0.00 186
+Unsatisfiable/GRP141-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 187
+Unsatisfiable/GRP142-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 188
+Unsatisfiable/GRP143-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 189
+Unsatisfiable/GRP144-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 190
+Unsatisfiable/GRP145-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 191
+Unsatisfiable/GRP146-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 192
+Unsatisfiable/GRP147-1.ma ... OK TIME NEEDED: 1.11 Rating : 0.00 193
+Unsatisfiable/GRP148-1.ma ... OK TIME NEEDED: 0.86 Rating : 0.00 194
+Unsatisfiable/GRP149-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 195
+Unsatisfiable/GRP150-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 196
+Unsatisfiable/GRP151-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 197
+Unsatisfiable/GRP152-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 198
+Unsatisfiable/GRP153-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 199
+Unsatisfiable/GRP154-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 200
+Unsatisfiable/GRP155-1.ma ... OK TIME NEEDED: 0.33 Rating : 0.00 201
+Unsatisfiable/GRP156-1.ma ... OK TIME NEEDED: 0.36 Rating : 0.00 202
+Unsatisfiable/GRP157-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 203
+Unsatisfiable/GRP158-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 204
+Unsatisfiable/GRP159-1.ma ... OK TIME NEEDED: 0.14 Rating : 0.00 205
+Unsatisfiable/GRP160-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 206
+Unsatisfiable/GRP161-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 207
+Unsatisfiable/GRP162-1.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 208
+Unsatisfiable/GRP163-1.ma ... OK TIME NEEDED: 0.22 Rating : 0.00 209
+Unsatisfiable/GRP164-1.ma ... FAIL Rating : 0.93 210
+Unsatisfiable/GRP164-2.ma ... FAIL Rating : 0.93 211
+Unsatisfiable/GRP165-1.ma ... FAIL Rating : 0.00 212
+Unsatisfiable/GRP165-2.ma ... FAIL Rating : 0.00 213
+Unsatisfiable/GRP166-1.ma ... OK TIME NEEDED: 6.44 Rating : 0.00 214
+Unsatisfiable/GRP166-2.ma ... OK TIME NEEDED: 3.78 Rating : 0.00 215
+Unsatisfiable/GRP166-3.ma ... FAIL Rating : 0.00 216
+Unsatisfiable/GRP166-4.ma ... FAIL Rating : 0.00 217
+Unsatisfiable/GRP167-1.ma ... OK TIME NEEDED: 3.08 Rating : 0.21 218
+Unsatisfiable/GRP167-2.ma ... OK TIME NEEDED: 3.04 Rating : 0.21 219
+Unsatisfiable/GRP167-3.ma ... FAIL Rating : 0.50 220
+Unsatisfiable/GRP167-4.ma ... FAIL Rating : 0.43 221
+Unsatisfiable/GRP167-5.ma ... OK TIME NEEDED: 0.73 Rating : 0.14 222
+Unsatisfiable/GRP168-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.07 223
+Unsatisfiable/GRP168-2.ma ... OK TIME NEEDED: 0.36 Rating : 0.07 224
+Unsatisfiable/GRP169-1.ma ... OK TIME NEEDED: 53.35 Rating : 0.00 225
+Unsatisfiable/GRP169-2.ma ... OK TIME NEEDED: 53.41 Rating : 0.00 226
+Unsatisfiable/GRP170-1.ma ... FAIL Rating : 0.00 227
+Unsatisfiable/GRP170-2.ma ... FAIL Rating : 0.00 228
+Unsatisfiable/GRP170-3.ma ... FAIL Rating : 0.00 229
+Unsatisfiable/GRP170-4.ma ... FAIL Rating : 0.00 230
+Unsatisfiable/GRP171-1.ma ... OK TIME NEEDED: 0.34 Rating : 0.00 231
+Unsatisfiable/GRP171-2.ma ... OK TIME NEEDED: 0.36 Rating : 0.00 232
+Unsatisfiable/GRP172-1.ma ... OK TIME NEEDED: 0.47 Rating : 0.00 233
+Unsatisfiable/GRP172-2.ma ... OK TIME NEEDED: 0.42 Rating : 0.00 234
+Unsatisfiable/GRP173-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 235
+Unsatisfiable/GRP174-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 236
+Unsatisfiable/GRP175-1.ma ... FAIL Rating : 0.00 237
+Unsatisfiable/GRP175-2.ma ... FAIL Rating : 0.00 238
+Unsatisfiable/GRP175-3.ma ... FAIL Rating : 0.00 239
+Unsatisfiable/GRP175-4.ma ... FAIL Rating : 0.00 240
+Unsatisfiable/GRP176-1.ma ... OK TIME NEEDED: 0.29 Rating : 0.00 241
+Unsatisfiable/GRP176-2.ma ... OK TIME NEEDED: 0.30 Rating : 0.00 242
+Unsatisfiable/GRP177-2.ma ... FAIL Rating : 0.21 243
+Unsatisfiable/GRP178-1.ma ... FAIL Rating : 0.14 244
+Unsatisfiable/GRP178-2.ma ... FAIL Rating : 0.14 245
+Unsatisfiable/GRP179-1.ma ... FAIL Rating : 0.50 246
+Unsatisfiable/GRP179-2.ma ... FAIL Rating : 0.50 247
+Unsatisfiable/GRP179-3.ma ... FAIL Rating : 0.36 248
+Unsatisfiable/GRP180-1.ma ... FAIL Rating : 0.50 249
+Unsatisfiable/GRP180-2.ma ... FAIL Rating : 0.43 250
+Unsatisfiable/GRP181-1.ma ... FAIL Rating : 0.71 251
+Unsatisfiable/GRP181-2.ma ... FAIL Rating : 0.71 252
+Unsatisfiable/GRP181-3.ma ... OK TIME NEEDED: 1.55 Rating : 0.43 253
+Unsatisfiable/GRP181-4.ma ... OK TIME NEEDED: 3.54 Rating : 0.43 254
+Unsatisfiable/GRP182-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 255
+Unsatisfiable/GRP182-2.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 256
+Unsatisfiable/GRP182-3.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 257
+Unsatisfiable/GRP182-4.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 258
+Unsatisfiable/GRP183-1.ma ... FAIL Rating : 0.43 259
+Unsatisfiable/GRP183-2.ma ... FAIL Rating : 0.43 260
+Unsatisfiable/GRP183-3.ma ... FAIL Rating : 0.43 261
+Unsatisfiable/GRP183-4.ma ... FAIL Rating : 0.36 262
+Unsatisfiable/GRP184-1.ma ... FAIL Rating : 0.29 263
+Unsatisfiable/GRP184-2.ma ... FAIL Rating : 0.14 264
+Unsatisfiable/GRP184-3.ma ... FAIL Rating : 0.21 265
+Unsatisfiable/GRP184-4.ma ... FAIL Rating : 0.00 266
+Unsatisfiable/GRP185-1.ma ... FAIL Rating : 0.07 267
+Unsatisfiable/GRP185-2.ma ... FAIL Rating : 0.07 268
+Unsatisfiable/GRP185-3.ma ... FAIL Rating : 0.21 269
+Unsatisfiable/GRP185-4.ma ... FAIL Rating : 0.21 270
+Unsatisfiable/GRP186-1.ma ... FAIL Rating : 0.57 271
+Unsatisfiable/GRP186-2.ma ... FAIL Rating : 0.36 272
+Unsatisfiable/GRP186-3.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 273
+Unsatisfiable/GRP186-4.ma ... OK TIME NEEDED: 0.20 Rating : 0.00 274
+Unsatisfiable/GRP187-1.ma ... FAIL Rating : 0.64 275
+Unsatisfiable/GRP188-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 276
+Unsatisfiable/GRP188-2.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 277
+Unsatisfiable/GRP189-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 278
+Unsatisfiable/GRP189-2.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 279
+Unsatisfiable/GRP190-1.ma ... OK TIME NEEDED: 109.81 Rating : 0.00 280
+Unsatisfiable/GRP190-2.ma ... OK TIME NEEDED: 109.16 Rating : 0.00 281
+Unsatisfiable/GRP191-1.ma ... OK TIME NEEDED: 108.35 Rating : 0.00 282
+Unsatisfiable/GRP191-2.ma ... OK TIME NEEDED: 108.91 Rating : 0.00 283
+Unsatisfiable/GRP192-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.07 284
+Unsatisfiable/GRP193-1.ma ... FAIL Rating : 0.00 285
+Unsatisfiable/GRP193-2.ma ... FAIL Rating : 0.00 286
+Unsatisfiable/GRP195-1.ma ... FAIL Rating : 0.00 287
+Unsatisfiable/GRP196-1.ma ... FAIL Rating : 0.93 288
+Unsatisfiable/GRP200-1.ma ... FAIL Rating : 0.29 289
+Unsatisfiable/GRP201-1.ma ... FAIL Rating : 0.36 290
+Unsatisfiable/GRP202-1.ma ... FAIL Rating : 0.43 291
+Unsatisfiable/GRP203-1.ma ... FAIL Rating : 0.21 292
+Unsatisfiable/GRP205-1.ma ... FAIL Rating : 0.43 293
+Unsatisfiable/GRP206-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 294
+Unsatisfiable/GRP403-1.ma ... OK TIME NEEDED: 48.77 Rating : 0.07 295
+Unsatisfiable/GRP404-1.ma ... FAIL Rating : 0.21 296
+Unsatisfiable/GRP405-1.ma ... FAIL Rating : 0.21 297
+Unsatisfiable/GRP406-1.ma ... FAIL Rating : 0.00 298
+Unsatisfiable/GRP407-1.ma ... FAIL Rating : 0.00 299
+Unsatisfiable/GRP408-1.ma ... FAIL Rating : 0.00 300
+Unsatisfiable/GRP409-1.ma ... OK TIME NEEDED: 7.50 Rating : 0.00 301
+Unsatisfiable/GRP410-1.ma ... OK TIME NEEDED: 12.23 Rating : 0.21 302
+Unsatisfiable/GRP411-1.ma ... OK TIME NEEDED: 13.76 Rating : 0.21 303
+Unsatisfiable/GRP412-1.ma ... OK TIME NEEDED: 105.80 Rating : 0.00 304
+Unsatisfiable/GRP413-1.ma ... FAIL Rating : 0.07 305
+Unsatisfiable/GRP414-1.ma ... FAIL Rating : 0.07 306
+Unsatisfiable/GRP415-1.ma ... FAIL Rating : 0.00 307
+Unsatisfiable/GRP416-1.ma ... FAIL Rating : 0.07 308
+Unsatisfiable/GRP417-1.ma ... FAIL Rating : 0.14 309
+Unsatisfiable/GRP418-1.ma ... FAIL Rating : 0.07 310
+Unsatisfiable/GRP419-1.ma ... FAIL Rating : 0.29 311
+Unsatisfiable/GRP420-1.ma ... FAIL Rating : 0.36 312
+Unsatisfiable/GRP421-1.ma ... FAIL Rating : 0.14 313
+Unsatisfiable/GRP422-1.ma ... FAIL Rating : 0.29 314
+Unsatisfiable/GRP423-1.ma ... FAIL Rating : 0.36 315
+Unsatisfiable/GRP424-1.ma ... OK TIME NEEDED: 20.70 Rating : 0.00 316
+Unsatisfiable/GRP425-1.ma ... OK TIME NEEDED: 21.22 Rating : 0.07 317
+Unsatisfiable/GRP426-1.ma ... FAIL Rating : 0.14 318
+Unsatisfiable/GRP427-1.ma ... FAIL Rating : 0.00 319
+Unsatisfiable/GRP428-1.ma ... FAIL Rating : 0.00 320
+Unsatisfiable/GRP429-1.ma ... FAIL Rating : 0.14 321
+Unsatisfiable/GRP430-1.ma ... OK TIME NEEDED: 32.43 Rating : 0.00 322
+Unsatisfiable/GRP431-1.ma ... OK TIME NEEDED: 29.82 Rating : 0.00 323
+Unsatisfiable/GRP432-1.ma ... OK TIME NEEDED: 35.35 Rating : 0.00 324
+Unsatisfiable/GRP433-1.ma ... FAIL Rating : 0.00 325
+Unsatisfiable/GRP434-1.ma ... FAIL Rating : 0.00 326
+Unsatisfiable/GRP435-1.ma ... FAIL Rating : 0.00 327
+Unsatisfiable/GRP436-1.ma ... OK Rating : 0.07 328
+Unsatisfiable/GRP437-1.ma ... OK Rating : 0.07 329
+Unsatisfiable/GRP438-1.ma ... OK Rating : 0.07 330
+Unsatisfiable/GRP439-1.ma ... OK TIME NEEDED: 33.82 Rating : 0.07 331
+Unsatisfiable/GRP440-1.ma ... FAIL Rating : 0.14 332
+Unsatisfiable/GRP441-1.ma ... FAIL Rating : 0.21 333
+Unsatisfiable/GRP442-1.ma ... FAIL Rating : 0.14 334
+Unsatisfiable/GRP443-1.ma ... FAIL Rating : 0.07 335
+Unsatisfiable/GRP444-1.ma ... FAIL Rating : 0.21 336
+Unsatisfiable/GRP445-1.ma ... OK TIME NEEDED: 0.20 Rating : 0.00 337
+Unsatisfiable/GRP446-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 338
+Unsatisfiable/GRP447-1.ma ... OK TIME NEEDED: 0.91 Rating : 0.14 339
+Unsatisfiable/GRP448-1.ma ... OK TIME NEEDED: 0.21 Rating : 0.00 340
+Unsatisfiable/GRP449-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 341
+Unsatisfiable/GRP450-1.ma ... OK TIME NEEDED: 0.88 Rating : 0.07 342
+Unsatisfiable/GRP451-1.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 343
+Unsatisfiable/GRP452-1.ma ... OK TIME NEEDED: 1.67 Rating : 0.14 344
+Unsatisfiable/GRP453-1.ma ... OK TIME NEEDED: 3.25 Rating : 0.21 345
+Unsatisfiable/GRP454-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 346
+Unsatisfiable/GRP455-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 347
+Unsatisfiable/GRP456-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.07 348
+Unsatisfiable/GRP457-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 349
+Unsatisfiable/GRP458-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 350
+Unsatisfiable/GRP459-1.ma ... OK TIME NEEDED: 0.27 Rating : 0.00 351
+Unsatisfiable/GRP460-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 352
+Unsatisfiable/GRP461-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 353
+Unsatisfiable/GRP462-1.ma ... OK TIME NEEDED: 0.32 Rating : 0.00 354
+Unsatisfiable/GRP463-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 355
+Unsatisfiable/GRP464-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 356
+Unsatisfiable/GRP465-1.ma ... OK TIME NEEDED: 0.32 Rating : 0.00 357
+Unsatisfiable/GRP466-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 358
+Unsatisfiable/GRP467-1.ma ... OK TIME NEEDED: 0.46 Rating : 0.00 359
+Unsatisfiable/GRP468-1.ma ... OK TIME NEEDED: 3.08 Rating : 0.00 360
+Unsatisfiable/GRP469-1.ma ... FAIL Rating : 0.21 361
+Unsatisfiable/GRP470-1.ma ... FAIL Rating : 0.21 362
+Unsatisfiable/GRP471-1.ma ... FAIL Rating : 0.21 363
+Unsatisfiable/GRP472-1.ma ... OK TIME NEEDED: 71.72 Rating : 0.07 364
+Unsatisfiable/GRP473-1.ma ... OK TIME NEEDED: 67.69 Rating : 0.07 365
+Unsatisfiable/GRP474-1.ma ... OK TIME NEEDED: 92.99 Rating : 0.07 366
+Unsatisfiable/GRP475-1.ma ... OK TIME NEEDED: 89.99 Rating : 0.21 367
+Unsatisfiable/GRP476-1.ma ... OK TIME NEEDED: 89.69 Rating : 0.21 368
+Unsatisfiable/GRP477-1.ma ... OK TIME NEEDED: 94.31 Rating : 0.21 369
+Unsatisfiable/GRP478-1.ma ... OK TIME NEEDED: 28.41 Rating : 0.14 370
+Unsatisfiable/GRP479-1.ma ... OK TIME NEEDED: 24.83 Rating : 0.14 371
+Unsatisfiable/GRP480-1.ma ... OK TIME NEEDED: 35.92 Rating : 0.21 372
+Unsatisfiable/GRP481-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 373
+Unsatisfiable/GRP482-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 374
+Unsatisfiable/GRP483-1.ma ... OK TIME NEEDED: 0.58 Rating : 0.00 375
+Unsatisfiable/GRP484-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 376
+Unsatisfiable/GRP485-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 377
+Unsatisfiable/GRP486-1.ma ... OK TIME NEEDED: 0.68 Rating : 0.00 378
+Unsatisfiable/GRP487-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 379
+Unsatisfiable/GRP488-1.ma ... OK TIME NEEDED: 0.85 Rating : 0.00 380
+Unsatisfiable/GRP489-1.ma ... OK TIME NEEDED: 1.76 Rating : 0.00 381
+Unsatisfiable/GRP490-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 382
+Unsatisfiable/GRP491-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 383
+Unsatisfiable/GRP492-1.ma ... OK TIME NEEDED: 0.42 Rating : 0.00 384
+Unsatisfiable/GRP493-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 385
+Unsatisfiable/GRP494-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 386
+Unsatisfiable/GRP495-1.ma ... OK TIME NEEDED: 0.33 Rating : 0.00 387
+Unsatisfiable/GRP496-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 388
+Unsatisfiable/GRP497-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 389
+Unsatisfiable/GRP498-1.ma ... OK TIME NEEDED: 0.38 Rating : 0.00 390
+Unsatisfiable/GRP499-1.ma ... OK TIME NEEDED: 42.38 Rating : 0.00 391
+Unsatisfiable/GRP500-1.ma ... OK TIME NEEDED: 19.75 Rating : 0.07 392
+Unsatisfiable/GRP501-1.ma ... OK TIME NEEDED: 53.98 Rating : 0.14 393
+Unsatisfiable/GRP502-1.ma ... FAIL Rating : 0.14 394
+Unsatisfiable/GRP503-1.ma ... FAIL Rating : 0.14 395
+Unsatisfiable/GRP504-1.ma ... FAIL Rating : 0.14 396
+Unsatisfiable/GRP505-1.ma ... FAIL Rating : 0.50 397
+Unsatisfiable/GRP506-1.ma ... FAIL Rating : 0.64 398
+Unsatisfiable/GRP507-1.ma ... FAIL Rating : 0.57 399
+Unsatisfiable/GRP508-1.ma ... FAIL Rating : 0.57 400
+Unsatisfiable/GRP509-1.ma ... OK TIME NEEDED: 0.67 Rating : 0.00 401
+Unsatisfiable/GRP510-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 402
+Unsatisfiable/GRP511-1.ma ... OK TIME NEEDED: 1.62 Rating : 0.00 403
+Unsatisfiable/GRP512-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 404
+Unsatisfiable/GRP513-1.ma ... OK TIME NEEDED: 1.39 Rating : 0.00 405
+Unsatisfiable/GRP514-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 406
+Unsatisfiable/GRP515-1.ma ... OK TIME NEEDED: 0.38 Rating : 0.00 407
+Unsatisfiable/GRP516-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 408
+Unsatisfiable/GRP517-1.ma ... OK TIME NEEDED: 1.54 Rating : 0.00 409
+Unsatisfiable/GRP518-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 410
+Unsatisfiable/GRP519-1.ma ... OK TIME NEEDED: 2.18 Rating : 0.00 411
+Unsatisfiable/GRP520-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 412
+Unsatisfiable/GRP521-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 413
+Unsatisfiable/GRP522-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 414
+Unsatisfiable/GRP523-1.ma ... OK TIME NEEDED: 2.41 Rating : 0.00 415
+Unsatisfiable/GRP524-1.ma ... OK TIME NEEDED: 0.36 Rating : 0.00 416
+Unsatisfiable/GRP525-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 417
+Unsatisfiable/GRP526-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 418
+Unsatisfiable/GRP527-1.ma ... OK TIME NEEDED: 1.19 Rating : 0.00 419
+Unsatisfiable/GRP528-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 420
+Unsatisfiable/GRP529-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 421
+Unsatisfiable/GRP530-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 422
+Unsatisfiable/GRP531-1.ma ... OK TIME NEEDED: 0.51 Rating : 0.00 423
+Unsatisfiable/GRP532-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 424
+Unsatisfiable/GRP533-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 425
+Unsatisfiable/GRP534-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 426
+Unsatisfiable/GRP535-1.ma ... OK TIME NEEDED: 0.73 Rating : 0.00 427
+Unsatisfiable/GRP536-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 428
+Unsatisfiable/GRP537-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 429
+Unsatisfiable/GRP538-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 430
+Unsatisfiable/GRP539-1.ma ... OK TIME NEEDED: 2.32 Rating : 0.00 431
+Unsatisfiable/GRP540-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 432
+Unsatisfiable/GRP541-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 433
+Unsatisfiable/GRP542-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 434
+Unsatisfiable/GRP543-1.ma ... OK TIME NEEDED: 0.35 Rating : 0.00 435
+Unsatisfiable/GRP544-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 436
+Unsatisfiable/GRP545-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 437
+Unsatisfiable/GRP546-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 438
+Unsatisfiable/GRP547-1.ma ... OK TIME NEEDED: 0.47 Rating : 0.00 439
+Unsatisfiable/GRP548-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 440
+Unsatisfiable/GRP549-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 441
+Unsatisfiable/GRP550-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.07 442
+Unsatisfiable/GRP551-1.ma ... OK TIME NEEDED: 0.37 Rating : 0.00 443
+Unsatisfiable/GRP552-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 444
+Unsatisfiable/GRP553-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 445
+Unsatisfiable/GRP554-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 446
+Unsatisfiable/GRP555-1.ma ... OK TIME NEEDED: 3.47 Rating : 0.00 447
+Unsatisfiable/GRP556-1.ma ... OK TIME NEEDED: 0.67 Rating : 0.00 448
+Unsatisfiable/GRP557-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 449
+Unsatisfiable/GRP558-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 450
+Unsatisfiable/GRP559-1.ma ... OK TIME NEEDED: 2.54 Rating : 0.00 451
+Unsatisfiable/GRP560-1.ma ... OK TIME NEEDED: 0.20 Rating : 0.00 452
+Unsatisfiable/GRP561-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 453
+Unsatisfiable/GRP562-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 454
+Unsatisfiable/GRP563-1.ma ... OK TIME NEEDED: 1.50 Rating : 0.00 455
+Unsatisfiable/GRP564-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 456
+Unsatisfiable/GRP565-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 457
+Unsatisfiable/GRP566-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 458
+Unsatisfiable/GRP567-1.ma ... OK TIME NEEDED: 2.58 Rating : 0.14 459
+Unsatisfiable/GRP568-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.14 460
+Unsatisfiable/GRP569-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 461
+Unsatisfiable/GRP570-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 462
+Unsatisfiable/GRP571-1.ma ... OK TIME NEEDED: 0.85 Rating : 0.14 463
+Unsatisfiable/GRP572-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.07 464
+Unsatisfiable/GRP573-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 465
+Unsatisfiable/GRP574-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 466
+Unsatisfiable/GRP575-1.ma ... OK TIME NEEDED: 2.01 Rating : 0.14 467
+Unsatisfiable/GRP576-1.ma ... OK TIME NEEDED: 0.29 Rating : 0.00 468
+Unsatisfiable/GRP577-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 469
+Unsatisfiable/GRP578-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 470
+Unsatisfiable/GRP579-1.ma ... OK TIME NEEDED: 4.20 Rating : 0.07 471
+Unsatisfiable/GRP580-1.ma ... OK TIME NEEDED: 0.40 Rating : 0.00 472
+Unsatisfiable/GRP581-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 473
+Unsatisfiable/GRP582-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 474
+Unsatisfiable/GRP583-1.ma ... OK TIME NEEDED: 1.43 Rating : 0.07 475
+Unsatisfiable/GRP584-1.ma ... OK TIME NEEDED: 0.20 Rating : 0.00 476
+Unsatisfiable/GRP585-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 477
+Unsatisfiable/GRP586-1.ma ... OK TIME NEEDED: 0.35 Rating : 0.00 478
+Unsatisfiable/GRP587-1.ma ... OK TIME NEEDED: 8.87 Rating : 0.00 479
+Unsatisfiable/GRP588-1.ma ... OK TIME NEEDED: 0.76 Rating : 0.00 480
+Unsatisfiable/GRP589-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 481
+Unsatisfiable/GRP590-1.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 482
+Unsatisfiable/GRP591-1.ma ... OK TIME NEEDED: 10.79 Rating : 0.07 483
+Unsatisfiable/GRP592-1.ma ... OK TIME NEEDED: 0.21 Rating : 0.07 484
+Unsatisfiable/GRP593-1.ma ... OK TIME NEEDED: 1.28 Rating : 0.00 485
+Unsatisfiable/GRP594-1.ma ... OK TIME NEEDED: 0.75 Rating : 0.00 486
+Unsatisfiable/GRP595-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.07 487
+Unsatisfiable/GRP596-1.ma ... OK TIME NEEDED: 0.29 Rating : 0.07 488
+Unsatisfiable/GRP597-1.ma ... OK TIME NEEDED: 0.58 Rating : 0.00 489
+Unsatisfiable/GRP598-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.07 490
+Unsatisfiable/GRP599-1.ma ... OK TIME NEEDED: 1.68 Rating : 0.07 491
+Unsatisfiable/GRP600-1.ma ... OK TIME NEEDED: 0.37 Rating : 0.07 492
+Unsatisfiable/GRP601-1.ma ... OK TIME NEEDED: 1.47 Rating : 0.07 493
+Unsatisfiable/GRP602-1.ma ... OK TIME NEEDED: 0.48 Rating : 0.07 494
+Unsatisfiable/GRP603-1.ma ... OK TIME NEEDED: 0.48 Rating : 0.07 495
+Unsatisfiable/GRP604-1.ma ... OK TIME NEEDED: 0.52 Rating : 0.07 496
+Unsatisfiable/GRP605-1.ma ... OK TIME NEEDED: 1.64 Rating : 0.00 497
+Unsatisfiable/GRP606-1.ma ... OK TIME NEEDED: 0.42 Rating : 0.00 498
+Unsatisfiable/GRP607-1.ma ... OK TIME NEEDED: 3.85 Rating : 0.00 499
+Unsatisfiable/GRP608-1.ma ... OK TIME NEEDED: 0.56 Rating : 0.00 500
+Unsatisfiable/GRP609-1.ma ... OK TIME NEEDED: 2.09 Rating : 0.07 501
+Unsatisfiable/GRP610-1.ma ... OK TIME NEEDED: 0.44 Rating : 0.07 502
+Unsatisfiable/GRP611-1.ma ... OK TIME NEEDED: 2.08 Rating : 0.00 503
+Unsatisfiable/GRP612-1.ma ... OK TIME NEEDED: 0.44 Rating : 0.07 504
+Unsatisfiable/GRP613-1.ma ... OK TIME NEEDED: 0.58 Rating : 0.00 505
+Unsatisfiable/GRP614-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 506
+Unsatisfiable/GRP615-1.ma ... OK TIME NEEDED: 1.33 Rating : 0.07 507
+Unsatisfiable/GRP616-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 508
+Unsatisfiable/LAT006-1.ma ... OK TIME NEEDED: 8.77 Rating : 0.14 509
+Unsatisfiable/LAT007-1.ma ... OK TIME NEEDED: 76.98 Rating : 0.36 510
+Unsatisfiable/LAT008-1.ma ... OK TIME NEEDED: 0.46 Rating : 0.07 511
+Unsatisfiable/LAT009-1.ma ... FAIL Rating : 0.00 512
+Unsatisfiable/LAT010-1.ma ... FAIL Rating : 0.00 513
+Unsatisfiable/LAT011-1.ma ... OK TIME NEEDED: 84.39 Rating : 0.07 514
+Unsatisfiable/LAT012-1.ma ... OK TIME NEEDED: 7.89 Rating : 0.00 515
+Unsatisfiable/LAT013-1.ma ... OK TIME NEEDED: 59.75 Rating : 0.14 516
+Unsatisfiable/LAT014-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 517
+Unsatisfiable/LAT017-1.ma ... FAIL Rating : 0.71 518
+Unsatisfiable/LAT018-1.ma ... FAIL Rating : 0.93 519
+Unsatisfiable/LAT019-1.ma ... FAIL Rating : 0.00 520
+Unsatisfiable/LAT020-1.ma ... FAIL Rating : 0.50 521
+Unsatisfiable/LAT021-1.ma ... FAIL Rating : 0.00 522
+Unsatisfiable/LAT022-1.ma ... FAIL Rating : 0.21 523
+Unsatisfiable/LAT023-1.ma ... FAIL Rating : 0.21 524
+Unsatisfiable/LAT026-1.ma ... OK TIME NEEDED: 37.10 Rating : 0.14 525
+Unsatisfiable/LAT027-1.ma ... FAIL Rating : 0.07 526
+Unsatisfiable/LAT028-1.ma ... OK TIME NEEDED: 99.40 Rating : 0.00 527
+Unsatisfiable/LAT031-1.ma ... OK TIME NEEDED: 19.14 Rating : 0.00 528
+Unsatisfiable/LAT032-1.ma ... OK TIME NEEDED: 10.64 Rating : 0.00 529
+Unsatisfiable/LAT033-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 530
+Unsatisfiable/LAT034-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 531
+Unsatisfiable/LAT038-1.ma ... FAIL Rating : 0.43 532
+Unsatisfiable/LAT039-1.ma ... OK TIME NEEDED: 0.22 Rating : 0.00 533
+Unsatisfiable/LAT039-2.ma ... OK TIME NEEDED: 0.22 Rating : 0.00 534
+Unsatisfiable/LAT040-1.ma ... OK TIME NEEDED: 4.10 Rating : 0.00 535
+Unsatisfiable/LAT042-1.ma ... OK TIME NEEDED: 65.92 Rating : 0.00 536
+Unsatisfiable/LAT043-1.ma ... OK TIME NEEDED: 67.86 Rating : 0.00 537
+Unsatisfiable/LAT044-1.ma ... OK TIME NEEDED: 89.67 Rating : 0.14 538
+Unsatisfiable/LAT045-1.ma ... OK TIME NEEDED: 0.35 Rating : 0.07 539
+Unsatisfiable/LAT070-1.ma ... FAIL Rating : 0.93 540
+Unsatisfiable/LAT072-1.ma ... FAIL Rating : 1.00 541
+Unsatisfiable/LAT074-1.ma ... FAIL Rating : 1.00 542
+Unsatisfiable/LAT075-1.ma ... FAIL Rating : 1.00 543
+Unsatisfiable/LAT076-1.ma ... FAIL Rating : 1.00 544
+Unsatisfiable/LAT077-1.ma ... FAIL Rating : 1.00 545
+Unsatisfiable/LAT078-1.ma ... FAIL Rating : 1.00 546
+Unsatisfiable/LAT079-1.ma ... FAIL Rating : 1.00 547
+Unsatisfiable/LAT080-1.ma ... FAIL Rating : 0.36 548
+Unsatisfiable/LAT081-1.ma ... FAIL Rating : 0.57 549
+Unsatisfiable/LAT082-1.ma ... FAIL Rating : 0.64 550
+Unsatisfiable/LAT083-1.ma ... FAIL Rating : 0.36 551
+Unsatisfiable/LAT084-1.ma ... FAIL Rating : 0.50 552
+Unsatisfiable/LAT085-1.ma ... FAIL Rating : 0.57 553
+Unsatisfiable/LAT086-1.ma ... FAIL Rating : 0.50 554
+Unsatisfiable/LAT087-1.ma ... FAIL Rating : 0.43 555
+Unsatisfiable/LAT088-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 556
+Unsatisfiable/LAT089-1.ma ... OK TIME NEEDED: 1.23 Rating : 0.00 557
+Unsatisfiable/LAT090-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 558
+Unsatisfiable/LAT091-1.ma ... OK TIME NEEDED: 9.54 Rating : 0.07 559
+Unsatisfiable/LAT092-1.ma ... FAIL Rating : 0.36 560
+Unsatisfiable/LAT093-1.ma ... FAIL Rating : 0.43 561
+Unsatisfiable/LAT094-1.ma ... FAIL Rating : 0.36 562
+Unsatisfiable/LAT095-1.ma ... FAIL Rating : 0.43 563
+Unsatisfiable/LAT096-1.ma ... FAIL Rating : 0.36 564
+Unsatisfiable/LAT097-1.ma ... FAIL Rating : 0.36 565
+Unsatisfiable/LAT138-1.ma ... FAIL Rating : 1.00 566
+Unsatisfiable/LAT139-1.ma ... FAIL Rating : 1.00 567
+Unsatisfiable/LAT140-1.ma ... FAIL Rating : 1.00 568
+Unsatisfiable/LAT141-1.ma ... FAIL Rating : 1.00 569
+Unsatisfiable/LAT142-1.ma ... FAIL Rating : 0.64 570
+Unsatisfiable/LAT143-1.ma ... FAIL Rating : 0.14 571
+Unsatisfiable/LAT144-1.ma ... FAIL Rating : 0.86 572
+Unsatisfiable/LAT145-1.ma ... FAIL Rating : 0.93 573
+Unsatisfiable/LAT146-1.ma ... FAIL Rating : 0.79 574
+Unsatisfiable/LAT147-1.ma ... FAIL Rating : 0.79 575
+Unsatisfiable/LAT148-1.ma ... FAIL Rating : 0.71 576
+Unsatisfiable/LAT149-1.ma ... FAIL Rating : 0.93 577
+Unsatisfiable/LAT150-1.ma ... FAIL Rating : 0.86 578
+Unsatisfiable/LAT151-1.ma ... FAIL Rating : 0.86 579
+Unsatisfiable/LAT152-1.ma ... FAIL Rating : 0.79 580
+Unsatisfiable/LAT153-1.ma ... FAIL Rating : 0.93 581
+Unsatisfiable/LAT154-1.ma ... FAIL Rating : 0.79 582
+Unsatisfiable/LAT155-1.ma ... FAIL Rating : 0.86 583
+Unsatisfiable/LAT156-1.ma ... FAIL Rating : 0.64 584
+Unsatisfiable/LAT157-1.ma ... FAIL Rating : 0.86 585
+Unsatisfiable/LAT158-1.ma ... FAIL Rating : 0.93 586
+Unsatisfiable/LAT159-1.ma ... FAIL Rating : 0.86 587
+Unsatisfiable/LAT160-1.ma ... FAIL Rating : 0.64 588
+Unsatisfiable/LAT161-1.ma ... FAIL Rating : 1.00 589
+Unsatisfiable/LAT162-1.ma ... FAIL Rating : 0.86 590
+Unsatisfiable/LAT163-1.ma ... FAIL Rating : 0.93 591
+Unsatisfiable/LAT164-1.ma ... FAIL Rating : 0.93 592
+Unsatisfiable/LAT165-1.ma ... FAIL Rating : 0.93 593
+Unsatisfiable/LAT166-1.ma ... FAIL Rating : 0.93 594
+Unsatisfiable/LAT167-1.ma ... FAIL Rating : 0.93 595
+Unsatisfiable/LAT168-1.ma ... FAIL Rating : 0.14 596
+Unsatisfiable/LAT169-1.ma ... FAIL Rating : 0.86 597
+Unsatisfiable/LAT170-1.ma ... FAIL Rating : 0.79 598
+Unsatisfiable/LAT171-1.ma ... FAIL Rating : 0.50 599
+Unsatisfiable/LAT172-1.ma ... FAIL Rating : 0.93 600
+Unsatisfiable/LAT173-1.ma ... FAIL Rating : 0.93 601
+Unsatisfiable/LAT174-1.ma ... FAIL Rating : 0.79 602
+Unsatisfiable/LAT175-1.ma ... FAIL Rating : 0.93 603
+Unsatisfiable/LAT176-1.ma ... FAIL Rating : 0.93 604
+Unsatisfiable/LAT177-1.ma ... FAIL Rating : 1.00 605
+Unsatisfiable/LCL109-2.ma ... FAIL Rating : 0.29 606
+Unsatisfiable/LCL109-6.ma ... FAIL Rating : 0.14 607
+Unsatisfiable/LCL110-2.ma ... OK TIME NEEDED: 0.27 Rating : 0.00 608
+Unsatisfiable/LCL111-2.ma ... OK TIME NEEDED: 7.03 Rating : 0.07 609
+Unsatisfiable/LCL112-2.ma ... OK TIME NEEDED: 0.27 Rating : 0.00 610
+Unsatisfiable/LCL113-2.ma ... OK TIME NEEDED: 0.29 Rating : 0.00 611
+Unsatisfiable/LCL114-2.ma ... OK TIME NEEDED: 0.36 Rating : 0.00 612
+Unsatisfiable/LCL115-2.ma ... OK TIME NEEDED: 0.59 Rating : 0.00 613
+Unsatisfiable/LCL116-2.ma ... OK TIME NEEDED: 4.90 Rating : 0.00 614
+Unsatisfiable/LCL132-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 615
+Unsatisfiable/LCL133-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 616
+Unsatisfiable/LCL134-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 617
+Unsatisfiable/LCL135-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 618
+Unsatisfiable/LCL138-1.ma ... FAIL Rating : 0.21 619
+Unsatisfiable/LCL139-1.ma ... OK TIME NEEDED: 0.34 Rating : 0.00 620
+Unsatisfiable/LCL140-1.ma ... OK TIME NEEDED: 0.28 Rating : 0.00 621
+Unsatisfiable/LCL141-1.ma ... OK TIME NEEDED: 0.59 Rating : 0.00 622
+Unsatisfiable/LCL153-1.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 623
+Unsatisfiable/LCL154-1.ma ... OK TIME NEEDED: 0.27 Rating : 0.00 624
+Unsatisfiable/LCL155-1.ma ... OK TIME NEEDED: 0.29 Rating : 0.00 625
+Unsatisfiable/LCL156-1.ma ... OK TIME NEEDED: 0.27 Rating : 0.00 626
+Unsatisfiable/LCL157-1.ma ... OK TIME NEEDED: 0.27 Rating : 0.00 627
+Unsatisfiable/LCL158-1.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 628
+Unsatisfiable/LCL159-1.ma ... OK TIME NEEDED: 6.15 Rating : 0.00 629
+Unsatisfiable/LCL160-1.ma ... FAIL Rating : 0.14 630
+Unsatisfiable/LCL161-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 631
+Unsatisfiable/LCL162-1.ma ... FAIL Rating : 0.00 632
+Unsatisfiable/LCL163-1.ma ... OK TIME NEEDED: 5.06 Rating : 0.14 633
+Unsatisfiable/LCL164-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 634
+Unsatisfiable/LDA001-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 635
+Unsatisfiable/LDA002-1.ma ... OK TIME NEEDED: 22.13 Rating : 0.00 636
+Unsatisfiable/LDA007-3.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 637
+Unsatisfiable/RNG007-4.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 638
+Unsatisfiable/RNG008-3.ma ... OK TIME NEEDED: 2.32 Rating : 0.07 639
+Unsatisfiable/RNG008-4.ma ... OK TIME NEEDED: 4.42 Rating : 0.07 640
+Unsatisfiable/RNG008-7.ma ... OK TIME NEEDED: 15.93 Rating : 0.07 641
+Unsatisfiable/RNG009-5.ma ... FAIL Rating : 0.50 642
+Unsatisfiable/RNG009-7.ma ... FAIL Rating : 0.50 643
+Unsatisfiable/RNG011-5.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 644
+Unsatisfiable/RNG012-6.ma ... OK TIME NEEDED: 71.73 Rating : 0.00 645
+Unsatisfiable/RNG013-6.ma ... OK TIME NEEDED: 71.74 Rating : 0.00 646
+Unsatisfiable/RNG014-6.ma ... OK TIME NEEDED: 67.79 Rating : 0.00 647
+Unsatisfiable/RNG015-6.ma ... OK TIME NEEDED: 69.34 Rating : 0.00 648
+Unsatisfiable/RNG016-6.ma ... OK TIME NEEDED: 71.94 Rating : 0.00 649
+Unsatisfiable/RNG017-6.ma ... OK TIME NEEDED: 71.63 Rating : 0.00 650
+Unsatisfiable/RNG018-6.ma ... OK TIME NEEDED: 68.25 Rating : 0.00 651
+Unsatisfiable/RNG019-6.ma ... FAIL Rating : 0.21 652
+Unsatisfiable/RNG019-7.ma ... FAIL Rating : 0.21 653
+Unsatisfiable/RNG020-6.ma ... FAIL Rating : 0.29 654
+Unsatisfiable/RNG020-7.ma ... FAIL Rating : 0.21 655
+Unsatisfiable/RNG021-6.ma ... FAIL Rating : 0.14 656
+Unsatisfiable/RNG021-7.ma ... FAIL Rating : 0.21 657
+Unsatisfiable/RNG023-6.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 658
+Unsatisfiable/RNG023-7.ma ... OK TIME NEEDED: 0.27 Rating : 0.00 659
+Unsatisfiable/RNG024-6.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 660
+Unsatisfiable/RNG024-7.ma ... OK TIME NEEDED: 0.41 Rating : 0.00 661
+Unsatisfiable/RNG025-4.ma ... FAIL Rating : 0.29 662
+Unsatisfiable/RNG025-5.ma ... FAIL Rating : 0.36 663
+Unsatisfiable/RNG025-6.ma ... FAIL Rating : 0.29 664
+Unsatisfiable/RNG025-7.ma ... FAIL Rating : 0.43 665
+Unsatisfiable/RNG026-6.ma ... FAIL Rating : 0.57 666
+Unsatisfiable/RNG026-7.ma ... FAIL Rating : 0.50 667
+Unsatisfiable/RNG027-5.ma ... FAIL Rating : 0.86 668
+Unsatisfiable/RNG027-7.ma ... FAIL Rating : 0.86 669
+Unsatisfiable/RNG027-8.ma ... FAIL Rating : 0.86 670
+Unsatisfiable/RNG027-9.ma ... FAIL Rating : 0.86 671
+Unsatisfiable/RNG028-5.ma ... FAIL Rating : 0.86 672
+Unsatisfiable/RNG028-7.ma ... FAIL Rating : 0.86 673
+Unsatisfiable/RNG028-8.ma ... FAIL Rating : 0.86 674
+Unsatisfiable/RNG028-9.ma ... FAIL Rating : 0.86 675
+Unsatisfiable/RNG029-5.ma ... FAIL Rating : 0.86 676
+Unsatisfiable/RNG029-6.ma ... FAIL Rating : 0.86 677
+Unsatisfiable/RNG029-7.ma ... FAIL Rating : 0.86 678
+Unsatisfiable/RNG035-7.ma ... FAIL Rating : 0.86 679
+Unsatisfiable/ROB001-1.ma ... FAIL Rating : 1.00 680
+Unsatisfiable/ROB002-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 681
+Unsatisfiable/ROB003-1.ma ... OK TIME NEEDED: 72.86 Rating : 0.00 682
+Unsatisfiable/ROB004-1.ma ... OK TIME NEEDED: 99.80 Rating : 0.00 683
+Unsatisfiable/ROB005-1.ma ... FAIL Rating : 0.07 684
+Unsatisfiable/ROB006-1.ma ... FAIL Rating : 0.86 685
+Unsatisfiable/ROB006-2.ma ... FAIL Rating : 0.86 686
+Unsatisfiable/ROB008-1.ma ... OK TIME NEEDED: 67.56 Rating : 0.00 687
+Unsatisfiable/ROB009-1.ma ... OK TIME NEEDED: 80.05 Rating : 0.00 688
+Unsatisfiable/ROB010-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 689
+Unsatisfiable/ROB013-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 690
+Unsatisfiable/ROB022-1.ma ... FAIL Rating : 0.00 691
+Unsatisfiable/ROB023-1.ma ... FAIL Rating : 0.00 692
+Unsatisfiable/ROB026-1.ma ... FAIL Rating : 0.86 693
+Unsatisfiable/ROB030-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 694
+Unsatisfiable/ROB031-1.ma ... FAIL Rating : 1.00 695
+Unsatisfiable/ROB032-1.ma ... FAIL Rating : 1.00 696
+Unsatisfiable/SYN080-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 697
+Unsatisfiable/SYN083-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 698
diff --git a/matita/tests/TPTP/log.300.19-6.txt b/matita/tests/TPTP/log.300.19-6.txt
new file mode 100644 (file)
index 0000000..e3b4562
--- /dev/null
@@ -0,0 +1,698 @@
+Unsatisfiable/ALG005-1.ma ... FAIL Rating : 0.07 1
+Unsatisfiable/ALG006-1.ma ... OK TIME NEEDED: 324.10 Rating : 0.00 2
+Unsatisfiable/ALG007-1.ma ... OK TIME NEEDED: 475.52 Rating : 0.00 3
+Unsatisfiable/BOO001-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 4
+Unsatisfiable/BOO002-1.ma ... OK TIME NEEDED: 7.20 Rating : 0.07 5
+Unsatisfiable/BOO002-2.ma ... OK TIME NEEDED: 12.64 Rating : 0.00 6
+Unsatisfiable/BOO003-2.ma ... OK TIME NEEDED: 0.47 Rating : 0.00 7
+Unsatisfiable/BOO003-4.ma ... OK TIME NEEDED: 0.58 Rating : 0.00 8
+Unsatisfiable/BOO004-2.ma ... OK TIME NEEDED: 0.36 Rating : 0.00 9
+Unsatisfiable/BOO004-4.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 10
+Unsatisfiable/BOO005-2.ma ... OK TIME NEEDED: 0.28 Rating : 0.00 11
+Unsatisfiable/BOO005-4.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 12
+Unsatisfiable/BOO006-2.ma ... OK TIME NEEDED: 0.85 Rating : 0.00 13
+Unsatisfiable/BOO006-4.ma ... OK TIME NEEDED: 0.75 Rating : 0.00 14
+Unsatisfiable/BOO007-2.ma ... OK TIME NEEDED: 166.08 Rating : 0.14 15
+Unsatisfiable/BOO007-4.ma ... OK TIME NEEDED: 79.91 Rating : 0.07 16
+Unsatisfiable/BOO008-2.ma ... OK TIME NEEDED: 245.82 Rating : 0.07 17
+Unsatisfiable/BOO008-4.ma ... OK TIME NEEDED: 106.85 Rating : 0.00 18
+Unsatisfiable/BOO009-2.ma ... OK TIME NEEDED: 1.32 Rating : 0.00 19
+Unsatisfiable/BOO009-4.ma ... OK TIME NEEDED: 0.98 Rating : 0.00 20
+Unsatisfiable/BOO010-2.ma ... OK TIME NEEDED: 1.29 Rating : 0.00 21
+Unsatisfiable/BOO010-4.ma ... OK TIME NEEDED: 0.67 Rating : 0.00 22
+Unsatisfiable/BOO011-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 23
+Unsatisfiable/BOO011-4.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 24
+Unsatisfiable/BOO012-2.ma ... OK TIME NEEDED: 0.43 Rating : 0.00 25
+Unsatisfiable/BOO012-4.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 26
+Unsatisfiable/BOO013-2.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 27
+Unsatisfiable/BOO013-4.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 28
+Unsatisfiable/BOO014-2.ma ... OK TIME NEEDED: 8.10 Rating : 0.00 29
+Unsatisfiable/BOO014-4.ma ... OK TIME NEEDED: 29.37 Rating : 0.00 30
+Unsatisfiable/BOO015-2.ma ... OK TIME NEEDED: 6.25 Rating : 0.00 31
+Unsatisfiable/BOO015-4.ma ... OK TIME NEEDED: 26.58 Rating : 0.00 32
+Unsatisfiable/BOO016-2.ma ... OK TIME NEEDED: 1.76 Rating : 0.00 33
+Unsatisfiable/BOO017-2.ma ... OK TIME NEEDED: 1.93 Rating : 0.00 34
+Unsatisfiable/BOO018-4.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 35
+Unsatisfiable/BOO021-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.07 36
+Unsatisfiable/BOO022-1.ma ... FAIL Rating : 0.07 37
+Unsatisfiable/BOO023-1.ma ... FAIL Rating : 0.50 38
+Unsatisfiable/BOO024-1.ma ... OK TIME NEEDED: 3.17 Rating : 0.00 39
+Unsatisfiable/BOO025-1.ma ... OK TIME NEEDED: 8.45 Rating : 0.07 40
+Unsatisfiable/BOO026-1.ma ... OK Rating : 0.07 41
+Unsatisfiable/BOO028-1.ma ... FAIL Rating : 0.07 42
+Unsatisfiable/BOO029-1.ma ... OK TIME NEEDED: 21.11 Rating : 0.00 43
+Unsatisfiable/BOO031-1.ma ... FAIL Rating : 0.21 44
+Unsatisfiable/BOO034-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.21 45
+Unsatisfiable/BOO067-1.ma ... FAIL Rating : 0.21 46
+Unsatisfiable/BOO068-1.ma ... OK TIME NEEDED: 2.13 Rating : 0.00 47
+Unsatisfiable/BOO069-1.ma ... OK TIME NEEDED: 1.46 Rating : 0.00 48
+Unsatisfiable/BOO070-1.ma ... OK TIME NEEDED: 2.38 Rating : 0.00 49
+Unsatisfiable/BOO071-1.ma ... OK TIME NEEDED: 1.38 Rating : 0.00 50
+Unsatisfiable/BOO072-1.ma ... FAIL Rating : 0.07 51
+Unsatisfiable/BOO073-1.ma ... FAIL Rating : 0.36 52
+Unsatisfiable/BOO074-1.ma ... FAIL Rating : 0.07 53
+Unsatisfiable/BOO075-1.ma ... OK TIME NEEDED: 0.66 Rating : 0.00 54
+Unsatisfiable/BOO076-1.ma ... FAIL Rating : 0.71 55
+Unsatisfiable/COL001-1.ma ... OK TIME NEEDED: 559.63 Rating : 0.07 56
+Unsatisfiable/COL001-2.ma ... OK TIME NEEDED: 15.71 Rating : 0.07 57
+Unsatisfiable/COL002-1.ma ... OK TIME NEEDED: 5.65 Rating : 0.00 58
+Unsatisfiable/COL002-4.ma ... OK TIME NEEDED: 100.64 Rating : 0.07 59
+Unsatisfiable/COL002-5.ma ... FAIL Rating : 0.43 60
+Unsatisfiable/COL003-1.ma ... FAIL Rating : 0.79 61
+Unsatisfiable/COL004-1.ma ... FAIL Rating : 0.57 62
+Unsatisfiable/COL004-3.ma ... FAIL Rating : 0.21 63
+Unsatisfiable/COL006-1.ma ... FAIL Rating : 0.57 64
+Unsatisfiable/COL006-5.ma ... FAIL Rating : 0.64 65
+Unsatisfiable/COL006-6.ma ... FAIL Rating : 0.64 66
+Unsatisfiable/COL006-7.ma ... FAIL Rating : 0.64 67
+Unsatisfiable/COL007-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 68
+Unsatisfiable/COL008-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 69
+Unsatisfiable/COL009-1.ma ... OK TIME NEEDED: 26.92 Rating : 0.07 70
+Unsatisfiable/COL010-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.07 71
+Unsatisfiable/COL011-1.ma ... FAIL Rating : 0.36 72
+Unsatisfiable/COL012-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 73
+Unsatisfiable/COL013-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 74
+Unsatisfiable/COL014-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 75
+Unsatisfiable/COL015-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 76
+Unsatisfiable/COL016-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 77
+Unsatisfiable/COL017-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 78
+Unsatisfiable/COL018-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 79
+Unsatisfiable/COL019-1.ma ... OK TIME NEEDED: 4.46 Rating : 0.00 80
+Unsatisfiable/COL020-1.ma ... FAIL Rating : 0.07 81
+Unsatisfiable/COL021-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 82
+Unsatisfiable/COL022-1.ma ... OK TIME NEEDED: 0.75 Rating : 0.00 83
+Unsatisfiable/COL023-1.ma ... OK TIME NEEDED: 452.84 Rating : 0.00 84
+Unsatisfiable/COL024-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 85
+Unsatisfiable/COL025-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 86
+Unsatisfiable/COL026-1.ma ... FAIL Rating : 0.07 87
+Unsatisfiable/COL027-1.ma ... FAIL Rating : 0.00 88
+Unsatisfiable/COL029-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 89
+Unsatisfiable/COL030-1.ma ... OK TIME NEEDED: 0.73 Rating : 0.14 90
+Unsatisfiable/COL031-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 91
+Unsatisfiable/COL032-1.ma ... OK Rating : 0.14 92
+Unsatisfiable/COL033-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.07 93
+Unsatisfiable/COL034-1.ma ... FAIL Rating : 0.43 94
+Unsatisfiable/COL035-1.ma ... FAIL Rating : 0.14 95
+Unsatisfiable/COL036-1.ma ... OK TIME NEEDED: 143.77 Rating : 0.57 96
+Unsatisfiable/COL037-1.ma ... FAIL Rating : 0.29 97
+Unsatisfiable/COL038-1.ma ... FAIL Rating : 0.64 98
+Unsatisfiable/COL039-1.ma ... OK TIME NEEDED: 77.40 Rating : 0.00 99
+Unsatisfiable/COL041-1.ma ... OK Rating : 0.36 100
+Unsatisfiable/COL042-1.ma ... FAIL Rating : 0.86 101
+Unsatisfiable/COL042-6.ma ... FAIL Rating : 0.14 102
+Unsatisfiable/COL042-7.ma ... FAIL Rating : 0.14 103
+Unsatisfiable/COL042-8.ma ... FAIL Rating : 0.14 104
+Unsatisfiable/COL042-9.ma ... FAIL Rating : 0.14 105
+Unsatisfiable/COL043-1.ma ... FAIL Rating : 0.86 106
+Unsatisfiable/COL043-3.ma ... FAIL Rating : 0.71 107
+Unsatisfiable/COL044-1.ma ... FAIL Rating : 0.21 108
+Unsatisfiable/COL044-6.ma ... FAIL Rating : 0.64 109
+Unsatisfiable/COL044-7.ma ... FAIL Rating : 0.50 110
+Unsatisfiable/COL044-8.ma ... FAIL Rating : 0.71 111
+Unsatisfiable/COL044-9.ma ... FAIL Rating : 0.64 112
+Unsatisfiable/COL045-1.ma ... OK TIME NEEDED: 4.06 Rating : 0.00 113
+Unsatisfiable/COL046-1.ma ... FAIL Rating : 0.64 114
+Unsatisfiable/COL048-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 115
+Unsatisfiable/COL049-1.ma ... FAIL Rating : 0.29 116
+Unsatisfiable/COL050-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 117
+Unsatisfiable/COL051-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 118
+Unsatisfiable/COL052-1.ma ... FAIL Rating : 0.00 119
+Unsatisfiable/COL053-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 120
+Unsatisfiable/COL056-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.07 121
+Unsatisfiable/COL057-1.ma ... FAIL Rating : 0.36 122
+Unsatisfiable/COL058-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 123
+Unsatisfiable/COL058-2.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 124
+Unsatisfiable/COL058-3.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 125
+Unsatisfiable/COL059-1.ma ... FAIL Rating : 0.00 126
+Unsatisfiable/COL060-1.ma ... FAIL Rating : 0.36 127
+Unsatisfiable/COL060-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 128
+Unsatisfiable/COL060-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 129
+Unsatisfiable/COL061-1.ma ... FAIL Rating : 0.36 130
+Unsatisfiable/COL061-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 131
+Unsatisfiable/COL061-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 132
+Unsatisfiable/COL062-1.ma ... FAIL Rating : 0.50 133
+Unsatisfiable/COL062-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 134
+Unsatisfiable/COL062-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 135
+Unsatisfiable/COL063-1.ma ... FAIL Rating : 0.50 136
+Unsatisfiable/COL063-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 137
+Unsatisfiable/COL063-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 138
+Unsatisfiable/COL063-4.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 139
+Unsatisfiable/COL063-5.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 140
+Unsatisfiable/COL063-6.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 141
+Unsatisfiable/COL064-1.ma ... FAIL Rating : 0.64 142
+Unsatisfiable/COL064-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 143
+Unsatisfiable/COL064-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 144
+Unsatisfiable/COL064-4.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 145
+Unsatisfiable/COL064-5.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 146
+Unsatisfiable/COL064-6.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 147
+Unsatisfiable/COL064-7.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 148
+Unsatisfiable/COL064-8.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 149
+Unsatisfiable/COL064-9.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 150
+Unsatisfiable/COL065-1.ma ... FAIL Rating : 0.71 151
+Unsatisfiable/COL066-1.ma ... FAIL Rating : 0.93 152
+Unsatisfiable/COL066-2.ma ... OK TIME NEEDED: 7.08 Rating : 0.00 153
+Unsatisfiable/COL066-3.ma ... OK TIME NEEDED: 6.55 Rating : 0.00 154
+Unsatisfiable/COL070-1.ma ... OK TIME NEEDED: 330.85 Rating : 0.07 155
+Unsatisfiable/COL075-2.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 156
+Unsatisfiable/COL083-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 157
+Unsatisfiable/COL084-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 158
+Unsatisfiable/COL085-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 159
+Unsatisfiable/COL086-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 160
+Unsatisfiable/GRP001-2.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 161
+Unsatisfiable/GRP001-4.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 162
+Unsatisfiable/GRP002-2.ma ... OK TIME NEEDED: 8.94 Rating : 0.00 163
+Unsatisfiable/GRP002-3.ma ... OK TIME NEEDED: 20.76 Rating : 0.00 164
+Unsatisfiable/GRP002-4.ma ... OK TIME NEEDED: 17.58 Rating : 0.00 165
+Unsatisfiable/GRP010-4.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 166
+Unsatisfiable/GRP011-4.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 167
+Unsatisfiable/GRP012-4.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 168
+Unsatisfiable/GRP014-1.ma ... FAIL Rating : 0.14 169
+Unsatisfiable/GRP022-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 170
+Unsatisfiable/GRP023-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 171
+Unsatisfiable/GRP024-5.ma ... FAIL Rating : 0.50 172
+Unsatisfiable/GRP114-1.ma ... OK TIME NEEDED: 60.18 Rating : 0.29 173
+Unsatisfiable/GRP115-1.ma ... OK TIME NEEDED: 1.31 Rating : 0.00 174
+Unsatisfiable/GRP116-1.ma ... OK TIME NEEDED: 1.30 Rating : 0.00 175
+Unsatisfiable/GRP117-1.ma ... OK TIME NEEDED: 1.36 Rating : 0.00 176
+Unsatisfiable/GRP118-1.ma ... OK TIME NEEDED: 1.52 Rating : 0.00 177
+Unsatisfiable/GRP119-1.ma ... OK Rating : 0.00 178
+Unsatisfiable/GRP120-1.ma ... OK Rating : 0.00 179
+Unsatisfiable/GRP121-1.ma ... OK TIME NEEDED: 48.93 Rating : 0.00 180
+Unsatisfiable/GRP122-1.ma ... FAIL Rating : 0.07 181
+Unsatisfiable/GRP136-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 182
+Unsatisfiable/GRP137-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 183
+Unsatisfiable/GRP138-1.ma ... OK TIME NEEDED: 1.24 Rating : 0.00 184
+Unsatisfiable/GRP139-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 185
+Unsatisfiable/GRP140-1.ma ... OK TIME NEEDED: 1.29 Rating : 0.00 186
+Unsatisfiable/GRP141-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 187
+Unsatisfiable/GRP142-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 188
+Unsatisfiable/GRP143-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 189
+Unsatisfiable/GRP144-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 190
+Unsatisfiable/GRP145-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 191
+Unsatisfiable/GRP146-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 192
+Unsatisfiable/GRP147-1.ma ... OK TIME NEEDED: 1.75 Rating : 0.00 193
+Unsatisfiable/GRP148-1.ma ... OK TIME NEEDED: 1.74 Rating : 0.00 194
+Unsatisfiable/GRP149-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 195
+Unsatisfiable/GRP150-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 196
+Unsatisfiable/GRP151-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 197
+Unsatisfiable/GRP152-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 198
+Unsatisfiable/GRP153-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 199
+Unsatisfiable/GRP154-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 200
+Unsatisfiable/GRP155-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.00 201
+Unsatisfiable/GRP156-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.00 202
+Unsatisfiable/GRP157-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 203
+Unsatisfiable/GRP158-1.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 204
+Unsatisfiable/GRP159-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 205
+Unsatisfiable/GRP160-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 206
+Unsatisfiable/GRP161-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 207
+Unsatisfiable/GRP162-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 208
+Unsatisfiable/GRP163-1.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 209
+Unsatisfiable/GRP164-1.ma ... FAIL Rating : 0.93 210
+Unsatisfiable/GRP164-2.ma ... FAIL Rating : 0.93 211
+Unsatisfiable/GRP165-1.ma ... OK TIME NEEDED: 1.76 Rating : 0.00 212
+Unsatisfiable/GRP165-2.ma ... OK TIME NEEDED: 1.63 Rating : 0.00 213
+Unsatisfiable/GRP166-1.ma ... OK TIME NEEDED: 17.00 Rating : 0.00 214
+Unsatisfiable/GRP166-2.ma ... OK TIME NEEDED: 23.37 Rating : 0.00 215
+Unsatisfiable/GRP166-3.ma ... OK TIME NEEDED: 4.36 Rating : 0.00 216
+Unsatisfiable/GRP166-4.ma ... OK TIME NEEDED: 4.42 Rating : 0.00 217
+Unsatisfiable/GRP167-1.ma ... OK TIME NEEDED: 110.83 Rating : 0.21 218
+Unsatisfiable/GRP167-2.ma ... OK TIME NEEDED: 114.98 Rating : 0.21 219
+Unsatisfiable/GRP167-3.ma ... FAIL Rating : 0.50 220
+Unsatisfiable/GRP167-4.ma ... FAIL Rating : 0.43 221
+Unsatisfiable/GRP167-5.ma ... OK TIME NEEDED: 2.36 Rating : 0.14 222
+Unsatisfiable/GRP168-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.07 223
+Unsatisfiable/GRP168-2.ma ... OK TIME NEEDED: 0.28 Rating : 0.07 224
+Unsatisfiable/GRP169-1.ma ... OK TIME NEEDED: 115.38 Rating : 0.00 225
+Unsatisfiable/GRP169-2.ma ... OK TIME NEEDED: 99.20 Rating : 0.00 226
+Unsatisfiable/GRP170-1.ma ... FAIL Rating : 0.00 227
+Unsatisfiable/GRP170-2.ma ... FAIL Rating : 0.00 228
+Unsatisfiable/GRP170-3.ma ... FAIL Rating : 0.00 229
+Unsatisfiable/GRP170-4.ma ... FAIL Rating : 0.00 230
+Unsatisfiable/GRP171-1.ma ... OK TIME NEEDED: 1.53 Rating : 0.00 231
+Unsatisfiable/GRP171-2.ma ... OK TIME NEEDED: 1.60 Rating : 0.00 232
+Unsatisfiable/GRP172-1.ma ... OK TIME NEEDED: 1.60 Rating : 0.00 233
+Unsatisfiable/GRP172-2.ma ... OK TIME NEEDED: 1.56 Rating : 0.00 234
+Unsatisfiable/GRP173-1.ma ... OK TIME NEEDED: 0.73 Rating : 0.00 235
+Unsatisfiable/GRP174-1.ma ... OK TIME NEEDED: 0.95 Rating : 0.00 236
+Unsatisfiable/GRP175-1.ma ... OK TIME NEEDED: 1.83 Rating : 0.00 237
+Unsatisfiable/GRP175-2.ma ... OK TIME NEEDED: 1.82 Rating : 0.00 238
+Unsatisfiable/GRP175-3.ma ... OK TIME NEEDED: 1.90 Rating : 0.00 239
+Unsatisfiable/GRP175-4.ma ... OK TIME NEEDED: 1.61 Rating : 0.00 240
+Unsatisfiable/GRP176-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 241
+Unsatisfiable/GRP176-2.ma ... OK TIME NEEDED: 0.22 Rating : 0.00 242
+Unsatisfiable/GRP177-2.ma ... FAIL Rating : 0.21 243
+Unsatisfiable/GRP178-1.ma ... FAIL Rating : 0.14 244
+Unsatisfiable/GRP178-2.ma ... FAIL Rating : 0.14 245
+Unsatisfiable/GRP179-1.ma ... FAIL Rating : 0.50 246
+Unsatisfiable/GRP179-2.ma ... FAIL Rating : 0.50 247
+Unsatisfiable/GRP179-3.ma ... FAIL Rating : 0.36 248
+Unsatisfiable/GRP180-1.ma ... FAIL Rating : 0.50 249
+Unsatisfiable/GRP180-2.ma ... FAIL Rating : 0.43 250
+Unsatisfiable/GRP181-1.ma ... FAIL Rating : 0.71 251
+Unsatisfiable/GRP181-2.ma ... FAIL Rating : 0.71 252
+Unsatisfiable/GRP181-3.ma ... OK TIME NEEDED: 28.37 Rating : 0.43 253
+Unsatisfiable/GRP181-4.ma ... OK TIME NEEDED: 35.94 Rating : 0.43 254
+Unsatisfiable/GRP182-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 255
+Unsatisfiable/GRP182-2.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 256
+Unsatisfiable/GRP182-3.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 257
+Unsatisfiable/GRP182-4.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 258
+Unsatisfiable/GRP183-1.ma ... FAIL Rating : 0.43 259
+Unsatisfiable/GRP183-2.ma ... FAIL Rating : 0.43 260
+Unsatisfiable/GRP183-3.ma ... FAIL Rating : 0.43 261
+Unsatisfiable/GRP183-4.ma ... FAIL Rating : 0.36 262
+Unsatisfiable/GRP184-1.ma ... FAIL Rating : 0.29 263
+Unsatisfiable/GRP184-2.ma ... FAIL Rating : 0.14 264
+Unsatisfiable/GRP184-3.ma ... FAIL Rating : 0.21 265
+Unsatisfiable/GRP184-4.ma ... OK TIME NEEDED: 51.53 Rating : 0.00 266
+Unsatisfiable/GRP185-1.ma ... FAIL Rating : 0.07 267
+Unsatisfiable/GRP185-2.ma ... FAIL Rating : 0.07 268
+Unsatisfiable/GRP185-3.ma ... FAIL Rating : 0.21 269
+Unsatisfiable/GRP185-4.ma ... FAIL Rating : 0.21 270
+Unsatisfiable/GRP186-1.ma ... FAIL Rating : 0.57 271
+Unsatisfiable/GRP186-2.ma ... FAIL Rating : 0.36 272
+Unsatisfiable/GRP186-3.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 273
+Unsatisfiable/GRP186-4.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 274
+Unsatisfiable/GRP187-1.ma ... FAIL Rating : 0.64 275
+Unsatisfiable/GRP188-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 276
+Unsatisfiable/GRP188-2.ma ... FAIL Rating : 0.00 277
+Unsatisfiable/GRP189-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 278
+Unsatisfiable/GRP189-2.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 279
+Unsatisfiable/GRP190-1.ma ... OK TIME NEEDED: 156.68 Rating : 0.00 280
+Unsatisfiable/GRP190-2.ma ... OK TIME NEEDED: 155.26 Rating : 0.00 281
+Unsatisfiable/GRP191-1.ma ... OK TIME NEEDED: 145.33 Rating : 0.00 282
+Unsatisfiable/GRP191-2.ma ... OK TIME NEEDED: 143.45 Rating : 0.00 283
+Unsatisfiable/GRP192-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.07 284
+Unsatisfiable/GRP193-1.ma ... OK TIME NEEDED: 32.58 Rating : 0.00 285
+Unsatisfiable/GRP193-2.ma ... OK TIME NEEDED: 32.81 Rating : 0.00 286
+Unsatisfiable/GRP195-1.ma ... FAIL Rating : 0.00 287
+Unsatisfiable/GRP196-1.ma ... FAIL Rating : 0.93 288
+Unsatisfiable/GRP200-1.ma ... FAIL Rating : 0.29 289
+Unsatisfiable/GRP201-1.ma ... FAIL Rating : 0.36 290
+Unsatisfiable/GRP202-1.ma ... FAIL Rating : 0.43 291
+Unsatisfiable/GRP203-1.ma ... FAIL Rating : 0.21 292
+Unsatisfiable/GRP205-1.ma ... FAIL Rating : 0.43 293
+Unsatisfiable/GRP206-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 294
+Unsatisfiable/GRP403-1.ma ... OK TIME NEEDED: 90.63 Rating : 0.07 295
+Unsatisfiable/GRP404-1.ma ... FAIL Rating : 0.21 296
+Unsatisfiable/GRP405-1.ma ... FAIL Rating : 0.21 297
+Unsatisfiable/GRP406-1.ma ... OK TIME NEEDED: 88.30 Rating : 0.00 298
+Unsatisfiable/GRP407-1.ma ... FAIL Rating : 0.00 299
+Unsatisfiable/GRP408-1.ma ... FAIL Rating : 0.00 300
+Unsatisfiable/GRP409-1.ma ... OK TIME NEEDED: 1.29 Rating : 0.00 301
+Unsatisfiable/GRP410-1.ma ... FAIL Rating : 0.21 302
+Unsatisfiable/GRP411-1.ma ... FAIL Rating : 0.21 303
+Unsatisfiable/GRP412-1.ma ... OK TIME NEEDED: 47.25 Rating : 0.00 304
+Unsatisfiable/GRP413-1.ma ... FAIL Rating : 0.07 305
+Unsatisfiable/GRP414-1.ma ... FAIL Rating : 0.07 306
+Unsatisfiable/GRP415-1.ma ... FAIL Rating : 0.00 307
+Unsatisfiable/GRP416-1.ma ... FAIL Rating : 0.07 308
+Unsatisfiable/GRP417-1.ma ... FAIL Rating : 0.14 309
+Unsatisfiable/GRP418-1.ma ... FAIL Rating : 0.07 310
+Unsatisfiable/GRP419-1.ma ... FAIL Rating : 0.29 311
+Unsatisfiable/GRP420-1.ma ... FAIL Rating : 0.36 312
+Unsatisfiable/GRP421-1.ma ... OK TIME NEEDED: 79.02 Rating : 0.14 313
+Unsatisfiable/GRP422-1.ma ... FAIL Rating : 0.29 314
+Unsatisfiable/GRP423-1.ma ... FAIL Rating : 0.36 315
+Unsatisfiable/GRP424-1.ma ... OK TIME NEEDED: 1.80 Rating : 0.00 316
+Unsatisfiable/GRP425-1.ma ... FAIL Rating : 0.07 317
+Unsatisfiable/GRP426-1.ma ... FAIL Rating : 0.14 318
+Unsatisfiable/GRP427-1.ma ... FAIL Rating : 0.00 319
+Unsatisfiable/GRP428-1.ma ... FAIL Rating : 0.00 320
+Unsatisfiable/GRP429-1.ma ... FAIL Rating : 0.14 321
+Unsatisfiable/GRP430-1.ma ... FAIL Rating : 0.00 322
+Unsatisfiable/GRP431-1.ma ... FAIL Rating : 0.00 323
+Unsatisfiable/GRP432-1.ma ... FAIL Rating : 0.00 324
+Unsatisfiable/GRP433-1.ma ... FAIL Rating : 0.00 325
+Unsatisfiable/GRP434-1.ma ... FAIL Rating : 0.00 326
+Unsatisfiable/GRP435-1.ma ... FAIL Rating : 0.00 327
+Unsatisfiable/GRP436-1.ma ... FAIL Rating : 0.07 328
+Unsatisfiable/GRP437-1.ma ... FAIL Rating : 0.07 329
+Unsatisfiable/GRP438-1.ma ... FAIL Rating : 0.07 330
+Unsatisfiable/GRP439-1.ma ... FAIL Rating : 0.07 331
+Unsatisfiable/GRP440-1.ma ... FAIL Rating : 0.14 332
+Unsatisfiable/GRP441-1.ma ... FAIL Rating : 0.21 333
+Unsatisfiable/GRP442-1.ma ... FAIL Rating : 0.14 334
+Unsatisfiable/GRP443-1.ma ... FAIL Rating : 0.07 335
+Unsatisfiable/GRP444-1.ma ... FAIL Rating : 0.21 336
+Unsatisfiable/GRP445-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 337
+Unsatisfiable/GRP446-1.ma ... OK TIME NEEDED: 0.62 Rating : 0.00 338
+Unsatisfiable/GRP447-1.ma ... OK TIME NEEDED: 11.05 Rating : 0.14 339
+Unsatisfiable/GRP448-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 340
+Unsatisfiable/GRP449-1.ma ... OK TIME NEEDED: 0.64 Rating : 0.00 341
+Unsatisfiable/GRP450-1.ma ... OK TIME NEEDED: 10.86 Rating : 0.07 342
+Unsatisfiable/GRP451-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 343
+Unsatisfiable/GRP452-1.ma ... OK TIME NEEDED: 98.00 Rating : 0.14 344
+Unsatisfiable/GRP453-1.ma ... OK TIME NEEDED: 146.19 Rating : 0.21 345
+Unsatisfiable/GRP454-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 346
+Unsatisfiable/GRP455-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 347
+Unsatisfiable/GRP456-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.07 348
+Unsatisfiable/GRP457-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 349
+Unsatisfiable/GRP458-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 350
+Unsatisfiable/GRP459-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 351
+Unsatisfiable/GRP460-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 352
+Unsatisfiable/GRP461-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 353
+Unsatisfiable/GRP462-1.ma ... OK TIME NEEDED: 0.44 Rating : 0.00 354
+Unsatisfiable/GRP463-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 355
+Unsatisfiable/GRP464-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 356
+Unsatisfiable/GRP465-1.ma ... OK TIME NEEDED: 0.42 Rating : 0.00 357
+Unsatisfiable/GRP466-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 358
+Unsatisfiable/GRP467-1.ma ... OK TIME NEEDED: 0.94 Rating : 0.00 359
+Unsatisfiable/GRP468-1.ma ... OK TIME NEEDED: 184.97 Rating : 0.00 360
+Unsatisfiable/GRP469-1.ma ... FAIL Rating : 0.21 361
+Unsatisfiable/GRP470-1.ma ... FAIL Rating : 0.21 362
+Unsatisfiable/GRP471-1.ma ... FAIL Rating : 0.21 363
+Unsatisfiable/GRP472-1.ma ... FAIL Rating : 0.07 364
+Unsatisfiable/GRP473-1.ma ... FAIL Rating : 0.07 365
+Unsatisfiable/GRP474-1.ma ... FAIL Rating : 0.07 366
+Unsatisfiable/GRP475-1.ma ... FAIL Rating : 0.21 367
+Unsatisfiable/GRP476-1.ma ... FAIL Rating : 0.21 368
+Unsatisfiable/GRP477-1.ma ... FAIL Rating : 0.21 369
+Unsatisfiable/GRP478-1.ma ... FAIL Rating : 0.14 370
+Unsatisfiable/GRP479-1.ma ... FAIL Rating : 0.14 371
+Unsatisfiable/GRP480-1.ma ... FAIL Rating : 0.21 372
+Unsatisfiable/GRP481-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 373
+Unsatisfiable/GRP482-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 374
+Unsatisfiable/GRP483-1.ma ... OK TIME NEEDED: 0.53 Rating : 0.00 375
+Unsatisfiable/GRP484-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 376
+Unsatisfiable/GRP485-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 377
+Unsatisfiable/GRP486-1.ma ... OK TIME NEEDED: 0.58 Rating : 0.00 378
+Unsatisfiable/GRP487-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 379
+Unsatisfiable/GRP488-1.ma ... OK TIME NEEDED: 1.20 Rating : 0.00 380
+Unsatisfiable/GRP489-1.ma ... OK TIME NEEDED: 1.02 Rating : 0.00 381
+Unsatisfiable/GRP490-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 382
+Unsatisfiable/GRP491-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 383
+Unsatisfiable/GRP492-1.ma ... OK TIME NEEDED: 0.47 Rating : 0.00 384
+Unsatisfiable/GRP493-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 385
+Unsatisfiable/GRP494-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 386
+Unsatisfiable/GRP495-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.00 387
+Unsatisfiable/GRP496-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 388
+Unsatisfiable/GRP497-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 389
+Unsatisfiable/GRP498-1.ma ... OK TIME NEEDED: 0.27 Rating : 0.00 390
+Unsatisfiable/GRP499-1.ma ... FAIL Rating : 0.00 391
+Unsatisfiable/GRP500-1.ma ... FAIL Rating : 0.07 392
+Unsatisfiable/GRP501-1.ma ... FAIL Rating : 0.14 393
+Unsatisfiable/GRP502-1.ma ... FAIL Rating : 0.14 394
+Unsatisfiable/GRP503-1.ma ... FAIL Rating : 0.14 395
+Unsatisfiable/GRP504-1.ma ... FAIL Rating : 0.14 396
+Unsatisfiable/GRP505-1.ma ... FAIL Rating : 0.50 397
+Unsatisfiable/GRP506-1.ma ... FAIL Rating : 0.64 398
+Unsatisfiable/GRP507-1.ma ... FAIL Rating : 0.57 399
+Unsatisfiable/GRP508-1.ma ... FAIL Rating : 0.57 400
+Unsatisfiable/GRP509-1.ma ... OK TIME NEEDED: 0.98 Rating : 0.00 401
+Unsatisfiable/GRP510-1.ma ... OK TIME NEEDED: 0.86 Rating : 0.00 402
+Unsatisfiable/GRP511-1.ma ... OK TIME NEEDED: 2.09 Rating : 0.00 403
+Unsatisfiable/GRP512-1.ma ... OK TIME NEEDED: 1.00 Rating : 0.00 404
+Unsatisfiable/GRP513-1.ma ... OK TIME NEEDED: 1.02 Rating : 0.00 405
+Unsatisfiable/GRP514-1.ma ... OK TIME NEEDED: 0.98 Rating : 0.00 406
+Unsatisfiable/GRP515-1.ma ... OK TIME NEEDED: 7.25 Rating : 0.00 407
+Unsatisfiable/GRP516-1.ma ... OK TIME NEEDED: 4.15 Rating : 0.00 408
+Unsatisfiable/GRP517-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 409
+Unsatisfiable/GRP518-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 410
+Unsatisfiable/GRP519-1.ma ... OK TIME NEEDED: 5.78 Rating : 0.00 411
+Unsatisfiable/GRP520-1.ma ... OK TIME NEEDED: 0.37 Rating : 0.00 412
+Unsatisfiable/GRP521-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 413
+Unsatisfiable/GRP522-1.ma ... OK TIME NEEDED: 10.82 Rating : 0.00 414
+Unsatisfiable/GRP523-1.ma ... OK TIME NEEDED: 24.87 Rating : 0.00 415
+Unsatisfiable/GRP524-1.ma ... OK TIME NEEDED: 11.55 Rating : 0.00 416
+Unsatisfiable/GRP525-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 417
+Unsatisfiable/GRP526-1.ma ... OK TIME NEEDED: 1.61 Rating : 0.00 418
+Unsatisfiable/GRP527-1.ma ... OK TIME NEEDED: 13.32 Rating : 0.00 419
+Unsatisfiable/GRP528-1.ma ... OK TIME NEEDED: 3.04 Rating : 0.00 420
+Unsatisfiable/GRP529-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 421
+Unsatisfiable/GRP530-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 422
+Unsatisfiable/GRP531-1.ma ... OK TIME NEEDED: 8.62 Rating : 0.00 423
+Unsatisfiable/GRP532-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 424
+Unsatisfiable/GRP533-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 425
+Unsatisfiable/GRP534-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 426
+Unsatisfiable/GRP535-1.ma ... OK TIME NEEDED: 2.89 Rating : 0.00 427
+Unsatisfiable/GRP536-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 428
+Unsatisfiable/GRP537-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 429
+Unsatisfiable/GRP538-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 430
+Unsatisfiable/GRP539-1.ma ... OK TIME NEEDED: 4.26 Rating : 0.00 431
+Unsatisfiable/GRP540-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 432
+Unsatisfiable/GRP541-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 433
+Unsatisfiable/GRP542-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 434
+Unsatisfiable/GRP543-1.ma ... OK TIME NEEDED: 1.94 Rating : 0.00 435
+Unsatisfiable/GRP544-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 436
+Unsatisfiable/GRP545-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 437
+Unsatisfiable/GRP546-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 438
+Unsatisfiable/GRP547-1.ma ... OK TIME NEEDED: 0.89 Rating : 0.00 439
+Unsatisfiable/GRP548-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 440
+Unsatisfiable/GRP549-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 441
+Unsatisfiable/GRP550-1.ma ... FAIL Rating : 0.07 442
+Unsatisfiable/GRP551-1.ma ... OK TIME NEEDED: 1.26 Rating : 0.00 443
+Unsatisfiable/GRP552-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 444
+Unsatisfiable/GRP553-1.ma ... OK TIME NEEDED: 0.35 Rating : 0.00 445
+Unsatisfiable/GRP554-1.ma ... OK TIME NEEDED: 0.38 Rating : 0.00 446
+Unsatisfiable/GRP555-1.ma ... OK TIME NEEDED: 0.38 Rating : 0.00 447
+Unsatisfiable/GRP556-1.ma ... OK TIME NEEDED: 1.31 Rating : 0.00 448
+Unsatisfiable/GRP557-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 449
+Unsatisfiable/GRP558-1.ma ... OK TIME NEEDED: 0.34 Rating : 0.00 450
+Unsatisfiable/GRP559-1.ma ... OK TIME NEEDED: 63.72 Rating : 0.00 451
+Unsatisfiable/GRP560-1.ma ... OK TIME NEEDED: 3.85 Rating : 0.00 452
+Unsatisfiable/GRP561-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 453
+Unsatisfiable/GRP562-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 454
+Unsatisfiable/GRP563-1.ma ... OK TIME NEEDED: 26.52 Rating : 0.00 455
+Unsatisfiable/GRP564-1.ma ... OK TIME NEEDED: 3.48 Rating : 0.00 456
+Unsatisfiable/GRP565-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 457
+Unsatisfiable/GRP566-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 458
+Unsatisfiable/GRP567-1.ma ... OK TIME NEEDED: 3.85 Rating : 0.14 459
+Unsatisfiable/GRP568-1.ma ... OK TIME NEEDED: 0.43 Rating : 0.14 460
+Unsatisfiable/GRP569-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 461
+Unsatisfiable/GRP570-1.ma ... Unsatisfiable/GRP570-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 1
+Unsatisfiable/GRP571-1.ma ... OK TIME NEEDED: 3.12 Rating : 0.14 2
+Unsatisfiable/GRP572-1.ma ... OK TIME NEEDED: 0.22 Rating : 0.07 3
+Unsatisfiable/GRP573-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 4
+Unsatisfiable/GRP574-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 5
+Unsatisfiable/GRP575-1.ma ... OK TIME NEEDED: 9.14 Rating : 0.14 6
+Unsatisfiable/GRP576-1.ma ... OK TIME NEEDED: 0.21 Rating : 0.00 7
+Unsatisfiable/GRP577-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 8
+Unsatisfiable/GRP578-1.ma ... OK TIME NEEDED: 0.20 Rating : 0.00 9
+Unsatisfiable/GRP579-1.ma ... OK Rating : 0.07 10
+Unsatisfiable/GRP580-1.ma ... OK TIME NEEDED: 0.38 Rating : 0.00 11
+Unsatisfiable/GRP581-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 12
+Unsatisfiable/GRP582-1.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 13
+Unsatisfiable/GRP583-1.ma ... OK TIME NEEDED: 1.49 Rating : 0.07 14
+Unsatisfiable/GRP584-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 15
+Unsatisfiable/GRP585-1.ma ... OK TIME NEEDED: 8.76 Rating : 0.00 16
+Unsatisfiable/GRP586-1.ma ... OK TIME NEEDED: 8.50 Rating : 0.00 17
+Unsatisfiable/GRP587-1.ma ... OK TIME NEEDED: 502.11 Rating : 0.00 18
+Unsatisfiable/GRP588-1.ma ... OK TIME NEEDED: 180.78 Rating : 0.00 19
+Unsatisfiable/GRP589-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 20
+Unsatisfiable/GRP590-1.ma ... OK TIME NEEDED: 47.86 Rating : 0.00 21
+Unsatisfiable/GRP591-1.ma ... OK TIME NEEDED: 273.95 Rating : 0.07 22
+Unsatisfiable/GRP592-1.ma ... OK TIME NEEDED: 54.36 Rating : 0.07 23
+Unsatisfiable/GRP593-1.ma ... OK TIME NEEDED: 94.27 Rating : 0.00 24
+Unsatisfiable/GRP594-1.ma ... OK TIME NEEDED: 94.11 Rating : 0.00 25
+Unsatisfiable/GRP595-1.ma ... OK TIME NEEDED: 83.30 Rating : 0.07 26
+Unsatisfiable/GRP596-1.ma ... OK TIME NEEDED: 85.71 Rating : 0.07 27
+Unsatisfiable/GRP597-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 28
+Unsatisfiable/GRP598-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.07 29
+Unsatisfiable/GRP599-1.ma ... OK TIME NEEDED: 97.88 Rating : 0.07 30
+Unsatisfiable/GRP600-1.ma ... OK TIME NEEDED: 0.54 Rating : 0.07 31
+Unsatisfiable/GRP601-1.ma ... FAIL Rating : 0.07 32
+Unsatisfiable/GRP602-1.ma ... FAIL Rating : 0.07 33
+Unsatisfiable/GRP603-1.ma ... FAIL Rating : 0.07 34
+Unsatisfiable/GRP604-1.ma ... FAIL Rating : 0.07 35
+Unsatisfiable/GRP605-1.ma ... OK TIME NEEDED: 175.99 Rating : 0.00 36
+Unsatisfiable/GRP606-1.ma ... OK TIME NEEDED: 176.57 Rating : 0.00 37
+Unsatisfiable/GRP607-1.ma ... OK TIME NEEDED: 407.66 Rating : 0.00 38
+Unsatisfiable/GRP608-1.ma ... OK TIME NEEDED: 183.10 Rating : 0.00 39
+Unsatisfiable/GRP609-1.ma ... OK TIME NEEDED: 123.47 Rating : 0.07 40
+Unsatisfiable/GRP610-1.ma ... Unsatisfiable/GRP610-1.ma ... OK TIME NEEDED: 79.58 Rating : 0.07 1
+Unsatisfiable/GRP611-1.ma ... OK TIME NEEDED: 80.92 Rating : 0.00 2
+Unsatisfiable/GRP612-1.ma ... OK TIME NEEDED: 179.66 Rating : 0.07 3
+Unsatisfiable/GRP613-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 4
+Unsatisfiable/GRP614-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 5
+Unsatisfiable/GRP615-1.ma ... OK TIME NEEDED: 102.09 Rating : 0.07 1
+Unsatisfiable/GRP616-1.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 2
+Unsatisfiable/LAT006-1.ma ... OK TIME NEEDED: 116.84 Rating : 0.14 3
+Unsatisfiable/LAT007-1.ma ... OK TIME NEEDED: 217.47 Rating : 0.36 4
+Unsatisfiable/LAT008-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.07 5
+Unsatisfiable/LAT009-1.ma ... OK TIME NEEDED: 529.79 Rating : 0.00 6
+Unsatisfiable/LAT010-1.ma ... FAIL Rating : 0.00 7
+Unsatisfiable/LAT011-1.ma ... FAIL Rating : 0.07 8
+Unsatisfiable/LAT012-1.ma ... OK TIME NEEDED: 6.85 Rating : 0.00 9
+Unsatisfiable/LAT013-1.ma ... FAIL Rating : 0.14 10
+Unsatisfiable/LAT014-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 11
+Unsatisfiable/LAT017-1.ma ... FAIL Rating : 0.71 12
+Unsatisfiable/LAT018-1.ma ... FAIL Rating : 0.93 13
+Unsatisfiable/LAT019-1.ma ... FAIL Rating : 0.00 14
+Unsatisfiable/LAT020-1.ma ... FAIL Rating : 0.50 15
+Unsatisfiable/LAT021-1.ma ... FAIL Rating : 0.00 16
+Unsatisfiable/LAT022-1.ma ... FAIL Rating : 0.21 17
+Unsatisfiable/LAT023-1.ma ... FAIL Rating : 0.21 18
+Unsatisfiable/LAT026-1.ma ... OK TIME NEEDED: 162.24 Rating : 0.14 19
+Unsatisfiable/LAT027-1.ma ... OK TIME NEEDED: 62.99 Rating : 0.07 20
+Unsatisfiable/LAT028-1.ma ... OK TIME NEEDED: 43.96 Rating : 0.00 21
+Unsatisfiable/LAT031-1.ma ... OK TIME NEEDED: 25.43 Rating : 0.00 22
+Unsatisfiable/LAT032-1.ma ... OK TIME NEEDED: 233.76 Rating : 0.00 23
+Unsatisfiable/LAT033-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 24
+Unsatisfiable/LAT034-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 25
+Unsatisfiable/LAT038-1.ma ... FAIL Rating : 0.43 26
+Unsatisfiable/LAT039-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 27
+Unsatisfiable/LAT039-2.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 28
+Unsatisfiable/LAT040-1.ma ... OK TIME NEEDED: 222.06 Rating : 0.00 29
+Unsatisfiable/LAT042-1.ma ... OK TIME NEEDED: 61.99 Rating : 0.00 30
+Unsatisfiable/LAT043-1.ma ... OK TIME NEEDED: 299.60 Rating : 0.00 31
+Unsatisfiable/LAT044-1.ma ... FAIL Rating : 0.14 32
+Unsatisfiable/LAT045-1.ma ... FAIL Rating : 0.07 33
+Unsatisfiable/LAT070-1.ma ... FAIL Rating : 0.93 34
+Unsatisfiable/LAT072-1.ma ... FAIL Rating : 1.00 35
+Unsatisfiable/LAT074-1.ma ... FAIL Rating : 1.00 36
+Unsatisfiable/LAT075-1.ma ... FAIL Rating : 1.00 37
+Unsatisfiable/LAT076-1.ma ... FAIL Rating : 1.00 38
+Unsatisfiable/LAT077-1.ma ... FAIL Rating : 1.00 39
+Unsatisfiable/LAT078-1.ma ... FAIL Rating : 1.00 40
+Unsatisfiable/LAT079-1.ma ... FAIL Rating : 1.00 41
+Unsatisfiable/LAT080-1.ma ... OK Rating : 0.36 42
+Unsatisfiable/LAT081-1.ma ... FAIL Rating : 0.57 43
+Unsatisfiable/LAT082-1.ma ... FAIL Rating : 0.64 44
+Unsatisfiable/LAT083-1.ma ... OK Rating : 0.36 45
+Unsatisfiable/LAT084-1.ma ... FAIL Rating : 0.50 46
+Unsatisfiable/LAT085-1.ma ... FAIL Rating : 0.57 47
+Unsatisfiable/LAT086-1.ma ... FAIL Rating : 0.50 48
+Unsatisfiable/LAT087-1.ma ... FAIL Rating : 0.43 49
+Unsatisfiable/LAT088-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 50
+Unsatisfiable/LAT089-1.ma ... OK TIME NEEDED: 1.45 Rating : 0.00 51
+Unsatisfiable/LAT090-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 52
+Unsatisfiable/LAT091-1.ma ... OK TIME NEEDED: 24.68 Rating : 0.07 53
+Unsatisfiable/LAT092-1.ma ... OK Rating : 0.36 54
+Unsatisfiable/LAT093-1.ma ... FAIL Rating : 0.43 55
+Unsatisfiable/LAT094-1.ma ... OK Rating : 0.36 56
+Unsatisfiable/LAT095-1.ma ... FAIL Rating : 0.43 57
+Unsatisfiable/LAT096-1.ma ... FAIL Rating : 0.36 58
+Unsatisfiable/LAT097-1.ma ... FAIL Rating : 0.36 59
+Unsatisfiable/LAT138-1.ma ... FAIL Rating : 1.00 60
+Unsatisfiable/LAT139-1.ma ... FAIL Rating : 1.00 61
+Unsatisfiable/LAT140-1.ma ... FAIL Rating : 1.00 62
+Unsatisfiable/LAT141-1.ma ... FAIL Rating : 1.00 63
+Unsatisfiable/LAT142-1.ma ... FAIL Rating : 0.64 64
+Unsatisfiable/LAT143-1.ma ... FAIL Rating : 0.14 65
+Unsatisfiable/LAT144-1.ma ... FAIL Rating : 0.86 66
+Unsatisfiable/LAT145-1.ma ... FAIL Rating : 0.93 67
+Unsatisfiable/LAT146-1.ma ... FAIL Rating : 0.79 68
+Unsatisfiable/LAT147-1.ma ... FAIL Rating : 0.79 69
+Unsatisfiable/LAT148-1.ma ... FAIL Rating : 0.71 70
+Unsatisfiable/LAT149-1.ma ... FAIL Rating : 0.93 71
+Unsatisfiable/LAT150-1.ma ... FAIL Rating : 0.86 72
+Unsatisfiable/LAT151-1.ma ... FAIL Rating : 0.86 73
+Unsatisfiable/LAT152-1.ma ... FAIL Rating : 0.79 74
+Unsatisfiable/LAT153-1.ma ... FAIL Rating : 0.93 75
+Unsatisfiable/LAT154-1.ma ... FAIL Rating : 0.79 76
+Unsatisfiable/LAT155-1.ma ... FAIL Rating : 0.86 77
+Unsatisfiable/LAT156-1.ma ... FAIL Rating : 0.64 78
+Unsatisfiable/LAT157-1.ma ... FAIL Rating : 0.86 79
+Unsatisfiable/LAT158-1.ma ... FAIL Rating : 0.93 80
+Unsatisfiable/LAT159-1.ma ... FAIL Rating : 0.86 81
+Unsatisfiable/LAT160-1.ma ... FAIL Rating : 0.64 82
+Unsatisfiable/LAT161-1.ma ... FAIL Rating : 1.00 83
+Unsatisfiable/LAT162-1.ma ... FAIL Rating : 0.86 84
+Unsatisfiable/LAT163-1.ma ... FAIL Rating : 0.93 85
+Unsatisfiable/LAT164-1.ma ... FAIL Rating : 0.93 86
+Unsatisfiable/LAT165-1.ma ... FAIL Rating : 0.93 87
+Unsatisfiable/LAT166-1.ma ... FAIL Rating : 0.93 88
+Unsatisfiable/LAT167-1.ma ... FAIL Rating : 0.93 89
+Unsatisfiable/LAT168-1.ma ... FAIL Rating : 0.14 90
+Unsatisfiable/LAT169-1.ma ... FAIL Rating : 0.86 91
+Unsatisfiable/LAT170-1.ma ... FAIL Rating : 0.79 92
+Unsatisfiable/LAT171-1.ma ... FAIL Rating : 0.50 93
+Unsatisfiable/LAT172-1.ma ... FAIL Rating : 0.93 94
+Unsatisfiable/LAT173-1.ma ... FAIL Rating : 0.93 95
+Unsatisfiable/LAT174-1.ma ... FAIL Rating : 0.79 96
+Unsatisfiable/LAT175-1.ma ... FAIL Rating : 0.93 97
+Unsatisfiable/LAT176-1.ma ... FAIL Rating : 0.93 98
+Unsatisfiable/LAT177-1.ma ... FAIL Rating : 1.00 99
+Unsatisfiable/LCL109-2.ma ... OK TIME NEEDED: 181.65 Rating : 0.29 100
+Unsatisfiable/LCL109-6.ma ... OK TIME NEEDED: 325.11 Rating : 0.14 101
+Unsatisfiable/LCL110-2.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 102
+Unsatisfiable/LCL111-2.ma ... OK TIME NEEDED: 7.91 Rating : 0.07 103
+Unsatisfiable/LCL112-2.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 104
+Unsatisfiable/LCL113-2.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 105
+Unsatisfiable/LCL114-2.ma ... OK TIME NEEDED: 0.27 Rating : 0.00 106
+Unsatisfiable/LCL115-2.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 107
+Unsatisfiable/LCL116-2.ma ... OK TIME NEEDED: 0.74 Rating : 0.00 108
+Unsatisfiable/LCL132-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 109
+Unsatisfiable/LCL133-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 110
+Unsatisfiable/LCL134-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 111
+Unsatisfiable/LCL135-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 112
+Unsatisfiable/LCL138-1.ma ... FAIL Rating : 0.21 113
+Unsatisfiable/LCL139-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 114
+Unsatisfiable/LCL140-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 115
+Unsatisfiable/LCL141-1.ma ... FAIL Rating : 0.00 116
+Unsatisfiable/LCL153-1.ma ... OK TIME NEEDED: 0.38 Rating : 0.00 117
+Unsatisfiable/LCL154-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.00 118
+Unsatisfiable/LCL155-1.ma ... OK TIME NEEDED: 0.21 Rating : 0.00 119
+Unsatisfiable/LCL156-1.ma ... OK TIME NEEDED: 0.20 Rating : 0.00 120
+Unsatisfiable/LCL157-1.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 121
+Unsatisfiable/LCL158-1.ma ... OK TIME NEEDED: 0.38 Rating : 0.00 122
+Unsatisfiable/LCL159-1.ma ... OK TIME NEEDED: 176.84 Rating : 0.00 123
+Unsatisfiable/LCL160-1.ma ... OK TIME NEEDED: 6.76 Rating : 0.14 124
+Unsatisfiable/LCL161-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 125
+Unsatisfiable/LCL162-1.ma ... FAIL Rating : 0.00 126
+Unsatisfiable/LCL163-1.ma ... OK TIME NEEDED: 0.53 Rating : 0.14 127
+Unsatisfiable/LCL164-1.ma ... OK TIME NEEDED: 35.13 Rating : 0.00 128
+Unsatisfiable/LDA001-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 129
+Unsatisfiable/LDA002-1.ma ... OK TIME NEEDED: 16.54 Rating : 0.00 130
+Unsatisfiable/LDA007-3.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 131
+Unsatisfiable/RNG007-4.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 132
+Unsatisfiable/RNG008-3.ma ... OK TIME NEEDED: 2.18 Rating : 0.07 133
+Unsatisfiable/RNG008-4.ma ... OK TIME NEEDED: 2.18 Rating : 0.07 134
+Unsatisfiable/RNG008-7.ma ... OK TIME NEEDED: 12.24 Rating : 0.07 135
+Unsatisfiable/RNG009-5.ma ... FAIL Rating : 0.50 136
+Unsatisfiable/RNG009-7.ma ... FAIL Rating : 0.50 137
+Unsatisfiable/RNG011-5.ma ... OK TIME NEEDED: 0.37 Rating : 0.00 138
+Unsatisfiable/RNG012-6.ma ... FAIL Rating : 0.00 139
+Unsatisfiable/RNG013-6.ma ... FAIL Rating : 0.00 140
+Unsatisfiable/RNG014-6.ma ... FAIL Rating : 0.00 141
+Unsatisfiable/RNG015-6.ma ... FAIL Rating : 0.00 142
+Unsatisfiable/RNG016-6.ma ... FAIL Rating : 0.00 143
+Unsatisfiable/RNG017-6.ma ... FAIL Rating : 0.00 144
+Unsatisfiable/RNG018-6.ma ... FAIL Rating : 0.00 145
+Unsatisfiable/RNG019-6.ma ... FAIL Rating : 0.21 146
+Unsatisfiable/RNG019-7.ma ... FAIL Rating : 0.21 147
+Unsatisfiable/RNG020-6.ma ... FAIL Rating : 0.29 148
+Unsatisfiable/RNG020-7.ma ... FAIL Rating : 0.21 149
+Unsatisfiable/RNG021-6.ma ... FAIL Rating : 0.14 150
+Unsatisfiable/RNG021-7.ma ... FAIL Rating : 0.21 151
+Unsatisfiable/RNG023-6.ma ... OK TIME NEEDED: 1.36 Rating : 0.00 152
+Unsatisfiable/RNG023-7.ma ... OK TIME NEEDED: 1.48 Rating : 0.00 153
+Unsatisfiable/RNG024-6.ma ... OK TIME NEEDED: 1.34 Rating : 0.00 154
+Unsatisfiable/RNG024-7.ma ... OK TIME NEEDED: 1.48 Rating : 0.00 155
+Unsatisfiable/RNG025-4.ma ... FAIL Rating : 0.29 156
+Unsatisfiable/RNG025-5.ma ... FAIL Rating : 0.36 157
+Unsatisfiable/RNG025-6.ma ... FAIL Rating : 0.29 158
+Unsatisfiable/RNG025-7.ma ... FAIL Rating : 0.43 159
+Unsatisfiable/RNG026-6.ma ... FAIL Rating : 0.57 160
+Unsatisfiable/RNG026-7.ma ... FAIL Rating : 0.50 161
+Unsatisfiable/RNG027-5.ma ... FAIL Rating : 0.86 162
+Unsatisfiable/RNG027-7.ma ... FAIL Rating : 0.86 163
+Unsatisfiable/RNG027-8.ma ... FAIL Rating : 0.86 164
+Unsatisfiable/RNG027-9.ma ... FAIL Rating : 0.86 165
+Unsatisfiable/RNG028-5.ma ... FAIL Rating : 0.86 166
+Unsatisfiable/RNG028-7.ma ... FAIL Rating : 0.86 167
+Unsatisfiable/RNG028-8.ma ... FAIL Rating : 0.86 168
+Unsatisfiable/RNG028-9.ma ... FAIL Rating : 0.86 169
+Unsatisfiable/RNG029-5.ma ... FAIL Rating : 0.86 170
+Unsatisfiable/RNG029-6.ma ... FAIL Rating : 0.86 171
+Unsatisfiable/RNG029-7.ma ... FAIL Rating : 0.86 172
+Unsatisfiable/RNG035-7.ma ... FAIL Rating : 0.86 173
+Unsatisfiable/ROB001-1.ma ... FAIL Rating : 1.00 174
+Unsatisfiable/ROB002-1.ma ... OK TIME NEEDED: 8.65 Rating : 0.00 175
+Unsatisfiable/ROB003-1.ma ... FAIL Rating : 0.00 176
+Unsatisfiable/ROB004-1.ma ... FAIL Rating : 0.00 177
+Unsatisfiable/ROB005-1.ma ... FAIL Rating : 0.07 178
+Unsatisfiable/ROB006-1.ma ... FAIL Rating : 0.86 179
+Unsatisfiable/ROB006-2.ma ... FAIL Rating : 0.86 180
+Unsatisfiable/ROB008-1.ma ... FAIL Rating : 0.00 181
+Unsatisfiable/ROB009-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 182
+Unsatisfiable/ROB010-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 183
+Unsatisfiable/ROB013-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 184
+Unsatisfiable/ROB022-1.ma ... FAIL Rating : 0.00 185
+Unsatisfiable/ROB023-1.ma ... FAIL Rating : 0.00 186
+Unsatisfiable/ROB026-1.ma ... FAIL Rating : 0.86 187
+Unsatisfiable/ROB030-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 188
+Unsatisfiable/ROB031-1.ma ... FAIL Rating : 1.00 189
+Unsatisfiable/ROB032-1.ma ... FAIL Rating : 1.00 190
+Unsatisfiable/SYN080-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 191
+Unsatisfiable/SYN083-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 192
diff --git a/matita/tests/TPTP/log.300.26-5.menvcorti b/matita/tests/TPTP/log.300.26-5.menvcorti
new file mode 100644 (file)
index 0000000..5a4f66d
--- /dev/null
@@ -0,0 +1,698 @@
+Unsatisfiable/ALG005-1.ma ... OK TIME NEEDED: 27.54
+Unsatisfiable/ALG006-1.ma ... OK TIME NEEDED: 1.44
+Unsatisfiable/ALG007-1.ma ... OK TIME NEEDED: 2.83
+Unsatisfiable/BOO001-1.ma ... OK TIME NEEDED: 0.69
+Unsatisfiable/BOO002-1.ma ... OK TIME NEEDED: 14.36
+Unsatisfiable/BOO002-2.ma ... OK TIME NEEDED: 19.60
+Unsatisfiable/BOO003-2.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/BOO003-4.ma ... OK TIME NEEDED: 0.11
+Unsatisfiable/BOO004-2.ma ... OK TIME NEEDED: 0.06
+Unsatisfiable/BOO004-4.ma ... OK TIME NEEDED: 0.11
+Unsatisfiable/BOO005-2.ma ... OK TIME NEEDED: 0.13
+Unsatisfiable/BOO005-4.ma ... OK TIME NEEDED: 0.12
+Unsatisfiable/BOO006-2.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/BOO006-4.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/BOO007-2.ma ... OK TIME NEEDED: 72.77
+Unsatisfiable/BOO007-4.ma ... OK TIME NEEDED: 60.41
+Unsatisfiable/BOO008-2.ma ... OK TIME NEEDED: 98.05
+Unsatisfiable/BOO008-4.ma ... OK TIME NEEDED: 52.56
+Unsatisfiable/BOO009-2.ma ... OK TIME NEEDED: 0.06
+Unsatisfiable/BOO009-4.ma ... OK TIME NEEDED: 0.29
+Unsatisfiable/BOO010-2.ma ... OK TIME NEEDED: 0.07
+Unsatisfiable/BOO010-4.ma ... OK TIME NEEDED: 0.07
+Unsatisfiable/BOO011-2.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/BOO011-4.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/BOO012-2.ma ... OK TIME NEEDED: 0.46
+Unsatisfiable/BOO012-4.ma ... OK TIME NEEDED: 0.51
+Unsatisfiable/BOO013-2.ma ... OK TIME NEEDED: 0.36
+Unsatisfiable/BOO013-4.ma ... OK TIME NEEDED: 0.66
+Unsatisfiable/BOO014-2.ma ... OK TIME NEEDED: 4.44
+Unsatisfiable/BOO014-4.ma ... OK TIME NEEDED: 13.50
+Unsatisfiable/BOO015-2.ma ... OK TIME NEEDED: 3.48
+Unsatisfiable/BOO015-4.ma ... OK TIME NEEDED: 13.30
+Unsatisfiable/BOO016-2.ma ... OK TIME NEEDED: 0.22
+Unsatisfiable/BOO017-2.ma ... OK TIME NEEDED: 0.20
+Unsatisfiable/BOO018-4.ma ... OK TIME NEEDED: 0.02
+Unsatisfiable/BOO021-1.ma ... OK
+Unsatisfiable/BOO022-1.ma ... OK
+Unsatisfiable/BOO023-1.ma ... FAIL
+Unsatisfiable/BOO024-1.ma ... OK TIME NEEDED: 2.44
+Unsatisfiable/BOO025-1.ma ... OK TIME NEEDED: 40.06
+Unsatisfiable/BOO026-1.ma ... FAIL
+Unsatisfiable/BOO028-1.ma ... FAIL
+Unsatisfiable/BOO029-1.ma ... OK
+Unsatisfiable/BOO031-1.ma ... FAIL
+Unsatisfiable/BOO034-1.ma ... OK TIME NEEDED: 0.94
+Unsatisfiable/BOO067-1.ma ... FAIL
+Unsatisfiable/BOO068-1.ma ... OK TIME NEEDED: 1.61
+Unsatisfiable/BOO069-1.ma ... OK TIME NEEDED: 0.80
+Unsatisfiable/BOO070-1.ma ... OK TIME NEEDED: 1.84
+Unsatisfiable/BOO071-1.ma ... OK TIME NEEDED: 0.81
+Unsatisfiable/BOO072-1.ma ... FAIL
+Unsatisfiable/BOO073-1.ma ... FAIL
+Unsatisfiable/BOO074-1.ma ... FAIL
+Unsatisfiable/BOO075-1.ma ... OK TIME NEEDED: 0.54
+Unsatisfiable/BOO076-1.ma ... FAIL
+Unsatisfiable/COL001-1.ma ... OK TIME NEEDED: 105.21
+Unsatisfiable/COL001-2.ma ... OK TIME NEEDED: 27.06
+Unsatisfiable/COL002-1.ma ... OK TIME NEEDED: 250.20
+Unsatisfiable/COL002-4.ma ... FAIL
+Unsatisfiable/COL002-5.ma ... FAIL
+Unsatisfiable/COL003-1.ma ... FAIL
+Unsatisfiable/COL004-1.ma ... FAIL
+Unsatisfiable/COL004-3.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/COL006-1.ma ... FAIL
+Unsatisfiable/COL006-5.ma ... FAIL
+Unsatisfiable/COL006-6.ma ... FAIL
+Unsatisfiable/COL006-7.ma ... FAIL
+Unsatisfiable/COL007-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL008-1.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/COL009-1.ma ... OK TIME NEEDED: 121.79
+Unsatisfiable/COL010-1.ma ... OK TIME NEEDED: 0.97
+Unsatisfiable/COL011-1.ma ... FAIL
+Unsatisfiable/COL012-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL013-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL014-1.ma ... OK TIME NEEDED: 0.12
+Unsatisfiable/COL015-1.ma ... OK TIME NEEDED: 0.02
+Unsatisfiable/COL016-1.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/COL017-1.ma ... OK TIME NEEDED: 0.02
+Unsatisfiable/COL018-1.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/COL019-1.ma ... OK TIME NEEDED: 27.26
+Unsatisfiable/COL020-1.ma ... FAIL
+Unsatisfiable/COL021-1.ma ... OK TIME NEEDED: 0.34
+Unsatisfiable/COL022-1.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/COL023-1.ma ... FAIL
+Unsatisfiable/COL024-1.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/COL025-1.ma ... OK TIME NEEDED: 0.02
+Unsatisfiable/COL026-1.ma ... FAIL
+Unsatisfiable/COL027-1.ma ... FAIL
+Unsatisfiable/COL029-1.ma ... FAIL
+Unsatisfiable/COL030-1.ma ... FAIL
+Unsatisfiable/COL031-1.ma ... FAIL
+Unsatisfiable/COL032-1.ma ... FAIL
+Unsatisfiable/COL033-1.ma ... FAIL
+Unsatisfiable/COL034-1.ma ... FAIL
+Unsatisfiable/COL035-1.ma ... FAIL
+Unsatisfiable/COL036-1.ma ... FAIL
+Unsatisfiable/COL037-1.ma ... FAIL
+Unsatisfiable/COL038-1.ma ... FAIL
+Unsatisfiable/COL039-1.ma ... FAIL
+Unsatisfiable/COL041-1.ma ... FAIL
+Unsatisfiable/COL042-1.ma ... FAIL
+Unsatisfiable/COL042-6.ma ... FAIL
+Unsatisfiable/COL042-7.ma ... FAIL
+Unsatisfiable/COL042-8.ma ... FAIL
+Unsatisfiable/COL042-9.ma ... FAIL
+Unsatisfiable/COL043-1.ma ... FAIL
+Unsatisfiable/COL043-3.ma ... FAIL
+Unsatisfiable/COL044-1.ma ... FAIL
+Unsatisfiable/COL044-6.ma ... FAIL
+Unsatisfiable/COL044-7.ma ... FAIL
+Unsatisfiable/COL044-8.ma ... FAIL
+Unsatisfiable/COL044-9.ma ... FAIL
+Unsatisfiable/COL045-1.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/COL046-1.ma ... FAIL
+Unsatisfiable/COL048-1.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/COL049-1.ma ... FAIL
+Unsatisfiable/COL050-1.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/COL051-1.ma ... OK
+Unsatisfiable/COL052-1.ma ... FAIL
+Unsatisfiable/COL053-1.ma ... FAIL
+Unsatisfiable/COL056-1.ma ... OK
+Unsatisfiable/COL057-1.ma ... FAIL
+Unsatisfiable/COL058-1.ma ... OK
+Unsatisfiable/COL058-2.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL058-3.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/COL059-1.ma ... FAIL
+Unsatisfiable/COL060-1.ma ... FAIL
+Unsatisfiable/COL060-2.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL060-3.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL061-1.ma ... FAIL
+Unsatisfiable/COL061-2.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL061-3.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL062-1.ma ... FAIL
+Unsatisfiable/COL062-2.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL062-3.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL063-1.ma ... FAIL
+Unsatisfiable/COL063-2.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL063-3.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL063-4.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL063-5.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL063-6.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL064-1.ma ... FAIL
+Unsatisfiable/COL064-2.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL064-3.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL064-4.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL064-5.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL064-6.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL064-7.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL064-8.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL064-9.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL065-1.ma ... FAIL
+Unsatisfiable/COL066-1.ma ... FAIL
+Unsatisfiable/COL066-2.ma ... OK TIME NEEDED: 1.21
+Unsatisfiable/COL066-3.ma ... OK TIME NEEDED: 1.20
+Unsatisfiable/COL070-1.ma ... FAIL
+Unsatisfiable/COL075-2.ma ... OK
+Unsatisfiable/COL083-1.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/COL084-1.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/COL085-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/COL086-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/GRP001-2.ma ... OK TIME NEEDED: 0.04
+Unsatisfiable/GRP001-4.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/GRP002-2.ma ... OK TIME NEEDED: 9.84
+Unsatisfiable/GRP002-3.ma ... OK TIME NEEDED: 8.65
+Unsatisfiable/GRP002-4.ma ... OK TIME NEEDED: 13.35
+Unsatisfiable/GRP010-4.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/GRP011-4.ma ... OK TIME NEEDED: 0.02
+Unsatisfiable/GRP012-4.ma ... OK TIME NEEDED: 0.02
+Unsatisfiable/GRP014-1.ma ... FAIL
+Unsatisfiable/GRP022-2.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/GRP023-2.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/GRP024-5.ma ... FAIL
+Unsatisfiable/GRP114-1.ma ... OK TIME NEEDED: 8.54
+Unsatisfiable/GRP115-1.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/GRP116-1.ma ... OK TIME NEEDED: 0.29
+Unsatisfiable/GRP117-1.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/GRP118-1.ma ... OK TIME NEEDED: 0.07
+Unsatisfiable/GRP119-1.ma ... OK
+Unsatisfiable/GRP120-1.ma ... OK
+Unsatisfiable/GRP121-1.ma ... OK
+Unsatisfiable/GRP122-1.ma ... FAIL
+Unsatisfiable/GRP136-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/GRP137-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/GRP138-1.ma ... OK TIME NEEDED: 10.54
+Unsatisfiable/GRP139-1.ma ... OK TIME NEEDED: 0.12
+Unsatisfiable/GRP140-1.ma ... OK TIME NEEDED: 7.30
+Unsatisfiable/GRP141-1.ma ... OK TIME NEEDED: 0.12
+Unsatisfiable/GRP142-1.ma ... OK TIME NEEDED: 0.04
+Unsatisfiable/GRP143-1.ma ... OK TIME NEEDED: 0.07
+Unsatisfiable/GRP144-1.ma ... OK TIME NEEDED: 0.04
+Unsatisfiable/GRP145-1.ma ... OK TIME NEEDED: 0.07
+Unsatisfiable/GRP146-1.ma ... OK TIME NEEDED: 0.16
+Unsatisfiable/GRP147-1.ma ... OK TIME NEEDED: 57.43
+Unsatisfiable/GRP148-1.ma ... OK TIME NEEDED: 43.78
+Unsatisfiable/GRP149-1.ma ... OK TIME NEEDED: 0.16
+Unsatisfiable/GRP150-1.ma ... OK TIME NEEDED: 0.06
+Unsatisfiable/GRP151-1.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/GRP152-1.ma ... OK TIME NEEDED: 0.08
+Unsatisfiable/GRP153-1.ma ... OK TIME NEEDED: 0.06
+Unsatisfiable/GRP154-1.ma ... OK TIME NEEDED: 0.27
+Unsatisfiable/GRP155-1.ma ... OK TIME NEEDED: 0.34
+Unsatisfiable/GRP156-1.ma ... OK TIME NEEDED: 0.36
+Unsatisfiable/GRP157-1.ma ... OK TIME NEEDED: 0.18
+Unsatisfiable/GRP158-1.ma ... OK TIME NEEDED: 0.22
+Unsatisfiable/GRP159-1.ma ... OK TIME NEEDED: 0.20
+Unsatisfiable/GRP160-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/GRP161-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/GRP162-1.ma ... OK TIME NEEDED: 0.16
+Unsatisfiable/GRP163-1.ma ... OK TIME NEEDED: 0.18
+Unsatisfiable/GRP164-1.ma ... FAIL
+Unsatisfiable/GRP164-2.ma ... FAIL
+Unsatisfiable/GRP165-1.ma ... OK TIME NEEDED: 88.00
+Unsatisfiable/GRP165-2.ma ... OK TIME NEEDED: 83.45
+Unsatisfiable/GRP166-1.ma ... OK TIME NEEDED: 4.62
+Unsatisfiable/GRP166-2.ma ... OK TIME NEEDED: 102.88
+Unsatisfiable/GRP166-3.ma ... OK TIME NEEDED: 144.57
+Unsatisfiable/GRP166-4.ma ... OK TIME NEEDED: 123.60
+Unsatisfiable/GRP167-1.ma ... OK TIME NEEDED: 3.28
+Unsatisfiable/GRP167-2.ma ... OK TIME NEEDED: 2.83
+Unsatisfiable/GRP167-3.ma ... FAIL
+Unsatisfiable/GRP167-4.ma ... FAIL
+Unsatisfiable/GRP167-5.ma ... OK TIME NEEDED: 1.12
+Unsatisfiable/GRP168-1.ma ... OK TIME NEEDED: 0.28
+Unsatisfiable/GRP168-2.ma ... OK TIME NEEDED: 0.38
+Unsatisfiable/GRP169-1.ma ... OK TIME NEEDED: 37.22
+Unsatisfiable/GRP169-2.ma ... OK TIME NEEDED: 36.29
+Unsatisfiable/GRP170-1.ma ... FAIL
+Unsatisfiable/GRP170-2.ma ... FAIL
+Unsatisfiable/GRP170-3.ma ... FAIL
+Unsatisfiable/GRP170-4.ma ... FAIL
+Unsatisfiable/GRP171-1.ma ... OK TIME NEEDED: 4.60
+Unsatisfiable/GRP171-2.ma ... OK TIME NEEDED: 4.62
+Unsatisfiable/GRP172-1.ma ... OK TIME NEEDED: 3.86
+Unsatisfiable/GRP172-2.ma ... OK TIME NEEDED: 3.99
+Unsatisfiable/GRP173-1.ma ... OK TIME NEEDED: 0.05
+Unsatisfiable/GRP174-1.ma ... OK TIME NEEDED: 0.06
+Unsatisfiable/GRP175-1.ma ... OK TIME NEEDED: 89.89
+Unsatisfiable/GRP175-2.ma ... OK TIME NEEDED: 85.68
+Unsatisfiable/GRP175-3.ma ... OK TIME NEEDED: 90.00
+Unsatisfiable/GRP175-4.ma ... OK TIME NEEDED: 88.31
+Unsatisfiable/GRP176-1.ma ... OK TIME NEEDED: 0.36
+Unsatisfiable/GRP176-2.ma ... OK TIME NEEDED: 0.34
+Unsatisfiable/GRP177-2.ma ... FAIL
+Unsatisfiable/GRP178-1.ma ... FAIL
+Unsatisfiable/GRP178-2.ma ... FAIL
+Unsatisfiable/GRP179-1.ma ... FAIL
+Unsatisfiable/GRP179-2.ma ... FAIL
+Unsatisfiable/GRP179-3.ma ... FAIL
+Unsatisfiable/GRP180-1.ma ... FAIL
+Unsatisfiable/GRP180-2.ma ... FAIL
+Unsatisfiable/GRP181-1.ma ... FAIL
+Unsatisfiable/GRP181-2.ma ... FAIL
+Unsatisfiable/GRP181-3.ma ... OK TIME NEEDED: 16.87
+Unsatisfiable/GRP181-4.ma ... OK TIME NEEDED: 27.77
+Unsatisfiable/GRP182-1.ma ... OK TIME NEEDED: 0.02
+Unsatisfiable/GRP182-2.ma ... OK TIME NEEDED: 0.05
+Unsatisfiable/GRP182-3.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/GRP182-4.ma ... OK TIME NEEDED: 0.06
+Unsatisfiable/GRP183-1.ma ... FAIL
+Unsatisfiable/GRP183-2.ma ... FAIL
+Unsatisfiable/GRP183-3.ma ... FAIL
+Unsatisfiable/GRP183-4.ma ... FAIL
+Unsatisfiable/GRP184-1.ma ... FAIL
+Unsatisfiable/GRP184-2.ma ... FAIL
+Unsatisfiable/GRP184-3.ma ... FAIL
+Unsatisfiable/GRP184-4.ma ... OK TIME NEEDED: 293.47
+Unsatisfiable/GRP185-1.ma ... FAIL
+Unsatisfiable/GRP185-2.ma ... FAIL
+Unsatisfiable/GRP185-3.ma ... FAIL
+Unsatisfiable/GRP185-4.ma ... FAIL
+Unsatisfiable/GRP186-1.ma ... FAIL
+Unsatisfiable/GRP186-2.ma ... FAIL
+Unsatisfiable/GRP186-3.ma ... OK TIME NEEDED: 0.20
+Unsatisfiable/GRP186-4.ma ... OK TIME NEEDED: 0.22
+Unsatisfiable/GRP187-1.ma ... FAIL
+Unsatisfiable/GRP188-1.ma ... OK TIME NEEDED: 0.08
+Unsatisfiable/GRP188-2.ma ... OK TIME NEEDED: 0.05
+Unsatisfiable/GRP189-1.ma ... OK TIME NEEDED: 0.04
+Unsatisfiable/GRP189-2.ma ... OK TIME NEEDED: 0.06
+Unsatisfiable/GRP190-1.ma ... OK TIME NEEDED: 42.71
+Unsatisfiable/GRP190-2.ma ... OK TIME NEEDED: 42.82
+Unsatisfiable/GRP191-1.ma ... OK TIME NEEDED: 44.97
+Unsatisfiable/GRP191-2.ma ... OK TIME NEEDED: 44.78
+Unsatisfiable/GRP192-1.ma ... OK TIME NEEDED: 0.20
+Unsatisfiable/GRP193-1.ma ... OK TIME NEEDED: 160.12
+Unsatisfiable/GRP193-2.ma ... OK TIME NEEDED: 137.38
+Unsatisfiable/GRP195-1.ma ... FAIL
+Unsatisfiable/GRP196-1.ma ... FAIL
+Unsatisfiable/GRP200-1.ma ... FAIL
+Unsatisfiable/GRP201-1.ma ... FAIL
+Unsatisfiable/GRP202-1.ma ... FAIL
+Unsatisfiable/GRP203-1.ma ... FAIL
+Unsatisfiable/GRP205-1.ma ... FAIL
+Unsatisfiable/GRP206-1.ma ... OK TIME NEEDED: 0.04
+Unsatisfiable/GRP403-1.ma ... OK TIME NEEDED: 28.55
+Unsatisfiable/GRP404-1.ma ... OK TIME NEEDED: 69.93
+Unsatisfiable/GRP405-1.ma ... OK TIME NEEDED: 70.94
+Unsatisfiable/GRP406-1.ma ... OK TIME NEEDED: 258.25
+Unsatisfiable/GRP407-1.ma ... OK TIME NEEDED: 267.52
+Unsatisfiable/GRP408-1.ma ... OK TIME NEEDED: 271.12
+Unsatisfiable/GRP409-1.ma ... OK TIME NEEDED: 7.14
+Unsatisfiable/GRP410-1.ma ... OK TIME NEEDED: 10.96
+Unsatisfiable/GRP411-1.ma ... OK TIME NEEDED: 12.26
+Unsatisfiable/GRP412-1.ma ... OK TIME NEEDED: 38.24
+Unsatisfiable/GRP413-1.ma ... FAIL
+Unsatisfiable/GRP414-1.ma ... FAIL
+Unsatisfiable/GRP415-1.ma ... FAIL
+Unsatisfiable/GRP416-1.ma ... FAIL
+Unsatisfiable/GRP417-1.ma ... FAIL
+Unsatisfiable/GRP418-1.ma ... FAIL
+Unsatisfiable/GRP419-1.ma ... FAIL
+Unsatisfiable/GRP420-1.ma ... FAIL
+Unsatisfiable/GRP421-1.ma ... FAIL
+Unsatisfiable/GRP422-1.ma ... FAIL
+Unsatisfiable/GRP423-1.ma ... FAIL
+Unsatisfiable/GRP424-1.ma ... OK TIME NEEDED: 21.08
+Unsatisfiable/GRP425-1.ma ... FAIL
+Unsatisfiable/GRP426-1.ma ... FAIL
+Unsatisfiable/GRP427-1.ma ... OK
+Unsatisfiable/GRP428-1.ma ... OK
+Unsatisfiable/GRP429-1.ma ... FAIL
+Unsatisfiable/GRP430-1.ma ... OK
+Unsatisfiable/GRP431-1.ma ... OK TIME NEEDED: 30.97
+Unsatisfiable/GRP432-1.ma ... OK TIME NEEDED: 35.68
+Unsatisfiable/GRP433-1.ma ... OK
+Unsatisfiable/GRP434-1.ma ... OK TIME NEEDED: 75.44
+Unsatisfiable/GRP435-1.ma ... OK TIME NEEDED: 99.68
+Unsatisfiable/GRP436-1.ma ... OK
+Unsatisfiable/GRP437-1.ma ... OK TIME NEEDED: 81.72
+Unsatisfiable/GRP438-1.ma ... OK TIME NEEDED: 122.27
+Unsatisfiable/GRP439-1.ma ... OK TIME NEEDED: 31.35
+Unsatisfiable/GRP440-1.ma ... OK
+Unsatisfiable/GRP441-1.ma ... OK
+Unsatisfiable/GRP442-1.ma ... FAIL
+Unsatisfiable/GRP443-1.ma ... FAIL
+Unsatisfiable/GRP444-1.ma ... FAIL
+Unsatisfiable/GRP445-1.ma ... OK
+Unsatisfiable/GRP446-1.ma ... OK
+Unsatisfiable/GRP447-1.ma ... OK
+Unsatisfiable/GRP448-1.ma ... OK
+Unsatisfiable/GRP449-1.ma ... OK
+Unsatisfiable/GRP450-1.ma ... OK
+Unsatisfiable/GRP451-1.ma ... OK
+Unsatisfiable/GRP452-1.ma ... OK
+Unsatisfiable/GRP453-1.ma ... OK
+Unsatisfiable/GRP454-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/GRP455-1.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/GRP456-1.ma ... OK TIME NEEDED: 0.18
+Unsatisfiable/GRP457-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/GRP458-1.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/GRP459-1.ma ... OK TIME NEEDED: 0.19
+Unsatisfiable/GRP460-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/GRP461-1.ma ... OK
+Unsatisfiable/GRP462-1.ma ... OK
+Unsatisfiable/GRP463-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/GRP464-1.ma ... OK
+Unsatisfiable/GRP465-1.ma ... OK
+Unsatisfiable/GRP466-1.ma ... OK
+Unsatisfiable/GRP467-1.ma ... OK TIME NEEDED: 0.48
+Unsatisfiable/GRP468-1.ma ... OK TIME NEEDED: 1.85
+Unsatisfiable/GRP469-1.ma ... OK
+Unsatisfiable/GRP470-1.ma ... OK TIME NEEDED: 115.05
+Unsatisfiable/GRP471-1.ma ... OK TIME NEEDED: 140.02
+Unsatisfiable/GRP472-1.ma ... OK
+Unsatisfiable/GRP473-1.ma ... OK TIME NEEDED: 66.00
+Unsatisfiable/GRP474-1.ma ... OK TIME NEEDED: 85.37
+Unsatisfiable/GRP475-1.ma ... OK
+Unsatisfiable/GRP476-1.ma ... OK TIME NEEDED: 86.40
+Unsatisfiable/GRP477-1.ma ... OK TIME NEEDED: 88.63
+Unsatisfiable/GRP478-1.ma ... OK
+Unsatisfiable/GRP479-1.ma ... OK TIME NEEDED: 23.91
+Unsatisfiable/GRP480-1.ma ... OK TIME NEEDED: 28.09
+Unsatisfiable/GRP481-1.ma ... OK TIME NEEDED: 0.02
+Unsatisfiable/GRP482-1.ma ... OK
+Unsatisfiable/GRP483-1.ma ... OK
+Unsatisfiable/GRP484-1.ma ... OK TIME NEEDED: 0.05
+Unsatisfiable/GRP485-1.ma ... OK TIME NEEDED: 0.08
+Unsatisfiable/GRP486-1.ma ... OK TIME NEEDED: 0.35
+Unsatisfiable/GRP487-1.ma ... OK TIME NEEDED: 0.02
+Unsatisfiable/GRP488-1.ma ... OK TIME NEEDED: 0.70
+Unsatisfiable/GRP489-1.ma ... OK TIME NEEDED: 1.10
+Unsatisfiable/GRP490-1.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/GRP491-1.ma ... OK TIME NEEDED: 0.05
+Unsatisfiable/GRP492-1.ma ... OK TIME NEEDED: 0.47
+Unsatisfiable/GRP493-1.ma ... OK TIME NEEDED: 0.02
+Unsatisfiable/GRP494-1.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/GRP495-1.ma ... OK TIME NEEDED: 0.25
+Unsatisfiable/GRP496-1.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/GRP497-1.ma ... OK TIME NEEDED: 0.13
+Unsatisfiable/GRP498-1.ma ... OK TIME NEEDED: 0.32
+Unsatisfiable/GRP499-1.ma ... OK
+Unsatisfiable/GRP500-1.ma ... OK TIME NEEDED: 24.13
+Unsatisfiable/GRP501-1.ma ... OK TIME NEEDED: 56.48
+Unsatisfiable/GRP502-1.ma ... FAIL
+Unsatisfiable/GRP503-1.ma ... FAIL
+Unsatisfiable/GRP504-1.ma ... FAIL
+Unsatisfiable/GRP505-1.ma ... FAIL
+Unsatisfiable/GRP506-1.ma ... FAIL
+Unsatisfiable/GRP507-1.ma ... FAIL
+Unsatisfiable/GRP508-1.ma ... FAIL
+Unsatisfiable/GRP509-1.ma ... OK TIME NEEDED: 0.60
+Unsatisfiable/GRP510-1.ma ... OK TIME NEEDED: 0.08
+Unsatisfiable/GRP511-1.ma ... OK TIME NEEDED: 0.77
+Unsatisfiable/GRP512-1.ma ... OK TIME NEEDED: 0.13
+Unsatisfiable/GRP513-1.ma ... OK TIME NEEDED: 0.64
+Unsatisfiable/GRP514-1.ma ... OK TIME NEEDED: 0.11
+Unsatisfiable/GRP515-1.ma ... OK TIME NEEDED: 0.57
+Unsatisfiable/GRP516-1.ma ... OK TIME NEEDED: 0.11
+Unsatisfiable/GRP517-1.ma ... OK TIME NEEDED: 0.53
+Unsatisfiable/GRP518-1.ma ... OK TIME NEEDED: 0.10
+Unsatisfiable/GRP519-1.ma ... OK TIME NEEDED: 1.23
+Unsatisfiable/GRP520-1.ma ... OK TIME NEEDED: 0.10
+Unsatisfiable/GRP521-1.ma ... OK
+Unsatisfiable/GRP522-1.ma ... OK
+Unsatisfiable/GRP523-1.ma ... OK
+Unsatisfiable/GRP524-1.ma ... OK
+Unsatisfiable/GRP525-1.ma ... OK
+Unsatisfiable/GRP526-1.ma ... OK
+Unsatisfiable/GRP527-1.ma ... OK
+Unsatisfiable/GRP528-1.ma ... OK
+Unsatisfiable/GRP529-1.ma ... OK
+Unsatisfiable/GRP530-1.ma ... OK
+Unsatisfiable/GRP531-1.ma ... OK
+Unsatisfiable/GRP532-1.ma ... OK
+Unsatisfiable/GRP533-1.ma ... OK
+Unsatisfiable/GRP534-1.ma ... OK
+Unsatisfiable/GRP535-1.ma ... OK
+Unsatisfiable/GRP536-1.ma ... OK
+Unsatisfiable/GRP537-1.ma ... OK
+Unsatisfiable/GRP538-1.ma ... OK
+Unsatisfiable/GRP539-1.ma ... OK
+Unsatisfiable/GRP540-1.ma ... OK
+Unsatisfiable/GRP541-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/GRP542-1.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/GRP543-1.ma ... OK TIME NEEDED: 0.21
+Unsatisfiable/GRP544-1.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/GRP545-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/GRP546-1.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/GRP547-1.ma ... OK TIME NEEDED: 0.50
+Unsatisfiable/GRP548-1.ma ... OK TIME NEEDED: 0.05
+Unsatisfiable/GRP549-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/GRP550-1.ma ... OK TIME NEEDED: 0.02
+Unsatisfiable/GRP551-1.ma ... OK TIME NEEDED: 0.41
+Unsatisfiable/GRP552-1.ma ... OK TIME NEEDED: 0.02
+Unsatisfiable/GRP553-1.ma ... OK
+Unsatisfiable/GRP554-1.ma ... OK
+Unsatisfiable/GRP555-1.ma ... OK
+Unsatisfiable/GRP556-1.ma ... OK TIME NEEDED: 0.65
+Unsatisfiable/GRP557-1.ma ... OK
+Unsatisfiable/GRP558-1.ma ... OK TIME NEEDED: 0.05
+Unsatisfiable/GRP559-1.ma ... OK TIME NEEDED: 1.24
+Unsatisfiable/GRP560-1.ma ... OK TIME NEEDED: 0.20
+Unsatisfiable/GRP561-1.ma ... OK TIME NEEDED: 0.13
+Unsatisfiable/GRP562-1.ma ... OK TIME NEEDED: 0.04
+Unsatisfiable/GRP563-1.ma ... OK TIME NEEDED: 3.89
+Unsatisfiable/GRP564-1.ma ... OK TIME NEEDED: 0.13
+Unsatisfiable/GRP565-1.ma ... OK TIME NEEDED: 0.05
+Unsatisfiable/GRP566-1.ma ... OK TIME NEEDED: 0.04
+Unsatisfiable/GRP567-1.ma ... OK TIME NEEDED: 0.89
+Unsatisfiable/GRP568-1.ma ... OK TIME NEEDED: 0.46
+Unsatisfiable/GRP569-1.ma ... OK TIME NEEDED: 0.04
+Unsatisfiable/GRP570-1.ma ... OK TIME NEEDED: 0.04
+Unsatisfiable/GRP571-1.ma ... OK TIME NEEDED: 1.14
+Unsatisfiable/GRP572-1.ma ... OK TIME NEEDED: 0.22
+Unsatisfiable/GRP573-1.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/GRP574-1.ma ... OK TIME NEEDED: 0.11
+Unsatisfiable/GRP575-1.ma ... OK TIME NEEDED: 2.19
+Unsatisfiable/GRP576-1.ma ... OK TIME NEEDED: 0.16
+Unsatisfiable/GRP577-1.ma ... OK TIME NEEDED: 0.08
+Unsatisfiable/GRP578-1.ma ... OK TIME NEEDED: 0.19
+Unsatisfiable/GRP579-1.ma ... OK TIME NEEDED: 3.97
+Unsatisfiable/GRP580-1.ma ... OK TIME NEEDED: 0.52
+Unsatisfiable/GRP581-1.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/GRP582-1.ma ... OK TIME NEEDED: 0.14
+Unsatisfiable/GRP583-1.ma ... OK TIME NEEDED: 0.76
+Unsatisfiable/GRP584-1.ma ... OK TIME NEEDED: 0.42
+Unsatisfiable/GRP585-1.ma ... OK
+Unsatisfiable/GRP586-1.ma ... OK TIME NEEDED: 0.11
+Unsatisfiable/GRP587-1.ma ... OK TIME NEEDED: 7.98
+Unsatisfiable/GRP588-1.ma ... OK TIME NEEDED: 0.41
+Unsatisfiable/GRP589-1.ma ... OK
+Unsatisfiable/GRP590-1.ma ... OK TIME NEEDED: 0.15
+Unsatisfiable/GRP591-1.ma ... OK
+Unsatisfiable/GRP592-1.ma ... OK TIME NEEDED: 0.22
+Unsatisfiable/GRP593-1.ma ... OK TIME NEEDED: 1.24
+Unsatisfiable/GRP594-1.ma ... OK TIME NEEDED: 1.02
+Unsatisfiable/GRP595-1.ma ... OK TIME NEEDED: 0.15
+Unsatisfiable/GRP596-1.ma ... OK TIME NEEDED: 0.25
+Unsatisfiable/GRP597-1.ma ... OK TIME NEEDED: 0.52
+Unsatisfiable/GRP598-1.ma ... OK TIME NEEDED: 0.20
+Unsatisfiable/GRP599-1.ma ... OK TIME NEEDED: 0.96
+Unsatisfiable/GRP600-1.ma ... OK TIME NEEDED: 0.30
+Unsatisfiable/GRP601-1.ma ... OK TIME NEEDED: 1.06
+Unsatisfiable/GRP602-1.ma ... OK TIME NEEDED: 0.47
+Unsatisfiable/GRP603-1.ma ... OK TIME NEEDED: 0.47
+Unsatisfiable/GRP604-1.ma ... OK TIME NEEDED: 0.61
+Unsatisfiable/GRP605-1.ma ... OK TIME NEEDED: 0.56
+Unsatisfiable/GRP606-1.ma ... OK TIME NEEDED: 0.35
+Unsatisfiable/GRP607-1.ma ... OK TIME NEEDED: 1.27
+Unsatisfiable/GRP608-1.ma ... OK TIME NEEDED: 0.40
+Unsatisfiable/GRP609-1.ma ... OK TIME NEEDED: 1.06
+Unsatisfiable/GRP610-1.ma ... OK TIME NEEDED: 0.27
+Unsatisfiable/GRP611-1.ma ... OK
+Unsatisfiable/GRP612-1.ma ... OK TIME NEEDED: 0.28
+Unsatisfiable/GRP613-1.ma ... OK TIME NEEDED: 0.48
+Unsatisfiable/GRP614-1.ma ... OK TIME NEEDED: 0.25
+Unsatisfiable/GRP615-1.ma ... OK TIME NEEDED: 0.68
+Unsatisfiable/GRP616-1.ma ... OK TIME NEEDED: 0.27
+Unsatisfiable/LAT006-1.ma ... OK TIME NEEDED: 9.83
+Unsatisfiable/LAT007-1.ma ... OK
+Unsatisfiable/LAT008-1.ma ... OK TIME NEEDED: 0.78
+Unsatisfiable/LAT009-1.ma ... OK TIME NEEDED: 271.20
+Unsatisfiable/LAT010-1.ma ... FAIL
+Unsatisfiable/LAT011-1.ma ... FAIL
+Unsatisfiable/LAT012-1.ma ... OK
+Unsatisfiable/LAT013-1.ma ... OK
+Unsatisfiable/LAT014-1.ma ... OK
+Unsatisfiable/LAT017-1.ma ... OK TIME NEEDED: 148.94
+Unsatisfiable/LAT018-1.ma ... FAIL
+Unsatisfiable/LAT019-1.ma ... OK TIME NEEDED: 165.91
+Unsatisfiable/LAT020-1.ma ... FAIL
+Unsatisfiable/LAT021-1.ma ... FAIL
+Unsatisfiable/LAT022-1.ma ... FAIL
+Unsatisfiable/LAT023-1.ma ... FAIL
+Unsatisfiable/LAT026-1.ma ... OK
+Unsatisfiable/LAT027-1.ma ... OK TIME NEEDED: 49.64
+Unsatisfiable/LAT028-1.ma ... OK TIME NEEDED: 45.13
+Unsatisfiable/LAT031-1.ma ... OK TIME NEEDED: 60.22
+Unsatisfiable/LAT032-1.ma ... OK TIME NEEDED: 1.63
+Unsatisfiable/LAT033-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/LAT034-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/LAT038-1.ma ... FAIL
+Unsatisfiable/LAT039-1.ma ... OK TIME NEEDED: 0.41
+Unsatisfiable/LAT039-2.ma ... OK TIME NEEDED: 0.41
+Unsatisfiable/LAT040-1.ma ... OK TIME NEEDED: 0.94
+Unsatisfiable/LAT042-1.ma ... OK TIME NEEDED: 22.84
+Unsatisfiable/LAT043-1.ma ... OK TIME NEEDED: 23.72
+Unsatisfiable/LAT044-1.ma ... FAIL
+Unsatisfiable/LAT045-1.ma ... OK TIME NEEDED: 0.37
+Unsatisfiable/LAT070-1.ma ... FAIL
+Unsatisfiable/LAT072-1.ma ... FAIL
+Unsatisfiable/LAT074-1.ma ... FAIL
+Unsatisfiable/LAT075-1.ma ... FAIL
+Unsatisfiable/LAT076-1.ma ... FAIL
+Unsatisfiable/LAT077-1.ma ... FAIL
+Unsatisfiable/LAT078-1.ma ... FAIL
+Unsatisfiable/LAT079-1.ma ... FAIL
+Unsatisfiable/LAT080-1.ma ... FAIL
+Unsatisfiable/LAT081-1.ma ... FAIL
+Unsatisfiable/LAT082-1.ma ... FAIL
+Unsatisfiable/LAT083-1.ma ... FAIL
+Unsatisfiable/LAT084-1.ma ... FAIL
+Unsatisfiable/LAT085-1.ma ... FAIL
+Unsatisfiable/LAT086-1.ma ... FAIL
+Unsatisfiable/LAT087-1.ma ... FAIL
+Unsatisfiable/LAT088-1.ma ... OK
+Unsatisfiable/LAT089-1.ma ... OK
+Unsatisfiable/LAT090-1.ma ... OK
+Unsatisfiable/LAT091-1.ma ... OK
+Unsatisfiable/LAT092-1.ma ... FAIL
+Unsatisfiable/LAT093-1.ma ... FAIL
+Unsatisfiable/LAT094-1.ma ... FAIL
+Unsatisfiable/LAT095-1.ma ... FAIL
+Unsatisfiable/LAT096-1.ma ... FAIL
+Unsatisfiable/LAT097-1.ma ... FAIL
+Unsatisfiable/LAT138-1.ma ... FAIL
+Unsatisfiable/LAT139-1.ma ... FAIL
+Unsatisfiable/LAT140-1.ma ... FAIL
+Unsatisfiable/LAT141-1.ma ... FAIL
+Unsatisfiable/LAT142-1.ma ... FAIL
+Unsatisfiable/LAT143-1.ma ... OK TIME NEEDED: 149.59
+Unsatisfiable/LAT144-1.ma ... FAIL
+Unsatisfiable/LAT145-1.ma ... FAIL
+Unsatisfiable/LAT146-1.ma ... FAIL
+Unsatisfiable/LAT147-1.ma ... FAIL
+Unsatisfiable/LAT148-1.ma ... FAIL
+Unsatisfiable/LAT149-1.ma ... FAIL
+Unsatisfiable/LAT150-1.ma ... FAIL
+Unsatisfiable/LAT151-1.ma ... FAIL
+Unsatisfiable/LAT152-1.ma ... FAIL
+Unsatisfiable/LAT153-1.ma ... FAIL
+Unsatisfiable/LAT154-1.ma ... FAIL
+Unsatisfiable/LAT155-1.ma ... FAIL
+Unsatisfiable/LAT156-1.ma ... OK TIME NEEDED: 218.93
+Unsatisfiable/LAT157-1.ma ... FAIL
+Unsatisfiable/LAT158-1.ma ... FAIL
+Unsatisfiable/LAT159-1.ma ... FAIL
+Unsatisfiable/LAT160-1.ma ... FAIL
+Unsatisfiable/LAT161-1.ma ... FAIL
+Unsatisfiable/LAT162-1.ma ... FAIL
+Unsatisfiable/LAT163-1.ma ... FAIL
+Unsatisfiable/LAT164-1.ma ... FAIL
+Unsatisfiable/LAT165-1.ma ... FAIL
+Unsatisfiable/LAT166-1.ma ... FAIL
+Unsatisfiable/LAT167-1.ma ... FAIL
+Unsatisfiable/LAT168-1.ma ... FAIL
+Unsatisfiable/LAT169-1.ma ... FAIL
+Unsatisfiable/LAT170-1.ma ... FAIL
+Unsatisfiable/LAT171-1.ma ... FAIL
+Unsatisfiable/LAT172-1.ma ... FAIL
+Unsatisfiable/LAT173-1.ma ... FAIL
+Unsatisfiable/LAT174-1.ma ... FAIL
+Unsatisfiable/LAT175-1.ma ... FAIL
+Unsatisfiable/LAT176-1.ma ... FAIL
+Unsatisfiable/LAT177-1.ma ... FAIL
+Unsatisfiable/LCL109-2.ma ... OK TIME NEEDED: 71.47
+Unsatisfiable/LCL109-6.ma ... OK TIME NEEDED: 49.25
+Unsatisfiable/LCL110-2.ma ... OK TIME NEEDED: 0.26
+Unsatisfiable/LCL111-2.ma ... OK TIME NEEDED: 5.72
+Unsatisfiable/LCL112-2.ma ... OK TIME NEEDED: 0.27
+Unsatisfiable/LCL113-2.ma ... OK TIME NEEDED: 0.28
+Unsatisfiable/LCL114-2.ma ... OK TIME NEEDED: 0.35
+Unsatisfiable/LCL115-2.ma ... OK TIME NEEDED: 0.55
+Unsatisfiable/LCL116-2.ma ... OK TIME NEEDED: 4.89
+Unsatisfiable/LCL132-1.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/LCL133-1.ma ... OK TIME NEEDED: 0.05
+Unsatisfiable/LCL134-1.ma ... OK TIME NEEDED: 0.05
+Unsatisfiable/LCL135-1.ma ... OK TIME NEEDED: 0.05
+Unsatisfiable/LCL138-1.ma ... FAIL
+Unsatisfiable/LCL139-1.ma ... OK TIME NEEDED: 0.34
+Unsatisfiable/LCL140-1.ma ... OK TIME NEEDED: 0.27
+Unsatisfiable/LCL141-1.ma ... OK TIME NEEDED: 0.55
+Unsatisfiable/LCL153-1.ma ... OK TIME NEEDED: 0.30
+Unsatisfiable/LCL154-1.ma ... OK TIME NEEDED: 0.26
+Unsatisfiable/LCL155-1.ma ... OK TIME NEEDED: 0.29
+Unsatisfiable/LCL156-1.ma ... OK TIME NEEDED: 0.25
+Unsatisfiable/LCL157-1.ma ... OK TIME NEEDED: 0.26
+Unsatisfiable/LCL158-1.ma ... OK TIME NEEDED: 0.30
+Unsatisfiable/LCL159-1.ma ... OK TIME NEEDED: 1.40
+Unsatisfiable/LCL160-1.ma ... OK TIME NEEDED: 255.01
+Unsatisfiable/LCL161-1.ma ... OK TIME NEEDED: 0.09
+Unsatisfiable/LCL162-1.ma ... FAIL
+Unsatisfiable/LCL163-1.ma ... OK TIME NEEDED: 6.24
+Unsatisfiable/LCL164-1.ma ... OK TIME NEEDED: 0.14
+Unsatisfiable/LDA001-1.ma ... OK TIME NEEDED: 0.04
+Unsatisfiable/LDA002-1.ma ... OK TIME NEEDED: 10.74
+Unsatisfiable/LDA007-3.ma ... OK TIME NEEDED: 0.11
+Unsatisfiable/RNG007-4.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/RNG008-3.ma ... OK TIME NEEDED: 3.54
+Unsatisfiable/RNG008-4.ma ... OK TIME NEEDED: 0.18
+Unsatisfiable/RNG008-7.ma ... OK TIME NEEDED: 17.42
+Unsatisfiable/RNG009-5.ma ... FAIL
+Unsatisfiable/RNG009-7.ma ... FAIL
+Unsatisfiable/RNG011-5.ma ... OK TIME NEEDED: 0.24
+Unsatisfiable/RNG012-6.ma ... OK TIME NEEDED: 51.47
+Unsatisfiable/RNG013-6.ma ... OK TIME NEEDED: 50.47
+Unsatisfiable/RNG014-6.ma ... OK TIME NEEDED: 48.93
+Unsatisfiable/RNG015-6.ma ... OK TIME NEEDED: 48.44
+Unsatisfiable/RNG016-6.ma ... OK TIME NEEDED: 50.42
+Unsatisfiable/RNG017-6.ma ... OK TIME NEEDED: 50.79
+Unsatisfiable/RNG018-6.ma ... OK TIME NEEDED: 48.34
+Unsatisfiable/RNG019-6.ma ... FAIL
+Unsatisfiable/RNG019-7.ma ... FAIL
+Unsatisfiable/RNG020-6.ma ... FAIL
+Unsatisfiable/RNG020-7.ma ... FAIL
+Unsatisfiable/RNG021-6.ma ... FAIL
+Unsatisfiable/RNG021-7.ma ... FAIL
+Unsatisfiable/RNG023-6.ma ... OK TIME NEEDED: 0.18
+Unsatisfiable/RNG023-7.ma ... OK TIME NEEDED: 0.29
+Unsatisfiable/RNG024-6.ma ... OK TIME NEEDED: 0.17
+Unsatisfiable/RNG024-7.ma ... OK TIME NEEDED: 0.29
+Unsatisfiable/RNG025-4.ma ... FAIL
+Unsatisfiable/RNG025-5.ma ... FAIL
+Unsatisfiable/RNG025-6.ma ... FAIL
+Unsatisfiable/RNG025-7.ma ... FAIL
+Unsatisfiable/RNG026-6.ma ... FAIL
+Unsatisfiable/RNG026-7.ma ... FAIL
+Unsatisfiable/RNG027-5.ma ... FAIL
+Unsatisfiable/RNG027-7.ma ... FAIL
+Unsatisfiable/RNG027-8.ma ... FAIL
+Unsatisfiable/RNG027-9.ma ... FAIL
+Unsatisfiable/RNG028-5.ma ... FAIL
+Unsatisfiable/RNG028-7.ma ... FAIL
+Unsatisfiable/RNG028-8.ma ... FAIL
+Unsatisfiable/RNG028-9.ma ... FAIL
+Unsatisfiable/RNG029-5.ma ... FAIL
+Unsatisfiable/RNG029-6.ma ... FAIL
+Unsatisfiable/RNG029-7.ma ... FAIL
+Unsatisfiable/RNG035-7.ma ... FAIL
+Unsatisfiable/ROB001-1.ma ... FAIL
+Unsatisfiable/ROB002-1.ma ... OK TIME NEEDED: 0.03
+Unsatisfiable/ROB003-1.ma ... OK TIME NEEDED: 47.87
+Unsatisfiable/ROB004-1.ma ... OK TIME NEEDED: 24.39
+Unsatisfiable/ROB005-1.ma ... OK TIME NEEDED: 221.06
+Unsatisfiable/ROB006-1.ma ... FAIL
+Unsatisfiable/ROB006-2.ma ... OK
+Unsatisfiable/ROB008-1.ma ... OK TIME NEEDED: 122.13
+Unsatisfiable/ROB009-1.ma ... OK TIME NEEDED: 0.80
+Unsatisfiable/ROB010-1.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/ROB013-1.ma ... OK TIME NEEDED: 0.01
+Unsatisfiable/ROB022-1.ma ... OK TIME NEEDED: 173.21
+Unsatisfiable/ROB023-1.ma ... OK TIME NEEDED: 191.39
+Unsatisfiable/ROB026-1.ma ... FAIL
+Unsatisfiable/ROB030-1.ma ... OK TIME NEEDED: 0.00
+Unsatisfiable/ROB031-1.ma ... OK
+Unsatisfiable/ROB032-1.ma ... OK
+Unsatisfiable/SYN080-1.ma ... OK
+Unsatisfiable/SYN083-1.ma ... OK TIME NEEDED: 0.00
diff --git a/matita/tests/TPTP/log.300.26-5.menvcorti.con_rating b/matita/tests/TPTP/log.300.26-5.menvcorti.con_rating
new file mode 100644 (file)
index 0000000..ca9e0cd
--- /dev/null
@@ -0,0 +1,698 @@
+Unsatisfiable/COL023-1.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/COL027-1.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/COL029-1.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/COL031-1.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/COL039-1.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/COL052-1.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/COL053-1.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/COL059-1.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/GRP170-1.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/GRP170-2.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/GRP170-3.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/GRP170-4.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/GRP195-1.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/GRP415-1.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/LAT010-1.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/LAT021-1.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/LCL162-1.ma ... FAIL (* Rating : 0.00 
+Unsatisfiable/BOO026-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/BOO028-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/BOO072-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/BOO074-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/COL002-4.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/COL020-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/COL026-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/COL033-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/COL070-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/GRP122-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/GRP185-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/GRP185-2.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/GRP413-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/GRP414-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/GRP416-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/GRP418-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/GRP425-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/GRP443-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/LAT011-1.ma ... FAIL (* Rating : 0.07 
+Unsatisfiable/COL030-1.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/COL032-1.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/COL035-1.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/COL042-6.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/COL042-7.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/COL042-8.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/COL042-9.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/GRP014-1.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/GRP178-1.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/GRP178-2.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/GRP184-2.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/GRP417-1.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/GRP421-1.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/GRP426-1.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/GRP429-1.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/GRP442-1.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/GRP502-1.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/GRP503-1.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/GRP504-1.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/LAT044-1.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/LAT168-1.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/RNG021-6.ma ... FAIL (* Rating : 0.14 
+Unsatisfiable/BOO031-1.ma ... FAIL (* Rating : 0.21 
+Unsatisfiable/BOO067-1.ma ... FAIL (* Rating : 0.21 
+Unsatisfiable/COL044-1.ma ... FAIL (* Rating : 0.21 
+Unsatisfiable/GRP177-2.ma ... FAIL (* Rating : 0.21 
+Unsatisfiable/GRP184-3.ma ... FAIL (* Rating : 0.21 
+Unsatisfiable/GRP185-3.ma ... FAIL (* Rating : 0.21 
+Unsatisfiable/GRP185-4.ma ... FAIL (* Rating : 0.21 
+Unsatisfiable/GRP203-1.ma ... FAIL (* Rating : 0.21 
+Unsatisfiable/GRP444-1.ma ... FAIL (* Rating : 0.21 
+Unsatisfiable/LAT022-1.ma ... FAIL (* Rating : 0.21 
+Unsatisfiable/LAT023-1.ma ... FAIL (* Rating : 0.21 
+Unsatisfiable/LCL138-1.ma ... FAIL (* Rating : 0.21 
+Unsatisfiable/RNG019-6.ma ... FAIL (* Rating : 0.21 
+Unsatisfiable/RNG019-7.ma ... FAIL (* Rating : 0.21 
+Unsatisfiable/RNG020-7.ma ... FAIL (* Rating : 0.21 
+Unsatisfiable/RNG021-7.ma ... FAIL (* Rating : 0.21 
+Unsatisfiable/COL037-1.ma ... FAIL (* Rating : 0.29 
+Unsatisfiable/COL049-1.ma ... FAIL (* Rating : 0.29 
+Unsatisfiable/GRP184-1.ma ... FAIL (* Rating : 0.29 
+Unsatisfiable/GRP200-1.ma ... FAIL (* Rating : 0.29 
+Unsatisfiable/GRP419-1.ma ... FAIL (* Rating : 0.29 
+Unsatisfiable/GRP422-1.ma ... FAIL (* Rating : 0.29 
+Unsatisfiable/RNG020-6.ma ... FAIL (* Rating : 0.29 
+Unsatisfiable/RNG025-4.ma ... FAIL (* Rating : 0.29 
+Unsatisfiable/RNG025-6.ma ... FAIL (* Rating : 0.29 
+Unsatisfiable/BOO073-1.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/COL011-1.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/COL041-1.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/COL057-1.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/COL060-1.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/COL061-1.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/GRP179-3.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/GRP183-4.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/GRP186-2.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/GRP201-1.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/GRP420-1.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/GRP423-1.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/LAT080-1.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/LAT083-1.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/LAT092-1.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/LAT094-1.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/LAT096-1.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/LAT097-1.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/RNG025-5.ma ... FAIL (* Rating : 0.36 
+Unsatisfiable/COL002-5.ma ... FAIL (* Rating : 0.43 
+Unsatisfiable/COL034-1.ma ... FAIL (* Rating : 0.43 
+Unsatisfiable/GRP167-4.ma ... FAIL (* Rating : 0.43 
+Unsatisfiable/GRP180-2.ma ... FAIL (* Rating : 0.43 
+Unsatisfiable/GRP183-1.ma ... FAIL (* Rating : 0.43 
+Unsatisfiable/GRP183-2.ma ... FAIL (* Rating : 0.43 
+Unsatisfiable/GRP183-3.ma ... FAIL (* Rating : 0.43 
+Unsatisfiable/GRP202-1.ma ... FAIL (* Rating : 0.43 
+Unsatisfiable/GRP205-1.ma ... FAIL (* Rating : 0.43 
+Unsatisfiable/LAT038-1.ma ... FAIL (* Rating : 0.43 
+Unsatisfiable/LAT087-1.ma ... FAIL (* Rating : 0.43 
+Unsatisfiable/LAT093-1.ma ... FAIL (* Rating : 0.43 
+Unsatisfiable/LAT095-1.ma ... FAIL (* Rating : 0.43 
+Unsatisfiable/RNG025-7.ma ... FAIL (* Rating : 0.43 
+Unsatisfiable/BOO023-1.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/COL044-7.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/COL062-1.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/COL063-1.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/GRP024-5.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/GRP167-3.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/GRP179-1.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/GRP179-2.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/GRP180-1.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/GRP505-1.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/LAT020-1.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/LAT084-1.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/LAT086-1.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/LAT171-1.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/RNG009-5.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/RNG009-7.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/RNG026-7.ma ... FAIL (* Rating : 0.50 
+Unsatisfiable/COL004-1.ma ... FAIL (* Rating : 0.57 
+Unsatisfiable/COL006-1.ma ... FAIL (* Rating : 0.57 
+Unsatisfiable/COL036-1.ma ... FAIL (* Rating : 0.57 
+Unsatisfiable/GRP186-1.ma ... FAIL (* Rating : 0.57 
+Unsatisfiable/GRP507-1.ma ... FAIL (* Rating : 0.57 
+Unsatisfiable/GRP508-1.ma ... FAIL (* Rating : 0.57 
+Unsatisfiable/LAT081-1.ma ... FAIL (* Rating : 0.57 
+Unsatisfiable/LAT085-1.ma ... FAIL (* Rating : 0.57 
+Unsatisfiable/RNG026-6.ma ... FAIL (* Rating : 0.57 
+Unsatisfiable/COL006-5.ma ... FAIL (* Rating : 0.64 
+Unsatisfiable/COL006-6.ma ... FAIL (* Rating : 0.64 
+Unsatisfiable/COL006-7.ma ... FAIL (* Rating : 0.64 
+Unsatisfiable/COL038-1.ma ... FAIL (* Rating : 0.64 
+Unsatisfiable/COL044-6.ma ... FAIL (* Rating : 0.64 
+Unsatisfiable/COL044-9.ma ... FAIL (* Rating : 0.64 
+Unsatisfiable/COL046-1.ma ... FAIL (* Rating : 0.64 
+Unsatisfiable/COL064-1.ma ... FAIL (* Rating : 0.64 
+Unsatisfiable/GRP187-1.ma ... FAIL (* Rating : 0.64 
+Unsatisfiable/GRP506-1.ma ... FAIL (* Rating : 0.64 
+Unsatisfiable/LAT082-1.ma ... FAIL (* Rating : 0.64 
+Unsatisfiable/LAT142-1.ma ... FAIL (* Rating : 0.64 
+Unsatisfiable/LAT160-1.ma ... FAIL (* Rating : 0.64 
+Unsatisfiable/BOO076-1.ma ... FAIL (* Rating : 0.71 
+Unsatisfiable/COL043-3.ma ... FAIL (* Rating : 0.71 
+Unsatisfiable/COL044-8.ma ... FAIL (* Rating : 0.71 
+Unsatisfiable/COL065-1.ma ... FAIL (* Rating : 0.71 
+Unsatisfiable/GRP181-1.ma ... FAIL (* Rating : 0.71 
+Unsatisfiable/GRP181-2.ma ... FAIL (* Rating : 0.71 
+Unsatisfiable/LAT148-1.ma ... FAIL (* Rating : 0.71 
+Unsatisfiable/COL003-1.ma ... FAIL (* Rating : 0.79 
+Unsatisfiable/LAT146-1.ma ... FAIL (* Rating : 0.79 
+Unsatisfiable/LAT147-1.ma ... FAIL (* Rating : 0.79 
+Unsatisfiable/LAT152-1.ma ... FAIL (* Rating : 0.79 
+Unsatisfiable/LAT154-1.ma ... FAIL (* Rating : 0.79 
+Unsatisfiable/LAT170-1.ma ... FAIL (* Rating : 0.79 
+Unsatisfiable/LAT174-1.ma ... FAIL (* Rating : 0.79 
+Unsatisfiable/COL042-1.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/COL043-1.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/LAT144-1.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/LAT150-1.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/LAT151-1.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/LAT155-1.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/LAT157-1.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/LAT159-1.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/LAT162-1.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/LAT169-1.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/RNG027-5.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/RNG027-7.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/RNG027-8.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/RNG027-9.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/RNG028-5.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/RNG028-7.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/RNG028-8.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/RNG028-9.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/RNG029-5.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/RNG029-6.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/RNG029-7.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/RNG035-7.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/ROB006-1.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/ROB026-1.ma ... FAIL (* Rating : 0.86 
+Unsatisfiable/COL066-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/GRP164-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/GRP164-2.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/GRP196-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/LAT018-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/LAT070-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/LAT145-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/LAT149-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/LAT153-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/LAT158-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/LAT163-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/LAT164-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/LAT165-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/LAT166-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/LAT167-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/LAT172-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/LAT173-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/LAT175-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/LAT176-1.ma ... FAIL (* Rating : 0.93 
+Unsatisfiable/LAT072-1.ma ... FAIL (* Rating : 1.00 
+Unsatisfiable/LAT074-1.ma ... FAIL (* Rating : 1.00 
+Unsatisfiable/LAT075-1.ma ... FAIL (* Rating : 1.00 
+Unsatisfiable/LAT076-1.ma ... FAIL (* Rating : 1.00 
+Unsatisfiable/LAT077-1.ma ... FAIL (* Rating : 1.00 
+Unsatisfiable/LAT078-1.ma ... FAIL (* Rating : 1.00 
+Unsatisfiable/LAT079-1.ma ... FAIL (* Rating : 1.00 
+Unsatisfiable/LAT138-1.ma ... FAIL (* Rating : 1.00 
+Unsatisfiable/LAT139-1.ma ... FAIL (* Rating : 1.00 
+Unsatisfiable/LAT140-1.ma ... FAIL (* Rating : 1.00 
+Unsatisfiable/LAT141-1.ma ... FAIL (* Rating : 1.00 
+Unsatisfiable/LAT161-1.ma ... FAIL (* Rating : 1.00 
+Unsatisfiable/LAT177-1.ma ... FAIL (* Rating : 1.00 
+Unsatisfiable/ROB001-1.ma ... FAIL (* Rating : 1.00 
+Unsatisfiable/BOO029-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/COL051-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/COL058-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/COL075-2.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP119-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP120-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP121-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP427-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP428-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP430-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP433-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP445-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP446-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP448-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP449-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP451-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP461-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP462-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP464-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP465-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP466-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP482-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP483-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP499-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP521-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP522-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP523-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP524-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP525-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP526-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP527-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP528-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP529-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP530-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP531-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP532-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP533-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP534-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP535-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP536-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP537-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP538-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP539-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP540-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP553-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP554-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP555-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP557-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP585-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP589-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/GRP611-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/LAT012-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/LAT014-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/LAT088-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/LAT089-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/LAT090-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/SYN080-1.ma ... OK (* Rating : 0.00 
+Unsatisfiable/BOO021-1.ma ... OK (* Rating : 0.07 
+Unsatisfiable/BOO022-1.ma ... OK (* Rating : 0.07 
+Unsatisfiable/COL056-1.ma ... OK (* Rating : 0.07 
+Unsatisfiable/GRP436-1.ma ... OK (* Rating : 0.07 
+Unsatisfiable/GRP450-1.ma ... OK (* Rating : 0.07 
+Unsatisfiable/GRP472-1.ma ... OK (* Rating : 0.07 
+Unsatisfiable/GRP591-1.ma ... OK (* Rating : 0.07 
+Unsatisfiable/LAT091-1.ma ... OK (* Rating : 0.07 
+Unsatisfiable/GRP440-1.ma ... OK (* Rating : 0.14 
+Unsatisfiable/GRP447-1.ma ... OK (* Rating : 0.14 
+Unsatisfiable/GRP452-1.ma ... OK (* Rating : 0.14 
+Unsatisfiable/GRP478-1.ma ... OK (* Rating : 0.14 
+Unsatisfiable/LAT013-1.ma ... OK (* Rating : 0.14 
+Unsatisfiable/LAT026-1.ma ... OK (* Rating : 0.14 
+Unsatisfiable/GRP441-1.ma ... OK (* Rating : 0.21 
+Unsatisfiable/GRP453-1.ma ... OK (* Rating : 0.21 
+Unsatisfiable/GRP469-1.ma ... OK (* Rating : 0.21 
+Unsatisfiable/GRP475-1.ma ... OK (* Rating : 0.21 
+Unsatisfiable/LAT007-1.ma ... OK (* Rating : 0.36 
+Unsatisfiable/ROB006-2.ma ... OK (* Rating : 0.86 
+Unsatisfiable/ROB031-1.ma ... OK (* Rating : 1.00 
+Unsatisfiable/ROB032-1.ma ... OK (* Rating : 1.00 
+Unsatisfiable/ALG006-1.ma ... OK TIME NEEDED: 1.44 (* Rating : 0.00 
+Unsatisfiable/ALG007-1.ma ... OK TIME NEEDED: 2.83 (* Rating : 0.00 
+Unsatisfiable/BOO001-1.ma ... OK TIME NEEDED: 0.69 (* Rating : 0.00 
+Unsatisfiable/BOO002-2.ma ... OK TIME NEEDED: 19.60 (* Rating : 0.00 
+Unsatisfiable/BOO003-2.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/BOO003-4.ma ... OK TIME NEEDED: 0.11 (* Rating : 0.00 
+Unsatisfiable/BOO004-2.ma ... OK TIME NEEDED: 0.06 (* Rating : 0.00 
+Unsatisfiable/BOO004-4.ma ... OK TIME NEEDED: 0.11 (* Rating : 0.00 
+Unsatisfiable/BOO005-2.ma ... OK TIME NEEDED: 0.13 (* Rating : 0.00 
+Unsatisfiable/BOO005-4.ma ... OK TIME NEEDED: 0.12 (* Rating : 0.00 
+Unsatisfiable/BOO006-2.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/BOO006-4.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/BOO008-4.ma ... OK TIME NEEDED: 52.56 (* Rating : 0.00 
+Unsatisfiable/BOO009-2.ma ... OK TIME NEEDED: 0.06 (* Rating : 0.00 
+Unsatisfiable/BOO009-4.ma ... OK TIME NEEDED: 0.29 (* Rating : 0.00 
+Unsatisfiable/BOO010-2.ma ... OK TIME NEEDED: 0.07 (* Rating : 0.00 
+Unsatisfiable/BOO010-4.ma ... OK TIME NEEDED: 0.07 (* Rating : 0.00 
+Unsatisfiable/BOO011-2.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/BOO011-4.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/BOO012-2.ma ... OK TIME NEEDED: 0.46 (* Rating : 0.00 
+Unsatisfiable/BOO012-4.ma ... OK TIME NEEDED: 0.51 (* Rating : 0.00 
+Unsatisfiable/BOO013-2.ma ... OK TIME NEEDED: 0.36 (* Rating : 0.00 
+Unsatisfiable/BOO013-4.ma ... OK TIME NEEDED: 0.66 (* Rating : 0.00 
+Unsatisfiable/BOO014-2.ma ... OK TIME NEEDED: 4.44 (* Rating : 0.00 
+Unsatisfiable/BOO014-4.ma ... OK TIME NEEDED: 13.50 (* Rating : 0.00 
+Unsatisfiable/BOO015-2.ma ... OK TIME NEEDED: 3.48 (* Rating : 0.00 
+Unsatisfiable/BOO015-4.ma ... OK TIME NEEDED: 13.30 (* Rating : 0.00 
+Unsatisfiable/BOO016-2.ma ... OK TIME NEEDED: 0.22 (* Rating : 0.00 
+Unsatisfiable/BOO017-2.ma ... OK TIME NEEDED: 0.20 (* Rating : 0.00 
+Unsatisfiable/BOO018-4.ma ... OK TIME NEEDED: 0.02 (* Rating : 0.00 
+Unsatisfiable/BOO024-1.ma ... OK TIME NEEDED: 2.44 (* Rating : 0.00 
+Unsatisfiable/BOO068-1.ma ... OK TIME NEEDED: 1.61 (* Rating : 0.00 
+Unsatisfiable/BOO069-1.ma ... OK TIME NEEDED: 0.80 (* Rating : 0.00 
+Unsatisfiable/BOO070-1.ma ... OK TIME NEEDED: 1.84 (* Rating : 0.00 
+Unsatisfiable/BOO071-1.ma ... OK TIME NEEDED: 0.81 (* Rating : 0.00 
+Unsatisfiable/BOO075-1.ma ... OK TIME NEEDED: 0.54 (* Rating : 0.00 
+Unsatisfiable/COL002-1.ma ... OK TIME NEEDED: 250.20 (* Rating : 0.00 
+Unsatisfiable/COL007-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL008-1.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/COL012-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL013-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL014-1.ma ... OK TIME NEEDED: 0.12 (* Rating : 0.00 
+Unsatisfiable/COL015-1.ma ... OK TIME NEEDED: 0.02 (* Rating : 0.00 
+Unsatisfiable/COL016-1.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/COL017-1.ma ... OK TIME NEEDED: 0.02 (* Rating : 0.00 
+Unsatisfiable/COL018-1.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/COL019-1.ma ... OK TIME NEEDED: 27.26 (* Rating : 0.00 
+Unsatisfiable/COL021-1.ma ... OK TIME NEEDED: 0.34 (* Rating : 0.00 
+Unsatisfiable/COL022-1.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/COL024-1.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/COL025-1.ma ... OK TIME NEEDED: 0.02 (* Rating : 0.00 
+Unsatisfiable/COL045-1.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/COL048-1.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/COL050-1.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/COL058-2.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL058-3.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/COL060-2.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL060-3.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL061-2.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL061-3.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL062-2.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL062-3.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL063-2.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL063-3.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL063-4.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL063-5.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL063-6.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL064-3.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL064-6.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL064-8.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL066-2.ma ... OK TIME NEEDED: 1.21 (* Rating : 0.00 
+Unsatisfiable/COL066-3.ma ... OK TIME NEEDED: 1.20 (* Rating : 0.00 
+Unsatisfiable/COL083-1.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/COL084-1.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/COL085-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/COL086-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/GRP001-2.ma ... OK TIME NEEDED: 0.04 (* Rating : 0.00 
+Unsatisfiable/GRP001-4.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/GRP002-2.ma ... OK TIME NEEDED: 9.84 (* Rating : 0.00 
+Unsatisfiable/GRP002-3.ma ... OK TIME NEEDED: 8.65 (* Rating : 0.00 
+Unsatisfiable/GRP002-4.ma ... OK TIME NEEDED: 13.35 (* Rating : 0.00 
+Unsatisfiable/GRP010-4.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/GRP011-4.ma ... OK TIME NEEDED: 0.02 (* Rating : 0.00 
+Unsatisfiable/GRP012-4.ma ... OK TIME NEEDED: 0.02 (* Rating : 0.00 
+Unsatisfiable/GRP022-2.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/GRP023-2.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/GRP115-1.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/GRP116-1.ma ... OK TIME NEEDED: 0.29 (* Rating : 0.00 
+Unsatisfiable/GRP117-1.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/GRP118-1.ma ... OK TIME NEEDED: 0.07 (* Rating : 0.00 
+Unsatisfiable/GRP136-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/GRP137-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/GRP138-1.ma ... OK TIME NEEDED: 10.54 (* Rating : 0.00 
+Unsatisfiable/GRP139-1.ma ... OK TIME NEEDED: 0.12 (* Rating : 0.00 
+Unsatisfiable/GRP140-1.ma ... OK TIME NEEDED: 7.30 (* Rating : 0.00 
+Unsatisfiable/GRP141-1.ma ... OK TIME NEEDED: 0.12 (* Rating : 0.00 
+Unsatisfiable/GRP142-1.ma ... OK TIME NEEDED: 0.04 (* Rating : 0.00 
+Unsatisfiable/GRP143-1.ma ... OK TIME NEEDED: 0.07 (* Rating : 0.00 
+Unsatisfiable/GRP144-1.ma ... OK TIME NEEDED: 0.04 (* Rating : 0.00 
+Unsatisfiable/GRP145-1.ma ... OK TIME NEEDED: 0.07 (* Rating : 0.00 
+Unsatisfiable/GRP146-1.ma ... OK TIME NEEDED: 0.16 (* Rating : 0.00 
+Unsatisfiable/GRP147-1.ma ... OK TIME NEEDED: 57.43 (* Rating : 0.00 
+Unsatisfiable/GRP148-1.ma ... OK TIME NEEDED: 43.78 (* Rating : 0.00 
+Unsatisfiable/GRP149-1.ma ... OK TIME NEEDED: 0.16 (* Rating : 0.00 
+Unsatisfiable/GRP150-1.ma ... OK TIME NEEDED: 0.06 (* Rating : 0.00 
+Unsatisfiable/GRP151-1.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/GRP152-1.ma ... OK TIME NEEDED: 0.08 (* Rating : 0.00 
+Unsatisfiable/GRP153-1.ma ... OK TIME NEEDED: 0.06 (* Rating : 0.00 
+Unsatisfiable/GRP154-1.ma ... OK TIME NEEDED: 0.27 (* Rating : 0.00 
+Unsatisfiable/GRP155-1.ma ... OK TIME NEEDED: 0.34 (* Rating : 0.00 
+Unsatisfiable/GRP156-1.ma ... OK TIME NEEDED: 0.36 (* Rating : 0.00 
+Unsatisfiable/GRP157-1.ma ... OK TIME NEEDED: 0.18 (* Rating : 0.00 
+Unsatisfiable/GRP158-1.ma ... OK TIME NEEDED: 0.22 (* Rating : 0.00 
+Unsatisfiable/GRP159-1.ma ... OK TIME NEEDED: 0.20 (* Rating : 0.00 
+Unsatisfiable/GRP160-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/GRP161-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/GRP162-1.ma ... OK TIME NEEDED: 0.16 (* Rating : 0.00 
+Unsatisfiable/GRP163-1.ma ... OK TIME NEEDED: 0.18 (* Rating : 0.00 
+Unsatisfiable/GRP165-1.ma ... OK TIME NEEDED: 88.00 (* Rating : 0.00 
+Unsatisfiable/GRP165-2.ma ... OK TIME NEEDED: 83.45 (* Rating : 0.00 
+Unsatisfiable/GRP166-1.ma ... OK TIME NEEDED: 4.62 (* Rating : 0.00 
+Unsatisfiable/GRP166-2.ma ... OK TIME NEEDED: 102.88 (* Rating : 0.00 
+Unsatisfiable/GRP166-3.ma ... OK TIME NEEDED: 144.57 (* Rating : 0.00 
+Unsatisfiable/GRP166-4.ma ... OK TIME NEEDED: 123.60 (* Rating : 0.00 
+Unsatisfiable/GRP169-1.ma ... OK TIME NEEDED: 37.22 (* Rating : 0.00 
+Unsatisfiable/GRP169-2.ma ... OK TIME NEEDED: 36.29 (* Rating : 0.00 
+Unsatisfiable/GRP171-1.ma ... OK TIME NEEDED: 4.60 (* Rating : 0.00 
+Unsatisfiable/GRP171-2.ma ... OK TIME NEEDED: 4.62 (* Rating : 0.00 
+Unsatisfiable/GRP172-1.ma ... OK TIME NEEDED: 3.86 (* Rating : 0.00 
+Unsatisfiable/GRP172-2.ma ... OK TIME NEEDED: 3.99 (* Rating : 0.00 
+Unsatisfiable/GRP173-1.ma ... OK TIME NEEDED: 0.05 (* Rating : 0.00 
+Unsatisfiable/GRP174-1.ma ... OK TIME NEEDED: 0.06 (* Rating : 0.00 
+Unsatisfiable/GRP175-1.ma ... OK TIME NEEDED: 89.89 (* Rating : 0.00 
+Unsatisfiable/GRP175-2.ma ... OK TIME NEEDED: 85.68 (* Rating : 0.00 
+Unsatisfiable/GRP175-3.ma ... OK TIME NEEDED: 90.00 (* Rating : 0.00 
+Unsatisfiable/GRP175-4.ma ... OK TIME NEEDED: 88.31 (* Rating : 0.00 
+Unsatisfiable/GRP176-1.ma ... OK TIME NEEDED: 0.36 (* Rating : 0.00 
+Unsatisfiable/GRP176-2.ma ... OK TIME NEEDED: 0.34 (* Rating : 0.00 
+Unsatisfiable/GRP182-1.ma ... OK TIME NEEDED: 0.02 (* Rating : 0.00 
+Unsatisfiable/GRP182-2.ma ... OK TIME NEEDED: 0.05 (* Rating : 0.00 
+Unsatisfiable/GRP182-3.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/GRP182-4.ma ... OK TIME NEEDED: 0.06 (* Rating : 0.00 
+Unsatisfiable/GRP184-4.ma ... OK TIME NEEDED: 293.47 (* Rating : 0.00 
+Unsatisfiable/GRP186-3.ma ... OK TIME NEEDED: 0.20 (* Rating : 0.00 
+Unsatisfiable/GRP186-4.ma ... OK TIME NEEDED: 0.22 (* Rating : 0.00 
+Unsatisfiable/GRP188-1.ma ... OK TIME NEEDED: 0.08 (* Rating : 0.00 
+Unsatisfiable/GRP188-2.ma ... OK TIME NEEDED: 0.05 (* Rating : 0.00 
+Unsatisfiable/GRP189-1.ma ... OK TIME NEEDED: 0.04 (* Rating : 0.00 
+Unsatisfiable/GRP189-2.ma ... OK TIME NEEDED: 0.06 (* Rating : 0.00 
+Unsatisfiable/GRP190-1.ma ... OK TIME NEEDED: 42.71 (* Rating : 0.00 
+Unsatisfiable/GRP190-2.ma ... OK TIME NEEDED: 42.82 (* Rating : 0.00 
+Unsatisfiable/GRP191-1.ma ... OK TIME NEEDED: 44.97 (* Rating : 0.00 
+Unsatisfiable/GRP191-2.ma ... OK TIME NEEDED: 44.78 (* Rating : 0.00 
+Unsatisfiable/GRP193-1.ma ... OK TIME NEEDED: 160.12 (* Rating : 0.00 
+Unsatisfiable/GRP193-2.ma ... OK TIME NEEDED: 137.38 (* Rating : 0.00 
+Unsatisfiable/GRP206-1.ma ... OK TIME NEEDED: 0.04 (* Rating : 0.00 
+Unsatisfiable/GRP406-1.ma ... OK TIME NEEDED: 258.25 (* Rating : 0.00 
+Unsatisfiable/GRP407-1.ma ... OK TIME NEEDED: 267.52 (* Rating : 0.00 
+Unsatisfiable/GRP408-1.ma ... OK TIME NEEDED: 271.12 (* Rating : 0.00 
+Unsatisfiable/GRP409-1.ma ... OK TIME NEEDED: 7.14 (* Rating : 0.00 
+Unsatisfiable/GRP412-1.ma ... OK TIME NEEDED: 38.24 (* Rating : 0.00 
+Unsatisfiable/GRP424-1.ma ... OK TIME NEEDED: 21.08 (* Rating : 0.00 
+Unsatisfiable/GRP431-1.ma ... OK TIME NEEDED: 30.97 (* Rating : 0.00 
+Unsatisfiable/GRP432-1.ma ... OK TIME NEEDED: 35.68 (* Rating : 0.00 
+Unsatisfiable/GRP434-1.ma ... OK TIME NEEDED: 75.44 (* Rating : 0.00 
+Unsatisfiable/GRP435-1.ma ... OK TIME NEEDED: 99.68 (* Rating : 0.00 
+Unsatisfiable/GRP454-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/GRP455-1.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/GRP457-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/GRP458-1.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/GRP459-1.ma ... OK TIME NEEDED: 0.19 (* Rating : 0.00 
+Unsatisfiable/GRP460-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/GRP463-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/GRP467-1.ma ... OK TIME NEEDED: 0.48 (* Rating : 0.00 
+Unsatisfiable/GRP468-1.ma ... OK TIME NEEDED: 1.85 (* Rating : 0.00 
+Unsatisfiable/GRP481-1.ma ... OK TIME NEEDED: 0.02 (* Rating : 0.00 
+Unsatisfiable/GRP484-1.ma ... OK TIME NEEDED: 0.05 (* Rating : 0.00 
+Unsatisfiable/GRP485-1.ma ... OK TIME NEEDED: 0.08 (* Rating : 0.00 
+Unsatisfiable/GRP486-1.ma ... OK TIME NEEDED: 0.35 (* Rating : 0.00 
+Unsatisfiable/GRP487-1.ma ... OK TIME NEEDED: 0.02 (* Rating : 0.00 
+Unsatisfiable/GRP488-1.ma ... OK TIME NEEDED: 0.70 (* Rating : 0.00 
+Unsatisfiable/GRP489-1.ma ... OK TIME NEEDED: 1.10 (* Rating : 0.00 
+Unsatisfiable/GRP490-1.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/GRP491-1.ma ... OK TIME NEEDED: 0.05 (* Rating : 0.00 
+Unsatisfiable/GRP492-1.ma ... OK TIME NEEDED: 0.47 (* Rating : 0.00 
+Unsatisfiable/GRP493-1.ma ... OK TIME NEEDED: 0.02 (* Rating : 0.00 
+Unsatisfiable/GRP494-1.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/GRP495-1.ma ... OK TIME NEEDED: 0.25 (* Rating : 0.00 
+Unsatisfiable/GRP496-1.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/GRP497-1.ma ... OK TIME NEEDED: 0.13 (* Rating : 0.00 
+Unsatisfiable/GRP498-1.ma ... OK TIME NEEDED: 0.32 (* Rating : 0.00 
+Unsatisfiable/GRP509-1.ma ... OK TIME NEEDED: 0.60 (* Rating : 0.00 
+Unsatisfiable/GRP510-1.ma ... OK TIME NEEDED: 0.08 (* Rating : 0.00 
+Unsatisfiable/GRP511-1.ma ... OK TIME NEEDED: 0.77 (* Rating : 0.00 
+Unsatisfiable/GRP512-1.ma ... OK TIME NEEDED: 0.13 (* Rating : 0.00 
+Unsatisfiable/GRP513-1.ma ... OK TIME NEEDED: 0.64 (* Rating : 0.00 
+Unsatisfiable/GRP514-1.ma ... OK TIME NEEDED: 0.11 (* Rating : 0.00 
+Unsatisfiable/GRP515-1.ma ... OK TIME NEEDED: 0.57 (* Rating : 0.00 
+Unsatisfiable/GRP516-1.ma ... OK TIME NEEDED: 0.11 (* Rating : 0.00 
+Unsatisfiable/GRP517-1.ma ... OK TIME NEEDED: 0.53 (* Rating : 0.00 
+Unsatisfiable/GRP518-1.ma ... OK TIME NEEDED: 0.10 (* Rating : 0.00 
+Unsatisfiable/GRP519-1.ma ... OK TIME NEEDED: 1.23 (* Rating : 0.00 
+Unsatisfiable/GRP520-1.ma ... OK TIME NEEDED: 0.10 (* Rating : 0.00 
+Unsatisfiable/GRP541-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/GRP542-1.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/GRP543-1.ma ... OK TIME NEEDED: 0.21 (* Rating : 0.00 
+Unsatisfiable/GRP544-1.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/GRP545-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/GRP546-1.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/GRP547-1.ma ... OK TIME NEEDED: 0.50 (* Rating : 0.00 
+Unsatisfiable/GRP548-1.ma ... OK TIME NEEDED: 0.05 (* Rating : 0.00 
+Unsatisfiable/GRP549-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/GRP551-1.ma ... OK TIME NEEDED: 0.41 (* Rating : 0.00 
+Unsatisfiable/GRP552-1.ma ... OK TIME NEEDED: 0.02 (* Rating : 0.00 
+Unsatisfiable/GRP556-1.ma ... OK TIME NEEDED: 0.65 (* Rating : 0.00 
+Unsatisfiable/GRP558-1.ma ... OK TIME NEEDED: 0.05 (* Rating : 0.00 
+Unsatisfiable/GRP559-1.ma ... OK TIME NEEDED: 1.24 (* Rating : 0.00 
+Unsatisfiable/GRP560-1.ma ... OK TIME NEEDED: 0.20 (* Rating : 0.00 
+Unsatisfiable/GRP561-1.ma ... OK TIME NEEDED: 0.13 (* Rating : 0.00 
+Unsatisfiable/GRP562-1.ma ... OK TIME NEEDED: 0.04 (* Rating : 0.00 
+Unsatisfiable/GRP563-1.ma ... OK TIME NEEDED: 3.89 (* Rating : 0.00 
+Unsatisfiable/GRP564-1.ma ... OK TIME NEEDED: 0.13 (* Rating : 0.00 
+Unsatisfiable/GRP565-1.ma ... OK TIME NEEDED: 0.05 (* Rating : 0.00 
+Unsatisfiable/GRP566-1.ma ... OK TIME NEEDED: 0.04 (* Rating : 0.00 
+Unsatisfiable/GRP569-1.ma ... OK TIME NEEDED: 0.04 (* Rating : 0.00 
+Unsatisfiable/GRP570-1.ma ... OK TIME NEEDED: 0.04 (* Rating : 0.00 
+Unsatisfiable/GRP573-1.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/GRP574-1.ma ... OK TIME NEEDED: 0.11 (* Rating : 0.00 
+Unsatisfiable/GRP576-1.ma ... OK TIME NEEDED: 0.16 (* Rating : 0.00 
+Unsatisfiable/GRP577-1.ma ... OK TIME NEEDED: 0.08 (* Rating : 0.00 
+Unsatisfiable/GRP578-1.ma ... OK TIME NEEDED: 0.19 (* Rating : 0.00 
+Unsatisfiable/GRP580-1.ma ... OK TIME NEEDED: 0.52 (* Rating : 0.00 
+Unsatisfiable/GRP581-1.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/GRP582-1.ma ... OK TIME NEEDED: 0.14 (* Rating : 0.00 
+Unsatisfiable/GRP584-1.ma ... OK TIME NEEDED: 0.42 (* Rating : 0.00 
+Unsatisfiable/GRP586-1.ma ... OK TIME NEEDED: 0.11 (* Rating : 0.00 
+Unsatisfiable/GRP587-1.ma ... OK TIME NEEDED: 7.98 (* Rating : 0.00 
+Unsatisfiable/GRP588-1.ma ... OK TIME NEEDED: 0.41 (* Rating : 0.00 
+Unsatisfiable/GRP590-1.ma ... OK TIME NEEDED: 0.15 (* Rating : 0.00 
+Unsatisfiable/GRP593-1.ma ... OK TIME NEEDED: 1.24 (* Rating : 0.00 
+Unsatisfiable/GRP594-1.ma ... OK TIME NEEDED: 1.02 (* Rating : 0.00 
+Unsatisfiable/GRP597-1.ma ... OK TIME NEEDED: 0.52 (* Rating : 0.00 
+Unsatisfiable/GRP605-1.ma ... OK TIME NEEDED: 0.56 (* Rating : 0.00 
+Unsatisfiable/GRP606-1.ma ... OK TIME NEEDED: 0.35 (* Rating : 0.00 
+Unsatisfiable/GRP607-1.ma ... OK TIME NEEDED: 1.27 (* Rating : 0.00 
+Unsatisfiable/GRP608-1.ma ... OK TIME NEEDED: 0.40 (* Rating : 0.00 
+Unsatisfiable/GRP613-1.ma ... OK TIME NEEDED: 0.48 (* Rating : 0.00 
+Unsatisfiable/GRP614-1.ma ... OK TIME NEEDED: 0.25 (* Rating : 0.00 
+Unsatisfiable/GRP616-1.ma ... OK TIME NEEDED: 0.27 (* Rating : 0.00 
+Unsatisfiable/LAT009-1.ma ... OK TIME NEEDED: 271.20 (* Rating : 0.00 
+Unsatisfiable/LAT019-1.ma ... OK TIME NEEDED: 165.91 (* Rating : 0.00 
+Unsatisfiable/LAT028-1.ma ... OK TIME NEEDED: 45.13 (* Rating : 0.00 
+Unsatisfiable/LAT031-1.ma ... OK TIME NEEDED: 60.22 (* Rating : 0.00 
+Unsatisfiable/LAT032-1.ma ... OK TIME NEEDED: 1.63 (* Rating : 0.00 
+Unsatisfiable/LAT033-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/LAT034-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/LAT039-1.ma ... OK TIME NEEDED: 0.41 (* Rating : 0.00 
+Unsatisfiable/LAT039-2.ma ... OK TIME NEEDED: 0.41 (* Rating : 0.00 
+Unsatisfiable/LAT040-1.ma ... OK TIME NEEDED: 0.94 (* Rating : 0.00 
+Unsatisfiable/LAT042-1.ma ... OK TIME NEEDED: 22.84 (* Rating : 0.00 
+Unsatisfiable/LAT043-1.ma ... OK TIME NEEDED: 23.72 (* Rating : 0.00 
+Unsatisfiable/LCL110-2.ma ... OK TIME NEEDED: 0.26 (* Rating : 0.00 
+Unsatisfiable/LCL112-2.ma ... OK TIME NEEDED: 0.27 (* Rating : 0.00 
+Unsatisfiable/LCL113-2.ma ... OK TIME NEEDED: 0.28 (* Rating : 0.00 
+Unsatisfiable/LCL114-2.ma ... OK TIME NEEDED: 0.35 (* Rating : 0.00 
+Unsatisfiable/LCL115-2.ma ... OK TIME NEEDED: 0.55 (* Rating : 0.00 
+Unsatisfiable/LCL116-2.ma ... OK TIME NEEDED: 4.89 (* Rating : 0.00 
+Unsatisfiable/LCL132-1.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/LCL133-1.ma ... OK TIME NEEDED: 0.05 (* Rating : 0.00 
+Unsatisfiable/LCL134-1.ma ... OK TIME NEEDED: 0.05 (* Rating : 0.00 
+Unsatisfiable/LCL135-1.ma ... OK TIME NEEDED: 0.05 (* Rating : 0.00 
+Unsatisfiable/LCL139-1.ma ... OK TIME NEEDED: 0.34 (* Rating : 0.00 
+Unsatisfiable/LCL140-1.ma ... OK TIME NEEDED: 0.27 (* Rating : 0.00 
+Unsatisfiable/LCL141-1.ma ... OK TIME NEEDED: 0.55 (* Rating : 0.00 
+Unsatisfiable/LCL153-1.ma ... OK TIME NEEDED: 0.30 (* Rating : 0.00 
+Unsatisfiable/LCL154-1.ma ... OK TIME NEEDED: 0.26 (* Rating : 0.00 
+Unsatisfiable/LCL155-1.ma ... OK TIME NEEDED: 0.29 (* Rating : 0.00 
+Unsatisfiable/LCL156-1.ma ... OK TIME NEEDED: 0.25 (* Rating : 0.00 
+Unsatisfiable/LCL157-1.ma ... OK TIME NEEDED: 0.26 (* Rating : 0.00 
+Unsatisfiable/LCL158-1.ma ... OK TIME NEEDED: 0.30 (* Rating : 0.00 
+Unsatisfiable/LCL159-1.ma ... OK TIME NEEDED: 1.40 (* Rating : 0.00 
+Unsatisfiable/LCL161-1.ma ... OK TIME NEEDED: 0.09 (* Rating : 0.00 
+Unsatisfiable/LCL164-1.ma ... OK TIME NEEDED: 0.14 (* Rating : 0.00 
+Unsatisfiable/LDA001-1.ma ... OK TIME NEEDED: 0.04 (* Rating : 0.00 
+Unsatisfiable/LDA002-1.ma ... OK TIME NEEDED: 10.74 (* Rating : 0.00 
+Unsatisfiable/LDA007-3.ma ... OK TIME NEEDED: 0.11 (* Rating : 0.00 
+Unsatisfiable/RNG007-4.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/RNG011-5.ma ... OK TIME NEEDED: 0.24 (* Rating : 0.00 
+Unsatisfiable/RNG012-6.ma ... OK TIME NEEDED: 51.47 (* Rating : 0.00 
+Unsatisfiable/RNG013-6.ma ... OK TIME NEEDED: 50.47 (* Rating : 0.00 
+Unsatisfiable/RNG014-6.ma ... OK TIME NEEDED: 48.93 (* Rating : 0.00 
+Unsatisfiable/RNG015-6.ma ... OK TIME NEEDED: 48.44 (* Rating : 0.00 
+Unsatisfiable/RNG016-6.ma ... OK TIME NEEDED: 50.42 (* Rating : 0.00 
+Unsatisfiable/RNG017-6.ma ... OK TIME NEEDED: 50.79 (* Rating : 0.00 
+Unsatisfiable/RNG018-6.ma ... OK TIME NEEDED: 48.34 (* Rating : 0.00 
+Unsatisfiable/RNG023-6.ma ... OK TIME NEEDED: 0.18 (* Rating : 0.00 
+Unsatisfiable/RNG023-7.ma ... OK TIME NEEDED: 0.29 (* Rating : 0.00 
+Unsatisfiable/RNG024-6.ma ... OK TIME NEEDED: 0.17 (* Rating : 0.00 
+Unsatisfiable/RNG024-7.ma ... OK TIME NEEDED: 0.29 (* Rating : 0.00 
+Unsatisfiable/ROB002-1.ma ... OK TIME NEEDED: 0.03 (* Rating : 0.00 
+Unsatisfiable/ROB003-1.ma ... OK TIME NEEDED: 47.87 (* Rating : 0.00 
+Unsatisfiable/ROB004-1.ma ... OK TIME NEEDED: 24.39 (* Rating : 0.00 
+Unsatisfiable/ROB008-1.ma ... OK TIME NEEDED: 122.13 (* Rating : 0.00 
+Unsatisfiable/ROB009-1.ma ... OK TIME NEEDED: 0.80 (* Rating : 0.00 
+Unsatisfiable/ROB010-1.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/ROB013-1.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.00 
+Unsatisfiable/ROB022-1.ma ... OK TIME NEEDED: 173.21 (* Rating : 0.00 
+Unsatisfiable/ROB023-1.ma ... OK TIME NEEDED: 191.39 (* Rating : 0.00 
+Unsatisfiable/ROB030-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/SYN083-1.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.00 
+Unsatisfiable/ALG005-1.ma ... OK TIME NEEDED: 27.54 (* Rating : 0.07 
+Unsatisfiable/BOO002-1.ma ... OK TIME NEEDED: 14.36 (* Rating : 0.07 
+Unsatisfiable/BOO007-4.ma ... OK TIME NEEDED: 60.41 (* Rating : 0.07 
+Unsatisfiable/BOO008-2.ma ... OK TIME NEEDED: 98.05 (* Rating : 0.07 
+Unsatisfiable/BOO025-1.ma ... OK TIME NEEDED: 40.06 (* Rating : 0.07 
+Unsatisfiable/COL001-1.ma ... OK TIME NEEDED: 105.21 (* Rating : 0.07 
+Unsatisfiable/COL001-2.ma ... OK TIME NEEDED: 27.06 (* Rating : 0.07 
+Unsatisfiable/COL009-1.ma ... OK TIME NEEDED: 121.79 (* Rating : 0.07 
+Unsatisfiable/COL010-1.ma ... OK TIME NEEDED: 0.97 (* Rating : 0.07 
+Unsatisfiable/COL064-2.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.07 
+Unsatisfiable/COL064-4.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.07 
+Unsatisfiable/COL064-5.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.07 
+Unsatisfiable/COL064-7.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.07 
+Unsatisfiable/COL064-9.ma ... OK TIME NEEDED: 0.00 (* Rating : 0.07 
+Unsatisfiable/GRP168-1.ma ... OK TIME NEEDED: 0.28 (* Rating : 0.07 
+Unsatisfiable/GRP168-2.ma ... OK TIME NEEDED: 0.38 (* Rating : 0.07 
+Unsatisfiable/GRP192-1.ma ... OK TIME NEEDED: 0.20 (* Rating : 0.07 
+Unsatisfiable/GRP403-1.ma ... OK TIME NEEDED: 28.55 (* Rating : 0.07 
+Unsatisfiable/GRP437-1.ma ... OK TIME NEEDED: 81.72 (* Rating : 0.07 
+Unsatisfiable/GRP438-1.ma ... OK TIME NEEDED: 122.27 (* Rating : 0.07 
+Unsatisfiable/GRP439-1.ma ... OK TIME NEEDED: 31.35 (* Rating : 0.07 
+Unsatisfiable/GRP456-1.ma ... OK TIME NEEDED: 0.18 (* Rating : 0.07 
+Unsatisfiable/GRP473-1.ma ... OK TIME NEEDED: 66.00 (* Rating : 0.07 
+Unsatisfiable/GRP474-1.ma ... OK TIME NEEDED: 85.37 (* Rating : 0.07 
+Unsatisfiable/GRP500-1.ma ... OK TIME NEEDED: 24.13 (* Rating : 0.07 
+Unsatisfiable/GRP550-1.ma ... OK TIME NEEDED: 0.02 (* Rating : 0.07 
+Unsatisfiable/GRP572-1.ma ... OK TIME NEEDED: 0.22 (* Rating : 0.07 
+Unsatisfiable/GRP579-1.ma ... OK TIME NEEDED: 3.97 (* Rating : 0.07 
+Unsatisfiable/GRP583-1.ma ... OK TIME NEEDED: 0.76 (* Rating : 0.07 
+Unsatisfiable/GRP592-1.ma ... OK TIME NEEDED: 0.22 (* Rating : 0.07 
+Unsatisfiable/GRP595-1.ma ... OK TIME NEEDED: 0.15 (* Rating : 0.07 
+Unsatisfiable/GRP596-1.ma ... OK TIME NEEDED: 0.25 (* Rating : 0.07 
+Unsatisfiable/GRP598-1.ma ... OK TIME NEEDED: 0.20 (* Rating : 0.07 
+Unsatisfiable/GRP599-1.ma ... OK TIME NEEDED: 0.96 (* Rating : 0.07 
+Unsatisfiable/GRP600-1.ma ... OK TIME NEEDED: 0.30 (* Rating : 0.07 
+Unsatisfiable/GRP601-1.ma ... OK TIME NEEDED: 1.06 (* Rating : 0.07 
+Unsatisfiable/GRP602-1.ma ... OK TIME NEEDED: 0.47 (* Rating : 0.07 
+Unsatisfiable/GRP603-1.ma ... OK TIME NEEDED: 0.47 (* Rating : 0.07 
+Unsatisfiable/GRP604-1.ma ... OK TIME NEEDED: 0.61 (* Rating : 0.07 
+Unsatisfiable/GRP609-1.ma ... OK TIME NEEDED: 1.06 (* Rating : 0.07 
+Unsatisfiable/GRP610-1.ma ... OK TIME NEEDED: 0.27 (* Rating : 0.07 
+Unsatisfiable/GRP612-1.ma ... OK TIME NEEDED: 0.28 (* Rating : 0.07 
+Unsatisfiable/GRP615-1.ma ... OK TIME NEEDED: 0.68 (* Rating : 0.07 
+Unsatisfiable/LAT008-1.ma ... OK TIME NEEDED: 0.78 (* Rating : 0.07 
+Unsatisfiable/LAT027-1.ma ... OK TIME NEEDED: 49.64 (* Rating : 0.07 
+Unsatisfiable/LAT045-1.ma ... OK TIME NEEDED: 0.37 (* Rating : 0.07 
+Unsatisfiable/LCL111-2.ma ... OK TIME NEEDED: 5.72 (* Rating : 0.07 
+Unsatisfiable/RNG008-3.ma ... OK TIME NEEDED: 3.54 (* Rating : 0.07 
+Unsatisfiable/RNG008-4.ma ... OK TIME NEEDED: 0.18 (* Rating : 0.07 
+Unsatisfiable/RNG008-7.ma ... OK TIME NEEDED: 17.42 (* Rating : 0.07 
+Unsatisfiable/ROB005-1.ma ... OK TIME NEEDED: 221.06 (* Rating : 0.07 
+Unsatisfiable/BOO007-2.ma ... OK TIME NEEDED: 72.77 (* Rating : 0.14 
+Unsatisfiable/GRP167-5.ma ... OK TIME NEEDED: 1.12 (* Rating : 0.14 
+Unsatisfiable/GRP479-1.ma ... OK TIME NEEDED: 23.91 (* Rating : 0.14 
+Unsatisfiable/GRP501-1.ma ... OK TIME NEEDED: 56.48 (* Rating : 0.14 
+Unsatisfiable/GRP567-1.ma ... OK TIME NEEDED: 0.89 (* Rating : 0.14 
+Unsatisfiable/GRP568-1.ma ... OK TIME NEEDED: 0.46 (* Rating : 0.14 
+Unsatisfiable/GRP571-1.ma ... OK TIME NEEDED: 1.14 (* Rating : 0.14 
+Unsatisfiable/GRP575-1.ma ... OK TIME NEEDED: 2.19 (* Rating : 0.14 
+Unsatisfiable/LAT006-1.ma ... OK TIME NEEDED: 9.83 (* Rating : 0.14 
+Unsatisfiable/LAT143-1.ma ... OK TIME NEEDED: 149.59 (* Rating : 0.14 
+Unsatisfiable/LCL109-6.ma ... OK TIME NEEDED: 49.25 (* Rating : 0.14 
+Unsatisfiable/LCL160-1.ma ... OK TIME NEEDED: 255.01 (* Rating : 0.14 
+Unsatisfiable/LCL163-1.ma ... OK TIME NEEDED: 6.24 (* Rating : 0.14 
+Unsatisfiable/BOO034-1.ma ... OK TIME NEEDED: 0.94 (* Rating : 0.21 
+Unsatisfiable/COL004-3.ma ... OK TIME NEEDED: 0.01 (* Rating : 0.21 
+Unsatisfiable/GRP167-1.ma ... OK TIME NEEDED: 3.28 (* Rating : 0.21 
+Unsatisfiable/GRP167-2.ma ... OK TIME NEEDED: 2.83 (* Rating : 0.21 
+Unsatisfiable/GRP404-1.ma ... OK TIME NEEDED: 69.93 (* Rating : 0.21 
+Unsatisfiable/GRP405-1.ma ... OK TIME NEEDED: 70.94 (* Rating : 0.21 
+Unsatisfiable/GRP410-1.ma ... OK TIME NEEDED: 10.96 (* Rating : 0.21 
+Unsatisfiable/GRP411-1.ma ... OK TIME NEEDED: 12.26 (* Rating : 0.21 
+Unsatisfiable/GRP470-1.ma ... OK TIME NEEDED: 115.05 (* Rating : 0.21 
+Unsatisfiable/GRP471-1.ma ... OK TIME NEEDED: 140.02 (* Rating : 0.21 
+Unsatisfiable/GRP476-1.ma ... OK TIME NEEDED: 86.40 (* Rating : 0.21 
+Unsatisfiable/GRP477-1.ma ... OK TIME NEEDED: 88.63 (* Rating : 0.21 
+Unsatisfiable/GRP480-1.ma ... OK TIME NEEDED: 28.09 (* Rating : 0.21 
+Unsatisfiable/GRP114-1.ma ... OK TIME NEEDED: 8.54 (* Rating : 0.29 
+Unsatisfiable/LCL109-2.ma ... OK TIME NEEDED: 71.47 (* Rating : 0.29 
+Unsatisfiable/GRP181-3.ma ... OK TIME NEEDED: 16.87 (* Rating : 0.43 
+Unsatisfiable/GRP181-4.ma ... OK TIME NEEDED: 27.77 (* Rating : 0.43 
+Unsatisfiable/LAT156-1.ma ... OK TIME NEEDED: 218.93 (* Rating : 0.64 
+Unsatisfiable/LAT017-1.ma ... OK TIME NEEDED: 148.94 (* Rating : 0.71 
diff --git a/matita/tests/TPTP/log.300.27-6.fixprove.fixsimpl-infergoal b/matita/tests/TPTP/log.300.27-6.fixprove.fixsimpl-infergoal
new file mode 100644 (file)
index 0000000..04ab4d7
--- /dev/null
@@ -0,0 +1,65 @@
+Unsatisfiable/ALG005-1.ma ... OK TIME NEEDED: 41.94 Rating : 0.07 1
+Unsatisfiable/ALG006-1.ma ... OK TIME NEEDED: 3.74 Rating : 0.00 2
+Unsatisfiable/ALG007-1.ma ... OK TIME NEEDED: 11.45 Rating : 0.00 3
+Unsatisfiable/BOO001-1.ma ... OK TIME NEEDED: 1.05 Rating : 0.00 4
+Unsatisfiable/BOO002-1.ma ... OK TIME NEEDED: 12.91 Rating : 0.07 5
+Unsatisfiable/BOO002-2.ma ... OK TIME NEEDED: 8.25 Rating : 0.00 6
+Unsatisfiable/BOO003-2.ma ... FAIL Rating : 0.00 7
+Unsatisfiable/BOO003-4.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 8
+Unsatisfiable/BOO004-2.ma ... OK TIME NEEDED: 0.27 Rating : 0.00 9
+Unsatisfiable/BOO004-4.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 10
+Unsatisfiable/BOO005-2.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 11
+Unsatisfiable/BOO005-4.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 12
+Unsatisfiable/BOO006-2.ma ... OK TIME NEEDED: 0.68 Rating : 0.00 13
+Unsatisfiable/BOO006-4.ma ... OK TIME NEEDED: 0.69 Rating : 0.00 14
+Unsatisfiable/BOO007-2.ma ... OK TIME NEEDED: 97.44 Rating : 0.14 15
+Unsatisfiable/BOO007-4.ma ... FAIL Rating : 0.07 16
+Unsatisfiable/BOO008-2.ma ... OK TIME NEEDED: 101.88 Rating : 0.07 17
+Unsatisfiable/BOO008-4.ma ... OK TIME NEEDED: 140.95 Rating : 0.00 18
+Unsatisfiable/BOO009-2.ma ... OK TIME NEEDED: 1.83 Rating : 0.00 19
+Unsatisfiable/BOO009-4.ma ... OK TIME NEEDED: 0.71 Rating : 0.00 20
+Unsatisfiable/BOO010-2.ma ... OK TIME NEEDED: 1.81 Rating : 0.00 21
+Unsatisfiable/BOO010-4.ma ... OK TIME NEEDED: 0.73 Rating : 0.00 22
+Unsatisfiable/BOO011-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 23
+Unsatisfiable/BOO011-4.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 24
+Unsatisfiable/BOO012-2.ma ... OK TIME NEEDED: 0.41 Rating : 0.00 25
+Unsatisfiable/BOO012-4.ma ... OK TIME NEEDED: 0.38 Rating : 0.00 26
+Unsatisfiable/BOO013-2.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 27
+Unsatisfiable/BOO013-4.ma ... OK TIME NEEDED: 0.21 Rating : 0.00 28
+Unsatisfiable/BOO014-2.ma ... OK TIME NEEDED: 7.91 Rating : 0.00 29
+Unsatisfiable/BOO014-4.ma ... OK TIME NEEDED: 47.97 Rating : 0.00 30
+Unsatisfiable/BOO015-2.ma ... OK TIME NEEDED: 10.04 Rating : 0.00 31
+Unsatisfiable/BOO015-4.ma ... FAIL Rating : 0.00 32
+Unsatisfiable/BOO016-2.ma ... OK TIME NEEDED: 0.92 Rating : 0.00 33
+Unsatisfiable/BOO017-2.ma ... OK TIME NEEDED: 1.60 Rating : 0.00 34
+Unsatisfiable/BOO018-4.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 35
+Unsatisfiable/BOO021-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.07 36
+Unsatisfiable/BOO022-1.ma ... FAIL Rating : 0.07 37
+Unsatisfiable/BOO023-1.ma ... OK TIME NEEDED: 100.75 Rating : 0.50 38
+Unsatisfiable/BOO024-1.ma ... OK TIME NEEDED: 2.61 Rating : 0.00 39
+Unsatisfiable/BOO025-1.ma ... OK TIME NEEDED: 3.36 Rating : 0.07 40
+Unsatisfiable/BOO026-1.ma ... OK TIME NEEDED: 23.65 Rating : 0.07 41
+Unsatisfiable/BOO028-1.ma ... FAIL Rating : 0.07 42
+Unsatisfiable/BOO029-1.ma ... OK TIME NEEDED: 59.89 Rating : 0.00 43
+Unsatisfiable/BOO031-1.ma ... FAIL Rating : 0.21 44
+Unsatisfiable/BOO034-1.ma ... FAIL Rating : 0.21 45
+Unsatisfiable/BOO067-1.ma ... FAIL Rating : 0.21 46
+Unsatisfiable/BOO068-1.ma ... OK TIME NEEDED: 1.71 Rating : 0.00 47
+Unsatisfiable/BOO069-1.ma ... OK TIME NEEDED: 0.92 Rating : 0.00 48
+Unsatisfiable/BOO070-1.ma ... OK TIME NEEDED: 1.96 Rating : 0.00 49
+Unsatisfiable/BOO071-1.ma ... OK TIME NEEDED: 0.95 Rating : 0.00 50
+Unsatisfiable/BOO072-1.ma ... FAIL Rating : 0.07 51
+Unsatisfiable/BOO073-1.ma ... FAIL Rating : 0.36 52
+Unsatisfiable/BOO074-1.ma ... FAIL Rating : 0.07 53
+Unsatisfiable/BOO075-1.ma ... OK TIME NEEDED: 0.79 Rating : 0.00 54
+Unsatisfiable/BOO076-1.ma ... FAIL Rating : 0.71 55
+Unsatisfiable/COL001-1.ma ... OK TIME NEEDED: 83.67 Rating : 0.07 56
+Unsatisfiable/COL001-2.ma ... OK TIME NEEDED: 6.02 Rating : 0.07 57
+Unsatisfiable/COL002-1.ma ... OK TIME NEEDED: 3.93 Rating : 0.00 58
+Unsatisfiable/COL002-4.ma ... FAIL Rating : 0.07 59
+Unsatisfiable/COL002-5.ma ... FAIL Rating : 0.43 60
+Unsatisfiable/COL003-1.ma ... FAIL Rating : 0.79 61
+Unsatisfiable/COL004-1.ma ... FAIL Rating : 0.57 62
+Unsatisfiable/COL004-3.ma ... FAIL Rating : 0.21 63
+Unsatisfiable/COL006-1.ma ... FAIL Rating : 0.57 64
+Unsatisfiable/COL006-5.ma 
\ No newline at end of file
diff --git a/matita/tests/TPTP/log.300.28-6.fixprove.fixsimpl-infergoal b/matita/tests/TPTP/log.300.28-6.fixprove.fixsimpl-infergoal
new file mode 100644 (file)
index 0000000..fb3eada
--- /dev/null
@@ -0,0 +1,698 @@
+Unsatisfiable/ALG005-1.ma ... OK TIME NEEDED: 40.69 Rating : 0.07 1
+Unsatisfiable/ALG006-1.ma ... OK TIME NEEDED: 3.59 Rating : 0.00 2
+Unsatisfiable/ALG007-1.ma ... OK TIME NEEDED: 11.00 Rating : 0.00 3
+Unsatisfiable/BOO001-1.ma ... OK TIME NEEDED: 1.04 Rating : 0.00 4
+Unsatisfiable/BOO002-1.ma ... OK TIME NEEDED: 12.66 Rating : 0.07 5
+Unsatisfiable/BOO002-2.ma ... OK TIME NEEDED: 8.11 Rating : 0.00 6
+Unsatisfiable/BOO003-2.ma ... OK TIME NEEDED: 0.35 Rating : 0.00 7
+Unsatisfiable/BOO003-4.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 8
+Unsatisfiable/BOO004-2.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 9
+Unsatisfiable/BOO004-4.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 10
+Unsatisfiable/BOO005-2.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 11
+Unsatisfiable/BOO005-4.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 12
+Unsatisfiable/BOO006-2.ma ... OK TIME NEEDED: 0.67 Rating : 0.00 13
+Unsatisfiable/BOO006-4.ma ... OK TIME NEEDED: 0.62 Rating : 0.00 14
+Unsatisfiable/BOO007-2.ma ... OK TIME NEEDED: 97.30 Rating : 0.14 15
+Unsatisfiable/BOO007-4.ma ... OK TIME NEEDED: 83.39 Rating : 0.07 16
+Unsatisfiable/BOO008-2.ma ... OK TIME NEEDED: 100.34 Rating : 0.07 17
+Unsatisfiable/BOO008-4.ma ... OK TIME NEEDED: 136.27 Rating : 0.00 18
+Unsatisfiable/BOO009-2.ma ... OK TIME NEEDED: 1.80 Rating : 0.00 19
+Unsatisfiable/BOO009-4.ma ... OK TIME NEEDED: 0.70 Rating : 0.00 20
+Unsatisfiable/BOO010-2.ma ... OK TIME NEEDED: 1.79 Rating : 0.00 21
+Unsatisfiable/BOO010-4.ma ... OK TIME NEEDED: 0.70 Rating : 0.00 22
+Unsatisfiable/BOO011-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 23
+Unsatisfiable/BOO011-4.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 24
+Unsatisfiable/BOO012-2.ma ... OK TIME NEEDED: 0.41 Rating : 0.00 25
+Unsatisfiable/BOO012-4.ma ... OK TIME NEEDED: 0.38 Rating : 0.00 26
+Unsatisfiable/BOO013-2.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 27
+Unsatisfiable/BOO013-4.ma ... OK TIME NEEDED: 0.20 Rating : 0.00 28
+Unsatisfiable/BOO014-2.ma ... OK TIME NEEDED: 7.86 Rating : 0.00 29
+Unsatisfiable/BOO014-4.ma ... OK TIME NEEDED: 48.85 Rating : 0.00 30
+Unsatisfiable/BOO015-2.ma ... OK TIME NEEDED: 9.57 Rating : 0.00 31
+Unsatisfiable/BOO015-4.ma ... FAIL Rating : 0.00 32
+Unsatisfiable/BOO016-2.ma ... OK TIME NEEDED: 0.91 Rating : 0.00 33
+Unsatisfiable/BOO017-2.ma ... OK TIME NEEDED: 1.56 Rating : 0.00 34
+Unsatisfiable/BOO018-4.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 35
+Unsatisfiable/BOO021-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.07 36
+Unsatisfiable/BOO022-1.ma ... FAIL Rating : 0.07 37
+Unsatisfiable/BOO023-1.ma ... OK TIME NEEDED: 84.14 Rating : 0.50 38
+Unsatisfiable/BOO024-1.ma ... OK TIME NEEDED: 2.32 Rating : 0.00 39
+Unsatisfiable/BOO025-1.ma ... OK TIME NEEDED: 3.07 Rating : 0.07 40
+Unsatisfiable/BOO026-1.ma ... OK TIME NEEDED: 20.98 Rating : 0.07 41
+Unsatisfiable/BOO028-1.ma ... FAIL Rating : 0.07 42
+Unsatisfiable/BOO029-1.ma ... OK TIME NEEDED: 54.59 Rating : 0.00 43
+Unsatisfiable/BOO031-1.ma ... FAIL Rating : 0.21 44
+Unsatisfiable/BOO034-1.ma ... OK TIME NEEDED: 1.48 Rating : 0.21 45
+Unsatisfiable/BOO067-1.ma ... FAIL Rating : 0.21 46
+Unsatisfiable/BOO068-1.ma ... OK TIME NEEDED: 1.69 Rating : 0.00 47
+Unsatisfiable/BOO069-1.ma ... OK TIME NEEDED: 0.92 Rating : 0.00 48
+Unsatisfiable/BOO070-1.ma ... OK TIME NEEDED: 1.91 Rating : 0.00 49
+Unsatisfiable/BOO071-1.ma ... OK TIME NEEDED: 0.91 Rating : 0.00 50
+Unsatisfiable/BOO072-1.ma ... FAIL Rating : 0.07 51
+Unsatisfiable/BOO073-1.ma ... FAIL Rating : 0.36 52
+Unsatisfiable/BOO074-1.ma ... FAIL Rating : 0.07 53
+Unsatisfiable/BOO075-1.ma ... OK TIME NEEDED: 0.80 Rating : 0.00 54
+Unsatisfiable/BOO076-1.ma ... FAIL Rating : 0.71 55
+Unsatisfiable/COL001-1.ma ... OK TIME NEEDED: 80.83 Rating : 0.07 56
+Unsatisfiable/COL001-2.ma ... OK TIME NEEDED: 5.93 Rating : 0.07 57
+Unsatisfiable/COL002-1.ma ... OK TIME NEEDED: 3.86 Rating : 0.00 58
+Unsatisfiable/COL002-4.ma ... FAIL Rating : 0.07 59
+Unsatisfiable/COL002-5.ma ... FAIL Rating : 0.43 60
+Unsatisfiable/COL003-1.ma ... FAIL Rating : 0.79 61
+Unsatisfiable/COL004-1.ma ... FAIL Rating : 0.57 62
+Unsatisfiable/COL004-3.ma ... FAIL Rating : 0.21 63
+Unsatisfiable/COL006-1.ma ... FAIL Rating : 0.57 64
+Unsatisfiable/COL006-5.ma ... FAIL Rating : 0.64 65
+Unsatisfiable/COL006-6.ma ... FAIL Rating : 0.64 66
+Unsatisfiable/COL006-7.ma ... FAIL Rating : 0.64 67
+Unsatisfiable/COL007-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 68
+Unsatisfiable/COL008-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 69
+Unsatisfiable/COL009-1.ma ... OK TIME NEEDED: 4.94 Rating : 0.07 70
+Unsatisfiable/COL010-1.ma ... OK TIME NEEDED: 0.81 Rating : 0.07 71
+Unsatisfiable/COL011-1.ma ... FAIL Rating : 0.36 72
+Unsatisfiable/COL012-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 73
+Unsatisfiable/COL013-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 74
+Unsatisfiable/COL014-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 75
+Unsatisfiable/COL015-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 76
+Unsatisfiable/COL016-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 77
+Unsatisfiable/COL017-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 78
+Unsatisfiable/COL018-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 79
+Unsatisfiable/COL019-1.ma ... OK TIME NEEDED: 61.04 Rating : 0.00 80
+Unsatisfiable/COL020-1.ma ... FAIL Rating : 0.07 81
+Unsatisfiable/COL021-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 82
+Unsatisfiable/COL022-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 83
+Unsatisfiable/COL023-1.ma ... FAIL Rating : 0.00 84
+Unsatisfiable/COL024-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 85
+Unsatisfiable/COL025-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 86
+Unsatisfiable/COL026-1.ma ... FAIL Rating : 0.07 87
+Unsatisfiable/COL027-1.ma ... FAIL Rating : 0.00 88
+Unsatisfiable/COL029-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 89
+Unsatisfiable/COL030-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.14 90
+Unsatisfiable/COL031-1.ma ... FAIL Rating : 0.00 91
+Unsatisfiable/COL032-1.ma ... OK Rating : 0.14 92
+Unsatisfiable/COL033-1.ma ... OK TIME NEEDED: 124.08 Rating : 0.07 93
+Unsatisfiable/COL034-1.ma ... FAIL Rating : 0.43 94
+Unsatisfiable/COL035-1.ma ... FAIL Rating : 0.14 95
+Unsatisfiable/COL036-1.ma ... FAIL Rating : 0.57 96
+Unsatisfiable/COL037-1.ma ... FAIL Rating : 0.29 97
+Unsatisfiable/COL038-1.ma ... FAIL Rating : 0.64 98
+Unsatisfiable/COL039-1.ma ... OK TIME NEEDED: 281.68 Rating : 0.00 99
+Unsatisfiable/COL041-1.ma ... OK Rating : 0.36 100
+Unsatisfiable/COL042-1.ma ... FAIL Rating : 0.86 101
+Unsatisfiable/COL042-6.ma ... FAIL Rating : 0.14 102
+Unsatisfiable/COL042-7.ma ... FAIL Rating : 0.14 103
+Unsatisfiable/COL042-8.ma ... FAIL Rating : 0.14 104
+Unsatisfiable/COL042-9.ma ... FAIL Rating : 0.14 105
+Unsatisfiable/COL043-1.ma ... FAIL Rating : 0.86 106
+Unsatisfiable/COL043-3.ma ... FAIL Rating : 0.71 107
+Unsatisfiable/COL044-1.ma ... FAIL Rating : 0.21 108
+Unsatisfiable/COL044-6.ma ... FAIL Rating : 0.64 109
+Unsatisfiable/COL044-7.ma ... FAIL Rating : 0.50 110
+Unsatisfiable/COL044-8.ma ... FAIL Rating : 0.71 111
+Unsatisfiable/COL044-9.ma ... FAIL Rating : 0.64 112
+Unsatisfiable/COL045-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 113
+Unsatisfiable/COL046-1.ma ... FAIL Rating : 0.64 114
+Unsatisfiable/COL048-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 115
+Unsatisfiable/COL049-1.ma ... FAIL Rating : 0.29 116
+Unsatisfiable/COL050-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 117
+Unsatisfiable/COL051-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 118
+Unsatisfiable/COL052-1.ma ... FAIL Rating : 0.00 119
+Unsatisfiable/COL053-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 120
+Unsatisfiable/COL056-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.07 121
+Unsatisfiable/COL057-1.ma ... FAIL Rating : 0.36 122
+Unsatisfiable/COL058-1.ma ... OK TIME NEEDED: 0.49 Rating : 0.00 123
+Unsatisfiable/COL058-2.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 124
+Unsatisfiable/COL058-3.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 125
+Unsatisfiable/COL059-1.ma ... FAIL Rating : 0.00 126
+Unsatisfiable/COL060-1.ma ... FAIL Rating : 0.36 127
+Unsatisfiable/COL060-2.ma ... FAIL Rating : 0.00 128
+Unsatisfiable/COL060-3.ma ... FAIL Rating : 0.00 129
+Unsatisfiable/COL061-1.ma ... FAIL Rating : 0.36 130
+Unsatisfiable/COL061-2.ma ... FAIL Rating : 0.00 131
+Unsatisfiable/COL061-3.ma ... FAIL Rating : 0.00 132
+Unsatisfiable/COL062-1.ma ... FAIL Rating : 0.50 133
+Unsatisfiable/COL062-2.ma ... FAIL Rating : 0.00 134
+Unsatisfiable/COL062-3.ma ... FAIL Rating : 0.00 135
+Unsatisfiable/COL063-1.ma ... FAIL Rating : 0.50 136
+Unsatisfiable/COL063-2.ma ... FAIL Rating : 0.00 137
+Unsatisfiable/COL063-3.ma ... FAIL Rating : 0.00 138
+Unsatisfiable/COL063-4.ma ... FAIL Rating : 0.00 139
+Unsatisfiable/COL063-5.ma ... FAIL Rating : 0.00 140
+Unsatisfiable/COL063-6.ma ... FAIL Rating : 0.00 141
+Unsatisfiable/COL064-1.ma ... FAIL Rating : 0.64 142
+Unsatisfiable/COL064-2.ma ... FAIL Rating : 0.07 143
+Unsatisfiable/COL064-3.ma ... FAIL Rating : 0.00 144
+Unsatisfiable/COL064-4.ma ... FAIL Rating : 0.07 145
+Unsatisfiable/COL064-5.ma ... FAIL Rating : 0.07 146
+Unsatisfiable/COL064-6.ma ... FAIL Rating : 0.00 147
+Unsatisfiable/COL064-7.ma ... FAIL Rating : 0.07 148
+Unsatisfiable/COL064-8.ma ... FAIL Rating : 0.00 149
+Unsatisfiable/COL064-9.ma ... FAIL Rating : 0.07 150
+Unsatisfiable/COL065-1.ma ... FAIL Rating : 0.71 151
+Unsatisfiable/COL066-1.ma ... FAIL Rating : 0.93 152
+Unsatisfiable/COL066-2.ma ... FAIL Rating : 0.00 153
+Unsatisfiable/COL066-3.ma ... FAIL Rating : 0.00 154
+Unsatisfiable/COL070-1.ma ... FAIL Rating : 0.07 155
+Unsatisfiable/COL075-2.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 156
+Unsatisfiable/COL083-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 157
+Unsatisfiable/COL084-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 158
+Unsatisfiable/COL085-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 159
+Unsatisfiable/COL086-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 160
+Unsatisfiable/GRP001-2.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 161
+Unsatisfiable/GRP001-4.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 162
+Unsatisfiable/GRP002-2.ma ... OK TIME NEEDED: 9.77 Rating : 0.00 163
+Unsatisfiable/GRP002-3.ma ... OK TIME NEEDED: 16.20 Rating : 0.00 164
+Unsatisfiable/GRP002-4.ma ... OK TIME NEEDED: 23.91 Rating : 0.00 165
+Unsatisfiable/GRP010-4.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 166
+Unsatisfiable/GRP011-4.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 167
+Unsatisfiable/GRP012-4.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 168
+Unsatisfiable/GRP014-1.ma ... FAIL Rating : 0.14 169
+Unsatisfiable/GRP022-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 170
+Unsatisfiable/GRP023-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 171
+Unsatisfiable/GRP024-5.ma ... FAIL Rating : 0.50 172
+Unsatisfiable/GRP114-1.ma ... OK TIME NEEDED: 34.06 Rating : 0.29 173
+Unsatisfiable/GRP115-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 174
+Unsatisfiable/GRP116-1.ma ... OK TIME NEEDED: 0.44 Rating : 0.00 175
+Unsatisfiable/GRP117-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 176
+Unsatisfiable/GRP118-1.ma ... OK TIME NEEDED: 0.44 Rating : 0.00 177
+Unsatisfiable/GRP119-1.ma ... OK TIME NEEDED: 81.78 Rating : 0.00 178
+Unsatisfiable/GRP120-1.ma ... OK TIME NEEDED: 89.12 Rating : 0.00 179
+Unsatisfiable/GRP121-1.ma ... OK TIME NEEDED: 84.94 Rating : 0.00 180
+Unsatisfiable/GRP122-1.ma ... OK TIME NEEDED: 93.77 Rating : 0.07 181
+Unsatisfiable/GRP136-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 182
+Unsatisfiable/GRP137-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 183
+Unsatisfiable/GRP138-1.ma ... OK TIME NEEDED: 3.37 Rating : 0.00 184
+Unsatisfiable/GRP139-1.ma ... FAIL Rating : 0.00 185
+Unsatisfiable/GRP140-1.ma ... OK TIME NEEDED: 3.41 Rating : 0.00 186
+Unsatisfiable/GRP141-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.00 187
+Unsatisfiable/GRP142-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 188
+Unsatisfiable/GRP143-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 189
+Unsatisfiable/GRP144-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 190
+Unsatisfiable/GRP145-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 191
+Unsatisfiable/GRP146-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 192
+Unsatisfiable/GRP147-1.ma ... OK TIME NEEDED: 3.10 Rating : 0.00 193
+Unsatisfiable/GRP148-1.ma ... OK TIME NEEDED: 1.83 Rating : 0.00 194
+Unsatisfiable/GRP149-1.ma ... FAIL Rating : 0.00 195
+Unsatisfiable/GRP150-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 196
+Unsatisfiable/GRP151-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 197
+Unsatisfiable/GRP152-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 198
+Unsatisfiable/GRP153-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 199
+Unsatisfiable/GRP154-1.ma ... FAIL Rating : 0.00 200
+Unsatisfiable/GRP155-1.ma ... FAIL Rating : 0.00 201
+Unsatisfiable/GRP156-1.ma ... FAIL Rating : 0.00 202
+Unsatisfiable/GRP157-1.ma ... FAIL Rating : 0.00 203
+Unsatisfiable/GRP158-1.ma ... FAIL Rating : 0.00 204
+Unsatisfiable/GRP159-1.ma ... FAIL Rating : 0.00 205
+Unsatisfiable/GRP160-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 206
+Unsatisfiable/GRP161-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 207
+Unsatisfiable/GRP162-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.00 208
+Unsatisfiable/GRP163-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.00 209
+Unsatisfiable/GRP164-1.ma ... FAIL Rating : 0.93 210
+Unsatisfiable/GRP164-2.ma ... FAIL Rating : 0.93 211
+Unsatisfiable/GRP165-1.ma ... OK TIME NEEDED: 212.88 Rating : 0.00 212
+Unsatisfiable/GRP165-2.ma ... OK TIME NEEDED: 229.27 Rating : 0.00 213
+Unsatisfiable/GRP166-1.ma ... OK TIME NEEDED: 16.85 Rating : 0.00 214
+Unsatisfiable/GRP166-2.ma ... OK TIME NEEDED: 20.80 Rating : 0.00 215
+Unsatisfiable/GRP166-3.ma ... OK TIME NEEDED: 288.77 Rating : 0.00 216
+Unsatisfiable/GRP166-4.ma ... FAIL Rating : 0.00 217
+Unsatisfiable/GRP167-1.ma ... OK TIME NEEDED: 44.41 Rating : 0.21 218
+Unsatisfiable/GRP167-2.ma ... OK TIME NEEDED: 67.72 Rating : 0.21 219
+Unsatisfiable/GRP167-3.ma ... FAIL Rating : 0.50 220
+Unsatisfiable/GRP167-4.ma ... FAIL Rating : 0.43 221
+Unsatisfiable/GRP167-5.ma ... OK TIME NEEDED: 7.91 Rating : 0.14 222
+Unsatisfiable/GRP168-1.ma ... FAIL Rating : 0.07 223
+Unsatisfiable/GRP168-2.ma ... FAIL Rating : 0.07 224
+Unsatisfiable/GRP169-1.ma ... OK TIME NEEDED: 24.53 Rating : 0.00 225
+Unsatisfiable/GRP169-2.ma ... OK TIME NEEDED: 16.64 Rating : 0.00 226
+Unsatisfiable/GRP170-1.ma ... FAIL Rating : 0.00 227
+Unsatisfiable/GRP170-2.ma ... FAIL Rating : 0.00 228
+Unsatisfiable/GRP170-3.ma ... FAIL Rating : 0.00 229
+Unsatisfiable/GRP170-4.ma ... FAIL Rating : 0.00 230
+Unsatisfiable/GRP171-1.ma ... OK TIME NEEDED: 0.44 Rating : 0.00 231
+Unsatisfiable/GRP171-2.ma ... OK TIME NEEDED: 0.48 Rating : 0.00 232
+Unsatisfiable/GRP172-1.ma ... OK TIME NEEDED: 0.56 Rating : 0.00 233
+Unsatisfiable/GRP172-2.ma ... OK TIME NEEDED: 0.54 Rating : 0.00 234
+Unsatisfiable/GRP173-1.ma ... OK TIME NEEDED: 1.01 Rating : 0.00 235
+Unsatisfiable/GRP174-1.ma ... OK TIME NEEDED: 1.11 Rating : 0.00 236
+Unsatisfiable/GRP175-1.ma ... OK TIME NEEDED: 223.60 Rating : 0.00 237
+Unsatisfiable/GRP175-2.ma ... OK TIME NEEDED: 230.87 Rating : 0.00 238
+Unsatisfiable/GRP175-3.ma ... OK TIME NEEDED: 223.38 Rating : 0.00 239
+Unsatisfiable/GRP175-4.ma ... OK TIME NEEDED: 232.01 Rating : 0.00 240
+Unsatisfiable/GRP176-1.ma ... OK TIME NEEDED: 0.32 Rating : 0.00 241
+Unsatisfiable/GRP176-2.ma ... OK TIME NEEDED: 0.38 Rating : 0.00 242
+Unsatisfiable/GRP177-2.ma ... FAIL Rating : 0.21 243
+Unsatisfiable/GRP178-1.ma ... FAIL Rating : 0.14 244
+Unsatisfiable/GRP178-2.ma ... FAIL Rating : 0.14 245
+Unsatisfiable/GRP179-1.ma ... FAIL Rating : 0.50 246
+Unsatisfiable/GRP179-2.ma ... FAIL Rating : 0.50 247
+Unsatisfiable/GRP179-3.ma ... FAIL Rating : 0.36 248
+Unsatisfiable/GRP180-1.ma ... FAIL Rating : 0.50 249
+Unsatisfiable/GRP180-2.ma ... FAIL Rating : 0.43 250
+Unsatisfiable/GRP181-1.ma ... FAIL Rating : 0.71 251
+Unsatisfiable/GRP181-2.ma ... FAIL Rating : 0.71 252
+Unsatisfiable/GRP181-3.ma ... OK TIME NEEDED: 4.31 Rating : 0.43 253
+Unsatisfiable/GRP181-4.ma ... OK TIME NEEDED: 5.39 Rating : 0.43 254
+Unsatisfiable/GRP182-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 255
+Unsatisfiable/GRP182-2.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 256
+Unsatisfiable/GRP182-3.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 257
+Unsatisfiable/GRP182-4.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 258
+Unsatisfiable/GRP183-1.ma ... FAIL Rating : 0.43 259
+Unsatisfiable/GRP183-2.ma ... FAIL Rating : 0.43 260
+Unsatisfiable/GRP183-3.ma ... FAIL Rating : 0.43 261
+Unsatisfiable/GRP183-4.ma ... FAIL Rating : 0.36 262
+Unsatisfiable/GRP184-1.ma ... FAIL Rating : 0.29 263
+Unsatisfiable/GRP184-2.ma ... FAIL Rating : 0.14 264
+Unsatisfiable/GRP184-3.ma ... FAIL Rating : 0.21 265
+Unsatisfiable/GRP184-4.ma ... OK TIME NEEDED: 84.98 Rating : 0.00 266
+Unsatisfiable/GRP185-1.ma ... FAIL Rating : 0.07 267
+Unsatisfiable/GRP185-2.ma ... FAIL Rating : 0.07 268
+Unsatisfiable/GRP185-3.ma ... FAIL Rating : 0.21 269
+Unsatisfiable/GRP185-4.ma ... FAIL Rating : 0.21 270
+Unsatisfiable/GRP186-1.ma ... FAIL Rating : 0.57 271
+Unsatisfiable/GRP186-2.ma ... FAIL Rating : 0.36 272
+Unsatisfiable/GRP186-3.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 273
+Unsatisfiable/GRP186-4.ma ... OK TIME NEEDED: 0.21 Rating : 0.00 274
+Unsatisfiable/GRP187-1.ma ... FAIL Rating : 0.64 275
+Unsatisfiable/GRP188-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 276
+Unsatisfiable/GRP188-2.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 277
+Unsatisfiable/GRP189-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 278
+Unsatisfiable/GRP189-2.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 279
+Unsatisfiable/GRP190-1.ma ... OK TIME NEEDED: 62.58 Rating : 0.00 280
+Unsatisfiable/GRP190-2.ma ... OK TIME NEEDED: 62.48 Rating : 0.00 281
+Unsatisfiable/GRP191-1.ma ... OK TIME NEEDED: 83.45 Rating : 0.00 282
+Unsatisfiable/GRP191-2.ma ... OK TIME NEEDED: 85.36 Rating : 0.00 283
+Unsatisfiable/GRP192-1.ma ... OK TIME NEEDED: 0.33 Rating : 0.07 284
+Unsatisfiable/GRP193-1.ma ... FAIL Rating : 0.00 285
+Unsatisfiable/GRP193-2.ma ... FAIL Rating : 0.00 286
+Unsatisfiable/GRP195-1.ma ... FAIL Rating : 0.00 287
+Unsatisfiable/GRP196-1.ma ... FAIL Rating : 0.93 288
+Unsatisfiable/GRP200-1.ma ... FAIL Rating : 0.29 289
+Unsatisfiable/GRP201-1.ma ... FAIL Rating : 0.36 290
+Unsatisfiable/GRP202-1.ma ... FAIL Rating : 0.43 291
+Unsatisfiable/GRP203-1.ma ... FAIL Rating : 0.21 292
+Unsatisfiable/GRP205-1.ma ... FAIL Rating : 0.43 293
+Unsatisfiable/GRP206-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 294
+Unsatisfiable/GRP403-1.ma ... OK TIME NEEDED: 74.60 Rating : 0.07 295
+Unsatisfiable/GRP404-1.ma ... OK TIME NEEDED: 176.10 Rating : 0.21 296
+Unsatisfiable/GRP405-1.ma ... OK TIME NEEDED: 167.86 Rating : 0.21 297
+Unsatisfiable/GRP406-1.ma ... FAIL Rating : 0.00 298
+Unsatisfiable/GRP407-1.ma ... FAIL Rating : 0.00 299
+Unsatisfiable/GRP408-1.ma ... FAIL Rating : 0.00 300
+Unsatisfiable/GRP409-1.ma ... OK TIME NEEDED: 8.40 Rating : 0.00 301
+Unsatisfiable/GRP410-1.ma ... OK TIME NEEDED: 13.84 Rating : 0.21 302
+Unsatisfiable/GRP411-1.ma ... OK TIME NEEDED: 14.68 Rating : 0.21 303
+Unsatisfiable/GRP412-1.ma ... OK TIME NEEDED: 101.23 Rating : 0.00 304
+Unsatisfiable/GRP413-1.ma ... FAIL Rating : 0.07 305
+Unsatisfiable/GRP414-1.ma ... FAIL Rating : 0.07 306
+Unsatisfiable/GRP415-1.ma ... FAIL Rating : 0.00 307
+Unsatisfiable/GRP416-1.ma ... FAIL Rating : 0.07 308
+Unsatisfiable/GRP417-1.ma ... FAIL Rating : 0.14 309
+Unsatisfiable/GRP418-1.ma ... FAIL Rating : 0.07 310
+Unsatisfiable/GRP419-1.ma ... FAIL Rating : 0.29 311
+Unsatisfiable/GRP420-1.ma ... FAIL Rating : 0.36 312
+Unsatisfiable/GRP421-1.ma ... FAIL Rating : 0.14 313
+Unsatisfiable/GRP422-1.ma ... FAIL Rating : 0.29 314
+Unsatisfiable/GRP423-1.ma ... FAIL Rating : 0.36 315
+Unsatisfiable/GRP424-1.ma ... OK TIME NEEDED: 21.31 Rating : 0.00 316
+Unsatisfiable/GRP425-1.ma ... OK TIME NEEDED: 21.31 Rating : 0.07 317
+Unsatisfiable/GRP426-1.ma ... FAIL Rating : 0.14 318
+Unsatisfiable/GRP427-1.ma ... FAIL Rating : 0.00 319
+Unsatisfiable/GRP428-1.ma ... OK TIME NEEDED: 296.55 Rating : 0.00 320
+Unsatisfiable/GRP429-1.ma ... FAIL Rating : 0.14 321
+Unsatisfiable/GRP430-1.ma ... OK TIME NEEDED: 34.68 Rating : 0.00 322
+Unsatisfiable/GRP431-1.ma ... OK TIME NEEDED: 31.86 Rating : 0.00 323
+Unsatisfiable/GRP432-1.ma ... OK TIME NEEDED: 37.85 Rating : 0.00 324
+Unsatisfiable/GRP433-1.ma ... OK TIME NEEDED: 145.99 Rating : 0.00 325
+Unsatisfiable/GRP434-1.ma ... OK TIME NEEDED: 139.16 Rating : 0.00 326
+Unsatisfiable/GRP435-1.ma ... OK TIME NEEDED: 138.46 Rating : 0.00 327
+Unsatisfiable/GRP436-1.ma ... FAIL Rating : 0.07 328
+Unsatisfiable/GRP437-1.ma ... FAIL Rating : 0.07 329
+Unsatisfiable/GRP438-1.ma ... FAIL Rating : 0.07 330
+Unsatisfiable/GRP439-1.ma ... OK TIME NEEDED: 35.25 Rating : 0.07 331
+Unsatisfiable/GRP440-1.ma ... OK TIME NEEDED: 115.55 Rating : 0.14 332
+Unsatisfiable/GRP441-1.ma ... OK TIME NEEDED: 144.50 Rating : 0.21 333
+Unsatisfiable/GRP442-1.ma ... FAIL Rating : 0.14 334
+Unsatisfiable/GRP443-1.ma ... FAIL Rating : 0.07 335
+Unsatisfiable/GRP444-1.ma ... FAIL Rating : 0.21 336
+Unsatisfiable/GRP445-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 337
+Unsatisfiable/GRP446-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 338
+Unsatisfiable/GRP447-1.ma ... OK TIME NEEDED: 0.95 Rating : 0.14 339
+Unsatisfiable/GRP448-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 340
+Unsatisfiable/GRP449-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 341
+Unsatisfiable/GRP450-1.ma ... OK TIME NEEDED: 0.97 Rating : 0.07 342
+Unsatisfiable/GRP451-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 343
+Unsatisfiable/GRP452-1.ma ... OK TIME NEEDED: 3.42 Rating : 0.14 344
+Unsatisfiable/GRP453-1.ma ... OK TIME NEEDED: 6.70 Rating : 0.21 345
+Unsatisfiable/GRP454-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 346
+Unsatisfiable/GRP455-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 347
+Unsatisfiable/GRP456-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.07 348
+Unsatisfiable/GRP457-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 349
+Unsatisfiable/GRP458-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 350
+Unsatisfiable/GRP459-1.ma ... OK TIME NEEDED: 0.29 Rating : 0.00 351
+Unsatisfiable/GRP460-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 352
+Unsatisfiable/GRP461-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 353
+Unsatisfiable/GRP462-1.ma ... OK TIME NEEDED: 0.84 Rating : 0.00 354
+Unsatisfiable/GRP463-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 355
+Unsatisfiable/GRP464-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 356
+Unsatisfiable/GRP465-1.ma ... OK TIME NEEDED: 0.43 Rating : 0.00 357
+Unsatisfiable/GRP466-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 358
+Unsatisfiable/GRP467-1.ma ... OK TIME NEEDED: 0.49 Rating : 0.00 359
+Unsatisfiable/GRP468-1.ma ... OK TIME NEEDED: 2.31 Rating : 0.00 360
+Unsatisfiable/GRP469-1.ma ... FAIL Rating : 0.21 361
+Unsatisfiable/GRP470-1.ma ... FAIL Rating : 0.21 362
+Unsatisfiable/GRP471-1.ma ... FAIL Rating : 0.21 363
+Unsatisfiable/GRP472-1.ma ... OK TIME NEEDED: 46.35 Rating : 0.07 364
+Unsatisfiable/GRP473-1.ma ... OK TIME NEEDED: 40.19 Rating : 0.07 365
+Unsatisfiable/GRP474-1.ma ... OK TIME NEEDED: 66.51 Rating : 0.07 366
+Unsatisfiable/GRP475-1.ma ... OK TIME NEEDED: 46.13 Rating : 0.21 367
+Unsatisfiable/GRP476-1.ma ... OK TIME NEEDED: 42.87 Rating : 0.21 368
+Unsatisfiable/GRP477-1.ma ... OK TIME NEEDED: 47.76 Rating : 0.21 369
+Unsatisfiable/GRP478-1.ma ... OK TIME NEEDED: 36.10 Rating : 0.14 370
+Unsatisfiable/GRP479-1.ma ... OK TIME NEEDED: 34.25 Rating : 0.14 371
+Unsatisfiable/GRP480-1.ma ... OK TIME NEEDED: 49.51 Rating : 0.21 372
+Unsatisfiable/GRP481-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 373
+Unsatisfiable/GRP482-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 374
+Unsatisfiable/GRP483-1.ma ... OK TIME NEEDED: 0.87 Rating : 0.00 375
+Unsatisfiable/GRP484-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 376
+Unsatisfiable/GRP485-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.00 377
+Unsatisfiable/GRP486-1.ma ... OK TIME NEEDED: 0.97 Rating : 0.00 378
+Unsatisfiable/GRP487-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 379
+Unsatisfiable/GRP488-1.ma ... OK TIME NEEDED: 1.09 Rating : 0.00 380
+Unsatisfiable/GRP489-1.ma ... OK TIME NEEDED: 1.36 Rating : 0.00 381
+Unsatisfiable/GRP490-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 382
+Unsatisfiable/GRP491-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 383
+Unsatisfiable/GRP492-1.ma ... OK TIME NEEDED: 0.50 Rating : 0.00 384
+Unsatisfiable/GRP493-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 385
+Unsatisfiable/GRP494-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 386
+Unsatisfiable/GRP495-1.ma ... OK TIME NEEDED: 0.44 Rating : 0.00 387
+Unsatisfiable/GRP496-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 388
+Unsatisfiable/GRP497-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 389
+Unsatisfiable/GRP498-1.ma ... OK TIME NEEDED: 0.49 Rating : 0.00 390
+Unsatisfiable/GRP499-1.ma ... OK TIME NEEDED: 55.48 Rating : 0.00 391
+Unsatisfiable/GRP500-1.ma ... OK TIME NEEDED: 19.82 Rating : 0.07 392
+Unsatisfiable/GRP501-1.ma ... OK TIME NEEDED: 63.77 Rating : 0.14 393
+Unsatisfiable/GRP502-1.ma ... FAIL Rating : 0.14 394
+Unsatisfiable/GRP503-1.ma ... FAIL Rating : 0.14 395
+Unsatisfiable/GRP504-1.ma ... FAIL Rating : 0.14 396
+Unsatisfiable/GRP505-1.ma ... FAIL Rating : 0.50 397
+Unsatisfiable/GRP506-1.ma ... FAIL Rating : 0.64 398
+Unsatisfiable/GRP507-1.ma ... FAIL Rating : 0.57 399
+Unsatisfiable/GRP508-1.ma ... FAIL Rating : 0.57 400
+Unsatisfiable/GRP509-1.ma ... OK TIME NEEDED: 2.24 Rating : 0.00 401
+Unsatisfiable/GRP510-1.ma ... OK TIME NEEDED: 0.46 Rating : 0.00 402
+Unsatisfiable/GRP511-1.ma ... OK TIME NEEDED: 9.92 Rating : 0.00 403
+Unsatisfiable/GRP512-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 404
+Unsatisfiable/GRP513-1.ma ... OK TIME NEEDED: 1.61 Rating : 0.00 405
+Unsatisfiable/GRP514-1.ma ... OK TIME NEEDED: 0.20 Rating : 0.00 406
+Unsatisfiable/GRP515-1.ma ... OK TIME NEEDED: 2.35 Rating : 0.00 407
+Unsatisfiable/GRP516-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 408
+Unsatisfiable/GRP517-1.ma ... OK TIME NEEDED: 1.93 Rating : 0.00 409
+Unsatisfiable/GRP518-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 410
+Unsatisfiable/GRP519-1.ma ... OK TIME NEEDED: 4.00 Rating : 0.00 411
+Unsatisfiable/GRP520-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 412
+Unsatisfiable/GRP521-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 413
+Unsatisfiable/GRP522-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 414
+Unsatisfiable/GRP523-1.ma ... OK TIME NEEDED: 1.66 Rating : 0.00 415
+Unsatisfiable/GRP524-1.ma ... OK TIME NEEDED: 0.37 Rating : 0.00 416
+Unsatisfiable/GRP525-1.ma ... FAIL Rating : 0.00 417
+Unsatisfiable/GRP526-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 418
+Unsatisfiable/GRP527-1.ma ... OK TIME NEEDED: 1.96 Rating : 0.00 419
+Unsatisfiable/GRP528-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 420
+Unsatisfiable/GRP529-1.ma ... FAIL Rating : 0.00 421
+Unsatisfiable/GRP530-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 422
+Unsatisfiable/GRP531-1.ma ... OK TIME NEEDED: 0.97 Rating : 0.00 423
+Unsatisfiable/GRP532-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 424
+Unsatisfiable/GRP533-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 425
+Unsatisfiable/GRP534-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 426
+Unsatisfiable/GRP535-1.ma ... OK TIME NEEDED: 1.11 Rating : 0.00 427
+Unsatisfiable/GRP536-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 428
+Unsatisfiable/GRP537-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 429
+Unsatisfiable/GRP538-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 430
+Unsatisfiable/GRP539-1.ma ... OK TIME NEEDED: 2.41 Rating : 0.00 431
+Unsatisfiable/GRP540-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 432
+Unsatisfiable/GRP541-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 433
+Unsatisfiable/GRP542-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 434
+Unsatisfiable/GRP543-1.ma ... OK TIME NEEDED: 0.98 Rating : 0.00 435
+Unsatisfiable/GRP544-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 436
+Unsatisfiable/GRP545-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 437
+Unsatisfiable/GRP546-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 438
+Unsatisfiable/GRP547-1.ma ... OK TIME NEEDED: 0.71 Rating : 0.00 439
+Unsatisfiable/GRP548-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 440
+Unsatisfiable/GRP549-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 441
+Unsatisfiable/GRP550-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.07 442
+Unsatisfiable/GRP551-1.ma ... OK TIME NEEDED: 0.99 Rating : 0.00 443
+Unsatisfiable/GRP552-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 444
+Unsatisfiable/GRP553-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 445
+Unsatisfiable/GRP554-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 446
+Unsatisfiable/GRP555-1.ma ... OK TIME NEEDED: 1.62 Rating : 0.00 447
+Unsatisfiable/GRP556-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 448
+Unsatisfiable/GRP557-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 449
+Unsatisfiable/GRP558-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 450
+Unsatisfiable/GRP559-1.ma ... OK TIME NEEDED: 6.45 Rating : 0.00 451
+Unsatisfiable/GRP560-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 452
+Unsatisfiable/GRP561-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 453
+Unsatisfiable/GRP562-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 454
+Unsatisfiable/GRP563-1.ma ... OK TIME NEEDED: 2.90 Rating : 0.00 455
+Unsatisfiable/GRP564-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 456
+Unsatisfiable/GRP565-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 457
+Unsatisfiable/GRP566-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 458
+Unsatisfiable/GRP567-1.ma ... OK TIME NEEDED: 244.72 Rating : 0.14 459
+Unsatisfiable/GRP568-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.14 460
+Unsatisfiable/GRP569-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 461
+Unsatisfiable/GRP570-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 462
+Unsatisfiable/GRP571-1.ma ... OK TIME NEEDED: 1.22 Rating : 0.14 463
+Unsatisfiable/GRP572-1.ma ... OK TIME NEEDED: 0.33 Rating : 0.07 464
+Unsatisfiable/GRP573-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 465
+Unsatisfiable/GRP574-1.ma ... OK TIME NEEDED: 0.20 Rating : 0.00 466
+Unsatisfiable/GRP575-1.ma ... OK TIME NEEDED: 8.57 Rating : 0.14 467
+Unsatisfiable/GRP576-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.00 468
+Unsatisfiable/GRP577-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 469
+Unsatisfiable/GRP578-1.ma ... OK TIME NEEDED: 0.28 Rating : 0.00 470
+Unsatisfiable/GRP579-1.ma ... FAIL Rating : 0.07 471
+Unsatisfiable/GRP580-1.ma ... OK TIME NEEDED: 0.51 Rating : 0.00 472
+Unsatisfiable/GRP581-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 473
+Unsatisfiable/GRP582-1.ma ... OK TIME NEEDED: 0.21 Rating : 0.00 474
+Unsatisfiable/GRP583-1.ma ... FAIL Rating : 0.07 475
+Unsatisfiable/GRP584-1.ma ... FAIL Rating : 0.00 476
+Unsatisfiable/GRP585-1.ma ... OK TIME NEEDED: 0.54 Rating : 0.00 477
+Unsatisfiable/GRP586-1.ma ... OK TIME NEEDED: 0.37 Rating : 0.00 478
+Unsatisfiable/GRP587-1.ma ... OK TIME NEEDED: 5.08 Rating : 0.00 479
+Unsatisfiable/GRP588-1.ma ... OK TIME NEEDED: 1.14 Rating : 0.00 480
+Unsatisfiable/GRP589-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 481
+Unsatisfiable/GRP590-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 482
+Unsatisfiable/GRP591-1.ma ... OK TIME NEEDED: 4.65 Rating : 0.07 483
+Unsatisfiable/GRP592-1.ma ... OK TIME NEEDED: 0.28 Rating : 0.07 484
+Unsatisfiable/GRP593-1.ma ... OK TIME NEEDED: 2.08 Rating : 0.00 485
+Unsatisfiable/GRP594-1.ma ... OK TIME NEEDED: 0.71 Rating : 0.00 486
+Unsatisfiable/GRP595-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.07 487
+Unsatisfiable/GRP596-1.ma ... OK TIME NEEDED: 0.34 Rating : 0.07 488
+Unsatisfiable/GRP597-1.ma ... OK TIME NEEDED: 0.75 Rating : 0.00 489
+Unsatisfiable/GRP598-1.ma ... OK TIME NEEDED: 0.33 Rating : 0.07 490
+Unsatisfiable/GRP599-1.ma ... OK TIME NEEDED: 69.24 Rating : 0.07 491
+Unsatisfiable/GRP600-1.ma ... OK TIME NEEDED: 0.35 Rating : 0.07 492
+Unsatisfiable/GRP601-1.ma ... OK TIME NEEDED: 5.17 Rating : 0.07 493
+Unsatisfiable/GRP602-1.ma ... FAIL Rating : 0.07 494
+Unsatisfiable/GRP603-1.ma ... OK TIME NEEDED: 0.80 Rating : 0.07 495
+Unsatisfiable/GRP604-1.ma ... OK TIME NEEDED: 0.79 Rating : 0.07 496
+Unsatisfiable/GRP605-1.ma ... OK TIME NEEDED: 1.28 Rating : 0.00 497
+Unsatisfiable/GRP606-1.ma ... OK TIME NEEDED: 1.14 Rating : 0.00 498
+Unsatisfiable/GRP607-1.ma ... OK TIME NEEDED: 5.82 Rating : 0.00 499
+Unsatisfiable/GRP608-1.ma ... OK TIME NEEDED: 1.25 Rating : 0.00 500
+Unsatisfiable/GRP609-1.ma ... OK TIME NEEDED: 2.47 Rating : 0.07 501
+Unsatisfiable/GRP610-1.ma ... OK TIME NEEDED: 0.52 Rating : 0.07 502
+Unsatisfiable/GRP611-1.ma ... OK TIME NEEDED: 3.28 Rating : 0.00 503
+Unsatisfiable/GRP612-1.ma ... OK TIME NEEDED: 0.46 Rating : 0.07 504
+Unsatisfiable/GRP613-1.ma ... OK TIME NEEDED: 0.69 Rating : 0.00 505
+Unsatisfiable/GRP614-1.ma ... OK TIME NEEDED: 0.35 Rating : 0.00 506
+Unsatisfiable/GRP615-1.ma ... OK TIME NEEDED: 2.52 Rating : 0.07 507
+Unsatisfiable/GRP616-1.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 508
+Unsatisfiable/LAT006-1.ma ... OK TIME NEEDED: 136.13 Rating : 0.14 509
+Unsatisfiable/LAT007-1.ma ... OK TIME NEEDED: 86.86 Rating : 0.36 510
+Unsatisfiable/LAT008-1.ma ... OK TIME NEEDED: 0.64 Rating : 0.07 511
+Unsatisfiable/LAT009-1.ma ... FAIL Rating : 0.00 512
+Unsatisfiable/LAT010-1.ma ... FAIL Rating : 0.00 513
+Unsatisfiable/LAT011-1.ma ... FAIL Rating : 0.07 514
+Unsatisfiable/LAT012-1.ma ... OK TIME NEEDED: 6.67 Rating : 0.00 515
+Unsatisfiable/LAT013-1.ma ... FAIL Rating : 0.14 516
+Unsatisfiable/LAT014-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 517
+Unsatisfiable/LAT017-1.ma ... FAIL Rating : 0.71 518
+Unsatisfiable/LAT018-1.ma ... FAIL Rating : 0.93 519
+Unsatisfiable/LAT019-1.ma ... FAIL Rating : 0.00 520
+Unsatisfiable/LAT020-1.ma ... FAIL Rating : 0.50 521
+Unsatisfiable/LAT021-1.ma ... FAIL Rating : 0.00 522
+Unsatisfiable/LAT022-1.ma ... FAIL Rating : 0.21 523
+Unsatisfiable/LAT023-1.ma ... FAIL Rating : 0.21 524
+Unsatisfiable/LAT026-1.ma ... FAIL Rating : 0.14 525
+Unsatisfiable/LAT027-1.ma ... FAIL Rating : 0.07 526
+Unsatisfiable/LAT028-1.ma ... OK TIME NEEDED: 16.59 Rating : 0.00 527
+Unsatisfiable/LAT031-1.ma ... OK TIME NEEDED: 15.67 Rating : 0.00 528
+Unsatisfiable/LAT032-1.ma ... OK TIME NEEDED: 30.73 Rating : 0.00 529
+Unsatisfiable/LAT033-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 530
+Unsatisfiable/LAT034-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 531
+Unsatisfiable/LAT038-1.ma ... FAIL Rating : 0.43 532
+Unsatisfiable/LAT039-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 533
+Unsatisfiable/LAT039-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 534
+Unsatisfiable/LAT040-1.ma ... OK TIME NEEDED: 8.16 Rating : 0.00 535
+Unsatisfiable/LAT042-1.ma ... OK TIME NEEDED: 225.34 Rating : 0.00 536
+Unsatisfiable/LAT043-1.ma ... FAIL Rating : 0.00 537
+Unsatisfiable/LAT044-1.ma ... FAIL Rating : 0.14 538
+Unsatisfiable/LAT045-1.ma ... FAIL Rating : 0.07 539
+Unsatisfiable/LAT070-1.ma ... FAIL Rating : 0.93 540
+Unsatisfiable/LAT072-1.ma ... FAIL Rating : 1.00 541
+Unsatisfiable/LAT074-1.ma ... FAIL Rating : 1.00 542
+Unsatisfiable/LAT075-1.ma ... FAIL Rating : 1.00 543
+Unsatisfiable/LAT076-1.ma ... FAIL Rating : 1.00 544
+Unsatisfiable/LAT077-1.ma ... FAIL Rating : 1.00 545
+Unsatisfiable/LAT078-1.ma ... FAIL Rating : 1.00 546
+Unsatisfiable/LAT079-1.ma ... FAIL Rating : 1.00 547
+Unsatisfiable/LAT080-1.ma ... FAIL Rating : 0.36 548
+Unsatisfiable/LAT081-1.ma ... FAIL Rating : 0.57 549
+Unsatisfiable/LAT082-1.ma ... FAIL Rating : 0.64 550
+Unsatisfiable/LAT083-1.ma ... FAIL Rating : 0.36 551
+Unsatisfiable/LAT084-1.ma ... FAIL Rating : 0.50 552
+Unsatisfiable/LAT085-1.ma ... FAIL Rating : 0.57 553
+Unsatisfiable/LAT086-1.ma ... FAIL Rating : 0.50 554
+Unsatisfiable/LAT087-1.ma ... FAIL Rating : 0.43 555
+Unsatisfiable/LAT088-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 556
+Unsatisfiable/LAT089-1.ma ... OK TIME NEEDED: 1.49 Rating : 0.00 557
+Unsatisfiable/LAT090-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 558
+Unsatisfiable/LAT091-1.ma ... OK TIME NEEDED: 15.12 Rating : 0.07 559
+Unsatisfiable/LAT092-1.ma ... FAIL Rating : 0.36 560
+Unsatisfiable/LAT093-1.ma ... FAIL Rating : 0.43 561
+Unsatisfiable/LAT094-1.ma ... FAIL Rating : 0.36 562
+Unsatisfiable/LAT095-1.ma ... FAIL Rating : 0.43 563
+Unsatisfiable/LAT096-1.ma ... FAIL Rating : 0.36 564
+Unsatisfiable/LAT097-1.ma ... FAIL Rating : 0.36 565
+Unsatisfiable/LAT138-1.ma ... FAIL Rating : 1.00 566
+Unsatisfiable/LAT139-1.ma ... FAIL Rating : 1.00 567
+Unsatisfiable/LAT140-1.ma ... FAIL Rating : 1.00 568
+Unsatisfiable/LAT141-1.ma ... FAIL Rating : 1.00 569
+Unsatisfiable/LAT142-1.ma ... FAIL Rating : 0.64 570
+Unsatisfiable/LAT143-1.ma ... FAIL Rating : 0.14 571
+Unsatisfiable/LAT144-1.ma ... FAIL Rating : 0.86 572
+Unsatisfiable/LAT145-1.ma ... FAIL Rating : 0.93 573
+Unsatisfiable/LAT146-1.ma ... FAIL Rating : 0.79 574
+Unsatisfiable/LAT147-1.ma ... FAIL Rating : 0.79 575
+Unsatisfiable/LAT148-1.ma ... FAIL Rating : 0.71 576
+Unsatisfiable/LAT149-1.ma ... FAIL Rating : 0.93 577
+Unsatisfiable/LAT150-1.ma ... FAIL Rating : 0.86 578
+Unsatisfiable/LAT151-1.ma ... FAIL Rating : 0.86 579
+Unsatisfiable/LAT152-1.ma ... FAIL Rating : 0.79 580
+Unsatisfiable/LAT153-1.ma ... FAIL Rating : 0.93 581
+Unsatisfiable/LAT154-1.ma ... FAIL Rating : 0.79 582
+Unsatisfiable/LAT155-1.ma ... FAIL Rating : 0.86 583
+Unsatisfiable/LAT156-1.ma ... FAIL Rating : 0.64 584
+Unsatisfiable/LAT157-1.ma ... FAIL Rating : 0.86 585
+Unsatisfiable/LAT158-1.ma ... FAIL Rating : 0.93 586
+Unsatisfiable/LAT159-1.ma ... FAIL Rating : 0.86 587
+Unsatisfiable/LAT160-1.ma ... FAIL Rating : 0.64 588
+Unsatisfiable/LAT161-1.ma ... FAIL Rating : 1.00 589
+Unsatisfiable/LAT162-1.ma ... FAIL Rating : 0.86 590
+Unsatisfiable/LAT163-1.ma ... FAIL Rating : 0.93 591
+Unsatisfiable/LAT164-1.ma ... FAIL Rating : 0.93 592
+Unsatisfiable/LAT165-1.ma ... FAIL Rating : 0.93 593
+Unsatisfiable/LAT166-1.ma ... FAIL Rating : 0.93 594
+Unsatisfiable/LAT167-1.ma ... FAIL Rating : 0.93 595
+Unsatisfiable/LAT168-1.ma ... FAIL Rating : 0.14 596
+Unsatisfiable/LAT169-1.ma ... FAIL Rating : 0.86 597
+Unsatisfiable/LAT170-1.ma ... FAIL Rating : 0.79 598
+Unsatisfiable/LAT171-1.ma ... FAIL Rating : 0.50 599
+Unsatisfiable/LAT172-1.ma ... FAIL Rating : 0.93 600
+Unsatisfiable/LAT173-1.ma ... FAIL Rating : 0.93 601
+Unsatisfiable/LAT174-1.ma ... FAIL Rating : 0.79 602
+Unsatisfiable/LAT175-1.ma ... FAIL Rating : 0.93 603
+Unsatisfiable/LAT176-1.ma ... FAIL Rating : 0.93 604
+Unsatisfiable/LAT177-1.ma ... FAIL Rating : 1.00 605
+Unsatisfiable/LCL109-2.ma ... OK TIME NEEDED: 203.55 Rating : 0.29 606
+Unsatisfiable/LCL109-6.ma ... OK TIME NEEDED: 99.14 Rating : 0.14 607
+Unsatisfiable/LCL110-2.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 608
+Unsatisfiable/LCL111-2.ma ... OK TIME NEEDED: 6.27 Rating : 0.07 609
+Unsatisfiable/LCL112-2.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 610
+Unsatisfiable/LCL113-2.ma ... OK TIME NEEDED: 0.32 Rating : 0.00 611
+Unsatisfiable/LCL114-2.ma ... OK TIME NEEDED: 0.52 Rating : 0.00 612
+Unsatisfiable/LCL115-2.ma ... OK TIME NEEDED: 0.51 Rating : 0.00 613
+Unsatisfiable/LCL116-2.ma ... OK TIME NEEDED: 5.19 Rating : 0.00 614
+Unsatisfiable/LCL132-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 615
+Unsatisfiable/LCL133-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 616
+Unsatisfiable/LCL134-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 617
+Unsatisfiable/LCL135-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 618
+Unsatisfiable/LCL138-1.ma ... OK TIME NEEDED: 59.77 Rating : 0.21 619
+Unsatisfiable/LCL139-1.ma ... OK TIME NEEDED: 0.49 Rating : 0.00 620
+Unsatisfiable/LCL140-1.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 621
+Unsatisfiable/LCL141-1.ma ... FAIL Rating : 0.00 622
+Unsatisfiable/LCL153-1.ma ... OK TIME NEEDED: 0.43 Rating : 0.00 623
+Unsatisfiable/LCL154-1.ma ... OK TIME NEEDED: 0.34 Rating : 0.00 624
+Unsatisfiable/LCL155-1.ma ... OK TIME NEEDED: 0.34 Rating : 0.00 625
+Unsatisfiable/LCL156-1.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 626
+Unsatisfiable/LCL157-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.00 627
+Unsatisfiable/LCL158-1.ma ... OK TIME NEEDED: 0.37 Rating : 0.00 628
+Unsatisfiable/LCL159-1.ma ... OK TIME NEEDED: 65.58 Rating : 0.00 629
+Unsatisfiable/LCL160-1.ma ... OK TIME NEEDED: 205.23 Rating : 0.14 630
+Unsatisfiable/LCL161-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 631
+Unsatisfiable/LCL162-1.ma ... FAIL Rating : 0.00 632
+Unsatisfiable/LCL163-1.ma ... OK TIME NEEDED: 51.14 Rating : 0.14 633
+Unsatisfiable/LCL164-1.ma ... FAIL Rating : 0.00 634
+Unsatisfiable/LDA001-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 635
+Unsatisfiable/LDA002-1.ma ... OK TIME NEEDED: 17.23 Rating : 0.00 636
+Unsatisfiable/LDA007-3.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 637
+Unsatisfiable/RNG007-4.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 638
+Unsatisfiable/RNG008-3.ma ... OK TIME NEEDED: 1.20 Rating : 0.07 639
+Unsatisfiable/RNG008-4.ma ... OK TIME NEEDED: 1.25 Rating : 0.07 640
+Unsatisfiable/RNG008-7.ma ... OK TIME NEEDED: 7.91 Rating : 0.07 641
+Unsatisfiable/RNG009-5.ma ... FAIL Rating : 0.50 642
+Unsatisfiable/RNG009-7.ma ... FAIL Rating : 0.50 643
+Unsatisfiable/RNG011-5.ma ... OK TIME NEEDED: 0.32 Rating : 0.00 644
+Unsatisfiable/RNG012-6.ma ... OK TIME NEEDED: 85.58 Rating : 0.00 645
+Unsatisfiable/RNG013-6.ma ... OK TIME NEEDED: 82.51 Rating : 0.00 646
+Unsatisfiable/RNG014-6.ma ... OK TIME NEEDED: 80.66 Rating : 0.00 647
+Unsatisfiable/RNG015-6.ma ... OK TIME NEEDED: 79.43 Rating : 0.00 648
+Unsatisfiable/RNG016-6.ma ... OK TIME NEEDED: 82.45 Rating : 0.00 649
+Unsatisfiable/RNG017-6.ma ... FAIL Rating : 0.00 650
+Unsatisfiable/RNG018-6.ma ... FAIL Rating : 0.00 651
+Unsatisfiable/RNG019-6.ma ... FAIL Rating : 0.21 652
+Unsatisfiable/RNG019-7.ma ... FAIL Rating : 0.21 653
+Unsatisfiable/RNG020-6.ma ... FAIL Rating : 0.29 654
+Unsatisfiable/RNG020-7.ma ... FAIL Rating : 0.21 655
+Unsatisfiable/RNG021-6.ma ... FAIL Rating : 0.14 656
+Unsatisfiable/RNG021-7.ma ... FAIL Rating : 0.21 657
+Unsatisfiable/RNG023-6.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 658
+Unsatisfiable/RNG023-7.ma ... OK TIME NEEDED: 0.33 Rating : 0.00 659
+Unsatisfiable/RNG024-6.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 660
+Unsatisfiable/RNG024-7.ma ... OK TIME NEEDED: 0.33 Rating : 0.00 661
+Unsatisfiable/RNG025-4.ma ... FAIL Rating : 0.29 662
+Unsatisfiable/RNG025-5.ma ... FAIL Rating : 0.36 663
+Unsatisfiable/RNG025-6.ma ... FAIL Rating : 0.29 664
+Unsatisfiable/RNG025-7.ma ... FAIL Rating : 0.43 665
+Unsatisfiable/RNG026-6.ma ... FAIL Rating : 0.57 666
+Unsatisfiable/RNG026-7.ma ... FAIL Rating : 0.50 667
+Unsatisfiable/RNG027-5.ma ... FAIL Rating : 0.86 668
+Unsatisfiable/RNG027-7.ma ... FAIL Rating : 0.86 669
+Unsatisfiable/RNG027-8.ma ... FAIL Rating : 0.86 670
+Unsatisfiable/RNG027-9.ma ... FAIL Rating : 0.86 671
+Unsatisfiable/RNG028-5.ma ... FAIL Rating : 0.86 672
+Unsatisfiable/RNG028-7.ma ... FAIL Rating : 0.86 673
+Unsatisfiable/RNG028-8.ma ... FAIL Rating : 0.86 674
+Unsatisfiable/RNG028-9.ma ... FAIL Rating : 0.86 675
+Unsatisfiable/RNG029-5.ma ... FAIL Rating : 0.86 676
+Unsatisfiable/RNG029-6.ma ... FAIL Rating : 0.86 677
+Unsatisfiable/RNG029-7.ma ... FAIL Rating : 0.86 678
+Unsatisfiable/RNG035-7.ma ... FAIL Rating : 0.86 679
+Unsatisfiable/ROB001-1.ma ... FAIL Rating : 1.00 680
+Unsatisfiable/ROB002-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 681
+Unsatisfiable/ROB003-1.ma ... OK TIME NEEDED: 78.81 Rating : 0.00 682
+Unsatisfiable/ROB004-1.ma ... OK TIME NEEDED: 103.84 Rating : 0.00 683
+Unsatisfiable/ROB005-1.ma ... FAIL Rating : 0.07 684
+Unsatisfiable/ROB006-1.ma ... FAIL Rating : 0.86 685
+Unsatisfiable/ROB006-2.ma ... FAIL Rating : 0.86 686
+Unsatisfiable/ROB008-1.ma ... OK TIME NEEDED: 70.78 Rating : 0.00 687
+Unsatisfiable/ROB009-1.ma ... OK TIME NEEDED: 85.47 Rating : 0.00 688
+Unsatisfiable/ROB010-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 689
+Unsatisfiable/ROB013-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 690
+Unsatisfiable/ROB022-1.ma ... FAIL Rating : 0.00 691
+Unsatisfiable/ROB023-1.ma ... OK TIME NEEDED: 174.58 Rating : 0.00 692
+Unsatisfiable/ROB026-1.ma ... FAIL Rating : 0.86 693
+Unsatisfiable/ROB030-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 694
+Unsatisfiable/ROB031-1.ma ... FAIL Rating : 1.00 695
+Unsatisfiable/ROB032-1.ma ... FAIL Rating : 1.00 696
+Unsatisfiable/SYN080-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 697
+Unsatisfiable/SYN083-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 698
diff --git a/matita/tests/TPTP/log.300.29-5.CASC b/matita/tests/TPTP/log.300.29-5.CASC
new file mode 100644 (file)
index 0000000..df03210
--- /dev/null
@@ -0,0 +1,119 @@
+Unsatisfiable/BOO023-1.ma ... FAIL
+Unsatisfiable/BOO073-1.ma ... FAIL
+Unsatisfiable/COL002-5.ma ... FAIL
+Unsatisfiable/COL004-1.ma ... FAIL
+Unsatisfiable/COL006-1.ma ... FAIL
+Unsatisfiable/COL006-6.ma ... FAIL
+Unsatisfiable/COL006-7.ma ... FAIL
+Unsatisfiable/COL034-1.ma ... FAIL
+Unsatisfiable/COL036-1.ma ... FAIL
+Unsatisfiable/COL041-1.ma ... OK TIME NEEDED: 173.76 Rating : 0.36
+Unsatisfiable/COL042-1.ma ... FAIL
+Unsatisfiable/COL043-3.ma ... FAIL
+Unsatisfiable/COL044-1.ma ... FAIL
+Unsatisfiable/COL044-9.ma ... FAIL
+Unsatisfiable/COL046-1.ma ... FAIL
+Unsatisfiable/COL049-1.ma ... FAIL
+Unsatisfiable/COL060-1.ma ... FAIL
+Unsatisfiable/COL061-1.ma ... FAIL
+Unsatisfiable/COL064-1.ma ... FAIL
+Unsatisfiable/COL066-1.ma ... FAIL
+Unsatisfiable/GRP114-1.ma ... OK TIME NEEDED: 8.65 Rating : 0.29
+Unsatisfiable/GRP167-4.ma ... FAIL
+Unsatisfiable/GRP177-2.ma ... FAIL
+Unsatisfiable/GRP179-1.ma ... FAIL
+Unsatisfiable/GRP179-2.ma ... FAIL
+Unsatisfiable/GRP179-3.ma ... FAIL
+Unsatisfiable/GRP180-1.ma ... FAIL
+Unsatisfiable/GRP181-1.ma ... FAIL
+Unsatisfiable/GRP181-3.ma ... OK TIME NEEDED: 16.99 Rating : 0.43
+Unsatisfiable/GRP183-1.ma ... FAIL
+Unsatisfiable/GRP183-3.ma ... FAIL
+Unsatisfiable/GRP183-4.ma ... FAIL
+Unsatisfiable/GRP184-1.ma ... FAIL
+Unsatisfiable/GRP184-3.ma ... FAIL
+Unsatisfiable/GRP186-1.ma ... FAIL
+Unsatisfiable/GRP186-2.ma ... FAIL
+Unsatisfiable/GRP196-1.ma ... FAIL
+Unsatisfiable/GRP200-1.ma ... FAIL
+Unsatisfiable/GRP201-1.ma ... FAIL
+Unsatisfiable/GRP205-1.ma ... FAIL
+Unsatisfiable/GRP405-1.ma ... FAIL
+Unsatisfiable/GRP410-1.ma ... FAIL
+Unsatisfiable/GRP419-10.ma ... FAIL
+Unsatisfiable/GRP422-1.ma ... FAIL
+Unsatisfiable/GRP423-1.ma ... FAIL
+Unsatisfiable/GRP444-1.ma ... FAIL
+Unsatisfiable/GRP475-1.ma ... FAIL
+Unsatisfiable/GRP476-1.ma ... FAIL
+Unsatisfiable/GRP505-1.ma ... FAIL
+Unsatisfiable/GRP506-1.ma ... FAIL
+Unsatisfiable/GRP508-1.ma ... FAIL
+Unsatisfiable/LAT080-1.ma ... FAIL
+Unsatisfiable/LAT081-1.ma ... FAIL
+Unsatisfiable/LAT083-1.ma ... FAIL
+Unsatisfiable/LAT084-1.ma ... FAIL
+Unsatisfiable/LAT086-1.ma ... FAIL
+Unsatisfiable/LAT087-1.ma ... FAIL
+Unsatisfiable/LAT092-1.ma ... FAIL
+Unsatisfiable/LAT093-1.ma ... FAIL
+Unsatisfiable/LAT094-1.ma ... FAIL
+Unsatisfiable/LAT096-1.ma ... FAIL
+Unsatisfiable/LAT145-1.ma ... FAIL
+Unsatisfiable/LAT147-1.ma ... FAIL
+Unsatisfiable/LAT148-1.ma ... FAIL
+Unsatisfiable/LAT151-1.ma ... FAIL
+Unsatisfiable/LAT152-1.ma ... FAIL
+Unsatisfiable/LAT154-10.ma ... FAIL
+Unsatisfiable/LAT156-1.ma ... OK TIME NEEDED: 215.53 Rating : 0.64
+Unsatisfiable/LAT160-1.ma ... FAIL
+Unsatisfiable/LAT162-1.ma ... FAIL
+Unsatisfiable/LAT164-1.ma ... FAIL
+Unsatisfiable/LAT165-1.ma ... FAIL
+Unsatisfiable/LAT169-1.ma ... FAIL
+Unsatisfiable/LCL138-1.ma ... OK TIME NEEDED: 250.95 Rating : 0.21
+Unsatisfiable/RNG009-5.ma ... FAIL
+Unsatisfiable/RNG009-7.ma ... FAIL
+Unsatisfiable/RNG019-6.ma ... FAIL
+Unsatisfiable/RNG020-6.ma ... FAIL
+Unsatisfiable/RNG021-7.ma ... FAIL
+Unsatisfiable/RNG025-4.ma ... FAIL
+Unsatisfiable/RNG025-5.ma ... FAIL
+Unsatisfiable/RNG025-6.ma ... FAIL
+Unsatisfiable/RNG026-6.ma ... FAIL
+Unsatisfiable/RNG026-7.ma ... FAIL
+Unsatisfiable/RNG027-5.ma ... FAIL
+Unsatisfiable/RNG027-7.ma ... FAIL
+Unsatisfiable/RNG027-8.ma ... FAIL
+Unsatisfiable/RNG027-9.ma ... FAIL
+Unsatisfiable/RNG028-7.ma ... FAIL
+Unsatisfiable/RNG028-8.ma ... FAIL
+Unsatisfiable/RNG029-6.ma ... FAIL
+Unsatisfiable/RNG029-7.ma ... FAIL
+Unsatisfiable/RNG035-7.ma ... FAIL
+Unsatisfiable/ROB006-1.ma ... FAIL
+Unsatisfiable/GRP187-1.ma ... FAIL
+Unsatisfiable/LAT020-1.ma ... FAIL
+Unsatisfiable/GRP164-1.ma ... FAIL
+Unsatisfiable/BOO067-1.ma ... FAIL
+Unsatisfiable/LAT171-1.ma ... FAIL
+Unsatisfiable/LAT150-1.ma ... FAIL
+Unsatisfiable/BOO076-1.ma ... FAIL
+Unsatisfiable/LAT146-1.ma ... FAIL
+Unsatisfiable/LAT172-1.ma ... FAIL
+Unsatisfiable/LAT175-1.ma ... FAIL
+Unsatisfiable/LAT144-1.ma ... FAIL
+Unsatisfiable/LAT157-1.ma ... FAIL
+Unsatisfiable/LAT155-1.ma ... FAIL
+Unsatisfiable/LAT158-1.ma ... FAIL
+Unsatisfiable/LAT166-1.ma ... FAIL
+Unsatisfiable/LAT153-1.ma ... FAIL
+Unsatisfiable/LAT174-1.ma ... FAIL
+Unsatisfiable/LAT142-1.ma ... FAIL
+Unsatisfiable/LAT173-1.ma ... FAIL
+Unsatisfiable/LAT167-1.ma ... FAIL
+Unsatisfiable/LAT163-1.ma ... FAIL
+Unsatisfiable/LAT176-1.ma ... FAIL
+Unsatisfiable/LAT159-1.ma ... FAIL
+Unsatisfiable/LAT149-1.ma ... FAIL
+Unsatisfiable/LAT170-1.ma ... FAIL
diff --git a/matita/tests/TPTP/log.300.29-6.fix-demodulationgoalwithcurr b/matita/tests/TPTP/log.300.29-6.fix-demodulationgoalwithcurr
new file mode 100644 (file)
index 0000000..89db456
--- /dev/null
@@ -0,0 +1,286 @@
+Unsatisfiable/BOO015-4.ma ... OK TIME NEEDED: 49.52 Rating : 0.00 1
+Unsatisfiable/COL023-1.ma ... FAIL Rating : 0.00 2
+Unsatisfiable/COL027-1.ma ... FAIL Rating : 0.00 3
+Unsatisfiable/COL031-1.ma ... FAIL Rating : 0.00 4
+Unsatisfiable/COL052-1.ma ... FAIL Rating : 0.00 5
+Unsatisfiable/COL059-1.ma ... FAIL Rating : 0.00 6
+Unsatisfiable/COL060-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 7
+Unsatisfiable/COL060-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 8
+Unsatisfiable/COL061-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 9
+Unsatisfiable/COL061-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 10
+Unsatisfiable/COL062-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 11
+Unsatisfiable/COL062-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 12
+Unsatisfiable/COL063-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 13
+Unsatisfiable/COL063-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 14
+Unsatisfiable/COL063-4.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 15
+Unsatisfiable/COL063-5.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 16
+Unsatisfiable/COL063-6.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 17
+Unsatisfiable/COL064-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 18
+Unsatisfiable/COL064-6.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 19
+Unsatisfiable/COL064-8.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 20
+Unsatisfiable/COL066-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 21
+Unsatisfiable/COL066-3.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 22
+Unsatisfiable/GRP139-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 23
+Unsatisfiable/GRP149-1.ma ... OK TIME NEEDED: 0.20 Rating : 0.00 24
+Unsatisfiable/GRP154-1.ma ... OK TIME NEEDED: 0.39 Rating : 0.00 25
+Unsatisfiable/GRP155-1.ma ... OK TIME NEEDED: 0.48 Rating : 0.00 26
+Unsatisfiable/GRP156-1.ma ... OK TIME NEEDED: 0.39 Rating : 0.00 27
+Unsatisfiable/GRP157-1.ma ... OK TIME NEEDED: 0.22 Rating : 0.00 28
+Unsatisfiable/GRP158-1.ma ... OK TIME NEEDED: 0.28 Rating : 0.00 29
+Unsatisfiable/GRP159-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 30
+Unsatisfiable/GRP166-4.ma ... FAIL Rating : 0.00 31
+Unsatisfiable/GRP170-1.ma ... FAIL Rating : 0.00 32
+Unsatisfiable/GRP170-2.ma ... FAIL Rating : 0.00 33
+Unsatisfiable/GRP170-3.ma ... FAIL Rating : 0.00 34
+Unsatisfiable/GRP170-4.ma ... FAIL Rating : 0.00 35
+Unsatisfiable/GRP193-1.ma ... FAIL Rating : 0.00 36
+Unsatisfiable/GRP193-2.ma ... FAIL Rating : 0.00 37
+Unsatisfiable/GRP195-1.ma ... FAIL Rating : 0.00 38
+Unsatisfiable/GRP406-1.ma ... FAIL Rating : 0.00 39
+Unsatisfiable/GRP407-1.ma ... FAIL Rating : 0.00 40
+Unsatisfiable/GRP408-1.ma ... FAIL Rating : 0.00 41
+Unsatisfiable/GRP415-1.ma ... FAIL Rating : 0.00 42
+Unsatisfiable/GRP427-1.ma ... FAIL Rating : 0.00 43
+Unsatisfiable/GRP525-1.ma ... OK TIME NEEDED: 0.14 Rating : 0.00 44
+Unsatisfiable/GRP529-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 45
+Unsatisfiable/GRP584-1.ma ... FAIL Rating : 0.00 46
+Unsatisfiable/LAT009-1.ma ... FAIL Rating : 0.00 47
+Unsatisfiable/LAT010-1.ma ... FAIL Rating : 0.00 48
+Unsatisfiable/LAT019-1.ma ... FAIL Rating : 0.00 49
+Unsatisfiable/LAT021-1.ma ... FAIL Rating : 0.00 50
+Unsatisfiable/LAT043-1.ma ... OK TIME NEEDED: 74.81 Rating : 0.00 51
+Unsatisfiable/LCL141-1.ma ... OK TIME NEEDED: 0.59 Rating : 0.00 52
+Unsatisfiable/LCL162-1.ma ... FAIL Rating : 0.00 53
+Unsatisfiable/LCL164-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 54
+Unsatisfiable/RNG017-6.ma ... OK TIME NEEDED: 90.67 Rating : 0.00 55
+Unsatisfiable/RNG018-6.ma ... OK TIME NEEDED: 85.21 Rating : 0.00 56
+Unsatisfiable/ROB022-1.ma ... FAIL Rating : 0.00 57
+Unsatisfiable/BOO022-1.ma ... FAIL Rating : 0.07 58
+Unsatisfiable/BOO028-1.ma ... FAIL Rating : 0.07 59
+Unsatisfiable/BOO072-1.ma ... FAIL Rating : 0.07 60
+Unsatisfiable/BOO074-1.ma ... FAIL Rating : 0.07 61
+Unsatisfiable/COL002-4.ma ... FAIL Rating : 0.07 62
+Unsatisfiable/COL020-1.ma ... FAIL Rating : 0.07 63
+Unsatisfiable/COL026-1.ma ... FAIL Rating : 0.07 64
+Unsatisfiable/COL064-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 65
+Unsatisfiable/COL064-4.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 66
+Unsatisfiable/COL064-5.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 67
+Unsatisfiable/COL064-7.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 68
+Unsatisfiable/COL064-9.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 69
+Unsatisfiable/COL070-1.ma ... FAIL Rating : 0.07 70
+Unsatisfiable/GRP168-1.ma ... OK TIME NEEDED: 0.37 Rating : 0.07 71
+Unsatisfiable/GRP168-2.ma ... OK TIME NEEDED: 0.46 Rating : 0.07 72
+Unsatisfiable/GRP185-1.ma ... FAIL Rating : 0.07 73
+Unsatisfiable/GRP185-2.ma ... FAIL Rating : 0.07 74
+Unsatisfiable/GRP413-1.ma ... FAIL Rating : 0.07 75
+Unsatisfiable/GRP414-1.ma ... FAIL Rating : 0.07 76
+Unsatisfiable/GRP416-1.ma ... FAIL Rating : 0.07 77
+Unsatisfiable/GRP418-1.ma ... FAIL Rating : 0.07 78
+Unsatisfiable/GRP436-1.ma ... FAIL Rating : 0.07 79
+Unsatisfiable/GRP437-1.ma ... FAIL Rating : 0.07 80
+Unsatisfiable/GRP438-1.ma ... FAIL Rating : 0.07 81
+Unsatisfiable/GRP443-1.ma ... FAIL Rating : 0.07 82
+Unsatisfiable/GRP579-1.ma ... OK TIME NEEDED: 4.20 Rating : 0.07 83
+Unsatisfiable/GRP583-1.ma ... OK TIME NEEDED: 2.20 Rating : 0.07 84
+Unsatisfiable/GRP602-1.ma ... OK TIME NEEDED: 1.00 Rating : 0.07 85
+Unsatisfiable/LAT011-1.ma ... FAIL Rating : 0.07 86
+Unsatisfiable/LAT027-1.ma ... FAIL Rating : 0.07 87
+Unsatisfiable/LAT045-1.ma ... OK TIME NEEDED: 0.47 Rating : 0.07 88
+Unsatisfiable/ROB005-1.ma ... FAIL Rating : 0.07 89
+Unsatisfiable/COL035-1.ma ... FAIL Rating : 0.14 90
+Unsatisfiable/COL042-6.ma ... FAIL Rating : 0.14 91
+Unsatisfiable/COL042-7.ma ... FAIL Rating : 0.14 92
+Unsatisfiable/COL042-8.ma ... FAIL Rating : 0.14 93
+Unsatisfiable/COL042-9.ma ... FAIL Rating : 0.14 94
+Unsatisfiable/GRP014-1.ma ... FAIL Rating : 0.14 95
+Unsatisfiable/GRP178-1.ma ... FAIL Rating : 0.14 96
+Unsatisfiable/GRP178-2.ma ... FAIL Rating : 0.14 97
+Unsatisfiable/GRP184-2.ma ... FAIL Rating : 0.14 98
+Unsatisfiable/GRP417-1.ma ... FAIL Rating : 0.14 99
+Unsatisfiable/GRP421-1.ma ... FAIL Rating : 0.14 100
+Unsatisfiable/GRP426-1.ma ... FAIL Rating : 0.14 101
+Unsatisfiable/GRP429-1.ma ... FAIL Rating : 0.14 102
+Unsatisfiable/GRP442-1.ma ... FAIL Rating : 0.14 103
+Unsatisfiable/GRP502-1.ma ... FAIL Rating : 0.14 104
+Unsatisfiable/GRP503-1.ma ... FAIL Rating : 0.14 105
+Unsatisfiable/GRP504-1.ma ... FAIL Rating : 0.14 106
+Unsatisfiable/LAT013-1.ma ... FAIL Rating : 0.14 107
+Unsatisfiable/LAT026-1.ma ... FAIL Rating : 0.14 108
+Unsatisfiable/LAT044-1.ma ... FAIL Rating : 0.14 109
+Unsatisfiable/LAT143-1.ma ... FAIL Rating : 0.14 110
+Unsatisfiable/LAT168-1.ma ... FAIL Rating : 0.14 111
+Unsatisfiable/RNG021-6.ma ... FAIL Rating : 0.14 112
+Unsatisfiable/BOO031-1.ma ... FAIL Rating : 0.21 113
+Unsatisfiable/BOO067-1.ma ... FAIL Rating : 0.21 114
+Unsatisfiable/COL004-3.ma ... OK TIME NEEDED: 0.01 Rating : 0.21 115
+Unsatisfiable/COL044-1.ma ... FAIL Rating : 0.21 116
+Unsatisfiable/GRP177-2.ma ... FAIL Rating : 0.21 117
+Unsatisfiable/GRP184-3.ma ... FAIL Rating : 0.21 118
+Unsatisfiable/GRP185-3.ma ... FAIL Rating : 0.21 119
+Unsatisfiable/GRP185-4.ma ... FAIL Rating : 0.21 120
+Unsatisfiable/GRP203-1.ma ... FAIL Rating : 0.21 121
+Unsatisfiable/GRP444-1.ma ... FAIL Rating : 0.21 122
+Unsatisfiable/GRP469-1.ma ... FAIL Rating : 0.21 123
+Unsatisfiable/GRP470-1.ma ... FAIL Rating : 0.21 124
+Unsatisfiable/GRP471-1.ma ... FAIL Rating : 0.21 125
+Unsatisfiable/LAT022-1.ma ... FAIL Rating : 0.21 126
+Unsatisfiable/LAT023-1.ma ... FAIL Rating : 0.21 127
+Unsatisfiable/RNG019-6.ma ... FAIL Rating : 0.21 128
+Unsatisfiable/RNG019-7.ma ... FAIL Rating : 0.21 129
+Unsatisfiable/RNG020-7.ma ... FAIL Rating : 0.21 130
+Unsatisfiable/RNG021-7.ma ... FAIL Rating : 0.21 131
+Unsatisfiable/COL037-1.ma ... FAIL Rating : 0.29 132
+Unsatisfiable/COL049-1.ma ... OK TIME NEEDED: 70.59 Rating : 0.29 133
+Unsatisfiable/GRP184-1.ma ... FAIL Rating : 0.29 134
+Unsatisfiable/GRP200-1.ma ... FAIL Rating : 0.29 135
+Unsatisfiable/GRP419-1.ma ... FAIL Rating : 0.29 136
+Unsatisfiable/GRP422-1.ma ... FAIL Rating : 0.29 137
+Unsatisfiable/RNG020-6.ma ... FAIL Rating : 0.29 138
+Unsatisfiable/RNG025-4.ma ... FAIL Rating : 0.29 139
+Unsatisfiable/RNG025-6.ma ... FAIL Rating : 0.29 140
+Unsatisfiable/BOO073-1.ma ... FAIL Rating : 0.36 141
+Unsatisfiable/COL011-1.ma ... FAIL Rating : 0.36 142
+Unsatisfiable/COL057-1.ma ... FAIL Rating : 0.36 143
+Unsatisfiable/COL060-1.ma ... OK TIME NEEDED: 18.53 Rating : 0.36 144
+Unsatisfiable/COL061-1.ma ... FAIL Rating : 0.36 145
+Unsatisfiable/GRP179-3.ma ... FAIL Rating : 0.36 146
+Unsatisfiable/GRP183-4.ma ... FAIL Rating : 0.36 147
+Unsatisfiable/GRP186-2.ma ... FAIL Rating : 0.36 148
+Unsatisfiable/GRP201-1.ma ... FAIL Rating : 0.36 149
+Unsatisfiable/GRP420-1.ma ... FAIL Rating : 0.36 150
+Unsatisfiable/GRP423-1.ma ... FAIL Rating : 0.36 151
+Unsatisfiable/LAT080-1.ma ... FAIL Rating : 0.36 152
+Unsatisfiable/LAT083-1.ma ... FAIL Rating : 0.36 153
+Unsatisfiable/LAT092-1.ma ... FAIL Rating : 0.36 154
+Unsatisfiable/LAT094-1.ma ... FAIL Rating : 0.36 155
+Unsatisfiable/LAT096-1.ma ... FAIL Rating : 0.36 156
+Unsatisfiable/LAT097-1.ma ... FAIL Rating : 0.36 157
+Unsatisfiable/RNG025-5.ma ... FAIL Rating : 0.36 158
+Unsatisfiable/COL002-5.ma ... FAIL Rating : 0.43 159
+Unsatisfiable/COL034-1.ma ... OK TIME NEEDED: 7.20 Rating : 0.43 160
+Unsatisfiable/GRP167-4.ma ... FAIL Rating : 0.43 161
+Unsatisfiable/GRP180-2.ma ... FAIL Rating : 0.43 162
+Unsatisfiable/GRP183-1.ma ... FAIL Rating : 0.43 163
+Unsatisfiable/GRP183-2.ma ... FAIL Rating : 0.43 164
+Unsatisfiable/GRP183-3.ma ... FAIL Rating : 0.43 165
+Unsatisfiable/GRP202-1.ma ... FAIL Rating : 0.43 166
+Unsatisfiable/GRP205-1.ma ... FAIL Rating : 0.43 167
+Unsatisfiable/LAT038-1.ma ... FAIL Rating : 0.43 168
+Unsatisfiable/LAT087-1.ma ... FAIL Rating : 0.43 169
+Unsatisfiable/LAT093-1.ma ... FAIL Rating : 0.43 170
+Unsatisfiable/LAT095-1.ma ... FAIL Rating : 0.43 171
+Unsatisfiable/RNG025-7.ma ... FAIL Rating : 0.43 172
+Unsatisfiable/COL044-7.ma ... FAIL Rating : 0.50 173
+Unsatisfiable/COL062-1.ma ... FAIL Rating : 0.50 174
+Unsatisfiable/COL063-1.ma ... FAIL Rating : 0.50 175
+Unsatisfiable/GRP024-5.ma ... FAIL Rating : 0.50 176
+Unsatisfiable/GRP167-3.ma ... FAIL Rating : 0.50 177
+Unsatisfiable/GRP179-1.ma ... FAIL Rating : 0.50 178
+Unsatisfiable/GRP179-2.ma ... FAIL Rating : 0.50 179
+Unsatisfiable/GRP180-1.ma ... FAIL Rating : 0.50 180
+Unsatisfiable/GRP505-1.ma ... FAIL Rating : 0.50 181
+Unsatisfiable/LAT020-1.ma ... FAIL Rating : 0.50 182
+Unsatisfiable/LAT084-1.ma ... FAIL Rating : 0.50 183
+Unsatisfiable/LAT086-1.ma ... FAIL Rating : 0.50 184
+Unsatisfiable/LAT171-1.ma ... FAIL Rating : 0.50 185
+Unsatisfiable/RNG009-5.ma ... FAIL Rating : 0.50 186
+Unsatisfiable/RNG009-7.ma ... FAIL Rating : 0.50 187
+Unsatisfiable/RNG026-7.ma ... FAIL Rating : 0.50 188
+Unsatisfiable/COL004-1.ma ... FAIL Rating : 0.57 189
+Unsatisfiable/COL006-1.ma ... FAIL Rating : 0.57 190
+Unsatisfiable/COL036-1.ma ... OK TIME NEEDED: 63.05 Rating : 0.57 191
+Unsatisfiable/GRP186-1.ma ... FAIL Rating : 0.57 192
+Unsatisfiable/GRP507-1.ma ... FAIL Rating : 0.57 193
+Unsatisfiable/GRP508-1.ma ... FAIL Rating : 0.57 194
+Unsatisfiable/LAT081-1.ma ... FAIL Rating : 0.57 195
+Unsatisfiable/LAT085-1.ma ... FAIL Rating : 0.57 196
+Unsatisfiable/RNG026-6.ma ... FAIL Rating : 0.57 197
+Unsatisfiable/COL006-5.ma ... FAIL Rating : 0.64 198
+Unsatisfiable/COL006-6.ma ... FAIL Rating : 0.64 199
+Unsatisfiable/COL006-7.ma ... FAIL Rating : 0.64 200
+Unsatisfiable/COL038-1.ma ... FAIL Rating : 0.64 201
+Unsatisfiable/COL044-6.ma ... FAIL Rating : 0.64 202
+Unsatisfiable/COL044-9.ma ... FAIL Rating : 0.64 203
+Unsatisfiable/COL046-1.ma ... FAIL Rating : 0.64 204
+Unsatisfiable/COL064-1.ma ... FAIL Rating : 0.64 205
+Unsatisfiable/GRP187-1.ma ... FAIL Rating : 0.64 206
+Unsatisfiable/GRP506-1.ma ... FAIL Rating : 0.64 207
+Unsatisfiable/LAT082-1.ma ... FAIL Rating : 0.64 208
+Unsatisfiable/LAT142-1.ma ... FAIL Rating : 0.64 209
+Unsatisfiable/LAT156-1.ma ... FAIL Rating : 0.64 210
+Unsatisfiable/LAT160-1.ma ... FAIL Rating : 0.64 211
+Unsatisfiable/BOO076-1.ma ... FAIL Rating : 0.71 212
+Unsatisfiable/COL043-3.ma ... FAIL Rating : 0.71 213
+Unsatisfiable/COL044-8.ma ... FAIL Rating : 0.71 214
+Unsatisfiable/COL065-1.ma ... FAIL Rating : 0.71 215
+Unsatisfiable/GRP181-1.ma ... FAIL Rating : 0.71 216
+Unsatisfiable/GRP181-2.ma ... FAIL Rating : 0.71 217
+Unsatisfiable/LAT017-1.ma ... FAIL Rating : 0.71 218
+Unsatisfiable/LAT148-1.ma ... FAIL Rating : 0.71 219
+Unsatisfiable/COL003-1.ma ... FAIL Rating : 0.79 220
+Unsatisfiable/LAT146-1.ma ... FAIL Rating : 0.79 221
+Unsatisfiable/LAT147-1.ma ... FAIL Rating : 0.79 222
+Unsatisfiable/LAT152-1.ma ... FAIL Rating : 0.79 223
+Unsatisfiable/LAT154-1.ma ... FAIL Rating : 0.79 224
+Unsatisfiable/LAT170-1.ma ... FAIL Rating : 0.79 225
+Unsatisfiable/LAT174-1.ma ... FAIL Rating : 0.79 226
+Unsatisfiable/COL042-1.ma ... FAIL Rating : 0.86 227
+Unsatisfiable/COL043-1.ma ... FAIL Rating : 0.86 228
+Unsatisfiable/LAT144-1.ma ... FAIL Rating : 0.86 229
+Unsatisfiable/LAT150-1.ma ... FAIL Rating : 0.86 230
+Unsatisfiable/LAT151-1.ma ... FAIL Rating : 0.86 231
+Unsatisfiable/LAT155-1.ma ... FAIL Rating : 0.86 232
+Unsatisfiable/LAT157-1.ma ... FAIL Rating : 0.86 233
+Unsatisfiable/LAT159-1.ma ... FAIL Rating : 0.86 234
+Unsatisfiable/LAT162-1.ma ... FAIL Rating : 0.86 235
+Unsatisfiable/LAT169-1.ma ... FAIL Rating : 0.86 236
+Unsatisfiable/RNG027-5.ma ... FAIL Rating : 0.86 237
+Unsatisfiable/RNG027-7.ma ... FAIL Rating : 0.86 238
+Unsatisfiable/RNG027-8.ma ... FAIL Rating : 0.86 239
+Unsatisfiable/RNG027-9.ma ... FAIL Rating : 0.86 240
+Unsatisfiable/RNG028-5.ma ... FAIL Rating : 0.86 241
+Unsatisfiable/RNG028-7.ma ... FAIL Rating : 0.86 242
+Unsatisfiable/RNG028-8.ma ... FAIL Rating : 0.86 243
+Unsatisfiable/RNG028-9.ma ... FAIL Rating : 0.86 244
+Unsatisfiable/RNG029-5.ma ... FAIL Rating : 0.86 245
+Unsatisfiable/RNG029-6.ma ... FAIL Rating : 0.86 246
+Unsatisfiable/RNG029-7.ma ... FAIL Rating : 0.86 247
+Unsatisfiable/RNG035-7.ma ... FAIL Rating : 0.86 248
+Unsatisfiable/ROB006-1.ma ... FAIL Rating : 0.86 249
+Unsatisfiable/ROB006-2.ma ... FAIL Rating : 0.86 250
+Unsatisfiable/ROB026-1.ma ... FAIL Rating : 0.86 251
+Unsatisfiable/COL066-1.ma ... FAIL Rating : 0.93 252
+Unsatisfiable/GRP164-1.ma ... FAIL Rating : 0.93 253
+Unsatisfiable/GRP164-2.ma ... FAIL Rating : 0.93 254
+Unsatisfiable/GRP196-1.ma ... FAIL Rating : 0.93 255
+Unsatisfiable/LAT018-1.ma ... FAIL Rating : 0.93 256
+Unsatisfiable/LAT070-1.ma ... FAIL Rating : 0.93 257
+Unsatisfiable/LAT145-1.ma ... FAIL Rating : 0.93 258
+Unsatisfiable/LAT149-1.ma ... FAIL Rating : 0.93 259
+Unsatisfiable/LAT153-1.ma ... FAIL Rating : 0.93 260
+Unsatisfiable/LAT158-1.ma ... FAIL Rating : 0.93 261
+Unsatisfiable/LAT163-1.ma ... FAIL Rating : 0.93 262
+Unsatisfiable/LAT164-1.ma ... FAIL Rating : 0.93 263
+Unsatisfiable/LAT165-1.ma ... FAIL Rating : 0.93 264
+Unsatisfiable/LAT166-1.ma ... FAIL Rating : 0.93 265
+Unsatisfiable/LAT167-1.ma ... FAIL Rating : 0.93 266
+Unsatisfiable/LAT172-1.ma ... FAIL Rating : 0.93 267
+Unsatisfiable/LAT173-1.ma ... FAIL Rating : 0.93 268
+Unsatisfiable/LAT175-1.ma ... FAIL Rating : 0.93 269
+Unsatisfiable/LAT176-1.ma ... FAIL Rating : 0.93 270
+Unsatisfiable/LAT072-1.ma ... FAIL Rating : 1.00 271
+Unsatisfiable/LAT074-1.ma ... FAIL Rating : 1.00 272
+Unsatisfiable/LAT075-1.ma ... FAIL Rating : 1.00 273
+Unsatisfiable/LAT076-1.ma ... FAIL Rating : 1.00 274
+Unsatisfiable/LAT077-1.ma ... FAIL Rating : 1.00 275
+Unsatisfiable/LAT078-1.ma ... FAIL Rating : 1.00 276
+Unsatisfiable/LAT079-1.ma ... FAIL Rating : 1.00 277
+Unsatisfiable/LAT138-1.ma ... FAIL Rating : 1.00 278
+Unsatisfiable/LAT139-1.ma ... FAIL Rating : 1.00 279
+Unsatisfiable/LAT140-1.ma ... FAIL Rating : 1.00 280
+Unsatisfiable/LAT141-1.ma ... FAIL Rating : 1.00 281
+Unsatisfiable/LAT161-1.ma ... FAIL Rating : 1.00 282
+Unsatisfiable/LAT177-1.ma ... FAIL Rating : 1.00 283
+Unsatisfiable/ROB001-1.ma ... FAIL Rating : 1.00 284
+Unsatisfiable/ROB031-1.ma ... FAIL Rating : 1.00 285
+Unsatisfiable/ROB032-1.ma ... FAIL Rating : 1.00 286
diff --git a/matita/tests/TPTP/log.300.30-6.fixdemodgoalinpassive b/matita/tests/TPTP/log.300.30-6.fixdemodgoalinpassive
new file mode 100644 (file)
index 0000000..ea726ae
--- /dev/null
@@ -0,0 +1,18 @@
+Unsatisfiable/COL023-1.ma ... FAIL Rating : 0.00 1
+Unsatisfiable/COL027-1.ma ... FAIL Rating : 0.00 2
+Unsatisfiable/COL031-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 3
+Unsatisfiable/COL052-1.ma ... FAIL Rating : 0.00 4
+Unsatisfiable/COL059-1.ma ... FAIL Rating : 0.00 5
+Unsatisfiable/GRP166-4.ma ... FAIL Rating : 0.00 6
+Unsatisfiable/GRP170-1.ma ... FAIL Rating : 0.00 7
+Unsatisfiable/GRP170-2.ma ... FAIL Rating : 0.00 8
+Unsatisfiable/GRP170-3.ma ... FAIL Rating : 0.00 9
+Unsatisfiable/GRP170-4.ma ... FAIL Rating : 0.00 10
+Unsatisfiable/GRP193-1.ma ... FAIL Rating : 0.00 11
+Unsatisfiable/GRP193-2.ma ... FAIL Rating : 0.00 12
+Unsatisfiable/GRP195-1.ma ... FAIL Rating : 0.00 13
+Unsatisfiable/GRP406-1.ma ... FAIL Rating : 0.00 14
+Unsatisfiable/GRP407-1.ma ... FAIL Rating : 0.00 15
+Unsatisfiable/GRP408-1.ma ... FAIL Rating : 0.00 16
+Unsatisfiable/GRP415-1.ma ... FAIL Rating : 0.00 17
+Unsatisfiable/GRP427-1.ma ... 
\ No newline at end of file
diff --git a/matita/tests/TPTP/log.600.15-7.comedasvn_stampapesomassimoeqinprovanellog.txt b/matita/tests/TPTP/log.600.15-7.comedasvn_stampapesomassimoeqinprovanellog.txt
new file mode 100644 (file)
index 0000000..d37bf6b
--- /dev/null
@@ -0,0 +1,698 @@
+Unsatisfiable/ALG005-1.ma ... OK TIME NEEDED: 72.61 Rating : 0.07 max weight: 21 1
+Unsatisfiable/ALG006-1.ma ... OK TIME NEEDED: 7.07 Rating : 0.00 max weight: 18 2
+Unsatisfiable/ALG007-1.ma ... OK TIME NEEDED: 8.76 Rating : 0.00 max weight: 18 3
+Unsatisfiable/BOO001-1.ma ... OK TIME NEEDED: 0.54 Rating : 0.00 max weight: 21 4
+Unsatisfiable/BOO002-1.ma ... OK TIME NEEDED: 6.47 Rating : 0.07 max weight: 26 5
+Unsatisfiable/BOO002-2.ma ... OK TIME NEEDED: 9.59 Rating : 0.00 max weight: 26 6
+Unsatisfiable/BOO003-2.ma ... OK TIME NEEDED: 0.78 Rating : 0.00 max weight: 13 7
+Unsatisfiable/BOO003-4.ma ... OK TIME NEEDED: 0.48 Rating : 0.00 max weight: 15 8
+Unsatisfiable/BOO004-2.ma ... OK TIME NEEDED: 0.20 Rating : 0.00 max weight: 10 9
+Unsatisfiable/BOO004-4.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 max weight: 10 10
+Unsatisfiable/BOO005-2.ma ... OK TIME NEEDED: 0.32 Rating : 0.00 max weight: 9 11
+Unsatisfiable/BOO005-4.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 max weight: 9 12
+Unsatisfiable/BOO006-2.ma ... OK TIME NEEDED: 1.05 Rating : 0.00 max weight: 17 13
+Unsatisfiable/BOO006-4.ma ... OK TIME NEEDED: 0.70 Rating : 0.00 max weight: 9 14
+Unsatisfiable/BOO007-2.ma ... OK TIME NEEDED: 31.65 Rating : 0.14 max weight: 19 15
+Unsatisfiable/BOO007-4.ma ... OK TIME NEEDED: 27.51 Rating : 0.07 max weight: 19 16
+Unsatisfiable/BOO008-2.ma ... OK TIME NEEDED: 24.61 Rating : 0.07 max weight: 19 17
+Unsatisfiable/BOO008-4.ma ... OK TIME NEEDED: 146.41 Rating : 0.00 max weight: 20 18
+Unsatisfiable/BOO009-2.ma ... OK TIME NEEDED: 1.28 Rating : 0.00 max weight: 14 19
+Unsatisfiable/BOO009-4.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 max weight: 14 20
+Unsatisfiable/BOO010-2.ma ... OK TIME NEEDED: 0.96 Rating : 0.00 max weight: 14 21
+Unsatisfiable/BOO010-4.ma ... OK TIME NEEDED: 0.32 Rating : 0.00 max weight: 14 22
+Unsatisfiable/BOO011-2.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 max weight: 2 23
+Unsatisfiable/BOO011-4.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 max weight: 5 24
+Unsatisfiable/BOO012-2.ma ... OK TIME NEEDED: 0.41 Rating : 0.00 max weight: 18 25
+Unsatisfiable/BOO012-4.ma ... OK TIME NEEDED: 2.11 Rating : 0.00 max weight: 18 26
+Unsatisfiable/BOO013-2.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 max weight: 10 27
+Unsatisfiable/BOO013-4.ma ... OK TIME NEEDED: 2.78 Rating : 0.00 max weight: 16 28
+Unsatisfiable/BOO014-2.ma ... OK TIME NEEDED: 20.42 Rating : 0.00 max weight: 18 29
+Unsatisfiable/BOO014-4.ma ... OK TIME NEEDED: 114.97 Rating : 0.00 max weight: 18 30
+Unsatisfiable/BOO015-2.ma ... OK TIME NEEDED: 15.38 Rating : 0.00 max weight: 18 31
+Unsatisfiable/BOO015-4.ma ... OK TIME NEEDED: 96.29 Rating : 0.00 max weight: 18 32
+Unsatisfiable/BOO016-2.ma ... OK TIME NEEDED: 0.85 Rating : 0.00 max weight: 17 33
+Unsatisfiable/BOO017-2.ma ... OK TIME NEEDED: 1.70 Rating : 0.00 max weight: 16 34
+Unsatisfiable/BOO018-4.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 max weight: 5 35
+Unsatisfiable/BOO021-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.07 max weight: 10 36
+Unsatisfiable/BOO022-1.ma ... OK TIME NEEDED: 65.58 Rating : 0.07 max weight: 18 37
+Unsatisfiable/BOO023-1.ma ... OK TIME NEEDED: 141.40 Rating : 0.50 max weight: 23 38
+Unsatisfiable/BOO024-1.ma ... OK TIME NEEDED: 17.84 Rating : 0.00 max weight: 14 39
+Unsatisfiable/BOO025-1.ma ... OK TIME NEEDED: 37.02 Rating : 0.07 max weight: 32 40
+Unsatisfiable/BOO026-1.ma ... OK TIME NEEDED: 17.55 Rating : 0.07 max weight: 21 41
+Unsatisfiable/BOO028-1.ma ... FAIL Rating : 0.07 42
+Unsatisfiable/BOO029-1.ma ... OK TIME NEEDED: 17.53 Rating : 0.00 max weight: 13 43
+Unsatisfiable/BOO031-1.ma ... FAIL Rating : 0.21 44
+Unsatisfiable/BOO034-1.ma ... OK TIME NEEDED: 0.89 Rating : 0.21 max weight: 20 45
+Unsatisfiable/BOO067-1.ma ... FAIL Rating : 0.21 46
+Unsatisfiable/BOO068-1.ma ... OK TIME NEEDED: 2.99 Rating : 0.00 max weight: 37 47
+Unsatisfiable/BOO069-1.ma ... OK TIME NEEDED: 2.85 Rating : 0.00 max weight: 36 48
+Unsatisfiable/BOO070-1.ma ... OK TIME NEEDED: 2.76 Rating : 0.00 max weight: 37 49
+Unsatisfiable/BOO071-1.ma ... OK TIME NEEDED: 3.18 Rating : 0.00 max weight: 36 50
+Unsatisfiable/BOO072-1.ma ... OK TIME NEEDED: 62.23 Rating : 0.07 max weight: 28 51
+Unsatisfiable/BOO073-1.ma ... FAIL Rating : 0.36 52
+Unsatisfiable/BOO074-1.ma ... OK TIME NEEDED: 99.57 Rating : 0.07 max weight: 27 53
+Unsatisfiable/BOO075-1.ma ... OK TIME NEEDED: 4.04 Rating : 0.00 max weight: 34 54
+Unsatisfiable/BOO076-1.ma ... FAIL Rating : 0.71 55
+Unsatisfiable/COL001-1.ma ... OK TIME NEEDED: 356.14 Rating : 0.07 max weight: 26 56
+Unsatisfiable/COL001-2.ma ... OK TIME NEEDED: 4.21 Rating : 0.07 max weight: 23 57
+Unsatisfiable/COL002-1.ma ... OK TIME NEEDED: 4.18 Rating : 0.00 max weight: 23 58
+Unsatisfiable/COL002-4.ma ... FAIL Rating : 0.07 59
+Unsatisfiable/COL002-5.ma ... FAIL Rating : 0.43 60
+Unsatisfiable/COL003-1.ma ... FAIL Rating : 0.79 61
+Unsatisfiable/COL004-1.ma ... FAIL Rating : 0.57 62
+Unsatisfiable/COL004-3.ma ... OK TIME NEEDED: 0.02 Rating : 0.21 max weight: 20 63
+Unsatisfiable/COL006-1.ma ... FAIL Rating : 0.57 64
+Unsatisfiable/COL006-5.ma ... FAIL Rating : 0.64 65
+Unsatisfiable/COL006-6.ma ... FAIL Rating : 0.64 66
+Unsatisfiable/COL006-7.ma ... FAIL Rating : 0.64 67
+Unsatisfiable/COL007-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 68
+Unsatisfiable/COL008-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 max weight: 11 69
+Unsatisfiable/COL009-1.ma ... OK TIME NEEDED: 3.16 Rating : 0.07 max weight: 18 70
+Unsatisfiable/COL010-1.ma ... OK TIME NEEDED: 1.59 Rating : 0.07 max weight: 23 71
+Unsatisfiable/COL011-1.ma ... FAIL Rating : 0.36 72
+Unsatisfiable/COL012-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 73
+Unsatisfiable/COL013-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 max weight: 0 74
+Unsatisfiable/COL014-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 75
+Unsatisfiable/COL015-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 max weight: 11 76
+Unsatisfiable/COL016-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 max weight: 0 77
+Unsatisfiable/COL017-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 max weight: 11 78
+Unsatisfiable/COL018-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 79
+Unsatisfiable/COL019-1.ma ... OK TIME NEEDED: 1.65 Rating : 0.00 max weight: 23 80
+Unsatisfiable/COL020-1.ma ... FAIL Rating : 0.07 81
+Unsatisfiable/COL021-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 max weight: 11 82
+Unsatisfiable/COL022-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 11 83
+Unsatisfiable/COL023-1.ma ... FAIL Rating : 0.00 84
+Unsatisfiable/COL024-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 max weight: 11 85
+Unsatisfiable/COL025-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 17 86
+Unsatisfiable/COL026-1.ma ... FAIL Rating : 0.07 87
+Unsatisfiable/COL027-1.ma ... FAIL Rating : 0.00 88
+Unsatisfiable/COL029-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 89
+Unsatisfiable/COL030-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.14 max weight: 13 90
+Unsatisfiable/COL031-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 max weight: 0 91
+Unsatisfiable/COL032-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.14 max weight: 0 92
+Unsatisfiable/COL033-1.ma ... OK TIME NEEDED: 4.71 Rating : 0.07 max weight: 16 93
+Unsatisfiable/COL034-1.ma ... OK TIME NEEDED: 0.51 Rating : 0.43 max weight: 0 94
+Unsatisfiable/COL035-1.ma ... FAIL Rating : 0.14 95
+Unsatisfiable/COL036-1.ma ... FAIL Rating : 0.57 96
+Unsatisfiable/COL037-1.ma ... FAIL Rating : 0.29 97
+Unsatisfiable/COL038-1.ma ... FAIL Rating : 0.64 98
+Unsatisfiable/COL039-1.ma ... OK TIME NEEDED: 5.87 Rating : 0.00 max weight: 11 99
+Unsatisfiable/COL041-1.ma ... OK TIME NEEDED: 0.65 Rating : 0.36 max weight: 0 100
+Unsatisfiable/COL042-1.ma ... FAIL Rating : 0.86 101
+Unsatisfiable/COL042-6.ma ... FAIL Rating : 0.14 102
+Unsatisfiable/COL042-7.ma ... FAIL Rating : 0.14 103
+Unsatisfiable/COL042-8.ma ... FAIL Rating : 0.14 104
+Unsatisfiable/COL042-9.ma ... FAIL Rating : 0.14 105
+Unsatisfiable/COL043-1.ma ... FAIL Rating : 0.86 106
+Unsatisfiable/COL043-3.ma ... FAIL Rating : 0.71 107
+Unsatisfiable/COL044-1.ma ... FAIL Rating : 0.21 108
+Unsatisfiable/COL044-6.ma ... FAIL Rating : 0.64 109
+Unsatisfiable/COL044-7.ma ... FAIL Rating : 0.50 110
+Unsatisfiable/COL044-8.ma ... FAIL Rating : 0.71 111
+Unsatisfiable/COL044-9.ma ... FAIL Rating : 0.64 112
+Unsatisfiable/COL045-1.ma ... OK TIME NEEDED: 0.22 Rating : 0.00 max weight: 11 113
+Unsatisfiable/COL046-1.ma ... FAIL Rating : 0.64 114
+Unsatisfiable/COL048-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 max weight: 17 115
+Unsatisfiable/COL049-1.ma ... OK TIME NEEDED: 5.11 Rating : 0.29 max weight: 17 116
+Unsatisfiable/COL050-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 max weight: 9 117
+Unsatisfiable/COL051-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 max weight: 9 118
+Unsatisfiable/COL052-1.ma ... FAIL Rating : 0.00 119
+Unsatisfiable/COL053-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 max weight: 0 120
+Unsatisfiable/COL056-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.07 max weight: 6 121
+Unsatisfiable/COL057-1.ma ... FAIL Rating : 0.36 122
+Unsatisfiable/COL058-1.ma ... OK TIME NEEDED: 0.32 Rating : 0.00 max weight: 0 123
+Unsatisfiable/COL058-2.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 max weight: 10 124
+Unsatisfiable/COL058-3.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 max weight: 10 125
+Unsatisfiable/COL059-1.ma ... FAIL Rating : 0.00 126
+Unsatisfiable/COL060-1.ma ... OK TIME NEEDED: 23.48 Rating : 0.36 max weight: 0 127
+Unsatisfiable/COL060-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 128
+Unsatisfiable/COL060-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 129
+Unsatisfiable/COL061-1.ma ... OK TIME NEEDED: 477.77 Rating : 0.36 max weight: 0 130
+Unsatisfiable/COL061-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 131
+Unsatisfiable/COL061-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 132
+Unsatisfiable/COL062-1.ma ... FAIL Rating : 0.50 133
+Unsatisfiable/COL062-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 134
+Unsatisfiable/COL062-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 135
+Unsatisfiable/COL063-1.ma ... FAIL Rating : 0.50 136
+Unsatisfiable/COL063-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 137
+Unsatisfiable/COL063-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 138
+Unsatisfiable/COL063-4.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 139
+Unsatisfiable/COL063-5.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 140
+Unsatisfiable/COL063-6.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 141
+Unsatisfiable/COL064-1.ma ... FAIL Rating : 0.64 142
+Unsatisfiable/COL064-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 max weight: 0 143
+Unsatisfiable/COL064-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 144
+Unsatisfiable/COL064-4.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 max weight: 0 145
+Unsatisfiable/COL064-5.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 max weight: 0 146
+Unsatisfiable/COL064-6.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 147
+Unsatisfiable/COL064-7.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 max weight: 0 148
+Unsatisfiable/COL064-8.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 149
+Unsatisfiable/COL064-9.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 max weight: 0 150
+Unsatisfiable/COL065-1.ma ... FAIL Rating : 0.71 151
+Unsatisfiable/COL066-1.ma ... FAIL Rating : 0.93 152
+Unsatisfiable/COL066-2.ma ... OK TIME NEEDED: 2.51 Rating : 0.00 max weight: 21 153
+Unsatisfiable/COL066-3.ma ... OK TIME NEEDED: 2.07 Rating : 0.00 max weight: 21 154
+Unsatisfiable/COL070-1.ma ... FAIL Rating : 0.07 155
+Unsatisfiable/COL075-2.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 max weight: 23 156
+Unsatisfiable/COL083-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 157
+Unsatisfiable/COL084-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 158
+Unsatisfiable/COL085-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 159
+Unsatisfiable/COL086-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 160
+Unsatisfiable/GRP001-2.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 max weight: 7 161
+Unsatisfiable/GRP001-4.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 max weight: 7 162
+Unsatisfiable/GRP002-2.ma ... OK TIME NEEDED: 31.68 Rating : 0.00 max weight: 22 163
+Unsatisfiable/GRP002-3.ma ... OK TIME NEEDED: 347.29 Rating : 0.00 max weight: 23 164
+Unsatisfiable/GRP002-4.ma ... OK TIME NEEDED: 67.57 Rating : 0.00 max weight: 23 165
+Unsatisfiable/GRP010-4.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 8 166
+Unsatisfiable/GRP011-4.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 max weight: 12 167
+Unsatisfiable/GRP012-4.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 max weight: 8 168
+Unsatisfiable/GRP014-1.ma ... OK TIME NEEDED: 50.29 Rating : 0.14 max weight: 39 169
+Unsatisfiable/GRP022-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 max weight: 9 170
+Unsatisfiable/GRP023-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 max weight: 2 171
+Unsatisfiable/GRP024-5.ma ... FAIL Rating : 0.50 172
+Unsatisfiable/GRP114-1.ma ... OK TIME NEEDED: 215.54 Rating : 0.29 max weight: 18 173
+Unsatisfiable/GRP115-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 18 174
+Unsatisfiable/GRP116-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 max weight: 18 175
+Unsatisfiable/GRP117-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 max weight: 18 176
+Unsatisfiable/GRP118-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 max weight: 19 177
+Unsatisfiable/GRP119-1.ma ... OK TIME NEEDED: 54.79 Rating : 0.00 max weight: 68 178
+Unsatisfiable/GRP120-1.ma ... OK TIME NEEDED: 41.58 Rating : 0.00 max weight: 68 179
+Unsatisfiable/GRP121-1.ma ... OK TIME NEEDED: 37.22 Rating : 0.00 max weight: 68 180
+Unsatisfiable/GRP122-1.ma ... OK TIME NEEDED: 38.77 Rating : 0.07 max weight: 69 181
+Unsatisfiable/GRP136-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 max weight: 4 182
+Unsatisfiable/GRP137-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 max weight: 4 183
+Unsatisfiable/GRP138-1.ma ... OK TIME NEEDED: 4.32 Rating : 0.00 max weight: 7 184
+Unsatisfiable/GRP139-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 max weight: 16 185
+Unsatisfiable/GRP140-1.ma ... OK TIME NEEDED: 3.11 Rating : 0.00 max weight: 7 186
+Unsatisfiable/GRP141-1.ma ... OK TIME NEEDED: 0.21 Rating : 0.00 max weight: 16 187
+Unsatisfiable/GRP142-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 max weight: 0 188
+Unsatisfiable/GRP143-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 6 189
+Unsatisfiable/GRP144-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 max weight: 6 190
+Unsatisfiable/GRP145-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 16 191
+Unsatisfiable/GRP146-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 max weight: 16 192
+Unsatisfiable/GRP147-1.ma ... OK TIME NEEDED: 4.68 Rating : 0.00 max weight: 7 193
+Unsatisfiable/GRP148-1.ma ... OK TIME NEEDED: 3.40 Rating : 0.00 max weight: 7 194
+Unsatisfiable/GRP149-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 max weight: 16 195
+Unsatisfiable/GRP150-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 max weight: 6 196
+Unsatisfiable/GRP151-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 max weight: 0 197
+Unsatisfiable/GRP152-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 max weight: 16 198
+Unsatisfiable/GRP153-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 6 199
+Unsatisfiable/GRP154-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 max weight: 3 200
+Unsatisfiable/GRP155-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 max weight: 3 201
+Unsatisfiable/GRP156-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 max weight: 4 202
+Unsatisfiable/GRP157-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 max weight: 3 203
+Unsatisfiable/GRP158-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 max weight: 3 204
+Unsatisfiable/GRP159-1.ma ... OK TIME NEEDED: 0.28 Rating : 0.00 max weight: 7 205
+Unsatisfiable/GRP160-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 0 206
+Unsatisfiable/GRP161-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 max weight: 0 207
+Unsatisfiable/GRP162-1.ma ... OK TIME NEEDED: 0.29 Rating : 0.00 max weight: 7 208
+Unsatisfiable/GRP163-1.ma ... OK TIME NEEDED: 0.43 Rating : 0.00 max weight: 7 209
+Unsatisfiable/GRP164-1.ma ... FAIL Rating : 0.93 210
+Unsatisfiable/GRP164-2.ma ... FAIL Rating : 0.93 211
+Unsatisfiable/GRP165-1.ma ... OK TIME NEEDED: 54.54 Rating : 0.00 max weight: 14 212
+Unsatisfiable/GRP165-2.ma ... OK TIME NEEDED: 51.75 Rating : 0.00 max weight: 15 213
+Unsatisfiable/GRP166-1.ma ... OK TIME NEEDED: 261.59 Rating : 0.00 max weight: 21 214
+Unsatisfiable/GRP166-2.ma ... FAIL Rating : 0.00 215
+Unsatisfiable/GRP166-3.ma ... OK TIME NEEDED: 62.82 Rating : 0.00 max weight: 14 216
+Unsatisfiable/GRP166-4.ma ... OK TIME NEEDED: 52.29 Rating : 0.00 max weight: 15 217
+Unsatisfiable/GRP167-1.ma ... OK TIME NEEDED: 124.19 Rating : 0.21 max weight: 18 218
+Unsatisfiable/GRP167-2.ma ... OK TIME NEEDED: 300.19 Rating : 0.21 max weight: 18 219
+Unsatisfiable/GRP167-3.ma ... OK TIME NEEDED: 311.96 Rating : 0.50 max weight: 14 220
+Unsatisfiable/GRP167-4.ma ... OK TIME NEEDED: 250.37 Rating : 0.43 max weight: 16 221
+Unsatisfiable/GRP167-5.ma ... OK TIME NEEDED: 19.53 Rating : 0.14 max weight: 15 222
+Unsatisfiable/GRP168-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.07 max weight: 3 223
+Unsatisfiable/GRP168-2.ma ... OK TIME NEEDED: 0.09 Rating : 0.07 max weight: 3 224
+Unsatisfiable/GRP169-1.ma ... OK TIME NEEDED: 107.13 Rating : 0.00 max weight: 12 225
+Unsatisfiable/GRP169-2.ma ... OK TIME NEEDED: 114.44 Rating : 0.00 max weight: 13 226
+Unsatisfiable/GRP170-1.ma ... OK TIME NEEDED: 307.40 Rating : 0.00 max weight: 14 227
+Unsatisfiable/GRP170-2.ma ... OK TIME NEEDED: 318.68 Rating : 0.00 max weight: 14 228
+Unsatisfiable/GRP170-3.ma ... OK TIME NEEDED: 339.79 Rating : 0.00 max weight: 14 229
+Unsatisfiable/GRP170-4.ma ... OK TIME NEEDED: 325.63 Rating : 0.00 max weight: 14 230
+Unsatisfiable/GRP171-1.ma ... OK TIME NEEDED: 6.36 Rating : 0.00 max weight: 10 231
+Unsatisfiable/GRP171-2.ma ... OK TIME NEEDED: 6.96 Rating : 0.00 max weight: 10 232
+Unsatisfiable/GRP172-1.ma ... OK TIME NEEDED: 10.72 Rating : 0.00 max weight: 10 233
+Unsatisfiable/GRP172-2.ma ... OK TIME NEEDED: 6.19 Rating : 0.00 max weight: 10 234
+Unsatisfiable/GRP173-1.ma ... OK TIME NEEDED: 15.46 Rating : 0.00 max weight: 11 235
+Unsatisfiable/GRP174-1.ma ... OK TIME NEEDED: 21.49 Rating : 0.00 max weight: 11 236
+Unsatisfiable/GRP175-1.ma ... OK TIME NEEDED: 33.68 Rating : 0.00 max weight: 13 237
+Unsatisfiable/GRP175-2.ma ... OK TIME NEEDED: 41.46 Rating : 0.00 max weight: 14 238
+Unsatisfiable/GRP175-3.ma ... OK TIME NEEDED: 41.14 Rating : 0.00 max weight: 14 239
+Unsatisfiable/GRP175-4.ma ... OK TIME NEEDED: 41.87 Rating : 0.00 max weight: 13 240
+Unsatisfiable/GRP176-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 max weight: 0 241
+Unsatisfiable/GRP176-2.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 max weight: 0 242
+Unsatisfiable/GRP177-2.ma ... FAIL Rating : 0.21 243
+Unsatisfiable/GRP178-1.ma ... OK TIME NEEDED: 282.09 Rating : 0.14 max weight: 15 244
+Unsatisfiable/GRP178-2.ma ... OK TIME NEEDED: 297.82 Rating : 0.14 max weight: 15 245
+Unsatisfiable/GRP179-1.ma ... FAIL Rating : 0.50 246
+Unsatisfiable/GRP179-2.ma ... FAIL Rating : 0.50 247
+Unsatisfiable/GRP179-3.ma ... FAIL Rating : 0.36 248
+Unsatisfiable/GRP180-1.ma ... FAIL Rating : 0.50 249
+Unsatisfiable/GRP180-2.ma ... FAIL Rating : 0.43 250
+Unsatisfiable/GRP181-1.ma ... FAIL Rating : 0.71 251
+Unsatisfiable/GRP181-2.ma ... FAIL Rating : 0.71 252
+Unsatisfiable/GRP181-3.ma ... OK TIME NEEDED: 547.55 Rating : 0.43 max weight: 19 253
+Unsatisfiable/GRP181-4.ma ... FAIL Rating : 0.43 254
+Unsatisfiable/GRP182-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 max weight: 6 255
+Unsatisfiable/GRP182-2.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 6 256
+Unsatisfiable/GRP182-3.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 max weight: 6 257
+Unsatisfiable/GRP182-4.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 6 258
+Unsatisfiable/GRP183-1.ma ... FAIL Rating : 0.43 259
+Unsatisfiable/GRP183-2.ma ... FAIL Rating : 0.43 260
+Unsatisfiable/GRP183-3.ma ... FAIL Rating : 0.43 261
+Unsatisfiable/GRP183-4.ma ... FAIL Rating : 0.36 262
+Unsatisfiable/GRP184-1.ma ... FAIL Rating : 0.29 263
+Unsatisfiable/GRP184-2.ma ... FAIL Rating : 0.14 264
+Unsatisfiable/GRP184-3.ma ... FAIL Rating : 0.21 265
+Unsatisfiable/GRP184-4.ma ... OK TIME NEEDED: 39.14 Rating : 0.00 max weight: 16 266
+Unsatisfiable/GRP185-1.ma ... FAIL Rating : 0.07 267
+Unsatisfiable/GRP185-2.ma ... FAIL Rating : 0.07 268
+Unsatisfiable/GRP185-3.ma ... FAIL Rating : 0.21 269
+Unsatisfiable/GRP185-4.ma ... FAIL Rating : 0.21 270
+Unsatisfiable/GRP186-1.ma ... FAIL Rating : 0.57 271
+Unsatisfiable/GRP186-2.ma ... FAIL Rating : 0.36 272
+Unsatisfiable/GRP186-3.ma ... OK TIME NEEDED: 0.21 Rating : 0.00 max weight: 9 273
+Unsatisfiable/GRP186-4.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 max weight: 7 274
+Unsatisfiable/GRP187-1.ma ... FAIL Rating : 0.64 275
+Unsatisfiable/GRP188-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 max weight: 16 276
+Unsatisfiable/GRP188-2.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 16 277
+Unsatisfiable/GRP189-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 max weight: 6 278
+Unsatisfiable/GRP189-2.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 max weight: 6 279
+Unsatisfiable/GRP190-1.ma ... OK TIME NEEDED: 88.61 Rating : 0.00 max weight: 15 280
+Unsatisfiable/GRP190-2.ma ... OK TIME NEEDED: 81.56 Rating : 0.00 max weight: 12 281
+Unsatisfiable/GRP191-1.ma ... OK TIME NEEDED: 106.88 Rating : 0.00 max weight: 12 282
+Unsatisfiable/GRP191-2.ma ... OK TIME NEEDED: 89.87 Rating : 0.00 max weight: 11 283
+Unsatisfiable/GRP192-1.ma ... OK TIME NEEDED: 0.69 Rating : 0.07 max weight: 15 284
+Unsatisfiable/GRP193-1.ma ... OK TIME NEEDED: 70.37 Rating : 0.00 max weight: 16 285
+Unsatisfiable/GRP193-2.ma ... OK TIME NEEDED: 50.43 Rating : 0.00 max weight: 15 286
+Unsatisfiable/GRP195-1.ma ... FAIL Rating : 0.00 287
+Unsatisfiable/GRP196-1.ma ... FAIL Rating : 0.93 288
+Unsatisfiable/GRP200-1.ma ... FAIL Rating : 0.29 289
+Unsatisfiable/GRP201-1.ma ... FAIL Rating : 0.36 290
+Unsatisfiable/GRP202-1.ma ... FAIL Rating : 0.43 291
+Unsatisfiable/GRP203-1.ma ... FAIL Rating : 0.21 292
+Unsatisfiable/GRP205-1.ma ... FAIL Rating : 0.43 293
+Unsatisfiable/GRP206-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 max weight: 12 294
+Unsatisfiable/GRP403-1.ma ... OK TIME NEEDED: 8.97 Rating : 0.07 max weight: 38 295
+Unsatisfiable/GRP404-1.ma ... OK TIME NEEDED: 51.68 Rating : 0.21 max weight: 48 296
+Unsatisfiable/GRP405-1.ma ... OK TIME NEEDED: 33.55 Rating : 0.21 max weight: 39 297
+Unsatisfiable/GRP406-1.ma ... OK TIME NEEDED: 128.40 Rating : 0.00 max weight: 67 298
+Unsatisfiable/GRP407-1.ma ... OK TIME NEEDED: 240.49 Rating : 0.00 max weight: 67 299
+Unsatisfiable/GRP408-1.ma ... OK TIME NEEDED: 243.34 Rating : 0.00 max weight: 68 300
+Unsatisfiable/GRP409-1.ma ... OK TIME NEEDED: 10.16 Rating : 0.00 max weight: 50 301
+Unsatisfiable/GRP410-1.ma ... OK TIME NEEDED: 22.28 Rating : 0.21 max weight: 50 302
+Unsatisfiable/GRP411-1.ma ... OK TIME NEEDED: 19.42 Rating : 0.21 max weight: 51 303
+Unsatisfiable/GRP412-1.ma ... OK TIME NEEDED: 19.16 Rating : 0.00 max weight: 44 304
+Unsatisfiable/GRP413-1.ma ... OK TIME NEEDED: 100.00 Rating : 0.07 max weight: 44 305
+Unsatisfiable/GRP414-1.ma ... OK TIME NEEDED: 62.50 Rating : 0.07 max weight: 45 306
+Unsatisfiable/GRP415-1.ma ... OK TIME NEEDED: 342.07 Rating : 0.00 max weight: 68 307
+Unsatisfiable/GRP416-1.ma ... OK TIME NEEDED: 400.72 Rating : 0.07 max weight: 68 308
+Unsatisfiable/GRP417-1.ma ... OK TIME NEEDED: 388.08 Rating : 0.14 max weight: 69 309
+Unsatisfiable/GRP418-1.ma ... FAIL Rating : 0.07 310
+Unsatisfiable/GRP419-1.ma ... FAIL Rating : 0.29 311
+Unsatisfiable/GRP420-1.ma ... FAIL Rating : 0.36 312
+Unsatisfiable/GRP421-1.ma ... OK TIME NEEDED: 3.56 Rating : 0.14 max weight: 71 313
+Unsatisfiable/GRP422-1.ma ... OK TIME NEEDED: 150.83 Rating : 0.29 max weight: 71 314
+Unsatisfiable/GRP423-1.ma ... OK TIME NEEDED: 76.62 Rating : 0.36 max weight: 72 315
+Unsatisfiable/GRP424-1.ma ... OK TIME NEEDED: 11.61 Rating : 0.00 max weight: 63 316
+Unsatisfiable/GRP425-1.ma ... OK TIME NEEDED: 11.20 Rating : 0.07 max weight: 63 317
+Unsatisfiable/GRP426-1.ma ... OK TIME NEEDED: 20.01 Rating : 0.14 max weight: 64 318
+Unsatisfiable/GRP427-1.ma ... OK TIME NEEDED: 31.94 Rating : 0.00 max weight: 38 319
+Unsatisfiable/GRP428-1.ma ... OK TIME NEEDED: 36.60 Rating : 0.00 max weight: 38 320
+Unsatisfiable/GRP429-1.ma ... OK TIME NEEDED: 50.34 Rating : 0.14 max weight: 39 321
+Unsatisfiable/GRP430-1.ma ... OK TIME NEEDED: 17.74 Rating : 0.00 max weight: 42 322
+Unsatisfiable/GRP431-1.ma ... OK TIME NEEDED: 16.07 Rating : 0.00 max weight: 42 323
+Unsatisfiable/GRP432-1.ma ... OK TIME NEEDED: 15.53 Rating : 0.00 max weight: 43 324
+Unsatisfiable/GRP433-1.ma ... OK TIME NEEDED: 4.91 Rating : 0.00 max weight: 22 325
+Unsatisfiable/GRP434-1.ma ... OK TIME NEEDED: 5.55 Rating : 0.00 max weight: 22 326
+Unsatisfiable/GRP435-1.ma ... OK TIME NEEDED: 8.83 Rating : 0.00 max weight: 24 327
+Unsatisfiable/GRP436-1.ma ... OK TIME NEEDED: 36.79 Rating : 0.07 max weight: 55 328
+Unsatisfiable/GRP437-1.ma ... OK TIME NEEDED: 35.27 Rating : 0.07 max weight: 55 329
+Unsatisfiable/GRP438-1.ma ... OK TIME NEEDED: 38.97 Rating : 0.07 max weight: 56 330
+Unsatisfiable/GRP439-1.ma ... OK TIME NEEDED: 13.91 Rating : 0.07 max weight: 48 331
+Unsatisfiable/GRP440-1.ma ... OK TIME NEEDED: 28.28 Rating : 0.14 max weight: 48 332
+Unsatisfiable/GRP441-1.ma ... OK TIME NEEDED: 36.20 Rating : 0.21 max weight: 49 333
+Unsatisfiable/GRP442-1.ma ... OK TIME NEEDED: 163.86 Rating : 0.14 max weight: 38 334
+Unsatisfiable/GRP443-1.ma ... OK TIME NEEDED: 169.09 Rating : 0.07 max weight: 38 335
+Unsatisfiable/GRP444-1.ma ... OK TIME NEEDED: 139.87 Rating : 0.21 max weight: 39 336
+Unsatisfiable/GRP445-1.ma ... OK TIME NEEDED: 0.48 Rating : 0.00 max weight: 15 337
+Unsatisfiable/GRP446-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 max weight: 15 338
+Unsatisfiable/GRP447-1.ma ... OK TIME NEEDED: 1.11 Rating : 0.14 max weight: 16 339
+Unsatisfiable/GRP448-1.ma ... OK TIME NEEDED: 0.33 Rating : 0.00 max weight: 15 340
+Unsatisfiable/GRP449-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 max weight: 15 341
+Unsatisfiable/GRP450-1.ma ... OK TIME NEEDED: 1.05 Rating : 0.07 max weight: 16 342
+Unsatisfiable/GRP451-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 max weight: 14 343
+Unsatisfiable/GRP452-1.ma ... OK TIME NEEDED: 1.64 Rating : 0.14 max weight: 21 344
+Unsatisfiable/GRP453-1.ma ... OK TIME NEEDED: 2.88 Rating : 0.21 max weight: 26 345
+Unsatisfiable/GRP454-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 7 346
+Unsatisfiable/GRP455-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 15 347
+Unsatisfiable/GRP456-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.07 max weight: 17 348
+Unsatisfiable/GRP457-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 7 349
+Unsatisfiable/GRP458-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 max weight: 15 350
+Unsatisfiable/GRP459-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 max weight: 17 351
+Unsatisfiable/GRP460-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 7 352
+Unsatisfiable/GRP461-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 max weight: 15 353
+Unsatisfiable/GRP462-1.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 max weight: 16 354
+Unsatisfiable/GRP463-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 7 355
+Unsatisfiable/GRP464-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 max weight: 15 356
+Unsatisfiable/GRP465-1.ma ... OK TIME NEEDED: 0.40 Rating : 0.00 max weight: 16 357
+Unsatisfiable/GRP466-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 max weight: 19 358
+Unsatisfiable/GRP467-1.ma ... OK TIME NEEDED: 0.67 Rating : 0.00 max weight: 19 359
+Unsatisfiable/GRP468-1.ma ... OK TIME NEEDED: 1.07 Rating : 0.00 max weight: 19 360
+Unsatisfiable/GRP469-1.ma ... OK TIME NEEDED: 116.49 Rating : 0.21 max weight: 43 361
+Unsatisfiable/GRP470-1.ma ... OK TIME NEEDED: 123.50 Rating : 0.21 max weight: 43 362
+Unsatisfiable/GRP471-1.ma ... OK TIME NEEDED: 48.37 Rating : 0.21 max weight: 38 363
+Unsatisfiable/GRP472-1.ma ... OK TIME NEEDED: 41.32 Rating : 0.07 max weight: 47 364
+Unsatisfiable/GRP473-1.ma ... OK TIME NEEDED: 37.76 Rating : 0.07 max weight: 47 365
+Unsatisfiable/GRP474-1.ma ... OK TIME NEEDED: 53.59 Rating : 0.07 max weight: 48 366
+Unsatisfiable/GRP475-1.ma ... OK TIME NEEDED: 51.86 Rating : 0.21 max weight: 37 367
+Unsatisfiable/GRP476-1.ma ... OK TIME NEEDED: 37.80 Rating : 0.21 max weight: 37 368
+Unsatisfiable/GRP477-1.ma ... OK TIME NEEDED: 41.41 Rating : 0.21 max weight: 38 369
+Unsatisfiable/GRP478-1.ma ... OK TIME NEEDED: 18.96 Rating : 0.14 max weight: 32 370
+Unsatisfiable/GRP479-1.ma ... OK TIME NEEDED: 19.22 Rating : 0.14 max weight: 32 371
+Unsatisfiable/GRP480-1.ma ... OK TIME NEEDED: 21.92 Rating : 0.21 max weight: 33 372
+Unsatisfiable/GRP481-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 max weight: 20 373
+Unsatisfiable/GRP482-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 21 374
+Unsatisfiable/GRP483-1.ma ... OK TIME NEEDED: 1.16 Rating : 0.00 max weight: 22 375
+Unsatisfiable/GRP484-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 max weight: 16 376
+Unsatisfiable/GRP485-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 max weight: 17 377
+Unsatisfiable/GRP486-1.ma ... OK TIME NEEDED: 1.23 Rating : 0.00 max weight: 18 378
+Unsatisfiable/GRP487-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 max weight: 15 379
+Unsatisfiable/GRP488-1.ma ... OK TIME NEEDED: 1.17 Rating : 0.00 max weight: 15 380
+Unsatisfiable/GRP489-1.ma ... OK TIME NEEDED: 2.53 Rating : 0.00 max weight: 26 381
+Unsatisfiable/GRP490-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 max weight: 15 382
+Unsatisfiable/GRP491-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 max weight: 16 383
+Unsatisfiable/GRP492-1.ma ... OK TIME NEEDED: 0.36 Rating : 0.00 max weight: 17 384
+Unsatisfiable/GRP493-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 max weight: 16 385
+Unsatisfiable/GRP494-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 max weight: 17 386
+Unsatisfiable/GRP495-1.ma ... OK TIME NEEDED: 0.27 Rating : 0.00 max weight: 18 387
+Unsatisfiable/GRP496-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 max weight: 16 388
+Unsatisfiable/GRP497-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 max weight: 17 389
+Unsatisfiable/GRP498-1.ma ... OK TIME NEEDED: 0.46 Rating : 0.00 max weight: 18 390
+Unsatisfiable/GRP499-1.ma ... OK TIME NEEDED: 7.75 Rating : 0.00 max weight: 38 391
+Unsatisfiable/GRP500-1.ma ... OK TIME NEEDED: 4.26 Rating : 0.07 max weight: 38 392
+Unsatisfiable/GRP501-1.ma ... OK TIME NEEDED: 87.52 Rating : 0.14 max weight: 39 393
+Unsatisfiable/GRP502-1.ma ... OK TIME NEEDED: 161.64 Rating : 0.14 max weight: 42 394
+Unsatisfiable/GRP503-1.ma ... OK TIME NEEDED: 248.32 Rating : 0.14 max weight: 42 395
+Unsatisfiable/GRP504-1.ma ... OK TIME NEEDED: 247.37 Rating : 0.14 max weight: 43 396
+Unsatisfiable/GRP505-1.ma ... FAIL Rating : 0.50 397
+Unsatisfiable/GRP506-1.ma ... FAIL Rating : 0.64 398
+Unsatisfiable/GRP507-1.ma ... FAIL Rating : 0.57 399
+Unsatisfiable/GRP508-1.ma ... FAIL Rating : 0.57 400
+Unsatisfiable/GRP509-1.ma ... OK TIME NEEDED: 143.03 Rating : 0.00 max weight: 21 401
+Unsatisfiable/GRP510-1.ma ... OK TIME NEEDED: 0.78 Rating : 0.00 max weight: 21 402
+Unsatisfiable/GRP511-1.ma ... OK TIME NEEDED: 8.71 Rating : 0.00 max weight: 22 403
+Unsatisfiable/GRP512-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 max weight: 22 404
+Unsatisfiable/GRP513-1.ma ... OK TIME NEEDED: 57.79 Rating : 0.00 max weight: 16 405
+Unsatisfiable/GRP514-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 max weight: 16 406
+Unsatisfiable/GRP515-1.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 max weight: 17 407
+Unsatisfiable/GRP516-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 max weight: 17 408
+Unsatisfiable/GRP517-1.ma ... OK TIME NEEDED: 1.38 Rating : 0.00 max weight: 16 409
+Unsatisfiable/GRP518-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 max weight: 16 410
+Unsatisfiable/GRP519-1.ma ... OK TIME NEEDED: 0.46 Rating : 0.00 max weight: 17 411
+Unsatisfiable/GRP520-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 max weight: 17 412
+Unsatisfiable/GRP521-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 max weight: 11 413
+Unsatisfiable/GRP522-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 max weight: 12 414
+Unsatisfiable/GRP523-1.ma ... OK TIME NEEDED: 2.70 Rating : 0.00 max weight: 16 415
+Unsatisfiable/GRP524-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 max weight: 13 416
+Unsatisfiable/GRP525-1.ma ... OK TIME NEEDED: 0.14 Rating : 0.00 max weight: 10 417
+Unsatisfiable/GRP526-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 max weight: 10 418
+Unsatisfiable/GRP527-1.ma ... OK TIME NEEDED: 9.44 Rating : 0.00 max weight: 16 419
+Unsatisfiable/GRP528-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 max weight: 16 420
+Unsatisfiable/GRP529-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 max weight: 11 421
+Unsatisfiable/GRP530-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 max weight: 8 422
+Unsatisfiable/GRP531-1.ma ... OK TIME NEEDED: 2.91 Rating : 0.00 max weight: 16 423
+Unsatisfiable/GRP532-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 max weight: 11 424
+Unsatisfiable/GRP533-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 max weight: 7 425
+Unsatisfiable/GRP534-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 max weight: 11 426
+Unsatisfiable/GRP535-1.ma ... OK TIME NEEDED: 2.82 Rating : 0.00 max weight: 16 427
+Unsatisfiable/GRP536-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 max weight: 15 428
+Unsatisfiable/GRP537-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 max weight: 7 429
+Unsatisfiable/GRP538-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 max weight: 11 430
+Unsatisfiable/GRP539-1.ma ... OK TIME NEEDED: 2.45 Rating : 0.00 max weight: 17 431
+Unsatisfiable/GRP540-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 max weight: 11 432
+Unsatisfiable/GRP541-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 7 433
+Unsatisfiable/GRP542-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 max weight: 12 434
+Unsatisfiable/GRP543-1.ma ... OK TIME NEEDED: 0.67 Rating : 0.00 max weight: 16 435
+Unsatisfiable/GRP544-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 13 436
+Unsatisfiable/GRP545-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 7 437
+Unsatisfiable/GRP546-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 max weight: 12 438
+Unsatisfiable/GRP547-1.ma ... OK TIME NEEDED: 1.70 Rating : 0.00 max weight: 17 439
+Unsatisfiable/GRP548-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 max weight: 13 440
+Unsatisfiable/GRP549-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 7 441
+Unsatisfiable/GRP550-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.07 max weight: 12 442
+Unsatisfiable/GRP551-1.ma ... OK TIME NEEDED: 0.75 Rating : 0.00 max weight: 16 443
+Unsatisfiable/GRP552-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 max weight: 13 444
+Unsatisfiable/GRP553-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 max weight: 15 445
+Unsatisfiable/GRP554-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 max weight: 16 446
+Unsatisfiable/GRP555-1.ma ... OK TIME NEEDED: 1.03 Rating : 0.00 max weight: 19 447
+Unsatisfiable/GRP556-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 max weight: 15 448
+Unsatisfiable/GRP557-1.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 max weight: 15 449
+Unsatisfiable/GRP558-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 max weight: 15 450
+Unsatisfiable/GRP559-1.ma ... OK TIME NEEDED: 3.08 Rating : 0.00 max weight: 16 451
+Unsatisfiable/GRP560-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 max weight: 15 452
+Unsatisfiable/GRP561-1.ma ... OK TIME NEEDED: 0.14 Rating : 0.00 max weight: 17 453
+Unsatisfiable/GRP562-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 max weight: 16 454
+Unsatisfiable/GRP563-1.ma ... OK TIME NEEDED: 6.03 Rating : 0.00 max weight: 17 455
+Unsatisfiable/GRP564-1.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 max weight: 17 456
+Unsatisfiable/GRP565-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 max weight: 16 457
+Unsatisfiable/GRP566-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 max weight: 17 458
+Unsatisfiable/GRP567-1.ma ... OK TIME NEEDED: 28.20 Rating : 0.14 max weight: 27 459
+Unsatisfiable/GRP568-1.ma ... OK TIME NEEDED: 0.36 Rating : 0.14 max weight: 27 460
+Unsatisfiable/GRP569-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 max weight: 16 461
+Unsatisfiable/GRP570-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 max weight: 17 462
+Unsatisfiable/GRP571-1.ma ... OK TIME NEEDED: 26.98 Rating : 0.14 max weight: 25 463
+Unsatisfiable/GRP572-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.07 max weight: 18 464
+Unsatisfiable/GRP573-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 max weight: 16 465
+Unsatisfiable/GRP574-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 max weight: 19 466
+Unsatisfiable/GRP575-1.ma ... OK TIME NEEDED: 46.52 Rating : 0.14 max weight: 25 467
+Unsatisfiable/GRP576-1.ma ... OK TIME NEEDED: 0.35 Rating : 0.00 max weight: 25 468
+Unsatisfiable/GRP577-1.ma ... OK TIME NEEDED: 0.21 Rating : 0.00 max weight: 16 469
+Unsatisfiable/GRP578-1.ma ... OK TIME NEEDED: 0.43 Rating : 0.00 max weight: 17 470
+Unsatisfiable/GRP579-1.ma ... OK TIME NEEDED: 1.66 Rating : 0.07 max weight: 25 471
+Unsatisfiable/GRP580-1.ma ... OK TIME NEEDED: 0.46 Rating : 0.00 max weight: 25 472
+Unsatisfiable/GRP581-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 max weight: 16 473
+Unsatisfiable/GRP582-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.00 max weight: 17 474
+Unsatisfiable/GRP583-1.ma ... OK TIME NEEDED: 2.94 Rating : 0.07 max weight: 19 475
+Unsatisfiable/GRP584-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 max weight: 18 476
+Unsatisfiable/GRP585-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 max weight: 19 477
+Unsatisfiable/GRP586-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 max weight: 19 478
+Unsatisfiable/GRP587-1.ma ... FAIL Rating : 0.00 479
+Unsatisfiable/GRP588-1.ma ... OK TIME NEEDED: 1.47 Rating : 0.00 max weight: 20 480
+Unsatisfiable/GRP589-1.ma ... OK TIME NEEDED: 0.50 Rating : 0.00 max weight: 19 481
+Unsatisfiable/GRP590-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 max weight: 19 482
+Unsatisfiable/GRP591-1.ma ... OK TIME NEEDED: 0.64 Rating : 0.07 max weight: 20 483
+Unsatisfiable/GRP592-1.ma ... OK TIME NEEDED: 0.28 Rating : 0.07 max weight: 20 484
+Unsatisfiable/GRP593-1.ma ... OK TIME NEEDED: 2.56 Rating : 0.00 max weight: 16 485
+Unsatisfiable/GRP594-1.ma ... OK TIME NEEDED: 1.16 Rating : 0.00 max weight: 16 486
+Unsatisfiable/GRP595-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.07 max weight: 16 487
+Unsatisfiable/GRP596-1.ma ... OK TIME NEEDED: 0.29 Rating : 0.07 max weight: 16 488
+Unsatisfiable/GRP597-1.ma ... OK TIME NEEDED: 0.62 Rating : 0.00 max weight: 20 489
+Unsatisfiable/GRP598-1.ma ... OK TIME NEEDED: 0.28 Rating : 0.07 max weight: 20 490
+Unsatisfiable/GRP599-1.ma ... OK TIME NEEDED: 2.33 Rating : 0.07 max weight: 21 491
+Unsatisfiable/GRP600-1.ma ... OK TIME NEEDED: 0.36 Rating : 0.07 max weight: 21 492
+Unsatisfiable/GRP601-1.ma ... OK TIME NEEDED: 3.56 Rating : 0.07 max weight: 15 493
+Unsatisfiable/GRP602-1.ma ... OK TIME NEEDED: 0.44 Rating : 0.07 max weight: 16 494
+Unsatisfiable/GRP603-1.ma ... OK TIME NEEDED: 0.56 Rating : 0.07 max weight: 16 495
+Unsatisfiable/GRP604-1.ma ... OK TIME NEEDED: 0.77 Rating : 0.07 max weight: 15 496
+Unsatisfiable/GRP605-1.ma ... OK TIME NEEDED: 1.75 Rating : 0.00 max weight: 19 497
+Unsatisfiable/GRP606-1.ma ... OK TIME NEEDED: 1.62 Rating : 0.00 max weight: 19 498
+Unsatisfiable/GRP607-1.ma ... FAIL Rating : 0.00 499
+Unsatisfiable/GRP608-1.ma ... OK TIME NEEDED: 2.11 Rating : 0.00 max weight: 22 500
+Unsatisfiable/GRP609-1.ma ... OK TIME NEEDED: 2.03 Rating : 0.07 max weight: 15 501
+Unsatisfiable/GRP610-1.ma ... OK TIME NEEDED: 0.50 Rating : 0.07 max weight: 15 502
+Unsatisfiable/GRP611-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 max weight: 16 503
+Unsatisfiable/GRP612-1.ma ... OK TIME NEEDED: 0.32 Rating : 0.07 max weight: 16 504
+Unsatisfiable/GRP613-1.ma ... OK TIME NEEDED: 0.78 Rating : 0.00 max weight: 20 505
+Unsatisfiable/GRP614-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.00 max weight: 20 506
+Unsatisfiable/GRP615-1.ma ... OK TIME NEEDED: 1.73 Rating : 0.07 max weight: 21 507
+Unsatisfiable/GRP616-1.ma ... OK TIME NEEDED: 0.32 Rating : 0.00 max weight: 21 508
+Unsatisfiable/LAT006-1.ma ... OK TIME NEEDED: 38.21 Rating : 0.14 max weight: 20 509
+Unsatisfiable/LAT007-1.ma ... OK TIME NEEDED: 97.83 Rating : 0.36 max weight: 19 510
+Unsatisfiable/LAT008-1.ma ... OK TIME NEEDED: 0.82 Rating : 0.07 max weight: 12 511
+Unsatisfiable/LAT009-1.ma ... OK TIME NEEDED: 341.28 Rating : 0.00 max weight: 23 512
+Unsatisfiable/LAT010-1.ma ... FAIL Rating : 0.00 513
+Unsatisfiable/LAT011-1.ma ... FAIL Rating : 0.07 514
+Unsatisfiable/LAT012-1.ma ... OK TIME NEEDED: 4.82 Rating : 0.00 max weight: 14 515
+Unsatisfiable/LAT013-1.ma ... OK TIME NEEDED: 90.79 Rating : 0.14 max weight: 18 516
+Unsatisfiable/LAT014-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 6 517
+Unsatisfiable/LAT017-1.ma ... FAIL Rating : 0.71 518
+Unsatisfiable/LAT018-1.ma ... FAIL Rating : 0.93 519
+Unsatisfiable/LAT019-1.ma ... FAIL Rating : 0.00 520
+Unsatisfiable/LAT020-1.ma ... FAIL Rating : 0.50 521
+Unsatisfiable/LAT021-1.ma ... FAIL Rating : 0.00 522
+Unsatisfiable/LAT022-1.ma ... FAIL Rating : 0.21 523
+Unsatisfiable/LAT023-1.ma ... FAIL Rating : 0.21 524
+Unsatisfiable/LAT026-1.ma ... OK TIME NEEDED: 20.28 Rating : 0.14 max weight: 16 525
+Unsatisfiable/LAT027-1.ma ... OK TIME NEEDED: 13.64 Rating : 0.07 max weight: 16 526
+Unsatisfiable/LAT028-1.ma ... OK TIME NEEDED: 17.73 Rating : 0.00 max weight: 12 527
+Unsatisfiable/LAT031-1.ma ... OK TIME NEEDED: 0.99 Rating : 0.00 max weight: 9 528
+Unsatisfiable/LAT032-1.ma ... OK TIME NEEDED: 27.63 Rating : 0.00 max weight: 9 529
+Unsatisfiable/LAT033-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 3 530
+Unsatisfiable/LAT034-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 3 531
+Unsatisfiable/LAT038-1.ma ... FAIL Rating : 0.43 532
+Unsatisfiable/LAT039-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 max weight: 6 533
+Unsatisfiable/LAT039-2.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 0 534
+Unsatisfiable/LAT040-1.ma ... OK TIME NEEDED: 36.21 Rating : 0.00 max weight: 11 535
+Unsatisfiable/LAT042-1.ma ... OK TIME NEEDED: 1.93 Rating : 0.00 max weight: 9 536
+Unsatisfiable/LAT043-1.ma ... OK TIME NEEDED: 158.67 Rating : 0.00 max weight: 18 537
+Unsatisfiable/LAT044-1.ma ... FAIL Rating : 0.14 538
+Unsatisfiable/LAT045-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.07 max weight: 18 539
+Unsatisfiable/LAT070-1.ma ... FAIL Rating : 0.93 540
+Unsatisfiable/LAT072-1.ma ... FAIL Rating : 1.00 541
+Unsatisfiable/LAT074-1.ma ... FAIL Rating : 1.00 542
+Unsatisfiable/LAT075-1.ma ... FAIL Rating : 1.00 543
+Unsatisfiable/LAT076-1.ma ... FAIL Rating : 1.00 544
+Unsatisfiable/LAT077-1.ma ... FAIL Rating : 1.00 545
+Unsatisfiable/LAT078-1.ma ... FAIL Rating : 1.00 546
+Unsatisfiable/LAT079-1.ma ... FAIL Rating : 1.00 547
+Unsatisfiable/LAT080-1.ma ... OK TIME NEEDED: 84.86 Rating : 0.36 max weight: 1061 548
+Unsatisfiable/LAT081-1.ma ... FAIL Rating : 0.57 549
+Unsatisfiable/LAT082-1.ma ... FAIL Rating : 0.64 550
+Unsatisfiable/LAT083-1.ma ... OK TIME NEEDED: 89.00 Rating : 0.36 max weight: 1061 551
+Unsatisfiable/LAT084-1.ma ... FAIL Rating : 0.50 552
+Unsatisfiable/LAT085-1.ma ... FAIL Rating : 0.57 553
+Unsatisfiable/LAT086-1.ma ... OK TIME NEEDED: 573.47 Rating : 0.50 max weight: 1060 554
+Unsatisfiable/LAT087-1.ma ... OK TIME NEEDED: 588.84 Rating : 0.43 max weight: 1060 555
+Unsatisfiable/LAT088-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 max weight: 16 556
+Unsatisfiable/LAT089-1.ma ... OK TIME NEEDED: 1.68 Rating : 0.00 max weight: 16 557
+Unsatisfiable/LAT090-1.ma ... OK TIME NEEDED: 0.14 Rating : 0.00 max weight: 16 558
+Unsatisfiable/LAT091-1.ma ... OK TIME NEEDED: 16.44 Rating : 0.07 max weight: 21 559
+Unsatisfiable/LAT092-1.ma ... OK TIME NEEDED: 82.68 Rating : 0.36 max weight: 991 560
+Unsatisfiable/LAT093-1.ma ... OK TIME NEEDED: 320.09 Rating : 0.43 max weight: 991 561
+Unsatisfiable/LAT094-1.ma ... OK TIME NEEDED: 97.53 Rating : 0.36 max weight: 991 562
+Unsatisfiable/LAT095-1.ma ... OK TIME NEEDED: 474.76 Rating : 0.43 max weight: 991 563
+Unsatisfiable/LAT096-1.ma ... OK TIME NEEDED: 162.98 Rating : 0.36 max weight: 990 564
+Unsatisfiable/LAT097-1.ma ... OK TIME NEEDED: 115.99 Rating : 0.36 max weight: 990 565
+Unsatisfiable/LAT138-1.ma ... FAIL Rating : 1.00 1
+Unsatisfiable/LAT139-1.ma ... FAIL Rating : 1.00 2
+Unsatisfiable/LAT140-1.ma ... FAIL Rating : 1.00 3
+Unsatisfiable/LAT141-1.ma ... FAIL Rating : 1.00 4
+Unsatisfiable/LAT142-1.ma ... FAIL Rating : 0.64 5
+Unsatisfiable/LAT143-1.ma ... FAIL Rating : 0.14 6
+Unsatisfiable/LAT144-1.ma ... FAIL Rating : 0.86 7
+Unsatisfiable/LAT145-1.ma ... FAIL Rating : 0.93 8
+Unsatisfiable/LAT146-1.ma ... FAIL Rating : 0.79 9
+Unsatisfiable/LAT147-1.ma ... FAIL Rating : 0.79 10
+Unsatisfiable/LAT148-1.ma ... FAIL Rating : 0.71 11
+Unsatisfiable/LAT149-1.ma ... FAIL Rating : 0.93 12
+Unsatisfiable/LAT150-1.ma ... FAIL Rating : 0.86 13
+Unsatisfiable/LAT151-1.ma ... FAIL Rating : 0.86 14
+Unsatisfiable/LAT152-1.ma ... FAIL Rating : 0.79 15
+Unsatisfiable/LAT153-1.ma ... FAIL Rating : 0.93 16
+Unsatisfiable/LAT154-1.ma ... FAIL Rating : 0.79 17
+Unsatisfiable/LAT155-1.ma ... FAIL Rating : 0.86 18
+Unsatisfiable/LAT156-1.ma ... FAIL Rating : 0.64 19
+Unsatisfiable/LAT157-1.ma ... FAIL Rating : 0.86 20
+Unsatisfiable/LAT158-1.ma ... FAIL Rating : 0.93 21
+Unsatisfiable/LAT159-1.ma ... FAIL Rating : 0.86 22
+Unsatisfiable/LAT160-1.ma ... FAIL Rating : 0.64 23
+Unsatisfiable/LAT161-1.ma ... FAIL Rating : 1.00 24
+Unsatisfiable/LAT162-1.ma ... FAIL Rating : 0.86 25
+Unsatisfiable/LAT163-1.ma ... FAIL Rating : 0.93 26
+Unsatisfiable/LAT164-1.ma ... FAIL Rating : 0.93 27
+Unsatisfiable/LAT165-1.ma ... FAIL Rating : 0.93 28
+Unsatisfiable/LAT166-1.ma ... FAIL Rating : 0.93 29
+Unsatisfiable/LAT167-1.ma ... FAIL Rating : 0.93 30
+Unsatisfiable/LAT168-1.ma ... OK TIME NEEDED: 190.30 Rating : 0.14 max weight: 16 31
+Unsatisfiable/LAT169-1.ma ... FAIL Rating : 0.86 32
+Unsatisfiable/LAT170-1.ma ... FAIL Rating : 0.79 33
+Unsatisfiable/LAT171-1.ma ... OK TIME NEEDED: 250.07 Rating : 0.50 max weight: 16 34
+Unsatisfiable/LAT172-1.ma ... FAIL Rating : 0.93 35
+Unsatisfiable/LAT173-1.ma ... FAIL Rating : 0.93 36
+Unsatisfiable/LAT174-1.ma ... FAIL Rating : 0.79 37
+Unsatisfiable/LAT175-1.ma ... FAIL Rating : 0.93 38
+Unsatisfiable/LAT176-1.ma ... FAIL Rating : 0.93 39
+Unsatisfiable/LAT177-1.ma ... FAIL Rating : 1.00 40
+Unsatisfiable/LCL109-2.ma ... FAIL Rating : 0.29 41
+Unsatisfiable/LCL109-6.ma ... FAIL Rating : 0.14 42
+Unsatisfiable/LCL110-2.ma ... OK TIME NEEDED: 1.67 Rating : 0.00 max weight: 12 43
+Unsatisfiable/LCL111-2.ma ... OK TIME NEEDED: 5.31 Rating : 0.07 max weight: 17 44
+Unsatisfiable/LCL112-2.ma ... OK TIME NEEDED: 1.81 Rating : 0.00 max weight: 14 45
+Unsatisfiable/LCL113-2.ma ... OK TIME NEEDED: 1.39 Rating : 0.00 max weight: 12 46
+Unsatisfiable/LCL114-2.ma ... OK TIME NEEDED: 1.90 Rating : 0.00 max weight: 12 47
+Unsatisfiable/LCL115-2.ma ... OK TIME NEEDED: 1.41 Rating : 0.00 max weight: 13 48
+Unsatisfiable/LCL116-2.ma ... OK TIME NEEDED: 5.72 Rating : 0.00 max weight: 13 49
+Unsatisfiable/LCL132-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 max weight: 9 50
+Unsatisfiable/LCL133-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 max weight: 11 51
+Unsatisfiable/LCL134-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 9 52
+Unsatisfiable/LCL135-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 max weight: 9 53
+Unsatisfiable/LCL138-1.ma ... FAIL Rating : 0.21 54
+Unsatisfiable/LCL139-1.ma ... OK TIME NEEDED: 1.81 Rating : 0.00 max weight: 12 55
+Unsatisfiable/LCL140-1.ma ... OK TIME NEEDED: 1.45 Rating : 0.00 max weight: 14 56
+Unsatisfiable/LCL141-1.ma ... OK TIME NEEDED: 2.09 Rating : 0.00 max weight: 14 57
+Unsatisfiable/LCL153-1.ma ... OK TIME NEEDED: 1.36 Rating : 0.00 max weight: 10 58
+Unsatisfiable/LCL154-1.ma ... OK TIME NEEDED: 10.65 Rating : 0.00 max weight: 12 59
+Unsatisfiable/LCL155-1.ma ... OK TIME NEEDED: 0.14 Rating : 0.00 max weight: 12 60
+Unsatisfiable/LCL156-1.ma ... OK TIME NEEDED: 1.38 Rating : 0.00 max weight: 11 61
+Unsatisfiable/LCL157-1.ma ... OK TIME NEEDED: 1.13 Rating : 0.00 max weight: 12 62
+Unsatisfiable/LCL158-1.ma ... OK TIME NEEDED: 1.87 Rating : 0.00 max weight: 15 63
+Unsatisfiable/LCL159-1.ma ... OK TIME NEEDED: 131.67 Rating : 0.00 max weight: 16 64
+Unsatisfiable/LCL160-1.ma ... FAIL Rating : 0.14 65
+Unsatisfiable/LCL161-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 max weight: 9 66
+Unsatisfiable/LCL162-1.ma ... FAIL Rating : 0.00 67
+Unsatisfiable/LCL163-1.ma ... OK TIME NEEDED: 10.10 Rating : 0.14 max weight: 34 68
+Unsatisfiable/LCL164-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 max weight: 12 69
+Unsatisfiable/LDA001-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 max weight: 7 70
+Unsatisfiable/LDA002-1.ma ... OK TIME NEEDED: 22.30 Rating : 0.00 max weight: 11 71
+Unsatisfiable/LDA007-3.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 max weight: 8 72
+Unsatisfiable/RNG007-4.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 max weight: 7 73
+Unsatisfiable/RNG008-3.ma ... OK TIME NEEDED: 17.75 Rating : 0.07 max weight: 17 74
+Unsatisfiable/RNG008-4.ma ... OK TIME NEEDED: 18.52 Rating : 0.07 max weight: 17 75
+Unsatisfiable/RNG008-7.ma ... OK TIME NEEDED: 47.63 Rating : 0.07 max weight: 22 76
+Unsatisfiable/RNG009-5.ma ... FAIL Rating : 0.50 77
+Unsatisfiable/RNG009-7.ma ... FAIL Rating : 0.50 78
+Unsatisfiable/RNG011-5.ma ... OK TIME NEEDED: 0.14 Rating : 0.00 max weight: 0 79
+Unsatisfiable/RNG012-6.ma ... OK TIME NEEDED: 114.29 Rating : 0.00 max weight: 12 80
+Unsatisfiable/RNG013-6.ma ... OK TIME NEEDED: 132.92 Rating : 0.00 max weight: 12 81
+Unsatisfiable/RNG014-6.ma ... OK TIME NEEDED: 145.08 Rating : 0.00 max weight: 12 82
+Unsatisfiable/RNG015-6.ma ... OK TIME NEEDED: 127.35 Rating : 0.00 max weight: 11 83
+Unsatisfiable/RNG016-6.ma ... OK TIME NEEDED: 133.38 Rating : 0.00 max weight: 11 84
+Unsatisfiable/RNG017-6.ma ... OK TIME NEEDED: 120.96 Rating : 0.00 max weight: 11 85
+Unsatisfiable/RNG018-6.ma ... OK TIME NEEDED: 116.44 Rating : 0.00 max weight: 11 86
+Unsatisfiable/RNG019-6.ma ... FAIL Rating : 0.21 87
+Unsatisfiable/RNG019-7.ma ... FAIL Rating : 0.21 88
+Unsatisfiable/RNG020-6.ma ... FAIL Rating : 0.29 89
+Unsatisfiable/RNG020-7.ma ... FAIL Rating : 0.21 90
+Unsatisfiable/RNG021-6.ma ... FAIL Rating : 0.14 91
+Unsatisfiable/RNG021-7.ma ... FAIL Rating : 0.21 92
+Unsatisfiable/RNG023-6.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 max weight: 15 93
+Unsatisfiable/RNG023-7.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 max weight: 15 94
+Unsatisfiable/RNG024-6.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 max weight: 15 95
+Unsatisfiable/RNG024-7.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 max weight: 15 96
+Unsatisfiable/RNG025-4.ma ... FAIL Rating : 0.29 97
+Unsatisfiable/RNG025-5.ma ... FAIL Rating : 0.36 98
+Unsatisfiable/RNG025-6.ma ... FAIL Rating : 0.29 99
+Unsatisfiable/RNG025-7.ma ... FAIL Rating : 0.43 100
+Unsatisfiable/RNG026-6.ma ... FAIL Rating : 0.57 101
+Unsatisfiable/RNG026-7.ma ... FAIL Rating : 0.50 102
+Unsatisfiable/RNG027-5.ma ... FAIL Rating : 0.86 103
+Unsatisfiable/RNG027-7.ma ... FAIL Rating : 0.86 104
+Unsatisfiable/RNG027-8.ma ... FAIL Rating : 0.86 105
+Unsatisfiable/RNG027-9.ma ... FAIL Rating : 0.86 106
+Unsatisfiable/RNG028-5.ma ... FAIL Rating : 0.86 107
+Unsatisfiable/RNG028-7.ma ... FAIL Rating : 0.86 108
+Unsatisfiable/RNG028-8.ma ... FAIL Rating : 0.86 109
+Unsatisfiable/RNG028-9.ma ... FAIL Rating : 0.86 110
+Unsatisfiable/RNG029-5.ma ... FAIL Rating : 0.86 111
+Unsatisfiable/RNG029-6.ma ... FAIL Rating : 0.86 112
+Unsatisfiable/RNG029-7.ma ... FAIL Rating : 0.86 113
+Unsatisfiable/RNG035-7.ma ... FAIL Rating : 0.86 114
+Unsatisfiable/ROB001-1.ma ... FAIL Rating : 1.00 115
+Unsatisfiable/ROB002-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 max weight: 10 116
+Unsatisfiable/ROB003-1.ma ... OK TIME NEEDED: 0.72 Rating : 0.00 max weight: 17 117
+Unsatisfiable/ROB004-1.ma ... OK TIME NEEDED: 66.26 Rating : 0.00 max weight: 22 118
+Unsatisfiable/ROB005-1.ma ... FAIL Rating : 0.07 119
+Unsatisfiable/ROB006-1.ma ... FAIL Rating : 0.86 120
+Unsatisfiable/ROB006-2.ma ... FAIL Rating : 0.86 121
+Unsatisfiable/ROB008-1.ma ... OK TIME NEEDED: 80.62 Rating : 0.00 max weight: 17 122
+Unsatisfiable/ROB009-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 max weight: 18 123
+Unsatisfiable/ROB010-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 max weight: 7 124
+Unsatisfiable/ROB013-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 max weight: 8 125
+Unsatisfiable/ROB022-1.ma ... FAIL Rating : 0.00 126
+Unsatisfiable/ROB023-1.ma ... FAIL Rating : 0.00 127
+Unsatisfiable/ROB026-1.ma ... FAIL Rating : 0.86 128
+Unsatisfiable/ROB030-1.ma ... OK TIME NEEDED: 0.44 Rating : 0.00 max weight: 5 129
+Unsatisfiable/ROB031-1.ma ... FAIL Rating : 1.00 130
+Unsatisfiable/ROB032-1.ma ... FAIL Rating : 1.00 131
+Unsatisfiable/SYN080-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 132
+Unsatisfiable/SYN083-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 max weight: 0 133
diff --git a/matita/tests/TPTP/log.600.22-7.matitaprover.txt b/matita/tests/TPTP/log.600.22-7.matitaprover.txt
new file mode 100644 (file)
index 0000000..55af0be
--- /dev/null
@@ -0,0 +1,698 @@
+Unsatisfiable/ALG005-1.ma ... OK TIME NEEDED: 60.58 Rating : 0.07 1
+Unsatisfiable/ALG006-1.ma ... OK TIME NEEDED: 6.72 Rating : 0.00 2
+Unsatisfiable/ALG007-1.ma ... OK TIME NEEDED: 7.72 Rating : 0.00 3
+Unsatisfiable/BOO001-1.ma ... OK TIME NEEDED: 0.39 Rating : 0.00 4
+Unsatisfiable/BOO002-1.ma ... OK TIME NEEDED: 6.11 Rating : 0.07 5
+Unsatisfiable/BOO002-2.ma ... OK TIME NEEDED: 8.29 Rating : 0.00 6
+Unsatisfiable/BOO003-2.ma ... OK TIME NEEDED: 0.45 Rating : 0.00 7
+Unsatisfiable/BOO003-4.ma ... OK TIME NEEDED: 0.33 Rating : 0.00 8
+Unsatisfiable/BOO004-2.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 9
+Unsatisfiable/BOO004-4.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 10
+Unsatisfiable/BOO005-2.ma ... OK TIME NEEDED: 0.22 Rating : 0.00 11
+Unsatisfiable/BOO005-4.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 12
+Unsatisfiable/BOO006-2.ma ... OK TIME NEEDED: 0.78 Rating : 0.00 13
+Unsatisfiable/BOO006-4.ma ... OK TIME NEEDED: 0.50 Rating : 0.00 14
+Unsatisfiable/BOO007-2.ma ... OK TIME NEEDED: 24.97 Rating : 0.14 15
+Unsatisfiable/BOO007-4.ma ... OK TIME NEEDED: 25.19 Rating : 0.07 16
+Unsatisfiable/BOO008-2.ma ... OK TIME NEEDED: 19.00 Rating : 0.07 17
+Unsatisfiable/BOO008-4.ma ... OK TIME NEEDED: 120.05 Rating : 0.00 18
+Unsatisfiable/BOO009-2.ma ... OK TIME NEEDED: 0.79 Rating : 0.00 19
+Unsatisfiable/BOO009-4.ma ... OK TIME NEEDED: 0.22 Rating : 0.00 20
+Unsatisfiable/BOO010-2.ma ... OK TIME NEEDED: 0.89 Rating : 0.00 21
+Unsatisfiable/BOO010-4.ma ... OK TIME NEEDED: 0.20 Rating : 0.00 22
+Unsatisfiable/BOO011-2.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 23
+Unsatisfiable/BOO011-4.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 24
+Unsatisfiable/BOO012-2.ma ... OK TIME NEEDED: 0.33 Rating : 0.00 25
+Unsatisfiable/BOO012-4.ma ... OK TIME NEEDED: 1.51 Rating : 0.00 26
+Unsatisfiable/BOO013-2.ma ... OK TIME NEEDED: 0.28 Rating : 0.00 27
+Unsatisfiable/BOO013-4.ma ... OK TIME NEEDED: 1.83 Rating : 0.00 28
+Unsatisfiable/BOO014-2.ma ... OK TIME NEEDED: 14.38 Rating : 0.00 29
+Unsatisfiable/BOO014-4.ma ... OK TIME NEEDED: 79.66 Rating : 0.00 30
+Unsatisfiable/BOO015-2.ma ... OK TIME NEEDED: 14.37 Rating : 0.00 31
+Unsatisfiable/BOO015-4.ma ... OK TIME NEEDED: 86.79 Rating : 0.00 32
+Unsatisfiable/BOO016-2.ma ... OK TIME NEEDED: 0.58 Rating : 0.00 33
+Unsatisfiable/BOO017-2.ma ... OK TIME NEEDED: 1.16 Rating : 0.00 34
+Unsatisfiable/BOO018-4.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 35
+Unsatisfiable/BOO021-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.07 36
+Unsatisfiable/BOO022-1.ma ... OK TIME NEEDED: 68.81 Rating : 0.07 37
+Unsatisfiable/BOO023-1.ma ... OK TIME NEEDED: 118.79 Rating : 0.50 38
+Unsatisfiable/BOO024-1.ma ... OK TIME NEEDED: 11.78 Rating : 0.00 39
+Unsatisfiable/BOO025-1.ma ... OK Rating : 0.07 40
+Unsatisfiable/BOO026-1.ma ... OK TIME NEEDED: 12.75 Rating : 0.07 41
+Unsatisfiable/BOO028-1.ma ... FAIL Rating : 0.07 42
+Unsatisfiable/BOO029-1.ma ... OK TIME NEEDED: 12.91 Rating : 0.00 43
+Unsatisfiable/BOO031-1.ma ... FAIL Rating : 0.21 44
+Unsatisfiable/BOO034-1.ma ... OK TIME NEEDED: 0.58 Rating : 0.21 45
+Unsatisfiable/BOO067-1.ma ... FAIL Rating : 0.21 46
+Unsatisfiable/BOO068-1.ma ... OK TIME NEEDED: 2.33 Rating : 0.00 47
+Unsatisfiable/BOO069-1.ma ... OK TIME NEEDED: 2.38 Rating : 0.00 48
+Unsatisfiable/BOO070-1.ma ... OK TIME NEEDED: 2.33 Rating : 0.00 49
+Unsatisfiable/BOO071-1.ma ... OK TIME NEEDED: 2.20 Rating : 0.00 50
+Unsatisfiable/BOO072-1.ma ... OK Rating : 0.07 51
+Unsatisfiable/BOO073-1.ma ... FAIL Rating : 0.36 52
+Unsatisfiable/BOO074-1.ma ... OK Rating : 0.07 53
+Unsatisfiable/BOO075-1.ma ... OK TIME NEEDED: 2.70 Rating : 0.00 54
+Unsatisfiable/BOO076-1.ma ... FAIL Rating : 0.71 55
+Unsatisfiable/COL001-1.ma ... OK TIME NEEDED: 300.01 Rating : 0.07 56
+Unsatisfiable/COL001-2.ma ... OK TIME NEEDED: 2.94 Rating : 0.07 57
+Unsatisfiable/COL002-1.ma ... OK TIME NEEDED: 2.91 Rating : 0.00 58
+Unsatisfiable/COL002-4.ma ... FAIL Rating : 0.07 59
+Unsatisfiable/COL002-5.ma ... FAIL Rating : 0.43 60
+Unsatisfiable/COL003-1.ma ... FAIL Rating : 0.79 61
+Unsatisfiable/COL004-1.ma ... FAIL Rating : 0.57 62
+Unsatisfiable/COL004-3.ma ... OK TIME NEEDED: 0.01 Rating : 0.21 63
+Unsatisfiable/COL006-1.ma ... FAIL Rating : 0.57 64
+Unsatisfiable/COL006-5.ma ... FAIL Rating : 0.64 65
+Unsatisfiable/COL006-6.ma ... FAIL Rating : 0.64 66
+Unsatisfiable/COL006-7.ma ... FAIL Rating : 0.64 67
+Unsatisfiable/COL007-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 68
+Unsatisfiable/COL008-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 69
+Unsatisfiable/COL009-1.ma ... OK TIME NEEDED: 2.99 Rating : 0.07 70
+Unsatisfiable/COL010-1.ma ... OK TIME NEEDED: 1.29 Rating : 0.07 71
+Unsatisfiable/COL011-1.ma ... FAIL Rating : 0.36 72
+Unsatisfiable/COL012-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 73
+Unsatisfiable/COL013-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 74
+Unsatisfiable/COL014-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 75
+Unsatisfiable/COL015-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 76
+Unsatisfiable/COL016-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 77
+Unsatisfiable/COL017-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 78
+Unsatisfiable/COL018-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 79
+Unsatisfiable/COL019-1.ma ... OK TIME NEEDED: 1.42 Rating : 0.00 80
+Unsatisfiable/COL020-1.ma ... FAIL Rating : 0.07 81
+Unsatisfiable/COL021-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 82
+Unsatisfiable/COL022-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 83
+Unsatisfiable/COL023-1.ma ... FAIL Rating : 0.00 84
+Unsatisfiable/COL024-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 85
+Unsatisfiable/COL025-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 86
+Unsatisfiable/COL026-1.ma ... FAIL Rating : 0.07 87
+Unsatisfiable/COL027-1.ma ... FAIL Rating : 0.00 88
+Unsatisfiable/COL029-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 89
+Unsatisfiable/COL030-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.14 90
+Unsatisfiable/COL031-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 91
+Unsatisfiable/COL032-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.14 92
+Unsatisfiable/COL033-1.ma ... OK TIME NEEDED: 3.99 Rating : 0.07 93
+Unsatisfiable/COL034-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.43 94
+Unsatisfiable/COL035-1.ma ... FAIL Rating : 0.14 95
+Unsatisfiable/COL036-1.ma ... FAIL Rating : 0.57 96
+Unsatisfiable/COL037-1.ma ... FAIL Rating : 0.29 97
+Unsatisfiable/COL038-1.ma ... FAIL Rating : 0.64 98
+Unsatisfiable/COL039-1.ma ... OK TIME NEEDED: 4.96 Rating : 0.00 99
+Unsatisfiable/COL041-1.ma ... OK TIME NEEDED: 0.47 Rating : 0.36 100
+Unsatisfiable/COL042-1.ma ... FAIL Rating : 0.86 101
+Unsatisfiable/COL042-6.ma ... FAIL Rating : 0.14 102
+Unsatisfiable/COL042-7.ma ... FAIL Rating : 0.14 103
+Unsatisfiable/COL042-8.ma ... FAIL Rating : 0.14 104
+Unsatisfiable/COL042-9.ma ... FAIL Rating : 0.14 105
+Unsatisfiable/COL043-1.ma ... FAIL Rating : 0.86 106
+Unsatisfiable/COL043-3.ma ... FAIL Rating : 0.71 107
+Unsatisfiable/COL044-1.ma ... FAIL Rating : 0.21 108
+Unsatisfiable/COL044-6.ma ... FAIL Rating : 0.64 109
+Unsatisfiable/COL044-7.ma ... FAIL Rating : 0.50 110
+Unsatisfiable/COL044-8.ma ... FAIL Rating : 0.71 111
+Unsatisfiable/COL044-9.ma ... FAIL Rating : 0.64 112
+Unsatisfiable/COL045-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 113
+Unsatisfiable/COL046-1.ma ... FAIL Rating : 0.64 114
+Unsatisfiable/COL048-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 115
+Unsatisfiable/COL049-1.ma ... OK TIME NEEDED: 3.59 Rating : 0.29 116
+Unsatisfiable/COL050-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 117
+Unsatisfiable/COL051-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 118
+Unsatisfiable/COL052-1.ma ... FAIL Rating : 0.00 119
+Unsatisfiable/COL053-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 120
+Unsatisfiable/COL056-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.07 121
+Unsatisfiable/COL057-1.ma ... FAIL Rating : 0.36 122
+Unsatisfiable/COL058-1.ma ... OK TIME NEEDED: 0.27 Rating : 0.00 123
+Unsatisfiable/COL058-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 124
+Unsatisfiable/COL058-3.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 125
+Unsatisfiable/COL059-1.ma ... FAIL Rating : 0.00 126
+Unsatisfiable/COL060-1.ma ... OK TIME NEEDED: 18.55 Rating : 0.36 127
+Unsatisfiable/COL060-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 128
+Unsatisfiable/COL060-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 129
+Unsatisfiable/COL061-1.ma ... OK TIME NEEDED: 399.77 Rating : 0.36 130
+Unsatisfiable/COL061-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 131
+Unsatisfiable/COL061-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 132
+Unsatisfiable/COL062-1.ma ... FAIL Rating : 0.50 133
+Unsatisfiable/COL062-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 134
+Unsatisfiable/COL062-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 135
+Unsatisfiable/COL063-1.ma ... FAIL Rating : 0.50 136
+Unsatisfiable/COL063-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 137
+Unsatisfiable/COL063-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 138
+Unsatisfiable/COL063-4.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 139
+Unsatisfiable/COL063-5.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 140
+Unsatisfiable/COL063-6.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 141
+Unsatisfiable/COL064-1.ma ... FAIL Rating : 0.64 142
+Unsatisfiable/COL064-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 143
+Unsatisfiable/COL064-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 144
+Unsatisfiable/COL064-4.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 145
+Unsatisfiable/COL064-5.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 146
+Unsatisfiable/COL064-6.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 147
+Unsatisfiable/COL064-7.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 148
+Unsatisfiable/COL064-8.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 149
+Unsatisfiable/COL064-9.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 150
+Unsatisfiable/COL065-1.ma ... FAIL Rating : 0.71 151
+Unsatisfiable/COL066-1.ma ... FAIL Rating : 0.93 152
+Unsatisfiable/COL066-2.ma ... OK TIME NEEDED: 1.72 Rating : 0.00 153
+Unsatisfiable/COL066-3.ma ... OK TIME NEEDED: 1.52 Rating : 0.00 154
+Unsatisfiable/COL070-1.ma ... FAIL Rating : 0.07 155
+Unsatisfiable/COL075-2.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 156
+Unsatisfiable/COL083-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 157
+Unsatisfiable/COL084-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 158
+Unsatisfiable/COL085-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 159
+Unsatisfiable/COL086-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 160
+Unsatisfiable/GRP001-2.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 161
+Unsatisfiable/GRP001-4.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 162
+Unsatisfiable/GRP002-2.ma ... OK TIME NEEDED: 20.39 Rating : 0.00 163
+Unsatisfiable/GRP002-3.ma ... OK TIME NEEDED: 247.62 Rating : 0.00 164
+Unsatisfiable/GRP002-4.ma ... OK TIME NEEDED: 57.39 Rating : 0.00 165
+Unsatisfiable/GRP010-4.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 166
+Unsatisfiable/GRP011-4.ma ... OK TIME NEEDED: 0.22 Rating : 0.00 167
+Unsatisfiable/GRP012-4.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 168
+Unsatisfiable/GRP014-1.ma ... OK TIME NEEDED: 42.92 Rating : 0.14 169
+Unsatisfiable/GRP022-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 170
+Unsatisfiable/GRP023-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 171
+Unsatisfiable/GRP024-5.ma ... FAIL Rating : 0.50 172
+Unsatisfiable/GRP114-1.ma ... OK TIME NEEDED: 144.40 Rating : 0.29 173
+Unsatisfiable/GRP115-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 174
+Unsatisfiable/GRP116-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 175
+Unsatisfiable/GRP117-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 176
+Unsatisfiable/GRP118-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 177
+Unsatisfiable/GRP119-1.ma ... OK TIME NEEDED: 36.03 Rating : 0.00 178
+Unsatisfiable/GRP120-1.ma ... OK TIME NEEDED: 35.79 Rating : 0.00 179
+Unsatisfiable/GRP121-1.ma ... OK TIME NEEDED: 36.76 Rating : 0.00 180
+Unsatisfiable/GRP122-1.ma ... OK TIME NEEDED: 32.81 Rating : 0.07 181
+Unsatisfiable/GRP136-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 182
+Unsatisfiable/GRP137-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 183
+Unsatisfiable/GRP138-1.ma ... OK TIME NEEDED: 3.41 Rating : 0.00 184
+Unsatisfiable/GRP139-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 185
+Unsatisfiable/GRP140-1.ma ... OK TIME NEEDED: 1.90 Rating : 0.00 186
+Unsatisfiable/GRP141-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 187
+Unsatisfiable/GRP142-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 188
+Unsatisfiable/GRP143-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 189
+Unsatisfiable/GRP144-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 190
+Unsatisfiable/GRP145-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 191
+Unsatisfiable/GRP146-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 192
+Unsatisfiable/GRP147-1.ma ... OK TIME NEEDED: 2.99 Rating : 0.00 193
+Unsatisfiable/GRP148-1.ma ... OK TIME NEEDED: 2.34 Rating : 0.00 194
+Unsatisfiable/GRP149-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 195
+Unsatisfiable/GRP150-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 196
+Unsatisfiable/GRP151-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 197
+Unsatisfiable/GRP152-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 198
+Unsatisfiable/GRP153-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 199
+Unsatisfiable/GRP154-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 200
+Unsatisfiable/GRP155-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 201
+Unsatisfiable/GRP156-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 202
+Unsatisfiable/GRP157-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 203
+Unsatisfiable/GRP158-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 204
+Unsatisfiable/GRP159-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 205
+Unsatisfiable/GRP160-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 206
+Unsatisfiable/GRP161-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 207
+Unsatisfiable/GRP162-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 208
+Unsatisfiable/GRP163-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 209
+Unsatisfiable/GRP164-1.ma ... FAIL Rating : 0.93 210
+Unsatisfiable/GRP164-2.ma ... FAIL Rating : 0.93 211
+Unsatisfiable/GRP165-1.ma ... OK TIME NEEDED: 44.08 Rating : 0.00 212
+Unsatisfiable/GRP165-2.ma ... OK TIME NEEDED: 41.33 Rating : 0.00 213
+Unsatisfiable/GRP166-1.ma ... OK TIME NEEDED: 227.25 Rating : 0.00 214
+Unsatisfiable/GRP166-2.ma ... FAIL Rating : 0.00 215
+Unsatisfiable/GRP166-3.ma ... OK TIME NEEDED: 58.07 Rating : 0.00 216
+Unsatisfiable/GRP166-4.ma ... OK TIME NEEDED: 44.12 Rating : 0.00 217
+Unsatisfiable/GRP167-1.ma ... OK TIME NEEDED: 103.91 Rating : 0.21 218
+Unsatisfiable/GRP167-2.ma ... OK TIME NEEDED: 231.00 Rating : 0.21 219
+Unsatisfiable/GRP167-3.ma ... OK TIME NEEDED: 277.91 Rating : 0.50 220
+Unsatisfiable/GRP167-4.ma ... OK TIME NEEDED: 231.05 Rating : 0.43 221
+Unsatisfiable/GRP167-5.ma ... OK TIME NEEDED: 13.09 Rating : 0.14 222
+Unsatisfiable/GRP168-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.07 223
+Unsatisfiable/GRP168-2.ma ... OK TIME NEEDED: 0.08 Rating : 0.07 224
+Unsatisfiable/GRP169-1.ma ... OK TIME NEEDED: 98.75 Rating : 0.00 225
+Unsatisfiable/GRP169-2.ma ... OK TIME NEEDED: 83.51 Rating : 0.00 226
+Unsatisfiable/GRP170-1.ma ... OK TIME NEEDED: 271.19 Rating : 0.00 227
+Unsatisfiable/GRP170-2.ma ... OK TIME NEEDED: 280.78 Rating : 0.00 228
+Unsatisfiable/GRP170-3.ma ... OK TIME NEEDED: 269.19 Rating : 0.00 229
+Unsatisfiable/GRP170-4.ma ... OK TIME NEEDED: 255.33 Rating : 0.00 230
+Unsatisfiable/GRP171-1.ma ... OK TIME NEEDED: 5.77 Rating : 0.00 231
+Unsatisfiable/GRP171-2.ma ... OK TIME NEEDED: 5.81 Rating : 0.00 232
+Unsatisfiable/GRP172-1.ma ... OK TIME NEEDED: 6.69 Rating : 0.00 233
+Unsatisfiable/GRP172-2.ma ... OK TIME NEEDED: 5.56 Rating : 0.00 234
+Unsatisfiable/GRP173-1.ma ... OK TIME NEEDED: 15.93 Rating : 0.00 235
+Unsatisfiable/GRP174-1.ma ... OK TIME NEEDED: 17.29 Rating : 0.00 236
+Unsatisfiable/GRP175-1.ma ... OK TIME NEEDED: 32.33 Rating : 0.00 237
+Unsatisfiable/GRP175-2.ma ... OK TIME NEEDED: 28.07 Rating : 0.00 238
+Unsatisfiable/GRP175-3.ma ... OK TIME NEEDED: 27.67 Rating : 0.00 239
+Unsatisfiable/GRP175-4.ma ... OK TIME NEEDED: 28.30 Rating : 0.00 240
+Unsatisfiable/GRP176-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 241
+Unsatisfiable/GRP176-2.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 242
+Unsatisfiable/GRP177-2.ma ... FAIL Rating : 0.21 243
+Unsatisfiable/GRP178-1.ma ... OK TIME NEEDED: 233.57 Rating : 0.14 244
+Unsatisfiable/GRP178-2.ma ... OK TIME NEEDED: 250.74 Rating : 0.14 245
+Unsatisfiable/GRP179-1.ma ... FAIL Rating : 0.50 246
+Unsatisfiable/GRP179-2.ma ... FAIL Rating : 0.50 247
+Unsatisfiable/GRP179-3.ma ... FAIL Rating : 0.36 248
+Unsatisfiable/GRP180-1.ma ... FAIL Rating : 0.50 249
+Unsatisfiable/GRP180-2.ma ... FAIL Rating : 0.43 250
+Unsatisfiable/GRP181-1.ma ... FAIL Rating : 0.71 251
+Unsatisfiable/GRP181-2.ma ... FAIL Rating : 0.71 252
+Unsatisfiable/GRP181-3.ma ... OK TIME NEEDED: 439.23 Rating : 0.43 253
+Unsatisfiable/GRP181-4.ma ... FAIL Rating : 0.43 254
+Unsatisfiable/GRP182-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 255
+Unsatisfiable/GRP182-2.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 256
+Unsatisfiable/GRP182-3.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 257
+Unsatisfiable/GRP182-4.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 258
+Unsatisfiable/GRP183-1.ma ... FAIL Rating : 0.43 259
+Unsatisfiable/GRP183-2.ma ... FAIL Rating : 0.43 260
+Unsatisfiable/GRP183-3.ma ... FAIL Rating : 0.43 261
+Unsatisfiable/GRP183-4.ma ... FAIL Rating : 0.36 262
+Unsatisfiable/GRP184-1.ma ... FAIL Rating : 0.29 263
+Unsatisfiable/GRP184-2.ma ... FAIL Rating : 0.14 264
+Unsatisfiable/GRP184-3.ma ... FAIL Rating : 0.21 265
+Unsatisfiable/GRP184-4.ma ... OK TIME NEEDED: 36.51 Rating : 0.00 266
+Unsatisfiable/GRP185-1.ma ... FAIL Rating : 0.07 267
+Unsatisfiable/GRP185-2.ma ... FAIL Rating : 0.07 268
+Unsatisfiable/GRP185-3.ma ... FAIL Rating : 0.21 269
+Unsatisfiable/GRP185-4.ma ... FAIL Rating : 0.21 270
+Unsatisfiable/GRP186-1.ma ... FAIL Rating : 0.57 271
+Unsatisfiable/GRP186-2.ma ... FAIL Rating : 0.36 272
+Unsatisfiable/GRP186-3.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 273
+Unsatisfiable/GRP186-4.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 274
+Unsatisfiable/GRP187-1.ma ... FAIL Rating : 0.64 275
+Unsatisfiable/GRP188-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 276
+Unsatisfiable/GRP188-2.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 277
+Unsatisfiable/GRP189-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 278
+Unsatisfiable/GRP189-2.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 279
+Unsatisfiable/GRP190-1.ma ... OK TIME NEEDED: 68.21 Rating : 0.00 280
+Unsatisfiable/GRP190-2.ma ... OK TIME NEEDED: 71.51 Rating : 0.00 281
+Unsatisfiable/GRP191-1.ma ... OK TIME NEEDED: 71.52 Rating : 0.00 282
+Unsatisfiable/GRP191-2.ma ... OK TIME NEEDED: 69.98 Rating : 0.00 283
+Unsatisfiable/GRP192-1.ma ... OK TIME NEEDED: 0.53 Rating : 0.07 284
+Unsatisfiable/GRP193-1.ma ... OK TIME NEEDED: 62.88 Rating : 0.00 285
+Unsatisfiable/GRP193-2.ma ... OK TIME NEEDED: 34.45 Rating : 0.00 286
+Unsatisfiable/GRP195-1.ma ... FAIL Rating : 0.00 287
+Unsatisfiable/GRP196-1.ma ... FAIL Rating : 0.93 288
+Unsatisfiable/GRP200-1.ma ... FAIL Rating : 0.29 289
+Unsatisfiable/GRP201-1.ma ... FAIL Rating : 0.36 290
+Unsatisfiable/GRP202-1.ma ... FAIL Rating : 0.43 291
+Unsatisfiable/GRP203-1.ma ... FAIL Rating : 0.21 292
+Unsatisfiable/GRP205-1.ma ... FAIL Rating : 0.43 293
+Unsatisfiable/GRP206-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 294
+Unsatisfiable/GRP403-1.ma ... OK TIME NEEDED: 7.71 Rating : 0.07 295
+Unsatisfiable/GRP404-1.ma ... OK TIME NEEDED: 48.03 Rating : 0.21 296
+Unsatisfiable/GRP405-1.ma ... OK TIME NEEDED: 33.76 Rating : 0.21 297
+Unsatisfiable/GRP406-1.ma ... OK TIME NEEDED: 115.24 Rating : 0.00 298
+Unsatisfiable/GRP407-1.ma ... OK TIME NEEDED: 203.15 Rating : 0.00 299
+Unsatisfiable/GRP408-1.ma ... OK TIME NEEDED: 185.74 Rating : 0.00 300
+Unsatisfiable/GRP409-1.ma ... OK TIME NEEDED: 5.80 Rating : 0.00 301
+Unsatisfiable/GRP410-1.ma ... OK TIME NEEDED: 17.87 Rating : 0.21 302
+Unsatisfiable/GRP411-1.ma ... OK TIME NEEDED: 15.05 Rating : 0.21 303
+Unsatisfiable/GRP412-1.ma ... OK TIME NEEDED: 12.22 Rating : 0.00 304
+Unsatisfiable/GRP413-1.ma ... OK TIME NEEDED: 76.05 Rating : 0.07 305
+Unsatisfiable/GRP414-1.ma ... OK TIME NEEDED: 44.29 Rating : 0.07 306
+Unsatisfiable/GRP415-1.ma ... OK TIME NEEDED: 289.89 Rating : 0.00 307
+Unsatisfiable/GRP416-1.ma ... OK TIME NEEDED: 333.94 Rating : 0.07 308
+Unsatisfiable/GRP417-1.ma ... OK TIME NEEDED: 316.20 Rating : 0.14 309
+Unsatisfiable/GRP418-1.ma ... FAIL Rating : 0.07 310
+Unsatisfiable/GRP419-1.ma ... FAIL Rating : 0.29 311
+Unsatisfiable/GRP420-1.ma ... FAIL Rating : 0.36 312
+Unsatisfiable/GRP421-1.ma ... OK TIME NEEDED: 2.87 Rating : 0.14 313
+Unsatisfiable/GRP422-1.ma ... OK TIME NEEDED: 125.31 Rating : 0.29 314
+Unsatisfiable/GRP423-1.ma ... OK TIME NEEDED: 65.32 Rating : 0.36 315
+Unsatisfiable/GRP424-1.ma ... OK Rating : 0.00 316
+Unsatisfiable/GRP425-1.ma ... OK TIME NEEDED: 10.25 Rating : 0.07 317
+Unsatisfiable/GRP426-1.ma ... OK TIME NEEDED: 14.80 Rating : 0.14 318
+Unsatisfiable/GRP427-1.ma ... OK TIME NEEDED: 30.56 Rating : 0.00 319
+Unsatisfiable/GRP428-1.ma ... OK TIME NEEDED: 29.91 Rating : 0.00 320
+Unsatisfiable/GRP429-1.ma ... OK TIME NEEDED: 40.97 Rating : 0.14 321
+Unsatisfiable/GRP430-1.ma ... OK TIME NEEDED: 14.65 Rating : 0.00 322
+Unsatisfiable/GRP431-1.ma ... OK TIME NEEDED: 14.00 Rating : 0.00 323
+Unsatisfiable/GRP432-1.ma ... OK TIME NEEDED: 15.86 Rating : 0.00 324
+Unsatisfiable/GRP433-1.ma ... OK TIME NEEDED: 4.88 Rating : 0.00 325
+Unsatisfiable/GRP434-1.ma ... OK TIME NEEDED: 4.53 Rating : 0.00 326
+Unsatisfiable/GRP435-1.ma ... OK TIME NEEDED: 6.37 Rating : 0.00 327
+Unsatisfiable/GRP436-1.ma ... OK TIME NEEDED: 27.85 Rating : 0.07 328
+Unsatisfiable/GRP437-1.ma ... OK TIME NEEDED: 26.92 Rating : 0.07 329
+Unsatisfiable/GRP438-1.ma ... OK TIME NEEDED: 30.30 Rating : 0.07 330
+Unsatisfiable/GRP439-1.ma ... OK TIME NEEDED: 8.41 Rating : 0.07 331
+Unsatisfiable/GRP440-1.ma ... OK TIME NEEDED: 23.50 Rating : 0.14 332
+Unsatisfiable/GRP441-1.ma ... OK Rating : 0.21 333
+Unsatisfiable/GRP442-1.ma ... OK TIME NEEDED: 137.33 Rating : 0.14 334
+Unsatisfiable/GRP443-1.ma ... OK TIME NEEDED: 134.07 Rating : 0.07 335
+Unsatisfiable/GRP444-1.ma ... OK TIME NEEDED: 140.12 Rating : 0.21 336
+Unsatisfiable/GRP445-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.00 337
+Unsatisfiable/GRP446-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 338
+Unsatisfiable/GRP447-1.ma ... OK TIME NEEDED: 0.63 Rating : 0.14 339
+Unsatisfiable/GRP448-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 340
+Unsatisfiable/GRP449-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 341
+Unsatisfiable/GRP450-1.ma ... OK TIME NEEDED: 0.65 Rating : 0.07 342
+Unsatisfiable/GRP451-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 343
+Unsatisfiable/GRP452-1.ma ... OK TIME NEEDED: 1.37 Rating : 0.14 344
+Unsatisfiable/GRP453-1.ma ... OK TIME NEEDED: 2.76 Rating : 0.21 345
+Unsatisfiable/GRP454-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 346
+Unsatisfiable/GRP455-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 347
+Unsatisfiable/GRP456-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.07 348
+Unsatisfiable/GRP457-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 349
+Unsatisfiable/GRP458-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 350
+Unsatisfiable/GRP459-1.ma ... OK TIME NEEDED: 0.22 Rating : 0.00 351
+Unsatisfiable/GRP460-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 352
+Unsatisfiable/GRP461-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 353
+Unsatisfiable/GRP462-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 354
+Unsatisfiable/GRP463-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 355
+Unsatisfiable/GRP464-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 356
+Unsatisfiable/GRP465-1.ma ... OK TIME NEEDED: 0.27 Rating : 0.00 357
+Unsatisfiable/GRP466-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 358
+Unsatisfiable/GRP467-1.ma ... OK TIME NEEDED: 0.54 Rating : 0.00 359
+Unsatisfiable/GRP468-1.ma ... OK TIME NEEDED: 0.91 Rating : 0.00 360
+Unsatisfiable/GRP469-1.ma ... OK TIME NEEDED: 106.10 Rating : 0.21 361
+Unsatisfiable/GRP470-1.ma ... OK TIME NEEDED: 107.84 Rating : 0.21 362
+Unsatisfiable/GRP471-1.ma ... OK TIME NEEDED: 44.87 Rating : 0.21 363
+Unsatisfiable/GRP472-1.ma ... OK TIME NEEDED: 28.53 Rating : 0.07 364
+Unsatisfiable/GRP473-1.ma ... OK TIME NEEDED: 22.65 Rating : 0.07 365
+Unsatisfiable/GRP474-1.ma ... OK TIME NEEDED: 39.85 Rating : 0.07 366
+Unsatisfiable/GRP475-1.ma ... OK TIME NEEDED: 34.63 Rating : 0.21 367
+Unsatisfiable/GRP476-1.ma ... OK TIME NEEDED: 33.88 Rating : 0.21 368
+Unsatisfiable/GRP477-1.ma ... OK TIME NEEDED: 31.40 Rating : 0.21 369
+Unsatisfiable/GRP478-1.ma ... OK TIME NEEDED: 17.74 Rating : 0.14 370
+Unsatisfiable/GRP479-1.ma ... OK TIME NEEDED: 16.79 Rating : 0.14 371
+Unsatisfiable/GRP480-1.ma ... OK TIME NEEDED: 17.76 Rating : 0.21 372
+Unsatisfiable/GRP481-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 373
+Unsatisfiable/GRP482-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 374
+Unsatisfiable/GRP483-1.ma ... OK TIME NEEDED: 0.70 Rating : 0.00 375
+Unsatisfiable/GRP484-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 376
+Unsatisfiable/GRP485-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 377
+Unsatisfiable/GRP486-1.ma ... OK TIME NEEDED: 0.97 Rating : 0.00 378
+Unsatisfiable/GRP487-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 379
+Unsatisfiable/GRP488-1.ma ... OK TIME NEEDED: 0.73 Rating : 0.00 380
+Unsatisfiable/GRP489-1.ma ... OK TIME NEEDED: 2.41 Rating : 0.00 381
+Unsatisfiable/GRP490-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 382
+Unsatisfiable/GRP491-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 383
+Unsatisfiable/GRP492-1.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 384
+Unsatisfiable/GRP493-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 385
+Unsatisfiable/GRP494-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 386
+Unsatisfiable/GRP495-1.ma ... OK TIME NEEDED: 0.22 Rating : 0.00 387
+Unsatisfiable/GRP496-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 388
+Unsatisfiable/GRP497-1.ma ... OK TIME NEEDED: 0.14 Rating : 0.00 389
+Unsatisfiable/GRP498-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 390
+Unsatisfiable/GRP499-1.ma ... OK TIME NEEDED: 6.90 Rating : 0.00 391
+Unsatisfiable/GRP500-1.ma ... OK Rating : 0.07 392
+Unsatisfiable/GRP501-1.ma ... OK TIME NEEDED: 75.21 Rating : 0.14 393
+Unsatisfiable/GRP502-1.ma ... OK TIME NEEDED: 127.74 Rating : 0.14 394
+Unsatisfiable/GRP503-1.ma ... OK TIME NEEDED: 195.81 Rating : 0.14 395
+Unsatisfiable/GRP504-1.ma ... OK TIME NEEDED: 207.94 Rating : 0.14 396
+Unsatisfiable/GRP505-1.ma ... FAIL Rating : 0.50 397
+Unsatisfiable/GRP506-1.ma ... FAIL Rating : 0.64 398
+Unsatisfiable/GRP507-1.ma ... FAIL Rating : 0.57 399
+Unsatisfiable/GRP508-1.ma ... FAIL Rating : 0.57 400
+Unsatisfiable/GRP509-1.ma ... OK TIME NEEDED: 143.40 Rating : 0.00 401
+Unsatisfiable/GRP510-1.ma ... OK TIME NEEDED: 0.48 Rating : 0.00 402
+Unsatisfiable/GRP511-1.ma ... OK TIME NEEDED: 6.28 Rating : 0.00 403
+Unsatisfiable/GRP512-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 404
+Unsatisfiable/GRP513-1.ma ... OK TIME NEEDED: 40.80 Rating : 0.00 405
+Unsatisfiable/GRP514-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 406
+Unsatisfiable/GRP515-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 407
+Unsatisfiable/GRP516-1.ma ... OK TIME NEEDED: 0.14 Rating : 0.00 408
+Unsatisfiable/GRP517-1.ma ... OK TIME NEEDED: 1.20 Rating : 0.00 409
+Unsatisfiable/GRP518-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 410
+Unsatisfiable/GRP519-1.ma ... OK TIME NEEDED: 0.39 Rating : 0.00 411
+Unsatisfiable/GRP520-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 412
+Unsatisfiable/GRP521-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 413
+Unsatisfiable/GRP522-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 414
+Unsatisfiable/GRP523-1.ma ... OK TIME NEEDED: 1.90 Rating : 0.00 415
+Unsatisfiable/GRP524-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 416
+Unsatisfiable/GRP525-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 417
+Unsatisfiable/GRP526-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 418
+Unsatisfiable/GRP527-1.ma ... OK TIME NEEDED: 8.62 Rating : 0.00 419
+Unsatisfiable/GRP528-1.ma ... OK TIME NEEDED: 0.14 Rating : 0.00 420
+Unsatisfiable/GRP529-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 421
+Unsatisfiable/GRP530-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 422
+Unsatisfiable/GRP531-1.ma ... OK TIME NEEDED: 1.99 Rating : 0.00 423
+Unsatisfiable/GRP532-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 424
+Unsatisfiable/GRP533-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 425
+Unsatisfiable/GRP534-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 426
+Unsatisfiable/GRP535-1.ma ... OK TIME NEEDED: 2.68 Rating : 0.00 427
+Unsatisfiable/GRP536-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 428
+Unsatisfiable/GRP537-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 429
+Unsatisfiable/GRP538-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 430
+Unsatisfiable/GRP539-1.ma ... OK TIME NEEDED: 2.27 Rating : 0.00 431
+Unsatisfiable/GRP540-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 432
+Unsatisfiable/GRP541-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 433
+Unsatisfiable/GRP542-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 434
+Unsatisfiable/GRP543-1.ma ... OK TIME NEEDED: 0.38 Rating : 0.00 435
+Unsatisfiable/GRP544-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 436
+Unsatisfiable/GRP545-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 437
+Unsatisfiable/GRP546-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 438
+Unsatisfiable/GRP547-1.ma ... OK TIME NEEDED: 1.28 Rating : 0.00 439
+Unsatisfiable/GRP548-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 440
+Unsatisfiable/GRP549-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 441
+Unsatisfiable/GRP550-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.07 442
+Unsatisfiable/GRP551-1.ma ... OK TIME NEEDED: 0.63 Rating : 0.00 443
+Unsatisfiable/GRP552-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 444
+Unsatisfiable/GRP553-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 445
+Unsatisfiable/GRP554-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 446
+Unsatisfiable/GRP555-1.ma ... OK TIME NEEDED: 1.00 Rating : 0.00 447
+Unsatisfiable/GRP556-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 448
+Unsatisfiable/GRP557-1.ma ... OK TIME NEEDED: 0.14 Rating : 0.00 449
+Unsatisfiable/GRP558-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 450
+Unsatisfiable/GRP559-1.ma ... OK TIME NEEDED: 2.65 Rating : 0.00 451
+Unsatisfiable/GRP560-1.ma ... OK TIME NEEDED: 0.20 Rating : 0.00 452
+Unsatisfiable/GRP561-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 453
+Unsatisfiable/GRP562-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 454
+Unsatisfiable/GRP563-1.ma ... OK TIME NEEDED: 5.18 Rating : 0.00 455
+Unsatisfiable/GRP564-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 456
+Unsatisfiable/GRP565-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 457
+Unsatisfiable/GRP566-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 458
+Unsatisfiable/GRP567-1.ma ... OK TIME NEEDED: 17.92 Rating : 0.14 459
+Unsatisfiable/GRP568-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.14 460
+Unsatisfiable/GRP569-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 461
+Unsatisfiable/GRP570-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 462
+Unsatisfiable/GRP571-1.ma ... OK TIME NEEDED: 17.87 Rating : 0.14 463
+Unsatisfiable/GRP572-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.07 464
+Unsatisfiable/GRP573-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 465
+Unsatisfiable/GRP574-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 466
+Unsatisfiable/GRP575-1.ma ... OK TIME NEEDED: 35.99 Rating : 0.14 467
+Unsatisfiable/GRP576-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 468
+Unsatisfiable/GRP577-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 469
+Unsatisfiable/GRP578-1.ma ... OK TIME NEEDED: 0.22 Rating : 0.00 470
+Unsatisfiable/GRP579-1.ma ... OK TIME NEEDED: 0.88 Rating : 0.07 471
+Unsatisfiable/GRP580-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 472
+Unsatisfiable/GRP581-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 473
+Unsatisfiable/GRP582-1.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 474
+Unsatisfiable/GRP583-1.ma ... OK TIME NEEDED: 1.93 Rating : 0.07 475
+Unsatisfiable/GRP584-1.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 476
+Unsatisfiable/GRP585-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 477
+Unsatisfiable/GRP586-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 478
+Unsatisfiable/GRP587-1.ma ... FAIL Rating : 0.00 479
+Unsatisfiable/GRP588-1.ma ... OK TIME NEEDED: 0.81 Rating : 0.00 480
+Unsatisfiable/GRP589-1.ma ... OK TIME NEEDED: 0.33 Rating : 0.00 481
+Unsatisfiable/GRP590-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 482
+Unsatisfiable/GRP591-1.ma ... OK TIME NEEDED: 0.48 Rating : 0.07 483
+Unsatisfiable/GRP592-1.ma ... OK TIME NEEDED: 0.16 Rating : 0.07 484
+Unsatisfiable/GRP593-1.ma ... OK TIME NEEDED: 1.95 Rating : 0.00 485
+Unsatisfiable/GRP594-1.ma ... OK TIME NEEDED: 0.80 Rating : 0.00 486
+Unsatisfiable/GRP595-1.ma ... OK TIME NEEDED: 0.14 Rating : 0.07 487
+Unsatisfiable/GRP596-1.ma ... OK TIME NEEDED: 0.21 Rating : 0.07 488
+Unsatisfiable/GRP597-1.ma ... OK TIME NEEDED: 0.48 Rating : 0.00 489
+Unsatisfiable/GRP598-1.ma ... OK TIME NEEDED: 0.21 Rating : 0.07 490
+Unsatisfiable/GRP599-1.ma ... OK TIME NEEDED: 1.89 Rating : 0.07 491
+Unsatisfiable/GRP600-1.ma ... OK TIME NEEDED: 0.21 Rating : 0.07 492
+Unsatisfiable/GRP601-1.ma ... OK TIME NEEDED: 2.97 Rating : 0.07 493
+Unsatisfiable/GRP602-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.07 494
+Unsatisfiable/GRP603-1.ma ... OK TIME NEEDED: 0.48 Rating : 0.07 495
+Unsatisfiable/GRP604-1.ma ... OK TIME NEEDED: 0.60 Rating : 0.07 496
+Unsatisfiable/GRP605-1.ma ... OK TIME NEEDED: 1.31 Rating : 0.00 497
+Unsatisfiable/GRP606-1.ma ... OK TIME NEEDED: 1.43 Rating : 0.00 498
+Unsatisfiable/GRP607-1.ma ... FAIL Rating : 0.00 499
+Unsatisfiable/GRP608-1.ma ... OK TIME NEEDED: 1.39 Rating : 0.00 500
+Unsatisfiable/GRP609-1.ma ... OK TIME NEEDED: 1.69 Rating : 0.07 501
+Unsatisfiable/GRP610-1.ma ... OK TIME NEEDED: 0.32 Rating : 0.07 502
+Unsatisfiable/GRP611-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 503
+Unsatisfiable/GRP612-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.07 504
+Unsatisfiable/GRP613-1.ma ... OK TIME NEEDED: 0.45 Rating : 0.00 505
+Unsatisfiable/GRP614-1.ma ... OK TIME NEEDED: 0.21 Rating : 0.00 506
+Unsatisfiable/GRP615-1.ma ... OK TIME NEEDED: 1.19 Rating : 0.07 507
+Unsatisfiable/GRP616-1.ma ... OK TIME NEEDED: 0.21 Rating : 0.00 508
+Unsatisfiable/LAT006-1.ma ... OK TIME NEEDED: 24.74 Rating : 0.14 509
+Unsatisfiable/LAT007-1.ma ... OK TIME NEEDED: 83.75 Rating : 0.36 510
+Unsatisfiable/LAT008-1.ma ... OK TIME NEEDED: 0.48 Rating : 0.07 511
+Unsatisfiable/LAT009-1.ma ... OK TIME NEEDED: 273.44 Rating : 0.00 512
+Unsatisfiable/LAT010-1.ma ... FAIL Rating : 0.00 513
+Unsatisfiable/LAT011-1.ma ... OK TIME NEEDED: 541.10 Rating : 0.07 514
+Unsatisfiable/LAT012-1.ma ... OK TIME NEEDED: 4.00 Rating : 0.00 515
+Unsatisfiable/LAT013-1.ma ... OK TIME NEEDED: 93.65 Rating : 0.14 516
+Unsatisfiable/LAT014-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 517
+Unsatisfiable/LAT017-1.ma ... FAIL Rating : 0.71 518
+Unsatisfiable/LAT018-1.ma ... FAIL Rating : 0.93 519
+Unsatisfiable/LAT019-1.ma ... FAIL Rating : 0.00 520
+Unsatisfiable/LAT020-1.ma ... FAIL Rating : 0.50 521
+Unsatisfiable/LAT021-1.ma ... FAIL Rating : 0.00 522
+Unsatisfiable/LAT022-1.ma ... FAIL Rating : 0.21 523
+Unsatisfiable/LAT023-1.ma ... FAIL Rating : 0.21 524
+Unsatisfiable/LAT026-1.ma ... OK TIME NEEDED: 14.20 Rating : 0.14 525
+Unsatisfiable/LAT027-1.ma ... OK TIME NEEDED: 13.07 Rating : 0.07 526
+Unsatisfiable/LAT028-1.ma ... OK TIME NEEDED: 11.45 Rating : 0.00 527
+Unsatisfiable/LAT031-1.ma ... OK TIME NEEDED: 0.69 Rating : 0.00 528
+Unsatisfiable/LAT032-1.ma ... OK TIME NEEDED: 26.94 Rating : 0.00 529
+Unsatisfiable/LAT033-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 530
+Unsatisfiable/LAT034-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 531
+Unsatisfiable/LAT038-1.ma ... FAIL Rating : 0.43 532
+Unsatisfiable/LAT039-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 533
+Unsatisfiable/LAT039-2.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 534
+Unsatisfiable/LAT040-1.ma ... OK TIME NEEDED: 32.35 Rating : 0.00 535
+Unsatisfiable/LAT042-1.ma ... OK TIME NEEDED: 1.69 Rating : 0.00 536
+Unsatisfiable/LAT043-1.ma ... OK TIME NEEDED: 140.92 Rating : 0.00 537
+Unsatisfiable/LAT044-1.ma ... FAIL Rating : 0.14 538
+Unsatisfiable/LAT045-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.07 539
+Unsatisfiable/LAT070-1.ma ... FAIL Rating : 0.93 540
+Unsatisfiable/LAT072-1.ma ... FAIL Rating : 1.00 541
+Unsatisfiable/LAT074-1.ma ... FAIL Rating : 1.00 542
+Unsatisfiable/LAT075-1.ma ... FAIL Rating : 1.00 543
+Unsatisfiable/LAT076-1.ma ... FAIL Rating : 1.00 544
+Unsatisfiable/LAT077-1.ma ... FAIL Rating : 1.00 545
+Unsatisfiable/LAT078-1.ma ... FAIL Rating : 1.00 546
+Unsatisfiable/LAT079-1.ma ... FAIL Rating : 1.00 547
+Unsatisfiable/LAT080-1.ma ... OK TIME NEEDED: 77.84 Rating : 0.36 548
+Unsatisfiable/LAT081-1.ma ... FAIL Rating : 0.57 549
+Unsatisfiable/LAT082-1.ma ... FAIL Rating : 0.64 550
+Unsatisfiable/LAT083-1.ma ... OK TIME NEEDED: 71.42 Rating : 0.36 551
+Unsatisfiable/LAT084-1.ma ... FAIL Rating : 0.50 552
+Unsatisfiable/LAT085-1.ma ... FAIL Rating : 0.57 553
+Unsatisfiable/LAT086-1.ma ... OK TIME NEEDED: 542.05 Rating : 0.50 554
+Unsatisfiable/LAT087-1.ma ... OK TIME NEEDED: 531.15 Rating : 0.43 555
+Unsatisfiable/LAT088-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 556
+Unsatisfiable/LAT089-1.ma ... OK TIME NEEDED: 1.32 Rating : 0.00 557
+Unsatisfiable/LAT090-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 558
+Unsatisfiable/LAT091-1.ma ... OK TIME NEEDED: 16.02 Rating : 0.07 559
+Unsatisfiable/LAT092-1.ma ... OK TIME NEEDED: 61.99 Rating : 0.36 560
+Unsatisfiable/LAT093-1.ma ... OK TIME NEEDED: 297.24 Rating : 0.43 561
+Unsatisfiable/LAT094-1.ma ... OK TIME NEEDED: 72.15 Rating : 0.36 562
+Unsatisfiable/LAT095-1.ma ... OK TIME NEEDED: 406.90 Rating : 0.43 563
+Unsatisfiable/LAT096-1.ma ... OK Rating : 0.36 564
+Unsatisfiable/LAT097-1.ma ... OK Rating : 0.36 565
+Unsatisfiable/LAT138-1.ma ... FAIL Rating : 1.00 566
+Unsatisfiable/LAT139-1.ma ... FAIL Rating : 1.00 567
+Unsatisfiable/LAT140-1.ma ... FAIL Rating : 1.00 568
+Unsatisfiable/LAT141-1.ma ... FAIL Rating : 1.00 569
+Unsatisfiable/LAT142-1.ma ... FAIL Rating : 0.64 570
+Unsatisfiable/LAT143-1.ma ... FAIL Rating : 0.14 571
+Unsatisfiable/LAT144-1.ma ... FAIL Rating : 0.86 572
+Unsatisfiable/LAT145-1.ma ... FAIL Rating : 0.93 573
+Unsatisfiable/LAT146-1.ma ... FAIL Rating : 0.79 574
+Unsatisfiable/LAT147-1.ma ... FAIL Rating : 0.79 575
+Unsatisfiable/LAT148-1.ma ... FAIL Rating : 0.71 576
+Unsatisfiable/LAT149-1.ma ... FAIL Rating : 0.93 577
+Unsatisfiable/LAT150-1.ma ... FAIL Rating : 0.86 578
+Unsatisfiable/LAT151-1.ma ... FAIL Rating : 0.86 579
+Unsatisfiable/LAT152-1.ma ... FAIL Rating : 0.79 580
+Unsatisfiable/LAT153-1.ma ... FAIL Rating : 0.93 581
+Unsatisfiable/LAT154-1.ma ... FAIL Rating : 0.79 582
+Unsatisfiable/LAT155-1.ma ... FAIL Rating : 0.86 583
+Unsatisfiable/LAT156-1.ma ... FAIL Rating : 0.64 584
+Unsatisfiable/LAT157-1.ma ... FAIL Rating : 0.86 585
+Unsatisfiable/LAT158-1.ma ... FAIL Rating : 0.93 586
+Unsatisfiable/LAT159-1.ma ... FAIL Rating : 0.86 587
+Unsatisfiable/LAT160-1.ma ... FAIL Rating : 0.64 588
+Unsatisfiable/LAT161-1.ma ... FAIL Rating : 1.00 589
+Unsatisfiable/LAT162-1.ma ... FAIL Rating : 0.86 590
+Unsatisfiable/LAT163-1.ma ... FAIL Rating : 0.93 591
+Unsatisfiable/LAT164-1.ma ... FAIL Rating : 0.93 592
+Unsatisfiable/LAT165-1.ma ... FAIL Rating : 0.93 593
+Unsatisfiable/LAT166-1.ma ... FAIL Rating : 0.93 594
+Unsatisfiable/LAT167-1.ma ... FAIL Rating : 0.93 595
+Unsatisfiable/LAT168-1.ma ... OK TIME NEEDED: 170.41 Rating : 0.14 596
+Unsatisfiable/LAT169-1.ma ... FAIL Rating : 0.86 597
+Unsatisfiable/LAT170-1.ma ... FAIL Rating : 0.79 598
+Unsatisfiable/LAT171-1.ma ... OK TIME NEEDED: 226.72 Rating : 0.50 599
+Unsatisfiable/LAT172-1.ma ... FAIL Rating : 0.93 600
+Unsatisfiable/LAT173-1.ma ... FAIL Rating : 0.93 601
+Unsatisfiable/LAT174-1.ma ... FAIL Rating : 0.79 602
+Unsatisfiable/LAT175-1.ma ... FAIL Rating : 0.93 603
+Unsatisfiable/LAT176-1.ma ... FAIL Rating : 0.93 604
+Unsatisfiable/LAT177-1.ma ... FAIL Rating : 1.00 605
+Unsatisfiable/LCL109-2.ma ... FAIL Rating : 0.29 606
+Unsatisfiable/LCL109-6.ma ... FAIL Rating : 0.14 607
+Unsatisfiable/LCL110-2.ma ... OK TIME NEEDED: 1.27 Rating : 0.00 608
+Unsatisfiable/LCL111-2.ma ... OK TIME NEEDED: 3.60 Rating : 0.07 609
+Unsatisfiable/LCL112-2.ma ... OK TIME NEEDED: 1.16 Rating : 0.00 610
+Unsatisfiable/LCL113-2.ma ... OK TIME NEEDED: 1.19 Rating : 0.00 611
+Unsatisfiable/LCL114-2.ma ... OK TIME NEEDED: 1.16 Rating : 0.00 612
+Unsatisfiable/LCL115-2.ma ... OK TIME NEEDED: 1.23 Rating : 0.00 613
+Unsatisfiable/LCL116-2.ma ... OK TIME NEEDED: 3.71 Rating : 0.00 614
+Unsatisfiable/LCL132-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 615
+Unsatisfiable/LCL133-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 616
+Unsatisfiable/LCL134-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 617
+Unsatisfiable/LCL135-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 618
+Unsatisfiable/LCL138-1.ma ... FAIL Rating : 0.21 619
+Unsatisfiable/LCL139-1.ma ... OK TIME NEEDED: 1.26 Rating : 0.00 620
+Unsatisfiable/LCL140-1.ma ... OK TIME NEEDED: 1.27 Rating : 0.00 621
+Unsatisfiable/LCL141-1.ma ... OK TIME NEEDED: 1.29 Rating : 0.00 622
+Unsatisfiable/LCL153-1.ma ... OK TIME NEEDED: 1.14 Rating : 0.00 623
+Unsatisfiable/LCL154-1.ma ... OK TIME NEEDED: 7.48 Rating : 0.00 624
+Unsatisfiable/LCL155-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 625
+Unsatisfiable/LCL156-1.ma ... OK TIME NEEDED: 1.29 Rating : 0.00 626
+Unsatisfiable/LCL157-1.ma ... OK TIME NEEDED: 0.71 Rating : 0.00 627
+Unsatisfiable/LCL158-1.ma ... OK TIME NEEDED: 1.80 Rating : 0.00 628
+Unsatisfiable/LCL159-1.ma ... OK TIME NEEDED: 109.15 Rating : 0.00 629
+Unsatisfiable/LCL160-1.ma ... FAIL Rating : 0.14 630
+Unsatisfiable/LCL161-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 631
+Unsatisfiable/LCL162-1.ma ... FAIL Rating : 0.00 632
+Unsatisfiable/LCL163-1.ma ... OK TIME NEEDED: 8.49 Rating : 0.14 633
+Unsatisfiable/LCL164-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 634
+Unsatisfiable/LDA001-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 635
+Unsatisfiable/LDA002-1.ma ... OK TIME NEEDED: 18.81 Rating : 0.00 636
+Unsatisfiable/LDA007-3.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 637
+Unsatisfiable/RNG007-4.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 638
+Unsatisfiable/RNG008-3.ma ... OK TIME NEEDED: 13.93 Rating : 0.07 639
+Unsatisfiable/RNG008-4.ma ... OK TIME NEEDED: 13.66 Rating : 0.07 640
+Unsatisfiable/RNG008-7.ma ... OK TIME NEEDED: 46.78 Rating : 0.07 641
+Unsatisfiable/RNG009-5.ma ... FAIL Rating : 0.50 642
+Unsatisfiable/RNG009-7.ma ... FAIL Rating : 0.50 643
+Unsatisfiable/RNG011-5.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 644
+Unsatisfiable/RNG012-6.ma ... OK TIME NEEDED: 111.30 Rating : 0.00 645
+Unsatisfiable/RNG013-6.ma ... OK TIME NEEDED: 107.78 Rating : 0.00 646
+Unsatisfiable/RNG014-6.ma ... OK TIME NEEDED: 99.05 Rating : 0.00 647
+Unsatisfiable/RNG015-6.ma ... OK TIME NEEDED: 105.75 Rating : 0.00 648
+Unsatisfiable/RNG016-6.ma ... OK TIME NEEDED: 110.15 Rating : 0.00 649
+Unsatisfiable/RNG017-6.ma ... OK TIME NEEDED: 109.25 Rating : 0.00 650
+Unsatisfiable/RNG018-6.ma ... OK TIME NEEDED: 113.16 Rating : 0.00 651
+Unsatisfiable/RNG019-6.ma ... FAIL Rating : 0.21 652
+Unsatisfiable/RNG019-7.ma ... FAIL Rating : 0.21 653
+Unsatisfiable/RNG020-6.ma ... FAIL Rating : 0.29 654
+Unsatisfiable/RNG020-7.ma ... FAIL Rating : 0.21 655
+Unsatisfiable/RNG021-6.ma ... FAIL Rating : 0.14 656
+Unsatisfiable/RNG021-7.ma ... FAIL Rating : 0.21 657
+Unsatisfiable/RNG023-6.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 658
+Unsatisfiable/RNG023-7.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 659
+Unsatisfiable/RNG024-6.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 660
+Unsatisfiable/RNG024-7.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 661
+Unsatisfiable/RNG025-4.ma ... FAIL Rating : 0.29 662
+Unsatisfiable/RNG025-5.ma ... FAIL Rating : 0.36 663
+Unsatisfiable/RNG025-6.ma ... FAIL Rating : 0.29 664
+Unsatisfiable/RNG025-7.ma ... FAIL Rating : 0.43 665
+Unsatisfiable/RNG026-6.ma ... FAIL Rating : 0.57 666
+Unsatisfiable/RNG026-7.ma ... FAIL Rating : 0.50 667
+Unsatisfiable/RNG027-5.ma ... FAIL Rating : 0.86 668
+Unsatisfiable/RNG027-7.ma ... FAIL Rating : 0.86 669
+Unsatisfiable/RNG027-8.ma ... FAIL Rating : 0.86 670
+Unsatisfiable/RNG027-9.ma ... FAIL Rating : 0.86 671
+Unsatisfiable/RNG028-5.ma ... FAIL Rating : 0.86 672
+Unsatisfiable/RNG028-7.ma ... FAIL Rating : 0.86 673
+Unsatisfiable/RNG028-8.ma ... FAIL Rating : 0.86 674
+Unsatisfiable/RNG028-9.ma ... FAIL Rating : 0.86 675
+Unsatisfiable/RNG029-5.ma ... FAIL Rating : 0.86 676
+Unsatisfiable/RNG029-6.ma ... FAIL Rating : 0.86 677
+Unsatisfiable/RNG029-7.ma ... FAIL Rating : 0.86 678
+Unsatisfiable/RNG035-7.ma ... FAIL Rating : 0.86 679
+Unsatisfiable/ROB001-1.ma ... FAIL Rating : 1.00 680
+Unsatisfiable/ROB002-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 681
+Unsatisfiable/ROB003-1.ma ... OK TIME NEEDED: 0.71 Rating : 0.00 682
+Unsatisfiable/ROB004-1.ma ... OK TIME NEEDED: 67.37 Rating : 0.00 683
+Unsatisfiable/ROB005-1.ma ... FAIL Rating : 0.07 684
+Unsatisfiable/ROB006-1.ma ... FAIL Rating : 0.86 685
+Unsatisfiable/ROB006-2.ma ... FAIL Rating : 0.86 686
+Unsatisfiable/ROB008-1.ma ... OK TIME NEEDED: 57.92 Rating : 0.00 687
+Unsatisfiable/ROB009-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 688
+Unsatisfiable/ROB010-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 689
+Unsatisfiable/ROB013-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 690
+Unsatisfiable/ROB022-1.ma ... FAIL Rating : 0.00 691
+Unsatisfiable/ROB023-1.ma ... FAIL Rating : 0.00 692
+Unsatisfiable/ROB026-1.ma ... FAIL Rating : 0.86 693
+Unsatisfiable/ROB030-1.ma ... OK TIME NEEDED: 0.37 Rating : 0.00 694
+Unsatisfiable/ROB031-1.ma ... FAIL Rating : 1.00 695
+Unsatisfiable/ROB032-1.ma ... FAIL Rating : 1.00 696
+Unsatisfiable/SYN080-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 697
+Unsatisfiable/SYN083-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 698
diff --git a/matita/tests/TPTP/log.600.30-6.weghtNOTlookingatgoalsymbols b/matita/tests/TPTP/log.600.30-6.weghtNOTlookingatgoalsymbols
new file mode 100644 (file)
index 0000000..b46e5b8
--- /dev/null
@@ -0,0 +1,523 @@
+Unsatisfiable/ALG005-1.ma ... OK TIME NEEDED: 40.53 Rating : 0.07 1
+Unsatisfiable/ALG006-1.ma ... OK TIME NEEDED: 3.60 Rating : 0.00 2
+Unsatisfiable/ALG007-1.ma ... OK TIME NEEDED: 10.95 Rating : 0.00 3
+Unsatisfiable/BOO001-1.ma ... OK TIME NEEDED: 1.04 Rating : 0.00 4
+Unsatisfiable/BOO002-1.ma ... OK TIME NEEDED: 12.64 Rating : 0.07 5
+Unsatisfiable/BOO002-2.ma ... OK TIME NEEDED: 8.02 Rating : 0.00 6
+Unsatisfiable/BOO003-2.ma ... OK TIME NEEDED: 0.35 Rating : 0.00 7
+Unsatisfiable/BOO003-4.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 8
+Unsatisfiable/BOO004-2.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 9
+Unsatisfiable/BOO004-4.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 10
+Unsatisfiable/BOO005-2.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 11
+Unsatisfiable/BOO005-4.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 12
+Unsatisfiable/BOO006-2.ma ... OK TIME NEEDED: 0.66 Rating : 0.00 13
+Unsatisfiable/BOO006-4.ma ... OK TIME NEEDED: 0.59 Rating : 0.00 14
+Unsatisfiable/BOO007-2.ma ... OK TIME NEEDED: 97.16 Rating : 0.14 15
+Unsatisfiable/BOO007-4.ma ... OK TIME NEEDED: 69.08 Rating : 0.07 16
+Unsatisfiable/BOO008-2.ma ... OK TIME NEEDED: 98.16 Rating : 0.07 17
+Unsatisfiable/BOO008-4.ma ... OK TIME NEEDED: 135.79 Rating : 0.00 18
+Unsatisfiable/BOO009-2.ma ... OK TIME NEEDED: 0.67 Rating : 0.00 19
+Unsatisfiable/BOO009-4.ma ... OK TIME NEEDED: 0.70 Rating : 0.00 20
+Unsatisfiable/BOO010-2.ma ... OK TIME NEEDED: 1.90 Rating : 0.00 21
+Unsatisfiable/BOO010-4.ma ... OK TIME NEEDED: 0.70 Rating : 0.00 22
+Unsatisfiable/BOO011-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 23
+Unsatisfiable/BOO011-4.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 24
+Unsatisfiable/BOO012-2.ma ... OK TIME NEEDED: 0.40 Rating : 0.00 25
+Unsatisfiable/BOO012-4.ma ... OK TIME NEEDED: 0.37 Rating : 0.00 26
+Unsatisfiable/BOO013-2.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 27
+Unsatisfiable/BOO013-4.ma ... OK TIME NEEDED: 0.20 Rating : 0.00 28
+Unsatisfiable/BOO014-2.ma ... OK TIME NEEDED: 7.76 Rating : 0.00 29
+Unsatisfiable/BOO014-4.ma ... OK TIME NEEDED: 48.32 Rating : 0.00 30
+Unsatisfiable/BOO015-2.ma ... OK TIME NEEDED: 9.57 Rating : 0.00 31
+Unsatisfiable/BOO015-4.ma ... OK TIME NEEDED: 48.12 Rating : 0.00 32
+Unsatisfiable/BOO016-2.ma ... OK TIME NEEDED: 0.88 Rating : 0.00 33
+Unsatisfiable/BOO017-2.ma ... OK TIME NEEDED: 1.54 Rating : 0.00 34
+Unsatisfiable/BOO018-4.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 35
+Unsatisfiable/BOO021-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.07 36
+Unsatisfiable/BOO022-1.ma ... FAIL Rating : 0.07 37
+Unsatisfiable/BOO023-1.ma ... OK TIME NEEDED: 83.96 Rating : 0.50 38
+Unsatisfiable/BOO024-1.ma ... OK TIME NEEDED: 2.32 Rating : 0.00 39
+Unsatisfiable/BOO025-1.ma ... OK TIME NEEDED: 3.01 Rating : 0.07 40
+Unsatisfiable/BOO026-1.ma ... OK TIME NEEDED: 21.18 Rating : 0.07 41
+Unsatisfiable/BOO028-1.ma ... FAIL Rating : 0.07 42
+Unsatisfiable/BOO029-1.ma ... OK TIME NEEDED: 54.57 Rating : 0.00 43
+Unsatisfiable/BOO031-1.ma ... FAIL Rating : 0.21 44
+Unsatisfiable/BOO034-1.ma ... OK TIME NEEDED: 1.47 Rating : 0.21 45
+Unsatisfiable/BOO067-1.ma ... FAIL Rating : 0.21 46
+Unsatisfiable/BOO068-1.ma ... OK TIME NEEDED: 1.68 Rating : 0.00 47
+Unsatisfiable/BOO069-1.ma ... OK TIME NEEDED: 0.91 Rating : 0.00 48
+Unsatisfiable/BOO070-1.ma ... OK TIME NEEDED: 1.90 Rating : 0.00 49
+Unsatisfiable/BOO071-1.ma ... OK TIME NEEDED: 0.91 Rating : 0.00 50
+Unsatisfiable/BOO072-1.ma ... FAIL Rating : 0.07 51
+Unsatisfiable/BOO073-1.ma ... FAIL Rating : 0.36 52
+Unsatisfiable/BOO074-1.ma ... FAIL Rating : 0.07 53
+Unsatisfiable/BOO075-1.ma ... OK TIME NEEDED: 0.78 Rating : 0.00 54
+Unsatisfiable/BOO076-1.ma ... FAIL Rating : 0.71 55
+Unsatisfiable/COL001-1.ma ... OK TIME NEEDED: 46.48 Rating : 0.07 56
+Unsatisfiable/COL001-2.ma ... OK TIME NEEDED: 2.78 Rating : 0.07 57
+Unsatisfiable/COL002-1.ma ... OK TIME NEEDED: 332.07 Rating : 0.00 58
+Unsatisfiable/COL002-4.ma ... FAIL Rating : 0.07 59
+Unsatisfiable/COL002-5.ma ... FAIL Rating : 0.43 60
+Unsatisfiable/COL003-1.ma ... FAIL Rating : 0.79 61
+Unsatisfiable/COL004-1.ma ... FAIL Rating : 0.57 62
+Unsatisfiable/COL004-3.ma ... OK TIME NEEDED: 0.01 Rating : 0.21 63
+Unsatisfiable/COL006-1.ma ... FAIL Rating : 0.57 64
+Unsatisfiable/COL006-5.ma ... FAIL Rating : 0.64 65
+Unsatisfiable/COL006-6.ma ... FAIL Rating : 0.64 66
+Unsatisfiable/COL006-7.ma ... FAIL Rating : 0.64 67
+Unsatisfiable/COL007-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 68
+Unsatisfiable/COL008-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 69
+Unsatisfiable/COL009-1.ma ... OK TIME NEEDED: 5.60 Rating : 0.07 70
+Unsatisfiable/COL010-1.ma ... OK TIME NEEDED: 0.81 Rating : 0.07 71
+Unsatisfiable/COL011-1.ma ... FAIL Rating : 0.36 72
+Unsatisfiable/COL012-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 73
+Unsatisfiable/COL013-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 74
+Unsatisfiable/COL014-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 75
+Unsatisfiable/COL015-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 76
+Unsatisfiable/COL016-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 77
+Unsatisfiable/COL017-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 78
+Unsatisfiable/COL018-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 79
+Unsatisfiable/COL019-1.ma ... OK TIME NEEDED: 51.80 Rating : 0.00 80
+Unsatisfiable/COL020-1.ma ... FAIL Rating : 0.07 81
+Unsatisfiable/COL021-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 82
+Unsatisfiable/COL022-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 83
+Unsatisfiable/COL023-1.ma ... FAIL Rating : 0.00 84
+Unsatisfiable/COL024-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 85
+Unsatisfiable/COL025-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 86
+Unsatisfiable/COL026-1.ma ... FAIL Rating : 0.07 87
+Unsatisfiable/COL027-1.ma ... FAIL Rating : 0.00 88
+Unsatisfiable/COL029-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 89
+Unsatisfiable/COL030-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.14 90
+Unsatisfiable/COL031-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 91
+Unsatisfiable/COL032-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.14 92
+Unsatisfiable/COL033-1.ma ... OK TIME NEEDED: 4.48 Rating : 0.07 93
+Unsatisfiable/COL034-1.ma ... OK TIME NEEDED: 7.82 Rating : 0.43 94
+Unsatisfiable/COL035-1.ma ... FAIL Rating : 0.14 95
+Unsatisfiable/COL036-1.ma ... OK TIME NEEDED: 55.84 Rating : 0.57 96
+Unsatisfiable/COL037-1.ma ... FAIL Rating : 0.29 97
+Unsatisfiable/COL038-1.ma ... FAIL Rating : 0.64 98
+Unsatisfiable/COL039-1.ma ... OK TIME NEEDED: 16.82 Rating : 0.00 99
+Unsatisfiable/COL041-1.ma ... OK TIME NEEDED: 0.59 Rating : 0.36 100
+Unsatisfiable/COL042-1.ma ... FAIL Rating : 0.86 101
+Unsatisfiable/COL042-6.ma ... FAIL Rating : 0.14 102
+Unsatisfiable/COL042-7.ma ... FAIL Rating : 0.14 103
+Unsatisfiable/COL042-8.ma ... FAIL Rating : 0.14 104
+Unsatisfiable/COL042-9.ma ... FAIL Rating : 0.14 105
+Unsatisfiable/COL043-1.ma ... FAIL Rating : 0.86 106
+Unsatisfiable/COL043-3.ma ... FAIL Rating : 0.71 107
+Unsatisfiable/COL044-1.ma ... FAIL Rating : 0.21 108
+Unsatisfiable/COL044-6.ma ... FAIL Rating : 0.64 109
+Unsatisfiable/COL044-7.ma ... FAIL Rating : 0.50 110
+Unsatisfiable/COL044-8.ma ... FAIL Rating : 0.71 111
+Unsatisfiable/COL044-9.ma ... FAIL Rating : 0.64 112
+Unsatisfiable/COL045-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 113
+Unsatisfiable/COL046-1.ma ... FAIL Rating : 0.64 114
+Unsatisfiable/COL048-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 115
+Unsatisfiable/COL049-1.ma ... OK TIME NEEDED: 67.37 Rating : 0.29 116
+Unsatisfiable/COL050-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 117
+Unsatisfiable/COL051-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 118
+Unsatisfiable/COL052-1.ma ... FAIL Rating : 0.00 119
+Unsatisfiable/COL053-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 120
+Unsatisfiable/COL056-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.07 121
+Unsatisfiable/COL057-1.ma ... FAIL Rating : 0.36 122
+Unsatisfiable/COL058-1.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 123
+Unsatisfiable/COL058-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 124
+Unsatisfiable/COL058-3.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 125
+Unsatisfiable/COL059-1.ma ... FAIL Rating : 0.00 126
+Unsatisfiable/COL060-1.ma ... OK TIME NEEDED: 18.56 Rating : 0.36 127
+Unsatisfiable/COL060-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 128
+Unsatisfiable/COL060-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 129
+Unsatisfiable/COL061-1.ma ... OK TIME NEEDED: 395.87 Rating : 0.36 130
+Unsatisfiable/COL061-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 131
+Unsatisfiable/COL061-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 132
+Unsatisfiable/COL062-1.ma ... FAIL Rating : 0.50 133
+Unsatisfiable/COL062-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 134
+Unsatisfiable/COL062-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 135
+Unsatisfiable/COL063-1.ma ... FAIL Rating : 0.50 136
+Unsatisfiable/COL063-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 137
+Unsatisfiable/COL063-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 138
+Unsatisfiable/COL063-4.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 139
+Unsatisfiable/COL063-5.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 140
+Unsatisfiable/COL063-6.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 141
+Unsatisfiable/COL064-1.ma ... FAIL Rating : 0.64 142
+Unsatisfiable/COL064-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 143
+Unsatisfiable/COL064-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 144
+Unsatisfiable/COL064-4.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 145
+Unsatisfiable/COL064-5.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 146
+Unsatisfiable/COL064-6.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 147
+Unsatisfiable/COL064-7.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 148
+Unsatisfiable/COL064-8.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 149
+Unsatisfiable/COL064-9.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 150
+Unsatisfiable/COL065-1.ma ... FAIL Rating : 0.71 151
+Unsatisfiable/COL066-1.ma ... FAIL Rating : 0.93 152
+Unsatisfiable/COL066-2.ma ... OK TIME NEEDED: 2.48 Rating : 0.00 153
+Unsatisfiable/COL066-3.ma ... OK TIME NEEDED: 2.49 Rating : 0.00 154
+Unsatisfiable/COL070-1.ma ... FAIL Rating : 0.07 155
+Unsatisfiable/COL075-2.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 156
+Unsatisfiable/COL083-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 157
+Unsatisfiable/COL084-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 158
+Unsatisfiable/COL085-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 159
+Unsatisfiable/COL086-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 160
+Unsatisfiable/GRP001-2.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 161
+Unsatisfiable/GRP001-4.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 162
+Unsatisfiable/GRP002-2.ma ... OK TIME NEEDED: 9.79 Rating : 0.00 163
+Unsatisfiable/GRP002-3.ma ... OK TIME NEEDED: 15.92 Rating : 0.00 164
+Unsatisfiable/GRP002-4.ma ... OK TIME NEEDED: 23.25 Rating : 0.00 165
+Unsatisfiable/GRP010-4.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 166
+Unsatisfiable/GRP011-4.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 167
+Unsatisfiable/GRP012-4.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 168
+Unsatisfiable/GRP014-1.ma ... FAIL Rating : 0.14 169
+Unsatisfiable/GRP022-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 170
+Unsatisfiable/GRP023-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 171
+Unsatisfiable/GRP024-5.ma ... FAIL Rating : 0.50 172
+Unsatisfiable/GRP114-1.ma ... OK TIME NEEDED: 33.38 Rating : 0.29 173
+Unsatisfiable/GRP115-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 174
+Unsatisfiable/GRP116-1.ma ... OK TIME NEEDED: 0.42 Rating : 0.00 175
+Unsatisfiable/GRP117-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 176
+Unsatisfiable/GRP118-1.ma ... OK TIME NEEDED: 0.43 Rating : 0.00 177
+Unsatisfiable/GRP119-1.ma ... OK TIME NEEDED: 82.72 Rating : 0.00 178
+Unsatisfiable/GRP120-1.ma ... OK TIME NEEDED: 87.60 Rating : 0.00 179
+Unsatisfiable/GRP121-1.ma ... OK TIME NEEDED: 81.97 Rating : 0.00 180
+Unsatisfiable/GRP122-1.ma ... OK TIME NEEDED: 87.03 Rating : 0.07 181
+Unsatisfiable/GRP136-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 182
+Unsatisfiable/GRP137-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 183
+Unsatisfiable/GRP138-1.ma ... OK TIME NEEDED: 3.05 Rating : 0.00 184
+Unsatisfiable/GRP139-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 185
+Unsatisfiable/GRP140-1.ma ... OK TIME NEEDED: 3.25 Rating : 0.00 186
+Unsatisfiable/GRP141-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 187
+Unsatisfiable/GRP142-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 188
+Unsatisfiable/GRP143-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 189
+Unsatisfiable/GRP144-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 190
+Unsatisfiable/GRP145-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 191
+Unsatisfiable/GRP146-1.ma ... OK TIME NEEDED: 0.21 Rating : 0.00 192
+Unsatisfiable/GRP147-1.ma ... OK TIME NEEDED: 2.85 Rating : 0.00 193
+Unsatisfiable/GRP148-1.ma ... OK TIME NEEDED: 1.43 Rating : 0.00 194
+Unsatisfiable/GRP149-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 195
+Unsatisfiable/GRP150-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 196
+Unsatisfiable/GRP151-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 197
+Unsatisfiable/GRP152-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 198
+Unsatisfiable/GRP153-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 199
+Unsatisfiable/GRP154-1.ma ... OK TIME NEEDED: 0.34 Rating : 0.00 200
+Unsatisfiable/GRP155-1.ma ... OK TIME NEEDED: 0.43 Rating : 0.00 201
+Unsatisfiable/GRP156-1.ma ... OK TIME NEEDED: 0.40 Rating : 0.00 202
+Unsatisfiable/GRP157-1.ma ... OK TIME NEEDED: 0.20 Rating : 0.00 203
+Unsatisfiable/GRP158-1.ma ... OK TIME NEEDED: 0.28 Rating : 0.00 204
+Unsatisfiable/GRP159-1.ma ... OK TIME NEEDED: 0.22 Rating : 0.00 205
+Unsatisfiable/GRP160-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 206
+Unsatisfiable/GRP161-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 207
+Unsatisfiable/GRP162-1.ma ... OK TIME NEEDED: 0.29 Rating : 0.00 208
+Unsatisfiable/GRP163-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 209
+Unsatisfiable/GRP164-1.ma ... FAIL Rating : 0.93 210
+Unsatisfiable/GRP164-2.ma ... FAIL Rating : 0.93 211
+Unsatisfiable/GRP165-1.ma ... OK TIME NEEDED: 198.86 Rating : 0.00 212
+Unsatisfiable/GRP165-2.ma ... OK TIME NEEDED: 210.51 Rating : 0.00 213
+Unsatisfiable/GRP166-1.ma ... OK TIME NEEDED: 14.27 Rating : 0.00 214
+Unsatisfiable/GRP166-2.ma ... OK TIME NEEDED: 17.75 Rating : 0.00 215
+Unsatisfiable/GRP166-3.ma ... OK TIME NEEDED: 259.78 Rating : 0.00 216
+Unsatisfiable/GRP166-4.ma ... OK TIME NEEDED: 325.91 Rating : 0.00 217
+Unsatisfiable/GRP167-1.ma ... OK TIME NEEDED: 40.87 Rating : 0.21 218
+Unsatisfiable/GRP167-2.ma ... OK TIME NEEDED: 62.46 Rating : 0.21 219
+Unsatisfiable/GRP167-3.ma ... OK TIME NEEDED: 426.54 Rating : 0.50 220
+Unsatisfiable/GRP167-4.ma ... FAIL Rating : 0.43 221
+Unsatisfiable/GRP167-5.ma ... OK TIME NEEDED: 7.02 Rating : 0.14 222
+Unsatisfiable/GRP168-1.ma ... OK TIME NEEDED: 0.35 Rating : 0.07 223
+Unsatisfiable/GRP168-2.ma ... OK TIME NEEDED: 0.41 Rating : 0.07 224
+Unsatisfiable/GRP169-1.ma ... OK TIME NEEDED: 22.05 Rating : 0.00 225
+Unsatisfiable/GRP169-2.ma ... OK TIME NEEDED: 15.27 Rating : 0.00 226
+Unsatisfiable/GRP170-1.ma ... OK TIME NEEDED: 529.78 Rating : 0.00 227
+Unsatisfiable/GRP170-2.ma ... FAIL Rating : 0.00 228
+Unsatisfiable/GRP170-3.ma ... OK TIME NEEDED: 533.86 Rating : 0.00 229
+Unsatisfiable/GRP170-4.ma ... FAIL Rating : 0.00 230
+Unsatisfiable/GRP171-1.ma ... OK TIME NEEDED: 0.38 Rating : 0.00 231
+Unsatisfiable/GRP171-2.ma ... OK TIME NEEDED: 0.44 Rating : 0.00 232
+Unsatisfiable/GRP172-1.ma ... OK TIME NEEDED: 0.50 Rating : 0.00 233
+Unsatisfiable/GRP172-2.ma ... OK TIME NEEDED: 0.49 Rating : 0.00 234
+Unsatisfiable/GRP173-1.ma ... OK TIME NEEDED: 1.00 Rating : 0.00 235
+Unsatisfiable/GRP174-1.ma ... OK TIME NEEDED: 1.01 Rating : 0.00 236
+Unsatisfiable/GRP175-1.ma ... OK TIME NEEDED: 205.94 Rating : 0.00 237
+Unsatisfiable/GRP175-2.ma ... OK TIME NEEDED: 210.61 Rating : 0.00 238
+Unsatisfiable/GRP175-3.ma ... OK TIME NEEDED: 210.52 Rating : 0.00 239
+Unsatisfiable/GRP175-4.ma ... OK TIME NEEDED: 211.86 Rating : 0.00 240
+Unsatisfiable/GRP176-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.00 241
+Unsatisfiable/GRP176-2.ma ... OK TIME NEEDED: 0.34 Rating : 0.00 242
+Unsatisfiable/GRP177-2.ma ... FAIL Rating : 0.21 243
+Unsatisfiable/GRP178-1.ma ... FAIL Rating : 0.14 244
+Unsatisfiable/GRP178-2.ma ... OK TIME NEEDED: 564.34 Rating : 0.14 245
+Unsatisfiable/GRP179-1.ma ... OK TIME NEEDED: 430.67 Rating : 0.50 246
+Unsatisfiable/GRP179-2.ma ... OK TIME NEEDED: 314.52 Rating : 0.50 247
+Unsatisfiable/GRP179-3.ma ... FAIL Rating : 0.36 248
+Unsatisfiable/GRP180-1.ma ... OK TIME NEEDED: 315.86 Rating : 0.50 249
+Unsatisfiable/GRP180-2.ma ... FAIL Rating : 0.43 250
+Unsatisfiable/GRP181-1.ma ... OK TIME NEEDED: 495.71 Rating : 0.71 251
+Unsatisfiable/GRP181-2.ma ... FAIL Rating : 0.71 252
+Unsatisfiable/GRP181-3.ma ... OK TIME NEEDED: 4.28 Rating : 0.43 253
+Unsatisfiable/GRP181-4.ma ... OK TIME NEEDED: 5.45 Rating : 0.43 254
+Unsatisfiable/GRP182-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 255
+Unsatisfiable/GRP182-2.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 256
+Unsatisfiable/GRP182-3.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 257
+Unsatisfiable/GRP182-4.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 258
+Unsatisfiable/GRP183-1.ma ... FAIL Rating : 0.43 259
+Unsatisfiable/GRP183-2.ma ... FAIL Rating : 0.43 260
+Unsatisfiable/GRP183-3.ma ... FAIL Rating : 0.43 261
+Unsatisfiable/GRP183-4.ma ... FAIL Rating : 0.36 262
+Unsatisfiable/GRP184-1.ma ... OK TIME NEEDED: 343.70 Rating : 0.29 263
+Unsatisfiable/GRP184-2.ma ... FAIL Rating : 0.14 264
+Unsatisfiable/GRP184-3.ma ... OK TIME NEEDED: 362.01 Rating : 0.21 265
+Unsatisfiable/GRP184-4.ma ... OK TIME NEEDED: 80.06 Rating : 0.00 266
+Unsatisfiable/GRP185-1.ma ... FAIL Rating : 0.07 267
+Unsatisfiable/GRP185-2.ma ... FAIL Rating : 0.07 268
+Unsatisfiable/GRP185-3.ma ... FAIL Rating : 0.21 269
+Unsatisfiable/GRP185-4.ma ... FAIL Rating : 0.21 270
+Unsatisfiable/GRP186-1.ma ... OK TIME NEEDED: 309.67 Rating : 0.57 271
+Unsatisfiable/GRP186-2.ma ... FAIL Rating : 0.36 272
+Unsatisfiable/GRP186-3.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 273
+Unsatisfiable/GRP186-4.ma ... OK TIME NEEDED: 0.22 Rating : 0.00 274
+Unsatisfiable/GRP187-1.ma ... FAIL Rating : 0.64 275
+Unsatisfiable/GRP188-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 276
+Unsatisfiable/GRP188-2.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 277
+Unsatisfiable/GRP189-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 278
+Unsatisfiable/GRP189-2.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 279
+Unsatisfiable/GRP190-1.ma ... OK TIME NEEDED: 61.74 Rating : 0.00 280
+Unsatisfiable/GRP190-2.ma ... OK TIME NEEDED: 62.40 Rating : 0.00 281
+Unsatisfiable/GRP191-1.ma ... OK TIME NEEDED: 82.38 Rating : 0.00 282
+Unsatisfiable/GRP191-2.ma ... OK TIME NEEDED: 82.18 Rating : 0.00 283
+Unsatisfiable/GRP192-1.ma ... OK TIME NEEDED: 0.28 Rating : 0.07 284
+Unsatisfiable/GRP193-1.ma ... OK TIME NEEDED: 427.14 Rating : 0.00 285
+Unsatisfiable/GRP193-2.ma ... OK TIME NEEDED: 358.75 Rating : 0.00 286
+Unsatisfiable/GRP195-1.ma ... FAIL Rating : 0.00 287
+Unsatisfiable/GRP196-1.ma ... FAIL Rating : 0.93 288
+Unsatisfiable/GRP200-1.ma ... FAIL Rating : 0.29 289
+Unsatisfiable/GRP201-1.ma ... FAIL Rating : 0.36 290
+Unsatisfiable/GRP202-1.ma ... FAIL Rating : 0.43 291
+Unsatisfiable/GRP203-1.ma ... FAIL Rating : 0.21 292
+Unsatisfiable/GRP205-1.ma ... FAIL Rating : 0.43 293
+Unsatisfiable/GRP206-1.ma ... OK TIME NEEDED: 1.28 Rating : 0.00 294
+Unsatisfiable/GRP403-1.ma ... OK TIME NEEDED: 74.28 Rating : 0.07 295
+Unsatisfiable/GRP404-1.ma ... OK TIME NEEDED: 183.19 Rating : 0.21 296
+Unsatisfiable/GRP405-1.ma ... OK TIME NEEDED: 167.95 Rating : 0.21 297
+Unsatisfiable/GRP406-1.ma ... FAIL Rating : 0.00 298
+Unsatisfiable/GRP407-1.ma ... FAIL Rating : 0.00 299
+Unsatisfiable/GRP408-1.ma ... FAIL Rating : 0.00 300
+Unsatisfiable/GRP409-1.ma ... OK TIME NEEDED: 8.42 Rating : 0.00 301
+Unsatisfiable/GRP410-1.ma ... OK TIME NEEDED: 14.45 Rating : 0.21 302
+Unsatisfiable/GRP411-1.ma ... OK TIME NEEDED: 14.85 Rating : 0.21 303
+Unsatisfiable/GRP412-1.ma ... OK TIME NEEDED: 100.19 Rating : 0.00 304
+Unsatisfiable/GRP413-1.ma ... FAIL Rating : 0.07 305
+Unsatisfiable/GRP414-1.ma ... FAIL Rating : 0.07 306
+Unsatisfiable/GRP415-1.ma ... FAIL Rating : 0.00 307
+Unsatisfiable/GRP416-1.ma ... FAIL Rating : 0.07 308
+Unsatisfiable/GRP417-1.ma ... FAIL Rating : 0.14 309
+Unsatisfiable/GRP418-1.ma ... FAIL Rating : 0.07 310
+Unsatisfiable/GRP419-1.ma ... FAIL Rating : 0.29 311
+Unsatisfiable/GRP420-1.ma ... FAIL Rating : 0.36 312
+Unsatisfiable/GRP421-1.ma ... FAIL Rating : 0.14 313
+Unsatisfiable/GRP422-1.ma ... FAIL Rating : 0.29 314
+Unsatisfiable/GRP423-1.ma ... FAIL Rating : 0.36 315
+Unsatisfiable/GRP424-1.ma ... OK TIME NEEDED: 20.62 Rating : 0.00 316
+Unsatisfiable/GRP425-1.ma ... OK TIME NEEDED: 21.62 Rating : 0.07 317
+Unsatisfiable/GRP426-1.ma ... FAIL Rating : 0.14 318
+Unsatisfiable/GRP427-1.ma ... OK TIME NEEDED: 305.14 Rating : 0.00 319
+Unsatisfiable/GRP428-1.ma ... OK TIME NEEDED: 294.14 Rating : 0.00 320
+Unsatisfiable/GRP429-1.ma ... FAIL Rating : 0.14 321
+Unsatisfiable/GRP430-1.ma ... OK TIME NEEDED: 34.32 Rating : 0.00 322
+Unsatisfiable/GRP431-1.ma ... OK TIME NEEDED: 31.66 Rating : 0.00 323
+Unsatisfiable/GRP432-1.ma ... OK TIME NEEDED: 37.46 Rating : 0.00 324
+Unsatisfiable/GRP433-1.ma ... OK TIME NEEDED: 143.73 Rating : 0.00 325
+Unsatisfiable/GRP434-1.ma ... OK TIME NEEDED: 138.71 Rating : 0.00 326
+Unsatisfiable/GRP435-1.ma ... OK TIME NEEDED: 138.74 Rating : 0.00 327
+Unsatisfiable/GRP436-1.ma ... OK TIME NEEDED: 310.76 Rating : 0.07 328
+Unsatisfiable/GRP437-1.ma ... OK TIME NEEDED: 309.63 Rating : 0.07 329
+Unsatisfiable/GRP438-1.ma ... OK TIME NEEDED: 317.18 Rating : 0.07 330
+Unsatisfiable/GRP439-1.ma ... OK TIME NEEDED: 35.34 Rating : 0.07 331
+Unsatisfiable/GRP440-1.ma ... OK TIME NEEDED: 113.26 Rating : 0.14 332
+Unsatisfiable/GRP441-1.ma ... OK TIME NEEDED: 144.64 Rating : 0.21 333
+Unsatisfiable/GRP442-1.ma ... OK TIME NEEDED: 382.99 Rating : 0.14 334
+Unsatisfiable/GRP443-1.ma ... OK TIME NEEDED: 374.16 Rating : 0.07 335
+Unsatisfiable/GRP444-1.ma ... OK TIME NEEDED: 401.85 Rating : 0.21 336
+Unsatisfiable/GRP445-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 337
+Unsatisfiable/GRP446-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 338
+Unsatisfiable/GRP447-1.ma ... OK TIME NEEDED: 0.93 Rating : 0.14 339
+Unsatisfiable/GRP448-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 340
+Unsatisfiable/GRP449-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 341
+Unsatisfiable/GRP450-1.ma ... OK TIME NEEDED: 0.93 Rating : 0.07 342
+Unsatisfiable/GRP451-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 343
+Unsatisfiable/GRP452-1.ma ... OK TIME NEEDED: 2.86 Rating : 0.14 344
+Unsatisfiable/GRP453-1.ma ... OK TIME NEEDED: 5.22 Rating : 0.21 345
+Unsatisfiable/GRP454-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 346
+Unsatisfiable/GRP455-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 347
+Unsatisfiable/GRP456-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.07 348
+Unsatisfiable/GRP457-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 349
+Unsatisfiable/GRP458-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 350
+Unsatisfiable/GRP459-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 351
+Unsatisfiable/GRP460-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 352
+Unsatisfiable/GRP461-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 353
+Unsatisfiable/GRP462-1.ma ... OK TIME NEEDED: 0.41 Rating : 0.00 354
+Unsatisfiable/GRP463-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 355
+Unsatisfiable/GRP464-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 356
+Unsatisfiable/GRP465-1.ma ... OK TIME NEEDED: 0.41 Rating : 0.00 357
+Unsatisfiable/GRP466-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 358
+Unsatisfiable/GRP467-1.ma ... OK TIME NEEDED: 0.55 Rating : 0.00 359
+Unsatisfiable/GRP468-1.ma ... OK TIME NEEDED: 2.14 Rating : 0.00 360
+Unsatisfiable/GRP469-1.ma ... FAIL Rating : 0.21 361
+Unsatisfiable/GRP470-1.ma ... FAIL Rating : 0.21 362
+Unsatisfiable/GRP471-1.ma ... FAIL Rating : 0.21 363
+Unsatisfiable/GRP472-1.ma ... OK TIME NEEDED: 43.28 Rating : 0.07 364
+Unsatisfiable/GRP473-1.ma ... OK TIME NEEDED: 40.37 Rating : 0.07 365
+Unsatisfiable/GRP474-1.ma ... OK TIME NEEDED: 65.58 Rating : 0.07 366
+Unsatisfiable/GRP475-1.ma ... OK TIME NEEDED: 42.52 Rating : 0.21 367
+Unsatisfiable/GRP476-1.ma ... OK TIME NEEDED: 42.83 Rating : 0.21 368
+Unsatisfiable/GRP477-1.ma ... OK TIME NEEDED: 44.85 Rating : 0.21 369
+Unsatisfiable/GRP478-1.ma ... OK TIME NEEDED: 33.69 Rating : 0.14 370
+Unsatisfiable/GRP479-1.ma ... OK TIME NEEDED: 31.19 Rating : 0.14 371
+Unsatisfiable/GRP480-1.ma ... OK TIME NEEDED: 46.43 Rating : 0.21 372
+Unsatisfiable/GRP481-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 373
+Unsatisfiable/GRP482-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 374
+Unsatisfiable/GRP483-1.ma ... OK TIME NEEDED: 0.77 Rating : 0.00 375
+Unsatisfiable/GRP484-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 376
+Unsatisfiable/GRP485-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 377
+Unsatisfiable/GRP486-1.ma ... OK TIME NEEDED: 0.93 Rating : 0.00 378
+Unsatisfiable/GRP487-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 379
+Unsatisfiable/GRP488-1.ma ... OK TIME NEEDED: 0.97 Rating : 0.00 380
+Unsatisfiable/GRP489-1.ma ... OK TIME NEEDED: 1.29 Rating : 0.00 381
+Unsatisfiable/GRP490-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 382
+Unsatisfiable/GRP491-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 383
+Unsatisfiable/GRP492-1.ma ... OK TIME NEEDED: 0.51 Rating : 0.00 384
+Unsatisfiable/GRP493-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 385
+Unsatisfiable/GRP494-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 386
+Unsatisfiable/GRP495-1.ma ... OK TIME NEEDED: 0.43 Rating : 0.00 387
+Unsatisfiable/GRP496-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 388
+Unsatisfiable/GRP497-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 389
+Unsatisfiable/GRP498-1.ma ... OK TIME NEEDED: 0.47 Rating : 0.00 390
+Unsatisfiable/GRP499-1.ma ... OK TIME NEEDED: 53.00 Rating : 0.00 391
+Unsatisfiable/GRP500-1.ma ... OK TIME NEEDED: 19.04 Rating : 0.07 392
+Unsatisfiable/GRP501-1.ma ... OK TIME NEEDED: 60.87 Rating : 0.14 393
+Unsatisfiable/GRP502-1.ma ... FAIL Rating : 0.14 394
+Unsatisfiable/GRP503-1.ma ... FAIL Rating : 0.14 395
+Unsatisfiable/GRP504-1.ma ... FAIL Rating : 0.14 396
+Unsatisfiable/GRP505-1.ma ... FAIL Rating : 0.50 397
+Unsatisfiable/GRP506-1.ma ... FAIL Rating : 0.64 398
+Unsatisfiable/GRP507-1.ma ... FAIL Rating : 0.57 399
+Unsatisfiable/GRP508-1.ma ... FAIL Rating : 0.57 400
+Unsatisfiable/GRP509-1.ma ... OK TIME NEEDED: 2.16 Rating : 0.00 401
+Unsatisfiable/GRP510-1.ma ... OK TIME NEEDED: 0.42 Rating : 0.00 402
+Unsatisfiable/GRP511-1.ma ... OK TIME NEEDED: 5.90 Rating : 0.00 403
+Unsatisfiable/GRP512-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 404
+Unsatisfiable/GRP513-1.ma ... OK TIME NEEDED: 1.53 Rating : 0.00 405
+Unsatisfiable/GRP514-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 406
+Unsatisfiable/GRP515-1.ma ... OK TIME NEEDED: 2.26 Rating : 0.00 407
+Unsatisfiable/GRP516-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 408
+Unsatisfiable/GRP517-1.ma ... OK TIME NEEDED: 1.88 Rating : 0.00 409
+Unsatisfiable/GRP518-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 410
+Unsatisfiable/GRP519-1.ma ... OK TIME NEEDED: 13.82 Rating : 0.00 411
+Unsatisfiable/GRP520-1.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 412
+Unsatisfiable/GRP521-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 413
+Unsatisfiable/GRP522-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 414
+Unsatisfiable/GRP523-1.ma ... OK TIME NEEDED: 1.65 Rating : 0.00 415
+Unsatisfiable/GRP524-1.ma ... OK TIME NEEDED: 0.34 Rating : 0.00 416
+Unsatisfiable/GRP525-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 417
+Unsatisfiable/GRP526-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 418
+Unsatisfiable/GRP527-1.ma ... OK TIME NEEDED: 1.97 Rating : 0.00 419
+Unsatisfiable/GRP528-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 420
+Unsatisfiable/GRP529-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 421
+Unsatisfiable/GRP530-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 422
+Unsatisfiable/GRP531-1.ma ... OK TIME NEEDED: 0.97 Rating : 0.00 423
+Unsatisfiable/GRP532-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 424
+Unsatisfiable/GRP533-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 425
+Unsatisfiable/GRP534-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 426
+Unsatisfiable/GRP535-1.ma ... OK TIME NEEDED: 1.00 Rating : 0.00 427
+Unsatisfiable/GRP536-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 428
+Unsatisfiable/GRP537-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 429
+Unsatisfiable/GRP538-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 430
+Unsatisfiable/GRP539-1.ma ... OK TIME NEEDED: 2.38 Rating : 0.00 431
+Unsatisfiable/GRP540-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 432
+Unsatisfiable/GRP541-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 433
+Unsatisfiable/GRP542-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 434
+Unsatisfiable/GRP543-1.ma ... OK TIME NEEDED: 0.42 Rating : 0.00 435
+Unsatisfiable/GRP544-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 436
+Unsatisfiable/GRP545-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 437
+Unsatisfiable/GRP546-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 438
+Unsatisfiable/GRP547-1.ma ... OK TIME NEEDED: 0.71 Rating : 0.00 439
+Unsatisfiable/GRP548-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 440
+Unsatisfiable/GRP549-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 441
+Unsatisfiable/GRP550-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.07 442
+Unsatisfiable/GRP551-1.ma ... OK TIME NEEDED: 0.54 Rating : 0.00 443
+Unsatisfiable/GRP552-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 444
+Unsatisfiable/GRP553-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 445
+Unsatisfiable/GRP554-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 446
+Unsatisfiable/GRP555-1.ma ... OK TIME NEEDED: 1.64 Rating : 0.00 447
+Unsatisfiable/GRP556-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 448
+Unsatisfiable/GRP557-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 449
+Unsatisfiable/GRP558-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 450
+Unsatisfiable/GRP559-1.ma ... OK TIME NEEDED: 6.52 Rating : 0.00 451
+Unsatisfiable/GRP560-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 452
+Unsatisfiable/GRP561-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 453
+Unsatisfiable/GRP562-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 454
+Unsatisfiable/GRP563-1.ma ... OK TIME NEEDED: 2.86 Rating : 0.00 455
+Unsatisfiable/GRP564-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 456
+Unsatisfiable/GRP565-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 457
+Unsatisfiable/GRP566-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 458
+Unsatisfiable/GRP567-1.ma ... OK TIME NEEDED: 3.11 Rating : 0.14 459
+Unsatisfiable/GRP568-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.14 460
+Unsatisfiable/GRP569-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 461
+Unsatisfiable/GRP570-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 462
+Unsatisfiable/GRP571-1.ma ... OK TIME NEEDED: 1.03 Rating : 0.14 463
+Unsatisfiable/GRP572-1.ma ... OK TIME NEEDED: 0.28 Rating : 0.07 464
+Unsatisfiable/GRP573-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 465
+Unsatisfiable/GRP574-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 466
+Unsatisfiable/GRP575-1.ma ... OK TIME NEEDED: 8.21 Rating : 0.14 467
+Unsatisfiable/GRP576-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 468
+Unsatisfiable/GRP577-1.ma ... OK TIME NEEDED: 0.14 Rating : 0.00 469
+Unsatisfiable/GRP578-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 470
+Unsatisfiable/GRP579-1.ma ... OK TIME NEEDED: 3.94 Rating : 0.07 471
+Unsatisfiable/GRP580-1.ma ... OK TIME NEEDED: 0.50 Rating : 0.00 472
+Unsatisfiable/GRP581-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 473
+Unsatisfiable/GRP582-1.ma ... OK TIME NEEDED: 0.21 Rating : 0.00 474
+Unsatisfiable/GRP583-1.ma ... OK TIME NEEDED: 2.02 Rating : 0.07 475
+Unsatisfiable/GRP584-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 476
+Unsatisfiable/GRP585-1.ma ... OK TIME NEEDED: 0.50 Rating : 0.00 477
+Unsatisfiable/GRP586-1.ma ... OK TIME NEEDED: 0.37 Rating : 0.00 478
+Unsatisfiable/GRP587-1.ma ... OK TIME NEEDED: 5.08 Rating : 0.00 479
+Unsatisfiable/GRP588-1.ma ... OK TIME NEEDED: 1.12 Rating : 0.00 480
+Unsatisfiable/GRP589-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 481
+Unsatisfiable/GRP590-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 482
+Unsatisfiable/GRP591-1.ma ... OK TIME NEEDED: 4.60 Rating : 0.07 483
+Unsatisfiable/GRP592-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.07 484
+Unsatisfiable/GRP593-1.ma ... OK TIME NEEDED: 2.08 Rating : 0.00 485
+Unsatisfiable/GRP594-1.ma ... OK TIME NEEDED: 0.72 Rating : 0.00 486
+Unsatisfiable/GRP595-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.07 487
+Unsatisfiable/GRP596-1.ma ... OK TIME NEEDED: 0.33 Rating : 0.07 488
+Unsatisfiable/GRP597-1.ma ... OK TIME NEEDED: 0.75 Rating : 0.00 489
+Unsatisfiable/GRP598-1.ma ... OK TIME NEEDED: 0.29 Rating : 0.07 490
+Unsatisfiable/GRP599-1.ma ... OK TIME NEEDED: 3.16 Rating : 0.07 491
+Unsatisfiable/GRP600-1.ma ... OK TIME NEEDED: 0.32 Rating : 0.07 492
+Unsatisfiable/GRP601-1.ma ... OK TIME NEEDED: 5.16 Rating : 0.07 493
+Unsatisfiable/GRP602-1.ma ... OK TIME NEEDED: 0.98 Rating : 0.07 494
+Unsatisfiable/GRP603-1.ma ... OK TIME NEEDED: 0.79 Rating : 0.07 495
+Unsatisfiable/GRP604-1.ma ... OK TIME NEEDED: 0.78 Rating : 0.07 496
+Unsatisfiable/GRP605-1.ma ... OK TIME NEEDED: 1.14 Rating : 0.00 497
+Unsatisfiable/GRP606-1.ma ... OK TIME NEEDED: 1.16 Rating : 0.00 498
+Unsatisfiable/GRP607-1.ma ... OK TIME NEEDED: 5.62 Rating : 0.00 499
+Unsatisfiable/GRP608-1.ma ... OK TIME NEEDED: 1.14 Rating : 0.00 500
+Unsatisfiable/GRP609-1.ma ... OK TIME NEEDED: 2.24 Rating : 0.07 501
+Unsatisfiable/GRP610-1.ma ... OK TIME NEEDED: 0.46 Rating : 0.07 502
+Unsatisfiable/GRP611-1.ma ... OK TIME NEEDED: 3.13 Rating : 0.00 503
+Unsatisfiable/GRP612-1.ma ... OK TIME NEEDED: 0.46 Rating : 0.07 504
+Unsatisfiable/GRP613-1.ma ... OK TIME NEEDED: 0.70 Rating : 0.00 505
+Unsatisfiable/GRP614-1.ma ... OK TIME NEEDED: 0.32 Rating : 0.00 506
+Unsatisfiable/GRP615-1.ma ... OK TIME NEEDED: 1.27 Rating : 0.07 507
+Unsatisfiable/GRP616-1.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 508
+Unsatisfiable/LAT006-1.ma ... OK TIME NEEDED: 135.83 Rating : 0.14 509
+Unsatisfiable/LAT007-1.ma ... OK TIME NEEDED: 85.97 Rating : 0.36 510
+Unsatisfiable/LAT008-1.ma ... OK TIME NEEDED: 0.60 Rating : 0.07 511
+Unsatisfiable/LAT009-1.ma ... OK TIME NEEDED: 470.38 Rating : 0.00 512
+Unsatisfiable/LAT010-1.ma ... FAIL Rating : 0.00 513
+Unsatisfiable/LAT011-1.ma ... OK TIME NEEDED: 590.45 Rating : 0.07 514
+Unsatisfiable/LAT012-1.ma ... OK TIME NEEDED: 6.68 Rating : 0.00 515
+Unsatisfiable/LAT013-1.ma ... OK TIME NEEDED: 473.81 Rating : 0.14 516
+Unsatisfiable/LAT014-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 517
+Unsatisfiable/LAT017-1.ma ... FAIL Rating : 0.71 518
+Unsatisfiable/LAT018-1.ma ... FAIL Rating : 0.93 519
+Unsatisfiable/LAT019-1.ma ... FAIL Rating : 0.00 520
+Unsatisfiable/LAT020-1.ma ... FAIL Rating : 0.50 521
+Unsatisfiable/LAT021-1.ma ... FAIL Rating : 0.00 522
+Unsatisfiable/LAT022-1.ma ... 
\ No newline at end of file
diff --git a/matita/tests/TPTP/log.600.30-6.weghtlookingatgoalsymbols.txt b/matita/tests/TPTP/log.600.30-6.weghtlookingatgoalsymbols.txt
new file mode 100644 (file)
index 0000000..cdb6a74
--- /dev/null
@@ -0,0 +1,698 @@
+Unsatisfiable/ALG005-1.ma ... OK TIME NEEDED: 48.39 Rating : 0.07 1
+Unsatisfiable/ALG006-1.ma ... OK TIME NEEDED: 3.61 Rating : 0.00 2
+Unsatisfiable/ALG007-1.ma ... OK TIME NEEDED: 10.93 Rating : 0.00 3
+Unsatisfiable/BOO001-1.ma ... OK TIME NEEDED: 1.04 Rating : 0.00 4
+Unsatisfiable/BOO002-1.ma ... OK TIME NEEDED: 12.66 Rating : 0.07 5
+Unsatisfiable/BOO002-2.ma ... OK TIME NEEDED: 8.00 Rating : 0.00 6
+Unsatisfiable/BOO003-2.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 7
+Unsatisfiable/BOO003-4.ma ... OK TIME NEEDED: 0.91 Rating : 0.00 8
+Unsatisfiable/BOO004-2.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 9
+Unsatisfiable/BOO004-4.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 10
+Unsatisfiable/BOO005-2.ma ... OK TIME NEEDED: 0.14 Rating : 0.00 11
+Unsatisfiable/BOO005-4.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 12
+Unsatisfiable/BOO006-2.ma ... OK TIME NEEDED: 0.90 Rating : 0.00 13
+Unsatisfiable/BOO006-4.ma ... OK TIME NEEDED: 1.60 Rating : 0.00 14
+Unsatisfiable/BOO007-2.ma ... OK TIME NEEDED: 4.47 Rating : 0.14 15
+Unsatisfiable/BOO007-4.ma ... OK TIME NEEDED: 26.84 Rating : 0.07 16
+Unsatisfiable/BOO008-2.ma ... OK TIME NEEDED: 28.51 Rating : 0.07 17
+Unsatisfiable/BOO008-4.ma ... OK TIME NEEDED: 228.31 Rating : 0.00 18
+Unsatisfiable/BOO009-2.ma ... OK TIME NEEDED: 0.34 Rating : 0.00 19
+Unsatisfiable/BOO009-4.ma ... OK TIME NEEDED: 0.69 Rating : 0.00 20
+Unsatisfiable/BOO010-2.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 21
+Unsatisfiable/BOO010-4.ma ... OK TIME NEEDED: 0.62 Rating : 0.00 22
+Unsatisfiable/BOO011-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 23
+Unsatisfiable/BOO011-4.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 24
+Unsatisfiable/BOO012-2.ma ... OK TIME NEEDED: 0.43 Rating : 0.00 25
+Unsatisfiable/BOO012-4.ma ... OK TIME NEEDED: 0.42 Rating : 0.00 26
+Unsatisfiable/BOO013-2.ma ... OK TIME NEEDED: 0.28 Rating : 0.00 27
+Unsatisfiable/BOO013-4.ma ... OK TIME NEEDED: 0.29 Rating : 0.00 28
+Unsatisfiable/BOO014-2.ma ... OK TIME NEEDED: 8.19 Rating : 0.00 29
+Unsatisfiable/BOO014-4.ma ... OK TIME NEEDED: 22.41 Rating : 0.00 30
+Unsatisfiable/BOO015-2.ma ... OK TIME NEEDED: 3.13 Rating : 0.00 31
+Unsatisfiable/BOO015-4.ma ... OK TIME NEEDED: 23.05 Rating : 0.00 32
+Unsatisfiable/BOO016-2.ma ... OK TIME NEEDED: 0.39 Rating : 0.00 33
+Unsatisfiable/BOO017-2.ma ... OK TIME NEEDED: 1.57 Rating : 0.00 34
+Unsatisfiable/BOO018-4.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 35
+Unsatisfiable/BOO021-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.07 36
+Unsatisfiable/BOO022-1.ma ... OK TIME NEEDED: 69.88 Rating : 0.07 37
+Unsatisfiable/BOO023-1.ma ... OK TIME NEEDED: 367.68 Rating : 0.50 38
+Unsatisfiable/BOO024-1.ma ... OK TIME NEEDED: 14.80 Rating : 0.00 39
+Unsatisfiable/BOO025-1.ma ... OK TIME NEEDED: 13.56 Rating : 0.07 40
+Unsatisfiable/BOO026-1.ma ... OK TIME NEEDED: 20.74 Rating : 0.07 41
+Unsatisfiable/BOO028-1.ma ... FAIL Rating : 0.07 42
+Unsatisfiable/BOO029-1.ma ... OK TIME NEEDED: 64.07 Rating : 0.00 43
+Unsatisfiable/BOO031-1.ma ... FAIL Rating : 0.21 44
+Unsatisfiable/BOO034-1.ma ... OK TIME NEEDED: 1.47 Rating : 0.21 45
+Unsatisfiable/BOO067-1.ma ... FAIL Rating : 0.21 46
+Unsatisfiable/BOO068-1.ma ... OK TIME NEEDED: 1.70 Rating : 0.00 47
+Unsatisfiable/BOO069-1.ma ... OK TIME NEEDED: 0.90 Rating : 0.00 48
+Unsatisfiable/BOO070-1.ma ... OK TIME NEEDED: 1.90 Rating : 0.00 49
+Unsatisfiable/BOO071-1.ma ... OK TIME NEEDED: 0.90 Rating : 0.00 50
+Unsatisfiable/BOO072-1.ma ... FAIL Rating : 0.07 51
+Unsatisfiable/BOO073-1.ma ... FAIL Rating : 0.36 52
+Unsatisfiable/BOO074-1.ma ... FAIL Rating : 0.07 53
+Unsatisfiable/BOO075-1.ma ... OK TIME NEEDED: 0.79 Rating : 0.00 54
+Unsatisfiable/BOO076-1.ma ... FAIL Rating : 0.71 55
+Unsatisfiable/COL001-1.ma ... OK TIME NEEDED: 49.14 Rating : 0.07 56
+Unsatisfiable/COL001-2.ma ... OK TIME NEEDED: 1.99 Rating : 0.07 57
+Unsatisfiable/COL002-1.ma ... OK TIME NEEDED: 2.43 Rating : 0.00 58
+Unsatisfiable/COL002-4.ma ... FAIL Rating : 0.07 59
+Unsatisfiable/COL002-5.ma ... FAIL Rating : 0.43 60
+Unsatisfiable/COL003-1.ma ... FAIL Rating : 0.79 61
+Unsatisfiable/COL004-1.ma ... FAIL Rating : 0.57 62
+Unsatisfiable/COL004-3.ma ... OK TIME NEEDED: 0.01 Rating : 0.21 63
+Unsatisfiable/COL006-1.ma ... FAIL Rating : 0.57 64
+Unsatisfiable/COL006-5.ma ... FAIL Rating : 0.64 65
+Unsatisfiable/COL006-6.ma ... FAIL Rating : 0.64 66
+Unsatisfiable/COL006-7.ma ... FAIL Rating : 0.64 67
+Unsatisfiable/COL007-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 68
+Unsatisfiable/COL008-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 69
+Unsatisfiable/COL009-1.ma ... OK TIME NEEDED: 5.25 Rating : 0.07 70
+Unsatisfiable/COL010-1.ma ... OK TIME NEEDED: 1.74 Rating : 0.07 71
+Unsatisfiable/COL011-1.ma ... FAIL Rating : 0.36 72
+Unsatisfiable/COL012-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 73
+Unsatisfiable/COL013-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 74
+Unsatisfiable/COL014-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 75
+Unsatisfiable/COL015-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 76
+Unsatisfiable/COL016-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 77
+Unsatisfiable/COL017-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 78
+Unsatisfiable/COL018-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 79
+Unsatisfiable/COL019-1.ma ... OK TIME NEEDED: 2.25 Rating : 0.00 80
+Unsatisfiable/COL020-1.ma ... FAIL Rating : 0.07 81
+Unsatisfiable/COL021-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 82
+Unsatisfiable/COL022-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 83
+Unsatisfiable/COL023-1.ma ... FAIL Rating : 0.00 84
+Unsatisfiable/COL024-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 85
+Unsatisfiable/COL025-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 86
+Unsatisfiable/COL026-1.ma ... FAIL Rating : 0.07 87
+Unsatisfiable/COL027-1.ma ... FAIL Rating : 0.00 88
+Unsatisfiable/COL029-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 89
+Unsatisfiable/COL030-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.14 90
+Unsatisfiable/COL031-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 91
+Unsatisfiable/COL032-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.14 92
+Unsatisfiable/COL033-1.ma ... OK TIME NEEDED: 5.88 Rating : 0.07 93
+Unsatisfiable/COL034-1.ma ... OK TIME NEEDED: 4.25 Rating : 0.43 94
+Unsatisfiable/COL035-1.ma ... FAIL Rating : 0.14 95
+Unsatisfiable/COL036-1.ma ... FAIL Rating : 0.57 96
+Unsatisfiable/COL037-1.ma ... FAIL Rating : 0.29 97
+Unsatisfiable/COL038-1.ma ... FAIL Rating : 0.64 98
+Unsatisfiable/COL039-1.ma ... OK TIME NEEDED: 17.10 Rating : 0.00 99
+Unsatisfiable/COL041-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.36 100
+Unsatisfiable/COL042-1.ma ... FAIL Rating : 0.86 101
+Unsatisfiable/COL042-6.ma ... FAIL Rating : 0.14 102
+Unsatisfiable/COL042-7.ma ... FAIL Rating : 0.14 103
+Unsatisfiable/COL042-8.ma ... FAIL Rating : 0.14 104
+Unsatisfiable/COL042-9.ma ... FAIL Rating : 0.14 105
+Unsatisfiable/COL043-1.ma ... FAIL Rating : 0.86 106
+Unsatisfiable/COL043-3.ma ... FAIL Rating : 0.71 107
+Unsatisfiable/COL044-1.ma ... FAIL Rating : 0.21 108
+Unsatisfiable/COL044-6.ma ... FAIL Rating : 0.64 109
+Unsatisfiable/COL044-7.ma ... FAIL Rating : 0.50 110
+Unsatisfiable/COL044-8.ma ... FAIL Rating : 0.71 111
+Unsatisfiable/COL044-9.ma ... FAIL Rating : 0.64 112
+Unsatisfiable/COL045-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 113
+Unsatisfiable/COL046-1.ma ... FAIL Rating : 0.64 114
+Unsatisfiable/COL048-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 115
+Unsatisfiable/COL049-1.ma ... OK TIME NEEDED: 79.25 Rating : 0.29 116
+Unsatisfiable/COL050-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 117
+Unsatisfiable/COL051-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 118
+Unsatisfiable/COL052-1.ma ... FAIL Rating : 0.00 119
+Unsatisfiable/COL053-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 120
+Unsatisfiable/COL056-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.07 121
+Unsatisfiable/COL057-1.ma ... FAIL Rating : 0.36 122
+Unsatisfiable/COL058-1.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 123
+Unsatisfiable/COL058-2.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 124
+Unsatisfiable/COL058-3.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 125
+Unsatisfiable/COL059-1.ma ... FAIL Rating : 0.00 126
+Unsatisfiable/COL060-1.ma ... OK TIME NEEDED: 18.48 Rating : 0.36 127
+Unsatisfiable/COL060-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 128
+Unsatisfiable/COL060-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 129
+Unsatisfiable/COL061-1.ma ... OK TIME NEEDED: 392.56 Rating : 0.36 130
+Unsatisfiable/COL061-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 131
+Unsatisfiable/COL061-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 132
+Unsatisfiable/COL062-1.ma ... FAIL Rating : 0.50 133
+Unsatisfiable/COL062-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 134
+Unsatisfiable/COL062-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 135
+Unsatisfiable/COL063-1.ma ... FAIL Rating : 0.50 136
+Unsatisfiable/COL063-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 137
+Unsatisfiable/COL063-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 138
+Unsatisfiable/COL063-4.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 139
+Unsatisfiable/COL063-5.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 140
+Unsatisfiable/COL063-6.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 141
+Unsatisfiable/COL064-1.ma ... FAIL Rating : 0.64 142
+Unsatisfiable/COL064-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 143
+Unsatisfiable/COL064-3.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 144
+Unsatisfiable/COL064-4.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 145
+Unsatisfiable/COL064-5.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 146
+Unsatisfiable/COL064-6.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 147
+Unsatisfiable/COL064-7.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 148
+Unsatisfiable/COL064-8.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 149
+Unsatisfiable/COL064-9.ma ... OK TIME NEEDED: 0.00 Rating : 0.07 150
+Unsatisfiable/COL065-1.ma ... FAIL Rating : 0.71 151
+Unsatisfiable/COL066-1.ma ... FAIL Rating : 0.93 152
+Unsatisfiable/COL066-2.ma ... OK TIME NEEDED: 2.73 Rating : 0.00 153
+Unsatisfiable/COL066-3.ma ... OK TIME NEEDED: 2.51 Rating : 0.00 154
+Unsatisfiable/COL070-1.ma ... FAIL Rating : 0.07 155
+Unsatisfiable/COL075-2.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 156
+Unsatisfiable/COL083-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 157
+Unsatisfiable/COL084-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 158
+Unsatisfiable/COL085-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 159
+Unsatisfiable/COL086-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 160
+Unsatisfiable/GRP001-2.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 161
+Unsatisfiable/GRP001-4.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 162
+Unsatisfiable/GRP002-2.ma ... OK TIME NEEDED: 26.68 Rating : 0.00 163
+Unsatisfiable/GRP002-3.ma ... OK TIME NEEDED: 28.03 Rating : 0.00 164
+Unsatisfiable/GRP002-4.ma ... OK TIME NEEDED: 25.66 Rating : 0.00 165
+Unsatisfiable/GRP010-4.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 166
+Unsatisfiable/GRP011-4.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 167
+Unsatisfiable/GRP012-4.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 168
+Unsatisfiable/GRP014-1.ma ... FAIL Rating : 0.14 169
+Unsatisfiable/GRP022-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 170
+Unsatisfiable/GRP023-2.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 171
+Unsatisfiable/GRP024-5.ma ... FAIL Rating : 0.50 172
+Unsatisfiable/GRP114-1.ma ... OK TIME NEEDED: 30.83 Rating : 0.29 173
+Unsatisfiable/GRP115-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 174
+Unsatisfiable/GRP116-1.ma ... OK TIME NEEDED: 0.43 Rating : 0.00 175
+Unsatisfiable/GRP117-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 176
+Unsatisfiable/GRP118-1.ma ... OK TIME NEEDED: 0.51 Rating : 0.00 177
+Unsatisfiable/GRP119-1.ma ... OK TIME NEEDED: 82.57 Rating : 0.00 178
+Unsatisfiable/GRP120-1.ma ... OK TIME NEEDED: 86.41 Rating : 0.00 179
+Unsatisfiable/GRP121-1.ma ... OK TIME NEEDED: 84.88 Rating : 0.00 180
+Unsatisfiable/GRP122-1.ma ... OK TIME NEEDED: 86.94 Rating : 0.07 181
+Unsatisfiable/GRP136-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 182
+Unsatisfiable/GRP137-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 183
+Unsatisfiable/GRP138-1.ma ... OK TIME NEEDED: 1.06 Rating : 0.00 184
+Unsatisfiable/GRP139-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 185
+Unsatisfiable/GRP140-1.ma ... OK TIME NEEDED: 0.89 Rating : 0.00 186
+Unsatisfiable/GRP141-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 187
+Unsatisfiable/GRP142-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 188
+Unsatisfiable/GRP143-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 189
+Unsatisfiable/GRP144-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 190
+Unsatisfiable/GRP145-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 191
+Unsatisfiable/GRP146-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 192
+Unsatisfiable/GRP147-1.ma ... OK TIME NEEDED: 1.17 Rating : 0.00 193
+Unsatisfiable/GRP148-1.ma ... OK TIME NEEDED: 0.82 Rating : 0.00 194
+Unsatisfiable/GRP149-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 195
+Unsatisfiable/GRP150-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 196
+Unsatisfiable/GRP151-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 197
+Unsatisfiable/GRP152-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 198
+Unsatisfiable/GRP153-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 199
+Unsatisfiable/GRP154-1.ma ... OK TIME NEEDED: 0.40 Rating : 0.00 200
+Unsatisfiable/GRP155-1.ma ... OK TIME NEEDED: 0.49 Rating : 0.00 201
+Unsatisfiable/GRP156-1.ma ... OK TIME NEEDED: 0.49 Rating : 0.00 202
+Unsatisfiable/GRP157-1.ma ... OK TIME NEEDED: 0.28 Rating : 0.00 203
+Unsatisfiable/GRP158-1.ma ... OK TIME NEEDED: 0.32 Rating : 0.00 204
+Unsatisfiable/GRP159-1.ma ... OK TIME NEEDED: 0.27 Rating : 0.00 205
+Unsatisfiable/GRP160-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 206
+Unsatisfiable/GRP161-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 207
+Unsatisfiable/GRP162-1.ma ... OK TIME NEEDED: 0.27 Rating : 0.00 208
+Unsatisfiable/GRP163-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 209
+Unsatisfiable/GRP164-1.ma ... FAIL Rating : 0.93 210
+Unsatisfiable/GRP164-2.ma ... FAIL Rating : 0.93 211
+Unsatisfiable/GRP165-1.ma ... OK TIME NEEDED: 273.31 Rating : 0.00 212
+Unsatisfiable/GRP165-2.ma ... OK TIME NEEDED: 327.84 Rating : 0.00 213
+Unsatisfiable/GRP166-1.ma ... OK TIME NEEDED: 22.42 Rating : 0.00 214
+Unsatisfiable/GRP166-2.ma ... OK TIME NEEDED: 5.30 Rating : 0.00 215
+Unsatisfiable/GRP166-3.ma ... OK TIME NEEDED: 0.87 Rating : 0.00 216
+Unsatisfiable/GRP166-4.ma ... OK TIME NEEDED: 564.71 Rating : 0.00 217
+Unsatisfiable/GRP167-1.ma ... OK TIME NEEDED: 74.28 Rating : 0.21 218
+Unsatisfiable/GRP167-2.ma ... OK TIME NEEDED: 46.19 Rating : 0.21 219
+Unsatisfiable/GRP167-3.ma ... FAIL Rating : 0.50 220
+Unsatisfiable/GRP167-4.ma ... FAIL Rating : 0.43 221
+Unsatisfiable/GRP167-5.ma ... OK TIME NEEDED: 3.91 Rating : 0.14 222
+Unsatisfiable/GRP168-1.ma ... OK TIME NEEDED: 0.37 Rating : 0.07 223
+Unsatisfiable/GRP168-2.ma ... OK TIME NEEDED: 0.41 Rating : 0.07 224
+Unsatisfiable/GRP169-1.ma ... OK TIME NEEDED: 277.68 Rating : 0.00 225
+Unsatisfiable/GRP169-2.ma ... OK TIME NEEDED: 312.44 Rating : 0.00 226
+Unsatisfiable/GRP170-1.ma ... OK TIME NEEDED: 401.61 Rating : 0.00 227
+Unsatisfiable/GRP170-2.ma ... OK TIME NEEDED: 85.80 Rating : 0.00 228
+Unsatisfiable/GRP170-3.ma ... OK TIME NEEDED: 555.43 Rating : 0.00 229
+Unsatisfiable/GRP170-4.ma ... OK TIME NEEDED: 73.04 Rating : 0.00 230
+Unsatisfiable/GRP171-1.ma ... OK TIME NEEDED: 0.27 Rating : 0.00 231
+Unsatisfiable/GRP171-2.ma ... OK TIME NEEDED: 0.29 Rating : 0.00 232
+Unsatisfiable/GRP172-1.ma ... OK TIME NEEDED: 0.58 Rating : 0.00 233
+Unsatisfiable/GRP172-2.ma ... OK TIME NEEDED: 0.56 Rating : 0.00 234
+Unsatisfiable/GRP173-1.ma ... OK TIME NEEDED: 12.62 Rating : 0.00 235
+Unsatisfiable/GRP174-1.ma ... OK TIME NEEDED: 12.22 Rating : 0.00 236
+Unsatisfiable/GRP175-1.ma ... OK TIME NEEDED: 142.17 Rating : 0.00 237
+Unsatisfiable/GRP175-2.ma ... OK TIME NEEDED: 152.24 Rating : 0.00 238
+Unsatisfiable/GRP175-3.ma ... OK TIME NEEDED: 186.04 Rating : 0.00 239
+Unsatisfiable/GRP175-4.ma ... OK TIME NEEDED: 134.96 Rating : 0.00 240
+Unsatisfiable/GRP176-1.ma ... OK TIME NEEDED: 0.37 Rating : 0.00 241
+Unsatisfiable/GRP176-2.ma ... OK TIME NEEDED: 0.35 Rating : 0.00 242
+Unsatisfiable/GRP177-2.ma ... FAIL Rating : 0.21 243
+Unsatisfiable/GRP178-1.ma ... OK TIME NEEDED: 181.49 Rating : 0.14 244
+Unsatisfiable/GRP178-2.ma ... OK TIME NEEDED: 480.31 Rating : 0.14 245
+Unsatisfiable/GRP179-1.ma ... FAIL Rating : 0.50 246
+Unsatisfiable/GRP179-2.ma ... OK TIME NEEDED: 521.94 Rating : 0.50 247
+Unsatisfiable/GRP179-3.ma ... FAIL Rating : 0.36 248
+Unsatisfiable/GRP180-1.ma ... FAIL Rating : 0.50 249
+Unsatisfiable/GRP180-2.ma ... FAIL Rating : 0.43 250
+Unsatisfiable/GRP181-1.ma ... FAIL Rating : 0.71 251
+Unsatisfiable/GRP181-2.ma ... FAIL Rating : 0.71 252
+Unsatisfiable/GRP181-3.ma ... OK TIME NEEDED: 444.09 Rating : 0.43 253
+Unsatisfiable/GRP181-4.ma ... OK TIME NEEDED: 462.23 Rating : 0.43 254
+Unsatisfiable/GRP182-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 255
+Unsatisfiable/GRP182-2.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 256
+Unsatisfiable/GRP182-3.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 257
+Unsatisfiable/GRP182-4.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 258
+Unsatisfiable/GRP183-1.ma ... FAIL Rating : 0.43 259
+Unsatisfiable/GRP183-2.ma ... FAIL Rating : 0.43 260
+Unsatisfiable/GRP183-3.ma ... FAIL Rating : 0.43 261
+Unsatisfiable/GRP183-4.ma ... FAIL Rating : 0.36 262
+Unsatisfiable/GRP184-1.ma ... OK TIME NEEDED: 349.05 Rating : 0.29 263
+Unsatisfiable/GRP184-2.ma ... FAIL Rating : 0.14 264
+Unsatisfiable/GRP184-3.ma ... OK TIME NEEDED: 369.14 Rating : 0.21 265
+Unsatisfiable/GRP184-4.ma ... OK TIME NEEDED: 78.89 Rating : 0.00 266
+Unsatisfiable/GRP185-1.ma ... FAIL Rating : 0.07 267
+Unsatisfiable/GRP185-2.ma ... FAIL Rating : 0.07 268
+Unsatisfiable/GRP185-3.ma ... FAIL Rating : 0.21 269
+Unsatisfiable/GRP185-4.ma ... FAIL Rating : 0.21 270
+Unsatisfiable/GRP186-1.ma ... OK TIME NEEDED: 315.24 Rating : 0.57 271
+Unsatisfiable/GRP186-2.ma ... FAIL Rating : 0.36 272
+Unsatisfiable/GRP186-3.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 273
+Unsatisfiable/GRP186-4.ma ... OK TIME NEEDED: 0.20 Rating : 0.00 274
+Unsatisfiable/GRP187-1.ma ... FAIL Rating : 0.64 275
+Unsatisfiable/GRP188-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 276
+Unsatisfiable/GRP188-2.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 277
+Unsatisfiable/GRP189-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 278
+Unsatisfiable/GRP189-2.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 279
+Unsatisfiable/GRP190-1.ma ... OK TIME NEEDED: 180.68 Rating : 0.00 280
+Unsatisfiable/GRP190-2.ma ... OK TIME NEEDED: 181.56 Rating : 0.00 281
+Unsatisfiable/GRP191-1.ma ... OK TIME NEEDED: 150.42 Rating : 0.00 282
+Unsatisfiable/GRP191-2.ma ... OK TIME NEEDED: 183.12 Rating : 0.00 283
+Unsatisfiable/GRP192-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.07 284
+Unsatisfiable/GRP193-1.ma ... OK TIME NEEDED: 182.89 Rating : 0.00 285
+Unsatisfiable/GRP193-2.ma ... OK TIME NEEDED: 410.76 Rating : 0.00 286
+Unsatisfiable/GRP195-1.ma ... FAIL Rating : 0.00 287
+Unsatisfiable/GRP196-1.ma ... FAIL Rating : 0.93 288
+Unsatisfiable/GRP200-1.ma ... FAIL Rating : 0.29 289
+Unsatisfiable/GRP201-1.ma ... FAIL Rating : 0.36 290
+Unsatisfiable/GRP202-1.ma ... FAIL Rating : 0.43 291
+Unsatisfiable/GRP203-1.ma ... FAIL Rating : 0.21 292
+Unsatisfiable/GRP205-1.ma ... FAIL Rating : 0.43 293
+Unsatisfiable/GRP206-1.ma ... OK TIME NEEDED: 0.85 Rating : 0.00 294
+Unsatisfiable/GRP403-1.ma ... OK TIME NEEDED: 74.83 Rating : 0.07 295
+Unsatisfiable/GRP404-1.ma ... OK TIME NEEDED: 183.06 Rating : 0.21 296
+Unsatisfiable/GRP405-1.ma ... OK TIME NEEDED: 167.39 Rating : 0.21 297
+Unsatisfiable/GRP406-1.ma ... FAIL Rating : 0.00 298
+Unsatisfiable/GRP407-1.ma ... FAIL Rating : 0.00 299
+Unsatisfiable/GRP408-1.ma ... FAIL Rating : 0.00 300
+Unsatisfiable/GRP409-1.ma ... OK TIME NEEDED: 8.50 Rating : 0.00 301
+Unsatisfiable/GRP410-1.ma ... OK TIME NEEDED: 14.24 Rating : 0.21 302
+Unsatisfiable/GRP411-1.ma ... OK TIME NEEDED: 15.00 Rating : 0.21 303
+Unsatisfiable/GRP412-1.ma ... OK TIME NEEDED: 101.41 Rating : 0.00 304
+Unsatisfiable/GRP413-1.ma ... FAIL Rating : 0.07 305
+Unsatisfiable/GRP414-1.ma ... FAIL Rating : 0.07 306
+Unsatisfiable/GRP415-1.ma ... FAIL Rating : 0.00 307
+Unsatisfiable/GRP416-1.ma ... FAIL Rating : 0.07 308
+Unsatisfiable/GRP417-1.ma ... FAIL Rating : 0.14 309
+Unsatisfiable/GRP418-1.ma ... FAIL Rating : 0.07 310
+Unsatisfiable/GRP419-1.ma ... FAIL Rating : 0.29 311
+Unsatisfiable/GRP420-1.ma ... FAIL Rating : 0.36 312
+Unsatisfiable/GRP421-1.ma ... FAIL Rating : 0.14 313
+Unsatisfiable/GRP422-1.ma ... FAIL Rating : 0.29 314
+Unsatisfiable/GRP423-1.ma ... FAIL Rating : 0.36 315
+Unsatisfiable/GRP424-1.ma ... OK TIME NEEDED: 21.12 Rating : 0.00 316
+Unsatisfiable/GRP425-1.ma ... OK TIME NEEDED: 22.54 Rating : 0.07 317
+Unsatisfiable/GRP426-1.ma ... FAIL Rating : 0.14 318
+Unsatisfiable/GRP427-1.ma ... OK TIME NEEDED: 301.63 Rating : 0.00 319
+Unsatisfiable/GRP428-1.ma ... OK TIME NEEDED: 295.24 Rating : 0.00 320
+Unsatisfiable/GRP429-1.ma ... FAIL Rating : 0.14 321
+Unsatisfiable/GRP430-1.ma ... OK TIME NEEDED: 34.32 Rating : 0.00 322
+Unsatisfiable/GRP431-1.ma ... OK TIME NEEDED: 31.45 Rating : 0.00 323
+Unsatisfiable/GRP432-1.ma ... OK TIME NEEDED: 37.39 Rating : 0.00 324
+Unsatisfiable/GRP433-1.ma ... OK TIME NEEDED: 144.49 Rating : 0.00 325
+Unsatisfiable/GRP434-1.ma ... OK TIME NEEDED: 138.74 Rating : 0.00 326
+Unsatisfiable/GRP435-1.ma ... OK TIME NEEDED: 137.73 Rating : 0.00 327
+Unsatisfiable/GRP436-1.ma ... OK TIME NEEDED: 310.33 Rating : 0.07 328
+Unsatisfiable/GRP437-1.ma ... OK TIME NEEDED: 309.63 Rating : 0.07 329
+Unsatisfiable/GRP438-1.ma ... OK TIME NEEDED: 318.06 Rating : 0.07 330
+Unsatisfiable/GRP439-1.ma ... OK TIME NEEDED: 35.55 Rating : 0.07 331
+Unsatisfiable/GRP440-1.ma ... OK TIME NEEDED: 112.63 Rating : 0.14 332
+Unsatisfiable/GRP441-1.ma ... OK TIME NEEDED: 144.24 Rating : 0.21 333
+Unsatisfiable/GRP442-1.ma ... OK TIME NEEDED: 379.87 Rating : 0.14 334
+Unsatisfiable/GRP443-1.ma ... OK TIME NEEDED: 376.42 Rating : 0.07 335
+Unsatisfiable/GRP444-1.ma ... OK TIME NEEDED: 403.21 Rating : 0.21 336
+Unsatisfiable/GRP445-1.ma ... OK TIME NEEDED: 0.43 Rating : 0.00 337
+Unsatisfiable/GRP446-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 338
+Unsatisfiable/GRP447-1.ma ... OK TIME NEEDED: 0.89 Rating : 0.14 339
+Unsatisfiable/GRP448-1.ma ... OK TIME NEEDED: 0.43 Rating : 0.00 340
+Unsatisfiable/GRP449-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 341
+Unsatisfiable/GRP450-1.ma ... OK TIME NEEDED: 0.89 Rating : 0.07 342
+Unsatisfiable/GRP451-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 343
+Unsatisfiable/GRP452-1.ma ... OK TIME NEEDED: 1.93 Rating : 0.14 344
+Unsatisfiable/GRP453-1.ma ... OK TIME NEEDED: 4.03 Rating : 0.21 345
+Unsatisfiable/GRP454-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 346
+Unsatisfiable/GRP455-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 347
+Unsatisfiable/GRP456-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.07 348
+Unsatisfiable/GRP457-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 349
+Unsatisfiable/GRP458-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 350
+Unsatisfiable/GRP459-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 351
+Unsatisfiable/GRP460-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 352
+Unsatisfiable/GRP461-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 353
+Unsatisfiable/GRP462-1.ma ... OK TIME NEEDED: 0.33 Rating : 0.00 354
+Unsatisfiable/GRP463-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 355
+Unsatisfiable/GRP464-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 356
+Unsatisfiable/GRP465-1.ma ... OK TIME NEEDED: 0.36 Rating : 0.00 357
+Unsatisfiable/GRP466-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 358
+Unsatisfiable/GRP467-1.ma ... OK TIME NEEDED: 0.80 Rating : 0.00 359
+Unsatisfiable/GRP468-1.ma ... OK TIME NEEDED: 1.72 Rating : 0.00 360
+Unsatisfiable/GRP469-1.ma ... FAIL Rating : 0.21 361
+Unsatisfiable/GRP470-1.ma ... FAIL Rating : 0.21 362
+Unsatisfiable/GRP471-1.ma ... OK TIME NEEDED: 138.72 Rating : 0.21 363
+Unsatisfiable/GRP472-1.ma ... OK TIME NEEDED: 45.08 Rating : 0.07 364
+Unsatisfiable/GRP473-1.ma ... OK TIME NEEDED: 41.04 Rating : 0.07 365
+Unsatisfiable/GRP474-1.ma ... OK TIME NEEDED: 56.80 Rating : 0.07 366
+Unsatisfiable/GRP475-1.ma ... OK TIME NEEDED: 43.16 Rating : 0.21 367
+Unsatisfiable/GRP476-1.ma ... OK TIME NEEDED: 42.61 Rating : 0.21 368
+Unsatisfiable/GRP477-1.ma ... OK TIME NEEDED: 48.32 Rating : 0.21 369
+Unsatisfiable/GRP478-1.ma ... OK TIME NEEDED: 35.68 Rating : 0.14 370
+Unsatisfiable/GRP479-1.ma ... OK TIME NEEDED: 31.34 Rating : 0.14 371
+Unsatisfiable/GRP480-1.ma ... OK TIME NEEDED: 44.04 Rating : 0.21 372
+Unsatisfiable/GRP481-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 373
+Unsatisfiable/GRP482-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 374
+Unsatisfiable/GRP483-1.ma ... OK TIME NEEDED: 0.68 Rating : 0.00 375
+Unsatisfiable/GRP484-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 376
+Unsatisfiable/GRP485-1.ma ... OK TIME NEEDED: 0.24 Rating : 0.00 377
+Unsatisfiable/GRP486-1.ma ... OK TIME NEEDED: 1.14 Rating : 0.00 378
+Unsatisfiable/GRP487-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 379
+Unsatisfiable/GRP488-1.ma ... OK TIME NEEDED: 0.56 Rating : 0.00 380
+Unsatisfiable/GRP489-1.ma ... OK TIME NEEDED: 1.13 Rating : 0.00 381
+Unsatisfiable/GRP490-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 382
+Unsatisfiable/GRP491-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 383
+Unsatisfiable/GRP492-1.ma ... OK TIME NEEDED: 0.33 Rating : 0.00 384
+Unsatisfiable/GRP493-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 385
+Unsatisfiable/GRP494-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 386
+Unsatisfiable/GRP495-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 387
+Unsatisfiable/GRP496-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 388
+Unsatisfiable/GRP497-1.ma ... OK TIME NEEDED: 0.18 Rating : 0.00 389
+Unsatisfiable/GRP498-1.ma ... OK TIME NEEDED: 0.33 Rating : 0.00 390
+Unsatisfiable/GRP499-1.ma ... OK TIME NEEDED: 45.83 Rating : 0.00 391
+Unsatisfiable/GRP500-1.ma ... OK TIME NEEDED: 16.47 Rating : 0.07 392
+Unsatisfiable/GRP501-1.ma ... OK TIME NEEDED: 79.65 Rating : 0.14 393
+Unsatisfiable/GRP502-1.ma ... FAIL Rating : 0.14 394
+Unsatisfiable/GRP503-1.ma ... FAIL Rating : 0.14 395
+Unsatisfiable/GRP504-1.ma ... FAIL Rating : 0.14 396
+Unsatisfiable/GRP505-1.ma ... FAIL Rating : 0.50 397
+Unsatisfiable/GRP506-1.ma ... FAIL Rating : 0.64 398
+Unsatisfiable/GRP507-1.ma ... FAIL Rating : 0.57 399
+Unsatisfiable/GRP508-1.ma ... FAIL Rating : 0.57 400
+Unsatisfiable/GRP509-1.ma ... OK TIME NEEDED: 2.18 Rating : 0.00 401
+Unsatisfiable/GRP510-1.ma ... OK TIME NEEDED: 0.42 Rating : 0.00 402
+Unsatisfiable/GRP511-1.ma ... OK TIME NEEDED: 6.15 Rating : 0.00 403
+Unsatisfiable/GRP512-1.ma ... OK TIME NEEDED: 0.15 Rating : 0.00 404
+Unsatisfiable/GRP513-1.ma ... OK TIME NEEDED: 1.53 Rating : 0.00 405
+Unsatisfiable/GRP514-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 406
+Unsatisfiable/GRP515-1.ma ... OK TIME NEEDED: 1.98 Rating : 0.00 407
+Unsatisfiable/GRP516-1.ma ... OK TIME NEEDED: 0.19 Rating : 0.00 408
+Unsatisfiable/GRP517-1.ma ... OK TIME NEEDED: 1.90 Rating : 0.00 409
+Unsatisfiable/GRP518-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 410
+Unsatisfiable/GRP519-1.ma ... OK TIME NEEDED: 14.15 Rating : 0.00 411
+Unsatisfiable/GRP520-1.ma ... OK TIME NEEDED: 0.17 Rating : 0.00 412
+Unsatisfiable/GRP521-1.ma ... OK TIME NEEDED: 0.14 Rating : 0.00 413
+Unsatisfiable/GRP522-1.ma ... OK TIME NEEDED: 0.33 Rating : 0.00 414
+Unsatisfiable/GRP523-1.ma ... OK TIME NEEDED: 2.20 Rating : 0.00 415
+Unsatisfiable/GRP524-1.ma ... OK TIME NEEDED: 0.44 Rating : 0.00 416
+Unsatisfiable/GRP525-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 417
+Unsatisfiable/GRP526-1.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 418
+Unsatisfiable/GRP527-1.ma ... OK TIME NEEDED: 2.05 Rating : 0.00 419
+Unsatisfiable/GRP528-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 420
+Unsatisfiable/GRP529-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 421
+Unsatisfiable/GRP530-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.00 422
+Unsatisfiable/GRP531-1.ma ... OK TIME NEEDED: 1.35 Rating : 0.00 423
+Unsatisfiable/GRP532-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 424
+Unsatisfiable/GRP533-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 425
+Unsatisfiable/GRP534-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 426
+Unsatisfiable/GRP535-1.ma ... OK TIME NEEDED: 2.30 Rating : 0.00 427
+Unsatisfiable/GRP536-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 428
+Unsatisfiable/GRP537-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 429
+Unsatisfiable/GRP538-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 430
+Unsatisfiable/GRP539-1.ma ... OK TIME NEEDED: 3.17 Rating : 0.00 431
+Unsatisfiable/GRP540-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 432
+Unsatisfiable/GRP541-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 433
+Unsatisfiable/GRP542-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 434
+Unsatisfiable/GRP543-1.ma ... OK TIME NEEDED: 0.54 Rating : 0.00 435
+Unsatisfiable/GRP544-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 436
+Unsatisfiable/GRP545-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 437
+Unsatisfiable/GRP546-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 438
+Unsatisfiable/GRP547-1.ma ... OK TIME NEEDED: 1.34 Rating : 0.00 439
+Unsatisfiable/GRP548-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 440
+Unsatisfiable/GRP549-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 441
+Unsatisfiable/GRP550-1.ma ... OK TIME NEEDED: 0.02 Rating : 0.07 442
+Unsatisfiable/GRP551-1.ma ... OK TIME NEEDED: 0.90 Rating : 0.00 443
+Unsatisfiable/GRP552-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 444
+Unsatisfiable/GRP553-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 445
+Unsatisfiable/GRP554-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 446
+Unsatisfiable/GRP555-1.ma ... OK TIME NEEDED: 1.21 Rating : 0.00 447
+Unsatisfiable/GRP556-1.ma ... OK TIME NEEDED: 0.09 Rating : 0.00 448
+Unsatisfiable/GRP557-1.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 449
+Unsatisfiable/GRP558-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 450
+Unsatisfiable/GRP559-1.ma ... OK TIME NEEDED: 3.54 Rating : 0.00 451
+Unsatisfiable/GRP560-1.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 452
+Unsatisfiable/GRP561-1.ma ... OK TIME NEEDED: 0.14 Rating : 0.00 453
+Unsatisfiable/GRP562-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 454
+Unsatisfiable/GRP563-1.ma ... OK TIME NEEDED: 5.11 Rating : 0.00 455
+Unsatisfiable/GRP564-1.ma ... OK TIME NEEDED: 0.16 Rating : 0.00 456
+Unsatisfiable/GRP565-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 457
+Unsatisfiable/GRP566-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 458
+Unsatisfiable/GRP567-1.ma ... OK TIME NEEDED: 3.82 Rating : 0.14 459
+Unsatisfiable/GRP568-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.14 460
+Unsatisfiable/GRP569-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 461
+Unsatisfiable/GRP570-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 462
+Unsatisfiable/GRP571-1.ma ... OK TIME NEEDED: 1.68 Rating : 0.14 463
+Unsatisfiable/GRP572-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.07 464
+Unsatisfiable/GRP573-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 465
+Unsatisfiable/GRP574-1.ma ... OK TIME NEEDED: 0.11 Rating : 0.00 466
+Unsatisfiable/GRP575-1.ma ... OK TIME NEEDED: 1.29 Rating : 0.14 467
+Unsatisfiable/GRP576-1.ma ... OK TIME NEEDED: 0.22 Rating : 0.00 468
+Unsatisfiable/GRP577-1.ma ... OK TIME NEEDED: 0.14 Rating : 0.00 469
+Unsatisfiable/GRP578-1.ma ... OK TIME NEEDED: 0.28 Rating : 0.00 470
+Unsatisfiable/GRP579-1.ma ... OK TIME NEEDED: 1.36 Rating : 0.07 471
+Unsatisfiable/GRP580-1.ma ... OK TIME NEEDED: 0.46 Rating : 0.00 472
+Unsatisfiable/GRP581-1.ma ... OK TIME NEEDED: 0.05 Rating : 0.00 473
+Unsatisfiable/GRP582-1.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 474
+Unsatisfiable/GRP583-1.ma ... OK TIME NEEDED: 1.56 Rating : 0.07 475
+Unsatisfiable/GRP584-1.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 476
+Unsatisfiable/GRP585-1.ma ... OK TIME NEEDED: 4.40 Rating : 0.00 477
+Unsatisfiable/GRP586-1.ma ... OK TIME NEEDED: 3.69 Rating : 0.00 478
+Unsatisfiable/GRP587-1.ma ... OK TIME NEEDED: 15.43 Rating : 0.00 479
+Unsatisfiable/GRP588-1.ma ... OK TIME NEEDED: 0.64 Rating : 0.00 480
+Unsatisfiable/GRP589-1.ma ... OK TIME NEEDED: 0.21 Rating : 0.00 481
+Unsatisfiable/GRP590-1.ma ... OK TIME NEEDED: 0.22 Rating : 0.00 482
+Unsatisfiable/GRP591-1.ma ... OK TIME NEEDED: 1.32 Rating : 0.07 483
+Unsatisfiable/GRP592-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.07 484
+Unsatisfiable/GRP593-1.ma ... OK TIME NEEDED: 1.82 Rating : 0.00 485
+Unsatisfiable/GRP594-1.ma ... OK TIME NEEDED: 0.34 Rating : 0.00 486
+Unsatisfiable/GRP595-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.07 487
+Unsatisfiable/GRP596-1.ma ... OK TIME NEEDED: 0.36 Rating : 0.07 488
+Unsatisfiable/GRP597-1.ma ... OK TIME NEEDED: 0.66 Rating : 0.00 489
+Unsatisfiable/GRP598-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.07 490
+Unsatisfiable/GRP599-1.ma ... OK TIME NEEDED: 1.87 Rating : 0.07 491
+Unsatisfiable/GRP600-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.07 492
+Unsatisfiable/GRP601-1.ma ... OK TIME NEEDED: 3.45 Rating : 0.07 493
+Unsatisfiable/GRP602-1.ma ... OK TIME NEEDED: 0.50 Rating : 0.07 494
+Unsatisfiable/GRP603-1.ma ... OK TIME NEEDED: 0.89 Rating : 0.07 495
+Unsatisfiable/GRP604-1.ma ... OK TIME NEEDED: 1.12 Rating : 0.07 496
+Unsatisfiable/GRP605-1.ma ... OK TIME NEEDED: 3.73 Rating : 0.00 497
+Unsatisfiable/GRP606-1.ma ... OK TIME NEEDED: 2.77 Rating : 0.00 498
+Unsatisfiable/GRP607-1.ma ... OK TIME NEEDED: 9.89 Rating : 0.00 499
+Unsatisfiable/GRP608-1.ma ... OK TIME NEEDED: 0.54 Rating : 0.00 500
+Unsatisfiable/GRP609-1.ma ... OK TIME NEEDED: 2.36 Rating : 0.07 501
+Unsatisfiable/GRP610-1.ma ... OK TIME NEEDED: 0.46 Rating : 0.07 502
+Unsatisfiable/GRP611-1.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 503
+Unsatisfiable/GRP612-1.ma ... OK TIME NEEDED: 0.38 Rating : 0.07 504
+Unsatisfiable/GRP613-1.ma ... OK TIME NEEDED: 0.59 Rating : 0.00 505
+Unsatisfiable/GRP614-1.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 506
+Unsatisfiable/GRP615-1.ma ... OK TIME NEEDED: 1.22 Rating : 0.07 507
+Unsatisfiable/GRP616-1.ma ... OK TIME NEEDED: 0.30 Rating : 0.00 508
+Unsatisfiable/LAT006-1.ma ... OK TIME NEEDED: 29.54 Rating : 0.14 509
+Unsatisfiable/LAT007-1.ma ... OK TIME NEEDED: 49.29 Rating : 0.36 510
+Unsatisfiable/LAT008-1.ma ... OK TIME NEEDED: 0.59 Rating : 0.07 511
+Unsatisfiable/LAT009-1.ma ... OK TIME NEEDED: 468.81 Rating : 0.00 512
+Unsatisfiable/LAT010-1.ma ... FAIL Rating : 0.00 513
+Unsatisfiable/LAT011-1.ma ... OK TIME NEEDED: 405.25 Rating : 0.07 514
+Unsatisfiable/LAT012-1.ma ... OK TIME NEEDED: 7.91 Rating : 0.00 515
+Unsatisfiable/LAT013-1.ma ... OK TIME NEEDED: 37.17 Rating : 0.14 516
+Unsatisfiable/LAT014-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 517
+Unsatisfiable/LAT017-1.ma ... FAIL Rating : 0.71 518
+Unsatisfiable/LAT018-1.ma ... FAIL Rating : 0.93 519
+Unsatisfiable/LAT019-1.ma ... FAIL Rating : 0.00 520
+Unsatisfiable/LAT020-1.ma ... FAIL Rating : 0.50 521
+Unsatisfiable/LAT021-1.ma ... FAIL Rating : 0.00 522
+Unsatisfiable/LAT022-1.ma ... FAIL Rating : 0.21 523
+Unsatisfiable/LAT023-1.ma ... FAIL Rating : 0.21 524
+Unsatisfiable/LAT026-1.ma ... OK TIME NEEDED: 47.89 Rating : 0.14 525
+Unsatisfiable/LAT027-1.ma ... OK TIME NEEDED: 18.86 Rating : 0.07 526
+Unsatisfiable/LAT028-1.ma ... OK TIME NEEDED: 28.53 Rating : 0.00 527
+Unsatisfiable/LAT031-1.ma ... OK TIME NEEDED: 4.20 Rating : 0.00 528
+Unsatisfiable/LAT032-1.ma ... OK TIME NEEDED: 24.15 Rating : 0.00 529
+Unsatisfiable/LAT033-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 530
+Unsatisfiable/LAT034-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 531
+Unsatisfiable/LAT038-1.ma ... FAIL Rating : 0.43 532
+Unsatisfiable/LAT039-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 533
+Unsatisfiable/LAT039-2.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 534
+Unsatisfiable/LAT040-1.ma ... OK TIME NEEDED: 75.59 Rating : 0.00 535
+Unsatisfiable/LAT042-1.ma ... OK TIME NEEDED: 1.07 Rating : 0.00 536
+Unsatisfiable/LAT043-1.ma ... OK TIME NEEDED: 137.95 Rating : 0.00 537
+Unsatisfiable/LAT044-1.ma ... OK TIME NEEDED: 166.22 Rating : 0.14 538
+Unsatisfiable/LAT045-1.ma ... OK TIME NEEDED: 0.35 Rating : 0.07 539
+Unsatisfiable/LAT070-1.ma ... FAIL Rating : 0.93 540
+Unsatisfiable/LAT072-1.ma ... FAIL Rating : 1.00 541
+Unsatisfiable/LAT074-1.ma ... FAIL Rating : 1.00 542
+Unsatisfiable/LAT075-1.ma ... FAIL Rating : 1.00 543
+Unsatisfiable/LAT076-1.ma ... FAIL Rating : 1.00 544
+Unsatisfiable/LAT077-1.ma ... FAIL Rating : 1.00 545
+Unsatisfiable/LAT078-1.ma ... FAIL Rating : 1.00 546
+Unsatisfiable/LAT079-1.ma ... FAIL Rating : 1.00 547
+Unsatisfiable/LAT080-1.ma ... OK TIME NEEDED: 380.96 Rating : 0.36 548
+Unsatisfiable/LAT081-1.ma ... FAIL Rating : 0.57 549
+Unsatisfiable/LAT082-1.ma ... FAIL Rating : 0.64 550
+Unsatisfiable/LAT083-1.ma ... OK TIME NEEDED: 370.81 Rating : 0.36 551
+Unsatisfiable/LAT084-1.ma ... FAIL Rating : 0.50 552
+Unsatisfiable/LAT085-1.ma ... FAIL Rating : 0.57 553
+Unsatisfiable/LAT086-1.ma ... FAIL Rating : 0.50 554
+Unsatisfiable/LAT087-1.ma ... FAIL Rating : 0.43 555
+Unsatisfiable/LAT088-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 556
+Unsatisfiable/LAT089-1.ma ... OK TIME NEEDED: 1.71 Rating : 0.00 557
+Unsatisfiable/LAT090-1.ma ... OK TIME NEEDED: 0.10 Rating : 0.00 558
+Unsatisfiable/LAT091-1.ma ... OK TIME NEEDED: 16.71 Rating : 0.07 559
+Unsatisfiable/LAT092-1.ma ... OK TIME NEEDED: 372.43 Rating : 0.36 560
+Unsatisfiable/LAT093-1.ma ... FAIL Rating : 0.43 561
+Unsatisfiable/LAT094-1.ma ... OK TIME NEEDED: 400.25 Rating : 0.36 562
+Unsatisfiable/LAT095-1.ma ... FAIL Rating : 0.43 563
+Unsatisfiable/LAT096-1.ma ... FAIL Rating : 0.36 564
+Unsatisfiable/LAT097-1.ma ... FAIL Rating : 0.36 565
+Unsatisfiable/LAT138-1.ma ... FAIL Rating : 1.00 566
+Unsatisfiable/LAT139-1.ma ... FAIL Rating : 1.00 567
+Unsatisfiable/LAT140-1.ma ... FAIL Rating : 1.00 568
+Unsatisfiable/LAT141-1.ma ... FAIL Rating : 1.00 569
+Unsatisfiable/LAT142-1.ma ... FAIL Rating : 0.64 570
+Unsatisfiable/LAT143-1.ma ... FAIL Rating : 0.14 571
+Unsatisfiable/LAT144-1.ma ... FAIL Rating : 0.86 572
+Unsatisfiable/LAT145-1.ma ... FAIL Rating : 0.93 573
+Unsatisfiable/LAT146-1.ma ... FAIL Rating : 0.79 574
+Unsatisfiable/LAT147-1.ma ... FAIL Rating : 0.79 575
+Unsatisfiable/LAT148-1.ma ... FAIL Rating : 0.71 576
+Unsatisfiable/LAT149-1.ma ... FAIL Rating : 0.93 577
+Unsatisfiable/LAT150-1.ma ... FAIL Rating : 0.86 578
+Unsatisfiable/LAT151-1.ma ... FAIL Rating : 0.86 579
+Unsatisfiable/LAT152-1.ma ... FAIL Rating : 0.79 580
+Unsatisfiable/LAT153-1.ma ... FAIL Rating : 0.93 581
+Unsatisfiable/LAT154-1.ma ... FAIL Rating : 0.79 582
+Unsatisfiable/LAT155-1.ma ... FAIL Rating : 0.86 583
+Unsatisfiable/LAT156-1.ma ... FAIL Rating : 0.64 584
+Unsatisfiable/LAT157-1.ma ... FAIL Rating : 0.86 585
+Unsatisfiable/LAT158-1.ma ... FAIL Rating : 0.93 586
+Unsatisfiable/LAT159-1.ma ... FAIL Rating : 0.86 587
+Unsatisfiable/LAT160-1.ma ... FAIL Rating : 0.64 588
+Unsatisfiable/LAT161-1.ma ... FAIL Rating : 1.00 589
+Unsatisfiable/LAT162-1.ma ... FAIL Rating : 0.86 590
+Unsatisfiable/LAT163-1.ma ... FAIL Rating : 0.93 591
+Unsatisfiable/LAT164-1.ma ... FAIL Rating : 0.93 592
+Unsatisfiable/LAT165-1.ma ... FAIL Rating : 0.93 593
+Unsatisfiable/LAT166-1.ma ... FAIL Rating : 0.93 594
+Unsatisfiable/LAT167-1.ma ... FAIL Rating : 0.93 595
+Unsatisfiable/LAT168-1.ma ... FAIL Rating : 0.14 596
+Unsatisfiable/LAT169-1.ma ... FAIL Rating : 0.86 597
+Unsatisfiable/LAT170-1.ma ... FAIL Rating : 0.79 598
+Unsatisfiable/LAT171-1.ma ... FAIL Rating : 0.50 599
+Unsatisfiable/LAT172-1.ma ... FAIL Rating : 0.93 600
+Unsatisfiable/LAT173-1.ma ... FAIL Rating : 0.93 601
+Unsatisfiable/LAT174-1.ma ... FAIL Rating : 0.79 602
+Unsatisfiable/LAT175-1.ma ... FAIL Rating : 0.93 603
+Unsatisfiable/LAT176-1.ma ... FAIL Rating : 0.93 604
+Unsatisfiable/LAT177-1.ma ... FAIL Rating : 1.00 605
+Unsatisfiable/LCL109-2.ma ... OK TIME NEEDED: 278.04 Rating : 0.29 606
+Unsatisfiable/LCL109-6.ma ... OK TIME NEEDED: 114.91 Rating : 0.14 607
+Unsatisfiable/LCL110-2.ma ... OK TIME NEEDED: 0.25 Rating : 0.00 608
+Unsatisfiable/LCL111-2.ma ... OK TIME NEEDED: 2.16 Rating : 0.07 609
+Unsatisfiable/LCL112-2.ma ... OK TIME NEEDED: 0.26 Rating : 0.00 610
+Unsatisfiable/LCL113-2.ma ... OK TIME NEEDED: 0.29 Rating : 0.00 611
+Unsatisfiable/LCL114-2.ma ... OK TIME NEEDED: 0.46 Rating : 0.00 612
+Unsatisfiable/LCL115-2.ma ... OK TIME NEEDED: 0.47 Rating : 0.00 613
+Unsatisfiable/LCL116-2.ma ... OK TIME NEEDED: 5.00 Rating : 0.00 614
+Unsatisfiable/LCL132-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 615
+Unsatisfiable/LCL133-1.ma ... OK TIME NEEDED: 0.07 Rating : 0.00 616
+Unsatisfiable/LCL134-1.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 617
+Unsatisfiable/LCL135-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 618
+Unsatisfiable/LCL138-1.ma ... OK TIME NEEDED: 49.02 Rating : 0.21 619
+Unsatisfiable/LCL139-1.ma ... OK TIME NEEDED: 0.45 Rating : 0.00 620
+Unsatisfiable/LCL140-1.ma ... OK TIME NEEDED: 0.31 Rating : 0.00 621
+Unsatisfiable/LCL141-1.ma ... OK TIME NEEDED: 0.71 Rating : 0.00 622
+Unsatisfiable/LCL153-1.ma ... OK TIME NEEDED: 0.81 Rating : 0.00 623
+Unsatisfiable/LCL154-1.ma ... OK TIME NEEDED: 0.32 Rating : 0.00 624
+Unsatisfiable/LCL155-1.ma ... OK TIME NEEDED: 0.34 Rating : 0.00 625
+Unsatisfiable/LCL156-1.ma ... OK TIME NEEDED: 0.38 Rating : 0.00 626
+Unsatisfiable/LCL157-1.ma ... OK TIME NEEDED: 0.33 Rating : 0.00 627
+Unsatisfiable/LCL158-1.ma ... OK TIME NEEDED: 0.68 Rating : 0.00 628
+Unsatisfiable/LCL159-1.ma ... OK TIME NEEDED: 169.48 Rating : 0.00 629
+Unsatisfiable/LCL160-1.ma ... FAIL Rating : 0.14 630
+Unsatisfiable/LCL161-1.ma ... OK TIME NEEDED: 0.12 Rating : 0.00 631
+Unsatisfiable/LCL162-1.ma ... FAIL Rating : 0.00 632
+Unsatisfiable/LCL163-1.ma ... OK TIME NEEDED: 10.88 Rating : 0.14 633
+Unsatisfiable/LCL164-1.ma ... OK TIME NEEDED: 0.13 Rating : 0.00 634
+Unsatisfiable/LDA001-1.ma ... OK TIME NEEDED: 0.04 Rating : 0.00 635
+Unsatisfiable/LDA002-1.ma ... OK TIME NEEDED: 11.19 Rating : 0.00 636
+Unsatisfiable/LDA007-3.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 637
+Unsatisfiable/RNG007-4.ma ... OK TIME NEEDED: 0.08 Rating : 0.00 638
+Unsatisfiable/RNG008-3.ma ... OK TIME NEEDED: 3.64 Rating : 0.07 639
+Unsatisfiable/RNG008-4.ma ... OK TIME NEEDED: 3.93 Rating : 0.07 640
+Unsatisfiable/RNG008-7.ma ... OK TIME NEEDED: 29.77 Rating : 0.07 641
+Unsatisfiable/RNG009-5.ma ... FAIL Rating : 0.50 642
+Unsatisfiable/RNG009-7.ma ... FAIL Rating : 0.50 643
+Unsatisfiable/RNG011-5.ma ... OK TIME NEEDED: 0.03 Rating : 0.00 644
+Unsatisfiable/RNG012-6.ma ... OK TIME NEEDED: 122.70 Rating : 0.00 645
+Unsatisfiable/RNG013-6.ma ... OK TIME NEEDED: 121.24 Rating : 0.00 646
+Unsatisfiable/RNG014-6.ma ... OK TIME NEEDED: 118.34 Rating : 0.00 647
+Unsatisfiable/RNG015-6.ma ... OK TIME NEEDED: 140.39 Rating : 0.00 648
+Unsatisfiable/RNG016-6.ma ... OK TIME NEEDED: 150.97 Rating : 0.00 649
+Unsatisfiable/RNG017-6.ma ... OK TIME NEEDED: 153.18 Rating : 0.00 650
+Unsatisfiable/RNG018-6.ma ... OK TIME NEEDED: 140.72 Rating : 0.00 651
+Unsatisfiable/RNG019-6.ma ... FAIL Rating : 0.21 652
+Unsatisfiable/RNG019-7.ma ... FAIL Rating : 0.21 653
+Unsatisfiable/RNG020-6.ma ... FAIL Rating : 0.29 654
+Unsatisfiable/RNG020-7.ma ... FAIL Rating : 0.21 655
+Unsatisfiable/RNG021-6.ma ... FAIL Rating : 0.14 656
+Unsatisfiable/RNG021-7.ma ... FAIL Rating : 0.21 657
+Unsatisfiable/RNG023-6.ma ... OK TIME NEEDED: 0.23 Rating : 0.00 658
+Unsatisfiable/RNG023-7.ma ... OK TIME NEEDED: 0.29 Rating : 0.00 659
+Unsatisfiable/RNG024-6.ma ... OK TIME NEEDED: 0.21 Rating : 0.00 660
+Unsatisfiable/RNG024-7.ma ... OK TIME NEEDED: 0.29 Rating : 0.00 661
+Unsatisfiable/RNG025-4.ma ... FAIL Rating : 0.29 662
+Unsatisfiable/RNG025-5.ma ... FAIL Rating : 0.36 663
+Unsatisfiable/RNG025-6.ma ... FAIL Rating : 0.29 664
+Unsatisfiable/RNG025-7.ma ... FAIL Rating : 0.43 665
+Unsatisfiable/RNG026-6.ma ... FAIL Rating : 0.57 666
+Unsatisfiable/RNG026-7.ma ... FAIL Rating : 0.50 667
+Unsatisfiable/RNG027-5.ma ... FAIL Rating : 0.86 668
+Unsatisfiable/RNG027-7.ma ... FAIL Rating : 0.86 669
+Unsatisfiable/RNG027-8.ma ... FAIL Rating : 0.86 670
+Unsatisfiable/RNG027-9.ma ... FAIL Rating : 0.86 671
+Unsatisfiable/RNG028-5.ma ... FAIL Rating : 0.86 672
+Unsatisfiable/RNG028-7.ma ... FAIL Rating : 0.86 673
+Unsatisfiable/RNG028-8.ma ... FAIL Rating : 0.86 674
+Unsatisfiable/RNG028-9.ma ... FAIL Rating : 0.86 675
+Unsatisfiable/RNG029-5.ma ... FAIL Rating : 0.86 676
+Unsatisfiable/RNG029-6.ma ... FAIL Rating : 0.86 677
+Unsatisfiable/RNG029-7.ma ... FAIL Rating : 0.86 678
+Unsatisfiable/RNG035-7.ma ... FAIL Rating : 0.86 679
+Unsatisfiable/ROB001-1.ma ... FAIL Rating : 1.00 680
+Unsatisfiable/ROB002-1.ma ... OK TIME NEEDED: 0.06 Rating : 0.00 681
+Unsatisfiable/ROB003-1.ma ... OK TIME NEEDED: 73.22 Rating : 0.00 682
+Unsatisfiable/ROB004-1.ma ... OK TIME NEEDED: 10.25 Rating : 0.00 683
+Unsatisfiable/ROB005-1.ma ... FAIL Rating : 0.07 684
+Unsatisfiable/ROB006-1.ma ... FAIL Rating : 0.86 685
+Unsatisfiable/ROB006-2.ma ... FAIL Rating : 0.86 686
+Unsatisfiable/ROB008-1.ma ... OK TIME NEEDED: 70.52 Rating : 0.00 687
+Unsatisfiable/ROB009-1.ma ... OK TIME NEEDED: 86.10 Rating : 0.00 688
+Unsatisfiable/ROB010-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 689
+Unsatisfiable/ROB013-1.ma ... OK TIME NEEDED: 0.01 Rating : 0.00 690
+Unsatisfiable/ROB022-1.ma ... OK TIME NEEDED: 173.55 Rating : 0.00 691
+Unsatisfiable/ROB023-1.ma ... OK TIME NEEDED: 170.01 Rating : 0.00 692
+Unsatisfiable/ROB026-1.ma ... FAIL Rating : 0.86 693
+Unsatisfiable/ROB030-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 694
+Unsatisfiable/ROB031-1.ma ... FAIL Rating : 1.00 695
+Unsatisfiable/ROB032-1.ma ... FAIL Rating : 1.00 696
+Unsatisfiable/SYN080-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 697
+Unsatisfiable/SYN083-1.ma ... OK TIME NEEDED: 0.00 Rating : 0.00 698
diff --git a/matita/tests/TPTP/maxweight.txt b/matita/tests/TPTP/maxweight.txt
new file mode 100644 (file)
index 0000000..a92e1b3
--- /dev/null
@@ -0,0 +1,510 @@
+log.ALG005-1.ma.gz:max weight: 21
+log.ALG006-1.ma.gz:max weight: 18
+log.ALG007-1.ma.gz:max weight: 18
+log.BOO001-1.ma.gz:max weight: 21
+log.BOO002-1.ma.gz:max weight: 26
+log.BOO002-2.ma.gz:max weight: 26
+log.BOO003-2.ma.gz:max weight: 13
+log.BOO003-4.ma.gz:max weight: 15
+log.BOO004-2.ma.gz:max weight: 10
+log.BOO004-4.ma.gz:max weight: 10
+log.BOO005-2.ma.gz:max weight: 9
+log.BOO005-4.ma.gz:max weight: 9
+log.BOO006-2.ma.gz:max weight: 17
+log.BOO006-4.ma.gz:max weight: 9
+log.BOO007-2.ma.gz:max weight: 19
+log.BOO007-4.ma.gz:max weight: 19
+log.BOO008-2.ma.gz:max weight: 19
+log.BOO008-4.ma.gz:max weight: 20
+log.BOO009-2.ma.gz:max weight: 14
+log.BOO009-4.ma.gz:max weight: 14
+log.BOO010-2.ma.gz:max weight: 14
+log.BOO010-4.ma.gz:max weight: 14
+log.BOO011-2.ma.gz:max weight: 2
+log.BOO011-4.ma.gz:max weight: 5
+log.BOO012-2.ma.gz:max weight: 18
+log.BOO012-4.ma.gz:max weight: 18
+log.BOO013-2.ma.gz:max weight: 10
+log.BOO013-4.ma.gz:max weight: 16
+log.BOO014-2.ma.gz:max weight: 18
+log.BOO014-4.ma.gz:max weight: 18
+log.BOO015-2.ma.gz:max weight: 18
+log.BOO015-4.ma.gz:max weight: 18
+log.BOO016-2.ma.gz:max weight: 17
+log.BOO017-2.ma.gz:max weight: 16
+log.BOO018-4.ma.gz:max weight: 5
+log.BOO021-1.ma.gz:max weight: 10
+log.BOO022-1.ma.gz:max weight: 18
+log.BOO023-1.ma.gz:max weight: 23
+log.BOO024-1.ma.gz:max weight: 14
+log.BOO025-1.ma.gz:max weight: 32
+log.BOO026-1.ma.gz:max weight: 21
+log.BOO029-1.ma.gz:max weight: 13
+log.BOO034-1.ma.gz:max weight: 20
+log.BOO068-1.ma.gz:max weight: 37
+log.BOO069-1.ma.gz:max weight: 36
+log.BOO070-1.ma.gz:max weight: 37
+log.BOO071-1.ma.gz:max weight: 36
+log.BOO072-1.ma.gz:max weight: 28
+log.BOO074-1.ma.gz:max weight: 27
+log.BOO075-1.ma.gz:max weight: 34
+log.COL001-1.ma.gz:max weight: 26
+log.COL001-2.ma.gz:max weight: 23
+log.COL002-1.ma.gz:max weight: 23
+log.COL004-3.ma.gz:max weight: 20
+log.COL007-1.ma.gz:max weight: 0
+log.COL008-1.ma.gz:max weight: 11
+log.COL009-1.ma.gz:max weight: 18
+log.COL010-1.ma.gz:max weight: 23
+log.COL012-1.ma.gz:max weight: 0
+log.COL013-1.ma.gz:max weight: 0
+log.COL014-1.ma.gz:max weight: 0
+log.COL015-1.ma.gz:max weight: 11
+log.COL016-1.ma.gz:max weight: 0
+log.COL017-1.ma.gz:max weight: 11
+log.COL018-1.ma.gz:max weight: 0
+log.COL019-1.ma.gz:max weight: 23
+log.COL021-1.ma.gz:max weight: 11
+log.COL022-1.ma.gz:max weight: 11
+log.COL024-1.ma.gz:max weight: 11
+log.COL025-1.ma.gz:max weight: 17
+log.COL029-1.ma.gz:max weight: 0
+log.COL030-1.ma.gz:max weight: 13
+log.COL031-1.ma.gz:max weight: 0
+log.COL032-1.ma.gz:max weight: 0
+log.COL033-1.ma.gz:max weight: 16
+log.COL034-1.ma.gz:max weight: 0
+log.COL039-1.ma.gz:max weight: 11
+log.COL041-1.ma.gz:max weight: 0
+log.COL045-1.ma.gz:max weight: 11
+log.COL048-1.ma.gz:max weight: 17
+log.COL049-1.ma.gz:max weight: 17
+log.COL050-1.ma.gz:max weight: 9
+log.COL051-1.ma.gz:max weight: 9
+log.COL053-1.ma.gz:max weight: 0
+log.COL056-1.ma.gz:max weight: 6
+log.COL058-1.ma.gz:max weight: 0
+log.COL058-2.ma.gz:max weight: 10
+log.COL058-3.ma.gz:max weight: 10
+log.COL060-1.ma.gz:max weight: 0
+log.COL060-2.ma.gz:max weight: 0
+log.COL060-3.ma.gz:max weight: 0
+log.COL061-1.ma.gz:max weight: 0
+log.COL061-2.ma.gz:max weight: 0
+log.COL061-3.ma.gz:max weight: 0
+log.COL062-2.ma.gz:max weight: 0
+log.COL062-3.ma.gz:max weight: 0
+log.COL063-2.ma.gz:max weight: 0
+log.COL063-3.ma.gz:max weight: 0
+log.COL063-4.ma.gz:max weight: 0
+log.COL063-5.ma.gz:max weight: 0
+log.COL063-6.ma.gz:max weight: 0
+log.COL064-2.ma.gz:max weight: 0
+log.COL064-3.ma.gz:max weight: 0
+log.COL064-4.ma.gz:max weight: 0
+log.COL064-5.ma.gz:max weight: 0
+log.COL064-6.ma.gz:max weight: 0
+log.COL064-7.ma.gz:max weight: 0
+log.COL064-8.ma.gz:max weight: 0
+log.COL064-9.ma.gz:max weight: 0
+log.COL066-2.ma.gz:max weight: 21
+log.COL066-3.ma.gz:max weight: 21
+log.COL075-2.ma.gz:max weight: 23
+log.COL083-1.ma.gz:max weight: 0
+log.COL084-1.ma.gz:max weight: 0
+log.COL085-1.ma.gz:max weight: 0
+log.COL086-1.ma.gz:max weight: 0
+log.GRP001-2.ma.gz:max weight: 7
+log.GRP001-4.ma.gz:max weight: 7
+log.GRP002-2.ma.gz:max weight: 22
+log.GRP002-3.ma.gz:max weight: 23
+log.GRP002-4.ma.gz:max weight: 23
+log.GRP010-4.ma.gz:max weight: 8
+log.GRP011-4.ma.gz:max weight: 12
+log.GRP012-4.ma.gz:max weight: 8
+log.GRP014-1.ma.gz:max weight: 39
+log.GRP022-2.ma.gz:max weight: 9
+log.GRP023-2.ma.gz:max weight: 2
+log.GRP114-1.ma.gz:max weight: 18
+log.GRP115-1.ma.gz:max weight: 18
+log.GRP116-1.ma.gz:max weight: 18
+log.GRP117-1.ma.gz:max weight: 18
+log.GRP118-1.ma.gz:max weight: 19
+log.GRP119-1.ma.gz:max weight: 68
+log.GRP120-1.ma.gz:max weight: 68
+log.GRP121-1.ma.gz:max weight: 68
+log.GRP122-1.ma.gz:max weight: 69
+log.GRP136-1.ma.gz:max weight: 4
+log.GRP137-1.ma.gz:max weight: 4
+log.GRP138-1.ma.gz:max weight: 7
+log.GRP139-1.ma.gz:max weight: 16
+log.GRP140-1.ma.gz:max weight: 7
+log.GRP141-1.ma.gz:max weight: 16
+log.GRP142-1.ma.gz:max weight: 0
+log.GRP143-1.ma.gz:max weight: 6
+log.GRP144-1.ma.gz:max weight: 6
+log.GRP145-1.ma.gz:max weight: 16
+log.GRP146-1.ma.gz:max weight: 16
+log.GRP147-1.ma.gz:max weight: 7
+log.GRP148-1.ma.gz:max weight: 7
+log.GRP149-1.ma.gz:max weight: 16
+log.GRP150-1.ma.gz:max weight: 6
+log.GRP151-1.ma.gz:max weight: 0
+log.GRP152-1.ma.gz:max weight: 16
+log.GRP153-1.ma.gz:max weight: 6
+log.GRP154-1.ma.gz:max weight: 3
+log.GRP155-1.ma.gz:max weight: 3
+log.GRP156-1.ma.gz:max weight: 4
+log.GRP157-1.ma.gz:max weight: 3
+log.GRP158-1.ma.gz:max weight: 3
+log.GRP159-1.ma.gz:max weight: 7
+log.GRP160-1.ma.gz:max weight: 0
+log.GRP161-1.ma.gz:max weight: 0
+log.GRP162-1.ma.gz:max weight: 7
+log.GRP163-1.ma.gz:max weight: 7
+log.GRP165-1.ma.gz:max weight: 14
+log.GRP165-2.ma.gz:max weight: 15
+log.GRP166-1.ma.gz:max weight: 21
+log.GRP166-3.ma.gz:max weight: 14
+log.GRP166-4.ma.gz:max weight: 15
+log.GRP167-1.ma.gz:max weight: 18
+log.GRP167-2.ma.gz:max weight: 18
+log.GRP167-3.ma.gz:max weight: 14
+log.GRP167-4.ma.gz:max weight: 16
+log.GRP167-5.ma.gz:max weight: 15
+log.GRP168-1.ma.gz:max weight: 3
+log.GRP168-2.ma.gz:max weight: 3
+log.GRP169-1.ma.gz:max weight: 12
+log.GRP169-2.ma.gz:max weight: 13
+log.GRP170-1.ma.gz:max weight: 14
+log.GRP170-2.ma.gz:max weight: 14
+log.GRP170-3.ma.gz:max weight: 14
+log.GRP170-4.ma.gz:max weight: 14
+log.GRP171-1.ma.gz:max weight: 10
+log.GRP171-2.ma.gz:max weight: 10
+log.GRP172-1.ma.gz:max weight: 10
+log.GRP172-2.ma.gz:max weight: 10
+log.GRP173-1.ma.gz:max weight: 11
+log.GRP174-1.ma.gz:max weight: 11
+log.GRP175-1.ma.gz:max weight: 13
+log.GRP175-2.ma.gz:max weight: 14
+log.GRP175-3.ma.gz:max weight: 14
+log.GRP175-4.ma.gz:max weight: 13
+log.GRP176-1.ma.gz:max weight: 0
+log.GRP176-2.ma.gz:max weight: 0
+log.GRP178-1.ma.gz:max weight: 15
+log.GRP178-2.ma.gz:max weight: 15
+log.GRP181-3.ma.gz:max weight: 19
+log.GRP182-1.ma.gz:max weight: 6
+log.GRP182-2.ma.gz:max weight: 6
+log.GRP182-3.ma.gz:max weight: 6
+log.GRP182-4.ma.gz:max weight: 6
+log.GRP184-4.ma.gz:max weight: 16
+log.GRP186-3.ma.gz:max weight: 9
+log.GRP186-4.ma.gz:max weight: 7
+log.GRP188-1.ma.gz:max weight: 16
+log.GRP188-2.ma.gz:max weight: 16
+log.GRP189-1.ma.gz:max weight: 6
+log.GRP189-2.ma.gz:max weight: 6
+log.GRP190-1.ma.gz:max weight: 15
+log.GRP190-2.ma.gz:max weight: 12
+log.GRP191-1.ma.gz:max weight: 12
+log.GRP191-2.ma.gz:max weight: 11
+log.GRP192-1.ma.gz:max weight: 15
+log.GRP193-1.ma.gz:max weight: 16
+log.GRP193-2.ma.gz:max weight: 15
+log.GRP206-1.ma.gz:max weight: 12
+log.GRP403-1.ma.gz:max weight: 38
+log.GRP404-1.ma.gz:max weight: 48
+log.GRP405-1.ma.gz:max weight: 39
+log.GRP406-1.ma.gz:max weight: 67
+log.GRP407-1.ma.gz:max weight: 67
+log.GRP408-1.ma.gz:max weight: 68
+log.GRP409-1.ma.gz:max weight: 50
+log.GRP410-1.ma.gz:max weight: 50
+log.GRP411-1.ma.gz:max weight: 51
+log.GRP412-1.ma.gz:max weight: 44
+log.GRP413-1.ma.gz:max weight: 44
+log.GRP414-1.ma.gz:max weight: 45
+log.GRP415-1.ma.gz:max weight: 68
+log.GRP416-1.ma.gz:max weight: 68
+log.GRP417-1.ma.gz:max weight: 69
+log.GRP421-1.ma.gz:max weight: 71
+log.GRP422-1.ma.gz:max weight: 71
+log.GRP423-1.ma.gz:max weight: 72
+log.GRP424-1.ma.gz:max weight: 63
+log.GRP425-1.ma.gz:max weight: 63
+log.GRP426-1.ma.gz:max weight: 64
+log.GRP427-1.ma.gz:max weight: 38
+log.GRP428-1.ma.gz:max weight: 38
+log.GRP429-1.ma.gz:max weight: 39
+log.GRP430-1.ma.gz:max weight: 42
+log.GRP431-1.ma.gz:max weight: 42
+log.GRP432-1.ma.gz:max weight: 43
+log.GRP433-1.ma.gz:max weight: 22
+log.GRP434-1.ma.gz:max weight: 22
+log.GRP435-1.ma.gz:max weight: 24
+log.GRP436-1.ma.gz:max weight: 55
+log.GRP437-1.ma.gz:max weight: 55
+log.GRP438-1.ma.gz:max weight: 56
+log.GRP439-1.ma.gz:max weight: 48
+log.GRP440-1.ma.gz:max weight: 48
+log.GRP441-1.ma.gz:max weight: 49
+log.GRP442-1.ma.gz:max weight: 38
+log.GRP443-1.ma.gz:max weight: 38
+log.GRP444-1.ma.gz:max weight: 39
+log.GRP445-1.ma.gz:max weight: 15
+log.GRP446-1.ma.gz:max weight: 15
+log.GRP447-1.ma.gz:max weight: 16
+log.GRP448-1.ma.gz:max weight: 15
+log.GRP449-1.ma.gz:max weight: 15
+log.GRP450-1.ma.gz:max weight: 16
+log.GRP451-1.ma.gz:max weight: 14
+log.GRP452-1.ma.gz:max weight: 21
+log.GRP453-1.ma.gz:max weight: 26
+log.GRP454-1.ma.gz:max weight: 7
+log.GRP455-1.ma.gz:max weight: 15
+log.GRP456-1.ma.gz:max weight: 17
+log.GRP457-1.ma.gz:max weight: 7
+log.GRP458-1.ma.gz:max weight: 15
+log.GRP459-1.ma.gz:max weight: 17
+log.GRP460-1.ma.gz:max weight: 7
+log.GRP461-1.ma.gz:max weight: 15
+log.GRP462-1.ma.gz:max weight: 16
+log.GRP463-1.ma.gz:max weight: 7
+log.GRP464-1.ma.gz:max weight: 15
+log.GRP465-1.ma.gz:max weight: 16
+log.GRP466-1.ma.gz:max weight: 19
+log.GRP467-1.ma.gz:max weight: 19
+log.GRP468-1.ma.gz:max weight: 19
+log.GRP469-1.ma.gz:max weight: 43
+log.GRP470-1.ma.gz:max weight: 43
+log.GRP471-1.ma.gz:max weight: 38
+log.GRP472-1.ma.gz:max weight: 47
+log.GRP473-1.ma.gz:max weight: 47
+log.GRP474-1.ma.gz:max weight: 48
+log.GRP475-1.ma.gz:max weight: 37
+log.GRP476-1.ma.gz:max weight: 37
+log.GRP477-1.ma.gz:max weight: 38
+log.GRP478-1.ma.gz:max weight: 32
+log.GRP479-1.ma.gz:max weight: 32
+log.GRP480-1.ma.gz:max weight: 33
+log.GRP481-1.ma.gz:max weight: 20
+log.GRP482-1.ma.gz:max weight: 21
+log.GRP483-1.ma.gz:max weight: 22
+log.GRP484-1.ma.gz:max weight: 16
+log.GRP485-1.ma.gz:max weight: 17
+log.GRP486-1.ma.gz:max weight: 18
+log.GRP487-1.ma.gz:max weight: 15
+log.GRP488-1.ma.gz:max weight: 15
+log.GRP489-1.ma.gz:max weight: 26
+log.GRP490-1.ma.gz:max weight: 15
+log.GRP491-1.ma.gz:max weight: 16
+log.GRP492-1.ma.gz:max weight: 17
+log.GRP493-1.ma.gz:max weight: 16
+log.GRP494-1.ma.gz:max weight: 17
+log.GRP495-1.ma.gz:max weight: 18
+log.GRP496-1.ma.gz:max weight: 16
+log.GRP497-1.ma.gz:max weight: 17
+log.GRP498-1.ma.gz:max weight: 18
+log.GRP499-1.ma.gz:max weight: 38
+log.GRP500-1.ma.gz:max weight: 38
+log.GRP501-1.ma.gz:max weight: 39
+log.GRP502-1.ma.gz:max weight: 42
+log.GRP503-1.ma.gz:max weight: 42
+log.GRP504-1.ma.gz:max weight: 43
+log.GRP509-1.ma.gz:max weight: 21
+log.GRP510-1.ma.gz:max weight: 21
+log.GRP511-1.ma.gz:max weight: 22
+log.GRP512-1.ma.gz:max weight: 22
+log.GRP513-1.ma.gz:max weight: 16
+log.GRP514-1.ma.gz:max weight: 16
+log.GRP515-1.ma.gz:max weight: 17
+log.GRP516-1.ma.gz:max weight: 17
+log.GRP517-1.ma.gz:max weight: 16
+log.GRP518-1.ma.gz:max weight: 16
+log.GRP519-1.ma.gz:max weight: 17
+log.GRP520-1.ma.gz:max weight: 17
+log.GRP521-1.ma.gz:max weight: 11
+log.GRP522-1.ma.gz:max weight: 12
+log.GRP523-1.ma.gz:max weight: 16
+log.GRP524-1.ma.gz:max weight: 13
+log.GRP525-1.ma.gz:max weight: 10
+log.GRP526-1.ma.gz:max weight: 10
+log.GRP527-1.ma.gz:max weight: 16
+log.GRP528-1.ma.gz:max weight: 16
+log.GRP529-1.ma.gz:max weight: 11
+log.GRP530-1.ma.gz:max weight: 8
+log.GRP531-1.ma.gz:max weight: 16
+log.GRP532-1.ma.gz:max weight: 11
+log.GRP533-1.ma.gz:max weight: 7
+log.GRP534-1.ma.gz:max weight: 11
+log.GRP535-1.ma.gz:max weight: 16
+log.GRP536-1.ma.gz:max weight: 15
+log.GRP537-1.ma.gz:max weight: 7
+log.GRP538-1.ma.gz:max weight: 11
+log.GRP539-1.ma.gz:max weight: 17
+log.GRP540-1.ma.gz:max weight: 11
+log.GRP541-1.ma.gz:max weight: 7
+log.GRP542-1.ma.gz:max weight: 12
+log.GRP543-1.ma.gz:max weight: 16
+log.GRP544-1.ma.gz:max weight: 13
+log.GRP545-1.ma.gz:max weight: 7
+log.GRP546-1.ma.gz:max weight: 12
+log.GRP547-1.ma.gz:max weight: 17
+log.GRP548-1.ma.gz:max weight: 13
+log.GRP549-1.ma.gz:max weight: 7
+log.GRP550-1.ma.gz:max weight: 12
+log.GRP551-1.ma.gz:max weight: 16
+log.GRP552-1.ma.gz:max weight: 13
+log.GRP553-1.ma.gz:max weight: 15
+log.GRP554-1.ma.gz:max weight: 16
+log.GRP555-1.ma.gz:max weight: 19
+log.GRP556-1.ma.gz:max weight: 15
+log.GRP557-1.ma.gz:max weight: 15
+log.GRP558-1.ma.gz:max weight: 15
+log.GRP559-1.ma.gz:max weight: 16
+log.GRP560-1.ma.gz:max weight: 15
+log.GRP561-1.ma.gz:max weight: 17
+log.GRP562-1.ma.gz:max weight: 16
+log.GRP563-1.ma.gz:max weight: 17
+log.GRP564-1.ma.gz:max weight: 17
+log.GRP565-1.ma.gz:max weight: 16
+log.GRP566-1.ma.gz:max weight: 17
+log.GRP567-1.ma.gz:max weight: 27
+log.GRP568-1.ma.gz:max weight: 27
+log.GRP569-1.ma.gz:max weight: 16
+log.GRP570-1.ma.gz:max weight: 17
+log.GRP571-1.ma.gz:max weight: 25
+log.GRP572-1.ma.gz:max weight: 18
+log.GRP573-1.ma.gz:max weight: 16
+log.GRP574-1.ma.gz:max weight: 19
+log.GRP575-1.ma.gz:max weight: 25
+log.GRP576-1.ma.gz:max weight: 25
+log.GRP577-1.ma.gz:max weight: 16
+log.GRP578-1.ma.gz:max weight: 17
+log.GRP579-1.ma.gz:max weight: 25
+log.GRP580-1.ma.gz:max weight: 25
+log.GRP581-1.ma.gz:max weight: 16
+log.GRP582-1.ma.gz:max weight: 17
+log.GRP583-1.ma.gz:max weight: 19
+log.GRP584-1.ma.gz:max weight: 18
+log.GRP585-1.ma.gz:max weight: 19
+log.GRP586-1.ma.gz:max weight: 19
+log.GRP588-1.ma.gz:max weight: 20
+log.GRP589-1.ma.gz:max weight: 19
+log.GRP590-1.ma.gz:max weight: 19
+log.GRP591-1.ma.gz:max weight: 20
+log.GRP592-1.ma.gz:max weight: 20
+log.GRP593-1.ma.gz:max weight: 16
+log.GRP594-1.ma.gz:max weight: 16
+log.GRP595-1.ma.gz:max weight: 16
+log.GRP596-1.ma.gz:max weight: 16
+log.GRP597-1.ma.gz:max weight: 20
+log.GRP598-1.ma.gz:max weight: 20
+log.GRP599-1.ma.gz:max weight: 21
+log.GRP600-1.ma.gz:max weight: 21
+log.GRP601-1.ma.gz:max weight: 15
+log.GRP602-1.ma.gz:max weight: 16
+log.GRP603-1.ma.gz:max weight: 16
+log.GRP604-1.ma.gz:max weight: 15
+log.GRP605-1.ma.gz:max weight: 19
+log.GRP606-1.ma.gz:max weight: 19
+log.GRP608-1.ma.gz:max weight: 22
+log.GRP609-1.ma.gz:max weight: 15
+log.GRP610-1.ma.gz:max weight: 15
+log.GRP611-1.ma.gz:max weight: 16
+log.GRP612-1.ma.gz:max weight: 16
+log.GRP613-1.ma.gz:max weight: 20
+log.GRP614-1.ma.gz:max weight: 20
+log.GRP615-1.ma.gz:max weight: 21
+log.GRP616-1.ma.gz:max weight: 21
+log.LAT006-1.ma.gz:max weight: 20
+log.LAT007-1.ma.gz:max weight: 19
+log.LAT008-1.ma.gz:max weight: 12
+log.LAT009-1.ma.gz:max weight: 23
+log.LAT012-1.ma.gz:max weight: 14
+log.LAT013-1.ma.gz:max weight: 18
+log.LAT014-1.ma.gz:max weight: 6
+log.LAT026-1.ma.gz:max weight: 16
+log.LAT027-1.ma.gz:max weight: 16
+log.LAT028-1.ma.gz:max weight: 12
+log.LAT031-1.ma.gz:max weight: 9
+log.LAT032-1.ma.gz:max weight: 9
+log.LAT033-1.ma.gz:max weight: 3
+log.LAT034-1.ma.gz:max weight: 3
+log.LAT039-1.ma.gz:max weight: 6
+log.LAT039-2.ma.gz:max weight: 0
+log.LAT040-1.ma.gz:max weight: 11
+log.LAT042-1.ma.gz:max weight: 9
+log.LAT043-1.ma.gz:max weight: 18
+log.LAT045-1.ma.gz:max weight: 18
+log.LAT080-1.ma.gz:max weight: 1061
+log.LAT083-1.ma.gz:max weight: 1061
+log.LAT086-1.ma.gz:max weight: 1060
+log.LAT087-1.ma.gz:max weight: 1060
+log.LAT088-1.ma.gz:max weight: 16
+log.LAT089-1.ma.gz:max weight: 16
+log.LAT090-1.ma.gz:max weight: 16
+log.LAT091-1.ma.gz:max weight: 21
+log.LAT092-1.ma.gz:max weight: 991
+log.LAT093-1.ma.gz:max weight: 991
+log.LAT094-1.ma.gz:max weight: 991
+log.LAT095-1.ma.gz:max weight: 991
+log.LAT096-1.ma.gz:max weight: 990
+log.LAT097-1.ma.gz:max weight: 990
+log.LAT168-1.ma.gz:max weight: 16
+log.LAT171-1.ma.gz:max weight: 16
+log.LCL110-2.ma.gz:max weight: 12
+log.LCL111-2.ma.gz:max weight: 17
+log.LCL112-2.ma.gz:max weight: 14
+log.LCL113-2.ma.gz:max weight: 12
+log.LCL114-2.ma.gz:max weight: 12
+log.LCL115-2.ma.gz:max weight: 13
+log.LCL116-2.ma.gz:max weight: 13
+log.LCL132-1.ma.gz:max weight: 9
+log.LCL133-1.ma.gz:max weight: 11
+log.LCL134-1.ma.gz:max weight: 9
+log.LCL135-1.ma.gz:max weight: 9
+log.LCL139-1.ma.gz:max weight: 12
+log.LCL140-1.ma.gz:max weight: 14
+log.LCL141-1.ma.gz:max weight: 14
+log.LCL153-1.ma.gz:max weight: 10
+log.LCL154-1.ma.gz:max weight: 12
+log.LCL155-1.ma.gz:max weight: 12
+log.LCL156-1.ma.gz:max weight: 11
+log.LCL157-1.ma.gz:max weight: 12
+log.LCL158-1.ma.gz:max weight: 15
+log.LCL159-1.ma.gz:max weight: 16
+log.LCL161-1.ma.gz:max weight: 9
+log.LCL163-1.ma.gz:max weight: 34
+log.LCL164-1.ma.gz:max weight: 12
+log.LDA001-1.ma.gz:max weight: 7
+log.LDA002-1.ma.gz:max weight: 11
+log.LDA007-3.ma.gz:max weight: 8
+log.RNG007-4.ma.gz:max weight: 7
+log.RNG008-3.ma.gz:max weight: 17
+log.RNG008-4.ma.gz:max weight: 17
+log.RNG008-7.ma.gz:max weight: 22
+log.RNG011-5.ma.gz:max weight: 0
+log.RNG012-6.ma.gz:max weight: 12
+log.RNG013-6.ma.gz:max weight: 12
+log.RNG014-6.ma.gz:max weight: 12
+log.RNG015-6.ma.gz:max weight: 11
+log.RNG016-6.ma.gz:max weight: 11
+log.RNG017-6.ma.gz:max weight: 11
+log.RNG018-6.ma.gz:max weight: 11
+log.RNG023-6.ma.gz:max weight: 15
+log.RNG023-7.ma.gz:max weight: 15
+log.RNG024-6.ma.gz:max weight: 15
+log.RNG024-7.ma.gz:max weight: 15
+log.ROB002-1.ma.gz:max weight: 10
+log.ROB003-1.ma.gz:max weight: 17
+log.ROB004-1.ma.gz:max weight: 22
+log.ROB008-1.ma.gz:max weight: 17
+log.ROB009-1.ma.gz:max weight: 18
+log.ROB010-1.ma.gz:max weight: 7
+log.ROB013-1.ma.gz:max weight: 8
+log.ROB030-1.ma.gz:max weight: 5
+log.SYN080-1.ma.gz:max weight: 0
+log.SYN083-1.ma.gz:max weight: 0
diff --git a/matita/tests/TPTP/merge_sorted_logs.awk b/matita/tests/TPTP/merge_sorted_logs.awk
new file mode 100644 (file)
index 0000000..969c548
--- /dev/null
@@ -0,0 +1,14 @@
+BEGIN {LAST=""; ARGS="";}
+ { 
+   if (LAST == $1) {
+       if ($3 == "OK" && length(ARGS) < length($0)) {
+          ARGS=$0;
+       }  
+   } else {
+       print ARGS;
+       LAST=$1;
+       ARGS=$0;
+  }
+   
+ }
+END{ print ARGS; }
diff --git a/matita/tests/TPTP/prova_LAT145_rating_93.tar.gz b/matita/tests/TPTP/prova_LAT145_rating_93.tar.gz
new file mode 100644 (file)
index 0000000..6dfe01f
Binary files /dev/null and b/matita/tests/TPTP/prova_LAT145_rating_93.tar.gz differ
diff --git a/matita/tests/TPTP/risultati_CASC_2005.txt b/matita/tests/TPTP/risultati_CASC_2005.txt
new file mode 100644 (file)
index 0000000..6b99bbe
--- /dev/null
@@ -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 (executable)
index 0000000..af58f37
--- /dev/null
@@ -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 (executable)
index 0000000..685484d
--- /dev/null
@@ -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 (file)
index 0000000..c296865
--- /dev/null
@@ -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 (file)
index 0000000..3a9719e
--- /dev/null
@@ -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 (file)
index 0000000..a77c99c
--- /dev/null
@@ -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 (file)
index 0000000..db87636
--- /dev/null
@@ -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 (file)
index 0000000..a265946
--- /dev/null
@@ -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 (file)
index 0000000..4b7859e
--- /dev/null
@@ -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 (file)
index 0000000..b009e18
--- /dev/null
@@ -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 (file)
index 0000000..7620894
--- /dev/null
@@ -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 (file)
index 0000000..0cac60d
--- /dev/null
@@ -0,0 +1,100 @@
+\e[0;32mInfo:  \e[0mexecution of auto.ma started:
+\e[0;34mDebug: \e[0mExecuting: ``set "baseuri" "cic:/matita/tests/auto/"''
+\e[0;34mDebug: \e[0mExecuting: ``include cic:/matita/legacy/coq''
+\e[0;34mDebug: \e[0mExecuting: ``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
+\e[0;31mError: \e[0mBad name: a
+\e[0;34mDebug: \e[0mExecuting: ``intro.''
+\e[0;34mDebug: \e[0mExecuting: ``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
+\e[0;31mError: \e[0mTactic error: No Applicable theorem
diff --git a/matita/tests/bad_tests/auto.ma b/matita/tests/bad_tests/auto.ma
new file mode 100755 (executable)
index 0000000..2972bfa
--- /dev/null
@@ -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 (file)
index 0000000..9185479
--- /dev/null
@@ -0,0 +1,4 @@
+\e[0;32mInfo:  \e[0mexecution of baseuri.ma started:
+\e[0;34mDebug: \e[0mExecuting: ``set "baseuri" "cic:/matita/tests/baseuri/"''
+\e[0;34mDebug: \e[0mExecuting: ``set "baseuri" "cic:/matita/tests/baseuri/"''
+\e[0;31mError: \e[0mError: 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 (file)
index 0000000..0e06223
--- /dev/null
@@ -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 (file)
index 0000000..fe39c31
--- /dev/null
@@ -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 (file)
index 0000000..214d0fb
--- /dev/null
@@ -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 (file)
index 0000000..6179652
--- /dev/null
@@ -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 (file)
index 0000000..3c95a8a
--- /dev/null
@@ -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 (file)
index 0000000..ca8c4ab
--- /dev/null
@@ -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 (file)
index 0000000..64f85ea
--- /dev/null
@@ -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 (file)
index 0000000..b89abbf
--- /dev/null
@@ -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 (file)
index 0000000..bfe2b34
--- /dev/null
@@ -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 (file)
index 0000000..0cf1565
--- /dev/null
@@ -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 (file)
index 0000000..d0d8cae
--- /dev/null
@@ -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 (file)
index 0000000..63c48e6
--- /dev/null
@@ -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 (file)
index 0000000..36217ad
--- /dev/null
@@ -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 (file)
index 0000000..cb54a90
--- /dev/null
@@ -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 (file)
index 0000000..5d60357
--- /dev/null
@@ -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 (file)
index 0000000..f33044f
--- /dev/null
@@ -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 (file)
index 0000000..a9d85ce
--- /dev/null
@@ -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 (file)
index 0000000..ed1ef6b
--- /dev/null
@@ -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 (file)
index 0000000..24d17f1
--- /dev/null
@@ -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 (file)
index 0000000..40f8d37
--- /dev/null
@@ -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 (file)
index 0000000..2ba58c1
--- /dev/null
@@ -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 (file)
index 0000000..cb7a830
--- /dev/null
@@ -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 (file)
index 0000000..0f4827e
--- /dev/null
@@ -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 (file)
index 0000000..e217a76
--- /dev/null
@@ -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 (file)
index 0000000..11a42ac
--- /dev/null
@@ -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 (file)
index 0000000..55275c4
--- /dev/null
@@ -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 (file)
index 0000000..e038c5d
--- /dev/null
@@ -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 (file)
index 0000000..a95e954
--- /dev/null
@@ -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 (file)
index 0000000..4fca7b1
--- /dev/null
@@ -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 (file)
index 0000000..65c916f
--- /dev/null
@@ -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 (file)
index 0000000..cd507c7
--- /dev/null
@@ -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 (file)
index 0000000..a3aacd3
--- /dev/null
@@ -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 (file)
index 0000000..059a27b
--- /dev/null
@@ -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 (file)
index 0000000..2cc7110
--- /dev/null
@@ -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 (file)
index 0000000..56212bd
--- /dev/null
@@ -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 (file)
index 0000000..b8718cd
--- /dev/null
@@ -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 (file)
index 0000000..aaf5700
--- /dev/null
@@ -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 (file)
index 0000000..e48cc82
--- /dev/null
@@ -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 (file)
index 0000000..4afdd37
--- /dev/null
@@ -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 (file)
index 0000000..d7347ed
--- /dev/null
@@ -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 (file)
index 0000000..7e02c0f
--- /dev/null
@@ -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 (file)
index 0000000..4c33bee
--- /dev/null
@@ -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 (file)
index 0000000..c99c59b
--- /dev/null
@@ -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 (file)
index 0000000..55933cd
--- /dev/null
@@ -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 (file)
index 0000000..d9dfec3
--- /dev/null
@@ -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 (file)
index 0000000..c610118
--- /dev/null
@@ -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 (file)
index 0000000..0e27ce4
--- /dev/null
@@ -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 (file)
index 0000000..de9746d
--- /dev/null
@@ -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 (file)
index 0000000..df15e70
--- /dev/null
@@ -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 (file)
index 0000000..bd0eb8d
--- /dev/null
@@ -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 (file)
index 0000000..6246048
--- /dev/null
@@ -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 (file)
index 0000000..2034001
--- /dev/null
@@ -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 (file)
index 0000000..2d090e1
--- /dev/null
@@ -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 (file)
index 0000000..7c46167
--- /dev/null
@@ -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 (file)
index 0000000..ab47854
--- /dev/null
@@ -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 (file)
index 0000000..621e2d4
--- /dev/null
@@ -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 (file)
index 0000000..5c976bc
--- /dev/null
@@ -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 (file)
index 0000000..935a90d
--- /dev/null
@@ -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 (file)
index 0000000..bc5d2e2
--- /dev/null
@@ -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 (file)
index 0000000..2961fdc
--- /dev/null
@@ -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 (file)
index 0000000..dff3b23
--- /dev/null
@@ -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 (file)
index 0000000..450c676
--- /dev/null
@@ -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 (file)
index 0000000..61150e8
--- /dev/null
@@ -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 (file)
index 0000000..a44e80a
--- /dev/null
@@ -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 (file)
index 0000000..93da2ec
--- /dev/null
@@ -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 (file)
index 0000000..85180da
--- /dev/null
@@ -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 (file)
index 0000000..55cfb6a
--- /dev/null
@@ -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 (file)
index 0000000..124cdc1
--- /dev/null
@@ -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 (file)
index 0000000..465d7c0
--- /dev/null
@@ -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 (file)
index 0000000..3318db1
--- /dev/null
@@ -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.