Skip to main content

Verifier

Struct Verifier 

Source
pub struct Verifier { /* private fields */ }
Expand description

Low-level Z3-based verifier for single-shot validity checks.

The verifier uses a 10-second timeout by default. For more complex proofs with multiple constraints, use VerificationSession instead.

§Examples

use logicaffeine_verify::Verifier;

let verifier = Verifier::new();

// Boolean validity
assert!(verifier.check_bool(true).is_ok());
assert!(verifier.check_bool(false).is_err());

// Integer bounds
assert!(verifier.check_int_greater_than(10, 5).is_ok());

Implementations§

Source§

impl Verifier

Source

pub fn new() -> Self

Create a new verifier with a 10-second timeout.

§Examples
use logicaffeine_verify::Verifier;

let verifier = Verifier::new();
Source

pub fn check_bool(&self, value: bool) -> VerificationResult

Check if a boolean value is valid (always true).

Returns Ok(()) if the value is true, an error otherwise.

§Examples
use logicaffeine_verify::Verifier;

let verifier = Verifier::new();
assert!(verifier.check_bool(true).is_ok());
assert!(verifier.check_bool(false).is_err());
Source

pub fn check_int_greater_than( &self, value: i64, bound: i64, ) -> VerificationResult

Verify that value > bound.

§Examples
use logicaffeine_verify::Verifier;

let verifier = Verifier::new();
assert!(verifier.check_int_greater_than(10, 5).is_ok());  // 10 > 5
assert!(verifier.check_int_greater_than(3, 5).is_err());  // 3 > 5 is false
Source

pub fn check_int_less_than(&self, value: i64, bound: i64) -> VerificationResult

Verify that value < bound.

§Examples
use logicaffeine_verify::Verifier;

let verifier = Verifier::new();
assert!(verifier.check_int_less_than(3, 5).is_ok());   // 3 < 5
assert!(verifier.check_int_less_than(10, 5).is_err()); // 10 < 5 is false
Source

pub fn check_int_equals(&self, left: i64, right: i64) -> VerificationResult

Verify that left == right.

§Examples
use logicaffeine_verify::Verifier;

let verifier = Verifier::new();
assert!(verifier.check_int_equals(42, 42).is_ok());
assert!(verifier.check_int_equals(1, 2).is_err());
Source

pub fn context(&self) -> VerificationContext

Create a verification context for more complex proofs.

Use this when you need to build custom verification logic with multiple variables and constraints.

§Examples
use logicaffeine_verify::Verifier;
use z3::ast::Bool;

let verifier = Verifier::new();
let ctx = verifier.context();
let solver = ctx.solver();

// P ∨ ¬P is a tautology
let p = ctx.bool_var("p");
let tautology = Bool::or(&[&p, &p.not()]);
assert!(ctx.check_valid(&solver, &tautology).is_ok());

Trait Implementations§

Source§

impl Default for Verifier

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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<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.

§

impl<T, A> IntoAst<A> for T
where T: Into<A>, A: Ast,

§

fn into_ast(self, _a: &A) -> A

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.