unsat 0.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 (54) hide show
  1. unsat-0.1.0/PKG-INFO +134 -0
  2. unsat-0.1.0/README.md +112 -0
  3. unsat-0.1.0/pyproject.toml +183 -0
  4. unsat-0.1.0/pyproject.toml.orig +174 -0
  5. unsat-0.1.0/src/unsat/__init__.py +160 -0
  6. unsat-0.1.0/src/unsat/__main__.py +11 -0
  7. unsat-0.1.0/src/unsat/api.py +625 -0
  8. unsat-0.1.0/src/unsat/cli.py +147 -0
  9. unsat-0.1.0/src/unsat/model/__init__.py +25 -0
  10. unsat-0.1.0/src/unsat/model/converters.py +102 -0
  11. unsat-0.1.0/src/unsat/model/eval.py +578 -0
  12. unsat-0.1.0/src/unsat/model/values.py +219 -0
  13. unsat-0.1.0/src/unsat/parser/__init__.py +34 -0
  14. unsat-0.1.0/src/unsat/parser/dimacs.py +151 -0
  15. unsat-0.1.0/src/unsat/parser/smt2/__init__.py +21 -0
  16. unsat-0.1.0/src/unsat/parser/smt2/format.py +101 -0
  17. unsat-0.1.0/src/unsat/parser/smt2/lexer.py +242 -0
  18. unsat-0.1.0/src/unsat/parser/smt2/runner.py +1364 -0
  19. unsat-0.1.0/src/unsat/py.typed +0 -0
  20. unsat-0.1.0/src/unsat/quantifiers/__init__.py +28 -0
  21. unsat-0.1.0/src/unsat/quantifiers/base.py +76 -0
  22. unsat-0.1.0/src/unsat/quantifiers/ematch.py +376 -0
  23. unsat-0.1.0/src/unsat/quantifiers/mbqi.py +334 -0
  24. unsat-0.1.0/src/unsat/sat/__init__.py +49 -0
  25. unsat-0.1.0/src/unsat/sat/heap.py +106 -0
  26. unsat-0.1.0/src/unsat/sat/solver.py +862 -0
  27. unsat-0.1.0/src/unsat/sat/trail.py +89 -0
  28. unsat-0.1.0/src/unsat/sat/types.py +140 -0
  29. unsat-0.1.0/src/unsat/smt/__init__.py +14 -0
  30. unsat-0.1.0/src/unsat/smt/encoder.py +737 -0
  31. unsat-0.1.0/src/unsat/smt/propagator.py +456 -0
  32. unsat-0.1.0/src/unsat/smt/solver.py +583 -0
  33. unsat-0.1.0/src/unsat/syntax/__init__.py +58 -0
  34. unsat-0.1.0/src/unsat/syntax/bv_eval.py +80 -0
  35. unsat-0.1.0/src/unsat/syntax/context.py +1029 -0
  36. unsat-0.1.0/src/unsat/syntax/context_arith.py +228 -0
  37. unsat-0.1.0/src/unsat/syntax/context_bv.py +620 -0
  38. unsat-0.1.0/src/unsat/syntax/expr.py +657 -0
  39. unsat-0.1.0/src/unsat/syntax/kinds.py +72 -0
  40. unsat-0.1.0/src/unsat/syntax/walk.py +618 -0
  41. unsat-0.1.0/src/unsat/tactics/__init__.py +51 -0
  42. unsat-0.1.0/src/unsat/tactics/base.py +40 -0
  43. unsat-0.1.0/src/unsat/tactics/bitblast.py +1209 -0
  44. unsat-0.1.0/src/unsat/tactics/ctx_simplify.py +254 -0
  45. unsat-0.1.0/src/unsat/tactics/elim.py +586 -0
  46. unsat-0.1.0/src/unsat/tactics/nnf.py +229 -0
  47. unsat-0.1.0/src/unsat/tactics/simplify.py +198 -0
  48. unsat-0.1.0/src/unsat/tactics/skolem.py +191 -0
  49. unsat-0.1.0/src/unsat/theories/__init__.py +32 -0
  50. unsat-0.1.0/src/unsat/theories/arrays.py +619 -0
  51. unsat-0.1.0/src/unsat/theories/base.py +131 -0
  52. unsat-0.1.0/src/unsat/theories/euf.py +1069 -0
  53. unsat-0.1.0/src/unsat/theories/lia.py +349 -0
  54. unsat-0.1.0/src/unsat/theories/lra.py +1171 -0
unsat-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,134 @@
1
+ Metadata-Version: 2.4
2
+ Name: unsat
3
+ Version: 0.1.0
4
+ Summary: A Z3-inspired SMT solver in Python
5
+ Keywords: smt,sat,solver,cdcl,theorem-proving,formal-verification
6
+ Author: noise01
7
+ Author-email: noise01 <noisecode.01@gmail.com>
8
+ License-Expression: Apache-2.0
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
15
+ Classifier: Topic :: Software Development :: Quality Assurance
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: >=3.14
18
+ Project-URL: Homepage, https://github.com/noise01/unsat
19
+ Project-URL: Repository, https://github.com/noise01/unsat
20
+ Project-URL: Issues, https://github.com/noise01/unsat/issues
21
+ Description-Content-Type: text/markdown
22
+
23
+ # unsat
24
+
25
+ A Z3-inspired SMT solver written in pure Python 3.14+ with zero runtime dependencies.
26
+
27
+ `unsat` pairs a standalone CDCL SAT core with online CDCL(T) theory solvers (`EUF`, `LRA`, `LIA`, `Arrays`), eager bit-vector bit-blasting with shared-term propagation, Model-Based Theory Combination (`MBTC`), E-matching and MBQI quantifier instantiation, AST preprocessing tactics, a Z3Py-style Python DSL, and an SMT-LIB2 / DIMACS CLI.
28
+
29
+ ## Features
30
+
31
+ - **CDCL SAT solver (`unsat.sat`)**: Two-watched literals (dedicated binary watches + blocker literals), 1-UIP conflict learning with recursive minimization, EVSIDS, phase saving, Glucose LBD restarts and DB reduction, incremental assumptions, assumption-based `unsat_core()`, lazy theory explanation hooks, and resource budgets (`max_conflicts`, `deadline`).
32
+ - **Theories & Combination (`unsat.theories`, `unsat.smt`)**:
33
+ - **EUF**: Congruence closure with signature table, copy-free trail-undo log, and proof forest minimal conflict explanations.
34
+ - **LRA / LIA**: Exact rational `fractions.Fraction` Simplex with infinitesimals (`a + b * delta`), branch-and-bound, and Gomory cuts.
35
+ - **Bit-Vectors**: Word-level simplification and Tseitin/AIG bit-blasting with shared-term bit propagation.
36
+ - **Arrays**: Lazy Read-over-Write (`select` / `store`), constant arrays (`const`), and extensionality lemmas.
37
+ - **MBTC**: Model-Based Theory Combination across EUF, arithmetic, bit-vectors, and arrays.
38
+ - **Quantifiers (`unsat.quantifiers`)**: E-matching with pattern tables and Model-Based Quantifier Instantiation (`MBQI`) bounded by configurable round/match/conflict/timeout budgets.
39
+ - **Tactics (`unsat.tactics`)**: Composable AST preprocessing (`SimplifyTactic`, `NNFTactic`, `BitBlastTactic`, `SkolemizeTactic`, `CtxSimplifyTactic`, `GaussianElimTactic`, `PropagateBoundsTactic`) with `ModelConverter` reconstruction via `solve_with_tactic`.
40
+ - **Frontends (`unsat.api`, `unsat.parser`, `unsat.cli`)**: Python DSL (`Solver`, `Int`, `Real`, `BitVec`, `Array`, `Bool`, `Function`, `ForAll`, `Exists`), DIMACS CNF parser/formatter, and interactive SMT-LIB2 command runner.
41
+
42
+ ## Supported SMT-LIB2 Logics & Commands
43
+
44
+ - **Logics**: `QF_BOOL`, `QF_UF`, `QF_LRA`, `QF_LIA`, `QF_UFLRA`, `QF_UFLIA`, `QF_LIRA`, `QF_BV`, `QF_UFBV`, `QF_AX`, `QF_ABV`, `QF_AUFBV`, `QF_ALIA`, `QF_ALRA`, `QF_AUFLIA`, `QF_AUFLRA`, `QF_AUFLIRA`, `UF`, `LIA`, `LRA`, `LIRA`, `UFLIA`, `UFLRA`, `UFLIRA`, `BV`, `UFBV`, `AX`, `ABV`, `AUFBV`, `ALIA`, `ALRA`, `AUFLIA`, `AUFLRA`, `AUFLIRA`, `ALL`.
45
+ - **Commands**: `set-logic`, `set-option`, `set-info`, `declare-sort`, `define-sort`, `declare-const`, `declare-fun`, `define-fun`, `assert` (with top-level `:named`), `check-sat`, `check-sat-assuming`, `get-model`, `get-value`, `get-unsat-core`, `get-assertions`, `push`, `pop`, `reset`, `reset-assertions`, `echo`, `exit`.
46
+
47
+ ## Installation
48
+
49
+ Requires Python 3.14 or newer.
50
+
51
+ ```bash
52
+ uv add unsat
53
+ # or
54
+ pip install unsat
55
+ ```
56
+
57
+ For local development (includes `pytest`, `hypothesis`, `z3-solver` for differential tests, `ruff`, `ty`, `import-linter`, and `rumdl`):
58
+
59
+ ```bash
60
+ uv sync --locked --all-extras --dev
61
+ ```
62
+
63
+ ## Quick Start
64
+
65
+ ### Python DSL
66
+
67
+ ```python
68
+ from unsat import Eq, Int, IntVal, SAT, Solver
69
+
70
+ x, y = Int("x"), Int("y")
71
+ solver = Solver(timeout=5.0, max_conflicts=10_000)
72
+ solver.add(Eq(x + y, IntVal(10)), x > y, y >= 2)
73
+
74
+ if solver.check() is SAT:
75
+ model = solver.model()
76
+ print(model.eval_int(x), model.eval_int(y))
77
+ ```
78
+
79
+ ### Preprocessing Tactics
80
+
81
+ ```python
82
+ from unsat import Context
83
+ from unsat.smt import SolveResult, solve_with_tactic
84
+ from unsat.tactics import (
85
+ CtxSimplifyTactic,
86
+ GaussianElimTactic,
87
+ PropagateBoundsTactic,
88
+ SimplifyTactic,
89
+ Then,
90
+ )
91
+
92
+ ctx = Context()
93
+ x, y = ctx.mk_int("x"), ctx.mk_int("y")
94
+ pipeline = Then(
95
+ CtxSimplifyTactic(),
96
+ GaussianElimTactic(),
97
+ PropagateBoundsTactic(),
98
+ SimplifyTactic(),
99
+ )
100
+ verdict, model = solve_with_tactic([ctx.mk_eq(x, y + 3), y >= 4, x <= 10], pipeline)
101
+ assert verdict is SolveResult.SAT and model is not None
102
+ ```
103
+
104
+ ### Command Line Interface
105
+
106
+ ```bash
107
+ unsat problem.smt2
108
+ unsat problem.cnf --stats --timeout 5.0 --max-conflicts 5000
109
+ python -m unsat - --format smt2 < script.smt2
110
+ ```
111
+
112
+ Available CLI options include `--format {auto,dimacs,smt2}`, `--stats`, `--timeout`, `--max-conflicts`, `--max-quantifier-rounds`, `--max-quantifier-matches`, and `--version`.
113
+
114
+ ## Development & Benchmarks
115
+
116
+ ```bash
117
+ uv run ruff check .
118
+ uv run ruff format --check .
119
+ uv run ty check
120
+ uv run lint-imports
121
+ uv run rumdl check .
122
+ uv run pytest tests
123
+ uv run python benchmarks/run.py --check
124
+ uv run python benchmarks/run.py --z3 --check
125
+ ```
126
+
127
+ ## Documentation
128
+
129
+ - [Architecture & Module Layout](docs/architecture.md)
130
+ - [Design & Roadmap](docs/roadmap.md)
131
+
132
+ ## License
133
+
134
+ Licensed under the [Apache License 2.0](LICENSE).
unsat-0.1.0/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # unsat
2
+
3
+ A Z3-inspired SMT solver written in pure Python 3.14+ with zero runtime dependencies.
4
+
5
+ `unsat` pairs a standalone CDCL SAT core with online CDCL(T) theory solvers (`EUF`, `LRA`, `LIA`, `Arrays`), eager bit-vector bit-blasting with shared-term propagation, Model-Based Theory Combination (`MBTC`), E-matching and MBQI quantifier instantiation, AST preprocessing tactics, a Z3Py-style Python DSL, and an SMT-LIB2 / DIMACS CLI.
6
+
7
+ ## Features
8
+
9
+ - **CDCL SAT solver (`unsat.sat`)**: Two-watched literals (dedicated binary watches + blocker literals), 1-UIP conflict learning with recursive minimization, EVSIDS, phase saving, Glucose LBD restarts and DB reduction, incremental assumptions, assumption-based `unsat_core()`, lazy theory explanation hooks, and resource budgets (`max_conflicts`, `deadline`).
10
+ - **Theories & Combination (`unsat.theories`, `unsat.smt`)**:
11
+ - **EUF**: Congruence closure with signature table, copy-free trail-undo log, and proof forest minimal conflict explanations.
12
+ - **LRA / LIA**: Exact rational `fractions.Fraction` Simplex with infinitesimals (`a + b * delta`), branch-and-bound, and Gomory cuts.
13
+ - **Bit-Vectors**: Word-level simplification and Tseitin/AIG bit-blasting with shared-term bit propagation.
14
+ - **Arrays**: Lazy Read-over-Write (`select` / `store`), constant arrays (`const`), and extensionality lemmas.
15
+ - **MBTC**: Model-Based Theory Combination across EUF, arithmetic, bit-vectors, and arrays.
16
+ - **Quantifiers (`unsat.quantifiers`)**: E-matching with pattern tables and Model-Based Quantifier Instantiation (`MBQI`) bounded by configurable round/match/conflict/timeout budgets.
17
+ - **Tactics (`unsat.tactics`)**: Composable AST preprocessing (`SimplifyTactic`, `NNFTactic`, `BitBlastTactic`, `SkolemizeTactic`, `CtxSimplifyTactic`, `GaussianElimTactic`, `PropagateBoundsTactic`) with `ModelConverter` reconstruction via `solve_with_tactic`.
18
+ - **Frontends (`unsat.api`, `unsat.parser`, `unsat.cli`)**: Python DSL (`Solver`, `Int`, `Real`, `BitVec`, `Array`, `Bool`, `Function`, `ForAll`, `Exists`), DIMACS CNF parser/formatter, and interactive SMT-LIB2 command runner.
19
+
20
+ ## Supported SMT-LIB2 Logics & Commands
21
+
22
+ - **Logics**: `QF_BOOL`, `QF_UF`, `QF_LRA`, `QF_LIA`, `QF_UFLRA`, `QF_UFLIA`, `QF_LIRA`, `QF_BV`, `QF_UFBV`, `QF_AX`, `QF_ABV`, `QF_AUFBV`, `QF_ALIA`, `QF_ALRA`, `QF_AUFLIA`, `QF_AUFLRA`, `QF_AUFLIRA`, `UF`, `LIA`, `LRA`, `LIRA`, `UFLIA`, `UFLRA`, `UFLIRA`, `BV`, `UFBV`, `AX`, `ABV`, `AUFBV`, `ALIA`, `ALRA`, `AUFLIA`, `AUFLRA`, `AUFLIRA`, `ALL`.
23
+ - **Commands**: `set-logic`, `set-option`, `set-info`, `declare-sort`, `define-sort`, `declare-const`, `declare-fun`, `define-fun`, `assert` (with top-level `:named`), `check-sat`, `check-sat-assuming`, `get-model`, `get-value`, `get-unsat-core`, `get-assertions`, `push`, `pop`, `reset`, `reset-assertions`, `echo`, `exit`.
24
+
25
+ ## Installation
26
+
27
+ Requires Python 3.14 or newer.
28
+
29
+ ```bash
30
+ uv add unsat
31
+ # or
32
+ pip install unsat
33
+ ```
34
+
35
+ For local development (includes `pytest`, `hypothesis`, `z3-solver` for differential tests, `ruff`, `ty`, `import-linter`, and `rumdl`):
36
+
37
+ ```bash
38
+ uv sync --locked --all-extras --dev
39
+ ```
40
+
41
+ ## Quick Start
42
+
43
+ ### Python DSL
44
+
45
+ ```python
46
+ from unsat import Eq, Int, IntVal, SAT, Solver
47
+
48
+ x, y = Int("x"), Int("y")
49
+ solver = Solver(timeout=5.0, max_conflicts=10_000)
50
+ solver.add(Eq(x + y, IntVal(10)), x > y, y >= 2)
51
+
52
+ if solver.check() is SAT:
53
+ model = solver.model()
54
+ print(model.eval_int(x), model.eval_int(y))
55
+ ```
56
+
57
+ ### Preprocessing Tactics
58
+
59
+ ```python
60
+ from unsat import Context
61
+ from unsat.smt import SolveResult, solve_with_tactic
62
+ from unsat.tactics import (
63
+ CtxSimplifyTactic,
64
+ GaussianElimTactic,
65
+ PropagateBoundsTactic,
66
+ SimplifyTactic,
67
+ Then,
68
+ )
69
+
70
+ ctx = Context()
71
+ x, y = ctx.mk_int("x"), ctx.mk_int("y")
72
+ pipeline = Then(
73
+ CtxSimplifyTactic(),
74
+ GaussianElimTactic(),
75
+ PropagateBoundsTactic(),
76
+ SimplifyTactic(),
77
+ )
78
+ verdict, model = solve_with_tactic([ctx.mk_eq(x, y + 3), y >= 4, x <= 10], pipeline)
79
+ assert verdict is SolveResult.SAT and model is not None
80
+ ```
81
+
82
+ ### Command Line Interface
83
+
84
+ ```bash
85
+ unsat problem.smt2
86
+ unsat problem.cnf --stats --timeout 5.0 --max-conflicts 5000
87
+ python -m unsat - --format smt2 < script.smt2
88
+ ```
89
+
90
+ Available CLI options include `--format {auto,dimacs,smt2}`, `--stats`, `--timeout`, `--max-conflicts`, `--max-quantifier-rounds`, `--max-quantifier-matches`, and `--version`.
91
+
92
+ ## Development & Benchmarks
93
+
94
+ ```bash
95
+ uv run ruff check .
96
+ uv run ruff format --check .
97
+ uv run ty check
98
+ uv run lint-imports
99
+ uv run rumdl check .
100
+ uv run pytest tests
101
+ uv run python benchmarks/run.py --check
102
+ uv run python benchmarks/run.py --z3 --check
103
+ ```
104
+
105
+ ## Documentation
106
+
107
+ - [Architecture & Module Layout](docs/architecture.md)
108
+ - [Design & Roadmap](docs/roadmap.md)
109
+
110
+ ## License
111
+
112
+ Licensed under the [Apache License 2.0](LICENSE).
@@ -0,0 +1,183 @@
1
+ [project]
2
+ name = "unsat"
3
+ version = "0.1.0"
4
+ description = "A Z3-inspired SMT solver in Python"
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ requires-python = ">=3.14"
8
+ dependencies = []
9
+ keywords = [
10
+ "smt",
11
+ "sat",
12
+ "solver",
13
+ "cdcl",
14
+ "theorem-proving",
15
+ "formal-verification",
16
+ ]
17
+ classifiers = [
18
+ "Development Status :: 3 - Alpha",
19
+ "Intended Audience :: Developers",
20
+ "Intended Audience :: Science/Research",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.14",
23
+ "Topic :: Scientific/Engineering :: Mathematics",
24
+ "Topic :: Software Development :: Quality Assurance",
25
+ "Typing :: Typed",
26
+ ]
27
+
28
+ [[project.authors]]
29
+ name = "noise01"
30
+ email = "noisecode.01@gmail.com"
31
+
32
+ [project.urls]
33
+ Homepage = "https://github.com/noise01/unsat"
34
+ Repository = "https://github.com/noise01/unsat"
35
+ Issues = "https://github.com/noise01/unsat/issues"
36
+
37
+ [project.scripts]
38
+ unsat = "unsat.cli:main"
39
+
40
+ [build-system]
41
+ requires = ["uv_build>=0.13.9,<0.14.0"]
42
+ build-backend = "uv_build"
43
+
44
+ [dependency-groups]
45
+ dev = [
46
+ "hypothesis>=6.170.17",
47
+ "import-linter>=2.17",
48
+ "pytest>=9.2.0",
49
+ "pytest-timeout>=2.4.0",
50
+ "ruff>=0.17.6",
51
+ "rumdl>=0.3.5",
52
+ "ty>=0.0.107",
53
+ "z3-solver>=4.13",
54
+ ]
55
+
56
+ [tool.pytest.ini_options]
57
+ timeout = 30
58
+
59
+ [tool.ruff]
60
+ target-version = "py314"
61
+
62
+ [tool.ruff.lint]
63
+ select = [
64
+ "E",
65
+ "F",
66
+ "I",
67
+ "UP",
68
+ "B",
69
+ "SIM",
70
+ "RUF",
71
+ "PT",
72
+ ]
73
+
74
+ [tool.importlinter]
75
+ root_package = "unsat"
76
+
77
+ [[tool.importlinter.contracts]]
78
+ name = "Layered solver architecture"
79
+ type = "layers"
80
+ containers = ["unsat"]
81
+ exhaustive = true
82
+ layers = [
83
+ "__main__",
84
+ "cli",
85
+ "parser | api",
86
+ "smt",
87
+ "quantifiers",
88
+ "theories | tactics",
89
+ "model",
90
+ "syntax | sat",
91
+ ]
92
+
93
+ [[tool.importlinter.contracts]]
94
+ name = "Internal modules must not import the public facade"
95
+ type = "protected"
96
+ protected_modules = ["unsat"]
97
+ allowed_importers = []
98
+ as_packages = false
99
+
100
+ [[tool.importlinter.contracts]]
101
+ name = "The public facade imports only api directly"
102
+ type = "forbidden"
103
+ source_modules = ["unsat"]
104
+ forbidden_modules = ["unsat.**"]
105
+ as_packages = false
106
+ allow_indirect_imports = true
107
+ ignore_imports = ["unsat -> unsat.api"]
108
+ unmatched_ignore_imports_alerting = "none"
109
+
110
+ [[tool.importlinter.contracts]]
111
+ name = "Main entry point delegates exclusively to cli"
112
+ type = "forbidden"
113
+ source_modules = ["unsat.__main__"]
114
+ forbidden_modules = [
115
+ "unsat.parser",
116
+ "unsat.api",
117
+ "unsat.smt",
118
+ "unsat.quantifiers",
119
+ "unsat.theories",
120
+ "unsat.tactics",
121
+ "unsat.model",
122
+ "unsat.syntax",
123
+ "unsat.sat",
124
+ ]
125
+ allow_indirect_imports = true
126
+
127
+ [[tool.importlinter.contracts]]
128
+ name = "CLI accesses solver internals through parser, smt and sat"
129
+ type = "forbidden"
130
+ source_modules = ["unsat.cli"]
131
+ forbidden_modules = [
132
+ "unsat.api",
133
+ "unsat.quantifiers",
134
+ "unsat.theories",
135
+ "unsat.tactics",
136
+ "unsat.model",
137
+ "unsat.syntax",
138
+ ]
139
+ allow_indirect_imports = true
140
+
141
+ [[tool.importlinter.contracts]]
142
+ name = "Parser accesses solver internals through smt, sat, model and syntax"
143
+ type = "forbidden"
144
+ source_modules = ["unsat.parser"]
145
+ forbidden_modules = [
146
+ "unsat.quantifiers",
147
+ "unsat.theories",
148
+ "unsat.tactics",
149
+ ]
150
+ allow_indirect_imports = true
151
+
152
+ [[tool.importlinter.contracts]]
153
+ name = "API accesses solver internals through smt"
154
+ type = "forbidden"
155
+ source_modules = ["unsat.api"]
156
+ forbidden_modules = [
157
+ "unsat.sat",
158
+ "unsat.quantifiers",
159
+ "unsat.theories",
160
+ "unsat.tactics",
161
+ ]
162
+ allow_indirect_imports = true
163
+
164
+ [[tool.importlinter.contracts]]
165
+ name = "Lower layers must not depend on sat"
166
+ type = "forbidden"
167
+ source_modules = [
168
+ "unsat.quantifiers",
169
+ "unsat.theories",
170
+ "unsat.tactics",
171
+ "unsat.model",
172
+ "unsat.syntax",
173
+ ]
174
+ forbidden_modules = ["unsat.sat"]
175
+
176
+ [[tool.importlinter.contracts]]
177
+ name = "Quantifiers must not depend on tactics"
178
+ type = "forbidden"
179
+ source_modules = ["unsat.quantifiers"]
180
+ forbidden_modules = ["unsat.tactics"]
181
+
182
+ [tool.rumdl]
183
+ disable = ["MD013"]
@@ -0,0 +1,174 @@
1
+ [project]
2
+ name = "unsat"
3
+ version = "0.1.0"
4
+ description = "A Z3-inspired SMT solver in Python"
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ authors = [
8
+ { name = "noise01", email = "noisecode.01@gmail.com" }
9
+ ]
10
+ requires-python = ">=3.14"
11
+ dependencies = []
12
+ keywords = [
13
+ "smt",
14
+ "sat",
15
+ "solver",
16
+ "cdcl",
17
+ "theorem-proving",
18
+ "formal-verification",
19
+ ]
20
+ classifiers = [
21
+ "Development Status :: 3 - Alpha",
22
+ "Intended Audience :: Developers",
23
+ "Intended Audience :: Science/Research",
24
+ "Programming Language :: Python :: 3",
25
+ "Programming Language :: Python :: 3.14",
26
+ "Topic :: Scientific/Engineering :: Mathematics",
27
+ "Topic :: Software Development :: Quality Assurance",
28
+ "Typing :: Typed",
29
+ ]
30
+
31
+ [project.urls]
32
+ Homepage = "https://github.com/noise01/unsat"
33
+ Repository = "https://github.com/noise01/unsat"
34
+ Issues = "https://github.com/noise01/unsat/issues"
35
+
36
+ [project.scripts]
37
+ unsat = "unsat.cli:main"
38
+
39
+ [build-system]
40
+ requires = ["uv_build>=0.13.9,<0.14.0"]
41
+ build-backend = "uv_build"
42
+
43
+ [dependency-groups]
44
+ dev = [
45
+ "hypothesis>=6.170.17",
46
+ "import-linter>=2.17",
47
+ "pytest>=9.2.0",
48
+ "pytest-timeout>=2.4.0",
49
+ "ruff>=0.17.6",
50
+ "rumdl>=0.3.5",
51
+ "ty>=0.0.107",
52
+ "z3-solver>=4.13",
53
+ ]
54
+
55
+ [tool.pytest.ini_options]
56
+ timeout = 30
57
+
58
+ [tool.ruff]
59
+ target-version = "py314"
60
+
61
+ [tool.ruff.lint]
62
+ select = ["E", "F", "I", "UP", "B", "SIM", "RUF", "PT"]
63
+
64
+ [tool.importlinter]
65
+ root_package = "unsat"
66
+
67
+ [[tool.importlinter.contracts]]
68
+ name = "Layered solver architecture"
69
+ type = "layers"
70
+ containers = ["unsat"]
71
+ exhaustive = true
72
+ layers = [
73
+ "__main__",
74
+ "cli",
75
+ "parser | api",
76
+ "smt",
77
+ "quantifiers",
78
+ "theories | tactics",
79
+ "model",
80
+ "syntax | sat",
81
+ ]
82
+
83
+ [[tool.importlinter.contracts]]
84
+ name = "Internal modules must not import the public facade"
85
+ type = "protected"
86
+ protected_modules = ["unsat"]
87
+ allowed_importers = []
88
+ as_packages = false
89
+
90
+ [[tool.importlinter.contracts]]
91
+ name = "The public facade imports only api directly"
92
+ type = "forbidden"
93
+ source_modules = ["unsat"]
94
+ forbidden_modules = ["unsat.**"]
95
+ as_packages = false
96
+ allow_indirect_imports = true
97
+ ignore_imports = ["unsat -> unsat.api"]
98
+ unmatched_ignore_imports_alerting = "none"
99
+
100
+ [[tool.importlinter.contracts]]
101
+ name = "Main entry point delegates exclusively to cli"
102
+ type = "forbidden"
103
+ source_modules = ["unsat.__main__"]
104
+ forbidden_modules = [
105
+ "unsat.parser",
106
+ "unsat.api",
107
+ "unsat.smt",
108
+ "unsat.quantifiers",
109
+ "unsat.theories",
110
+ "unsat.tactics",
111
+ "unsat.model",
112
+ "unsat.syntax",
113
+ "unsat.sat",
114
+ ]
115
+ allow_indirect_imports = true
116
+
117
+ [[tool.importlinter.contracts]]
118
+ name = "CLI accesses solver internals through parser, smt and sat"
119
+ type = "forbidden"
120
+ source_modules = ["unsat.cli"]
121
+ forbidden_modules = [
122
+ "unsat.api",
123
+ "unsat.quantifiers",
124
+ "unsat.theories",
125
+ "unsat.tactics",
126
+ "unsat.model",
127
+ "unsat.syntax",
128
+ ]
129
+ allow_indirect_imports = true
130
+
131
+ [[tool.importlinter.contracts]]
132
+ name = "Parser accesses solver internals through smt, sat, model and syntax"
133
+ type = "forbidden"
134
+ source_modules = ["unsat.parser"]
135
+ forbidden_modules = [
136
+ "unsat.quantifiers",
137
+ "unsat.theories",
138
+ "unsat.tactics",
139
+ ]
140
+ allow_indirect_imports = true
141
+
142
+ [[tool.importlinter.contracts]]
143
+ name = "API accesses solver internals through smt"
144
+ type = "forbidden"
145
+ source_modules = ["unsat.api"]
146
+ forbidden_modules = ["unsat.sat", "unsat.quantifiers", "unsat.theories", "unsat.tactics"]
147
+ allow_indirect_imports = true
148
+
149
+ [[tool.importlinter.contracts]]
150
+ name = "Lower layers must not depend on sat"
151
+ type = "forbidden"
152
+ source_modules = [
153
+ "unsat.quantifiers",
154
+ "unsat.theories",
155
+ "unsat.tactics",
156
+ "unsat.model",
157
+ "unsat.syntax",
158
+ ]
159
+ forbidden_modules = [
160
+ "unsat.sat",
161
+ ]
162
+
163
+ [[tool.importlinter.contracts]]
164
+ name = "Quantifiers must not depend on tactics"
165
+ type = "forbidden"
166
+ source_modules = [
167
+ "unsat.quantifiers",
168
+ ]
169
+ forbidden_modules = [
170
+ "unsat.tactics",
171
+ ]
172
+
173
+ [tool.rumdl]
174
+ disable = ["MD013"]