aboutsummaryrefslogtreecommitdiff
path: root/src/Util/HList.v
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2016-11-08 15:21:32 -0500
committerGravatar Jason Gross <jgross@mit.edu>2016-11-08 15:21:40 -0500
commit25bee1e1ea359593fcd3a75b044f3fb66ae85b00 (patch)
treec2291a0bf338bdec780d297ed48e827c49276b99 /src/Util/HList.v
parentc6ee53d51b832d22e86773bc9fd096b5f755e6f5 (diff)
Add hlist_map
Diffstat (limited to 'src/Util/HList.v')
-rw-r--r--src/Util/HList.v12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Util/HList.v b/src/Util/HList.v
index aacefe8f3..ec9dcdd7b 100644
--- a/src/Util/HList.v
+++ b/src/Util/HList.v
@@ -88,6 +88,18 @@ Proof.
destruct n; [ constructor | apply hlist'_impl ].
Defined.
+Local Arguments Tuple.map : simpl never.
+Lemma hlist_map {n A B F} {f:A -> B} (xs:tuple A n)
+ : hlist F (Tuple.map f xs) = hlist (fun x => F (f x)) xs.
+Proof.
+ destruct n as [|n]; [ reflexivity | ].
+ induction n; [ reflexivity | ].
+ specialize (IHn (fst xs)).
+ destruct xs; rewrite Tuple.map_S.
+ simpl @hlist in *; rewrite <- IHn.
+ reflexivity.
+Qed.
+
Module Tuple.
Lemma map_id_ext {n A} (f : A -> A) (xs:tuple A n)
: hlist (fun x => f x = x) xs -> Tuple.map f xs = xs.