aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2008-06-08 16:13:37 +0000
committerGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2008-06-08 16:13:37 +0000
commit47e5f716f7ded0eec43b00d49955d56c370c3596 (patch)
treee7fbe16925eacc72bdd9ebeb65c2a20b8bb0eef0 /lib
parent70f8c345685278a567fbb075f222c79f0533e90e (diff)
- Extension de "generalize" en "generalize c as id at occs".
- Ajout clause "in" à "remember" (et passage du code en ML). - Ajout clause "in" à "induction"/"destruct" qui, en ce cas, ajoute aussi une égalité pour se souvenir du terme sur lequel l'induction ou l'analyse de cas s'applique. - Ajout "pose t as id" en standard (Matthieu: j'ai enlevé celui de Programs qui avait la sémantique de "pose proof" tandis que le nouveau a la même sémantique que "pose (id:=t)"). - Un peu de réorganisation, uniformisation de noms dans Arith, et ajout EqNat dans Arith. - Documentation tactiques et notations de tactiques. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@11072 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib')
-rw-r--r--lib/util.ml13
-rw-r--r--lib/util.mli7
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/util.ml b/lib/util.ml
index 5a5905859..4089dc03d 100644
--- a/lib/util.ml
+++ b/lib/util.ml
@@ -42,6 +42,11 @@ let located_iter2 f (_,a) (_,b) = f a b
exception Error_in_file of string * (bool * string * loc) * exn
+(* Mapping under pairs *)
+
+let on_fst f (a,b) = (f a,b)
+let on_snd f (a,b) = (a,f b)
+
(* Projections from triplets *)
let pi1 (a,_,_) = a
@@ -552,6 +557,13 @@ let list_unique_index x =
| [] -> raise Not_found
in index_x 1
+let list_fold_right_i f i l =
+ let rec it_list_f i l a = match l with
+ | [] -> a
+ | b::l -> f (i-1) b (it_list_f (i-1) l a)
+ in
+ it_list_f (List.length l + i) l
+
let list_fold_left_i f =
let rec it_list_f i a = function
| [] -> a
@@ -1169,6 +1181,7 @@ let pr_semicolon () = str ";" ++ spc ()
let pr_bar () = str "|" ++ spc ()
let pr_arg pr x = spc () ++ pr x
let pr_opt pr = function None -> mt () | Some x -> pr_arg pr x
+let pr_opt_no_spc pr = function None -> mt () | Some x -> pr x
let nth n = str (ordinal n)
diff --git a/lib/util.mli b/lib/util.mli
index e715feca3..bc1a9cc26 100644
--- a/lib/util.mli
+++ b/lib/util.mli
@@ -52,6 +52,11 @@ val located_iter2 : ('a -> 'b -> unit) -> 'a located -> 'b located -> unit
exception Error_in_file of string * (bool * string * loc) * exn
+(* Mapping under pairs *)
+
+val on_fst : ('a -> 'b) -> 'a * 'c -> 'b * 'c
+val on_snd : ('a -> 'b) -> 'c * 'a -> 'c * 'b
+
(*s Projections from triplets *)
val pi1 : 'a * 'b * 'c -> 'a
@@ -121,6 +126,7 @@ val list_unique_index : 'a -> 'a list -> int
val list_index0 : 'a -> 'a list -> int
val list_iter3 : ('a -> 'b -> 'c -> unit) -> 'a list -> 'b list -> 'c list -> unit
val list_iter_i : (int -> 'a -> unit) -> 'a list -> unit
+val list_fold_right_i : (int -> 'a -> 'b -> 'b) -> int -> 'a list -> 'b -> 'b
val list_fold_left_i : (int -> 'a -> 'b -> 'a) -> int -> 'a -> 'b list -> 'a
val list_fold_right_and_left :
('a -> 'b -> 'b list -> 'a) -> 'b list -> 'a -> 'a
@@ -257,6 +263,7 @@ val pr_semicolon : unit -> std_ppcmds
val pr_bar : unit -> std_ppcmds
val pr_arg : ('a -> std_ppcmds) -> 'a -> std_ppcmds
val pr_opt : ('a -> std_ppcmds) -> 'a option -> std_ppcmds
+val pr_opt_no_spc : ('a -> std_ppcmds) -> 'a option -> std_ppcmds
val nth : int -> std_ppcmds
val prlist : ('a -> std_ppcmds) -> 'a list -> std_ppcmds