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.1.1

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.1.1
File Size Uploaded Provenance Actions
tididi-0.1.1.tar.gz 1.6 MB Without provenance Details for tididi-0.1.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for tididi 0.1.1
File Actions
tididi-0.1.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for tididi-0.1.1-cp310-abi3-win_amd64.whl
tididi-0.1.1-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for tididi-0.1.1-cp310-abi3-manylinux_2_28_x86_64.whl
tididi-0.1.1-cp310-abi3-manylinux_2_28_aarch64.whl CPython 3.10 abi3 Linux glibc 2.28+ ARM64 Details for tididi-0.1.1-cp310-abi3-manylinux_2_28_aarch64.whl
tididi-0.1.1-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 for tididi-0.1.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Total release size: 10.2 MB

Release files / tididi-0.1.1.tar.gz

Download URL tididi-0.1.1.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
5fb114f4e3617ad49288111a8814a948e8cd413b1b6922588526ed27e08136b9
BLAKE2b-256 checksum
How to use checksums
363b6981c254b6be3cbeec3389978a2c879f75a50f174010532816728aa5adc1
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.1-cp310-abi3-win_amd64.whl

Download URL tididi-0.1.1-cp310-abi3-win_amd64.whl
Size 1.6 MB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
099152e784b076c84bb024f68a7a71a69a552e63b753cadc3201097c8627001b
BLAKE2b-256 checksum
How to use checksums
73ad04d3ff376bac3eafaeb980a2ca7ab063e5ab70c36c282b32a98fe5cc4e48
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.1-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL tididi-0.1.1-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
d20a74c5c50a350a67366b89ec9a59afa26549a2811aceac812aac6effc39270
BLAKE2b-256 checksum
How to use checksums
5dd39e36b454e99654a4280267f397e290919d938d5ef227e78d7caaa7de4fce
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.1-cp310-abi3-manylinux_2_28_aarch64.whl

Download URL tididi-0.1.1-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
d7d5f28c4b2e11c83589e8d5a111b3a4f61aaaae139a06c49a5f93525bab6bf7
BLAKE2b-256 checksum
How to use checksums
742915ad8bf29064046e7363bc78b3b4beae117bc8a97a1097ccd75ce8da33ed
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.1-cp310-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL tididi-0.1.1-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
347c8c4c9f4ba4e1e09f32f3cba6e0bd52072894cec6d42dc61e149be0f25aaf
BLAKE2b-256 checksum
How to use checksums
7b3cd3fa63edb19ed0a8b6d2b1cbc8b5d6a2f032e33fb209c18c49fce128d3da
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.1

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