To run: ghc --make Main && ./Main.
Depending on the λ-term used, this will output either an error or <term> :: <type> if type-checking passed.
Example execution:
>> Typechecking term @e@ against type @τ@ where
e ≡ ((), ())
τ ≡ (x :^1 𝟏) ⊗ 𝟏
>> Success!
((), ())
:: (x :^1 𝟏) ⊗ 𝟏
This supports the following types:
-
Π(x :ⁱ A). Bis the quantitative dependent function type whose domain isA(with usagei) and codomain isB. -
∀(x : A). Bis the same asΠ(x :⁰ A). B. -
(x : A) ⊸ Bis the same asΠ(x :¹ A). B. -
(x :ⁱ A) ⊗ Bis the quantitative multiplicative dependent pair type. -
Uis the type of universes of types. We haveU :⁰ Uin order to simplify the type system studied here. -
𝟏is the multiplicative unit type. -
ℕis the type of natural numbers. and expressions: -
λ(x :ⁱ A). Bis a function taking anxof typeAand returningBwhich consumesxitimes. -
(a, b)is the constructor of the quantitative multiplicative dependent pair type. -
()is the constructor for the multiplicative unit type. -
f xis the application of the argumentxto the functionf. -
xis a simple variable. -
let () as z = a in bis the general destructor of the multiplication unit type, whereashould result in()andbis the return value of the expression. -
let x :ⁱ A = e₁ in e₂locally binds the variablexwith usageiand valuee₁for use withine₂. -
ndenotes a simple naturel number (unsigned integer).