]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/components/ng_paramodulation/foSubst.ml
Fixes
[helm.git] / helm / software / components / ng_paramodulation / foSubst.ml
index 1b9f2624c77760b88f6e59184ecafca0ff12da60..5cb84e1c938d1ff20b359bc738f7f0b713cfe87f 100644 (file)
@@ -9,22 +9,22 @@
      \ /   This software is distributed as is, NO WARRANTY.     
       V_______________________________________________________________ *)
 
-module Subst (B : Terms.Blob) = struct
+(* module Subst (B : Terms.Blob) = struct *)
   
   let id_subst = [];;
   
   let build_subst n t tail = (n,t) :: tail ;;
   
-  let rec lookup_subst var subst =
+  let rec lookup var subst =
     match var with
       | Terms.Var i ->
           (try
-            lookup_subst (List.assoc i subst) subst
+            lookup (List.assoc i subst) subst
           with
               Not_found -> var)
       | _ -> var
   ;;
-  let lookup_subst i subst = lookup_subst (Terms.Var i) subst;;
+  let lookup i subst = lookup (Terms.Var i) subst;;
   
   let is_in_subst i subst = List.mem_assoc i subst;;
   
@@ -35,5 +35,17 @@ module Subst (B : Terms.Blob) = struct
          not (is_in_subst m subst))
       varlist
   ;;
+
+  let rec apply_subst subst = function
+    | (Terms.Leaf _) as t -> t
+    | Terms.Var i -> 
+        (match lookup i subst with
+        | Terms.Node _ as t -> apply_subst subst t
+        | t -> t)
+    | (Terms.Node l) ->
+       Terms.Node (List.map (fun t -> apply_subst subst t) l)
+;;
+
+  let concat x y = x @ y;;
   
-end
+(* end *)