add local bindings to context

- without this, inside the body of `let x = e in …`, the typechecker
  would forget that `x = e`
- now bound variables can reduce, if they have a definition, so RedexTest
  needs to take the context too
This commit is contained in:
rhiannon morris 2023-12-07 01:35:39 +01:00
parent cdf1ec6deb
commit 03c197bd04
13 changed files with 300 additions and 211 deletions

View file

@ -24,13 +24,17 @@ anys : {n : Nat} -> QContext n
anys {n = 0} = [<]
anys {n = S n} = anys :< Any
public export
locals : Context (Term d) n -> Context (LocalVar d) n
locals = map $ \t => MkLocal t Nothing
public export
ctx, ctx01 : {n : Nat} -> Context (\n => (BindName, Term 0 n)) n ->
TyContext 0 n
ctx tel = let (ns, ts) = unzip tel in
MkTyContext new [<] ts ns anys
MkTyContext new [<] (locals ts) ns anys
ctx01 tel = let (ns, ts) = unzip tel in
MkTyContext ZeroIsOne [<] ts ns anys
MkTyContext ZeroIsOne [<] (locals ts) ns anys
export
mkDef : GQty -> Term 0 0 -> Term 0 0 -> Definition

View file

@ -33,7 +33,7 @@ parameters {0 isRedex : RedexTest tm} {auto _ : CanWhnf tm isRedex} {d, n : Nat}
private
ctx : {n : Nat} -> Context (\n => (BindName, Term 0 n)) n -> WhnfContext 0 n
ctx xs = let (ns, ts) = unzip xs in MkWhnfContext [<] ns ts
ctx xs = let (ns, ts) = unzip xs in MkWhnfContext [<] ns (locals ts)
export