View difference between Paste ID: 074JTKEp and aJeFkfX9
SHOW: | | - or go back to the newest paste.
1
import Data.Vect
2
 
3
||| Constant Types
4
data ANTConst = I Int | BI Integer | Fl Double | Ch Char | Str String
5
 
6
  ||| Context
7-
mutual
7+
8
  data ANTContext : {n : Nat} -> Type
9
  data Expr : ANTContext -> Type
10
11
  data ANTContext : {n : Nat} -> Type where
12
    AddVar : (ctx : ANTContext {n}) -> Expr ctx -> ANTContext {n=(S n)}
13
14
  getExpr : ANTContext -> Fin n -> Expr ctx
15
  getExpr ctx n = ?getExpr_rhs
16
17
  betaEq : Expr ctx -> Expr ctx -> Type
18
  betaEq = ?x
19
20
  ||| This represents when a context implies something. It is laid out
21
  ||| as the basic rules of the type theory system
22
  ||| Taken from https://eb.host.cs.st-andrews.ac.uk/drafts/impldtp.pdf page 11
23
  data Expr : ANTContext -> Type where
24
    |||     G |- f : (x : S) -> T   G |- s : S
25
    ||| App ----------------------------------
26
    |||     G |- f s : T[s/x]
27
    App : (ctx : ANTContext {n})
28
      -> (fInd : Fin n)
29
      -> (sInd : Fin n)
30
      -> ?betaEq (getExpr ctx fInd) (getExpr ctx sInd)
31
      -> Expr ctx
32
    |||     G;\x:S |- e : T   G |- (x : S) -> T : Type(n)
33
    ||| Lam ---------------------------------------------
34
    |||     G |- \x:S.e : (x : S) -> T
35
    ||| Given a context, an arg type within that context, and an expression
36
    ||| that uses that var, returns a Lam (variable name not specified
37
    ||| since we are using DeBrujin indexes)
38
    Lam : (ctx : ANTContext) -> (argType : Expr ctx)
39
      -> Expr (AddVar ctx argType) -> Expr ctx