aboutsummaryrefslogtreecommitdiff
path: root/src/Util/Tuple.v
diff options
context:
space:
mode:
authorGravatar Jason Gross <jgross@mit.edu>2017-04-01 17:58:03 -0400
committerGravatar Jason Gross <jgross@mit.edu>2017-04-01 17:58:13 -0400
commitdfb7398c3d674ef9762b6d9a9d47029a8d66167c (patch)
tree61f42227a9d9aea6d14d97e594fba5b5e8781560 /src/Util/Tuple.v
parentb1a3c63c77cd0be5679ce0e949863325a6348e7b (diff)
Add Tuple.eta
Diffstat (limited to 'src/Util/Tuple.v')
-rw-r--r--src/Util/Tuple.v15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Util/Tuple.v b/src/Util/Tuple.v
index cdae79191..2b049d86e 100644
--- a/src/Util/Tuple.v
+++ b/src/Util/Tuple.v
@@ -208,6 +208,21 @@ Fixpoint curry {R T n} : curryT R T n -> (tuple T n -> R)
| S n' => @curry' R T n'
end.
+Fixpoint eta' {n A B} : (tuple' A n -> B) -> tuple' A n -> B
+ := match n with
+ | 0 => fun f => f
+ | S n' => fun (f : tuple' A n' * A -> B)
+ (xy : tuple' A n' * A)
+ => let '(x, y) := xy in
+ eta' (fun x => f (x, y)) x
+ end.
+
+Definition eta {n A B} : (tuple A n -> B) -> tuple A n -> B
+ := match n with
+ | 0 => fun f => f
+ | S n' => @eta' n' A B
+ end.
+
Definition on_tuple {A B} (f:list A -> list B)
{n m:nat} (H:forall xs, length xs = n -> length (f xs) = m)
(xs:tuple A n) : tuple B m :=