ScopeTerms that can bind multiple vars

This commit is contained in:
rhiannon morris 2023-01-23 03:22:50 +01:00
parent 92617a2e4a
commit f0f49d9abf
5 changed files with 86 additions and 48 deletions

View file

@ -5,6 +5,7 @@ import Quox.Syntax.Var
import Quox.Name
import Quox.Pretty
import Data.Nat
import Data.List
%default total
@ -84,6 +85,16 @@ public export %inline
push : CanSubst1 f => Subst f from to -> Subst f (S from) (S to)
push th = fromVar VZ ::: (th . shift 1)
-- [fixme] a better way to do this?
public export
pushN : CanSubst1 f => (s : Nat) ->
Subst f from to -> Subst f (s + from) (s + to)
pushN 0 th = th
pushN (S s) th =
rewrite plusSuccRightSucc s from in
rewrite plusSuccRightSucc s to in
pushN s $ fromVar VZ ::: (th . shift 1)
public export
drop1 : Subst f (S from) to -> Subst f from to
drop1 (Shift by) = Shift $ ssDown by