Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish-aplite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
- uses: actions/setup-node@v6
- uses: actions/setup-node@v7
with:
node-version: '24'
- name: Check release identity
Expand All @@ -46,7 +46,7 @@ jobs:
- uses: actions/checkout@v7
with:
ref: ${{ github.sha }}
- uses: actions/setup-node@v6
- uses: actions/setup-node@v7
with:
node-version: '24'
- uses: ./.github/actions/setup-rust
Expand Down
11 changes: 11 additions & 0 deletions conformance/sv-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,17 @@ contains 3,300 case/mode verdicts at the pinned revision. These are its only
changed rows, with no passing case regressing: 1,201 cases pass in 2state and
1,212 in 4state. Only these reviewed expectations are updated.

Integral array reductions (7.12.3) support `sum`, `product`, `and`, `or` and
`xor`, with or without empty parentheses. The five unmodified
`chapter-7/arrays/unpacked/reduction-methods` simulation cases pass the
official runner in both state modes at the pinned revision. Only those ten
reviewed expectations change from `fail` to `pass`; this is a focused run,
not a new full-corpus measurement. Shared regressions also exercise fixed
arrays, queues, integral- and string-indexed associative arrays, element-width
overflow, signed results, packed type queries and four-state propagation.
Empty containers reduce to zero. `with` expressions, iterator arguments and
multidimensional unpacked receivers remain unsupported.

## Running locally

Use the locked development shell and install the pinned [`requirements.txt`](requirements.txt) in a Python environment.
Expand Down
20 changes: 10 additions & 10 deletions conformance/sv-tests/expected.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -1383,16 +1383,16 @@ chapter-7/arrays/unpacked/ordering-methods/shuffle.sv 2state fail
chapter-7/arrays/unpacked/ordering-methods/shuffle.sv 4state fail
chapter-7/arrays/unpacked/ordering-methods/sort.sv 2state fail
chapter-7/arrays/unpacked/ordering-methods/sort.sv 4state fail
chapter-7/arrays/unpacked/reduction-methods/and.sv 2state fail
chapter-7/arrays/unpacked/reduction-methods/and.sv 4state fail
chapter-7/arrays/unpacked/reduction-methods/or.sv 2state fail
chapter-7/arrays/unpacked/reduction-methods/or.sv 4state fail
chapter-7/arrays/unpacked/reduction-methods/product.sv 2state fail
chapter-7/arrays/unpacked/reduction-methods/product.sv 4state fail
chapter-7/arrays/unpacked/reduction-methods/sum.sv 2state fail
chapter-7/arrays/unpacked/reduction-methods/sum.sv 4state fail
chapter-7/arrays/unpacked/reduction-methods/xor.sv 2state fail
chapter-7/arrays/unpacked/reduction-methods/xor.sv 4state fail
chapter-7/arrays/unpacked/reduction-methods/and.sv 2state pass
chapter-7/arrays/unpacked/reduction-methods/and.sv 4state pass
chapter-7/arrays/unpacked/reduction-methods/or.sv 2state pass
chapter-7/arrays/unpacked/reduction-methods/or.sv 4state pass
chapter-7/arrays/unpacked/reduction-methods/product.sv 2state pass
chapter-7/arrays/unpacked/reduction-methods/product.sv 4state pass
chapter-7/arrays/unpacked/reduction-methods/sum.sv 2state pass
chapter-7/arrays/unpacked/reduction-methods/sum.sv 4state pass
chapter-7/arrays/unpacked/reduction-methods/xor.sv 2state pass
chapter-7/arrays/unpacked/reduction-methods/xor.sv 4state pass
chapter-7/arrays/unpacked/slice-equality.sv 2state pass
chapter-7/arrays/unpacked/slice-equality.sv 4state pass
chapter-7/arrays/unpacked/slice.sv 2state pass
Expand Down
31 changes: 31 additions & 0 deletions crates/aplite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,34 @@ the query history because learning and search activity are retained. Unknown
includes invalid predicate indexes and exhausted budgets, and is not Unsat.
This API supplies reusable solving for future distribution policies; it does not
implement uniform sampling, variable ordering, or SystemVerilog `randomize()`.

## Bounded hash cells

`HashCells` prepares seed-selected affine XOR predicates over chosen scalar
variables. A query chooses a prefix of those predicates and their target bits;
shorter prefixes leave larger cells. The original formula and all predicates are
compiled once. The cell query uses one temporary SAT database and retains local
learning while it blocks already-seen projected assignments. It does not recompile
the formula for each model or retain blockers between cells.

```rust
use aplite::{CellStatus, Env, HashCells, Limits, Sort, boolv, var};
let projection = Env::from([("value".into(), var("x".into(), Sort::Bv(3)))]);
let cells = HashCells::new(&boolv(true), &projection, 2, 42, Limits::default()).unwrap();
let cell = cells.cell(&[true, false], 8, Limits::default());
assert_eq!(cell.status, CellStatus::Complete);
assert!(cell.models.iter().all(|model| model.contains_key("x")));
```

`Complete` certifies all models in that cell, including an empty cell. `TooLarge`
means the cell has more models than the caller's bound, and `Unknown` covers
invalid input or exhausted budgets. Neither exposes a truncated model list.
All searches and replay in one cell share one work/time budget. Hidden variables
are existential: multiple witnesses cannot duplicate a projected assignment.
Call `PreparedQuery::enumerate_cell` directly for custom partition predicates.

These operations are building blocks, **not a uniform sampler**. Uniformly picking
a cell and then uniformly picking one of its models generally biases results
when cells have different sizes. A sampling policy must control cell sizing and
acceptance separately. The exhaustive reservoir sampler remains a test-only reference.
Rows may be dependent or constant; hash construction preserves those cases.
2 changes: 1 addition & 1 deletion crates/aplite/src/finite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod control;
mod lookup;
mod prepared;
mod readonly;
pub use prepared::{Assumption, PreparedQuery};
pub use prepared::{Assumption, Cell, CellStatus, HashCells, PreparedQuery};
pub use readonly::ArrayModel;

type Lit = i32;
Expand Down
5 changes: 5 additions & 0 deletions crates/aplite/src/finite/prepared.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
//! Reusable scalar encoding with temporary Boolean assumptions.
use super::*;

mod cell;
mod hashing;
pub use cell::{Cell, CellStatus};
pub use hashing::HashCells;

/// Select the polarity of a predicate supplied when preparing the query.
#[derive(Clone, Copy, Debug)]
pub struct Assumption {
Expand Down
Loading
Loading