summaryrefslogtreecommitdiff
path: root/src/Data/Fin
diff options
context:
space:
mode:
authorGreg Brown <greg.brown01@ed.ac.uk>2023-07-10 13:37:56 +0100
committerGreg Brown <greg.brown01@ed.ac.uk>2023-07-10 13:37:56 +0100
commitce546fe96974cb7aa3b09c729f33ac6ba5169299 (patch)
treed58a1a217c54ae07aefb1f6b5c886e64c6b051db /src/Data/Fin
parent849b99d0a51674a15acfdfe4b6f6606491b20166 (diff)
Describe unification.
Diffstat (limited to 'src/Data/Fin')
-rw-r--r--src/Data/Fin/Occurs.idr11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Data/Fin/Occurs.idr b/src/Data/Fin/Occurs.idr
index 58c8faa..d70c8f3 100644
--- a/src/Data/Fin/Occurs.idr
+++ b/src/Data/Fin/Occurs.idr
@@ -101,3 +101,14 @@ thickJust (FS x) (FS y) prf =
let 0 z = mapJustInverse suc (thick x y) prf in
rewrite snd $ z.snd in
trans (thinSucSuc x z.fst) (cong FS $ thickJust x y (fst $ z.snd))
+
+export
+thickThin : (x : Fin n) -> (y : Fin (pred n)) -> thick x (thin x y) = Just y
+thickThin x y =
+ let neq = thinSkips x y in
+ let isJust = thickNeq x (thin x y) (\prf => neq $ sym prf) in
+ let zPrf = extractIsJust isJust in
+ let z = zPrf.fst in
+ let 0 prf1 = zPrf.snd in
+ let 0 prf2 = thickJust x (thin x y) prf1 in
+ trans prf1 (cong Just $ thinInjective x prf2)