fix equality types
This commit is contained in:
parent
15f6f4c8a4
commit
924fd991f9
2 changed files with 23 additions and 2 deletions
|
@ -257,9 +257,9 @@ parameters {auto _ : IsQty q}
|
||||||
Y t' => checkTypeC (extendDim t.name ctx) t' u
|
Y t' => checkTypeC (extendDim t.name ctx) t' u
|
||||||
N t' => checkTypeC ctx t' u
|
N t' => checkTypeC ctx t' u
|
||||||
-- if Ψ | Γ ⊢₀ l ⇐ A‹0›
|
-- if Ψ | Γ ⊢₀ l ⇐ A‹0›
|
||||||
check0 ctx t.zero l
|
check0 ctx l t.zero
|
||||||
-- if Ψ | Γ ⊢₀ r ⇐ A‹1›
|
-- if Ψ | Γ ⊢₀ r ⇐ A‹1›
|
||||||
check0 ctx t.one r
|
check0 ctx r t.one
|
||||||
-- then Ψ | Γ ⊢₀ Eq [i ⇒ A] l r ⇐ Type ℓ
|
-- then Ψ | Γ ⊢₀ Eq [i ⇒ A] l r ⇐ Type ℓ
|
||||||
|
|
||||||
checkType' ctx t@(DLam {}) u =
|
checkType' ctx t@(DLam {}) u =
|
||||||
|
|
|
@ -370,6 +370,27 @@ tests = "typechecker" :- [
|
||||||
singleton "ff" (Tag "tt"))
|
singleton "ff" (Tag "tt"))
|
||||||
],
|
],
|
||||||
|
|
||||||
|
"equality types" :- [
|
||||||
|
testTC "0 · ℕ = ℕ : ★₀ ⇐ ★₁" $
|
||||||
|
check_ empty szero (Eq0 (TYPE 0) Nat Nat) (TYPE 1),
|
||||||
|
testTC "0 · ℕ = ℕ : ★₀ ⇐ ★₂" $
|
||||||
|
check_ empty szero (Eq0 (TYPE 0) Nat Nat) (TYPE 2),
|
||||||
|
testTC "0 · ℕ = ℕ : ★₁ ⇐ ★₂" $
|
||||||
|
check_ empty szero (Eq0 (TYPE 1) Nat Nat) (TYPE 2),
|
||||||
|
testTCFail "0 · ℕ = ℕ : ★₁ ⇍ ★₁" $
|
||||||
|
check_ empty szero (Eq0 (TYPE 1) Nat Nat) (TYPE 1),
|
||||||
|
testTC "ab : A ≡ B : ★₀, x : A, y : B ⊢ Eq [i ⇒ ab i] x y ⇐ ★₀" $
|
||||||
|
check_ (ctx [< ("ab", Eq0 (TYPE 0) (FT "A") (FT "B")),
|
||||||
|
("x", FT "A"), ("y", FT "B")]) szero
|
||||||
|
(Eq (SY [< "i"] $ E $ BV 2 :% BV 0) (BVT 1) (BVT 0))
|
||||||
|
(TYPE 0),
|
||||||
|
testTCFail "ab : A ≡ B : ★₀, x : A, y : B ⊢ Eq [i ⇒ ab i] y x ⇍ ★₀" $
|
||||||
|
check_ (ctx [< ("ab", Eq0 (TYPE 0) (FT "A") (FT "B")),
|
||||||
|
("x", FT "A"), ("y", FT "B")]) szero
|
||||||
|
(Eq (SY [< "i"] $ E $ BV 2 :% BV 0) (BVT 0) (BVT 1))
|
||||||
|
(TYPE 0)
|
||||||
|
],
|
||||||
|
|
||||||
"equalities" :- [
|
"equalities" :- [
|
||||||
testTC "1 · (δ i ⇒ a) ⇐ a ≡ a" $
|
testTC "1 · (δ i ⇒ a) ⇐ a ≡ a" $
|
||||||
check_ empty sone (DLam $ SN $ FT "a")
|
check_ empty sone (DLam $ SN $ FT "a")
|
||||||
|
|
Loading…
Reference in a new issue