diff options
author | Chloe Brown <chloe.brown.00@outlook.com> | 2023-04-06 16:41:11 +0100 |
---|---|---|
committer | Chloe Brown <chloe.brown.00@outlook.com> | 2023-04-06 16:41:11 +0100 |
commit | fce659187d9e24e29ae23f7d8de078dcdc9dcfd4 (patch) | |
tree | 4db6754bf4c28575ca1a4dc234e56b8fd3e178b4 /src/Core/Term.idr | |
parent | 3c818e967c1a161fd424a3286b4b619176495e3d (diff) |
Define Thinned terms.
This is to unify parts of Environment and Substition.
Diffstat (limited to 'src/Core/Term.idr')
-rw-r--r-- | src/Core/Term.idr | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/Core/Term.idr b/src/Core/Term.idr index 28e229d..e52545d 100644 --- a/src/Core/Term.idr +++ b/src/Core/Term.idr @@ -6,6 +6,8 @@ import Core.Thinning import Syntax.PreorderReasoning +%prefix_record_projections off + -- Definition ------------------------------------------------------------------ public export @@ -53,3 +55,29 @@ wknHomo (Abs n t) thin1 thin2 = ~~ wkn t (keep thin2 n . keep thin1 n) ...(wknHomo t (keep thin1 n) (keep thin2 n)) ~~ wkn t (keep (thin2 . thin1) n) ...(cong (wkn t) $ compKeep thin2 thin1 n) wknHomo (App t u) thin1 thin2 = cong2 App (wknHomo t thin1 thin2) (wknHomo u thin1 thin2) + +-- Thinned Terms --------------------------------------------------------------- + +public export +record Thinned (sx : Context) where + constructor Over + {0 sy : Context} + term : Term sy + thin : sy `Thins` sx + +%name Thinned t, u, v + +public export +expand : Thinned sx -> Term sx +expand (term `Over` thin) = wkn term thin + +public export +shift : Thinned sx -> sx `Thins` sy -> Thinned sy +shift (term `Over` thin') thin = term `Over` thin . thin' + +export +expandShift : + (t : Thinned sx) -> + (thin : sx `Thins` sy) -> + expand (shift t thin) = wkn (expand t) thin +expandShift (term `Over` thin') thin = sym $ wknHomo term thin' thin |