elenctic
A testing and analysis library for answer set programs, with a thin CLI. Claims about a program
live in its own comments (@expect, @count, @answer-set, @cautious, @brave, @query,
@cost) and are checked under clingo or clingcon.
Elenctic, from Greek ἐλεγκτικός (ἔλεγχος, elenchos), "serving to refute by
cross-examination": the Socratic elenchus. A contract is a thesis about the program; FAIL is
its refutation, and UNDECIDED is aporia, an honest "cannot say" rather than a false "no".
Install
Requires Python 3.14+ and clingo 5.8. The optional theory extra pulls in clingcon 5.2 for
contracts that declare % @elenctic solver clingcon.
# pip
pip install elenctic
pip install 'elenctic[theory]'
# uv — as a project dependency, or as a tool on PATH
uv add elenctic
uv add 'elenctic[theory]'
uv tool install elenctic
uv tool install 'elenctic[theory]'
# pixi — from PyPI
pixi add --pypi elenctic
pixi add --pypi 'elenctic[theory]'
From source, straight from Git or from a clone:
pip install 'elenctic[theory] @ git+https://github.com/GregoryGelfond/elenctic'
git clone https://github.com/GregoryGelfond/elenctic && cd elenctic
pip install '.[theory]'
uv tool install '.[theory]'
pixi install -e theory # the locked environment
Container
No prebuilt image is published. The Containerfile is a local recipe: build it yourself with
Docker or Podman, then mount a directory of .lp files and run a check.
docker build -f Containerfile -t elenctic .
podman build -f Containerfile -t elenctic .
docker run --rm -v "$PWD":/work:ro elenctic drinks.lp
podman run --rm -v "$PWD":/work:ro elenctic drinks.lp
The image includes the theory extra (clingo and clingcon). The entrypoint is elenctic; pass
the same arguments you would on the host.
Quick start
Save this as drinks.lp:
% @expect sat
% @count 2
% @brave { tea, coffee }
% @cautious { biscuit }
% @query unknown { tea }
{ tea; coffee } = 1.
biscuit.
#show tea/0.
#show coffee/0.
#show biscuit/0.
$ elenctic drinks.lp
1/1 passed
Change @count 2 to @count 3 and run again:
$ elenctic drinks.lp
drinks.lp — FAIL
[FAIL] @count 3 (line 2): 3 expected, 2 distinct shown answer sets
0/1 passed, 1 fail
elenctic PATH… is elenctic test PATH…. From Python the same check is silent and returns a
value:
from elenctic import Limits, Program, check
report = check(Program.read("drinks.lp"), limits=Limits(max_seconds=10))
Usage
elenctic [test] PATH… |
check programs against their contracts (reference) |
--format full|short|json |
rustc multi-line diagnostics (default), one-line short, or JSON (output, diagnostics) |
Exit 0 / 1 / 2 / 3 |
claims hold, claim unmet, fault, internal error (exit codes) |
Claims with real command output: docs/reference/examples.md. Tutorial: docs/tutorial/first-contract.md. Full map: docs/index.md.
Develop
pixi install -e theory
pixi run -e theory check # format, lint, strict types, import contracts, tests
pixi run -e py314 test # or -e py315
pixi run check is the one gate; ./check.sh runs it. uv.lock is tracked so
uv sync --locked reproduces the same dependencies.
License
Licensed under the MIT license. Changes are in the changelog.
Metadata
Release files for elenctic 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| elenctic-1.0.0.tar.gz | 230.6 kB | With provenance | Details for elenctic-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| elenctic-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for elenctic-1.0.0-py3-none-any.whl |
Total release size: 316.9 kB
Release files / elenctic-1.0.0.tar.gz
| Download URL | elenctic-1.0.0.tar.gz |
|---|---|
| Size | 230.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa83f55e47bdaae111f510bc257b745ef00cc740dc457871aba7a1b918a5b52a
|
|
BLAKE2b-256 checksum How to use checksums |
422551628316fb339e0614bf1503f900e55f31b087bcaab1a54e18c697c9febe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logRelease files / elenctic-1.0.0-py3-none-any.whl
| Download URL | elenctic-1.0.0-py3-none-any.whl |
|---|---|
| Size | 86.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a5347402becfa3276be778c92965f31d38b20755a91d509a85ab230be03154b4
|
|
BLAKE2b-256 checksum How to use checksums |
cc07e3065db838fef19d5786b3b0b84233ec7a8e15f2365486b626320106494a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logSecurity for elenctic 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for elenctic-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.