Added plus, fixed some comments

This commit is contained in:
William J. Bowman 2015-01-19 20:20:25 -05:00
parent c359631268
commit de202fa6a0

View File

@ -57,15 +57,16 @@
[s (lambda (x : nat) x)])) [s (lambda (x : nat) x)]))
(check-equal? (sub1 (s z)) z) (check-equal? (sub1 (s z)) z)
#|
;; TODO: Plus require recursion and I don't have recursion! ;; TODO: Plus require recursion and I don't have recursion!
(define (plus (n1 : nat) (n2 : nat)) (define plus
(fix (plus : (forall* (n1 : nat) (n2 : nat) nat))
(lambda (n1 : nat)
(lambda (n2 : nat)
(case n1 (case n1
[z n2] [z n2]
[s (λ (x : nat) (plus x (s n2)))])) [s (λ (x : nat) (plus x (s n2)))])))))
(check-equal? (plus (s (s z)) (s (s z))) (s (s (s z)))) (check-equal? (plus (s (s z)) (s (s z))) (s (s (s (s z)))))
|#
;; ------------------- ;; -------------------
;; It's annoying to have to write things explicitly curried ;; It's annoying to have to write things explicitly curried
@ -239,7 +240,7 @@
;; ------------------- ;; -------------------
;; Okay but what about *real* proofs, like formalizing STLC, complete ;; Okay but what about *real* proofs, like formalizing STLC, complete
;; with fancy syntax for type checking? ;; with fancy syntax?
(data type : Type (data type : Type
(Unit : type) (Unit : type)