View difference between Paste ID: cVXLmbzD and kthpU2c0
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
  ||| @n total number of vars
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 : (ctx : ANTContext) -> Fin n -> Expr ctx
15
  getExpr (AddVar c e) 0 = e
16
  getExpr (AddVar c e) (S n) = getExpr c n
17
18
  betaEq : Expr ctx -> Expr ctx -> Type
19
  betaEq = ?x
20
21
  ||| This represents when a context implies something. It is laid out
22
  ||| as the basic rules of the type theory system
23
  ||| Taken from https://eb.host.cs.st-andrews.ac.uk/drafts/impldtp.pdf page 11
24
  data Expr : ANTContext -> Type where
25
    |||     G |- f : (x : S) -> T   G |- s : S
26
    ||| App ----------------------------------
27
    |||     G |- f s : T[s/x]
28
    App : (ctx : ANTContext {n})
29
      -> (fInd : Fin n)
30
      -> (sInd : Fin n)
31
      -> ?betaEq (getExpr ctx fInd) (getExpr ctx sInd)
32
      -> Expr ctx
33
    |||     G;\x:S |- e : T   G |- (x : S) -> T : Type(n)
34
    ||| Lam ---------------------------------------------
35
    |||     G |- \x:S.e : (x : S) -> T
36
    ||| Given a context, an arg type within that context, and an expression
37
    ||| that uses that var, returns a Lam (variable name not specified
38
    ||| since we are using DeBrujin indexes)
39
    Lam : (ctx : ANTContext) -> (argType : Expr ctx)
40
      -> Expr (AddVar ctx argType) -> Expr ctx