diff options
author | Greg Brown <greg.brown01@ed.ac.uk> | 2022-11-24 13:41:18 +0000 |
---|---|---|
committer | Greg Brown <greg.brown01@ed.ac.uk> | 2022-11-24 14:09:04 +0000 |
commit | e3747417cdb6e5d24caf4af4cc18d5fd9348a103 (patch) | |
tree | ab8c6fe712682a19ec6611b37b6c9dcc5573bed3 | |
parent | 8d58e9d5377cb8821a8d6d274659b5c4cc2a2ed4 (diff) |
Prove relationship between index and tabulate.
-rw-r--r-- | src/Soat/Data/Product.idr | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Soat/Data/Product.idr b/src/Soat/Data/Product.idr index c5cebe4..e9c3d17 100644 --- a/src/Soat/Data/Product.idr +++ b/src/Soat/Data/Product.idr @@ -53,6 +53,12 @@ tabulate : {is : List a} -> ({i : a} -> Elem i is -> x i) -> x ^ is tabulate {is = []} f = [] tabulate {is = (i :: is)} f = f Here :: tabulate (f . There) +public export +indexTabulate : forall x . (0 f : {i : a} -> Elem i is -> x i) -> (elem : Elem i is) + -> index (tabulate f) elem = f elem +indexTabulate f Here = Refl +indexTabulate f (There elem) = indexTabulate (f . There) elem + -- Operations public export |