]> matita.cs.unibo.it Git - helm.git/commitdiff
- added (hack) apply_tac_verbose (for auto)
authorAndrea Asperti <andrea.asperti@unibo.it>
Fri, 22 Oct 2004 12:48:31 +0000 (12:48 +0000)
committerAndrea Asperti <andrea.asperti@unibo.it>
Fri, 22 Oct 2004 12:48:31 +0000 (12:48 +0000)
- ported to typed explicit subst

helm/ocaml/tactics/primitiveTactics.ml
helm/ocaml/tactics/primitiveTactics.mli

index e318bd87c562c31547208b944565c1200a1cee1c..c411340ae829ee94159f7ac90e5d0e76c7882a71 100644 (file)
@@ -260,7 +260,7 @@ let
     new_fresh_meta,newmetasenvfragment,exp_named_subst',exp_named_subst_diff
 ;;
 
-let apply_tac ~term (proof, goal) =
+let apply_tac_verbose ~term (proof, goal) =
   (* Assumption: The term "term" must be closed in the current context *)
  let module T = CicTypeChecker in
  let module R = CicReduction in
@@ -328,15 +328,27 @@ let apply_tac ~term (proof, goal) =
              Cic.Appl (term'::arguments)
            )
          in
-          let newmetasenv'' = new_uninstantiatedmetas@old_uninstantiatedmetas in
-          let (newproof, newmetasenv''') =
-           let subst_in =
-             CicMetaSubst.apply_subst ((metano,(context, bo'))::subst)
-           in
-            subst_meta_and_metasenv_in_proof
-              proof metano subst_in newmetasenv''
-          in
-           (newproof, List.map (function (i,_,_) -> i) new_uninstantiatedmetas)
+         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 *)
+           CicMetaSubst.apply_subst 
+            ((metano,(context, bo', Cic.Implicit None))::subst)
+         in
+         let (newproof, newmetasenv''') =
+           subst_meta_and_metasenv_in_proof
+             proof metano subst_in newmetasenv''
+         in
+           (subst_in,(newproof, List.map (function (i,_,_) -> i) new_uninstantiatedmetas))
+
+let apply_tac ~term status = snd (apply_tac_verbose ~term status)
+
+let apply_tac_verbose ~term status =
+  try
+    apply_tac_verbose ~term status
+      (* TODO cacciare anche altre eccezioni? *)
+  with CicUnification.UnificationFailure _ as e ->
+    raise (Fail (Printexc.to_string e))
 
   (* TODO per implementare i tatticali e' necessario che tutte le tattiche
   sollevino _solamente_ Fail *)
index bef3bb2e8041bacb6f5125e932d99c6676be5862..5bbc7d188412702d49a8e1a615f30a04c7170664 100644 (file)
  * http://cs.unibo.it/helm/.
  *)
 
+(* 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: