Should parse:
x
Should parse:
\x : Nat. x
Should parse:
f a
Should parse:
f a b
Should parse:
f (a b)
Should parse:
(f a) b
Should parse:
let a = 1 in a
Should parse:
fix (\x : Nat -> Nat. 1)
Should parse:
true
Should parse:
false
Should parse:
if true then 1 else 0
Should parse:
1
Should parse:
\x : Bool. x
Should parse:
\x : Bool -> Bool. x
Should parse:
\x : Bool -> Bool -> Bool. x
Should parse:
\x : Bool -> (Bool -> Bool). x
Should parse:
\x : (Bool -> Bool) -> Bool. x
Should parse:
f a
b
c
Should not parse:
!
Should typecheck:
true
Should typecheck:
1
Should typecheck:
is-zero 1
Should not typecheck:
is-zero true
Should typecheck:
(\x : Nat. x)
Should not typecheck:
a
Should not typecheck:
0 1
Should not typecheck:
(\x : Nat. x) true
Should not typecheck:
if 1 then true else false
Should not typecheck:
if true then 1 else false
Should typecheck:
fix (\x : Nat. 1)
Should not typecheck:
fix 1
Should not typecheck:
fix (\x : Nat -> Nat. 1)
Expected:
\x : Nat. x
Expected:
(\x : Nat. x) 1
Expected: 1
let a = 1 in a
Expected: 1
if true then 1 else 0
Expected: 1
suc 0
Expected: 0
pred 1
Expected: 0
pred 0
Expected: true
is-zero 0
Expected: 1
fix (\x : Nat. 1)
Expected: 0
fix (\rec : Nat -> Nat. \x : Nat. if is-zero x then 0 else rec (pred x)) 2
Expected: 7
let
add =
fix
(\recurse : Nat -> Nat -> Nat.
\x : Nat. \y : Nat.
if is-zero x
then
y
else
recurse (pred x) (suc y))
in
add 3 4