Skip to main content
tididi

PyPI CI Python guide arXiv

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

The model count is the number of satisfying assignments: four 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.

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 ProbLog, Bayesian networks and probabilistic programs, also 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.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tididi 0.2.0
File Size Uploaded Provenance Actions
tididi-0.2.0.tar.gz 1.9 MB Without provenance Details for tididi-0.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for tididi 0.2.0
File Actions
tididi-0.2.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for tididi-0.2.0-cp310-abi3-win_amd64.whl
tididi-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for tididi-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl
tididi-0.2.0-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for tididi-0.2.0-cp310-abi3-manylinux_2_28_aarch64.whl
tididi-0.2.0-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 10.12+ universal2 (ARM64, x86-64), macOS 11.0+ ARM64, macOS 10.12+ x86-64 Details for tididi-0.2.0-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl

Total release size: 17.8 MB

Release files / tididi-0.2.0.tar.gz

Download URL tididi-0.2.0.tar.gz
Size 1.9 MB
Tags Source
SHA-256 checksum
How to use checksums
cf67b3dbbf05d5e95bfd02e45b692108a2e8a82a1f2127979ddb466c00d77540
BLAKE2b-256 checksum
How to use checksums
9ed440603f8489121e1098b09454f5f569052b1d4c4768b116c4987684b2a1d4
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.2.0-cp310-abi3-win_amd64.whl

Download URL tididi-0.2.0-cp310-abi3-win_amd64.whl
Size 3.2 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
a6e82cc8610ba3a61142f5ea0e83eeca530aad6c0771b61bd69a9f647c838c2e
BLAKE2b-256 checksum
How to use checksums
819056ee679b17ee564b32879438ce21ce424d7648268250b0d66d1a0771b0d0
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.2.0-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL tididi-0.2.0-cp310-abi3-manylinux_2_28_x86_64.whl
Size 3.5 MB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
f463fea438b8ba38f15c22e3115c232c775b0a1e5d73711202173befda5c99b6
BLAKE2b-256 checksum
How to use checksums
1934f5f01da4ea5e7fe5a92b7789b467319aa731675daec86a87b9063a0e3f5f
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.2.0-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL tididi-0.2.0-cp310-abi3-manylinux_2_28_aarch64.whl
Size 3.0 MB
Tags CPython 3.10 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
065dfd3bc829c869225e84423c3490fb42939163481e1889b9742fea26466f0a
BLAKE2b-256 checksum
How to use checksums
4c80514bee64620c40a51d61049a4ba2a943132fc97f8267ba8dea8b1bfe32cd
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.2.0-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl

Download URL tididi-0.2.0-cp310-abi3-macosx_10_12_universal2.macosx_10_12_x86_64.macosx_11_0_arm64.whl
Size 6.2 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
ecb3144baf8ef663cd72c084168b4d06bc74b9aa19f4e91e545bbdf59a159276
BLAKE2b-256 checksum
How to use checksums
8d89db14178366ee23a5ce85fb839e1e0064e4cbf92e1fc9d80bee114ade3177
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.2.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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page