aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbarras2008-03-18 13:30:57 +0000
committerbarras2008-03-18 13:30:57 +0000
commit067aa9a444b7d13733c8ca1cf52d6d73e105dec0 (patch)
treeefa8f52dccdd7eaa8fdc04de7366f840b9a70d86
parent242e810e149d19d9a6089e6af564acd884b61fc5 (diff)
improved the implementation of rtree
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@10691 85f007b7-540e-0410-9357-904b9bb8a0f7
-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