ELTLSpecificationBuilder

Struct ELTLSpecificationBuilder 

Source
pub struct ELTLSpecificationBuilder<'a, T: ThresholdAutomaton> {
    ta: &'a T,
    properties: Vec<ELTLProperty>,
}
Expand description

Builder for building an ELTLSpecification over a threshold automaton

§Example

use taco_threshold_automaton::general_threshold_automaton::builder::GeneralThresholdAutomatonBuilder;
use taco_threshold_automaton::expressions::{IntegerExpression, ComparisonOp, Location, Variable};
use taco_model_checker::eltl::{ELTLExpression, ELTLSpecificationBuilder};

let ta = GeneralThresholdAutomatonBuilder::new("test_ta1")
    .with_variables(vec![
        Variable::new("var1"),
        Variable::new("var2"),
        Variable::new("var3"),
    ])
    .unwrap()
    .with_locations(vec![
        Location::new("loc1"),
        Location::new("loc2"),
    ])
    .unwrap()
    .initialize()
    .build();

let mut builder = ELTLSpecificationBuilder::new(&ta);

let expr1 = ELTLExpression::LocationExpr(
    Box::new(IntegerExpression::Atom(Location::new("loc1"))),
    ComparisonOp::Eq,
    Box::new(IntegerExpression::Const(2)),
);

let expr2 = ELTLExpression::LocationExpr(
    Box::new(IntegerExpression::Atom(Location::new("loc2"))),
    ComparisonOp::Eq,
    Box::new(IntegerExpression::Const(0)),
);

builder.add_expressions(vec![
    ("spec1".to_string(), expr1),
    ("spec2".to_string(), expr2),
]).unwrap();

let spec = builder.build();

assert_eq!(spec.expressions().len(), 2);
assert!(spec.expressions().iter().any(|(name, _)| name == "spec1"));
assert!(spec.expressions().iter().any(|(name, _)| name == "spec2"));

Fields§

§ta: &'a T

Threshold automaton associated with the expressions

§properties: Vec<ELTLProperty>

Collection of tuples of expression names and the ELTL expression

Implementations§

Source§

impl<T: ThresholdAutomaton> ELTLSpecificationBuilder<'_, T>

Source

fn check_for_unknown_identifier<S>( &self, expr: &IntegerExpression<S>, ) -> Result<(), InternalELTLExpressionBuilderError>
where S: Atomic, Self: IsDeclared<S>,

Check if all identifiers in the expression are known

Returns () if no unknown identifier is found, otherwise the name of the unknown identifier

Source

fn check_contains_parameter_expression( expr: &ELTLExpression, ) -> Result<(), InternalELTLExpressionBuilderError>

Check whether an ELTL expression contains a parameter expression

Source

fn replace_trivial_expressions(expr: ELTLExpression) -> ELTLExpression

Replaces parameter expressions that do not contain parameters

Source

fn validate_property( &self, expr: &ELTLExpression, ) -> Result<(), InternalELTLExpressionBuilderError>

Check if all atoms in the expression are known in the threshold automaton associated with the builder and that all location expressions are valid

Source

pub fn add_expression( &mut self, name: String, expr: ELTLExpression, ) -> Result<(), ELTLExpressionBuilderError>

Add a new ELTL expression to the specification

This function checks if all atoms in the expression are known in the threshold automaton associated with the builder. If an unknown atom is found, an error is returned. Otherwise the expression is added to the specification.

This function also returns an error if the name of the expression is already used in the specification.

Source

pub fn add_expressions( &mut self, expressions: impl IntoIterator<Item = ELTLProperty>, ) -> Result<(), ELTLExpressionBuilderError>

Add multiple ELTL expressions to the specification

This function checks if all atoms in the expression are known in the threshold automaton associated with the builder. If an unknown atom is found, an error is returned. Otherwise the expression is added to the specification.

This function also returns an error if the name of the expression is already used in the specification.

Source

pub fn build(self) -> ELTLSpecification

Build the ELTL specification

Returns the ELTL specification containing all added expressions

Source§

impl<'a, T: ThresholdAutomaton> ELTLSpecificationBuilder<'a, T>

Source

pub fn new(ta: &'a T) -> Self

Create a new empty ELTL specification builder

Trait Implementations§

Source§

impl<T: ThresholdAutomaton> IsDeclared<Location> for ELTLSpecificationBuilder<'_, T>

Source§

fn is_declared(&self, obj: &Location) -> bool

Check if object of type T is declared
Source§

impl<T: ThresholdAutomaton> IsDeclared<Parameter> for ELTLSpecificationBuilder<'_, T>

Source§

fn is_declared(&self, obj: &Parameter) -> bool

Check if object of type T is declared
Source§

impl<T: ThresholdAutomaton> IsDeclared<Variable> for ELTLSpecificationBuilder<'_, T>

Source§

fn is_declared(&self, obj: &Variable) -> bool

Check if object of type T is declared

Auto Trait Implementations§

§

impl<'a, T> Freeze for ELTLSpecificationBuilder<'a, T>

§

impl<'a, T> RefUnwindSafe for ELTLSpecificationBuilder<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for ELTLSpecificationBuilder<'a, T>
where T: Sync,

§

impl<'a, T> Sync for ELTLSpecificationBuilder<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for ELTLSpecificationBuilder<'a, T>

§

impl<'a, T> UnwindSafe for ELTLSpecificationBuilder<'a, T>
where T: RefUnwindSafe,

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