Skip to content

Commit 53e7820

Browse files
committed
Update README with the new nemeless term substitution functionality
1 parent 0a184d4 commit 53e7820

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# lambda-parser
2-
Parser for lambda terms, written in Haskell, that is also able to apply substitution, according to the rules of lambda calculus
2+
Parser for lambda terms, written in Haskell, that is also able to apply substitution, according to the rules of lambda calculus
33

44
## Table of contents
55
- [Prerequisites](#prerequisites)
@@ -46,7 +46,9 @@ $` \quad \quad \quad \quad \ \ | \quad λ \ \langle variable\rangle \ . \ \lan
4646
(Here $` (\!( \ )\!)^* `$ means that the brackets themselves are optional)
4747

4848
### Substitution
49-
In order for the substitution to be correct and not change the semantics of the lambda terms, the algorithm uses **Curry substitution**. This means that in the cases where a naive substitution would cause a problem, the bound variables are renamed. The algorithm starts by trying all letters, starting from *a*, until a letter is found that would not cause the term to change its semantics and renames the bound variable with the found letter. If a suitable letter is not found, then the algorithm continues to search for any suitable character (which does not follow the grammar).
49+
There are currently 2 supported versions for the substitutions:
50+
- curry substitution - this is the standart substitution, done directly on the original term. In order for it to be correct and not change the semantics of the lambda terms, in the cases where a naive substitution would cause a problem, the bound variables are renamed. The algorithm starts by trying all letters, starting from *a*, until a letter is found that would not cause the term to change its semantics and renames the bound variable with the found letter. If a suitable letter is not found, then the algorithm continues to search for any suitable character (which does not follow the grammar);
51+
- nameless term substitution - in order for this substitution to be applied the term is first transformed into nameless term. Nameless terms don't have variable names - instead de Bruijn indexes are used to denote which variables are bound and which - free. The substitution is then done on the indexes instead of the variables by utilizing the `shift` function. After the substitution is done, the term is transformed back into its named version, where the bound variables may have different names (which does not change the semantics of the term).
5052

5153
## License
5254
The project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more information.

src/Main.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import System.IO (BufferMode (BlockBuffering), hSetBuffering, stdout)
99
import Transformer (toNamed, toNameless)
1010
import Prelude hiding (lookup)
1111

12+
-- TODO: let the user decide which substitution to be used and how the
13+
-- result should be displayed - either as named or nameless term
1214
main :: IO ()
1315
main = do
1416
hSetBuffering stdout $ BlockBuffering $ Just 1

0 commit comments

Comments
 (0)