aboutsummaryrefslogtreecommitdiffhomepage
path: root/theories/Lists
diff options
context:
space:
mode:
authorGravatar Nickolai Zeldovich <nickolai@csail.mit.edu>2014-11-09 11:55:00 -0500
committerGravatar Pierre Letouzey <pierre.letouzey@inria.fr>2015-04-09 12:33:51 +0200
commit30446765297d79767b68e4a5f5b9160171b63b72 (patch)
tree56b998c575dc3ea72171b93652b718a4b4e00500 /theories/Lists
parent1688d4af1896effb42fa5dd191948795c59288a4 (diff)
Add a [map_ext_in] lemma to List.v.
Slightly broader version of the existing [map_ext]: two [map] expressions are equal if their respective functions agree on all arguments that are in the list being mapped.
Diffstat (limited to 'theories/Lists')
-rw-r--r--theories/Lists/List.v7
1 files changed, 7 insertions, 0 deletions
diff --git a/theories/Lists/List.v b/theories/Lists/List.v
index 3cba090f3..00406f57d 100644
--- a/theories/Lists/List.v
+++ b/theories/Lists/List.v
@@ -1021,6 +1021,13 @@ Proof.
rewrite H; rewrite IHl; auto.
Qed.
+Lemma map_ext_in :
+ forall (A B : Type)(f g:A->B) l, (forall a, In a l -> f a = g a) -> map f l = map g l.
+Proof.
+ induction l; simpl; auto.
+ intros; rewrite H by intuition; rewrite IHl; auto.
+Qed.
+
(************************************)
(** Left-to-right iterator on lists *)