represent ℕ constants directly
instead of as huge `succ (succ (succ ⋯))` terms
This commit is contained in:
parent
fa7f82ae5a
commit
0514fff481
18 changed files with 104 additions and 115 deletions
|
@ -486,11 +486,11 @@ tests = "equality & subtyping" :- [
|
|||
testEq "caseω 4 return ℕ of {0 ⇒ 0; succ n ⇒ n} = 3" $
|
||||
equalT empty
|
||||
(^NAT)
|
||||
(E $ ^CaseNat Any Zero (^Ann (^makeNat 4) (^NAT))
|
||||
(E $ ^CaseNat Any Zero (^Ann (^Nat 4) (^NAT))
|
||||
(SN $ ^NAT)
|
||||
(^Zero)
|
||||
(SY [< "n", ^BN Unused] $ ^BVT 1))
|
||||
(^makeNat 3)
|
||||
(^Nat 3)
|
||||
],
|
||||
|
||||
todo "pair types",
|
||||
|
|
|
@ -284,12 +284,10 @@ tests = "parser" :- [
|
|||
"naturals" :- [
|
||||
parseMatch term "ℕ" `(NAT _),
|
||||
parseMatch term "Nat" `(NAT _),
|
||||
parseMatch term "zero" `(Zero _),
|
||||
parseMatch term "zero" `(Nat 0 _),
|
||||
parseMatch term "succ n" `(Succ (V "n" {}) _),
|
||||
parseMatch term "3"
|
||||
`(Succ (Succ (Succ (Zero _) _) _) _),
|
||||
parseMatch term "succ (succ 1)"
|
||||
`(Succ (Succ (Succ (Zero _) _) _) _),
|
||||
parseMatch term "3" `(Nat 3 _),
|
||||
parseMatch term "succ (succ 1)" `(Succ (Succ (Nat 1 _) _) _),
|
||||
parseFails term "succ succ 5",
|
||||
parseFails term "succ"
|
||||
],
|
||||
|
@ -299,12 +297,9 @@ tests = "parser" :- [
|
|||
`(BOX (PQ One _) (NAT _) _),
|
||||
parseMatch term "[ω. ℕ × ℕ]"
|
||||
`(BOX (PQ Any _) (Sig (Unused _) (NAT _) (NAT _) _) _),
|
||||
parseMatch term "[a]"
|
||||
`(Box (V "a" {}) _),
|
||||
parseMatch term "[0]"
|
||||
`(Box (Zero _) _),
|
||||
parseMatch term "[1]"
|
||||
`(Box (Succ (Zero _) _) _)
|
||||
parseMatch term "[a]" `(Box (V "a" {}) _),
|
||||
parseMatch term "[0]" `(Box (Nat 0 _) _),
|
||||
parseMatch term "[1]" `(Box (Nat 1 _) _)
|
||||
],
|
||||
|
||||
"coe" :- [
|
||||
|
@ -389,13 +384,13 @@ tests = "parser" :- [
|
|||
(CaseNat (V "a" {}) (PV "n'" _, PQ Zero _, Unused _, V "b" {}) _) _),
|
||||
parseMatch term "caseω n return ℕ of { succ _, 1.ih ⇒ ih; zero ⇒ 0; }"
|
||||
`(Case (PQ Any _) (V "n" {}) (Unused _, NAT _)
|
||||
(CaseNat (Zero _) (Unused _, PQ One _, PV "ih" _, V "ih" {}) _) _),
|
||||
(CaseNat (Nat 0 _) (Unused _, PQ One _, PV "ih" _, V "ih" {}) _) _),
|
||||
parseMatch term "caseω n return ℕ of { succ _, ω.ih ⇒ ih; zero ⇒ 0; }"
|
||||
`(Case (PQ Any _) (V "n" {}) (Unused _, NAT _)
|
||||
(CaseNat (Zero _) (Unused _, PQ Any _, PV "ih" _, V "ih" {}) _) _),
|
||||
(CaseNat (Nat 0 _) (Unused _, PQ Any _, PV "ih" _, V "ih" {}) _) _),
|
||||
parseMatch term "caseω n return ℕ of { succ _, ih ⇒ ih; zero ⇒ 0; }"
|
||||
`(Case (PQ Any _) (V "n" {}) (Unused _, NAT _)
|
||||
(CaseNat (Zero _) (Unused _, PQ One _, PV "ih" _, V "ih" {}) _) _),
|
||||
(CaseNat (Nat 0 _) (Unused _, PQ One _, PV "ih" _, V "ih" {}) _) _),
|
||||
parseFails term "caseω n return A of { zero ⇒ a }",
|
||||
parseFails term "caseω n return ℕ of { succ ⇒ 5 }"
|
||||
],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue