From 695393e2880afcad64028a10aecb5615eeb3acd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Bohn?= Date: Tue, 10 Nov 2026 00:33:08 +0100 Subject: [PATCH] Drop biodivine-lib-bdd: labels are only AbstractLabelExpression (part B of automata#156) --- CHANGELOG.md | 11 ++- CLAUDE.md | 6 +- Cargo.lock | 116 -------------------------- Cargo.toml | 1 - src/body.rs | 19 ++--- src/error.rs | 42 ---------- src/label.rs | 223 +++++++------------------------------------------- src/lib.rs | 57 +++++-------- src/output.rs | 64 +-------------- 9 files changed, 73 insertions(+), 466 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ad549b..a18bf08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ### Changed -- **Breaking:** label conversion returns the new `LabelError` instead of a `String`: `AbstractLabelExpression::try_into_bdd`, `AbstractLabelExpression::try_into_prop` and `LabelExpression::try_into_hoa_expression`. It tells an out-of-range AP (`LabelError::ApOutOfRange { ap, count }`) from an unresolved alias (`LabelError::UnresolvedAlias(name)`) and implements `std::error::Error` (issue 6). +- **Breaking:** `biodivine-lib-bdd` is no longer a dependency, so no BDD type appears in the API any more. Labels are only kept as the `AbstractLabelExpression` that was parsed: `Label` is now `Label(pub AbstractLabelExpression)` (and derefs to it), `LabelExpression` is gone, and `Aliases` holds `AbstractLabelExpression`s. Interpreting a label (as a BDD, a truth table, ...) is left to the user, who calls `HoaRepresentation::unalias` first and can use `AbstractLabelExpression::max_ap` (now public) to find the number of propositions it needs. `Label` is written with the `Display` of the expression, which no longer rewrites anything. + + | 0.4 | 0.5 | + |---|---| + | `hoars::HoaExpression` (`Bdd`) | removed, build your own from the `AbstractLabelExpression` | + | `LabelExpression::{Abstract, Expression}`, `Label(LabelExpression)` | `Label(AbstractLabelExpression)`; `match &label.0 { LabelExpression::Abstract(e) => .. }` becomes `let e = &label.0;` | + | `AbstractLabelExpression::try_into_bdd`, `try_into_prop`, `LabelExpression::try_into_hoa_expression` | removed; fold the expression yourself over `Boolean`, `Integer`, `Negated`, `Conjunction`, `Disjunction` (`Alias` after `unalias` is an error) | + | `LabelError` (`ApOutOfRange`, `UnresolvedAlias`) | removed with the conversions; `HoaRepresentation::verify` still reports out-of-range propositions, `max_ap` gives the largest one | + | `Label(LabelExpression::Expression(bdd))` printed as a DNF | removed | + | `biodivine-lib-bdd` in `Cargo.toml` | none | - **Breaking:** `HoaRepresentation::unalias` returns the new `AliasError` (`Undefined`, `Cyclic`) and `HoaRepresentation::verify` returns `VerifyErrors`, a list of `VerifyError` (`DuplicateState`, `StateCountMismatch`), instead of `String`. Both implement `std::error::Error`, and `VerifyErrors` derefs to `[VerifyError]` (issue 6). ## [0.4.0] - 2026-11-06 diff --git a/CLAUDE.md b/CLAUDE.md index 69e114c..2177526 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -20,17 +20,17 @@ RUSTDOCFLAGS="-D warnings" cargo doc --no-deps ## Layout - `src/lexer.rs`: tokens (`chumsky`-based). `src/input.rs`: parsing entry points, `ariadne` diagnostics. -- `src/header.rs`, `src/body.rs`, `src/value.rs`: parsers/types for the header items, the body (states, edges), and values (integers, acceptance expressions, labels via `biodivine-lib-bdd`). +- `src/header.rs`, `src/body.rs`, `src/value.rs`: parsers/types for the header items, the body (states, edges), and values (integers, acceptance expressions, labels as `AbstractLabelExpression`; there is no BDD library, interpreting a label is up to the user). - `src/format.rs`, `src/output.rs`: writing HOA. `src/interpretation.rs`: unaliasing and interpretation of the parsed automaton. - `src/lib.rs`: `HoaAutomaton` (header + body), `from_parts`, `from_hoa` helpers. - `hoa/`: sample HOA files used by tests (`spec/`, `spot/`; `bench/` is for benchmarks only); `doc/hoaf.pdf`: the format specification. ## Known sharp edges -- MSRV is 1.88 (`rust-version`; `biodivine-lib-bdd` needs it), checked in CI for the library only. +- MSRV is 1.88 (`rust-version`), checked in CI for the library only. - Parsers use `chumsky` 0.9 (`Simple` errors), flagged with `allow(clippy::result_large_err)` in several places. - 52 unit tests, including one that parses, round-trips and converts every fixture in `hoa/` (`hoa/spec/` holds the spec examples, `hoa/spot/` real Spot output); no fuzzing. -- Version `0.4.0` is the first release since crates.io `0.2.0` (0.3.0 was never published); breaking changes include `biodivine-lib-bdd` 0.6 and the reworked `Header`/`Body`/error API. +- Version `0.4.0` is the first release since crates.io `0.2.0` (0.3.0 was never published); breaking changes include the reworked `Header`/`Body`/error API. ## Benchmarks diff --git a/Cargo.lock b/Cargo.lock index af991dd..839d4a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -66,31 +66,12 @@ dependencies = [ "unty-next", ] -[[package]] -name = "biodivine-lib-bdd" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "353f2ea51bac487de00039cdce4d1f7c789de2e3ef99cd14ea460b3e8921f038" -dependencies = [ - "fxhash", - "num-bigint", - "num-rational", - "num-traits", - "rand", -] - [[package]] name = "bumpalo" version = "3.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - [[package]] name = "cast" version = "0.3.0" @@ -323,26 +304,6 @@ dependencies = [ "slab", ] -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "getrandom" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - [[package]] name = "gungraun" version = "0.20.0" @@ -421,7 +382,6 @@ name = "hoars" version = "0.4.0" dependencies = [ "ariadne", - "biodivine-lib-bdd", "chumsky", "criterion", "gungraun", @@ -486,37 +446,6 @@ version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" -[[package]] -name = "num-bigint" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367" -dependencies = [ - "num-integer", - "num-traits", - "rand", -] - -[[package]] -name = "num-integer" -version = "0.1.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.19" @@ -588,15 +517,6 @@ dependencies = [ "plotters-backend", ] -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - [[package]] name = "proc-macro-error-attr3" version = "3.1.1" @@ -637,36 +557,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - [[package]] name = "rapidhash" version = "4.5.1" @@ -907,12 +797,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "wasi" -version = "0.11.1+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" - [[package]] name = "wasm-bindgen" version = "0.2.130" diff --git a/Cargo.toml b/Cargo.toml index 0f3cb28..32bf5a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,6 @@ exclude = ["fuzz", "hoa/*", "doc/hoaf.pdf", ".github", "scripts", "CLAUDE.md", " [dependencies] tracing = "0.1" -biodivine-lib-bdd = "0.6" itertools = "0.15" ariadne = "0.6" diff --git a/src/body.rs b/src/body.rs index 3c49150..2a05671 100644 --- a/src/body.rs +++ b/src/body.rs @@ -3,7 +3,7 @@ use std::ops::Deref; use chumsky::prelude::*; use crate::{ - AbstractLabelExpression, AcceptanceSignature, Id, Label, LabelExpression, StateConjunction, + AbstractLabelExpression, AcceptanceSignature, Id, Label, StateConjunction, value::{self, HoaErr, sym, tok}, }; @@ -21,7 +21,7 @@ pub(crate) struct RawState { #[derive(Clone, Debug, PartialEq, Eq)] struct RawEdge(Option