pub struct Sequent {
pub antecedents: Vec<TLExpr>,
pub consequents: Vec<TLExpr>,
}Expand description
A sequent is a formal statement Γ ⊢ Δ representing an entailment relation.
antecedents(Γ): Multiset of hypothesis formulas (left side)consequents(Δ): Multiset of conclusion formulas (right side)
The sequent is valid if: assuming all antecedents are true, at least one consequent must be true.
Fields§
§antecedents: Vec<TLExpr>Hypothesis formulas (left side of ⊢)
consequents: Vec<TLExpr>Conclusion formulas (right side of ⊢)
Implementations§
Source§impl Sequent
impl Sequent
Sourcepub fn new(antecedents: Vec<TLExpr>, consequents: Vec<TLExpr>) -> Self
pub fn new(antecedents: Vec<TLExpr>, consequents: Vec<TLExpr>) -> Self
Create a new sequent from antecedents and consequents.
Sourcepub fn is_axiom(&self) -> bool
pub fn is_axiom(&self) -> bool
Check if this is an axiom (identity sequent where some antecedent equals some consequent).
Sourcepub fn weaken_left(self, formula: TLExpr) -> Self
pub fn weaken_left(self, formula: TLExpr) -> Self
Apply weakening rule: add a formula to antecedents.
Sourcepub fn weaken_right(self, formula: TLExpr) -> Self
pub fn weaken_right(self, formula: TLExpr) -> Self
Apply weakening rule: add a formula to consequents.
Sourcepub fn contract_left(self, index: usize) -> Option<Self>
pub fn contract_left(self, index: usize) -> Option<Self>
Apply contraction rule: remove duplicate from antecedents.
Sourcepub fn contract_right(self, index: usize) -> Option<Self>
pub fn contract_right(self, index: usize) -> Option<Self>
Apply contraction rule: remove duplicate from consequents.
Sourcepub fn substitute(&self, var: &str, term: &Term) -> Self
pub fn substitute(&self, var: &str, term: &Term) -> Self
Substitute a term for a variable throughout the sequent.
This creates a new substitution and applies it to all formulas in the sequent. The substitution is capture-avoiding for bound variables in quantifiers.
§Example
use tensorlogic_ir::{Sequent, TLExpr, Term};
// P(x) ⊢ P(x)
let p_x = TLExpr::pred("P", vec![Term::var("x")]);
let seq = Sequent::identity(p_x);
// Substitute x with a
let seq_subst = seq.substitute("x", &Term::constant("a"));
// Result should be P(a) ⊢ P(a)