51 lines
971 B
Idris
51 lines
971 B
Idris
module Value
|
|
|
|
import Term
|
|
import Misc
|
|
|
|
import Data.Vect
|
|
|
|
%default total
|
|
|
|
mutual
|
|
public export
|
|
data Value : Type where
|
|
VType : Value
|
|
|
|
VTop : Value
|
|
VStar : Value
|
|
|
|
VBot : Value
|
|
|
|
VNat : Value
|
|
VNatTr : Nat -> Value
|
|
|
|
VPair : Value -> Value -> Value
|
|
|
|
VGen : Nat -> Value
|
|
VApp : Value -> Value -> Value
|
|
VClos : Ctx n -> Term n -> Value
|
|
|
|
infixl 2 `VApp`
|
|
|
|
public export
|
|
Ctx : Index -> Type
|
|
Ctx i = Vect i Value
|
|
|
|
public export
|
|
ctx0 : Ctx 0
|
|
ctx0 = []
|
|
|
|
public export
|
|
Show Value where
|
|
show VType = "VType"
|
|
show VTop = "VTop"
|
|
show VStar = "VStar"
|
|
show VBot = "VBot"
|
|
show VNat = "VNat"
|
|
show (VPair a b) = "VPair (" ++ show a ++ ") (" ++ show b ++ ")"
|
|
show (VNatTr n) = "V" ++ show n
|
|
show (VGen i) = "VGen " ++ show i
|
|
show (VApp f x) = "VApp (" ++ show f ++ ") (" ++ show x ++ ")"
|
|
show (VClos e t) = "VClos (" ++ assert_total (show e) ++ ") (" ++ show t ++ ")"
|