pub enum TLExpr {
Show 75 variants
Pred {
name: String,
args: Vec<Term>,
},
And(Box<TLExpr>, Box<TLExpr>),
Or(Box<TLExpr>, Box<TLExpr>),
Not(Box<TLExpr>),
Exists {
var: String,
domain: String,
body: Box<TLExpr>,
},
ForAll {
var: String,
domain: String,
body: Box<TLExpr>,
},
Imply(Box<TLExpr>, Box<TLExpr>),
Score(Box<TLExpr>),
Add(Box<TLExpr>, Box<TLExpr>),
Sub(Box<TLExpr>, Box<TLExpr>),
Mul(Box<TLExpr>, Box<TLExpr>),
Div(Box<TLExpr>, Box<TLExpr>),
Pow(Box<TLExpr>, Box<TLExpr>),
Mod(Box<TLExpr>, Box<TLExpr>),
Min(Box<TLExpr>, Box<TLExpr>),
Max(Box<TLExpr>, Box<TLExpr>),
Abs(Box<TLExpr>),
Floor(Box<TLExpr>),
Ceil(Box<TLExpr>),
Round(Box<TLExpr>),
Sqrt(Box<TLExpr>),
Exp(Box<TLExpr>),
Log(Box<TLExpr>),
Sin(Box<TLExpr>),
Cos(Box<TLExpr>),
Tan(Box<TLExpr>),
Eq(Box<TLExpr>, Box<TLExpr>),
Lt(Box<TLExpr>, Box<TLExpr>),
Gt(Box<TLExpr>, Box<TLExpr>),
Lte(Box<TLExpr>, Box<TLExpr>),
Gte(Box<TLExpr>, Box<TLExpr>),
IfThenElse {
condition: Box<TLExpr>,
then_branch: Box<TLExpr>,
else_branch: Box<TLExpr>,
},
Constant(f64),
Aggregate {
op: AggregateOp,
var: String,
domain: String,
body: Box<TLExpr>,
group_by: Option<Vec<String>>,
},
Let {
var: String,
value: Box<TLExpr>,
body: Box<TLExpr>,
},
Box(Box<TLExpr>),
Diamond(Box<TLExpr>),
Next(Box<TLExpr>),
Eventually(Box<TLExpr>),
Always(Box<TLExpr>),
Until {
before: Box<TLExpr>,
after: Box<TLExpr>,
},
TNorm {
kind: TNormKind,
left: Box<TLExpr>,
right: Box<TLExpr>,
},
TCoNorm {
kind: TCoNormKind,
left: Box<TLExpr>,
right: Box<TLExpr>,
},
FuzzyNot {
kind: FuzzyNegationKind,
expr: Box<TLExpr>,
},
FuzzyImplication {
kind: FuzzyImplicationKind,
premise: Box<TLExpr>,
conclusion: Box<TLExpr>,
},
SoftExists {
var: String,
domain: String,
body: Box<TLExpr>,
temperature: f64,
},
SoftForAll {
var: String,
domain: String,
body: Box<TLExpr>,
temperature: f64,
},
WeightedRule {
weight: f64,
rule: Box<TLExpr>,
},
ProbabilisticChoice {
alternatives: Vec<(f64, TLExpr)>,
},
Release {
released: Box<TLExpr>,
releaser: Box<TLExpr>,
},
WeakUntil {
before: Box<TLExpr>,
after: Box<TLExpr>,
},
StrongRelease {
released: Box<TLExpr>,
releaser: Box<TLExpr>,
},
Lambda {
var: String,
var_type: Option<String>,
body: Box<TLExpr>,
},
Apply {
function: Box<TLExpr>,
argument: Box<TLExpr>,
},
SetMembership {
element: Box<TLExpr>,
set: Box<TLExpr>,
},
SetUnion {
left: Box<TLExpr>,
right: Box<TLExpr>,
},
SetIntersection {
left: Box<TLExpr>,
right: Box<TLExpr>,
},
SetDifference {
left: Box<TLExpr>,
right: Box<TLExpr>,
},
SetCardinality {
set: Box<TLExpr>,
},
EmptySet,
SetComprehension {
var: String,
domain: String,
condition: Box<TLExpr>,
},
CountingExists {
var: String,
domain: String,
body: Box<TLExpr>,
min_count: usize,
},
CountingForAll {
var: String,
domain: String,
body: Box<TLExpr>,
min_count: usize,
},
ExactCount {
var: String,
domain: String,
body: Box<TLExpr>,
count: usize,
},
Majority {
var: String,
domain: String,
body: Box<TLExpr>,
},
LeastFixpoint {
var: String,
body: Box<TLExpr>,
},
GreatestFixpoint {
var: String,
body: Box<TLExpr>,
},
Nominal {
name: String,
},
At {
nominal: String,
formula: Box<TLExpr>,
},
Somewhere {
formula: Box<TLExpr>,
},
Everywhere {
formula: Box<TLExpr>,
},
AllDifferent {
variables: Vec<String>,
},
GlobalCardinality {
variables: Vec<String>,
values: Vec<TLExpr>,
min_occurrences: Vec<usize>,
max_occurrences: Vec<usize>,
},
Abducible {
name: String,
cost: f64,
},
Explain {
formula: Box<TLExpr>,
},
}Variants§
Pred
And(Box<TLExpr>, Box<TLExpr>)
Or(Box<TLExpr>, Box<TLExpr>)
Not(Box<TLExpr>)
Exists
ForAll
Imply(Box<TLExpr>, Box<TLExpr>)
Score(Box<TLExpr>)
Add(Box<TLExpr>, Box<TLExpr>)
Sub(Box<TLExpr>, Box<TLExpr>)
Mul(Box<TLExpr>, Box<TLExpr>)
Div(Box<TLExpr>, Box<TLExpr>)
Pow(Box<TLExpr>, Box<TLExpr>)
Mod(Box<TLExpr>, Box<TLExpr>)
Min(Box<TLExpr>, Box<TLExpr>)
Max(Box<TLExpr>, Box<TLExpr>)
Abs(Box<TLExpr>)
Floor(Box<TLExpr>)
Ceil(Box<TLExpr>)
Round(Box<TLExpr>)
Sqrt(Box<TLExpr>)
Exp(Box<TLExpr>)
Log(Box<TLExpr>)
Sin(Box<TLExpr>)
Cos(Box<TLExpr>)
Tan(Box<TLExpr>)
Eq(Box<TLExpr>, Box<TLExpr>)
Lt(Box<TLExpr>, Box<TLExpr>)
Gt(Box<TLExpr>, Box<TLExpr>)
Lte(Box<TLExpr>, Box<TLExpr>)
Gte(Box<TLExpr>, Box<TLExpr>)
IfThenElse
Constant(f64)
Aggregate
Fields
op: AggregateOpLet
Box(Box<TLExpr>)
Necessity operator (□, “box”): something is necessarily true In all possible worlds or states, the expression holds
Diamond(Box<TLExpr>)
Possibility operator (◇, “diamond”): something is possibly true In at least one possible world or state, the expression holds Related to Box by: ◇P = ¬□¬P
Next(Box<TLExpr>)
Next operator (X): true in the next state
Eventually(Box<TLExpr>)
Eventually operator (F): true in some future state
Always(Box<TLExpr>)
Always/Globally operator (G): true in all future states
Until
Until operator (U): first expression holds until second becomes true
TNorm
T-norm (fuzzy AND) with specified semantics
TCoNorm
T-conorm (fuzzy OR) with specified semantics
FuzzyNot
Fuzzy negation with specified semantics
FuzzyImplication
Fuzzy implication operator
SoftExists
Soft existential quantifier with temperature parameter Temperature controls how “soft” the quantifier is:
- Low temperature (→0): approaches hard max (standard exists)
- High temperature: smoother aggregation (log-sum-exp)
Fields
SoftForAll
Soft universal quantifier with temperature parameter Temperature controls how “soft” the quantifier is:
- Low temperature (→0): approaches hard min (standard forall)
- High temperature: smoother aggregation
Fields
WeightedRule
Weighted rule with confidence/probability Used in probabilistic logic programming
ProbabilisticChoice
Probabilistic choice between alternatives with given probabilities Probabilities should sum to 1.0
Release
Release operator (R): dual of Until P R Q means Q holds until and including when P becomes true
WeakUntil
Weak Until (W): P W Q means P holds until Q, but Q may never hold
StrongRelease
Strong Release (M): dual of weak until
Lambda
Lambda abstraction: λvar. body Creates a function that binds var in body
Fields
Apply
Function application: Apply(f, arg) represents f(arg)
SetMembership
Set membership: elem ∈ set
SetUnion
Set union: A ∪ B
SetIntersection
Set intersection: A ∩ B
SetDifference
Set difference: A \ B
SetCardinality
Set cardinality: |S|
EmptySet
Empty set: ∅
SetComprehension
Set comprehension: { var : domain | condition }
CountingExists
Counting existential quantifier: ∃≥k x. P(x) “There exist at least k elements satisfying P”
CountingForAll
Counting universal quantifier: ∀≥k x. P(x) “At least k elements satisfy P”
ExactCount
Exact count quantifier: ∃=k x. P(x) “Exactly k elements satisfy P”
Majority
Majority quantifier: Majority x. P(x) “More than half of the elements satisfy P”
LeastFixpoint
Least fixed point (mu): μX. F(X) Used for inductive definitions
Fields
GreatestFixpoint
Greatest fixed point (nu): νX. F(X) Used for coinductive definitions
Fields
Nominal
Nominal (named state/world): @i Represents a specific named state in a model
At
Satisfaction operator: @i φ “Formula φ is true at the nominal state i”
Somewhere
Universal modality: E φ “φ is true in some state reachable from here”
Everywhere
Universal modality (dual): A φ “φ is true in all reachable states”
AllDifferent
All-different constraint: all variables must have different values
GlobalCardinality
Global cardinality constraint Each value in values must occur at least min and at most max times in variables
Fields
Abducible
Abducible literal: can be assumed true for explanation
Explain
Explanation marker: indicates this part needs explanation
Implementations§
Source§impl TLExpr
impl TLExpr
Sourcepub fn validate_domains(&self, registry: &DomainRegistry) -> Result<(), IrError>
pub fn validate_domains(&self, registry: &DomainRegistry) -> Result<(), IrError>
Validate all domain references in this expression.
Checks that:
- All quantifier domains exist in the registry
- Variables used consistently across different quantifiers
Sourcepub fn referenced_domains(&self) -> Vec<String>
pub fn referenced_domains(&self) -> Vec<String>
Extract all domains referenced in this expression.
Source§impl TLExpr
impl TLExpr
Sourcepub fn validate_arity(&self) -> Result<(), String>
pub fn validate_arity(&self) -> Result<(), String>
Validate that all predicates with the same name have consistent arity
Source§impl TLExpr
impl TLExpr
pub fn pred(name: impl Into<String>, args: Vec<Term>) -> Self
pub fn and(left: TLExpr, right: TLExpr) -> Self
pub fn or(left: TLExpr, right: TLExpr) -> Self
pub fn negate(expr: TLExpr) -> Self
pub fn exists( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self
pub fn forall( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self
pub fn imply(premise: TLExpr, conclusion: TLExpr) -> Self
pub fn score(expr: TLExpr) -> Self
pub fn add(left: TLExpr, right: TLExpr) -> Self
pub fn sub(left: TLExpr, right: TLExpr) -> Self
pub fn mul(left: TLExpr, right: TLExpr) -> Self
pub fn div(left: TLExpr, right: TLExpr) -> Self
pub fn pow(left: TLExpr, right: TLExpr) -> Self
pub fn modulo(left: TLExpr, right: TLExpr) -> Self
pub fn min(left: TLExpr, right: TLExpr) -> Self
pub fn max(left: TLExpr, right: TLExpr) -> Self
pub fn abs(expr: TLExpr) -> Self
pub fn floor(expr: TLExpr) -> Self
pub fn ceil(expr: TLExpr) -> Self
pub fn round(expr: TLExpr) -> Self
pub fn sqrt(expr: TLExpr) -> Self
pub fn exp(expr: TLExpr) -> Self
pub fn log(expr: TLExpr) -> Self
pub fn sin(expr: TLExpr) -> Self
pub fn cos(expr: TLExpr) -> Self
pub fn tan(expr: TLExpr) -> Self
pub fn eq(left: TLExpr, right: TLExpr) -> Self
pub fn lt(left: TLExpr, right: TLExpr) -> Self
pub fn gt(left: TLExpr, right: TLExpr) -> Self
pub fn lte(left: TLExpr, right: TLExpr) -> Self
pub fn gte(left: TLExpr, right: TLExpr) -> Self
pub fn if_then_else( condition: TLExpr, then_branch: TLExpr, else_branch: TLExpr, ) -> Self
pub fn constant(value: f64) -> Self
pub fn aggregate( op: AggregateOp, var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self
pub fn aggregate_with_group_by( op: AggregateOp, var: impl Into<String>, domain: impl Into<String>, body: TLExpr, group_by: Vec<String>, ) -> Self
pub fn count( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self
pub fn sum( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self
pub fn average( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self
pub fn max_agg( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self
pub fn min_agg( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self
pub fn product( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self
pub fn let_binding(var: impl Into<String>, value: TLExpr, body: TLExpr) -> Self
Sourcepub fn modal_box(expr: TLExpr) -> Self
pub fn modal_box(expr: TLExpr) -> Self
Create a Box (necessity) operator.
□P: “P is necessarily true” - holds in all possible worlds/states
Sourcepub fn modal_diamond(expr: TLExpr) -> Self
pub fn modal_diamond(expr: TLExpr) -> Self
Create a Diamond (possibility) operator.
◇P: “P is possibly true” - holds in at least one possible world/state
Sourcepub fn eventually(expr: TLExpr) -> Self
pub fn eventually(expr: TLExpr) -> Self
Create an Eventually operator.
FP: “P will eventually be true” - true in some future state
Sourcepub fn always(expr: TLExpr) -> Self
pub fn always(expr: TLExpr) -> Self
Create an Always operator.
GP: “P is always true” - true in all future states
Sourcepub fn until(before: TLExpr, after: TLExpr) -> Self
pub fn until(before: TLExpr, after: TLExpr) -> Self
Create an Until operator.
P U Q: “P holds until Q becomes true”
Sourcepub fn tnorm(kind: TNormKind, left: TLExpr, right: TLExpr) -> Self
pub fn tnorm(kind: TNormKind, left: TLExpr, right: TLExpr) -> Self
Create a T-norm (fuzzy AND) operation with specified semantics.
Sourcepub fn fuzzy_and(left: TLExpr, right: TLExpr) -> Self
pub fn fuzzy_and(left: TLExpr, right: TLExpr) -> Self
Create a minimum T-norm (standard fuzzy AND).
Sourcepub fn probabilistic_and(left: TLExpr, right: TLExpr) -> Self
pub fn probabilistic_and(left: TLExpr, right: TLExpr) -> Self
Create a product T-norm (probabilistic AND).
Sourcepub fn tconorm(kind: TCoNormKind, left: TLExpr, right: TLExpr) -> Self
pub fn tconorm(kind: TCoNormKind, left: TLExpr, right: TLExpr) -> Self
Create a T-conorm (fuzzy OR) operation with specified semantics.
Sourcepub fn fuzzy_or(left: TLExpr, right: TLExpr) -> Self
pub fn fuzzy_or(left: TLExpr, right: TLExpr) -> Self
Create a maximum T-conorm (standard fuzzy OR).
Sourcepub fn probabilistic_or(left: TLExpr, right: TLExpr) -> Self
pub fn probabilistic_or(left: TLExpr, right: TLExpr) -> Self
Create a probabilistic sum T-conorm.
Sourcepub fn fuzzy_not(kind: FuzzyNegationKind, expr: TLExpr) -> Self
pub fn fuzzy_not(kind: FuzzyNegationKind, expr: TLExpr) -> Self
Create a fuzzy negation with specified semantics.
Sourcepub fn standard_fuzzy_not(expr: TLExpr) -> Self
pub fn standard_fuzzy_not(expr: TLExpr) -> Self
Create a standard fuzzy negation (1 - x).
Sourcepub fn fuzzy_imply(
kind: FuzzyImplicationKind,
premise: TLExpr,
conclusion: TLExpr,
) -> Self
pub fn fuzzy_imply( kind: FuzzyImplicationKind, premise: TLExpr, conclusion: TLExpr, ) -> Self
Create a fuzzy implication with specified semantics.
Sourcepub fn soft_exists(
var: impl Into<String>,
domain: impl Into<String>,
body: TLExpr,
temperature: f64,
) -> Self
pub fn soft_exists( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, temperature: f64, ) -> Self
Create a soft existential quantifier with temperature parameter.
§Arguments
var- Variable namedomain- Domain namebody- Expression bodytemperature- Temperature parameter (default 1.0). Lower = harder max.
Sourcepub fn soft_forall(
var: impl Into<String>,
domain: impl Into<String>,
body: TLExpr,
temperature: f64,
) -> Self
pub fn soft_forall( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, temperature: f64, ) -> Self
Create a soft universal quantifier with temperature parameter.
§Arguments
var- Variable namedomain- Domain namebody- Expression bodytemperature- Temperature parameter (default 1.0). Lower = harder min.
Sourcepub fn weighted_rule(weight: f64, rule: TLExpr) -> Self
pub fn weighted_rule(weight: f64, rule: TLExpr) -> Self
Create a weighted rule with confidence/probability.
§Arguments
weight- Weight/confidence (typically in [0,1] for probabilities)rule- The rule expression
Sourcepub fn probabilistic_choice(alternatives: Vec<(f64, TLExpr)>) -> Self
pub fn probabilistic_choice(alternatives: Vec<(f64, TLExpr)>) -> Self
Create a probabilistic choice between alternatives.
§Arguments
alternatives- Vector of (probability, expression) pairs. Should sum to 1.0.
Sourcepub fn release(released: TLExpr, releaser: TLExpr) -> Self
pub fn release(released: TLExpr, releaser: TLExpr) -> Self
Create a Release operator (R).
P R Q: “Q holds until and including when P becomes true”
Sourcepub fn weak_until(before: TLExpr, after: TLExpr) -> Self
pub fn weak_until(before: TLExpr, after: TLExpr) -> Self
Create a Weak Until operator (W).
P W Q: “P holds until Q, but Q may never hold”
Sourcepub fn strong_release(released: TLExpr, releaser: TLExpr) -> Self
pub fn strong_release(released: TLExpr, releaser: TLExpr) -> Self
Create a Strong Release operator (M).
P M Q: Dual of weak until
Sourcepub fn lambda(
var: impl Into<String>,
var_type: Option<String>,
body: TLExpr,
) -> Self
pub fn lambda( var: impl Into<String>, var_type: Option<String>, body: TLExpr, ) -> Self
Create a lambda abstraction: λvar. body
§Arguments
var- The parameter namevar_type- Optional type annotation for the parameterbody- The function body
Sourcepub fn lambda_untyped(var: impl Into<String>, body: TLExpr) -> Self
pub fn lambda_untyped(var: impl Into<String>, body: TLExpr) -> Self
Create a lambda abstraction without type annotation.
Sourcepub fn apply(function: TLExpr, argument: TLExpr) -> Self
pub fn apply(function: TLExpr, argument: TLExpr) -> Self
Create a function application: f(arg)
§Arguments
function- The function to applyargument- The argument to apply to the function
Sourcepub fn set_membership(element: TLExpr, set: TLExpr) -> Self
pub fn set_membership(element: TLExpr, set: TLExpr) -> Self
Create a set membership test: elem ∈ set
Sourcepub fn set_intersection(left: TLExpr, right: TLExpr) -> Self
pub fn set_intersection(left: TLExpr, right: TLExpr) -> Self
Create a set intersection: A ∩ B
Sourcepub fn set_difference(left: TLExpr, right: TLExpr) -> Self
pub fn set_difference(left: TLExpr, right: TLExpr) -> Self
Create a set difference: A \ B
Sourcepub fn set_cardinality(set: TLExpr) -> Self
pub fn set_cardinality(set: TLExpr) -> Self
Create a set cardinality expression: |S|
Sourcepub fn set_comprehension(
var: impl Into<String>,
domain: impl Into<String>,
condition: TLExpr,
) -> Self
pub fn set_comprehension( var: impl Into<String>, domain: impl Into<String>, condition: TLExpr, ) -> Self
Create a set comprehension: { var : domain | condition }
Sourcepub fn counting_exists(
var: impl Into<String>,
domain: impl Into<String>,
body: TLExpr,
min_count: usize,
) -> Self
pub fn counting_exists( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, min_count: usize, ) -> Self
Create a counting existential quantifier: ∃≥k x. P(x)
“There exist at least k elements satisfying P”
Sourcepub fn counting_forall(
var: impl Into<String>,
domain: impl Into<String>,
body: TLExpr,
min_count: usize,
) -> Self
pub fn counting_forall( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, min_count: usize, ) -> Self
Create a counting universal quantifier: ∀≥k x. P(x)
“At least k elements satisfy P”
Sourcepub fn exact_count(
var: impl Into<String>,
domain: impl Into<String>,
body: TLExpr,
count: usize,
) -> Self
pub fn exact_count( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, count: usize, ) -> Self
Create an exact count quantifier: ∃=k x. P(x)
“Exactly k elements satisfy P”
Sourcepub fn majority(
var: impl Into<String>,
domain: impl Into<String>,
body: TLExpr,
) -> Self
pub fn majority( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self
Create a majority quantifier: Majority x. P(x)
“More than half of the elements satisfy P”
Sourcepub fn least_fixpoint(var: impl Into<String>, body: TLExpr) -> Self
pub fn least_fixpoint(var: impl Into<String>, body: TLExpr) -> Self
Create a least fixed point: μX. F(X)
Used for inductive definitions (smallest solution)
Sourcepub fn greatest_fixpoint(var: impl Into<String>, body: TLExpr) -> Self
pub fn greatest_fixpoint(var: impl Into<String>, body: TLExpr) -> Self
Create a greatest fixed point: νX. F(X)
Used for coinductive definitions (largest solution)
Sourcepub fn at(nominal: impl Into<String>, formula: TLExpr) -> Self
pub fn at(nominal: impl Into<String>, formula: TLExpr) -> Self
Create a satisfaction operator: @i φ
“Formula φ is true at the nominal state i”
Sourcepub fn somewhere(formula: TLExpr) -> Self
pub fn somewhere(formula: TLExpr) -> Self
Create a “somewhere” modality: E φ
“φ is true in some reachable state”
Sourcepub fn everywhere(formula: TLExpr) -> Self
pub fn everywhere(formula: TLExpr) -> Self
Create an “everywhere” modality: A φ
“φ is true in all reachable states”
Sourcepub fn all_different(variables: Vec<String>) -> Self
pub fn all_different(variables: Vec<String>) -> Self
Create an all-different constraint.
All variables must have different values.
Sourcepub fn global_cardinality(
variables: Vec<String>,
values: Vec<TLExpr>,
min_occurrences: Vec<usize>,
max_occurrences: Vec<usize>,
) -> Self
pub fn global_cardinality( variables: Vec<String>, values: Vec<TLExpr>, min_occurrences: Vec<usize>, max_occurrences: Vec<usize>, ) -> Self
Create a global cardinality constraint.
Each value must occur within specified bounds in the variables.
Sourcepub fn abducible(name: impl Into<String>, cost: f64) -> Self
pub fn abducible(name: impl Into<String>, cost: f64) -> Self
Create an abducible literal.
Can be assumed true for explanation with the given cost.
Sourcepub fn substitute(&self, var: &str, value: &TLExpr) -> Self
pub fn substitute(&self, var: &str, value: &TLExpr) -> Self
Substitute a variable with an expression throughout this formula.
This performs capture-avoiding substitution, respecting variable shadowing in quantifiers, lambda abstractions, and let bindings.
§Arguments
var- The variable name to replacevalue- The expression to substitute in place of the variable
§Example
use tensorlogic_ir::{TLExpr, Term};
// P(x) ∧ Q(x)
let p = TLExpr::pred("P", vec![Term::var("x")]);
let q = TLExpr::pred("Q", vec![Term::var("x")]);
let expr = TLExpr::and(p.clone(), q);
// Substitute x with y
let y = TLExpr::pred("y", vec![]);
let result = expr.substitute("x", &y);