Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions redex-doc/redex/scribblings/long-tut/mon-aft.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ Here are two more metafunctions that use patterns in interesting ways:
(where #false (in x (x_1 ...)))]
[(subtract1 (x ...) x_1) (x ...)])


(define-metafunction Lambda
in : x (x ...) -> boolean
[(in x (x_1 ... x x_2 ...)) #true]
[(in x (x_1 ...)) #false])

))
@;%
Expand Down Expand Up @@ -319,15 +322,9 @@ Now α equivalence is straightforward:
(racketblock
;; (=α e_1 e_2) determines whether e_1 and e_2 are α equivalent

(define-extended-language Lambda/n Lambda
(e ::= .... n)
(n ::= natural))

(define in-Lambda/n? (redex-match? Lambda/n e))

(module+ test
(test-equal (term (=α (lambda (x) x) (lambda (y) y))) #true)
(test-equal (term (=α (lambda (x) (x 1)) (lambda (y) (y 1)))) #true)
(test-equal (term (=α (lambda (x) (x x)) (lambda (y) (y y)))) #true)
(test-equal (term (=α (lambda (x) x) (lambda (y) z))) #false))

(define-metafunction SD
Expand Down