use NContext/SnocVect for scope name lists etc
This commit is contained in:
parent
32f38238ef
commit
6dc7177be5
12 changed files with 165 additions and 134 deletions
|
@ -6,6 +6,7 @@ import public Quox.Syntax.Subst
|
|||
import public Quox.Syntax.Qty
|
||||
import public Quox.Syntax.Dim
|
||||
import public Quox.Name
|
||||
import public Quox.Context
|
||||
-- import public Quox.OPE
|
||||
|
||||
import Quox.Pretty
|
||||
|
@ -16,7 +17,6 @@ import Data.Maybe
|
|||
import Data.Nat
|
||||
import public Data.So
|
||||
import Data.String
|
||||
import Data.Vect
|
||||
import public Data.SortedMap
|
||||
import public Data.SortedSet
|
||||
|
||||
|
@ -132,7 +132,7 @@ mutual
|
|||
public export
|
||||
record Scoped (s : Nat) (f : Nat -> Type) (n : Nat) where
|
||||
constructor S
|
||||
names : Vect s BaseName
|
||||
names : NContext s
|
||||
body : ScopedBody s f n
|
||||
|
||||
public export
|
||||
|
@ -158,16 +158,16 @@ mutual
|
|||
||| scope which ignores all its binders
|
||||
public export %inline
|
||||
SN : {s : Nat} -> f n -> Scoped s f n
|
||||
SN = S (replicate s "_") . N
|
||||
SN = S (replicate s Unused) . N
|
||||
|
||||
||| scope which uses its binders
|
||||
public export %inline
|
||||
SY : Vect s BaseName -> f (s + n) -> Scoped s f n
|
||||
SY : NContext s -> f (s + n) -> Scoped s f n
|
||||
SY ns = S ns . Y
|
||||
|
||||
public export %inline
|
||||
name : Scoped 1 f n -> BaseName
|
||||
name (S [x] _) = x
|
||||
name (S [< x] _) = x
|
||||
|
||||
public export %inline
|
||||
(.name) : Scoped 1 f n -> BaseName
|
||||
|
@ -177,7 +177,7 @@ s.name = name s
|
|||
public export %inline
|
||||
Pi_ : (qty : q) -> (x : BaseName) ->
|
||||
(arg : Term q d n) -> (res : Term q d (S n)) -> Term q d n
|
||||
Pi_ {qty, x, arg, res} = Pi {qty, arg, res = S [x] $ Y res}
|
||||
Pi_ {qty, x, arg, res} = Pi {qty, arg, res = S [< x] $ Y res}
|
||||
|
||||
||| non dependent function type
|
||||
public export %inline
|
||||
|
@ -188,7 +188,7 @@ Arr {qty, arg, res} = Pi {qty, arg, res = SN res}
|
|||
public export %inline
|
||||
Sig_ : (x : BaseName) -> (fst : Term q d n) ->
|
||||
(snd : Term q d (S n)) -> Term q d n
|
||||
Sig_ {x, fst, snd} = Sig {fst, snd = S [x] $ Y snd}
|
||||
Sig_ {x, fst, snd} = Sig {fst, snd = S [< x] $ Y snd}
|
||||
|
||||
||| non dependent pair type
|
||||
public export %inline
|
||||
|
@ -199,7 +199,7 @@ And {fst, snd} = Sig {fst, snd = SN snd}
|
|||
public export %inline
|
||||
Eq_ : (i : BaseName) -> (ty : Term q (S d) n) ->
|
||||
(l, r : Term q d n) -> Term q d n
|
||||
Eq_ {i, ty, l, r} = Eq {ty = S [i] $ Y ty, l, r}
|
||||
Eq_ {i, ty, l, r} = Eq {ty = S [< i] $ Y ty, l, r}
|
||||
|
||||
||| non dependent equality type
|
||||
public export %inline
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue