ELTLExpression

Enum ELTLExpression 

Source
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

Source

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);
Source

fn negate_expression(&self) -> NonNegatedELTLExpression

Source§

impl ELTLExpression

Source

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

Source§

type Output = ELTLExpression

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl BitOr for ELTLExpression

Source§

type Output = ELTLExpression

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl Clone for ELTLExpression

Source§

fn clone(&self) -> ELTLExpression

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 ELTLExpression

Source§

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

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

impl Display for ELTLExpression

Source§

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

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

impl From<ELTLExpression> for NonNegatedELTLExpression

Source§

fn from(value: ELTLExpression) -> Self

Converts to this type from the input type.
Source§

impl Hash for ELTLExpression

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Not for ELTLExpression

Source§

type Output = ELTLExpression

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl PartialEq for ELTLExpression

Source§

fn eq(&self, other: &ELTLExpression) -> 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 StructuralPartialEq for ELTLExpression

Auto Trait Implementations§

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.