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). B
is the quantitative dependent function type whose domain isA
(with usagei
) and codomain isB
. -
∀(x : A). B
is the same asΠ(x :⁰ A). B
. -
(x : A) ⊸ B
is the same asΠ(x :¹ A). B
. -
(x :ⁱ A) ⊗ B
is the quantitative multiplicative dependent pair type. -
U
is the type of universes of types. We haveU :⁰ U
in order to simplify the type system studied here. -
𝟏
is the multiplicative unit type. -
ℕ
is the type of natural numbers. and expressions: -
λ(x :ⁱ A). B
is a function taking anx
of typeA
and returningB
which consumesx
i
times. -
(a, b)
is the constructor of the quantitative multiplicative dependent pair type. -
()
is the constructor for the multiplicative unit type. -
f x
is the application of the argumentx
to the functionf
. -
x
is a simple variable. -
let () as z = a in b
is the general destructor of the multiplication unit type, wherea
should result in()
andb
is the return value of the expression. -
let x :ⁱ A = e₁ in e₂
locally binds the variablex
with usagei
and valuee₁
for use withine₂
. -
n
denotes a simple naturel number (unsigned integer).