Advertisement
Guest User

Untitled

a guest
Oct 16th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. import Data.Vect
  3.  
  4. ||| Constant Types
  5. data ANTConst = I Int | BI Integer | Fl Double | Ch Char | Str String
  6.  
  7. mutual
  8. ||| Context
  9. ||| @n total number of vars
  10. data ANTContext : {n : Nat} -> Type where
  11. AddVar : (ctx : ANTContext {n}) -> Expr ctx -> ANTContext {n=(S n)}
  12.  
  13. data Expr : ANTContext -> Type
  14.  
  15. getExpr : ANTContext -> Fin n -> Expr ctx
  16. getExpr ctx n = ?getExpr_rhs
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement