From: Wilmer Ricciotti Date: Tue, 6 Oct 2009 14:08:58 +0000 (+0000) Subject: Inverters/Inversion: X-Git-Tag: make_still_working~3370 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=806ecbdd749ecf2a1cabff52b41cf748fe022401;p=helm.git Inverters/Inversion: - fixed a bug with left parameters and inversion principles - hooked automatic definition of inversion principles to the declaration of inductive types --- diff --git a/helm/software/components/acic_content/.depend b/helm/software/components/acic_content/.depend index 89dca0e44..8ade458af 100644 --- a/helm/software/components/acic_content/.depend +++ b/helm/software/components/acic_content/.depend @@ -1,4 +1,3 @@ -content.cmi: acic2content.cmi: content.cmi content2cic.cmi: content.cmi cicNotationUtil.cmi: cicNotationPt.cmo @@ -6,8 +5,6 @@ cicNotationEnv.cmi: cicNotationPt.cmo cicNotationPp.cmi: cicNotationPt.cmo cicNotationEnv.cmi acic2astMatcher.cmi: cicNotationPt.cmo termAcicContent.cmi: cicNotationPt.cmo -cicNotationPt.cmo: -cicNotationPt.cmx: content.cmo: content.cmi content.cmx: content.cmi acic2content.cmo: content.cmi acic2content.cmi diff --git a/helm/software/components/acic_procedural/.depend b/helm/software/components/acic_procedural/.depend index 97238c4d8..8d0128744 100644 --- a/helm/software/components/acic_procedural/.depend +++ b/helm/software/components/acic_procedural/.depend @@ -1,13 +1,6 @@ -proceduralHelpers.cmi: -proceduralClassify.cmi: -proceduralOptimizer.cmi: -proceduralTypes.cmi: -proceduralMode.cmi: -proceduralConversion.cmi: procedural1.cmi: proceduralTypes.cmi procedural2.cmi: proceduralTypes.cmi proceduralTeX.cmi: proceduralTypes.cmi -acic2Procedural.cmi: proceduralHelpers.cmo: proceduralHelpers.cmi proceduralHelpers.cmx: proceduralHelpers.cmi proceduralClassify.cmo: proceduralHelpers.cmi proceduralClassify.cmi diff --git a/helm/software/components/binaries/extractor/.depend b/helm/software/components/binaries/extractor/.depend index 0c39328ae..e69de29bb 100644 --- a/helm/software/components/binaries/extractor/.depend +++ b/helm/software/components/binaries/extractor/.depend @@ -1,4 +0,0 @@ -extractor.cmo: -extractor.cmx: -extractor_manager.cmo: -extractor_manager.cmx: diff --git a/helm/software/components/binaries/table_creator/.depend b/helm/software/components/binaries/table_creator/.depend index 33147b949..e69de29bb 100644 --- a/helm/software/components/binaries/table_creator/.depend +++ b/helm/software/components/binaries/table_creator/.depend @@ -1,2 +0,0 @@ -table_creator.cmo: -table_creator.cmx: diff --git a/helm/software/components/binaries/transcript/.depend b/helm/software/components/binaries/transcript/.depend index 87d1ed25c..bb6f22a64 100644 --- a/helm/software/components/binaries/transcript/.depend +++ b/helm/software/components/binaries/transcript/.depend @@ -1,11 +1,6 @@ gallina8Parser.cmi: types.cmo grafiteParser.cmi: types.cmo grafite.cmi: types.cmo -engine.cmi: -types.cmo: -types.cmx: -options.cmo: -options.cmx: gallina8Parser.cmo: types.cmo options.cmo gallina8Parser.cmi gallina8Parser.cmx: types.cmx options.cmx gallina8Parser.cmi gallina8Lexer.cmo: options.cmo gallina8Parser.cmi diff --git a/helm/software/components/cic/.depend b/helm/software/components/cic/.depend index a835b247f..c2c7105c7 100644 --- a/helm/software/components/cic/.depend +++ b/helm/software/components/cic/.depend @@ -1,10 +1,8 @@ -cicUniv.cmi: unshare.cmi: cic.cmo deannotate.cmi: cic.cmo cicParser.cmi: cic.cmo cicUtil.cmi: cic.cmo helmLibraryObjects.cmi: cic.cmo -libraryObjects.cmi: cic_indexable.cmi: cic.cmo path_indexing.cmi: cic.cmo cicInspect.cmi: cic.cmo diff --git a/helm/software/components/cic_acic/.depend b/helm/software/components/cic_acic/.depend index 5449d50aa..3fc1e0dce 100644 --- a/helm/software/components/cic_acic/.depend +++ b/helm/software/components/cic_acic/.depend @@ -1,6 +1,3 @@ -eta_fixing.cmi: -doubleTypeInference.cmi: -cic2acic.cmi: cic2Xml.cmi: cic2acic.cmi eta_fixing.cmo: eta_fixing.cmi eta_fixing.cmx: eta_fixing.cmi diff --git a/helm/software/components/cic_disambiguation/.depend b/helm/software/components/cic_disambiguation/.depend index a9ae65a5e..e9bd1168f 100644 --- a/helm/software/components/cic_disambiguation/.depend +++ b/helm/software/components/cic_disambiguation/.depend @@ -1,5 +1,3 @@ -cicDisambiguate.cmi: -disambiguateChoices.cmi: cicDisambiguate.cmo: cicDisambiguate.cmi cicDisambiguate.cmx: cicDisambiguate.cmi disambiguateChoices.cmo: disambiguateChoices.cmi diff --git a/helm/software/components/cic_exportation/.depend b/helm/software/components/cic_exportation/.depend index 91be8d88d..288ea5f6c 100644 --- a/helm/software/components/cic_exportation/.depend +++ b/helm/software/components/cic_exportation/.depend @@ -1,3 +1,2 @@ -cicExportation.cmi: cicExportation.cmo: cicExportation.cmi cicExportation.cmx: cicExportation.cmi diff --git a/helm/software/components/cic_proof_checking/.depend b/helm/software/components/cic_proof_checking/.depend index f8a16629e..5d83fd0f3 100644 --- a/helm/software/components/cic_proof_checking/.depend +++ b/helm/software/components/cic_proof_checking/.depend @@ -1,13 +1,3 @@ -cicLogger.cmi: -cicEnvironment.cmi: -cicPp.cmi: -cicUnivUtils.cmi: -cicSubstitution.cmi: -cicMiniReduction.cmi: -cicReduction.cmi: -cicTypeChecker.cmi: -freshNamesGenerator.cmi: -cicDischarge.cmi: cicLogger.cmo: cicLogger.cmi cicLogger.cmx: cicLogger.cmi cicEnvironment.cmo: cicEnvironment.cmi diff --git a/helm/software/components/cic_unification/.depend b/helm/software/components/cic_unification/.depend index 2e054f73d..a7b23ceb4 100644 --- a/helm/software/components/cic_unification/.depend +++ b/helm/software/components/cic_unification/.depend @@ -1,10 +1,3 @@ -cicMetaSubst.cmi: -cicMkImplicit.cmi: -termUtil.cmi: -coercGraph.cmi: -cicUnification.cmi: -cicReplace.cmi: -cicRefine.cmi: cicMetaSubst.cmo: cicMetaSubst.cmi cicMetaSubst.cmx: cicMetaSubst.cmi cicMkImplicit.cmo: cicMkImplicit.cmi diff --git a/helm/software/components/content_pres/.depend b/helm/software/components/content_pres/.depend index 8d74439eb..6dd0e78a1 100644 --- a/helm/software/components/content_pres/.depend +++ b/helm/software/components/content_pres/.depend @@ -1,9 +1,3 @@ -renderingAttrs.cmi: -cicNotationLexer.cmi: -cicNotationParser.cmi: -mpresentation.cmi: -box.cmi: -content2presMatcher.cmi: termContentPres.cmi: cicNotationParser.cmi boxPp.cmi: mpresentation.cmi cicNotationPres.cmi box.cmi cicNotationPres.cmi: mpresentation.cmi box.cmi diff --git a/helm/software/components/disambiguation/.depend b/helm/software/components/disambiguation/.depend index 9fdbeeeaf..aba9ffea7 100644 --- a/helm/software/components/disambiguation/.depend +++ b/helm/software/components/disambiguation/.depend @@ -1,4 +1,3 @@ -disambiguateTypes.cmi: disambiguate.cmi: disambiguateTypes.cmi multiPassDisambiguator.cmi: disambiguateTypes.cmi disambiguate.cmi disambiguateTypes.cmo: disambiguateTypes.cmi diff --git a/helm/software/components/extlib/.depend b/helm/software/components/extlib/.depend index dcc6377a0..201cd0cba 100644 --- a/helm/software/components/extlib/.depend +++ b/helm/software/components/extlib/.depend @@ -1,13 +1,3 @@ -componentsConf.cmi: -hExtlib.cmi: -hMarshal.cmi: -patternMatcher.cmi: -hLog.cmi: -trie.cmi: -discrimination_tree.cmi: -hTopoSort.cmi: -refCounter.cmi: -graphvizPp.cmi: componentsConf.cmo: componentsConf.cmi componentsConf.cmx: componentsConf.cmi hExtlib.cmo: hExtlib.cmi diff --git a/helm/software/components/getter/.depend b/helm/software/components/getter/.depend index ca64d8ec0..20f69cf0c 100644 --- a/helm/software/components/getter/.depend +++ b/helm/software/components/getter/.depend @@ -1,13 +1,6 @@ -http_getter_wget.cmi: -http_getter_logger.cmi: -http_getter_misc.cmi: -http_getter_const.cmi: http_getter_env.cmi: http_getter_types.cmo -http_getter_storage.cmi: http_getter_common.cmi: http_getter_types.cmo http_getter.cmi: http_getter_types.cmo -http_getter_types.cmo: -http_getter_types.cmx: 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 diff --git a/helm/software/components/grafite/.depend b/helm/software/components/grafite/.depend index f305b1580..dc225e221 100644 --- a/helm/software/components/grafite/.depend +++ b/helm/software/components/grafite/.depend @@ -1,7 +1,5 @@ grafiteAstPp.cmi: grafiteAst.cmo grafiteMarshal.cmi: grafiteAst.cmo -grafiteAst.cmo: -grafiteAst.cmx: grafiteAstPp.cmo: grafiteAst.cmo grafiteAstPp.cmi grafiteAstPp.cmx: grafiteAst.cmx grafiteAstPp.cmi grafiteMarshal.cmo: grafiteAstPp.cmi grafiteAst.cmo grafiteMarshal.cmi diff --git a/helm/software/components/grafite_engine/.depend b/helm/software/components/grafite_engine/.depend index 10236823a..a545f14e3 100644 --- a/helm/software/components/grafite_engine/.depend +++ b/helm/software/components/grafite_engine/.depend @@ -1,4 +1,3 @@ -grafiteTypes.cmi: grafiteSync.cmi: grafiteTypes.cmi nCicCoercDeclaration.cmi: grafiteTypes.cmi grafiteEngine.cmi: grafiteTypes.cmi diff --git a/helm/software/components/grafite_engine/grafiteEngine.ml b/helm/software/components/grafite_engine/grafiteEngine.ml index 1b6878aba..310f3793f 100644 --- a/helm/software/components/grafite_engine/grafiteEngine.ml +++ b/helm/software/components/grafite_engine/grafiteEngine.ml @@ -826,7 +826,29 @@ let rec eval_ncommand opts status (text,prefix_len,cmd) = | NCicTypeChecker.TypeCheckerFailure _ -> HLog.warn "error in generating projection/eliminator"; status,uris - ) (status,`New [] (* uris *)) boxml in + ) (status,`New [] (* uris *)) boxml in + let _,_,_,_,nobj = obj in + let status = match nobj with + NCic.Inductive (true,leftno,[it],_) -> + let _,ind_name,ty,cl = it in + List.fold_left + (fun status outsort -> + let status = status#set_ng_mode `ProofMode in + try + (let status,invobj = NInversion.mk_inverter + (ind_name ^ "_inv_" ^ (snd (NCicElim.ast_of_sort outsort))) + it leftno outsort status status#baseuri in + let _,_,menv,_,_ = invobj in + fst (match menv with + [] -> eval_ncommand opts status ("",0,GrafiteAst.NQed Stdpp.dummy_loc) + | _ -> status,`New [])) + with _ -> HLog.warn "error in generating inversion principle"; + let status = status#set_ng_mode `CommandMode in status) + status + (NCic.Prop:: + List.map (fun s -> NCic.Type s) (NCicEnvironment.get_universes ())) + | _ -> status + in let coercions = match obj with _,_,_,_,NCic.Inductive diff --git a/helm/software/components/grafite_parser/.depend b/helm/software/components/grafite_parser/.depend index 2766b04d0..97bf4d7c2 100644 --- a/helm/software/components/grafite_parser/.depend +++ b/helm/software/components/grafite_parser/.depend @@ -1,9 +1,4 @@ -dependenciesParser.cmi: -grafiteParser.cmi: -cicNotation2.cmi: -nEstatus.cmi: grafiteDisambiguate.cmi: nEstatus.cmi -print_grammar.cmi: dependenciesParser.cmo: dependenciesParser.cmi dependenciesParser.cmx: dependenciesParser.cmi grafiteParser.cmo: grafiteParser.cmi diff --git a/helm/software/components/hgdome/.depend b/helm/software/components/hgdome/.depend index 072d9697a..bf9c09af7 100644 --- a/helm/software/components/hgdome/.depend +++ b/helm/software/components/hgdome/.depend @@ -1,5 +1,3 @@ -domMisc.cmi: -xml2Gdome.cmi: domMisc.cmo: domMisc.cmi domMisc.cmx: domMisc.cmi xml2Gdome.cmo: xml2Gdome.cmi diff --git a/helm/software/components/hmysql/.depend b/helm/software/components/hmysql/.depend index ce439d961..16e6e9da7 100644 --- a/helm/software/components/hmysql/.depend +++ b/helm/software/components/hmysql/.depend @@ -1,7 +1,2 @@ -hSql.cmi: -hSqlite3.cmo: -hSqlite3.cmx: -hMysql.cmo: -hMysql.cmx: hSql.cmo: hSqlite3.cmo hMysql.cmo hSql.cmi hSql.cmx: hSqlite3.cmx hMysql.cmx hSql.cmi diff --git a/helm/software/components/lexicon/.depend b/helm/software/components/lexicon/.depend index 16c114516..847a4a807 100644 --- a/helm/software/components/lexicon/.depend +++ b/helm/software/components/lexicon/.depend @@ -3,8 +3,6 @@ lexiconMarshal.cmi: lexiconAst.cmo cicNotation.cmi: lexiconAst.cmo lexiconEngine.cmi: lexiconMarshal.cmi lexiconAst.cmo cicNotation.cmi lexiconSync.cmi: lexiconEngine.cmi lexiconAst.cmo -lexiconAst.cmo: -lexiconAst.cmx: lexiconAstPp.cmo: lexiconAst.cmo lexiconAstPp.cmi lexiconAstPp.cmx: lexiconAst.cmx lexiconAstPp.cmi lexiconMarshal.cmo: lexiconAstPp.cmi lexiconAst.cmo lexiconMarshal.cmi diff --git a/helm/software/components/library/.depend b/helm/software/components/library/.depend index cfa1295ed..a9f24f814 100644 --- a/helm/software/components/library/.depend +++ b/helm/software/components/library/.depend @@ -1,13 +1,4 @@ -librarian.cmi: -libraryMisc.cmi: -libraryDb.cmi: -coercDb.cmi: cicCoercion.cmi: coercDb.cmi -librarySync.cmi: -cicElim.cmi: -cicRecord.cmi: -cicFix.cmi: -libraryClean.cmi: librarian.cmo: librarian.cmi librarian.cmx: librarian.cmi libraryMisc.cmo: libraryMisc.cmi diff --git a/helm/software/components/logger/.depend b/helm/software/components/logger/.depend index dfb4400ff..28268d29e 100644 --- a/helm/software/components/logger/.depend +++ b/helm/software/components/logger/.depend @@ -1,3 +1,2 @@ -helmLogger.cmi: helmLogger.cmo: helmLogger.cmi helmLogger.cmx: helmLogger.cmi diff --git a/helm/software/components/metadata/.depend b/helm/software/components/metadata/.depend index 78cd97a0d..492a34e3a 100644 --- a/helm/software/components/metadata/.depend +++ b/helm/software/components/metadata/.depend @@ -1,5 +1,3 @@ -sqlStatements.cmi: -metadataTypes.cmi: metadataExtractor.cmi: metadataTypes.cmi metadataPp.cmi: metadataTypes.cmi metadataConstraints.cmi: metadataTypes.cmi diff --git a/helm/software/components/ng_cic_content/.depend b/helm/software/components/ng_cic_content/.depend index 1316c8eab..b4e17fa99 100644 --- a/helm/software/components/ng_cic_content/.depend +++ b/helm/software/components/ng_cic_content/.depend @@ -1,5 +1,3 @@ -ncic2astMatcher.cmi: -nTermCicContent.cmi: ncic2astMatcher.cmo: ncic2astMatcher.cmi ncic2astMatcher.cmx: ncic2astMatcher.cmi nTermCicContent.cmo: ncic2astMatcher.cmi nTermCicContent.cmi diff --git a/helm/software/components/ng_disambiguation/.depend b/helm/software/components/ng_disambiguation/.depend index 2de54dc5e..6b4ef95c1 100644 --- a/helm/software/components/ng_disambiguation/.depend +++ b/helm/software/components/ng_disambiguation/.depend @@ -1,3 +1,2 @@ -nCicDisambiguate.cmi: nCicDisambiguate.cmo: nCicDisambiguate.cmi nCicDisambiguate.cmx: nCicDisambiguate.cmi diff --git a/helm/software/components/ng_kernel/.depend b/helm/software/components/ng_kernel/.depend index 365aaf261..fa6e42064 100644 --- a/helm/software/components/ng_kernel/.depend +++ b/helm/software/components/ng_kernel/.depend @@ -1,4 +1,3 @@ -nUri.cmi: nReference.cmi: nUri.cmi nCicUtils.cmi: nCic.cmo nCicSubstitution.cmi: nCic.cmo diff --git a/helm/software/components/ng_library/.depend b/helm/software/components/ng_library/.depend index 48127a325..c76001c01 100644 --- a/helm/software/components/ng_library/.depend +++ b/helm/software/components/ng_library/.depend @@ -1,3 +1,2 @@ -nCicLibrary.cmi: nCicLibrary.cmo: nCicLibrary.cmi nCicLibrary.cmx: nCicLibrary.cmi diff --git a/helm/software/components/ng_paramodulation/.depend b/helm/software/components/ng_paramodulation/.depend index 369ed6b69..3ace51014 100644 --- a/helm/software/components/ng_paramodulation/.depend +++ b/helm/software/components/ng_paramodulation/.depend @@ -1,4 +1,3 @@ -terms.cmi: pp.cmi: terms.cmi foSubst.cmi: terms.cmi orderings.cmi: terms.cmi @@ -11,7 +10,6 @@ paramod.cmi: terms.cmi orderings.cmi nCicBlob.cmi: terms.cmi cicBlob.cmi: terms.cmi nCicProof.cmi: terms.cmi -nCicParamod.cmi: terms.cmo: terms.cmi terms.cmx: terms.cmi pp.cmo: terms.cmi pp.cmi diff --git a/helm/software/components/ng_refiner/.depend b/helm/software/components/ng_refiner/.depend index db7e52884..f30b906fd 100644 --- a/helm/software/components/ng_refiner/.depend +++ b/helm/software/components/ng_refiner/.depend @@ -1,6 +1,3 @@ -nDiscriminationTree.cmi: -nCicMetaSubst.cmi: -nCicUnifHint.cmi: nCicCoercion.cmi: nCicUnifHint.cmi nRstatus.cmi: nCicCoercion.cmi nCicUnification.cmi: nRstatus.cmi diff --git a/helm/software/components/ng_tactics/.depend b/helm/software/components/ng_tactics/.depend index 615a158e9..8d46f1671 100644 --- a/helm/software/components/ng_tactics/.depend +++ b/helm/software/components/ng_tactics/.depend @@ -1,8 +1,5 @@ -nCicTacReduction.cmi: -nTacStatus.cmi: -nCicElim.cmi: -nAuto.cmi: nTacStatus.cmi nTactics.cmi: nTacStatus.cmi +nAuto.cmi: nTacStatus.cmi nInversion.cmi: nTacStatus.cmi nCicTacReduction.cmo: nCicTacReduction.cmi nCicTacReduction.cmx: nCicTacReduction.cmi @@ -10,9 +7,9 @@ nTacStatus.cmo: nCicTacReduction.cmi nTacStatus.cmi nTacStatus.cmx: nCicTacReduction.cmx nTacStatus.cmi nCicElim.cmo: nCicElim.cmi nCicElim.cmx: nCicElim.cmi -nAuto.cmo: nTacStatus.cmi nAuto.cmi -nAuto.cmx: nTacStatus.cmx nAuto.cmi nTactics.cmo: nTacStatus.cmi nCicElim.cmi nTactics.cmi nTactics.cmx: nTacStatus.cmx nCicElim.cmx nTactics.cmi +nAuto.cmo: nTactics.cmi nTacStatus.cmi nAuto.cmi +nAuto.cmx: nTactics.cmx nTacStatus.cmx nAuto.cmi nInversion.cmo: nTactics.cmi nCicElim.cmi nInversion.cmi nInversion.cmx: nTactics.cmx nCicElim.cmx nInversion.cmi diff --git a/helm/software/components/ng_tactics/nInversion.ml b/helm/software/components/ng_tactics/nInversion.ml index f70999315..7c58ae87e 100644 --- a/helm/software/components/ng_tactics/nInversion.ml +++ b/helm/software/components/ng_tactics/nInversion.ml @@ -82,86 +82,89 @@ let mk_inverter name it leftno ?selection outsort status baseuri = prerr_endline ("lunghezza args = " ^ string_of_int (List.length args));*) let nparams = List.length args in prerr_endline ("nparams = " ^ string_of_int nparams); - - let xs = List.map (fun n -> "x" ^ (string_of_int n)) (HExtlib.list_seq 1 (nparams+1)) in - prerr_endline ("lunghezza xs = " ^ string_of_int (List.length xs)); - let ls, rs = HExtlib.split_nth leftno xs in - prerr_endline ("lunghezza ls = " ^ string_of_int (List.length ls)); - prerr_endline ("lunghezza rs = " ^ string_of_int (List.length rs)); - let ys = List.map (fun n -> "y" ^ (string_of_int n)) (HExtlib.list_seq (leftno+1) (nparams+1)) in - - let id_xs = List.map mk_id xs in - let id_ls = List.map mk_id ls in - let id_rs = List.map mk_id rs in - let id_ys = List.map mk_id ys in - - (* pseudocode let t = Lambda y1 ... yr. xs_ = ys_ -> pred *) - - (* check: assuming we have more than one right parameter *) - (* pred := P yr- *) - let pred = mk_appl ((mk_id "P")::id_ys) in - - let selection = match selection with - None -> HExtlib.mk_list true (List.length ys) - | Some s -> s - in - let prods = mk_arrows id_rs id_ys selection pred in - - let lambdas = mk_lambdas (ys@["p"]) prods in - - let hyplist = - let rec hypaux k = function - 0 -> [] - | n -> ("H" ^ string_of_int k) :: hypaux (k+1) (n-1) - in (hypaux 1 ncons) - in - prerr_endline ("lunghezza ys = " ^ string_of_int (List.length ys)); - - let outsort, suffix = NCicElim.ast_of_sort outsort in - let theorem = mk_prods xs - (CicNotationPt.Binder (`Forall, (mk_id "P", Some (mk_prods (HExtlib.mk_list "_" (List.length ys)) (CicNotationPt.Sort outsort))), - mk_prods hyplist (CicNotationPt.Binder (`Forall, (mk_id "Hterm", (*Some (mk_appl (List.map mk_id (ind_name::xs)))) *) - Some (CicNotationPt.Implicit `JustOne)), - mk_appl (mk_id "P"::id_rs))))) - in - let t = mk_appl ( [mk_id (ind_name ^ "_" ^ suffix); lambdas] @ - List.map mk_id hyplist @ - CicNotationPt.Implicit `Vector::[mk_id "Hterm"] ) in - - let status, theorem = GrafiteDisambiguate.disambiguate_nobj status ~baseuri - (baseuri ^ name ^ ".def", - 0,CicNotationPt.Theorem (`Theorem,name,theorem,Some - (CicNotationPt.Implicit (`Tagged "inv")),`Regular)) in - let uri,height,nmenv,nsubst,nobj = theorem in - let ninitial_stack = Continuationals.Stack.of_nmetasenv nmenv in - let status = status#set_obj theorem in - let status = status#set_stack ninitial_stack in - let status = subst_metasenv_and_fix_names status in - - let cut_theorem = - let rs = List.map (fun x -> mk_id x) rs in - mk_arrows rs rs selection (mk_appl (mk_id "P"::rs)) in - - let cut = mk_appl [CicNotationPt.Binder (`Lambda, (mk_id "Hcut", Some cut_theorem), - CicNotationPt.Implicit (`Tagged "end")); - CicNotationPt.Implicit (`Tagged "cut")] in - - let intros = List.map (fun x -> NTactics.intro_tac x) (xs@["P"]@hyplist@["Hterm"]) in - - let status = NTactics.block_tac - (NTactics.branch_tac:: - NTactics.case_tac "inv":: - (intros @ - [NTactics.apply_tac ("",0,cut); - NTactics.branch_tac; - NTactics.case_tac "end"; - NTactics.apply_tac ("",0,mk_id "Hcut"); - NTactics.apply_tac ("",0,mk_id "refl_eq"); - NTactics.shift_tac; - NTactics.case_tac "cut"; - NTactics.apply_tac ("",0,t); - NTactics.merge_tac; - NTactics.merge_tac; - NTactics.skip_tac])) status in - status,status#obj + if nparams <= leftno + then raise (Failure "inverter: the type must have at least one right parameter") + else + let xs = List.map (fun n -> "x" ^ (string_of_int n)) (HExtlib.list_seq 1 (nparams+1)) in + prerr_endline ("lunghezza xs = " ^ string_of_int (List.length xs)); + let ls, rs = HExtlib.split_nth leftno xs in + prerr_endline ("lunghezza ls = " ^ string_of_int (List.length ls)); + prerr_endline ("lunghezza rs = " ^ string_of_int (List.length rs)); + let ys = List.map (fun n -> "y" ^ (string_of_int n)) (HExtlib.list_seq (leftno+1) (nparams+1)) in + + let id_xs = List.map mk_id xs in + let id_ls = List.map mk_id ls in + let id_rs = List.map mk_id rs in + let id_ys = List.map mk_id ys in + + (* pseudocode let t = Lambda y1 ... yr. xs_ = ys_ -> pred *) + + (* check: assuming we have more than one right parameter *) + (* pred := P yr- *) + let pred = mk_appl ((mk_id "P")::id_ys) in + + let selection = match selection with + None -> HExtlib.mk_list true (List.length ys) + | Some s -> s + in + let prods = mk_arrows id_rs id_ys selection pred in + + let lambdas = mk_lambdas (ys@["p"]) prods in + + let hyplist = + let rec hypaux k = function + 0 -> [] + | n -> ("H" ^ string_of_int k) :: hypaux (k+1) (n-1) + in (hypaux 1 ncons) + in + prerr_endline ("lunghezza ys = " ^ string_of_int (List.length ys)); + + let outsort, suffix = NCicElim.ast_of_sort outsort in + let theorem = mk_prods xs + (CicNotationPt.Binder (`Forall, (mk_id "P", Some (mk_prods (HExtlib.mk_list "_" (List.length ys)) (CicNotationPt.Sort outsort))), + mk_prods hyplist (CicNotationPt.Binder (`Forall, (mk_id "Hterm", (*Some (mk_appl (List.map mk_id (ind_name::xs)))) *) + Some (CicNotationPt.Implicit `JustOne)), + mk_appl (mk_id "P"::id_rs))))) + in + let t = mk_appl ( [mk_id (ind_name ^ "_" ^ suffix)]@ id_ls @ [lambdas] @ + List.map mk_id hyplist @ + CicNotationPt.Implicit `Vector::[mk_id "Hterm"] ) in + + let status, theorem = GrafiteDisambiguate.disambiguate_nobj status ~baseuri + (baseuri ^ name ^ ".def", + 0,CicNotationPt.Theorem (`Theorem,name,theorem,Some + (CicNotationPt.Implicit (`Tagged "inv")),`InversionPrinciple)) in + let uri,height,nmenv,nsubst,nobj = theorem in + let ninitial_stack = Continuationals.Stack.of_nmetasenv nmenv in + let status = status#set_obj theorem in + let status = status#set_stack ninitial_stack in + let status = subst_metasenv_and_fix_names status in + + let cut_theorem = + let rs = List.map (fun x -> mk_id x) rs in + mk_arrows rs rs selection (mk_appl (mk_id "P"::rs)) in + + let cut = mk_appl [CicNotationPt.Binder (`Lambda, (mk_id "Hcut", Some cut_theorem), + CicNotationPt.Implicit (`Tagged "end")); + CicNotationPt.Implicit (`Tagged "cut")] in + let intros = List.map (fun x -> NTactics.intro_tac x) (xs@["P"]@hyplist@["Hterm"]) in + + let status = NTactics.block_tac + (NTactics.branch_tac:: + NTactics.case_tac "inv":: + (intros @ + [NTactics.apply_tac ("",0,cut); + NTactics.branch_tac; + NTactics.case_tac "end"; + NTactics.apply_tac ("",0,mk_id "Hcut"); + NTactics.apply_tac ("",0,mk_id "refl_eq"); + NTactics.shift_tac; + NTactics.case_tac "cut"; + NTactics.apply_tac ("",0,t) + (* ; + NTactics.merge_tac; + NTactics.merge_tac; + NTactics.skip_tac*)])) status in + status,status#obj ;; + diff --git a/helm/software/components/registry/.depend b/helm/software/components/registry/.depend index 40c03891a..cf4f36b68 100644 --- a/helm/software/components/registry/.depend +++ b/helm/software/components/registry/.depend @@ -1,3 +1,2 @@ -helm_registry.cmi: helm_registry.cmo: helm_registry.cmi helm_registry.cmx: helm_registry.cmi diff --git a/helm/software/components/syntax_extensions/.depend b/helm/software/components/syntax_extensions/.depend index 25e67131f..f3c6a8bd1 100644 --- a/helm/software/components/syntax_extensions/.depend +++ b/helm/software/components/syntax_extensions/.depend @@ -1,5 +1,2 @@ -utf8Macro.cmi: -utf8MacroTable.cmo: -utf8MacroTable.cmx: utf8Macro.cmo: utf8MacroTable.cmo utf8Macro.cmi utf8Macro.cmx: utf8MacroTable.cmx utf8Macro.cmi diff --git a/helm/software/components/tactics/.depend b/helm/software/components/tactics/.depend index d9d6034a1..169fc76b0 100644 --- a/helm/software/components/tactics/.depend +++ b/helm/software/components/tactics/.depend @@ -1,19 +1,11 @@ -proofEngineTypes.cmi: proofEngineHelpers.cmi: proofEngineTypes.cmi -proofEngineReduction.cmi: continuationals.cmi: proofEngineTypes.cmi tacticals.cmi: proofEngineTypes.cmi reductionTactics.cmi: proofEngineTypes.cmi proofEngineStructuralRules.cmi: proofEngineTypes.cmi primitiveTactics.cmi: proofEngineTypes.cmi -hashtbl_equiv.cmi: metadataQuery.cmi: proofEngineTypes.cmi -universe.cmi: autoTypes.cmi: proofEngineTypes.cmi -autoCache.cmi: -paramodulation/utils.cmi: -closeCoercionGraph.cmi: -paramodulation/subst.cmi: paramodulation/equality.cmi: paramodulation/utils.cmi \ paramodulation/subst.cmi paramodulation/founif.cmi: paramodulation/subst.cmi @@ -35,13 +27,10 @@ equalityTactics.cmi: proofEngineTypes.cmi auto.cmi: proofEngineTypes.cmi automationCache.cmi destructTactic.cmi: proofEngineTypes.cmi inversion.cmi: proofEngineTypes.cmi -inversion_principle.cmi: ring.cmi: proofEngineTypes.cmi setoids.cmi: proofEngineTypes.cmi -fourier.cmi: fourierR.cmi: proofEngineTypes.cmi fwdSimplTactic.cmi: proofEngineTypes.cmi -history.cmi: statefulProofEngine.cmi: proofEngineTypes.cmi tactics.cmi: tacticals.cmi proofEngineTypes.cmi automationCache.cmi auto.cmi declarative.cmi: proofEngineTypes.cmi automationCache.cmi auto.cmi diff --git a/helm/software/components/thread/.depend b/helm/software/components/thread/.depend index 6616a03d0..7759190c6 100644 --- a/helm/software/components/thread/.depend +++ b/helm/software/components/thread/.depend @@ -1,5 +1,3 @@ -threadSafe.cmi: -extThread.cmi: threadSafe.cmo: threadSafe.cmi threadSafe.cmx: threadSafe.cmi extThread.cmo: extThread.cmi diff --git a/helm/software/components/tptp_grafite/.depend b/helm/software/components/tptp_grafite/.depend index a8972f4cf..bc310327f 100644 --- a/helm/software/components/tptp_grafite/.depend +++ b/helm/software/components/tptp_grafite/.depend @@ -1,7 +1,4 @@ parser.cmi: ast.cmo -tptp2grafite.cmi: -ast.cmo: -ast.cmx: lexer.cmo: parser.cmi lexer.cmx: parser.cmx parser.cmo: ast.cmo parser.cmi diff --git a/helm/software/components/urimanager/.depend b/helm/software/components/urimanager/.depend index 9cac9aa78..482148423 100644 --- a/helm/software/components/urimanager/.depend +++ b/helm/software/components/urimanager/.depend @@ -1,3 +1,2 @@ -uriManager.cmi: uriManager.cmo: uriManager.cmi uriManager.cmx: uriManager.cmi diff --git a/helm/software/components/whelp/.depend b/helm/software/components/whelp/.depend index 65dc07955..39f37dfa9 100644 --- a/helm/software/components/whelp/.depend +++ b/helm/software/components/whelp/.depend @@ -1,5 +1,3 @@ -whelp.cmi: -fwdQueries.cmi: whelp.cmo: whelp.cmi whelp.cmx: whelp.cmi fwdQueries.cmo: fwdQueries.cmi diff --git a/helm/software/components/xml/.depend b/helm/software/components/xml/.depend index e7e7ffbd7..5ef59bdc9 100644 --- a/helm/software/components/xml/.depend +++ b/helm/software/components/xml/.depend @@ -1,5 +1,3 @@ -xml.cmi: -xmlPushParser.cmi: xml.cmo: xml.cmi xml.cmx: xml.cmi xmlPushParser.cmo: xmlPushParser.cmi diff --git a/helm/software/components/xmldiff/.depend b/helm/software/components/xmldiff/.depend index 65bd7b949..e2832de33 100644 --- a/helm/software/components/xmldiff/.depend +++ b/helm/software/components/xmldiff/.depend @@ -1,3 +1,2 @@ -xmlDiff.cmi: xmlDiff.cmo: xmlDiff.cmi xmlDiff.cmx: xmlDiff.cmi