vnnlib-test-solver 2.0.0__tar.gz → 2.0.1__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 (77) hide show
  1. vnnlib_test_solver-2.0.1/CHANGELOG.md +16 -0
  2. vnnlib_test_solver-2.0.1/CONTRIBUTING.md +52 -0
  3. vnnlib_test_solver-2.0.1/PKG-INFO +100 -0
  4. vnnlib_test_solver-2.0.1/README.md +66 -0
  5. vnnlib_test_solver-2.0.1/docs/CONFIGURATION.md +261 -0
  6. vnnlib_test_solver-2.0.1/examples/README.md +40 -0
  7. vnnlib_test_solver-2.0.1/examples/capabilities.toml +29 -0
  8. vnnlib_test_solver-2.0.1/examples/misbehaving.toml +24 -0
  9. vnnlib_test_solver-2.0.1/examples/results.toml +24 -0
  10. vnnlib_test_solver-2.0.1/examples/worked-example.toml +19 -0
  11. vnnlib_test_solver-2.0.1/pyproject.toml +94 -0
  12. vnnlib_test_solver-2.0.1/src/vnnlib_test_solver/__init__.py +1 -0
  13. vnnlib_test_solver-2.0.0/CHANGELOG.md +0 -252
  14. vnnlib_test_solver-2.0.0/CONTRIBUTING.md +0 -186
  15. vnnlib_test_solver-2.0.0/PKG-INFO +0 -176
  16. vnnlib_test_solver-2.0.0/README.md +0 -142
  17. vnnlib_test_solver-2.0.0/docs/CONFIGURATION.md +0 -636
  18. vnnlib_test_solver-2.0.0/examples/README.md +0 -61
  19. vnnlib_test_solver-2.0.0/examples/capabilities.toml +0 -45
  20. vnnlib_test_solver-2.0.0/examples/misbehaving.toml +0 -48
  21. vnnlib_test_solver-2.0.0/examples/results.toml +0 -37
  22. vnnlib_test_solver-2.0.0/examples/worked-example.toml +0 -35
  23. vnnlib_test_solver-2.0.0/pyproject.toml +0 -143
  24. vnnlib_test_solver-2.0.0/src/vnnlib_test_solver/__init__.py +0 -1
  25. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/.gitignore +0 -0
  26. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/LICENSE +0 -0
  27. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/examples/f.onnx +0 -0
  28. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/examples/g.onnx +0 -0
  29. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/src/vnnlib_test_solver/assignments.py +0 -0
  30. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/src/vnnlib_test_solver/cli.py +0 -0
  31. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/src/vnnlib_test_solver/config.py +0 -0
  32. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/src/vnnlib_test_solver/dtypes.py +0 -0
  33. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/src/vnnlib_test_solver/errors.py +0 -0
  34. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/src/vnnlib_test_solver/injection.py +0 -0
  35. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/src/vnnlib_test_solver/py.typed +0 -0
  36. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/src/vnnlib_test_solver/querymodel.py +0 -0
  37. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/src/vnnlib_test_solver/rules.py +0 -0
  38. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/src/vnnlib_test_solver/spec.py +0 -0
  39. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/src/vnnlib_test_solver/supports.py +0 -0
  40. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/src/vnnlib_test_solver/validation.py +0 -0
  41. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/src/vnnlib_test_solver/verify.py +0 -0
  42. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/conftest.py +0 -0
  43. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/fixtures/all_real.vnnlib +0 -0
  44. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/fixtures/duplicate_network_name.vnnlib +0 -0
  45. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/fixtures/equal_to.vnnlib +0 -0
  46. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/fixtures/isomorphic.vnnlib +0 -0
  47. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/fixtures/mixed_types.vnnlib +0 -0
  48. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/fixtures/unusual_but_legal.vnnlib +0 -0
  49. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/fixtures/worked_example.vnnlib +0 -0
  50. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/golden/injected_extra_output.stdout +0 -0
  51. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/golden/injected_nothing.stdout +0 -0
  52. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/golden/result_sat.stdout +0 -0
  53. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/golden/result_timed_out.stdout +0 -0
  54. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/golden/result_unknown.stdout +0 -0
  55. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/golden/result_unsat.stdout +0 -0
  56. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/golden/supports_boolean.stdout +0 -0
  57. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/golden/supports_element_types.stdout +0 -0
  58. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/golden/supports_operators.stdout +0 -0
  59. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/golden/supports_opset_versions.stdout +0 -0
  60. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/golden/worked_example.stdout +0 -0
  61. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_assignments.py +0 -0
  62. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_cli.py +0 -0
  63. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_config.py +0 -0
  64. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_conformance.py +0 -0
  65. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_contract.py +0 -0
  66. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_determinism.py +0 -0
  67. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_error_conditions.py +0 -0
  68. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_injection.py +0 -0
  69. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_network_mapping.py +0 -0
  70. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_not_over_policed.py +0 -0
  71. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_output_bytes.py +0 -0
  72. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_packaging.py +0 -0
  73. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_querymodel.py +0 -0
  74. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_rules.py +0 -0
  75. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_supports.py +0 -0
  76. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_timeout.py +0 -0
  77. {vnnlib_test_solver-2.0.0 → vnnlib_test_solver-2.0.1}/tests/test_verify.py +0 -0
@@ -0,0 +1,16 @@
1
+ # Version 2.0.1
2
+
3
+ * Widened the `vnnlib` requirement from `==1.0.2` to `>=1.0.2,<2`, so that the package can be installed alongside a newer 1.x release of that library.
4
+
5
+ # Version 2.0.0
6
+
7
+ * Breaking changes:
8
+ - Renamed the command from `vnnlib-test-solver` to `vnnlibTestSolver`, and the configuration file it looks for in the working directory to `vnnlibTestSolver.toml`. Neither old spelling is accepted. The distribution is still installed as `vnnlib-test-solver`.
9
+ - Removed the default configuration. A run with no `--config`, no `VNNLIB_TEST_SOLVER_CONFIG` and no `vnnlibTestSolver.toml` now exits `2` instead of answering `unknown` and reporting a full set of capabilities. This applies to `--name` and `--version` as well as to `verify`.
10
+ - Restricted the `real` exemption to queries that use `real` exclusively, per the definition of a real-valued query in section 3.5. A query mixing `real` with another element type is no longer exempt from the section 5.3.2 error conditions, including for its `real` variables; a query written entirely in `real` is unaffected.
11
+ * Removed the warning issued when `[capabilities]` reports the `real` element type without a matching `[soundness]` claim. Reporting `float32` or `float64` unclaimed still warns.
12
+ * First version published to PyPI.
13
+
14
+ # Version 1.0.0
15
+
16
+ * Initial release.
@@ -0,0 +1,52 @@
1
+ # Contributing to VNNLIB-Test-Solver
2
+
3
+ ## Setting up the project
4
+
5
+ 1. Clone the repository and create a virtual environment:
6
+ ```bash
7
+ git clone https://github.com/VNNLIB/VNNLIB-Test-Solver.git
8
+ cd VNNLIB-Test-Solver
9
+ python -m venv .venv
10
+ source .venv/bin/activate # On Windows: .venv\Scripts\activate
11
+ ```
12
+
13
+ 2. Install the package in editable mode along with the development dependencies:
14
+ ```bash
15
+ pip install -e ".[dev]"
16
+ ```
17
+
18
+ ## Building and Testing
19
+
20
+ Run the checks:
21
+ ```bash
22
+ pytest # the test suite
23
+ pytest -m contract # the published command line surface, on its own
24
+ ruff check . # lint
25
+ ruff format --check . # formatting
26
+ mypy # type checking
27
+ ```
28
+
29
+ Three conventions to know before adding a test:
30
+
31
+ - Tests run the installed `vnnlibTestSolver` as a subprocess rather than importing the package, so an editable install is what makes them exercise your changes.
32
+ - `stdout` is compared as raw bytes against the files in `tests/golden/`. When one fails, establish which of the two is wrong rather than regenerating it.
33
+ - `vnnlib` is imported only in `querymodel.py`, which converts the parser's objects into plain strings, integers and tuples. It imports from `vnnlib.query` and falls back to the top level names, so it works either side of that library's namespace migration.
34
+
35
+ The **Build-and-Test** workflow runs on every pull request: the suite on Ubuntu, macOS and Windows against Python 3.9, 3.11 and 3.13; lint and type checking; and an install into a container with no build toolchain.
36
+
37
+ ## Making a release
38
+
39
+ 1. Update the version in `pyproject.toml` and `src/vnnlib_test_solver/__init__.py`.
40
+
41
+ 2. Update `README.md` with a new entry to the compatibility table.
42
+
43
+ 3. Update `CHANGELOG.md` with the new version and changes.
44
+
45
+ 4. Create a new Release on GitHub:
46
+ - Tag the version (e.g., `v2.0.1`).
47
+ - Provide a title and description.
48
+ - Publish the release.
49
+
50
+ 5. The **Build-and-Deploy** GitHub workflow will automatically trigger:
51
+ - It builds the source distribution and the wheel, and checks both before uploading.
52
+ - It uploads them to PyPI (or TestPyPI if the workflow is run manually with that target).
@@ -0,0 +1,100 @@
1
+ Metadata-Version: 2.5
2
+ Name: vnnlib-test-solver
3
+ Version: 2.0.1
4
+ Summary: A configurable test solver implementing the VNN-LIB standard's command-line interface.
5
+ Project-URL: Homepage, https://github.com/VNNLIB/VNNLIB-Test-Solver
6
+ Project-URL: Repository, https://github.com/VNNLIB/VNNLIB-Test-Solver
7
+ Project-URL: Changelog, https://github.com/VNNLIB/VNNLIB-Test-Solver/blob/main/CHANGELOG.md
8
+ Project-URL: Issues, https://github.com/VNNLIB/VNNLIB-Test-Solver/issues
9
+ Author: VNNLIB
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: conformance,neural-network,testing,verification,vnnlib
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Software Development :: Testing
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.9
25
+ Requires-Dist: tomli>=2.0; python_version < '3.11'
26
+ Requires-Dist: vnnlib<2,>=1.0.2
27
+ Provides-Extra: dev
28
+ Requires-Dist: mypy; extra == 'dev'
29
+ Requires-Dist: pytest; extra == 'dev'
30
+ Requires-Dist: ruff; extra == 'dev'
31
+ Provides-Extra: serialise
32
+ Requires-Dist: onnx; extra == 'serialise'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # VNN-LIB Test Solver
36
+
37
+ [![Build-and-Test](https://github.com/VNNLIB/VNNLIB-Test-Solver/actions/workflows/buildAndTest.yml/badge.svg)](https://github.com/VNNLIB/VNNLIB-Test-Solver/actions/workflows/buildAndTest.yml)
38
+
39
+ A configurable test solver for the [VNN-LIB format](https://www.vnnlib.org/). It implements the command line interface of chapter 5 of the standard and answers entirely from a TOML configuration file, performing no verification of its own.
40
+
41
+ It exists so that tools driving VNN-LIB solvers can be tested against a solver whose responses they choose.
42
+
43
+ ## Features
44
+
45
+ Features include:
46
+ - Results: answer `sat`, `unsat`, `unknown` or `timed-out` from `verify`, selected by the query file's name.
47
+ - Assignments: print a satisfying assignment in the command line format of section 5.3.1.
48
+ - Capabilities: answer all eleven mandatory `supports` capabilities of section 5.4.
49
+ - Identity: answer the `--name` and `--version` global options from configuration.
50
+ - Error conditions: trigger any of the three error conditions of section 5.3.2 on demand, such as a `--network` mapping naming too few or too many model files.
51
+ - Timeouts: wait a configured number of seconds, so a caller's `--timeout` handling can be exercised.
52
+ - Misbehaviour: emit unparseable output, an exit code disagreeing with the answer, noise on `stderr`, or an abnormal termination.
53
+
54
+ `--serialise-assignments` is accepted but writes no files, whatever the configuration reports for that capability.
55
+
56
+ ## Installation
57
+
58
+ Install the latest stable version via PyPI:
59
+ ```bash
60
+ pip install vnnlib-test-solver
61
+ ```
62
+
63
+ To drive it from another project's test suite, declare it among that project's test dependencies rather than its runtime ones:
64
+ ```toml
65
+ [project.optional-dependencies]
66
+ test = ["pytest", "vnnlib-test-solver>=2.0.1"]
67
+ ```
68
+
69
+ Requires Python 3.9 or later. The package is pure Python, but its `vnnlib` parser dependency is distributed only as prebuilt wheels, for Linux `x86_64`, macOS and Windows. Linux `aarch64` has neither a wheel nor a source distribution, so `pip install` cannot satisfy the dependency there.
70
+
71
+ ## Basic Usage
72
+
73
+ The solver answers only from a configuration file. A run that resolves none exits `2`.
74
+
75
+ ```toml
76
+ # my-solver.toml
77
+ [solver]
78
+ name = "My Test Solver"
79
+ version = "1.0.0"
80
+
81
+ [[rules]]
82
+ match = "*.vnnlib"
83
+ result = "sat"
84
+ ```
85
+
86
+ ```bash
87
+ vnnlibTestSolver --config my-solver.toml verify query.vnnlib
88
+ ```
89
+
90
+ Configuration is resolved from `--config`, then the `VNNLIB_TEST_SOLVER_CONFIG` environment variable, then a `vnnlibTestSolver.toml` in the working directory.
91
+
92
+ See [docs/CONFIGURATION.md](https://github.com/VNNLIB/VNNLIB-Test-Solver/blob/main/docs/CONFIGURATION.md) for every configuration key and command line option, and [examples/](https://github.com/VNNLIB/VNNLIB-Test-Solver/tree/main/examples/) for runnable configurations.
93
+
94
+ ## Version compatibility
95
+
96
+ | VNNLIB-Test-Solver version | VNNLIB version | vnnlib version |
97
+ | --- | --- | --- |
98
+ | v2.0.1 | v2.0 | >=1.0.2,<2 |
99
+ | v2.0.0 | v2.0 | 1.0.2 |
100
+ | v1.0.0 | v2.0 | 1.0.2 |
@@ -0,0 +1,66 @@
1
+ # VNN-LIB Test Solver
2
+
3
+ [![Build-and-Test](https://github.com/VNNLIB/VNNLIB-Test-Solver/actions/workflows/buildAndTest.yml/badge.svg)](https://github.com/VNNLIB/VNNLIB-Test-Solver/actions/workflows/buildAndTest.yml)
4
+
5
+ A configurable test solver for the [VNN-LIB format](https://www.vnnlib.org/). It implements the command line interface of chapter 5 of the standard and answers entirely from a TOML configuration file, performing no verification of its own.
6
+
7
+ It exists so that tools driving VNN-LIB solvers can be tested against a solver whose responses they choose.
8
+
9
+ ## Features
10
+
11
+ Features include:
12
+ - Results: answer `sat`, `unsat`, `unknown` or `timed-out` from `verify`, selected by the query file's name.
13
+ - Assignments: print a satisfying assignment in the command line format of section 5.3.1.
14
+ - Capabilities: answer all eleven mandatory `supports` capabilities of section 5.4.
15
+ - Identity: answer the `--name` and `--version` global options from configuration.
16
+ - Error conditions: trigger any of the three error conditions of section 5.3.2 on demand, such as a `--network` mapping naming too few or too many model files.
17
+ - Timeouts: wait a configured number of seconds, so a caller's `--timeout` handling can be exercised.
18
+ - Misbehaviour: emit unparseable output, an exit code disagreeing with the answer, noise on `stderr`, or an abnormal termination.
19
+
20
+ `--serialise-assignments` is accepted but writes no files, whatever the configuration reports for that capability.
21
+
22
+ ## Installation
23
+
24
+ Install the latest stable version via PyPI:
25
+ ```bash
26
+ pip install vnnlib-test-solver
27
+ ```
28
+
29
+ To drive it from another project's test suite, declare it among that project's test dependencies rather than its runtime ones:
30
+ ```toml
31
+ [project.optional-dependencies]
32
+ test = ["pytest", "vnnlib-test-solver>=2.0.1"]
33
+ ```
34
+
35
+ Requires Python 3.9 or later. The package is pure Python, but its `vnnlib` parser dependency is distributed only as prebuilt wheels, for Linux `x86_64`, macOS and Windows. Linux `aarch64` has neither a wheel nor a source distribution, so `pip install` cannot satisfy the dependency there.
36
+
37
+ ## Basic Usage
38
+
39
+ The solver answers only from a configuration file. A run that resolves none exits `2`.
40
+
41
+ ```toml
42
+ # my-solver.toml
43
+ [solver]
44
+ name = "My Test Solver"
45
+ version = "1.0.0"
46
+
47
+ [[rules]]
48
+ match = "*.vnnlib"
49
+ result = "sat"
50
+ ```
51
+
52
+ ```bash
53
+ vnnlibTestSolver --config my-solver.toml verify query.vnnlib
54
+ ```
55
+
56
+ Configuration is resolved from `--config`, then the `VNNLIB_TEST_SOLVER_CONFIG` environment variable, then a `vnnlibTestSolver.toml` in the working directory.
57
+
58
+ See [docs/CONFIGURATION.md](https://github.com/VNNLIB/VNNLIB-Test-Solver/blob/main/docs/CONFIGURATION.md) for every configuration key and command line option, and [examples/](https://github.com/VNNLIB/VNNLIB-Test-Solver/tree/main/examples/) for runnable configurations.
59
+
60
+ ## Version compatibility
61
+
62
+ | VNNLIB-Test-Solver version | VNNLIB version | vnnlib version |
63
+ | --- | --- | --- |
64
+ | v2.0.1 | v2.0 | >=1.0.2,<2 |
65
+ | v2.0.0 | v2.0 | 1.0.2 |
66
+ | v1.0.0 | v2.0 | 1.0.2 |
@@ -0,0 +1,261 @@
1
+ # Configuration reference
2
+
3
+ Every key `vnnlibTestSolver` accepts, and what it does. The [readme](../README.md) covers installing the package and answering a first query, and [`examples/`](../examples/) holds runnable configurations.
4
+
5
+ The query file supplies structure, the configuration supplies answers.
6
+
7
+ ## Configuration file
8
+
9
+ | Table | Required | Purpose |
10
+ |-------|----------|---------|
11
+ | `[solver]` | yes | The name and version the solver reports |
12
+ | `[[rules]]` | for `verify` | One entry per answer, selected by the query file's name |
13
+ | `[capabilities]` | for `supports` | The eleven capability responses |
14
+ | `[soundness]` | no | The element types the solver claims to analyse soundly |
15
+ | `[injection]` | no | Misbehaviour applied to whichever command runs |
16
+
17
+ An unknown key is refused when the configuration loads, and the message names the permitted keys.
18
+
19
+ ## `[solver]`
20
+
21
+ | Key | Type | Notes |
22
+ |-----|------|-------|
23
+ | `name` | string | Answers `--name`. May contain spaces, but not a line break |
24
+ | `version` | string | Answers `--version` |
25
+
26
+ Both are required and neither may be empty.
27
+
28
+ ## `[[rules]]`
29
+
30
+ | Key | Type | Notes |
31
+ |-----|------|-------|
32
+ | `match` | string | Glob matched against the query file's name. Required |
33
+ | `result` | string | `sat`, `unsat`, `unknown` or `timed-out`. Required |
34
+ | `delay_seconds` | integer | Seconds to wait before answering, 0 to 2147483647. Omitted means no delay |
35
+ | `assignments` | table | One array of values per declared variable |
36
+ | `model_element_types` | table | The element types the supplied model files expose |
37
+ | `stderr` | string | Text written to standard error before the answer |
38
+ | `exit_code` | integer | Process exit status, 0 to 255 |
39
+ | `raw_stdout` | string | Replaces standard output entirely |
40
+ | `crash` | boolean | Terminate abnormally instead of exiting |
41
+
42
+ The last four are the injection controls, described under [`[injection]`](#injection).
43
+
44
+ ### Matching
45
+
46
+ The first rule whose `match` pattern matches wins. Patterns are compared against the file's **name**, not the path it was given by, and matching is case sensitive on every platform. A query that no rule matches is an error naming the file and every pattern tried.
47
+
48
+ ```toml
49
+ [[rules]]
50
+ match = "sat-*.vnnlib"
51
+ result = "sat"
52
+
53
+ [[rules]]
54
+ match = "*"
55
+ result = "unknown"
56
+ ```
57
+
58
+ ### Delays
59
+
60
+ `delay_seconds` is how long the solver waits before answering. A delay longer than `--timeout` waits out the timeout and answers `timed-out`; a delay equal to the timeout answers normally; an absent `--timeout` is not a timeout of zero.
61
+
62
+ ### Assignments
63
+
64
+ A rule answering `sat` may supply the assignment to print, as one array per variable, row-major, keyed by the name the query declares:
65
+
66
+ ```toml
67
+ [[rules]]
68
+ match = "example.vnnlib"
69
+ result = "sat"
70
+
71
+ [rules.assignments]
72
+ A = [0.5, 0.3, 0.4, 0.2]
73
+ B = [-1]
74
+ Y = [0.0]
75
+ ```
76
+
77
+ Against a query declaring `A float32 [2,2]`, `B int32 [1]` and `Y float32 [1]`, that prints:
78
+
79
+ ```text
80
+ sat
81
+ A float32 [2,2]
82
+ 0.5
83
+ 0.3
84
+ 0.4
85
+ 0.2
86
+ B int32 [1]
87
+ -1
88
+ Y float32 [1]
89
+ 0.0
90
+ ```
91
+
92
+ Only the values are configured. Each variable's name, element type, dimensions and position come from the query file. Three rules follow:
93
+
94
+ - A rule covers **every** declared variable or supplies none at all.
95
+ - An array must hold exactly as many values as the declared shape has positions.
96
+ - A name the query does not declare is refused.
97
+
98
+ Variables appear in the order the query declares them: for each network in turn, its inputs, then its hidden nodes, then its outputs. A network declared `(equal-to f)` still declares its own variables and they still appear.
99
+
100
+ Values print as the **shortest representation that round-trips to the same value**, which is identical on every platform. Scientific notation is normalised, so `1e10` prints as `10000000000.0` and `1.5e-8` as `1.5e-08`. `inf`, `-inf` and `nan` pass through.
101
+
102
+ Assignments are printed for `sat` only, and the three rules above are checked only then: a wrong-length array is refused beside `result = "sat"` and passes unremarked beside `result = "unsat"`.
103
+
104
+ ### Model element types
105
+
106
+ `model_element_types` states what the supplied model files expose, keyed by variable name, since nothing here opens a model file. A variable the table does not name is taken to match; a name the query does not declare is a configuration error.
107
+
108
+ ```toml
109
+ [rules.model_element_types]
110
+ B = "float64"
111
+ ```
112
+
113
+ ## `[capabilities]`
114
+
115
+ `supports` answers one capability at a time. Each key is the flag name without its leading dashes.
116
+
117
+ | Key | Value | Response |
118
+ |-----|-------|----------|
119
+ | `onnx-opset-versions` | two strings | Two lines: minimum, then maximum |
120
+ | `vnnlib-versions` | two strings | Two lines: minimum, then maximum |
121
+ | `onnx-element-types` | list of element types | One per line |
122
+ | `onnx-operators` | array of tables | One line each: name, then its element types |
123
+ | `hidden-node-theories` | list of identifiers | One per line |
124
+ | `multiple-input-output-theories` | list of identifiers | One per line |
125
+ | `multiple-network-theories` | list of identifiers | One per line |
126
+ | `multiple-node-comparison-theories` | list of identifiers | One per line |
127
+ | `arithmetic-complexity-theories` | list of identifiers | One per line |
128
+ | `optimised-disjunctive-reasoning` | boolean | One line: `true` or `false` |
129
+ | `serialise-assignments` | boolean | One line: `true` or `false` |
130
+
131
+ A capability the file does not mention is an error, not an empty answer. An explicitly empty list is the answer "none", and prints nothing.
132
+
133
+ Only the exact flag spellings are accepted: `--onnx-e` is refused rather than resolved to `--onnx-element-types`.
134
+
135
+ ### Theory identifiers
136
+
137
+ Validated when the configuration loads, against the section 4.1 sets:
138
+
139
+ | Key | Legal identifiers |
140
+ |-----|-------------------|
141
+ | `hidden-node-theories` | `NH`, `H` |
142
+ | `multiple-input-output-theories` | `SIO`, `MIO` |
143
+ | `multiple-network-theories` | `SNET`, `MNET`, `MENET`, `MINET` |
144
+ | `multiple-node-comparison-theories` | `SNC`, `MNC` |
145
+ | `arithmetic-complexity-theories` | `BND`, `LIN`, `OUTC`, `POLY` |
146
+
147
+ ### Element types
148
+
149
+ The 21 names the standard defines, accepted wherever an element type is given:
150
+
151
+ `real`, `bool`, `int8`, `int16`, `int32`, `int64`, `uint8`, `uint16`, `uint32`, `uint64`, `float16`, `float32`, `float64`, `bfloat16`, `complex64`, `complex128`, `float4e2m1`, `float8e4m3fn`, `float8e4m3fnuz`, `float8e5m2`, `float8e5m2fnuz`
152
+
153
+ ### Operators
154
+
155
+ ```toml
156
+ [[capabilities.onnx-operators]]
157
+ name = "Gemm"
158
+ element-types = ["float32", "float64"]
159
+
160
+ [[capabilities.onnx-operators]]
161
+ name = "Relu"
162
+ ```
163
+
164
+ Omitting `element-types` means every element type the solver reports. The line is printed as configured rather than expanded.
165
+
166
+ ## `[soundness]`
167
+
168
+ | Key | Type | Notes |
169
+ |-----|------|-------|
170
+ | `sound-for` | list of element types | The types the solver claims to analyse soundly |
171
+
172
+ Reporting a type under `[capabilities]` without claiming it here is allowed, and warns on `stderr` each run. `real` is exempt from that warning.
173
+
174
+ With no `[soundness]` table, `verify` skips the soundness condition, but the warning above still fires for any reported type other than `real`. An explicitly empty `sound-for = []` is a claim, and refuses every query that is not real-valued.
175
+
176
+ ## `[injection]`
177
+
178
+ The same four keys a rule carries, applied to whichever command runs. This is the only way to reach `supports`, which has no query file and so matches no rule.
179
+
180
+ | Key | Type | Effect |
181
+ |-----|------|--------|
182
+ | `stderr` | string | Written before the answer and before any delay |
183
+ | `exit_code` | integer | Exit status, 0 to 255 |
184
+ | `raw_stdout` | string | Replaces standard output entirely; `""` suppresses it |
185
+ | `crash` | boolean | Terminates abnormally after output is flushed; by signal on Unix-like systems |
186
+
187
+ Where a rule and this table both set the same key, the rule wins **for that key alone** rather than replacing the whole table.
188
+
189
+ `crash` and `exit_code` cannot be set together, because a process that dies abnormally reports no exit status. An `exit_code` outside 0 to 255 is refused when the configuration loads, since 256 would reach the caller as 0.
190
+
191
+ **None of this applies to a run the solver refuses.** A configuration mistake, a usage mistake and each of the standard's own error conditions keep their own exit code and write nothing to standard output.
192
+
193
+ ## Command line
194
+
195
+ ```bash
196
+ vnnlibTestSolver [--config <path>] (--name | --version)
197
+ vnnlibTestSolver [--config <path>] verify <filepath> [--network <name>=<filepath>] [--timeout <seconds>] [--serialise-assignments <folder>]
198
+ vnnlibTestSolver [--config <path>] supports <capability>
199
+ ```
200
+
201
+ `--timeout` takes whole seconds, 0 to 2147483647. `--network` is given once per declared network, and mapping the same network twice is refused. A network declared `(equal-to h)` takes no model file of its own, and supplying one for it is an error.
202
+
203
+ `--serialise-assignments` is accepted but writes no files, and says so on `stderr`. That is independent of what `serialise-assignments` reports under `[capabilities]`: a configuration may report `true` and still no files appear.
204
+
205
+ ## Error conditions
206
+
207
+ Section 5.3.2 requires `verify` to error in three circumstances. All three write nothing to `stdout`, exit `1`, and carry messages distinct from one another.
208
+
209
+ | Condition | Driven by |
210
+ |-----------|-----------|
211
+ | Too few or too many model files | The `--network` arguments against the query's declarations |
212
+ | Model element types disagreeing with the query | `model_element_types` |
213
+ | No sound analysis over a declared type | `[soundness] sound-for` |
214
+
215
+ **The last two are checked only when the run opens the query file**, which happens in exactly three circumstances: a `--network` argument is given, a rule supplies `assignments`, or a rule supplies `model_element_types`. A bare `verify <path>` with none of the three answers from the rule alone and never opens the file. Opening the query also enforces the model mapping, so reaching either condition needs a complete `--network` mapping.
216
+
217
+ ### The `real` exemption
218
+
219
+ The standard exempts a real-valued query from the last two conditions. Section 3.5 defines a real-valued query as one that uses the `real` element type **exclusively**, so the exemption belongs to the whole query, not to one declaration.
220
+
221
+ A query mixing `real` with any other type carries none of it, including for its `real` variables: `sound-for = ["float32"]` still refuses such a query, naming its `real` declaration. A query in which every declaration is `real` is exempt in full and needs no claim at all, even under `sound-for = []`.
222
+
223
+ Mixing element types is not itself rejected.
224
+
225
+ ## Configuration discovery
226
+
227
+ Resolved in this order, stopping at the first source that applies:
228
+
229
+ 1. `--config <path>`
230
+ 2. The `VNNLIB_TEST_SOLVER_CONFIG` environment variable
231
+ 3. A `vnnlibTestSolver.toml` in the working directory
232
+
233
+ **There is no fourth source and no default.** If none resolves, the run exits `2` with nothing on `stdout` and a message naming all three. That applies to `--name` and `--version` as much as to `verify`.
234
+
235
+ A path that is set but does not point to an existing file is an error, never a fall-through to the next source. Setting `VNNLIB_TEST_SOLVER_DEBUG=1` prints the file a run used to `stderr`.
236
+
237
+ ## Exit codes
238
+
239
+ The standard defines none, so these are this package's own convention.
240
+
241
+ | Code | Meaning |
242
+ |------|---------|
243
+ | `0` | A result was delivered, `unsat` and `timed-out` included |
244
+ | `1` | The invocation was wrong: an unknown option, a malformed `--network` pair, a missing query file, an unknown capability |
245
+ | `2` | The configuration was wrong: missing, malformed, or unable to answer the query |
246
+
247
+ A rule or `[injection]` may set any code from 0 to 255, so these three are a convention rather than a guarantee. A configured run can pair a non-zero exit with a good answer, or an empty `stdout` with a zero exit, so do not infer either stream from the other.
248
+
249
+ ## Output guarantees
250
+
251
+ - The result is the **first line of `stdout`**, and `stdout` carries nothing else the standard does not define. Warnings, errors and the configuration-source note go to `stderr`. Only `raw_stdout` overrides this.
252
+ - Line endings on `stdout` are **`LF` on every platform**, Windows included, so a recorded response compares byte for byte across machines.
253
+ - Output is **deterministic**: the same configuration and query produce byte-identical `stdout` every time, and lists print in the order the configuration wrote them.
254
+
255
+ ## Departures from chapter 5
256
+
257
+ Serialised assignments, section 5.3.1's optional `.pb` `TensorProto` output, are not written. Section 5.3 requires the option only of a solver reporting support for it, and section 5.3.1 makes the command-line format the default every solver provides.
258
+
259
+ The assignment output matches section 5.3.1.1's worked example except for four lines. That example prints `Real` for `H`, `Y`, `C` and `Z`, which its own declarations give as `float32`, and declares `A` and `C` identically while printing them differently. This package prints the declared type. Reported as [VNNLIB-Standard#181](https://github.com/VNNLIB/VNNLIB-Standard/issues/181).
260
+
261
+ Two names are spelled two ways in chapter 5, and both spellings are accepted: `capabilities` for `supports`, and `--assignments` for `--serialise-assignments`. The second of each pair is the documented form. Reported as [VNNLIB-Standard#179](https://github.com/VNNLIB/VNNLIB-Standard/issues/179).
@@ -0,0 +1,40 @@
1
+ # Example configurations
2
+
3
+ Four configurations, each runnable as written from the root of this repository. The [configuration reference](../docs/CONFIGURATION.md) explains every key they use.
4
+
5
+ ## `results.toml` - four answers, chosen by file name
6
+
7
+ ```bash
8
+ vnnlibTestSolver --config examples/results.toml verify proved.vnnlib
9
+ vnnlibTestSolver --config examples/results.toml verify refuted.vnnlib
10
+ vnnlibTestSolver --config examples/results.toml verify anything-else.vnnlib
11
+ vnnlibTestSolver --config examples/results.toml verify slow.vnnlib --timeout 1
12
+ ```
13
+
14
+ None of those query files needs to exist, because a rule is selected by the name alone. The last command waits one second and answers `timed-out`, because its rule claims to think for thirty.
15
+
16
+ ## `capabilities.toml` - the eleven capability responses
17
+
18
+ ```bash
19
+ vnnlibTestSolver --config examples/capabilities.toml supports --onnx-element-types
20
+ vnnlibTestSolver --config examples/capabilities.toml supports --onnx-operators
21
+ vnnlibTestSolver --config examples/capabilities.toml --name
22
+ ```
23
+
24
+ ## `worked-example.toml` - the standard's own assignment example
25
+
26
+ ```bash
27
+ vnnlibTestSolver --config examples/worked-example.toml verify tests/fixtures/worked_example.vnnlib --network f=examples/f.onnx --network g=examples/g.onnx
28
+ ```
29
+
30
+ This one does need its query file: the variable names, types, dimensions and order come from the query, and only the values come from configuration. The two `.onnx` files are placeholders; the mapping only establishes that the right networks were named.
31
+
32
+ ## `misbehaving.toml` - a solver that answers wrongly on purpose
33
+
34
+ ```bash
35
+ vnnlibTestSolver --config examples/misbehaving.toml verify crash.vnnlib
36
+ vnnlibTestSolver --config examples/misbehaving.toml verify garbage.vnnlib
37
+ vnnlibTestSolver --config examples/misbehaving.toml verify noisy.vnnlib
38
+ ```
39
+
40
+ A correct answer followed by abnormal termination; a first line that is not a result; and noise on standard error beside an exit code that disagrees with the answer.
@@ -0,0 +1,29 @@
1
+ # All eleven mandatory capabilities, in the four response shapes of section 5.4.
2
+
3
+ [solver]
4
+ name = "Example Solver"
5
+ version = "1.0.0"
6
+
7
+ [capabilities]
8
+ onnx-opset-versions = ["13", "21"]
9
+ onnx-element-types = ["real"]
10
+ vnnlib-versions = ["2.0", "2.0"]
11
+ hidden-node-theories = ["NH"]
12
+ multiple-input-output-theories = ["SIO"]
13
+ multiple-network-theories = ["SNET"]
14
+ multiple-node-comparison-theories = ["SNC"]
15
+ arithmetic-complexity-theories = ["BND", "LIN"]
16
+ optimised-disjunctive-reasoning = false
17
+ serialise-assignments = false
18
+
19
+ # An operator with no element types supports every type reported above, not none.
20
+ [[capabilities.onnx-operators]]
21
+ name = "Gemm"
22
+ element-types = ["real"]
23
+
24
+ [[capabilities.onnx-operators]]
25
+ name = "Relu"
26
+
27
+ # Reporting a type above without claiming it here warns on stderr (section 5.4.1).
28
+ [soundness]
29
+ sound-for = ["real"]
@@ -0,0 +1,24 @@
1
+ # A solver that answers wrongly on purpose. None of these controls applies to a
2
+ # run the solver refuses.
3
+
4
+ [solver]
5
+ name = "Example Solver"
6
+ version = "1.0.0"
7
+
8
+ # Answers, flushes, then terminates abnormally. Setting exit_code beside it is refused.
9
+ [[rules]]
10
+ match = "crash.vnnlib"
11
+ result = "sat"
12
+ crash = true
13
+
14
+ # Replaces stdout entirely; "" suppresses it.
15
+ [[rules]]
16
+ match = "garbage.vnnlib"
17
+ result = "sat"
18
+ raw_stdout = "not-a-result-line\n"
19
+
20
+ [[rules]]
21
+ match = "noisy.vnnlib"
22
+ result = "unsat"
23
+ stderr = "solver: exploring branch 1 of 4"
24
+ exit_code = 7
@@ -0,0 +1,24 @@
1
+ # Four answers from one binary, chosen by the query file's name.
2
+
3
+ [solver]
4
+ name = "Example Solver"
5
+ version = "1.0.0"
6
+
7
+ [[rules]]
8
+ match = "proved.vnnlib"
9
+ result = "sat"
10
+
11
+ [[rules]]
12
+ match = "refuted.vnnlib"
13
+ result = "unsat"
14
+
15
+ # A delay longer than --timeout answers timed-out instead.
16
+ [[rules]]
17
+ match = "slow.vnnlib"
18
+ result = "sat"
19
+ delay_seconds = 30
20
+
21
+ # Without a catch-all, a query no rule matches is an error rather than an unknown.
22
+ [[rules]]
23
+ match = "*"
24
+ result = "unknown"
@@ -0,0 +1,19 @@
1
+ # The worked example of section 5.3.1. Only the values are configured: each
2
+ # variable's name, element type, dimensions and position come from the query file.
3
+
4
+ [solver]
5
+ name = "Example Solver"
6
+ version = "1.0.0"
7
+
8
+ [[rules]]
9
+ match = "worked_example.vnnlib"
10
+ result = "sat"
11
+
12
+ # One array per declared variable, row-major. A rule covers every variable or none.
13
+ [rules.assignments]
14
+ A = [0.5, 0.3, 0.4, 0.2]
15
+ B = [-1]
16
+ H = [0.5, 0.3]
17
+ Y = [0.1]
18
+ C = [1.0, 0.3, 0.4, 0.2]
19
+ Z = [0.0]