aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kernel/inductive.ml6
-rw-r--r--lib/util.ml5
-rw-r--r--lib/util.mli1
3 files changed, 9 insertions, 3 deletions
diff --git a/kernel/inductive.ml b/kernel/inductive.ml
index aef3d6cc82..f60e2dbe0f 100644
--- a/kernel/inductive.ml
+++ b/kernel/inductive.ml
@@ -425,8 +425,8 @@ type subterm_spec =
| Not_subterm
let spec_of_tree t =
- if t=mk_norec then Not_subterm else Subterm(Strict,t)
-
+ if Rtree.eq_rtree (=) t mk_norec then Not_subterm else Subterm(Strict,t)
+
let subterm_spec_glb =
let glb2 s1 s2 =
match s1,s2 with
@@ -435,7 +435,7 @@ let subterm_spec_glb =
| Not_subterm, _ -> Not_subterm
| _, Not_subterm -> Not_subterm
| Subterm (a1,t1), Subterm (a2,t2) ->
- if t1=t2 then Subterm (size_glb a1 a2, t1)
+ if Rtree.eq_rtree (=) t1 t2 then Subterm (size_glb a1 a2, t1)
(* branches do not return objects with same spec *)
else Not_subterm in
Array.fold_left glb2 Dead_code
diff --git a/lib/util.ml b/lib/util.ml
index 29edaf3073..ce336ac34c 100644
--- a/lib/util.ml
+++ b/lib/util.ml
@@ -741,6 +741,11 @@ let array_map_left_pair f a g b =
r, s
end
+let array_iter2 f v1 v2 =
+ let n = Array.length v1 in
+ if Array.length v2 <> n then invalid_arg "array_iter2"
+ else for i = 0 to n - 1 do f v1.(i) v2.(i) done
+
let pure_functional = false
let array_fold_map' f v e =
diff --git a/lib/util.mli b/lib/util.mli
index 92822f770b..befe844bc8 100644
--- a/lib/util.mli
+++ b/lib/util.mli
@@ -198,6 +198,7 @@ val array_map3 :
val array_map_left : ('a -> 'b) -> 'a array -> 'b array
val array_map_left_pair : ('a -> 'b) -> 'a array -> ('c -> 'd) -> 'c array ->
'b array * 'd array
+val array_iter2 : ('a -> 'b -> unit) -> 'a array -> 'b array -> unit
val array_fold_map' : ('a -> 'c -> 'b * 'c) -> 'a array -> 'c -> 'b array * 'c
val array_fold_map2' :
('a -> 'b -> 'c -> 'd * 'c) -> 'a array -> 'b array -> 'c -> 'd array * 'c