You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm following the tutorial but trying to define unrestricted beta-reduction for the untyped lambda calculus:
#lang racket
(require (only-in redex/reduction-semantics
define-language redex-match define-metafunction term
reduction-relation --> in-hole apply-reduction-relation)
(only-in redex/tut-subst subst/proc))
(define-language L
(e (e e)
(λ x e)
x)
(x variable-not-otherwise-mentioned)
(E (E e)
(e E)
hole))
(define x? (redex-match L x))
(define-metafunction L
subst : x e_1 e_0 -> e
[(subst x e_1 e_0)
,(subst/proc x? (list (term x)) (list (term e_1)) (term e_0))])
(define red
(reduction-relation
L
#:domain e
(--> (in-hole E ((λ x e_0) e_1))
(in-hole E (subst x e_1 e_0))
"β")))
(define twice '(λ f1 (λ x9 (f1 (f1 x9)))))
(define redex-with-x1-free `(,twice (,twice x1)))
(define result-without-x1-free
(for/or ((result (apply-reduction-relation red redex-with-x1-free)))
(match result (`(λ x1 ,_) result) (_#f))))
result-without-x1-free
There seems to be a bug in subst/proc that turns a term with x1 free into a term without x1 free.
Activity
ccshan commentedon Feb 26, 2026
It looks like
fvsneeds a case for "(λ x ... e)for untyped".add test cases for #274
rfindler commentedon Feb 26, 2026
Thanks!