LIAThresholdAutomaton

Struct LIAThresholdAutomaton 

Source
pub struct LIAThresholdAutomaton {
    ta: GeneralThresholdAutomaton,
    init_variable_constr: Vec<LIAVariableConstraint>,
    rules: HashMap<Location, Vec<LIARule>>,
    additional_vars_for_sums: HashMap<Variable, WeightedSum<Variable>>,
}
Expand description

A linear arithmetic threshold automaton or LIAThresholdAutomaton is a threshold automaton containing linear arithmetic guards. The goal of the LIAThresholdAutomaton is to stay as close to the formal definition of a threshold automaton as possible.

To convert a GeneralThresholdAutomaton to a LIAThresholdAutomaton all guards are translated into one of these forms:

  • SingleAtomConstraint: Which represents a threshold in the form x <COMPARISON_OP> c_1 * p_1 + ... c_n * p_n + c where c_1, ..., c_n, c are rational constants, p_1, ..., p_n are Parameters and x is a single shared variable.
  • SumAtomConstraint: Represents a threshold of the form cx_1 * x_1 + ... + cx_m * x_m <COMPARISON_OP> c_1 * p_1 + ... c_n * p_n + c where c_1, ..., c_n, cx_1, ..., cx_m, c are rational constants, p_1, ..., p_n are Parameters and x_1, …, x_m are shared variables. Additionally, all coefficients cx_1, ..., cx_m must be all positive.
  • ComparisonConstraint: Comparison constraints are structured analog to a SumAtomConstraint, but allow mixing positive and negative constants in the constants cx_1, ..., cx_m.

Note that not all algorithms support all types of guards. Especially the ComparisonConstraint makes the verification problem undecidable (even without decrements and or resets). For more information see:

All Flavors of Threshold Automata - Jure Kukovec, Igor Konnov, Josef Widder - https://doi.org/10.4230/LIPIcs.CONCUR.2018.19

Fields§

§ta: GeneralThresholdAutomaton

GeneralThresholdAutomaton the canonical automaton has been constructed from

§init_variable_constr: Vec<LIAVariableConstraint>

Initial conditions on variables in linear arithmetic

§rules: HashMap<Location, Vec<LIARule>>

Transition rules of the threshold automaton indexed by source location

§additional_vars_for_sums: HashMap<Variable, WeightedSum<Variable>>

Additional variables that are used to replace sums TODO: remove when a proper ordering for sums of variables is implemented

Implementations§

Source§

impl LIAThresholdAutomaton

Source

pub fn into_ta_without_sum_vars(self) -> Self

This function will remove any LIAVariableConstraint::SumVarConstraint and replace them with a new variable that is incremented/reset/decremented when any of its components is incremented, reset, or decremented.

This is not the most efficient solution for error graphs, but it is the simplest.

TODO: replace when more capable interval ordering is ready (see note in module no_sum_var docs)

Source

pub fn get_replacement_vars_for_sumvars( &self, ) -> &HashMap<Variable, WeightedSum<Variable>>

Get the helper variables that have been added to replace sums of variables

Source

fn create_new_variable_for_sumvar( s: &WeightedSum<Variable>, lta: &LIAThresholdAutomaton, ) -> Variable

Creates a new unique name for a sum of variables

Source§

impl LIAThresholdAutomaton

Source

pub fn get_max_number_of_thresholds_per_rule(&self) -> u32

Get the maximum number of thresholds in a single rule of the threshold automaton

Source

pub fn get_ta(&self) -> &GeneralThresholdAutomaton

Get a reference to the GeneralThresholdAutomaton this automaton has been derived from

Source

pub fn has_sum_var_threshold_guard(&self) -> bool

Check if the canonical threshold automaton contains a guard over as sum of variables, i.e., some guard contains a SumAtomConstraint

Source

pub fn has_comparison_guard(&self) -> bool

Check if the canonical threshold automaton has a comparison guard,i.e., some guard contains a ComparisonConstraint

Source

pub fn get_single_var_constraints_rules( &self, ) -> HashSet<SingleAtomConstraint<Variable>>

Get all appearing SingleAtomConstraints

This function returns all appearing SingleAtomConstraints in the rules of a threshold automaton. The constraints are deduplicated.

Source

pub fn get_sum_var_constraints(&self) -> HashSet<SumAtomConstraint<Variable>>

Get all appearing SumAtomConstraints

This function returns all appearing SumAtomConstraints in the rules of a threshold automaton. The constraints are deduplicated.

Source

pub fn get_comparison_guards(&self) -> HashSet<ComparisonConstraint<Variable>>

Get all appearing ComparisonConstraints

This function returns all appearing ComparisonConstraints in the rules of a threshold automaton. The constraints are deduplicated.

Source

pub fn get_thresholds(&self) -> HashSet<Threshold>

Get the number of distinct thresholds appearing in the definition of the threshold automaton

Source

pub fn get_derived_rule(&self, r: &LIARule) -> Rule

Get the Rule this rule has been derived from

Trait Implementations§

Source§

impl Clone for LIAThresholdAutomaton

Source§

fn clone(&self) -> LIAThresholdAutomaton

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 LIAThresholdAutomaton

Source§

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

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

impl Display for LIAThresholdAutomaton

Source§

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

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

impl IsDeclared<Location> for LIAThresholdAutomaton

Source§

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

Check if object of type T is declared
Source§

impl IsDeclared<Parameter> for LIAThresholdAutomaton

Source§

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

Check if object of type T is declared
Source§

impl IsDeclared<Variable> for LIAThresholdAutomaton

Source§

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

Check if object of type T is declared
Source§

impl PartialEq for LIAThresholdAutomaton

Source§

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

Source§

type Rule = LIARule

Type of the rules of the threshold automaton
Source§

type InitialVariableConstraintType = LIAVariableConstraint

Type of the initial variable conditions of the threshold automaton
Source§

fn name(&self) -> &str

Get the name of the threshold automaton
Source§

fn variables(&self) -> impl Iterator<Item = &Variable>

Get the shared variables of the threshold automaton
Source§

fn parameters(&self) -> impl Iterator<Item = &Parameter>

Get the parameters of the threshold automaton
Source§

fn locations(&self) -> impl Iterator<Item = &Location>

Get the locations of the threshold automaton
Source§

fn resilience_conditions( &self, ) -> impl Iterator<Item = &BooleanExpression<Parameter>>

Get the resilience condition of the threshold automaton
Source§

fn can_be_initial_location(&self, location: &Location) -> bool

Check if a location can be initial by the location constraints of the threshold automaton Read more
Source§

fn rules(&self) -> impl Iterator<Item = &Self::Rule>

Get the rules of the threshold automaton
Source§

fn incoming_rules( &self, location: &Location, ) -> impl Iterator<Item = &Self::Rule>

Get incoming rules to a location Read more
Source§

fn outgoing_rules( &self, location: &Location, ) -> impl Iterator<Item = &Self::Rule>

Get outgoing rules for a location Read more
Source§

fn initial_location_constraints( &self, ) -> impl Iterator<Item = &LocationConstraint>

Get the initial location constraints of the threshold automaton
Source§

fn initial_variable_constraints( &self, ) -> impl Iterator<Item = &LIAVariableConstraint>

Get the initial variable constraints of the threshold automaton
Source§

fn has_decrements_or_resets(&self) -> bool

Check whether the threshold automaton contains any decrements or resets
Source§

fn has_decrements(&self) -> bool

Check whether the threshold automaton contains any decrements
Source§

fn has_resets(&self) -> bool

Check whether the threshold automaton contains any resets
Source§

impl TryFrom<GeneralThresholdAutomaton> for LIAThresholdAutomaton

Source§

type Error = LIATransformationError

The type returned in the event of a conversion error.
Source§

fn try_from(ta: GeneralThresholdAutomaton) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl StructuralPartialEq for LIAThresholdAutomaton

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

Source§

fn get_dot_diff(&self, other: &T) -> String

Get the difference between two objects in DOT format 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> ToDOT for T

Source§

fn get_dot_graph(&self) -> String

Get the underlying graph in DOT format 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.