Skip to main content

Finder

Struct Finder 

Source
pub struct Finder(/* private fields */);
Expand description

A search for the instances, or traces, of one problem, one after another. With changing relations, it tries the shapes of LOGIC.md 13.4 in order: by number of states, then by loop target.

use elinvar_engine::logic::{Bounds, Expr, Relation, Universe};
use elinvar_engine::{Finder, Next, Options};

let u = Universe::new(["A", "B"]).unwrap();
let s = Relation::unary("S");
let mut b = Bounds::new(&u);
b.bound_upper(&s, u.all(1).unwrap()).unwrap();

let mut finder = Finder::new(&b, &Expr::relation(&s).some(), &Options::default()).unwrap();
let mut found = 0;
while let Next::Instance(_) = finder.next_instance() {
    found += 1;
}
assert!(found >= 1);

Implementations§

Source§

impl Finder

Source

pub fn new( bounds: &Bounds, formula: &Formula, options: &Options, ) -> Result<Finder, Vec<Error>>

Translates a problem: bounds and a formula with no free variables, using the default solver.

Errors: every error of the formula against the bounds, together.

Source

pub fn with_solver<S, F>( bounds: &Bounds, formula: &Formula, options: &Options, make_solver: F, ) -> Result<Finder, Vec<Error>>
where S: Solver + 'static, F: FnMut() -> S + 'static,

Translates a problem using a solver built by make_solver (R9, DESIGN.md section 7.4). Each trace shape asks for a fresh solver. Every returned instance or trace is still refereed by elinvar-logic.

Errors: every error of the formula against the bounds, together.

Source

pub fn stats(&self) -> Stats

Statistics so far: the size of the last translation, and the conflicts of every solve.

Source

pub fn next_instance(&mut self) -> Next

The next instance or trace, after ruling out those already given (LOGIC.md 12.6 and 13.4).

Auto Trait Implementations§

§

impl !RefUnwindSafe for Finder

§

impl !Send for Finder

§

impl !Sync for Finder

§

impl !UnwindSafe for Finder

§

impl Forget for Finder

§

impl Freeze for Finder
where *const ArcInner<Atoms> is !null: Freeze, PhantomData<ArcInner<Atoms>>: Freeze, *const u8 is !null: Freeze, PhantomData<(Relation, TupleSet, TupleSet)>: Freeze, *const ArcInner<FormulaNode> is !null: Freeze, PhantomData<ArcInner<FormulaNode>>: Freeze, PhantomData<Shape>: Freeze, PhantomData<Gate>: Freeze, PhantomData<(Gate, u32)>: Freeze, PhantomData<u8>: Freeze, PhantomData<Bool>: Freeze, PhantomData<Lit>: Freeze, *const dyn Solver is !null: Freeze, PhantomData<dyn Solver>: Freeze, PhantomData<Primary>: Freeze, PhantomData<(Relation, TupleSet)>: Freeze, PhantomData<Instance>: Freeze, *const dyn FnMut() -> Box<dyn Solver> is !null: Freeze, PhantomData<dyn FnMut() -> Box<dyn Solver>>: Freeze,

§

impl Move for Finder

§

impl Unpin for Finder
where Arc<Atoms>: Unpin, *const u8 is !null: Unpin, Arc<Declared>: Unpin, *const LeafNode<u64, SetValZST> is !null: Unpin, Box<(u64, SetValZST)>: Unpin, Arc<FormulaNode>: Unpin, Box<dyn Solver>: Unpin, Box<dyn FnMut() -> Box<dyn Solver>>: Unpin,

§

impl UnsafeUnpin for Finder

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
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.