]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/ng_refiner/nCicCoercion.ml
arithmetics for λδ
[helm.git] / helm / software / components / ng_refiner / nCicCoercion.ml
index 757041451bbe7978aeb30d0dcdaf88cdf35663d8..04fddee83fdee339546a4bf42484bdf3e23d8f73 100644 (file)
 (* $Id: nCicRefiner.mli 9227 2008-11-21 16:00:06Z tassi $ *)
 
 let debug s = prerr_endline (Lazy.force s);;
-(* let debug _ = ();; *)
+let debug _ = ();;
+
+let convert_term = ref (fun _ _ -> assert false);;
+let set_convert_term f = convert_term := f;;
 
 module COT : Set.OrderedType 
 with type t = string * NCic.term * int * int  * NCic.term *
@@ -31,6 +34,12 @@ type db = DB.t * DB.t
 
 let empty_db = DB.empty,DB.empty
 
+class type g_status =
+ object
+  inherit NCicUnifHint.g_status
+  method coerc_db: db
+ end
+
 class status =
  object
   inherit NCicUnifHint.status
@@ -38,21 +47,18 @@ class status =
   method coerc_db = db
   method set_coerc_db v = {< db = v >}
   method set_coercion_status
-  : 'status. < coerc_db : db; uhint_db: NCicUnifHint.db; .. > as 'status -> 
-          'self
-          = fun o -> {< db = o#coerc_db >}#set_unifhint_status o
+   : 'status. #g_status as 'status -> 'self
+   = fun o -> {< db = o#coerc_db >}#set_unifhint_status o
  end
 
 let index_coercion status name c src tgt arity arg =
   let db_src,db_tgt = status#coerc_db in
   let data = (name,c,arity,arg,src,tgt) in
-
   debug (lazy ("INDEX:" ^ 
     NCicPp.ppterm ~metasenv:[] ~subst:[] ~context:[] src ^ " ===> " ^
     NCicPp.ppterm ~metasenv:[] ~subst:[] ~context:[] tgt ^ "  :=  " ^
     NCicPp.ppterm ~metasenv:[] ~subst:[] ~context:[] c ^ " " ^ 
     string_of_int arg ^ " " ^ string_of_int arity));
-
   let db_src = DB.index db_src src data in
   let db_tgt = DB.index db_tgt tgt data in
   status#set_coerc_db (db_src, db_tgt)
@@ -64,7 +70,7 @@ let index_old_db odb (status : #status) =
        List.fold_left 
          (fun status (uri,_,arg) ->
            try
-            let c=fst (OCic2NCic.convert_term uri (CicUtil.term_of_uri uri)) in
+            let c=fst (!convert_term uri (CicUtil.term_of_uri uri)) in
             let arity = match tgt with | CoercDb.Fun i -> i | _ -> 0 in
             let src, tgt = 
               let cty = NCicTypeChecker.typeof ~subst:[] ~metasenv:[] [] c in