lambda-calculus 2.2.3__tar.gz → 3.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. lambda_calculus-3.1.0/.flake8 +3 -0
  2. lambda_calculus-3.1.0/.gitignore +164 -0
  3. lambda_calculus-3.1.0/.readthedocs.yaml +20 -0
  4. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0}/PKG-INFO +6 -5
  5. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0}/README.md +1 -0
  6. lambda_calculus-3.1.0/docs/Makefile +20 -0
  7. lambda_calculus-3.1.0/docs/api/errors.rst +8 -0
  8. lambda_calculus-3.1.0/docs/api/terms/abc.rst +8 -0
  9. lambda_calculus-3.1.0/docs/api/terms/arithmetic.rst +8 -0
  10. lambda_calculus-3.1.0/docs/api/terms/combinators.rst +8 -0
  11. lambda_calculus-3.1.0/docs/api/terms/logic.rst +8 -0
  12. lambda_calculus-3.1.0/docs/api/terms/pairs.rst +8 -0
  13. lambda_calculus-3.1.0/docs/api/terms.rst +15 -0
  14. lambda_calculus-3.1.0/docs/api/visitors/normalisation.rst +8 -0
  15. lambda_calculus-3.1.0/docs/api/visitors/substitution/checked.rst +8 -0
  16. lambda_calculus-3.1.0/docs/api/visitors/substitution/renaming.rst +8 -0
  17. lambda_calculus-3.1.0/docs/api/visitors/substitution/unsafe.rst +8 -0
  18. lambda_calculus-3.1.0/docs/api/visitors/substitution.rst +12 -0
  19. lambda_calculus-3.1.0/docs/api/visitors/walking.rst +8 -0
  20. lambda_calculus-3.1.0/docs/api/visitors.rst +12 -0
  21. lambda_calculus-3.1.0/docs/api.rst +23 -0
  22. lambda_calculus-3.1.0/docs/conf.py +17 -0
  23. lambda_calculus-3.1.0/docs/index.rst +25 -0
  24. lambda_calculus-3.1.0/docs/installation.rst +33 -0
  25. lambda_calculus-3.1.0/docs/requirements.txt +3 -0
  26. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0}/pyproject.toml +61 -5
  27. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0/src}/lambda_calculus/__init__.py +1 -1
  28. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0/src}/lambda_calculus/terms/__init__.py +6 -4
  29. lambda_calculus-3.1.0/src/lambda_calculus/terms/abc.py +17 -0
  30. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0/src}/lambda_calculus/terms/arithmetic.py +8 -7
  31. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0/src}/lambda_calculus/terms/combinators.py +10 -9
  32. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0/src}/lambda_calculus/terms/logic.py +7 -6
  33. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0/src}/lambda_calculus/terms/pairs.py +6 -5
  34. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0/src}/lambda_calculus/visitors/normalisation.py +2 -2
  35. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0/src}/lambda_calculus/visitors/substitution/unsafe.py +3 -8
  36. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0/src}/lambda_calculus/visitors/walking.py +4 -1
  37. lambda_calculus-3.1.0/tests/__init__.py +0 -0
  38. lambda_calculus-3.1.0/tests/terms/__init__.py +219 -0
  39. lambda_calculus-3.1.0/tests/terms/test_abc.py +24 -0
  40. lambda_calculus-3.1.0/tests/terms/test_arithmetic.py +165 -0
  41. lambda_calculus-3.1.0/tests/terms/test_combinators.py +96 -0
  42. lambda_calculus-3.1.0/tests/terms/test_logic.py +80 -0
  43. lambda_calculus-3.1.0/tests/terms/test_pairs.py +64 -0
  44. lambda_calculus-3.1.0/tests/test_errors.py +35 -0
  45. lambda_calculus-3.1.0/tests/test_readme.py +70 -0
  46. lambda_calculus-3.1.0/tests/visitors/__init__.py +0 -0
  47. lambda_calculus-3.1.0/tests/visitors/substitution/__init__.py +0 -0
  48. lambda_calculus-3.1.0/tests/visitors/substitution/test_checked.py +64 -0
  49. lambda_calculus-3.1.0/tests/visitors/substitution/test_renaming.py +185 -0
  50. lambda_calculus-3.1.0/tests/visitors/test_normalisation.py +158 -0
  51. lambda_calculus-3.1.0/tests/visitors/test_walking.py +57 -0
  52. lambda_calculus-2.2.3/lambda_calculus.egg-info/PKG-INFO +0 -114
  53. lambda_calculus-2.2.3/lambda_calculus.egg-info/SOURCES.txt +0 -22
  54. lambda_calculus-2.2.3/lambda_calculus.egg-info/dependency_links.txt +0 -1
  55. lambda_calculus-2.2.3/lambda_calculus.egg-info/top_level.txt +0 -1
  56. lambda_calculus-2.2.3/setup.cfg +0 -4
  57. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0}/LICENSE +0 -0
  58. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0/src}/lambda_calculus/errors.py +0 -0
  59. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0/src}/lambda_calculus/py.typed +0 -0
  60. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0/src}/lambda_calculus/visitors/__init__.py +0 -0
  61. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0/src}/lambda_calculus/visitors/substitution/__init__.py +0 -0
  62. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0/src}/lambda_calculus/visitors/substitution/checked.py +0 -0
  63. {lambda_calculus-2.2.3 → lambda_calculus-3.1.0/src}/lambda_calculus/visitors/substitution/renaming.py +0 -0
@@ -0,0 +1,3 @@
1
+ [flake8]
2
+ max-line-length = 100
3
+ extend-ignore = E221,E501
@@ -0,0 +1,164 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ .direnv
126
+ env/
127
+ venv/
128
+ ENV/
129
+ env.bak/
130
+ venv.bak/
131
+
132
+ # Spyder project settings
133
+ .spyderproject
134
+ .spyproject
135
+
136
+ # Rope project settings
137
+ .ropeproject
138
+
139
+ # mkdocs documentation
140
+ /site
141
+
142
+ # mypy
143
+ .mypy_cache/
144
+ .dmypy.json
145
+ dmypy.json
146
+
147
+ # Pyre type checker
148
+ .pyre/
149
+
150
+ # pytype static type analyzer
151
+ .pytype/
152
+
153
+ # Cython debug symbols
154
+ cython_debug/
155
+
156
+ # PyCharm
157
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
158
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
159
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
160
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
161
+ #.idea/
162
+
163
+ # VSCode
164
+ .vscode/
@@ -0,0 +1,20 @@
1
+ version: 2
2
+
3
+ build:
4
+ os: "ubuntu-22.04"
5
+ tools:
6
+ python: "3.10"
7
+
8
+ formats:
9
+ - pdf
10
+ - epub
11
+
12
+ sphinx:
13
+ configuration: docs/conf.py
14
+ fail_on_warning: true
15
+
16
+ python:
17
+ install:
18
+ - requirements: docs/requirements.txt
19
+ - method: pip
20
+ path: .
@@ -1,11 +1,12 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: lambda_calculus
3
- Version: 2.2.3
3
+ Version: 3.1.0
4
4
  Summary: Implementation of the Lambda calculus
5
- Author-email: Eric Niklas Wolf <eric_niklas.wolf@mailbox.tu-dresden.de>
6
5
  Project-URL: Repository, https://github.com/Deric-W/lambda_calculus
7
6
  Project-URL: Documentation, http://lambda-calculus.readthedocs.io/
8
7
  Project-URL: Bugtracker, https://github.com/Deric-W/lambda_calculus/issues
8
+ Author-email: Eric Niklas Wolf <eric_niklas.wolf@mailbox.tu-dresden.de>
9
+ License-File: LICENSE
9
10
  Classifier: Intended Audience :: Education
10
11
  Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
11
12
  Classifier: Operating System :: OS Independent
@@ -15,10 +16,10 @@ Classifier: Topic :: Utilities
15
16
  Classifier: Typing :: Typed
16
17
  Requires-Python: >=3.10
17
18
  Description-Content-Type: text/markdown
18
- License-File: LICENSE
19
19
 
20
20
  # lambda_calculus
21
21
 
22
+ [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)
22
23
  ![Tests](https://github.com/Deric-W/lambda_calculus/actions/workflows/Tests.yaml/badge.svg)
23
24
  [![codecov](https://codecov.io/gh/Deric-W/lambda_calculus/branch/main/graph/badge.svg?token=SU3982mC17)](https://codecov.io/gh/Deric-W/lambda_calculus)
24
25
  [![Documentation Status](https://readthedocs.org/projects/lambda-calculus/badge/?version=stable)](https://lambda-calculus.readthedocs.io/en/stable/?badge=stable)
@@ -111,4 +112,4 @@ assert BetaNormalisingVisitor().skip_intermediate(term) == Application.with_argu
111
112
  Variable("+"),
112
113
  (Variable("4"), Variable("3"))
113
114
  )
114
- ```
115
+ ```
@@ -1,5 +1,6 @@
1
1
  # lambda_calculus
2
2
 
3
+ [![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)
3
4
  ![Tests](https://github.com/Deric-W/lambda_calculus/actions/workflows/Tests.yaml/badge.svg)
4
5
  [![codecov](https://codecov.io/gh/Deric-W/lambda_calculus/branch/main/graph/badge.svg?token=SU3982mC17)](https://codecov.io/gh/Deric-W/lambda_calculus)
5
6
  [![Documentation Status](https://readthedocs.org/projects/lambda-calculus/badge/?version=stable)](https://lambda-calculus.readthedocs.io/en/stable/?badge=stable)
@@ -0,0 +1,20 @@
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line, and also
5
+ # from the environment for the first two.
6
+ SPHINXOPTS ?=
7
+ SPHINXBUILD ?= sphinx-build
8
+ SOURCEDIR = .
9
+ BUILDDIR = _build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -0,0 +1,8 @@
1
+ Module errors
2
+ =============
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+
7
+ .. automodule:: lambda_calculus.errors
8
+ :members:
@@ -0,0 +1,8 @@
1
+ Module abc
2
+ ==========
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+
7
+ .. automodule:: lambda_calculus.terms.abc
8
+ :members:
@@ -0,0 +1,8 @@
1
+ Module arithmetic
2
+ =================
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+
7
+ .. automodule:: lambda_calculus.terms.arithmetic
8
+ :members:
@@ -0,0 +1,8 @@
1
+ Module combinators
2
+ ==================
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+
7
+ .. automodule:: lambda_calculus.terms.combinators
8
+ :members:
@@ -0,0 +1,8 @@
1
+ Module logic
2
+ ============
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+
7
+ .. automodule:: lambda_calculus.terms.logic
8
+ :members:
@@ -0,0 +1,8 @@
1
+ Module pairs
2
+ ============
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+
7
+ .. automodule:: lambda_calculus.terms.pairs
8
+ :members:
@@ -0,0 +1,15 @@
1
+ Package terms
2
+ =============
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+
7
+ terms/abc
8
+ terms/logic
9
+ terms/arithmetic
10
+ terms/pairs
11
+ terms/combinators
12
+
13
+ .. automodule:: lambda_calculus.terms
14
+ :members:
15
+ :special-members: __iter__, __str__
@@ -0,0 +1,8 @@
1
+ Module normalisation
2
+ ====================
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+
7
+ .. automodule:: lambda_calculus.visitors.normalisation
8
+ :members:
@@ -0,0 +1,8 @@
1
+ Module checked
2
+ ==============
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+
7
+ .. automodule:: lambda_calculus.visitors.substitution.checked
8
+ :members:
@@ -0,0 +1,8 @@
1
+ Module renaming
2
+ ===============
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+
7
+ .. automodule:: lambda_calculus.visitors.substitution.renaming
8
+ :members:
@@ -0,0 +1,8 @@
1
+ Module unsafe
2
+ =============
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+
7
+ .. automodule:: lambda_calculus.visitors.substitution.unsafe
8
+ :members:
@@ -0,0 +1,12 @@
1
+ Package substitution
2
+ ====================
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+
7
+ substitution/checked
8
+ substitution/renaming
9
+ substitution/unsafe
10
+
11
+ .. automodule:: lambda_calculus.visitors.substitution
12
+ :members:
@@ -0,0 +1,8 @@
1
+ Module walking
2
+ ==============
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+
7
+ .. automodule:: lambda_calculus.visitors.walking
8
+ :members:
@@ -0,0 +1,12 @@
1
+ Package visitors
2
+ ================
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+
7
+ visitors/substitution
8
+ visitors/normalisation
9
+ visitors/walking
10
+
11
+ .. automodule:: lambda_calculus.visitors
12
+ :members:
@@ -0,0 +1,23 @@
1
+ Package API
2
+ ===========
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+
7
+ api/terms
8
+ api/visitors
9
+ api/errors
10
+
11
+ .. automodule:: lambda_calculus
12
+
13
+ .. autoclass:: Variable
14
+
15
+ Reference to :class:`.terms.Variable` for convenience
16
+
17
+ .. autoclass:: Abstraction
18
+
19
+ Reference to :class:`.terms.Abstraction` for convenience
20
+
21
+ .. autoclass:: Application
22
+
23
+ Reference to :class:`.terms.Application` for convenience
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env python3
2
+
3
+ """Sphinx configuration"""
4
+
5
+ import sys
6
+ import os.path
7
+ from sphinx_pyproject import SphinxConfig
8
+
9
+
10
+ sys.path.append(os.path.abspath(".."))
11
+
12
+ config = SphinxConfig("../pyproject.toml", globalns=globals())
13
+
14
+ intersphinx_mapping = {
15
+ "python": ("https://docs.python.org/3/", None),
16
+ "sphinx": ("https://www.sphinx-doc.org/en/stable/", None),
17
+ }
@@ -0,0 +1,25 @@
1
+ lambda_calculus
2
+ ===============
3
+
4
+ Welcome to lambda_calculus`s documentation.
5
+
6
+ This project implements basic operations of the `Lambda calculus <https://en.wikipedia.org/wiki/Lambda_calculus>`_
7
+ as a python package and contains helpers to define custom ones.
8
+
9
+ It is intended to be used for educational purposes and is not optimized for speed.
10
+ Furthermore, it expects all terms to be finite, which means the absence of cycles.
11
+ :py:class:`RecursionError` may be raised when using an infinite term or the evaluation is too complex.
12
+
13
+ .. toctree::
14
+ :maxdepth: 2
15
+
16
+ installation
17
+ api
18
+
19
+
20
+ Indices and tables
21
+ ==================
22
+
23
+ * :ref:`genindex`
24
+ * :ref:`modindex`
25
+ * :ref:`search`
@@ -0,0 +1,33 @@
1
+ Installation
2
+ ============
3
+
4
+ .. toctree::
5
+ :maxdepth: 2
6
+
7
+ Overview over the most common ways of installing this project.
8
+
9
+ Installation from PyPI
10
+ ----------------------
11
+
12
+ If you just want to get started or receive updates you can use
13
+ the package available on `PyPI <https://pypi.org/project/lambda-calculus/>`_ and
14
+ install it with the following command:
15
+
16
+ .. code:: bash
17
+
18
+ python3 -m pip install lambda-calculus
19
+
20
+ `Sematic Versioning <https://semver.org/>`_ is is attempted to be adhered to.
21
+
22
+ Installation from source
23
+ ------------------------
24
+
25
+ This project adheres to `PEP 517 <https://peps.python.org/pep-0517>`_ and
26
+ can be build using `build <https://pypi.org/project/build/>`_:
27
+
28
+ .. code:: bash
29
+
30
+ python3 -m build
31
+
32
+ The resulting wheel should be platform and machine independent
33
+ because this is a pure python project.
@@ -0,0 +1,3 @@
1
+ sphinx ~= 5.2.0
2
+ sphinx-pyproject ~= 0.1.0
3
+ sphinx-rtd-theme ~= 1.0.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "lambda_calculus"
3
- version = "2.2.3"
3
+ version = "3.1.0"
4
4
  description = "Implementation of the Lambda calculus"
5
5
  requires-python = ">=3.10"
6
6
  keywords = []
@@ -28,11 +28,59 @@ Documentation = "http://lambda-calculus.readthedocs.io/"
28
28
  Bugtracker = "https://github.com/Deric-W/lambda_calculus/issues"
29
29
 
30
30
  [build-system]
31
- requires = ["setuptools >= 61.0.0"]
32
- build-backend = "setuptools.build_meta"
31
+ requires = ["hatchling"]
32
+ build-backend = "hatchling.build"
33
33
 
34
- [tool.setuptools.package-data]
35
- lambda_calculus = ["py.typed"]
34
+ [tool.hatch.envs.test]
35
+ dependencies = [
36
+ "coverage[toml] == 7.*"
37
+ ]
38
+
39
+ [tool.hatch.envs.test.scripts]
40
+ test = "python -m unittest discover {args}"
41
+ cov-run = "coverage run -m unittest discover {args}"
42
+ cov-report = [
43
+ "- coverage combine",
44
+ "coverage report"
45
+ ]
46
+ cov = [
47
+ "cov-run",
48
+ "cov-report"
49
+ ]
50
+
51
+ [[tool.hatch.envs.test.matrix]]
52
+ python = ["3.10", "3.11", "3.12"]
53
+
54
+ [tool.hatch.envs.lint]
55
+ dependencies = [
56
+ "mypy >= 1.0.0",
57
+ "pylint >= 2.12.2",
58
+ "flake8 >= 5.0.0",
59
+ "isort >= 5.10.1"
60
+ ]
61
+
62
+ [tool.hatch.envs.lint.scripts]
63
+ lint = [
64
+ "- flake8 src/lambda_calculus",
65
+ "- pylint src/lambda_calculus"
66
+ ]
67
+ typecheck = "mypy -p lambda_calculus"
68
+ release = [
69
+ "typecheck"
70
+ ]
71
+
72
+ [tool.hatch.envs.docs]
73
+ dependencies = [
74
+ "sphinx ~= 5.2.0",
75
+ "sphinx-pyproject ~= 0.1.0",
76
+ "sphinx-rtd-theme ~= 1.0.0"
77
+ ]
78
+
79
+ [tool.hatch.envs.docs.scripts]
80
+ build = "sphinx-build {args} docs docs/_build"
81
+
82
+ [tool.hatch.build.targets.sdist]
83
+ exclude = ["/.github"]
36
84
 
37
85
  [tool.mypy]
38
86
  disallow_any_unimported = true
@@ -45,6 +93,14 @@ warn_unused_ignores = true
45
93
  warn_return_any = true
46
94
  warn_unreachable = true
47
95
 
96
+ [tool.pylint]
97
+ max-line-length = 100
98
+
99
+ [tool.coverage.run]
100
+ source_pkgs = ["lambda_calculus"]
101
+ branch = true
102
+ parallel = true
103
+
48
104
  [tool.sphinx-pyproject]
49
105
  project = "lambda_calculus"
50
106
  copyright = "2022 Eric Wolf"
@@ -4,7 +4,7 @@
4
4
 
5
5
  from .terms import Variable, Abstraction, Application
6
6
 
7
- __version__ = "2.2.3"
7
+ __version__ = "3.1.0"
8
8
  __author__ = "Eric Niklas Wolf"
9
9
  __email__ = "eric_niklas.wolf@mailbox.tu-dresden.de"
10
10
  __all__ = (
@@ -6,7 +6,7 @@ from __future__ import annotations
6
6
  from abc import abstractmethod
7
7
  from collections.abc import Sequence, Set, Iterable, Iterator
8
8
  from dataclasses import dataclass
9
- from typing import TypeVar
9
+ from typing import TypeVar, final
10
10
  from .. import visitors
11
11
  from ..errors import CollisionError
12
12
  from ..visitors import walking
@@ -17,6 +17,7 @@ __all__ = (
17
17
  "Variable",
18
18
  "Abstraction",
19
19
  "Application",
20
+ "abc",
20
21
  "arithmetic",
21
22
  "logic",
22
23
  "pairs",
@@ -128,6 +129,7 @@ class Term(Iterable["Term[V]"]):
128
129
  return not self.free_variables()
129
130
 
130
131
 
132
+ @final
131
133
  @dataclass(unsafe_hash=True, slots=True)
132
134
  class Variable(Term[V]):
133
135
  """
@@ -197,6 +199,7 @@ class Variable(Term[V]):
197
199
  return visitor.visit_variable(self)
198
200
 
199
201
 
202
+ @final
200
203
  @dataclass(unsafe_hash=True, slots=True)
201
204
  class Abstraction(Term[V]):
202
205
  """
@@ -278,7 +281,7 @@ class Abstraction(Term[V]):
278
281
  )
279
282
  raise CollisionError("new variable would bind free variable in body", (new,))
280
283
 
281
- def eta_reduction(self) -> Term[V]: # type: ignore[return]
284
+ def eta_reduction(self) -> Term[V]:
282
285
  """
283
286
  Remove a useless abstraction.
284
287
 
@@ -289,8 +292,6 @@ class Abstraction(Term[V]):
289
292
  case Application(f, Variable(x)) if x == self.bound and x not in f.free_variables():
290
293
  return f
291
294
  case _:
292
- # mypy detects missing returns
293
- # because of https://github.com/python/mypy/issues/12534
294
295
  raise ValueError("abstraction is not useless")
295
296
 
296
297
  def accept(self, visitor: visitors.Visitor[T, V]) -> T:
@@ -316,6 +317,7 @@ class Abstraction(Term[V]):
316
317
  )
317
318
 
318
319
 
320
+ @final
319
321
  @dataclass(unsafe_hash=True, slots=True)
320
322
  class Application(Term[V]):
321
323
  """
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/python3
2
+
3
+ """Predefined Variables for all ASCII letters"""
4
+
5
+ from string import ascii_letters
6
+ from . import Variable
7
+
8
+ __all__ = tuple(ascii_letters)
9
+
10
+ # better IDE autocompletion
11
+ a, b, c, d, e, f, g, h, i, j = map(Variable, "abcdefghij")
12
+ k, l, m, n, o, p, q, r, s, t = map(Variable, "klmnopqrst")
13
+ u, v, w, x, y, z = map(Variable, "uvwxyz")
14
+
15
+ A, B, C, D, E, F, G, H, I, J = map(Variable, "ABCDEFGHIJ")
16
+ K, L, M, N, O, P, Q, R, S, T = map(Variable, "KLMNOPQRST")
17
+ U, V, W, X, Y, Z = map(Variable, "UVWXYZ")