box type
This commit is contained in:
parent
37dd1ee76d
commit
8a9b4c23dd
15 changed files with 256 additions and 19 deletions
|
@ -500,6 +500,10 @@ tests = "equality & subtyping" :- [
|
|||
todo "enum",
|
||||
todo "enum elim",
|
||||
|
||||
todo "box types",
|
||||
todo "boxes",
|
||||
todo "box elim",
|
||||
|
||||
"elim closure" :- [
|
||||
testEq "#0{a} = a" $
|
||||
equalE empty (CloE (BV 0) (F "a" ::: id)) (F "a"),
|
||||
|
|
|
@ -233,6 +233,14 @@ tests = "parser" :- [
|
|||
parseFails term "succ"
|
||||
],
|
||||
|
||||
"box" :- [
|
||||
parsesAs term "[1.ℕ]" $ BOX One Nat,
|
||||
parsesAs term "[ω. ℕ × ℕ]" $ BOX Any (Sig Nothing Nat Nat),
|
||||
parsesAs term "[a]" $ Box (V "a"),
|
||||
parsesAs term "[0]" $ Box (Zero :# Nat),
|
||||
parsesAs term "[1]" $ Box (Succ Zero :# Nat)
|
||||
],
|
||||
|
||||
"case" :- [
|
||||
parsesAs term
|
||||
"case1 f s return x ⇒ A x of { (l, r) ⇒ add l r }" $
|
||||
|
@ -264,7 +272,7 @@ tests = "parser" :- [
|
|||
parsesAs term "caseω n return A of { 0 ⇒ a; succ n' ⇒ b }" $
|
||||
Case Any (V "n") (Nothing, V "A") $
|
||||
CaseNat (V "a") (Just "n'", Zero, Nothing, V "b"),
|
||||
parsesAs term "caseω n return ℕ of { succ _ [1.ih] ⇒ ih; zero ⇒ 0; }" $
|
||||
parsesAs term "caseω n return ℕ of { succ _, 1.ih ⇒ ih; zero ⇒ 0; }" $
|
||||
Case Any (V "n") (Nothing, Nat) $
|
||||
CaseNat (Zero :# Nat) (Nothing, One, Just "ih", V "ih"),
|
||||
parseFails term "caseω n return A of { zero ⇒ a }",
|
||||
|
|
|
@ -390,6 +390,31 @@ tests = "typechecker" :- [
|
|||
Eq0 (Eq0 (FT "A") (FT "a") (FT "a")) (BVT 1) (BVT 0))
|
||||
],
|
||||
|
||||
"natural numbers" :- [
|
||||
testTC "0 · ℕ ⇐ ★₀" $ check_ empty szero Nat (TYPE 0),
|
||||
testTC "0 · ℕ ⇐ ★₇" $ check_ empty szero Nat (TYPE 7),
|
||||
testTCFail "1 · ℕ ⇍ ★₀" $ check_ empty sone Nat (TYPE 0),
|
||||
testTC "1 · zero ⇐ ℕ" $ check_ empty sone Zero Nat,
|
||||
testTC "1 · zero ⇍ ℕ×ℕ" $ check_ empty sone Zero (Nat `And` Nat),
|
||||
testTC "ω·n : ℕ ⊢ 1 · succ n ⇐ ℕ" $
|
||||
check_ (ctx [< ("n", Nat)]) sone (Succ (BVT 0)) Nat,
|
||||
testTC "1 · λ n ⇒ succ n ⇐ 1.ℕ → ℕ" $
|
||||
check_ empty sone ([< "n"] :\\ Succ (BVT 0)) (Arr One Nat Nat),
|
||||
todo "nat elim"
|
||||
],
|
||||
|
||||
"box types" :- [
|
||||
testTC "0 · [0.ℕ] ⇐ ★₀" $
|
||||
check_ empty szero (BOX Zero Nat) (TYPE 0),
|
||||
testTC "0 · [0.★₀] ⇐ ★₁" $
|
||||
check_ empty szero (BOX Zero (TYPE 0)) (TYPE 1),
|
||||
testTCFail "0 · [0.★₀] ⇍ ★₀" $
|
||||
check_ empty szero (BOX Zero (TYPE 0)) (TYPE 0)
|
||||
],
|
||||
|
||||
todo "box values",
|
||||
todo "box elim",
|
||||
|
||||
"misc" :- [
|
||||
note "0·A : Type, 0·P : A → Type, ω·p : (1·x : A) → P x",
|
||||
note "⊢",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue