| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Hermod.ReCon.LTL.Formula
Synopsis
- type PropName = Text
- type VariableIdentifier = Text
- type IntValue = Int64
- type TextValue = Text
- data IntTerm
- data TextTerm
- data BinRel
- data PropConstraint
- data Formula event ty
- = Forall Word (Formula event ty)
- | ForallN Word (Formula event ty)
- | ExistsN Word (Formula event ty)
- | Next (Formula event ty)
- | NextN Word (Formula event ty)
- | UntilN Word (Formula event ty) (Formula event ty)
- | Atom ty (Set PropConstraint)
- | Or (Formula event ty) (Formula event ty)
- | And (Formula event ty) (Formula event ty)
- | Not (Formula event ty)
- | Implies (Formula event ty) (Formula event ty)
- | Top
- | Bottom
- | PropIntForall VariableIdentifier (Formula event ty)
- | PropTextForall VariableIdentifier (Formula event ty)
- | PropIntForallN VariableIdentifier (Set IntValue) (Formula event ty)
- | PropTextForallN VariableIdentifier (Set TextValue) (Formula event ty)
- | PropIntExists VariableIdentifier (Formula event ty)
- | PropTextExists VariableIdentifier (Formula event ty)
- | PropIntExistsN VariableIdentifier (Set IntValue) (Formula event ty)
- | PropTextExistsN VariableIdentifier (Set TextValue) (Formula event ty)
- | PropIntBinRel BinRel (Relevance event ty) IntTerm IntTerm
- | PropTextEq (Relevance event ty) TextTerm TextValue
- unfoldForall :: Word -> Formula event ty -> Formula event ty
- unfoldForallN :: Word -> Formula event ty -> Formula event ty
- unfoldExistsN :: Word -> Formula event ty -> Formula event ty
- unfoldNextN :: Word -> Formula event ty -> Formula event ty
- unfoldUntilN :: Word -> Formula event ty -> Formula event ty -> Formula event ty
- relevance :: (Ord event, Ord ty) => Formula event ty -> Relevance event ty
- type Relevance event ty = Set (event, ty)
- and :: [Formula event ty] -> Formula event ty
- interpTimeunit :: (Word -> Word) -> Formula event ty -> Formula event ty
- data OnMissingKey
- class Event a ty | a -> ty where
Documentation
type VariableIdentifier = Text Source #
The type of variable identifiers used throughout the framework (LTL property variables and polynomial integer variables).
type IntValue = Int64 Source #
The numeric type used for integer event property values and polynomial arithmetic throughout the framework.
Instances
| Show IntTerm Source # | |
| Eq IntTerm Source # | |
| Ord IntTerm Source # | |
Defined in Hermod.ReCon.Integer.Polynomial.Term | |
Text term: a constant string or a variable ranging over strings.
Constructors
| TextConst TextValue | |
| TextVar VariableIdentifier |
Instances
| Show TextTerm Source # | |
| Eq TextTerm Source # | |
| Ord TextTerm Source # | |
Defined in Hermod.ReCon.LTL.Formula | |
Binary comparison relation on an ordered type.
Instances
| Show BinRel Source # | |
| Eq BinRel Source # | |
| Ord BinRel Source # | |
data PropConstraint Source #
Default name: c.
A constraint inside an Atom, matching an event property against a term.
Constructors
| IntPropConstraint PropName IntTerm | |
| TextPropConstraint PropName TextTerm |
Instances
| Show PropConstraint Source # | |
Defined in Hermod.ReCon.LTL.Formula | |
| Eq PropConstraint Source # | |
Defined in Hermod.ReCon.LTL.Formula Methods (==) :: PropConstraint -> PropConstraint -> Bool Source # (/=) :: PropConstraint -> PropConstraint -> Bool Source # | |
| Ord PropConstraint Source # | |
Defined in Hermod.ReCon.LTL.Formula Methods compare :: PropConstraint -> PropConstraint -> Ordering Source # (<) :: PropConstraint -> PropConstraint -> Bool Source # (<=) :: PropConstraint -> PropConstraint -> Bool Source # (>) :: PropConstraint -> PropConstraint -> Bool Source # (>=) :: PropConstraint -> PropConstraint -> Bool Source # max :: PropConstraint -> PropConstraint -> PropConstraint Source # min :: PropConstraint -> PropConstraint -> PropConstraint Source # | |
data Formula event ty Source #
Default name: φ.
Formulas of a discrete-time Linear Temporal Logic (LTL) enriched with first-order quantification over event properties.
Time model.
Time is a sequence of abstract units indexed by natural numbers.
Each unit carries a finite multiset of typed events (see Event).
The temporal connectives advance through this sequence:
◯ φ— next unit☐ ᪲ₖ φ— every(k+1)-th unit from now, forever☐ⁿ φ— for each of the nextnunits♢ⁿ φ— for some unit within the nextnφ |ⁿ ψ—φuntilψ, withinnunits
Parameterisation.
The type parameter ty is the vocabulary of event types; event is the
concrete event representation (see Event). Atoms () assert
that the current unit contains an event of type Atom ty csty whose properties
satisfy the constraints cs.
First-order layer.
Quantifiers ∀x ∈ ℤ, ∃x ∈ ℤ, ∀x ∈ Text, ∃x ∈ Text, and their
finite-domain variants, bind variables that can appear in property
constraints, integer comparison atoms (), and text
equality atoms (PropIntBinRel). The resulting fragment is decidable:
integer arithmetic is handled by Cooper's quantifier elimination;
text quantifiers are decided by finite enumeration (see
Hermod.ReCon.LTL.Internal.IR.HomogeneousFormula.FinFree).PropTextEq
Constructors
| Forall Word (Formula event ty) | ☐ ᪲ₖ φ ≡ φ ∧ ◯ (◯ᵏ (☐ ᪲ₖ)) For every (k+1)-th unit of time from now, φ For example: ☐ ᪲₁ φ means for every other unit of time from now, φ ☐ ᪲₃ φ means for every 4-th unit of time from now, φ ☐ ᪲₀ φ means for every unit of time from now, φ |
| ForallN Word (Formula event ty) | ☐ⁿ φ ☐⁰ φ ≡ ⊤ ☐¹⁺ᵏ φ ≡ φ ∧ ◯ (☐ᵏ φ) For each of the n units of time from now, φ |
| ExistsN Word (Formula event ty) | ♢ⁿ φ ♢⁰ φ ≡ ⊥ ♢¹⁺ᵏ φ ≡ φ ∨ ◯ (♢ᵏ φ) For one of the n units of time from now, φ |
| Next (Formula event ty) | ◯ φ For the next unit of time from now, φ. |
| NextN Word (Formula event ty) | ◯ⁿ φ ◯⁰ φ ≡ φ ◯¹⁺ᵏ φ ≡ ◯ (◯ᵏ φ) For the n-th unit of time from now, φ |
| UntilN Word (Formula event ty) (Formula event ty) | φ |ⁿ ψ φ |⁰ ψ ≡ ⊤ φ |¹⁺ᵏ ψ ≡ ψ ∨ ¬ ψ ∧ φ ∧ (φ |ᵏ ψ) φ until ψ in the n units of time from now |
| Atom ty (Set PropConstraint) | ty c̄ |
| Or (Formula event ty) (Formula event ty) | φ ∨ ψ |
| And (Formula event ty) (Formula event ty) | φ ∧ ψ |
| Not (Formula event ty) | ¬ φ |
| Implies (Formula event ty) (Formula event ty) | φ ⇒ ψ |
| Top | T |
| Bottom | ⊥ |
| PropIntForall VariableIdentifier (Formula event ty) | ∀x ∈ ℤ. φ — x ranges over all integers |
| PropTextForall VariableIdentifier (Formula event ty) | ∀x ∈ Text. φ — x ranges over all strings |
| PropIntForallN VariableIdentifier (Set IntValue) (Formula event ty) | ∀x ∈ v̄. φ — x ranges over the given integers |
| PropTextForallN VariableIdentifier (Set TextValue) (Formula event ty) | ∀x ∈ v̄. φ — x ranges over the given strings |
| PropIntExists VariableIdentifier (Formula event ty) | ∃x ∈ ℤ. φ — x ranges over all integers |
| PropTextExists VariableIdentifier (Formula event ty) | ∃x ∈ Text. φ — x ranges over all strings |
| PropIntExistsN VariableIdentifier (Set IntValue) (Formula event ty) | ∃x ∈ v̄. φ — x ranges over the given integers |
| PropTextExistsN VariableIdentifier (Set TextValue) (Formula event ty) | ∃x ∈ v̄. φ — x ranges over the given strings |
| PropIntBinRel BinRel (Relevance event ty) IntTerm IntTerm | t rel t (integer) |
| PropTextEq (Relevance event ty) TextTerm TextValue | t = v (text) |
Instances
| (Show ty, Show event) => Show (Formula event ty) Source # | |
| (Eq ty, Eq event) => Eq (Formula event ty) Source # | |
| (Ord ty, Ord event) => Ord (Formula event ty) Source # | |
Defined in Hermod.ReCon.LTL.Formula Methods compare :: Formula event ty -> Formula event ty -> Ordering Source # (<) :: Formula event ty -> Formula event ty -> Bool Source # (<=) :: Formula event ty -> Formula event ty -> Bool Source # (>) :: Formula event ty -> Formula event ty -> Bool Source # (>=) :: Formula event ty -> Formula event ty -> Bool Source # max :: Formula event ty -> Formula event ty -> Formula event ty Source # min :: Formula event ty -> Formula event ty -> Formula event ty Source # | |
relevance :: (Ord event, Ord ty) => Formula event ty -> Relevance event ty Source #
Compute the total Relevance of the formula.
interpTimeunit :: (Word -> Word) -> Formula event ty -> Formula event ty Source #
It's useful to express temporal aspect of the formulas in a familiar time unit (e.g milliseconds). Yet, the LTL machinery works with nameless abstract time units. This function can be used to convert one into the other.
data OnMissingKey Source #
Controls evaluator behaviour when a formula atom references a property key that is absent from the event being evaluated.
BottomOnMissingKey— treat the atom as unsatisfied (⊥); evaluation continues silently. Useful when events may legally omit optional fields.CrashOnMissingKey— throw an exception. Useful during development to catch formula/event-schema mismatches early.
Constructors
| BottomOnMissingKey | |
| CrashOnMissingKey |
class Event a ty | a -> ty where Source #
Default name: e.
Interface between a concrete event representation a and the LTL
evaluator. The functional dependency a -> ty fixes the event-type
vocabulary once the event type is known.
Semantics.
Each time unit presents a sequence of events to the evaluator. An
is satisfied by unit Atom ty cst if there exists an event e in
t such that:
holds, andofTye ty- every constraint
c ∈ csmatcheseagainstorintPropse ty(seetextPropse tysatisfiability-semantics.txt).
Precondition.
and intProps are only called when textProps is
ofTy e tyTrue; their behaviour is unspecified otherwise.
Methods
ofTy :: a -> ty -> Bool Source #
— is event ofTy e tye of type ty?
intProps :: a -> ty -> Map VariableIdentifier IntValue Source #
Integer-valued properties of e relevant to type ty,
keyed by property name. Precondition: .ofTy e ty
textProps :: a -> ty -> Map VariableIdentifier TextValue Source #
Text-valued properties of e relevant to type ty,
keyed by property name. Precondition: .ofTy e ty
Timestamp of the event in microseconds. Used for diagnostics only; the LTL evaluator does not reason about wall-clock time.
Instances
| Event TemporalEvent Text Source # | |
Defined in Hermod.ReCon.Trace.Event Methods ofTy :: TemporalEvent -> Text -> Bool Source # intProps :: TemporalEvent -> Text -> Map VariableIdentifier IntValue Source # textProps :: TemporalEvent -> Text -> Map VariableIdentifier TextValue Source # beg :: TemporalEvent -> Word64 Source # | |