]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/lambda-delta/lib/cps.ml
we added the implicit coercion for modus tollens
[helm.git] / helm / software / lambda-delta / lib / cps.ml
index 9fc5dc9b22285d1f62a08090b845fe1b4e7b110d..b61fccfa47f148553394d83fb26a5bb369002efc 100644 (file)
@@ -30,10 +30,10 @@ let rec list_rev_map_append f map ~tail = function
          let f hd = list_rev_map_append f map ~tail:(hd :: tail) tl in
          map f hd
 
-let rec forall2 f map l1 l2 = match l1, l2 with
+let rec list_forall2 f map l1 l2 = match l1, l2 with
    | [], []                 -> f true
    | hd1 :: tl1, hd2 :: tl2 ->
-      let f b = if b then forall2 f map tl1 tl2 else f false in
+      let f b = if b then list_forall2 f map tl1 tl2 else f false in
       map f hd1 hd2
    | _                      -> f false
 
@@ -56,3 +56,10 @@ let list_map f =
 let list_iter f map l =
    let map f () x = map f x in
    list_fold_left f map () l
+
+let rec list_fold_left2 f map a l1 l2 = match l1, l2 with
+   | [], []                 -> f a
+   | hd1 :: tl1, hd2 :: tl2 -> 
+      let f a = if a = None then f a else list_fold_left2 f map a tl1 tl2 in
+      map f a hd1 hd2
+   | _                      -> f None