tididi for Python
Tree Decision Diagrams for Python.
tididi represents Boolean functions as circuits called Tree Decision Diagrams (TDDs), so you can work with their satisfying assignments without listing them. Build a circuit once, then combine it with other circuits or query it as your inputs change. This package calls the same Rust implementation as the Rust crate and the C library.
Like binary decision diagrams, minimized TDDs are canonical and combine efficiently under Boolean operations; in practice they can be much smaller.
Install
pip install tididi
Wheels cover Python 3.10 and later on Linux (x86-64 and ARM64), macOS and Windows. Elsewhere pip builds the package from source, which needs a Rust toolchain.
Getting started
This example builds (x ∧ y) ∨ z and counts its satisfying assignments:
from tididi import Vtree, literal
vtree = Vtree.balanced(3)
x = literal(vtree, 1)
y = literal(vtree, 2)
z = literal(vtree, 3)
f = (x & y) | z
print("Satisfying assignments:", f.model_count())
Output:
Satisfying assignments: 5
Four assignments have z true, and one more has z false with x and y true.
A vtree is a binary tree that groups the variables; circuits you combine must share the same vtree. Literals are signed variable numbers: 1 is x and -2 is ¬y. Boolean operations consume their operands, so use a.copy() & b.copy() to keep both; queries such as model_count() leave a circuit usable, and reusing a consumed circuit raises ConsumedCircuitError.
The tutorials in the Python guide cover what the library does, with executed output and downloadable scripts and notebooks:
Build and transform functions by combining circuits, fixing variables and quantifying them out: the reachability tutorial explores a transition system.
Find and count solutions, and test equivalence or implication: the configuration tutorial counts a backup application’s valid configurations as a user changes their choices.
Evaluate weighted models such as probabilities, changing the weights without rebuilding the circuit: the probability tutorial answers a conditional-probability query, and custom algebras compute other quantities, such as a minimum configuration cost.
Further tutorials cover tables, saving and loading, variable grouping, resource limits and circuit statistics. The API reference documents every function.
Applications built on tididi
tididi-cnf compiles CNF formulas into TDDs for model counting, weighted model counting and projected model counting, from Rust, Python or C.
tddlog performs exact probabilistic inference for higher-level languages: ProbLog programs, Bayesian and Markov networks, and discrete probabilistic programs. It has Python, C and WebAssembly bindings and runs in the browser.
Develop
From bindings/python in a checkout, build in place and run the checks:
python -m venv .venv
. .venv/bin/activate
python -m pip install 'maturin>=1.9.4,<2'
maturin develop --release
python -m pip install '.[test,docs]'
python -m pytest
python -m sphinx -W --keep-going -b html docs docs/_build/html
On Windows activate with .venv\Scripts\activate instead. Sphinx executes the tutorials while building the pages; open docs/_build/html/index.html.
Citing
Please cite A Canonical Generalization of OBDD, which introduced TDDs.
Acknowledgements
This material is based upon work supported by the Defense Advanced Research Projects Agency (DARPA) under Agreement No. HR0011269E224.
Metadata
Release files for tididi 0.1.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 | |
|---|---|---|---|---|
| tididi-0.1.0.tar.gz | 1.8 MB | Without provenance | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| tididi-0.1.0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| tididi-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| tididi-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl | CPython 3.10 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| tididi-0.1.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl | CPython 3.10 | abi3 | macOS 10.12+ x86-64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64 | Details |
Total release size: 10.3 MB
Release files / tididi-0.1.0.tar.gz
| Download URL | tididi-0.1.0.tar.gz |
|---|---|
| Size | 1.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
947c575c53e226aa5b0a3f4db8a49751dd6438b7612652aff40b39c6e664c97d
|
|
BLAKE2b-256 checksum How to use checksums |
01cb9276078fdc748050efccc98d68ef1b5cde237cb8fdecf955e4616f38fc71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / tididi-0.1.0-cp310-abi3-win_amd64.whl
| Download URL | tididi-0.1.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7d34f4fa8033360415a011aca93686e361fd1298d44905db6e40ce2c9fd877d5
|
|
BLAKE2b-256 checksum How to use checksums |
31a9353b579984b8e9fadfd6af8ebb53f7e73d92af39ca6355b90ac3ea498cc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / tididi-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl
| Download URL | tididi-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d9b913487156cbc5a130fc3dc47cdf229be0a4080c7512b342d51d87028e09d9
|
|
BLAKE2b-256 checksum How to use checksums |
19053f5fef1e61c2f4c86a0212f8d59a1e2b825ec7aa07308d1838cc7e42938b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / tididi-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl
| Download URL | tididi-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
146096edac4eff28df6024d100c5eaa49c9bd1aedc3094d5f1044fcb5cac9a4a
|
|
BLAKE2b-256 checksum How to use checksums |
c620ca6c1a9c506bd37b4caed8cb3b88148814a2162232ff3f3f1a83b7b3f8f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / tididi-0.1.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
| Download URL | tididi-0.1.0-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl |
|---|---|
| Size | 3.4 MB |
| Tags | CPython 3.10 abi3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
030ada28449b797365880aaf9ff55d546058bb357284ea17fa895d23ccd40698
|
|
BLAKE2b-256 checksum How to use checksums |
f9abb06c7b7e89e4911f6cf6a41bb98f31b139fdc2b811c53bb5f0f5c3ee263e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for tididi 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.