diff options
author | Greg Brown <greg.brown01@ed.ac.uk> | 2022-11-25 15:30:18 +0000 |
---|---|---|
committer | Greg Brown <greg.brown01@ed.ac.uk> | 2022-11-25 15:30:18 +0000 |
commit | a7d205c7d156c81efb3590f30dce62939a9dd088 (patch) | |
tree | 87401453fbf489d332a66d834f18446650124013 /src/Soat | |
parent | d55bab90ca4455dbd9406a1ca7dd4d74d1a39a36 (diff) |
Prove curry and uncurry form an isomorphism.
Diffstat (limited to 'src/Soat')
-rw-r--r-- | src/Soat/Data/Sublist.idr | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Soat/Data/Sublist.idr b/src/Soat/Data/Sublist.idr index 82637ee..98e3c14 100644 --- a/src/Soat/Data/Sublist.idr +++ b/src/Soat/Data/Sublist.idr @@ -24,6 +24,17 @@ uncurry {xs = []} f = [] uncurry {xs = (x :: xs)} f = f Here :: uncurry (f . There) public export +uncurryCurry : (f : xs `Sublist` ys) -> uncurry (curry f) = f +uncurryCurry [] = Refl +uncurryCurry (mem :: mems) = cong ((::) mem) (uncurryCurry mems) + +public export +curryUncurry : (0 f : forall x . Elem x xs -> Elem x ys) -> (i : Elem x xs) + -> curry (uncurry f) i = f i +curryUncurry f Here = Refl +curryUncurry f (There elem) = curryUncurry (f . There) elem + +public export Reflexive (List a) Sublist where reflexive = uncurry id |