pub struct StratifiedProgram<'p> { /* private fields */ }Expand description
A program that has been successfully stratified.
Contains the original program and the computed strata. This structure is used to guide the execution order of the IR.
Stratification ensures that if a predicate p depends negatively on q,
then q is evaluated in an earlier stratum than p. This allows for
the correct evaluation of negation and aggregation (semi-naive evaluation).
Implementations§
Source§impl<'p> StratifiedProgram<'p>
impl<'p> StratifiedProgram<'p>
Sourcepub fn extensional_preds(&'p self) -> PredicateSet
pub fn extensional_preds(&'p self) -> PredicateSet
Returns predicates for extensional DB (stored facts).
Sourcepub fn intensional_preds(&'p self) -> PredicateSet
pub fn intensional_preds(&'p self) -> PredicateSet
Returns predicates for intensional DB (derived rules).
Sourcepub fn rules(
&'p self,
sym: PredicateIndex,
) -> impl Iterator<Item = &'p Clause<'p>>
pub fn rules( &'p self, sym: PredicateIndex, ) -> impl Iterator<Item = &'p Clause<'p>>
Maps predicates of intensional DB to their defining rules.
Sourcepub fn strata(&'p self) -> Vec<PredicateSet> ⓘ
pub fn strata(&'p self) -> Vec<PredicateSet> ⓘ
Returns an iterator of strata, in dependency order. Each stratum is a set of mutually recursive predicates that can be evaluated together.
Sourcepub fn pred_to_index(&'p self, sym: PredicateIndex) -> Option<usize>
pub fn pred_to_index(&'p self, sym: PredicateIndex) -> Option<usize>
Returns the stratum index for a given predicate symbol.
Returns None if the predicate is not part of the stratified program (e.g. it’s EDB).
Trait Implementations§
Source§impl<'p> Clone for StratifiedProgram<'p>
impl<'p> Clone for StratifiedProgram<'p>
Source§fn clone(&self) -> StratifiedProgram<'p>
fn clone(&self) -> StratifiedProgram<'p>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more