
These fixes are merged because properly testing the latter requires having the former, while properly implementing the former is made simpler by having the latter. Fixed handling of names/substitution === * Added capture-avoiding substitution. Closes #7 * Added equivalence during typing checking, including α-equivalence and limited β-equivalence. Closes #8 * Exposed better typing-check reflection features to allow typing checking modulo equivalence. * Tweaked QED macro to use new type-checking reflection feature. Fixed inductive families === The implementation of inductive families is now based on the theoretical models of inductive families, rather than an ad-hoc non-dependent pattern matcher. * Removed case and fix from Cur and Curnel. They are replaced by elim, the generic eliminator for inductive families. Closes #5. Since fix is no more, also closes #2. * Elimination of false works! Closes #4. * Changed uses of case to elim in Curnel * Changed uses of case* in Cur to use eliminators. Breaks case* API. * Fixed Coq generator to use eliminators * Fixed Latex generator
21 lines
524 B
Racket
21 lines
524 B
Racket
#lang s-exp "../redex-curnel.rkt"
|
|
(provide bool btrue bfalse if bnot)
|
|
|
|
(data bool : Type
|
|
(btrue : bool)
|
|
(bfalse : bool))
|
|
|
|
(define-syntax (if syn)
|
|
(syntax-case syn ()
|
|
[(_ t s f)
|
|
;; Compute the motive
|
|
(let ([M #`(lambda (x : #,(type-infer/syn #'t))
|
|
#,(type-infer/syn #'s))])
|
|
(quasisyntax/loc syn (elim bool t #,M s f)))]))
|
|
|
|
(define (bnot (x : bool)) (if x bfalse btrue))
|
|
(module+ test
|
|
(require rackunit)
|
|
(check-equal? (bnot btrue) bfalse)
|
|
(check-equal? (bnot bfalse) btrue))
|