From: Enrico Tassi Date: Fri, 19 Dec 2008 10:09:53 +0000 (+0000) Subject: added unification hint X-Git-Tag: make_still_working~4361 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=ee21d4e76a585c9f9b7921834311d809f2f5bf80;p=helm.git added unification hint --- diff --git a/helm/software/components/grafite_parser/grafiteDisambiguate.ml b/helm/software/components/grafite_parser/grafiteDisambiguate.ml index 29d1052dd..c1fd03af2 100644 --- a/helm/software/components/grafite_parser/grafiteDisambiguate.ml +++ b/helm/software/components/grafite_parser/grafiteDisambiguate.ml @@ -570,21 +570,7 @@ let disambiguate_obj lexicon_status ?baseuri metasenv (text,prefix_len,obj) = | None -> raise BaseUriNotSetYet) | CicNotationPt.Inductive _ -> assert false | CicNotationPt.Theorem _ -> None in - let time = Unix.gettimeofday () in - let (diff, metasenv, _, cic, _) = - singleton "third" - (CicDisambiguate.disambiguate_obj - ~lookup_in_library - ~mk_choice:cic_mk_choice - ~mk_implicit - ~description_of_alias:LexiconAst.description_of_alias - ~aliases:lexicon_status.LexiconEngine.aliases - ~universe:(Some lexicon_status.LexiconEngine.multi_aliases) ~uri - (text,prefix_len,obj)) in - - let time = Unix.gettimeofday () -. time in -(* - prerr_endline ("VECCHIA DISAMBIGUAZIONE: " ^ string_of_float time); + let try_new cic = (NCicLibrary.clear_cache (); NCicEnvironment.invalidate (); OCic2NCic.clear (); @@ -650,11 +636,44 @@ let disambiguate_obj lexicon_status ?baseuri metasenv (text,prefix_len,obj) = (* | exn -> prerr_endline (Printexc.to_string exn) *) ) | _ -> ()) - ); + ) + in + +(* + try + let time = Unix.gettimeofday () in *) - + + let (diff, metasenv, _, cic, _) = + singleton "third" + (CicDisambiguate.disambiguate_obj + ~lookup_in_library + ~mk_choice:cic_mk_choice + ~mk_implicit + ~description_of_alias:LexiconAst.description_of_alias + ~aliases:lexicon_status.LexiconEngine.aliases + ~universe:(Some lexicon_status.LexiconEngine.multi_aliases) ~uri + (text,prefix_len,obj)) in + +(* + let time = Unix.gettimeofday () -. time in + prerr_endline ("VECCHIA DISAMBIGUAZIONE: " ^ string_of_float time); + try_new cic; +*) + + let lexicon_status = LexiconEngine.set_proof_aliases lexicon_status diff in lexicon_status, metasenv, cic + +(* + with + | Sys.Break as exn -> raise exn + | exn -> + try_new (Cic.InductiveDefinition ([],[],0,[])); + raise exn +*) + +;; let disambiguate_command lexicon_status ?baseuri metasenv (text,prefix_len,cmd)= match cmd with @@ -677,6 +696,12 @@ let disambiguate_command lexicon_status ?baseuri metasenv (text,prefix_len,cmd)= disambiguate_term None text prefix_len lexicon_status_ref [] in let metasenv,t = disambiguate_term metasenv t in !lexicon_status_ref, metasenv, GrafiteAst.Coercion (loc,t,b,a,s) + | GrafiteAst.UnificationHint (loc, t) -> + let lexicon_status_ref = ref lexicon_status in + let disambiguate_term = + disambiguate_term None text prefix_len lexicon_status_ref [] in + let metasenv,t = disambiguate_term metasenv t in + !lexicon_status_ref, metasenv, GrafiteAst.UnificationHint (loc,t) | GrafiteAst.Default _ | GrafiteAst.Drop _ | GrafiteAst.Include _