lambdacalc | simple example of an interpreter in JS | Interpreter library
kandi X-RAY | lambdacalc Summary
kandi X-RAY | lambdacalc Summary
A simple example of an interpreter in JS. Evaluates lambda calculus expressions.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of lambdacalc
lambdacalc Key Features
lambdacalc Examples and Code Snippets
Community Discussions
Trending Discussions on lambdacalc
QUESTION
I am studying Haskell and I am learning what is an abstraction, substitution (beta equivalence), application, free and bound variables (alpha equivalence), but I have some doubts resolving these exercises, I don't know if my solutions are correct.
Make the following substitutions
...ANSWER
Answered 2020-Sep-12 at 06:14
1. (λ x → y x x) [x:= f z]
Sol.(\x -> y x x) =>α (\w -> y w w) =>α (\w -> x w w) =>β (\w -> f z w w)
No, you can't rename y
, it's free in (λ x → y x x)
. Only bound variables can be (consistently) α-renamed. But only free variables can be substituted, and there's no free x
in that lambda term.
2. ((λ x → y x x) x) [y:= x]
Sol.((\x -> y x x)x) =>α (\w -> y w w)[y:= x] = (\w -> x w w)
Yes, substituting x
for y
would allow it to be captured by the λ x
, so you indeed must α-rename the x
in (λ x → y x x)
first to some new unique name as you did, but you've dropped the application to the free x
for some reason. You can't just omit parts of a term, so it's ((\w -> y w w) x)[y:= x]
. Now perform the substitution. Note you're not asked to perform the β-reduction of the resulting term, just the substitution.
I'll leave the other two out. Just follow the rules carefully. It's easy if you rename all bound names to unique names first, even if the renaming is not strictly required, for instance
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install lambdacalc
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page