Skip to main content

Formula

Enum Formula 

Source
pub enum Formula {
    True,
    AtLeast {
        signal: usize,
        threshold: f64,
    },
    AtMost {
        signal: usize,
        threshold: f64,
    },
    Not(Box<Formula>),
    And(Vec<Formula>),
    Or(Vec<Formula>),
    Always {
        from: usize,
        to: usize,
        formula: Box<Formula>,
    },
    Eventually {
        from: usize,
        to: usize,
        formula: Box<Formula>,
    },
    Until {
        from: usize,
        to: usize,
        left: Box<Formula>,
        right: Box<Formula>,
    },
}
Expand description

An STL formula over signals indexed 0...

Variants§

§

True

Always true (ρ = +∞).

§

AtLeast

x_signal ≥ threshold.

Fields

§signal: usize

The signal index.

§threshold: f64

The threshold c.

§

AtMost

x_signal ≤ threshold.

Fields

§signal: usize

The signal index.

§threshold: f64

The threshold c.

§

Not(Box<Formula>)

Negation.

§

And(Vec<Formula>)

Conjunction; empty is True.

§

Or(Vec<Formula>)

Disjunction; empty is false (-∞).

§

Always

G[from, to] φ: φ holds at every step of the window.

Fields

§from: usize

The window start, relative to the current step.

§to: usize

The window end (inclusive), >= from.

§formula: Box<Formula>

The formula that must hold throughout.

§

Eventually

F[from, to] φ: φ holds at some step of the window.

Fields

§from: usize

The window start, relative to the current step.

§to: usize

The window end (inclusive), >= from.

§formula: Box<Formula>

The formula that must hold once.

§

Until

φ U[from, to] ψ: ψ holds at some step of the window and φ at every step before.

Fields

§from: usize

The window start, relative to the current step.

§to: usize

The window end (inclusive), >= from.

§left: Box<Formula>

The formula that must hold until right does.

§right: Box<Formula>

The formula that must eventually hold.

Implementations§

Source§

impl Formula

Source

pub fn ge(signal: usize, threshold: f64) -> Self

x_signal ≥ threshold.

Source

pub fn le(signal: usize, threshold: f64) -> Self

x_signal ≤ threshold.

Source

pub fn not(formula: Self) -> Self

¬φ.

Source

pub fn and(formulas: Vec<Self>) -> Self

φ_1 ∧ … ∧ φ_k.

Source

pub fn or(formulas: Vec<Self>) -> Self

φ_1 ∨ … ∨ φ_k.

Source

pub fn always(from: usize, to: usize, formula: Self) -> Self

G[from, to] φ.

Source

pub fn eventually(from: usize, to: usize, formula: Self) -> Self

F[from, to] φ.

Source

pub fn until(from: usize, to: usize, left: Self, right: Self) -> Self

φ U[from, to] ψ.

Source

pub fn robustness<S: AsRef<[f64]>>(&self, trace: &[S]) -> f64

The robustness at the first step of trace.

Source

pub fn violation<S: AsRef<[f64]>>(&self, trace: &[S]) -> f64

The constraint violation max(0, -ρ) at the first step: 0 when satisfied.

Source

pub fn signal<S: AsRef<[f64]>>(&self, trace: &[S], len: usize) -> Vec<f64>

The robustness at every step 0..len (steps past the trace see an empty future).

Source

pub fn complexity(&self) -> usize

The number of nodes, the complexity term of fit().

Source

pub fn thresholds(&self) -> Vec<f64>

The predicate thresholds in depth-first order: the parameters fit() tunes.

Source

pub fn with_thresholds(&self, values: &[f64]) -> Self

A copy with the thresholds replaced, in the order of Formula::thresholds; missing values leave thresholds unchanged.

Trait Implementations§

Source§

impl Clone for Formula

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Formula

Source§

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

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

impl PartialEq for Formula

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Formula

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.