Skip to main content

TLExpr

Enum TLExpr 

Source
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

Fields

§name: String
§args: Vec<Term>
§

And(Box<TLExpr>, Box<TLExpr>)

§

Or(Box<TLExpr>, Box<TLExpr>)

§

Not(Box<TLExpr>)

§

Exists

Fields

§domain: String
§body: Box<TLExpr>
§

ForAll

Fields

§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

Fields

§condition: Box<TLExpr>
§then_branch: Box<TLExpr>
§else_branch: Box<TLExpr>
§

Constant(f64)

§

Aggregate

Fields

§domain: String
§body: Box<TLExpr>
§group_by: Option<Vec<String>>

Optional group-by variables

§

Let

Fields

§value: Box<TLExpr>
§body: Box<TLExpr>
§

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

Fields

§before: Box<TLExpr>
§after: Box<TLExpr>
§

TNorm

T-norm (fuzzy AND) with specified semantics

Fields

§left: Box<TLExpr>
§right: Box<TLExpr>
§

TCoNorm

T-conorm (fuzzy OR) with specified semantics

Fields

§left: Box<TLExpr>
§right: Box<TLExpr>
§

FuzzyNot

Fuzzy negation with specified semantics

Fields

§expr: Box<TLExpr>
§

FuzzyImplication

Fuzzy implication operator

Fields

§premise: Box<TLExpr>
§conclusion: Box<TLExpr>
§

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

§domain: String
§body: Box<TLExpr>
§temperature: f64

Temperature parameter (default: 1.0)

§

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

§domain: String
§body: Box<TLExpr>
§temperature: f64

Temperature parameter (default: 1.0)

§

WeightedRule

Weighted rule with confidence/probability Used in probabilistic logic programming

Fields

§weight: f64
§rule: Box<TLExpr>
§

ProbabilisticChoice

Probabilistic choice between alternatives with given probabilities Probabilities should sum to 1.0

Fields

§alternatives: Vec<(f64, TLExpr)>
§

Release

Release operator (R): dual of Until P R Q means Q holds until and including when P becomes true

Fields

§released: Box<TLExpr>
§releaser: Box<TLExpr>
§

WeakUntil

Weak Until (W): P W Q means P holds until Q, but Q may never hold

Fields

§before: Box<TLExpr>
§after: Box<TLExpr>
§

StrongRelease

Strong Release (M): dual of weak until

Fields

§released: Box<TLExpr>
§releaser: Box<TLExpr>
§

Lambda

Lambda abstraction: λvar. body Creates a function that binds var in body

Fields

§var_type: Option<String>

Optional type annotation for the parameter

§body: Box<TLExpr>
§

Apply

Function application: Apply(f, arg) represents f(arg)

Fields

§function: Box<TLExpr>
§argument: Box<TLExpr>
§

SetMembership

Set membership: elem ∈ set

Fields

§element: Box<TLExpr>
§

SetUnion

Set union: A ∪ B

Fields

§left: Box<TLExpr>
§right: Box<TLExpr>
§

SetIntersection

Set intersection: A ∩ B

Fields

§left: Box<TLExpr>
§right: Box<TLExpr>
§

SetDifference

Set difference: A \ B

Fields

§left: Box<TLExpr>
§right: Box<TLExpr>
§

SetCardinality

Set cardinality: |S|

Fields

§

EmptySet

Empty set: ∅

§

SetComprehension

Set comprehension: { var : domain | condition }

Fields

§domain: String
§condition: Box<TLExpr>
§

CountingExists

Counting existential quantifier: ∃≥k x. P(x) “There exist at least k elements satisfying P”

Fields

§domain: String
§body: Box<TLExpr>
§min_count: usize

Minimum count threshold

§

CountingForAll

Counting universal quantifier: ∀≥k x. P(x) “At least k elements satisfy P”

Fields

§domain: String
§body: Box<TLExpr>
§min_count: usize

Minimum count threshold

§

ExactCount

Exact count quantifier: ∃=k x. P(x) “Exactly k elements satisfy P”

Fields

§domain: String
§body: Box<TLExpr>
§count: usize

Exact count required

§

Majority

Majority quantifier: Majority x. P(x) “More than half of the elements satisfy P”

Fields

§domain: String
§body: Box<TLExpr>
§

LeastFixpoint

Least fixed point (mu): μX. F(X) Used for inductive definitions

Fields

§var: String

Variable representing the fixed point

§body: Box<TLExpr>

Function body that references var

§

GreatestFixpoint

Greatest fixed point (nu): νX. F(X) Used for coinductive definitions

Fields

§var: String

Variable representing the fixed point

§body: Box<TLExpr>

Function body that references var

§

Nominal

Nominal (named state/world): @i Represents a specific named state in a model

Fields

§name: String
§

At

Satisfaction operator: @i φ “Formula φ is true at the nominal state i”

Fields

§nominal: String
§formula: Box<TLExpr>
§

Somewhere

Universal modality: E φ “φ is true in some state reachable from here”

Fields

§formula: Box<TLExpr>
§

Everywhere

Universal modality (dual): A φ “φ is true in all reachable states”

Fields

§formula: Box<TLExpr>
§

AllDifferent

All-different constraint: all variables must have different values

Fields

§variables: Vec<String>
§

GlobalCardinality

Global cardinality constraint Each value in values must occur at least min and at most max times in variables

Fields

§variables: Vec<String>
§values: Vec<TLExpr>
§min_occurrences: Vec<usize>
§max_occurrences: Vec<usize>
§

Abducible

Abducible literal: can be assumed true for explanation

Fields

§name: String
§cost: f64
§

Explain

Explanation marker: indicates this part needs explanation

Fields

§formula: Box<TLExpr>

Implementations§

Source§

impl TLExpr

Source

pub fn free_vars(&self) -> HashSet<String>

Collect all free variables in this expression

Source

pub fn all_predicates(&self) -> HashMap<String, usize>

Collect all predicates and their arities

Source§

impl TLExpr

Source

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
Source

pub fn referenced_domains(&self) -> Vec<String>

Extract all domains referenced in this expression.

Source§

impl TLExpr

Source

pub fn validate_arity(&self) -> Result<(), String>

Validate that all predicates with the same name have consistent arity

Source§

impl TLExpr

Source

pub fn pred(name: impl Into<String>, args: Vec<Term>) -> Self

Source

pub fn and(left: TLExpr, right: TLExpr) -> Self

Source

pub fn or(left: TLExpr, right: TLExpr) -> Self

Source

pub fn negate(expr: TLExpr) -> Self

Source

pub fn exists( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self

Source

pub fn forall( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self

Source

pub fn imply(premise: TLExpr, conclusion: TLExpr) -> Self

Source

pub fn score(expr: TLExpr) -> Self

Source

pub fn add(left: TLExpr, right: TLExpr) -> Self

Source

pub fn sub(left: TLExpr, right: TLExpr) -> Self

Source

pub fn mul(left: TLExpr, right: TLExpr) -> Self

Source

pub fn div(left: TLExpr, right: TLExpr) -> Self

Source

pub fn pow(left: TLExpr, right: TLExpr) -> Self

Source

pub fn modulo(left: TLExpr, right: TLExpr) -> Self

Source

pub fn min(left: TLExpr, right: TLExpr) -> Self

Source

pub fn max(left: TLExpr, right: TLExpr) -> Self

Source

pub fn abs(expr: TLExpr) -> Self

Source

pub fn floor(expr: TLExpr) -> Self

Source

pub fn ceil(expr: TLExpr) -> Self

Source

pub fn round(expr: TLExpr) -> Self

Source

pub fn sqrt(expr: TLExpr) -> Self

Source

pub fn exp(expr: TLExpr) -> Self

Source

pub fn log(expr: TLExpr) -> Self

Source

pub fn sin(expr: TLExpr) -> Self

Source

pub fn cos(expr: TLExpr) -> Self

Source

pub fn tan(expr: TLExpr) -> Self

Source

pub fn eq(left: TLExpr, right: TLExpr) -> Self

Source

pub fn lt(left: TLExpr, right: TLExpr) -> Self

Source

pub fn gt(left: TLExpr, right: TLExpr) -> Self

Source

pub fn lte(left: TLExpr, right: TLExpr) -> Self

Source

pub fn gte(left: TLExpr, right: TLExpr) -> Self

Source

pub fn if_then_else( condition: TLExpr, then_branch: TLExpr, else_branch: TLExpr, ) -> Self

Source

pub fn constant(value: f64) -> Self

Source

pub fn aggregate( op: AggregateOp, var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self

Source

pub fn aggregate_with_group_by( op: AggregateOp, var: impl Into<String>, domain: impl Into<String>, body: TLExpr, group_by: Vec<String>, ) -> Self

Source

pub fn count( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self

Source

pub fn sum( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self

Source

pub fn average( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self

Source

pub fn max_agg( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self

Source

pub fn min_agg( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self

Source

pub fn product( var: impl Into<String>, domain: impl Into<String>, body: TLExpr, ) -> Self

Source

pub fn let_binding(var: impl Into<String>, value: TLExpr, body: TLExpr) -> Self

Source

pub fn modal_box(expr: TLExpr) -> Self

Create a Box (necessity) operator.

□P: “P is necessarily true” - holds in all possible worlds/states

Source

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

Source

pub fn next(expr: TLExpr) -> Self

Create a Next operator.

XP: “P is true in the next state”

Source

pub fn eventually(expr: TLExpr) -> Self

Create an Eventually operator.

FP: “P will eventually be true” - true in some future state

Source

pub fn always(expr: TLExpr) -> Self

Create an Always operator.

GP: “P is always true” - true in all future states

Source

pub fn until(before: TLExpr, after: TLExpr) -> Self

Create an Until operator.

P U Q: “P holds until Q becomes true”

Source

pub fn tnorm(kind: TNormKind, left: TLExpr, right: TLExpr) -> Self

Create a T-norm (fuzzy AND) operation with specified semantics.

Source

pub fn fuzzy_and(left: TLExpr, right: TLExpr) -> Self

Create a minimum T-norm (standard fuzzy AND).

Source

pub fn probabilistic_and(left: TLExpr, right: TLExpr) -> Self

Create a product T-norm (probabilistic AND).

Source

pub fn tconorm(kind: TCoNormKind, left: TLExpr, right: TLExpr) -> Self

Create a T-conorm (fuzzy OR) operation with specified semantics.

Source

pub fn fuzzy_or(left: TLExpr, right: TLExpr) -> Self

Create a maximum T-conorm (standard fuzzy OR).

Source

pub fn probabilistic_or(left: TLExpr, right: TLExpr) -> Self

Create a probabilistic sum T-conorm.

Source

pub fn fuzzy_not(kind: FuzzyNegationKind, expr: TLExpr) -> Self

Create a fuzzy negation with specified semantics.

Source

pub fn standard_fuzzy_not(expr: TLExpr) -> Self

Create a standard fuzzy negation (1 - x).

Source

pub fn fuzzy_imply( kind: FuzzyImplicationKind, premise: TLExpr, conclusion: TLExpr, ) -> Self

Create a fuzzy implication with specified semantics.

Source

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 name
  • domain - Domain name
  • body - Expression body
  • temperature - Temperature parameter (default 1.0). Lower = harder max.
Source

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 name
  • domain - Domain name
  • body - Expression body
  • temperature - Temperature parameter (default 1.0). Lower = harder min.
Source

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
Source

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

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”

Source

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”

Source

pub fn strong_release(released: TLExpr, releaser: TLExpr) -> Self

Create a Strong Release operator (M).

P M Q: Dual of weak until

Source

pub fn lambda( var: impl Into<String>, var_type: Option<String>, body: TLExpr, ) -> Self

Create a lambda abstraction: λvar. body

§Arguments
  • var - The parameter name
  • var_type - Optional type annotation for the parameter
  • body - The function body
Source

pub fn lambda_untyped(var: impl Into<String>, body: TLExpr) -> Self

Create a lambda abstraction without type annotation.

Source

pub fn apply(function: TLExpr, argument: TLExpr) -> Self

Create a function application: f(arg)

§Arguments
  • function - The function to apply
  • argument - The argument to apply to the function
Source

pub fn set_membership(element: TLExpr, set: TLExpr) -> Self

Create a set membership test: elem ∈ set

Source

pub fn set_union(left: TLExpr, right: TLExpr) -> Self

Create a set union: A ∪ B

Source

pub fn set_intersection(left: TLExpr, right: TLExpr) -> Self

Create a set intersection: A ∩ B

Source

pub fn set_difference(left: TLExpr, right: TLExpr) -> Self

Create a set difference: A \ B

Source

pub fn set_cardinality(set: TLExpr) -> Self

Create a set cardinality expression: |S|

Source

pub fn empty_set() -> Self

Create an empty set: ∅

Source

pub fn set_comprehension( var: impl Into<String>, domain: impl Into<String>, condition: TLExpr, ) -> Self

Create a set comprehension: { var : domain | condition }

Source

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”

Source

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”

Source

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”

Source

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”

Source

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)

Source

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)

Source

pub fn nominal(name: impl Into<String>) -> Self

Create a nominal (named state): @i

Source

pub fn at(nominal: impl Into<String>, formula: TLExpr) -> Self

Create a satisfaction operator: @i φ

“Formula φ is true at the nominal state i”

Source

pub fn somewhere(formula: TLExpr) -> Self

Create a “somewhere” modality: E φ

“φ is true in some reachable state”

Source

pub fn everywhere(formula: TLExpr) -> Self

Create an “everywhere” modality: A φ

“φ is true in all reachable states”

Source

pub fn all_different(variables: Vec<String>) -> Self

Create an all-different constraint.

All variables must have different values.

Source

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.

Source

pub fn abducible(name: impl Into<String>, cost: f64) -> Self

Create an abducible literal.

Can be assumed true for explanation with the given cost.

Source

pub fn explain(formula: TLExpr) -> Self

Mark a formula as needing explanation.

Source

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 replace
  • value - 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);

Trait Implementations§

Source§

impl Clone for TLExpr

Source§

fn clone(&self) -> TLExpr

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TLExpr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TLExpr

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for TLExpr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TLExpr

Source§

fn eq(&self, other: &TLExpr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for TLExpr

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TLExpr

Auto Trait Implementations§

§

impl Freeze for TLExpr

§

impl RefUnwindSafe for TLExpr

§

impl Send for TLExpr

§

impl Sync for TLExpr

§

impl Unpin for TLExpr

§

impl UnwindSafe for TLExpr

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,