X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fmatita%2FmatitaScript.ml;h=65d7be828f0e0ebeb4199fd3f4dbb46e8d25180c;hb=1ee5193677b8e2a80d4f068ee79ecac335de1196;hp=f769484c87706e9d615a7f9aa508b5ba1d9430db;hpb=6a5e51c1cf9a56c74a8b53a9b8bc5aa686c9780e;p=helm.git diff --git a/helm/software/matita/matitaScript.ml b/helm/software/matita/matitaScript.ml index f769484c8..65d7be828 100644 --- a/helm/software/matita/matitaScript.ml +++ b/helm/software/matita/matitaScript.ml @@ -118,28 +118,7 @@ let wrap_with_make include_paths (f : GrafiteParser.statement) x = HLog.error "please create it."; raise (Failure ("No root file for "^mafilename)) in - let initial_lexicon_status = - CicNotation2.load_notation ~include_paths:[] BuildTimeConf.core_notation_script - in - let b,x = - try - GrafiteSync.push (); - LexiconSync.time_travel ~present:x ~past:initial_lexicon_status; - let rc = MatitacLib.Make.make root [tgt] in - GrafiteSync.pop (); - CicNotation.reset (); - ignore(CicNotation2.load_notation ~include_paths:[] - BuildTimeConf.core_notation_script); - let x = List.fold_left (fun s c -> LexiconEngine.eval_command s c) - initial_lexicon_status (List.rev - x.LexiconEngine.lexicon_content_rev) - in - rc,x - with - | exn -> - HLog.error ("Unexpected " ^ snd(MatitaExcPp.to_string exn)); - assert false - in + let b = MatitacLib.Make.make root [tgt] in if b then try f ~include_paths x with LexiconEngine.IncludedFileNotCompiled _ -> raise @@ -399,33 +378,22 @@ let rec eval_macro include_paths (buffer : GText.buffer) guistuff lexicon_status (* 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 + let pp_macro = ApplyTransformation.txt_of_macro ~map_unicode_to_tex:true 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 + 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 + 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 + let entry = `Whelp (pp_macro [] [] mac, l) in guistuff.mathviewer#show_uri_list ~reuse:true ~entry l; [], "", parsed_text_length | TA.WElim (loc, term) -> @@ -435,14 +403,14 @@ let rec eval_macro include_paths (buffer : GText.buffer) guistuff lexicon_status | _ -> failwith "Not a MutInd" in let l = Whelp.elim ~dbd uri in - let entry = `Whelp (pp_macro mac, l) 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 s = ((None,[0,[],term], _subst, lazy (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 + let entry = `Whelp (pp_macro [] [] mac, l) in guistuff.mathviewer#show_uri_list ~reuse:true ~entry l; [], "", parsed_text_length (* REAL macro *) @@ -457,7 +425,8 @@ let rec eval_macro include_paths (buffer : GText.buffer) guistuff lexicon_status 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 + 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 @@ -493,6 +462,32 @@ let rec eval_macro include_paths (buffer : GText.buffer) guistuff lexicon_status fun u -> HLog.error (UriManager.string_of_uri u ^ "\n") ) selected; assert false) + | TA.Eval (_, kind, 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 term = + match kind with + | `Normalize -> + CicReduction.normalize ~delta:true ~subst:[] context term + | `Simpl -> + ProofEngineReduction.simpl context term + | `Unfold None -> + ProofEngineReduction.unfold ?what:None context term + | `Unfold (Some lazy_term) -> + let what, _, _ = + lazy_term context metasenv CicUniv.empty_ugraph in + ProofEngineReduction.unfold ~what context term + | `Whd -> + CicReduction.whd ~delta:true ~subst:[] context term + in + let t_and_ty = Cic.Cast (term,ty) in + guistuff.mathviewer#show_entry (`Cic (t_and_ty,metasenv)); + [({grafite_status with proof_status = No_proof},lexicon_status), parsed_text ],"", + parsed_text_length | TA.Check (_,term) -> let metasenv = GrafiteTypes.get_proof_metasenv grafite_status in let context =