]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/tactics/primitiveTactics.ml
CSC: hack to make applications of constants that have a Type sort which
[helm.git] / helm / ocaml / tactics / primitiveTactics.ml
index 1de72fb5d2d7368da9eba47a0301017e7fe7a742..1631e767fb7a5f59f7482a598081195267969f5b 100644 (file)
@@ -160,6 +160,21 @@ let new_metasenv_for_apply newmeta proof context ty =
   let rec aux newmeta =
    function
       C.Cast (he,_) -> aux newmeta he
+      (* 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) ->
+       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
@@ -275,7 +290,7 @@ let apply_tac ~term ~status:(proof, goal) =
     in
      let newmetasenv = metasenv'@newmetas in
       let subst,newmetasenv' =
-       CicUnification.fo_unif newmetasenv context consthead ty
+        CicUnification.fo_unif newmetasenv context consthead ty
       in
        let in_subst_domain i = List.exists (function (j,_) -> i=j) subst in
        let apply_subst = CicMetaSubst.apply_subst subst in