]> matita.cs.unibo.it Git - helm.git/commitdiff
...
authorEnrico Tassi <enrico.tassi@inria.fr>
Wed, 15 Oct 2008 22:32:03 +0000 (22:32 +0000)
committerEnrico Tassi <enrico.tassi@inria.fr>
Wed, 15 Oct 2008 22:32:03 +0000 (22:32 +0000)
helm/software/components/ng_refiner/check.ml

index 7fe8cf3663303b9820f10141be11a79f7c3cae09..3b951bec268157e8903d1c8d81364a82c9a16c4f 100644 (file)
@@ -205,14 +205,14 @@ let _ =
                 ctx @ [(name, (NCic.Decl s))] , t
             | t -> [], t
           in
-          let rec perforate ctx menv = function
+          let rec perforate ctx metasenv = function
             | NCic.Appl (NCic.Const (NReference.Ref (u,_))::ty::_)
               when NUri.string_of_uri u = "cic:/matita/tests/hole.con" ->
-                let menv, ty =  perforate ctx menv ty in
-                let a,b,_ = NCicMetaSubst.mk_meta menv ctx (`WithType ty) in a,b
+                let metasenv, ty =  perforate ctx metasenv ty in
+                let a,b,_ = NCicMetaSubst.mk_meta metasenv ctx (`WithType ty) in a,b
             | t -> 
                 NCicUntrusted.map_term_fold_a
-                 (fun e ctx -> e::ctx) ctx perforate menv t
+                 (fun e ctx -> e::ctx) ctx perforate metasenv t
           in
           let rec curryfy ctx = function
             | NCic.Lambda (name, s, tgt) ->
@@ -224,10 +224,10 @@ let _ =
           in
 (*
           let ctx, pty = intros ty in
-          let menv, pty = perforate ctx [] pty in
+          let metasenv, pty = perforate ctx [] pty in
 *)
 (*
-          let sty, menv, _ = 
+          let sty, metasenv, _ = 
             NCicMetaSubst.saturate ~delta:max_int [] ctx ty 0
           in
 *)
@@ -251,22 +251,29 @@ let _ =
 (*
                 prerr_endline 
                  (Printf.sprintf "%s == %s"
-                 (NCicPp.ppterm ~metasenv:menv ~subst:[] ~context:ctx ity)
-                 (NCicPp.ppterm ~metasenv:menv ~subst:[] ~context:ctx sty));
+                 (NCicPp.ppterm ~metasenv:metasenv ~subst:[] ~context:ctx ity)
+                 (NCicPp.ppterm ~metasenv:metasenv ~subst:[] ~context:ctx sty));
 *)
-          let menv, subst, bo, infty = 
-            NCicRefiner.typeof [] [] [] (curryfy [] bo) None
+          let metasenv, subst, bo, infty = 
+            let bo = curryfy [] bo in
+            try NCicRefiner.typeof [] [] [] bo None
+            with
+            | NCicRefiner.RefineFailure msg 
+            | NCicRefiner.Uncertain msg ->
+               let _, msg = Lazy.force msg in
+               prerr_endline msg;
+               assert false
           in
           let metasenv, subst = 
             try 
-              NCicUnification.unify menv subst [] infty ty
+              NCicUnification.unify metasenv subst [] infty ty
             with
             | NCicUnification.Uncertain msg 
             | NCicUnification.UnificationFailure msg 
             | NCicMetaSubst.MetaSubstFailure msg ->
                 prerr_endline (Lazy.force msg); 
-                [], []
-            | Sys.Break -> [],[]
+                metasenv, subst
+            | Sys.Break -> metasenv, subst
           in
           if (NCicReduction.are_convertible ~subst [] infty ty)
           then
@@ -280,8 +287,9 @@ let _ =
                     prerr_endline ("FAIL: " ^ NUri.string_of_uri u);
                 prerr_endline 
                  (Printf.sprintf 
-                   ("\t\tRESULT OF UNIF\n\nsubst:\n%s\nmenv:\n%s\n" ^^ 
-                   "context:\n%s\n%s == %s\n%s == %s\n")
+                   ("\t\tRESULT OF UNIF\n\nsubst:\n%s\nmetasenv:\n%s\n" ^^ 
+                   "context:\n%s\nTERMS NO SUBST:\n%s\n==\n%s\n"^^
+                   "TERMS:\n%s\n==\n%s\n")
                  (NCicPp.ppsubst ~metasenv subst)
                  (NCicPp.ppmetasenv ~subst metasenv)
                  (NCicPp.ppcontext ~metasenv ~subst ctx)