Skip to main content

PredicateAnalysis

Struct PredicateAnalysis 

Source
pub struct PredicateAnalysis<'a> { /* private fields */ }
Expand description

Cached Boolean queries over one immutable graph level.

Shared Compute ancestry preserves correlated guards. The graph must be acyclic and predicates must name existing bit producers. The borrow prevents graph edits from invalidating retained predicates and query results.

Implementations§

Source§

impl<'a> PredicateAnalysis<'a>

Source

pub fn new(graph: &'a SubGraph) -> Self

Start a query cache borrowing this graph level, with finite defaults.

Source

pub fn with_limits(graph: &'a SubGraph, limits: BooleanLimits) -> Self

Start a query cache with explicit decision-node and cumulative-work limits.

Source

pub fn overlap( &mut self, left: Option<BloqNodeId>, right: Option<BloqNodeId>, ) -> Result<bool, Error>

Whether two guards can both hold; an absent guard is unconditional.

§Errors

Returns crate::lowering::NodeTemplateInstanceMergeError for malformed predicate dataflow or exhausted Boolean resources.

Source

pub fn overlap_values( &mut self, left: Option<ValueRef>, right: Option<ValueRef>, ) -> Result<bool, Error>

Whether selected output guards overlap.

§Errors

Returns an error for malformed predicates or exhausted Boolean resources.

Source§

impl PredicateAnalysis<'_>

Source

pub fn values_up_to( &mut self, predicates: &[BloqNodeId], limit: usize, ) -> Result<Vec<Vec<bool>>, Error>

Enumerate at most limit distinct, jointly reachable predicate tuples. Shared Boolean ancestry preserves equal and complementary inputs without enumerating all assignments to the underlying bit producers.

§Errors

Returns malformed predicate dataflow or exhausted Boolean resources.

Source

pub fn assignment_reachable( &mut self, predicates: &[(BloqNodeId, bool)], ) -> Result<bool, Error>

Whether a joint assignment is consistent with the Boolean dataflow.

§Errors

Returns crate::lowering::NodeTemplateInstanceMergeError for malformed predicate dataflow or exhausted Boolean resources.

Trait Implementations§

Source§

impl<'a> Debug for PredicateAnalysis<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for PredicateAnalysis<'a>

§

impl<'a> RefUnwindSafe for PredicateAnalysis<'a>

§

impl<'a> Send for PredicateAnalysis<'a>

§

impl<'a> Sync for PredicateAnalysis<'a>

§

impl<'a> Unpin for PredicateAnalysis<'a>

§

impl<'a> UnsafeUnpin for PredicateAnalysis<'a>

§

impl<'a> UnwindSafe for PredicateAnalysis<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T, BorrowedSelf> BitwiseMutViaBorrow<BorrowedSelf> for T
where T: BorrowMut<BorrowedSelf>, BorrowedSelf: BitwiseMut + ?Sized,

§

fn assign_index(&mut self, index: usize, to: bool)

§

fn negate_index(&mut self, index: usize)

§

fn clear_bits(&mut self)

§

fn assign_random( &mut self, bit_count: usize, random_number_generator: &mut impl RngExt, )
where BorrowedSelf: BitLength,

§

impl<Bits, Other, BorrowedSelf, BorrowedOther> BitwisePairMutViaBorrow<Other, BorrowedSelf, BorrowedOther> for Bits
where Bits: BorrowMut<BorrowedSelf> + ?Sized, Other: Borrow<BorrowedOther> + ?Sized, BorrowedSelf: Bitwise + BitwisePairMut<BorrowedOther> + ?Sized, BorrowedOther: Bitwise + ?Sized,

§

fn assign(&mut self, other: &Other)

§

fn bitxor_assign(&mut self, other: &Other)

§

fn bitand_assign(&mut self, other: &Other)

§

fn bitor_assign(&mut self, other: &Other)

§

impl<T, Other, BorrowedSelf, BorrowedOther> BitwisePairViaBorrow<Other, BorrowedSelf, BorrowedOther> for T
where T: Borrow<BorrowedSelf> + ?Sized, Other: Borrow<BorrowedOther> + ?Sized, BorrowedSelf: Bitwise + BitwisePair<BorrowedOther> + ?Sized, BorrowedOther: Bitwise + ?Sized,

§

fn dot(&self, other: &Other) -> bool

§

fn and_weight(&self, other: &Other) -> usize

§

fn or_weight(&self, other: &Other) -> usize

§

fn xor_weight(&self, other: &Other) -> usize

§

impl<T, BorrowedSelf> BitwiseViaBorrow<BorrowedSelf> for T
where T: Borrow<BorrowedSelf>, BorrowedSelf: Bitwise + ?Sized,

§

fn index(&self, index: usize) -> bool

§

fn weight(&self) -> usize

§

fn parity(&self) -> bool

§

fn is_zero(&self) -> bool

§

fn is_unit(&self, index: usize) -> bool

§

fn support<'a>(&'a self) -> impl SortedIterator
where BorrowedSelf: 'a,

§

fn max_support(&self) -> Option<usize>

§

fn min_support(&self) -> Option<usize>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.