pub struct ResolutionProver {
pub stats: ProverStats,
/* private fields */
}Expand description
Resolution-based theorem prover.
Fields§
§stats: ProverStatsStatistics
Implementations§
Source§impl ResolutionProver
impl ResolutionProver
Sourcepub fn with_strategy(strategy: ResolutionStrategy) -> Self
pub fn with_strategy(strategy: ResolutionStrategy) -> Self
Create a prover with a specific strategy.
Sourcepub fn add_clause(&mut self, clause: Clause)
pub fn add_clause(&mut self, clause: Clause)
Add a clause to the initial clause set.
Sourcepub fn add_clauses(&mut self, clauses: Vec<Clause>)
pub fn add_clauses(&mut self, clauses: Vec<Clause>)
Add multiple clauses.
Sourcepub fn resolve_first_order(
&self,
c1: &Clause,
c2: &Clause,
) -> Vec<(Clause, Literal)>
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 derivedSourcepub fn prove(&mut self) -> ProofResult
pub fn prove(&mut self) -> ProofResult
Attempt to prove the clause set unsatisfiable using resolution.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ResolutionProver
impl RefUnwindSafe for ResolutionProver
impl Send for ResolutionProver
impl Sync for ResolutionProver
impl Unpin for ResolutionProver
impl UnwindSafe for ResolutionProver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more