unicode-fol-kit 0.3.0__tar.gz → 0.4.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 (34) hide show
  1. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/.gitignore +181 -181
  2. unicode_fol_kit-0.4.0/CHANGELOG.md +98 -0
  3. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/LICENSE +20 -20
  4. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/PKG-INFO +297 -12
  5. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/README.md +296 -11
  6. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/pyproject.toml +2 -1
  7. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/unicode_fol_kit/__init__.py +23 -2
  8. unicode_fol_kit-0.4.0/unicode_fol_kit/__main__.py +106 -0
  9. unicode_fol_kit-0.4.0/unicode_fol_kit/atp/__init__.py +19 -0
  10. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/unicode_fol_kit/atp/prover9_entailment.py +8 -1
  11. unicode_fol_kit-0.4.0/unicode_fol_kit/atp/resolution.py +401 -0
  12. unicode_fol_kit-0.4.0/unicode_fol_kit/atp/z3_arith.py +276 -0
  13. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/unicode_fol_kit/atp/z3_equivalence.py +6 -2
  14. unicode_fol_kit-0.4.0/unicode_fol_kit/atp/z3_fuzzy.py +262 -0
  15. unicode_fol_kit-0.4.0/unicode_fol_kit/atp/z3_models.py +49 -0
  16. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/unicode_fol_kit/fol/__init__.py +6 -0
  17. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/unicode_fol_kit/fol/_fol_nodes.py +183 -37
  18. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/unicode_fol_kit/fol/_msfl_nodes.py +183 -133
  19. unicode_fol_kit-0.4.0/unicode_fol_kit/fol/lambda_tools.py +297 -0
  20. unicode_fol_kit-0.4.0/unicode_fol_kit/fol/normalforms.py +408 -0
  21. unicode_fol_kit-0.4.0/unicode_fol_kit/fol/unification.py +141 -0
  22. unicode_fol_kit-0.4.0/unicode_fol_kit/py.typed +0 -0
  23. unicode_fol_kit-0.4.0/unicode_fol_kit/semantics/__init__.py +15 -0
  24. unicode_fol_kit-0.4.0/unicode_fol_kit/semantics/fuzzy.py +253 -0
  25. unicode_fol_kit-0.4.0/unicode_fol_kit/semantics/tarski.py +333 -0
  26. unicode_fol_kit-0.3.0/unicode_fol_kit/atp/__init__.py +0 -4
  27. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/unicode_fol_kit/fol/grammars/fl.lark +0 -0
  28. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/unicode_fol_kit/fol/grammars/fol.lark +0 -0
  29. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/unicode_fol_kit/fol/grammars/msfl.lark +0 -0
  30. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/unicode_fol_kit/fol/grammars/msfol.lark +0 -0
  31. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/unicode_fol_kit/fol/grammars/terminals.lark +0 -0
  32. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/unicode_fol_kit/fol/msflparser.py +0 -0
  33. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/unicode_fol_kit/fol/naming.py +0 -0
  34. {unicode_fol_kit-0.3.0 → unicode_fol_kit-0.4.0}/unicode_fol_kit/fol/nodes.py +0 -0
@@ -1,182 +1,182 @@
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
- # UV
98
- # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
- # This is especially recommended for binary packages to ensure reproducibility, and is more
100
- # commonly ignored for libraries.
101
- #uv.lock
102
-
103
- # poetry
104
- # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
- # This is especially recommended for binary packages to ensure reproducibility, and is more
106
- # commonly ignored for libraries.
107
- # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
- #poetry.lock
109
-
110
- # pdm
111
- # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
- #pdm.lock
113
- # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
- # in version control.
115
- # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
- .pdm.toml
117
- .pdm-python
118
- .pdm-build/
119
-
120
- # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
- __pypackages__/
122
-
123
- # Celery stuff
124
- celerybeat-schedule
125
- celerybeat.pid
126
-
127
- # SageMath parsed files
128
- *.sage.py
129
-
130
- # Environments
131
- .env
132
- .venv
133
- env/
134
- venv/
135
- ENV/
136
- env.bak/
137
- venv.bak/
138
-
139
- # Spyder project settings
140
- .spyderproject
141
- .spyproject
142
-
143
- # Rope project settings
144
- .ropeproject
145
-
146
- # mkdocs documentation
147
- /site
148
-
149
- # mypy
150
- .mypy_cache/
151
- .dmypy.json
152
- dmypy.json
153
-
154
- # Pyre type checker
155
- .pyre/
156
-
157
- # pytype static type analyzer
158
- .pytype/
159
-
160
- # Cython debug symbols
161
- cython_debug/
162
-
163
- # PyCharm
164
- # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
- # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
- # and can be added to the global gitignore or merged into this file. For a more nuclear
167
- # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
- #.idea/
169
-
170
- # Ruff stuff:
171
- .ruff_cache/
172
-
173
- # PyPI configuration file
174
- .pypirc
175
-
176
- # Cursor
177
- # Cursor is an AI-powered code editor.`.cursorignore` specifies files/directories to
178
- # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
179
- # refer to https://docs.cursor.com/context/ignore-files
180
- .cursorignore
181
- .cursorindexingignore
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
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ #.idea/
169
+
170
+ # Ruff stuff:
171
+ .ruff_cache/
172
+
173
+ # PyPI configuration file
174
+ .pypirc
175
+
176
+ # Cursor
177
+ # Cursor is an AI-powered code editor.`.cursorignore` specifies files/directories to
178
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
179
+ # refer to https://docs.cursor.com/context/ignore-files
180
+ .cursorignore
181
+ .cursorindexingignore
182
182
  .claude
@@ -0,0 +1,98 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file. The format is
4
+ loosely based on [Keep a Changelog](https://keepachangelog.com/). Versioning is
5
+ semantic, but the project is pre-1.0 (alpha): a **minor** release may contain
6
+ breaking changes.
7
+
8
+ ## [0.4.0] - 2026-06-23
9
+
10
+ A large feature release adding model-theoretic and many-valued semantics, an
11
+ in-process theorem prover, more solver back-ends, and lambda/normal-form tooling,
12
+ plus a set of correctness fixes. **Includes one breaking change** (see *Changed*).
13
+
14
+ ### Added
15
+
16
+ - **Tarskian model theory** (`unicode_fol_kit.semantics.tarski`): define a
17
+ `Structure` (a "world" with a domain of individuals and interpretations of
18
+ constants, functions, predicates, and — for MSFOL — sorts) and compute a
19
+ formula's truth value with `satisfies()` / `models()` / `term_value()`.
20
+ Equality is built in; sorted quantifiers range over their sort universe.
21
+ - **Łukasiewicz fuzzy evaluator** (`fuzzy_evaluate`): the truth degree in [0, 1]
22
+ of an FL/MSFL formula under a valuation (`∀` = inf, `∃` = sup).
23
+ - **Fuzzy satisfiability / validity** via Z3 reals: `fuzzy_is_satisfiable`,
24
+ `fuzzy_is_valid`, `fuzzy_get_model`, `degree_expr`.
25
+ - **Arithmetic-aware Z3 translation**: `to_z3_arith`, `is_satisfiable_arith`,
26
+ `is_valid_arith`, `get_model_arith` interpret `+ - * /` and the comparisons
27
+ over Z3 reals/integers (the default `to_z3` keeps them uninterpreted).
28
+ - **Built-in first-order resolution prover** (`unicode_fol_kit.atp.resolution`):
29
+ `prove`, `is_valid_resolution`, `to_clauses`, `refute` — sound entailment and
30
+ validity checking in-process, without an external prover. Deliberately
31
+ incomplete under a step bound (never reports a non-theorem as proved);
32
+ `=` is treated as an uninterpreted predicate.
33
+ - **Lambda tooling**: `eliminate_lambdas` (beta-eta normalise and verify
34
+ lambda-free), `reduce_trace`, `beta_reduce_step`, `has_lambdas`.
35
+ - **Normal forms**: `to_dnf` (equivalence-preserving) and `to_tseitin_cnf`
36
+ (equisatisfiable, avoids the distributive blow-up).
37
+ - **Robinson unification**: `unify` (most general unifier with occurs-check) and
38
+ `apply_subst`.
39
+ - **Command-line interface**: `python -m unicode_fol_kit "<formula>" --mode … --to …`.
40
+ - **Typing**: a `py.typed` marker (PEP 561).
41
+ - **AST helper**: `Node.map_children`, the single structural-recursion engine.
42
+
43
+ ### Changed
44
+
45
+ - **BREAKING — AST nodes are now frozen dataclasses.** Every node is immutable
46
+ and **hashable**, so nodes can be put in sets, used as dict keys, and
47
+ deduplicated.
48
+ - **BREAKING — `Function.args` and `Atom.args` are now `tuple`s, not `list`s.**
49
+ Construction stays lenient: a list passed to the constructor is coerced to a
50
+ tuple, so `Atom("P", [x])` still works and `node == node` comparisons are
51
+ unaffected. Code that relied on `.args` being a *list* (in-place mutation,
52
+ `isinstance(node.args, list)`, or comparing `node.args == [...]`) must switch
53
+ to tuples.
54
+
55
+ ### Fixed
56
+
57
+ - `Xor.to_tptp` emitted `~|` (TPTP **NOR**); now emits `<~>` (correct XOR /
58
+ non-equivalence).
59
+ - TPTP arithmetic comparisons (`<`, `>`, `≤`, `≥`) are now emitted as prefix
60
+ dollar-word predicates (`$less(a, b)`), not as invalid infix expressions.
61
+ - Prover9 export: quantified variables are uppercased to match the emitted
62
+ `set(prolog_style_variables)`; nullary predicates render as bare propositional
63
+ atoms instead of the invalid `P()`.
64
+ - `to_latex` escapes the underscore in `c_`-prefixed constants (otherwise read as
65
+ a LaTeX subscript).
66
+ - Prover9 entailment: the temporary input file is no longer leaked when the
67
+ `prover9_path` is invalid (now cleaned up in a `finally`).
68
+ - Several README inaccuracies (clone URL, "three" vs "four" parser modes, the
69
+ exception class raised on mixing same-level connectives, the `Quantifier`
70
+ AST-table annotation), and the `formulas_are_equivalent` / `is_valid`
71
+ docstrings.
72
+
73
+ ### Documentation
74
+
75
+ - Clarified that `to_fol` / `to_msfol` is a classical **Boolean projection**
76
+ (the strong and weak Łukasiewicz connectives both collapse to `And`/`Or`), not
77
+ a fuzzy-preserving translation — use `fuzzy_evaluate` / the fuzzy Z3 solver for
78
+ many-valued degrees.
79
+
80
+ ### Internal
81
+
82
+ - Refactored the duplicated structural recursions (`free_variables`,
83
+ substitution, beta/eta reduction, scope resolution, `to_msfol`/`_relativize`,
84
+ term substitution) onto the shared `Node.map_children` / `_child_nodes`
85
+ helpers, removing the per-node `isinstance` chains while preserving the
86
+ binder-aware special cases and the public `TypeError` contracts.
87
+
88
+ ## [0.3.1] - earlier
89
+
90
+ - LaTeX export, normal forms, Horn check, Z3 models, traversal API, Graphviz export.
91
+
92
+ ## [0.3.0] - earlier
93
+
94
+ - `to_unicode_str()` with parser round-trip.
95
+
96
+ ## [0.2.1] - earlier
97
+
98
+ - README patch release.
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Felix Vossel
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Felix Vossel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.