pub enum ELTLExpression {
Implies(Box<ELTLExpression>, Box<ELTLExpression>),
Globally(Box<ELTLExpression>),
Eventually(Box<ELTLExpression>),
And(Box<ELTLExpression>, Box<ELTLExpression>),
Or(Box<ELTLExpression>, Box<ELTLExpression>),
Not(Box<ELTLExpression>),
LocationExpr(Box<IntegerExpression<Location>>, ComparisonOp, Box<IntegerExpression<Location>>),
VariableExpr(Box<IntegerExpression<Variable>>, ComparisonOp, Box<IntegerExpression<Variable>>),
ParameterExpr(Box<IntegerExpression<Parameter>>, ComparisonOp, Box<IntegerExpression<Parameter>>),
True,
False,
}Expand description
ELTL (LTL without next) expressions for threshold automata
This module provides the types defining ELTL expressions without a next operator for threshold automata. In the literature these formulas are also called ELTL or fault-tolerant temporal logic.
§Example
use taco_threshold_automaton::expressions::{IntegerExpression, ComparisonOp, Location};
use taco_model_checker::eltl::ELTLExpression;
// loc1 = 0 => □(loc_agree_1 = 0)
let _ = ELTLExpression::Implies(
Box::new(ELTLExpression::LocationExpr(
Box::new(IntegerExpression::Atom(Location::new("loc1"))),
ComparisonOp::Eq,
Box::new(IntegerExpression::Const(0)),
)),
Box::new(ELTLExpression::Globally(
Box::new(ELTLExpression::LocationExpr(
Box::new(IntegerExpression::Atom(Location::new("loc_agree_1"))),
ComparisonOp::Eq,
Box::new(IntegerExpression::Const(0)),
)),
)));Variants§
Implies(Box<ELTLExpression>, Box<ELTLExpression>)
Implication ⟹
Globally(Box<ELTLExpression>)
Globally □
Eventually(Box<ELTLExpression>)
Eventually ◇
And(Box<ELTLExpression>, Box<ELTLExpression>)
And ∧
Or(Box<ELTLExpression>, Box<ELTLExpression>)
Or ∨
Not(Box<ELTLExpression>)
Not ¬
LocationExpr(Box<IntegerExpression<Location>>, ComparisonOp, Box<IntegerExpression<Location>>)
Boolean constraint over the number of processes in a location
VariableExpr(Box<IntegerExpression<Variable>>, ComparisonOp, Box<IntegerExpression<Variable>>)
Boolean constraint over the value of a variable
ParameterExpr(Box<IntegerExpression<Parameter>>, ComparisonOp, Box<IntegerExpression<Parameter>>)
Expression over the value of parameters
True
Always true
False
Always false
Implementations§
Source§impl ELTLExpression
impl ELTLExpression
Sourcepub fn remove_negations(&self) -> NonNegatedELTLExpression
pub fn remove_negations(&self) -> NonNegatedELTLExpression
Remove boolean negations from an expression, transforming the expression
into a NonNegatedELTLExpression expression.
This method is used to remove negations and implications from an LTL expression. Implications are simply transformed into disjunctions, and negations are pushed down to the atomic expressions.
§Example
use taco_model_checker::eltl::ELTLExpression;
use taco_threshold_automaton::expressions::{ComparisonOp, Variable, IntegerExpression};
use taco_model_checker::eltl::remove_negations::NonNegatedELTLExpression;
// (1 = 2) => (x = 1)
let ltl = ELTLExpression::Implies(
Box::new(ELTLExpression::LocationExpr(
Box::new(IntegerExpression::Const(1)),
ComparisonOp::Eq,
Box::new(IntegerExpression::Const(2)),
)),
Box::new(ELTLExpression::VariableExpr(
Box::new(IntegerExpression::Atom(Variable::new("x"))),
ComparisonOp::Eq,
Box::new(IntegerExpression::Const(1)),
)),
);
let non_negated_ltl = ltl.remove_negations();
// (1 != 2) ∨ (x = 1)
let expected = NonNegatedELTLExpression::Or(
Box::new(NonNegatedELTLExpression::LocationExpr(
Box::new(IntegerExpression::Const(1)),
ComparisonOp::Neq,
Box::new(IntegerExpression::Const(2)),
)),
Box::new(NonNegatedELTLExpression::VariableExpr(
Box::new(IntegerExpression::Atom(Variable::new("x"))),
ComparisonOp::Eq,
Box::new(IntegerExpression::Const(1)),
)),
);
assert_eq!(non_negated_ltl, expected);fn negate_expression(&self) -> NonNegatedELTLExpression
Source§impl ELTLExpression
impl ELTLExpression
Sourcepub fn contains_temporal_operator(&self) -> bool
pub fn contains_temporal_operator(&self) -> bool
Check if the expression contains a temporal operator
Returns true if the expression contains a temporal operator,
otherwise false
§Example
use taco_threshold_automaton::expressions::{IntegerExpression, ComparisonOp, Location};
use taco_model_checker::eltl::ELTLExpression;
let expression = ELTLExpression::LocationExpr(
Box::new(IntegerExpression::Atom(Location::new("loc1"))),
ComparisonOp::Eq,
Box::new(IntegerExpression::Atom(Location::new("loc2"))),
);
assert!(!expression.contains_temporal_operator());
let expression = ELTLExpression::Globally(Box::new(ELTLExpression::LocationExpr(
Box::new(IntegerExpression::Atom(Location::new("loc1"))),
ComparisonOp::Eq,
Box::new(IntegerExpression::Atom(Location::new("loc2"))),
)));
assert!(expression.contains_temporal_operator());Trait Implementations§
Source§impl BitAnd for ELTLExpression
impl BitAnd for ELTLExpression
Source§impl BitOr for ELTLExpression
impl BitOr for ELTLExpression
Source§impl Clone for ELTLExpression
impl Clone for ELTLExpression
Source§fn clone(&self) -> ELTLExpression
fn clone(&self) -> ELTLExpression
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ELTLExpression
impl Debug for ELTLExpression
Source§impl Display for ELTLExpression
impl Display for ELTLExpression
Source§impl From<ELTLExpression> for NonNegatedELTLExpression
impl From<ELTLExpression> for NonNegatedELTLExpression
Source§fn from(value: ELTLExpression) -> Self
fn from(value: ELTLExpression) -> Self
Source§impl Hash for ELTLExpression
impl Hash for ELTLExpression
Source§impl Not for ELTLExpression
impl Not for ELTLExpression
Source§impl PartialEq for ELTLExpression
impl PartialEq for ELTLExpression
impl StructuralPartialEq for ELTLExpression
Auto Trait Implementations§
impl Freeze for ELTLExpression
impl RefUnwindSafe for ELTLExpression
impl Send for ELTLExpression
impl Sync for ELTLExpression
impl Unpin for ELTLExpression
impl UnwindSafe for ELTLExpression
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more