Tests reveal type-safety is broken for elim
This commit is contained in:
parent
d82727a3fb
commit
bd795ba0ea
|
@ -186,7 +186,8 @@
|
||||||
|
|
||||||
(module+ test
|
(module+ test
|
||||||
;; TODO: Rename these signatures, and use them in all future tests.
|
;; TODO: Rename these signatures, and use them in all future tests.
|
||||||
(define Σ (term (∅ (nat : (Unv 0) ((zero : nat) (s : (Π (x : nat) nat)))))))
|
(define Σ (term ((∅ (nat : (Unv 0) ((zero : nat) (s : (Π (x : nat) nat)))))
|
||||||
|
(bool : (Unv 0) ((true : bool) (false : bool))))))
|
||||||
(define Σ0 (term ∅))
|
(define Σ0 (term ∅))
|
||||||
(define Σ3 (term (∅ (and : (Π (A : (Unv 0)) (Π (B : (Unv 0)) (Unv 0))) ()))))
|
(define Σ3 (term (∅ (and : (Π (A : (Unv 0)) (Π (B : (Unv 0)) (Unv 0))) ()))))
|
||||||
(define Σ4 (term (∅ (and : (Π (A : (Unv 0)) (Π (B : (Unv 0)) (Unv 0)))
|
(define Σ4 (term (∅ (and : (Π (A : (Unv 0)) (Π (B : (Unv 0)) (Unv 0)))
|
||||||
|
@ -1000,7 +1001,44 @@
|
||||||
(check-holds
|
(check-holds
|
||||||
(type-check ,sigma (,gamma x : false)
|
(type-check ,sigma (,gamma x : false)
|
||||||
((((elim false) (Unv 0)) (λ (y : false) (Π (x : Type) x))) x)
|
((((elim false) (Unv 0)) (λ (y : false) (Π (x : Type) x))) x)
|
||||||
(Π (x : (Unv 0)) x)))))
|
(Π (x : (Unv 0)) x)))
|
||||||
|
|
||||||
|
;; nat-equal? tests
|
||||||
|
(define zero?
|
||||||
|
(term (((((elim nat) Type) (λ (x : nat) bool))
|
||||||
|
true)
|
||||||
|
(λ (x : nat) (λ (x_ih : bool) false)))))
|
||||||
|
(check-holds
|
||||||
|
(type-check ,Σ ∅ ,zero? (Π (x : nat) bool)))
|
||||||
|
(check-equal?
|
||||||
|
(term (reduce ,Σ (,zero? z)))
|
||||||
|
(term true))
|
||||||
|
(check-equal?
|
||||||
|
(term (reduce ,Σ (,zero? (s z))))
|
||||||
|
(term false))
|
||||||
|
(define ih-equal?
|
||||||
|
(term (((((elim nat) Type) (λ (x : nat) bool))
|
||||||
|
false)
|
||||||
|
(λ (x : nat) (λ (y : bool) (x_ih x))))))
|
||||||
|
(check-holds
|
||||||
|
(type-check ,Σ (∅ x_ih : (Π (x : nat) bool))
|
||||||
|
,ih-equal?
|
||||||
|
(Π (x : nat) bool)))
|
||||||
|
(check-holds
|
||||||
|
(type-check ,Σ ∅
|
||||||
|
(((((((elim nat) Type) (λ (x : nat) (Π (x : nat) bool)))
|
||||||
|
,zero?)
|
||||||
|
(λ (x : nat) (λ (x_ih : (Π (x : nat) bool))
|
||||||
|
,ih-equal?)))
|
||||||
|
z) (s z))
|
||||||
|
(Π (x : nat) (Π (y : nat) bool))))
|
||||||
|
(check-equal?
|
||||||
|
(term (reduce ,Σ (((((((elim nat) Type) (λ (x : nat) (Π (x : nat) bool)))
|
||||||
|
,zero?)
|
||||||
|
(λ (x : nat) (λ (x_ih : (Π (x : nat) bool))
|
||||||
|
,ih-equal?)))
|
||||||
|
z) (s z))))
|
||||||
|
false)))
|
||||||
|
|
||||||
;; This module just provide module language sugar over the redex model.
|
;; This module just provide module language sugar over the redex model.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user