pub type TLExpr = TLExpr;Expand description
Type alias for TensorLogic expressions
Aliased Type§
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