]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/ng_paramodulation/nCicBlob.ml
First tests for paramodulation (pretty printer, unification)
[helm.git] / helm / software / components / ng_paramodulation / nCicBlob.ml
index 87d081deae51cad79c4951bf7eb004c2660729e7..e01edfae309e30053ea336e3aeee2d35ba658536 100644 (file)
@@ -11,7 +11,7 @@
 
 (* $Id: terms.mli 9822 2009-06-03 15:37:06Z tassi $ *)
 
-module type NCicContext = 
+module type NCicContext =
   sig
     val metasenv : NCic.metasenv
     val subst : NCic.substitution
@@ -35,4 +35,17 @@ module NCicBlob(C : NCicContext) : Terms.Blob with type t = NCic.term = struct
   let pp t = 
     NCicPp.ppterm ~context:C.context ~metasenv:C.metasenv ~subst:C.subst t;;
 
+  let rec embed = function
+    | NCic.Meta (i,_) -> Terms.Var i, [i]
+    | NCic.Appl l ->
+       let rec aux acc l = function
+         |[] -> acc@l
+         |hd::tl -> if List.mem hd l then aux acc l tl else aux (hd::acc) l tl
+       in
+       let res,vars = List.fold_left
+         (fun (r,v) t -> let r1,v1 = embed t in (r1::r),aux [] v v1) ([],[]) l
+       in (Terms.Node (List.rev res)), vars
+    | t -> Terms.Leaf t, []
+;;
+
  end