]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/cic_unification/cicRefine.ml
- new implementation of the apply case in fo_unif using beta expansion
[helm.git] / helm / ocaml / cic_unification / cicRefine.ml
index b3525d3182bcec3737d02c2883cd7402d1acf730..7bd3de5c2a0f09aa92e0094d80f999dac7272276 100644 (file)
@@ -162,8 +162,8 @@ and type_of_aux' metasenv context t =
         in
         CicSubstitution.lift_meta l ty, subst', metasenv'
      (* TASSI: CONSTRAINT *)
-    | C.Sort (C.Type t) ->
-        let t' = CicUniv.fresh() in
+    | C.Sort (C.Type t) -> 
+        let t' = CicUniv.fresh() in 
         if not (CicUniv.add_gt t' t ) then
          assert false (* t' is fresh! an error in CicUniv *)
        else
@@ -452,6 +452,7 @@ and type_of_aux' metasenv context t =
     | ((uri,t) as subst)::tl ->
        let typeofvar =
         CicSubstitution.subst_vars substs (type_of_variable uri) in
+(* CSC: why was this code here? it is wrong
        (match CicEnvironment.get_cooked_obj ~trust:false uri with
            Cic.Variable (_,Some bo,_,_) ->
             raise
@@ -463,16 +464,19 @@ and type_of_aux' metasenv context t =
             (RefineFailure
              ("Unkown variable definition " ^ UriManager.string_of_uri uri))
        ) ;
+*)
        let typeoft,metasubst',metasenv' =
         type_of_aux metasubst metasenv context t
        in
-        try
-         let metasubst'',metasenv'' =
+        let metasubst'',metasenv'' =
+         try
           fo_unif_subst metasubst' context metasenv' typeoft typeofvar
-         in
-          check_exp_named_subst_aux metasubst'' metasenv'' (substs@[subst]) tl
-        with _ ->
-         raise (RefineFailure "Wrong Explicit Named Substitution")
+         with _ ->
+          raise (RefineFailure
+           ("Wrong Explicit Named Substitution: " ^ CicMetaSubst.ppterm metasubst' typeoft ^
+            " not unifiable with " ^ CicMetaSubst.ppterm metasubst' typeofvar))
+        in
+         check_exp_named_subst_aux metasubst'' metasenv'' (substs@[subst]) tl
   in
    check_exp_named_subst_aux metasubst metasenv []
 
@@ -487,7 +491,7 @@ and type_of_aux' metasenv context t =
           C.Sort s2,subst,metasenv
      | (C.Sort (C.Type t1), C.Sort (C.Type t2)) -> 
        (* TASSI: CONSRTAINTS: the same in cictypechecker, doubletypeinference *)
-       let t' = CicUniv.fresh() in
+       let t' = CicUniv.fresh() in 
        if not (CicUniv.add_ge t' t1) || not (CicUniv.add_ge t' t2) then
          assert false ; (* not possible, error in CicUniv *)
        C.Sort (C.Type t'),subst,metasenv