clock-dbm
clock-dbm is a Rust library for representing zones of timed automata
using canonical difference-bound matrices (DBMs). Clock values are nonnegative
real numbers; constraints use strict or non-strict integer bounds stored in
packed i32 entries.
The library provides canonical zone construction, constraints and batch constraints, time elapse, reset, free, intersection, inclusion, maximal-constant extrapolation (ExtraM), and copy-on-write shared zones.
The core DBM operations are formally verified using Creusot against their specified zone semantics. See verification status for the exact coverage and trusted assumptions.
Quick start
The constraint! macro writes clock guards in the usual notation: single-clock
bounds such as x >= 2 and clock differences such as y - x < 3.
use ;
A successful operation always returns a canonical or empty zone. Inconsistent
constraints return Ok with an empty zone, not an error.
Error::Range means exact finite arithmetic encountered an unrepresentable
bound; it must not be treated as emptiness.
Documentation
The generated Rustdoc contains the complete public API reference, including mathematical meaning, errors, complexity, and usage examples:
For developers and verification researchers, further technical documents are included in Rustdoc and maintained as Markdown in the repository:
- Algorithms and implementation: representation, closure, optimizations, complexity, ExtraM, and sharing.
- Proof status and toolchain: machine-checked properties, trusted assumptions, pinned verification tools, and reproduction.
The copy-on-write layer is checked relative to documented trusted
specifications of selected Rc operations; hashing is not machine-checked.
See the proof-status reference for the precise verified subset.
Build and test
RUSTDOCFLAGS="-D warnings"
The Rust toolchain configuration is in rust-toolchain.toml, and the minimum
supported Rust version is declared in Cargo.toml. Verification uses the
separately pinned environment documented under verification/.
Development
This project has been developed with assistance from AI coding agents, including Claude Code and OpenAI Codex. The project maintainer remains responsible for the design, implementation, and maintenance of the software.
The implementation builds on established DBM algorithms described by, for example, Bengtsson and Yi (2004). Its mathematical specifications are informed by the Isabelle AFP formalization of difference-bound matrices, associated with Wimmer and Lammich (2018). UDBM was consulted as a design and performance reference, particularly for packed-bound representations and efficient incremental closure.
Another Creusot-based verification of DBM operations is VerifiedDBM, which focuses on a simplified DBM representation and selected operations.
License
Licensed under either the Apache License, Version 2.0 or the MIT license, at your option.