From e60054fe4dbdc26ed545c7ca6fb8ab36b244f2f7 Mon Sep 17 00:00:00 2001 From: herbelin Date: Mon, 27 Oct 2008 11:38:47 +0000 Subject: - Fixed many "Theorem with" bugs. - Fixed doc of assert as. - Doc of apply in + update credits. - Nettoyage partiel de Even.v en utilisant "Theorem with". - Added check that name is not in use for "generalize as". git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@11511 85f007b7-540e-0410-9357-904b9bb8a0f7 --- lib/util.ml | 10 ++++++++++ lib/util.mli | 5 +++++ 2 files changed, 15 insertions(+) (limited to 'lib') diff --git a/lib/util.ml b/lib/util.ml index d1e24e3216..9428aa134d 100644 --- a/lib/util.ml +++ b/lib/util.ml @@ -871,6 +871,16 @@ let list_cartesians op init ll = let list_combinations l = list_cartesians (fun x l -> x::l) [] l +(* Keep only those products that do not return None *) + +let rec list_cartesian_filter op l1 l2 = + list_map_append (fun x -> list_map_filter (op x) l2) l1 + +(* Keep only those products that do not return None *) + +let rec list_cartesians_filter op init ll = + List.fold_right (list_cartesian_filter op) ll [init] + (* Drop the last element of a list *) let rec list_drop_last = function [] -> assert false | hd :: [] -> [] | hd :: tl -> hd :: list_drop_last tl diff --git a/lib/util.mli b/lib/util.mli index 46fd7b02ed..8b27e61583 100644 --- a/lib/util.mli +++ b/lib/util.mli @@ -178,6 +178,11 @@ val list_cartesian : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list val list_cartesians : ('a -> 'b -> 'b) -> 'b -> 'a list list -> 'b list (* list_combinations [[a;b];[c;d]] returns [[a;c];[a;d];[b;c];[b;d]] *) val list_combinations : 'a list list -> 'a list list +(* Keep only those products that do not return None *) +val list_cartesian_filter : + ('a -> 'b -> 'c option) -> 'a list -> 'b list -> 'c list +val list_cartesians_filter : + ('a -> 'b -> 'b option) -> 'b -> 'a list list -> 'b list val list_union_map : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b -- cgit v1.2.3