summaryrefslogtreecommitdiff
path: root/src/Core/Thinning.idr
diff options
context:
space:
mode:
authorChloe Brown <chloe.brown.00@outlook.com>2023-04-15 16:16:35 +0100
committerChloe Brown <chloe.brown.00@outlook.com>2023-04-15 16:16:35 +0100
commit5f83999f483e241158706522a35364ba32f7f203 (patch)
tree539d16ca0ed14ecfe1d495ec2deeaaf8f284501c /src/Core/Thinning.idr
parented9beabb1e5f867bad0c0693f36cd0ffc0d5d96c (diff)
Define Term substitution.
Diffstat (limited to 'src/Core/Thinning.idr')
-rw-r--r--src/Core/Thinning.idr15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Core/Thinning.idr b/src/Core/Thinning.idr
index dc4efcb..a2500e9 100644
--- a/src/Core/Thinning.idr
+++ b/src/Core/Thinning.idr
@@ -68,3 +68,18 @@ export
wkn : Fin m -> m `Thins` n -> Fin n
wkn i IsId = i
wkn i (IsThinner thin) = wkn' i thin
+
+-- Composition -----------------------------------------------------------------
+
+comp : Thinner m n -> Thinner k m -> Thinner k n
+comp IsBase thin2 = IsDrop thin2
+comp (IsDrop thin1) thin2 = IsDrop (comp thin1 thin2)
+comp (IsKeep thin1) IsBase = IsDrop thin1
+comp (IsKeep thin1) (IsDrop thin2) = IsDrop (comp thin1 thin2)
+comp (IsKeep thin1) (IsKeep thin2) = IsKeep (comp thin1 thin2)
+
+export
+(.) : m `Thins` n -> k `Thins` m -> k `Thins` n
+IsId . thin2 = thin2
+IsThinner thin1 . IsId = IsThinner thin1
+IsThinner thin1 . IsThinner thin2 = IsThinner (comp thin1 thin2)