Skip to main content

ResolutionProver

Struct ResolutionProver 

Source
pub struct ResolutionProver {
    pub stats: ProverStats,
    /* private fields */
}
Expand description

Resolution-based theorem prover.

Fields§

§stats: ProverStats

Statistics

Implementations§

Source§

impl ResolutionProver

Source

pub fn new() -> Self

Create a new resolution prover with default strategy.

Source

pub fn with_strategy(strategy: ResolutionStrategy) -> Self

Create a prover with a specific strategy.

Source

pub fn add_clause(&mut self, clause: Clause)

Add a clause to the initial clause set.

Source

pub fn add_clauses(&mut self, clauses: Vec<Clause>)

Add multiple clauses.

Source

pub fn reset(&mut self)

Reset the prover (clear clauses and stats).

Source

pub fn resolve_first_order( &self, c1: &Clause, c2: &Clause, ) -> Vec<(Clause, Literal)>

Perform first-order binary resolution with unification.

This supports resolution on clauses with variables by using unification. Clauses are standardized apart before resolution to avoid variable conflicts.

Returns all possible resolvents with their MGUs.

§Example
use tensorlogic_ir::{TLExpr, Term, Literal, Clause, ResolutionProver};

// {P(x)} and {¬P(a)} resolve to {} (empty clause) with MGU {x/a}
let p_x = Literal::positive(TLExpr::pred("P", vec![Term::var("x")]));
let not_p_a = Literal::negative(TLExpr::pred("P", vec![Term::constant("a")]));

let c1 = Clause::unit(p_x);
let c2 = Clause::unit(not_p_a);

let prover = ResolutionProver::new();
let resolvents = prover.resolve_first_order(&c1, &c2);

assert_eq!(resolvents.len(), 1);
assert!(resolvents[0].0.is_empty()); // Empty clause derived
Source

pub fn prove(&mut self) -> ProofResult

Attempt to prove the clause set unsatisfiable using resolution.

Trait Implementations§

Source§

impl Default for ResolutionProver

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.

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.