Bex is a rust crate for working with binary (Boolean) expressions.
This crate lets you build a complicated abstract syntax tree (AST) by working with individual Bit structs, or vectors that act like integers.
You can also "solve" these AST structures by converting them into various canonical representations:
- reduced, ordered, binary decision diagrams (ROBDDs) -- a normal form consisting of if-then-else triples that essentially act like compressed truth tables
- algebraic nomal form -- an "xor of ands" polynomial form
- (more coming in the future)
J and Bex vs Primorial 15 is about converting "simple" factoring problems into boolean expressions and solving them with bex.
It covers the large factoring problems in examples/solve/bdd-solve.rs and the smaller tests in src/solve.rs
- add C ffi for use with https://github.com/SSoelvsten/bdd-benchmark (bex adapter is at https://github.com/tangentforks/bdd-benchmark for now)
- add
iteto the Base trait - Removed
XIDtype fromswap.rs, as it is equivalent toNID::ixn()and required duplicating (or genericizing)HiloandVhltypes. - Added a new SQLite persistence module (
sqlfeature, enabled by default) with anast_node/ast_edgeschema,tag/keeptables, anedge_src_bitsview, and stored format-version metadata. - Expose AST/BDD operations, solvers, and
NIDutilities via the C FFI. - Breaking: remove
ITE::new(use the normal constructor instead). - Swarm: when
num_workers=0, leave one core free for the main thread. - Swap: disable
validate()checks except in test mode. - FFI build/profile updates: move FFI release profile to the workspace root, enable optimizations, and allow configurable profiles.
- Profiling: set debug info to line-labels-only for profiling release builds.
- Notation: standardize and tighten NID string forms
- Use
@for indexed nodes; remove legacy#form. - Enforce uppercase hex for all hex segments (
xN,vN,.MMMM,@MMMM,fN.M). - Allow binary tables
twith lengths 2/4/8/16/32 bits (arity 1..5). - Restrict hex tables shorthand to a single digit:
fX==f2.X; multi-digitfXXshorthand is rejected (fullfN.Mremains). - Fix parsing of virtual variables (
v…).
- Use
- Shell: align with spec
- Only
!for negation (remove~andnot). - Only
OandIfor constants (remove lowercase aliases).
- Only
- API: no response format change; endpoints still return plain text, but paths now accept the updated NID syntax (uppercase hex,
@…, extendedt…,fX).
See CHANGELOG.md for detailed notes on published releases, including 0.3.0.