Runtime verification


From [2]:

Runtime verification avoids the complexity of traditional formal verification techniques (like model checking and theorem proving) by analyzing only one or a few execution traces and working directly with the actual system. Thus, runtime verification scales up relatively well and gives more confidence in the results of the analysis because it avoids the tedious and error-prone step of formally modeling the system (at the expense of reduced coverage).

From abstract of this:

Runtime verification is the topic of analyzing execution traces using formal techniques.

Safety property

Liveness property

Every finite prefix can be extended to have a run that satisfies the property. ie, we can never be sure.

From abstract of [1]:

liveliness properties stipulate that "something good" events really happens during execution

Morbidity

Every finite prefix can be extended to have a run that violates the property. ie, we can never be sure.

Non-monitorable property

Not all properties are monitorable

Eg: □(◇ p): ie, that a property holds infinitely often.

DBT: ie, all liveness and morbidity properties are non-monitorable??

Prefix

Classification of properties

As per [2]:

Class Prefix Verdict on Pnueli
Safety Bad Failure
Guarantee / co-safety Good Success
Liveness Ugly Never
Morbidity Ugly Never
Class Description Monitorable
AFR If false, bad prefix exists Yes
AFS If true, good prefix exists Yes
NFR No
NFS No
SFR
SFS

Only property that's both a safety and guarantee property is true:

Only property that's both a liveness and morbidity property is false:

Model checking vs runtime verification

Model checking Runtime verification
Checks if all possible runs Checks if a particular run
satisfies the property satisfies the property
A language inclusion problem A word inclusion problem

Formal methods

Based on mathematical theories like

From a 2008 issue of AMS ³:

A formal proof is a proof in which every logical inference has been checked all the way back to the fundamental axioms of mathematics. All the intermediate logical steps are supplied, without exception. No appeal is made to intuition, even if the translation from intuition to logic is routine. Thus, a formal proof is less intuitive, and yet less susceptible to logical errors.

In the same AMS issue, from 'Formal Proof-Theory and Practice' by John Harrison:

A formal proof is a proof written in a precise artificial language that admits only a fixed repertoire of stylized steps. This formal language is usually designed so that there is a purely mechanical process by which the correctness of a proof in the language can be verified.

Spec

An abstract description of the system.

A system is correct if it meets its requirements.

'Program correctness' has meaning only with respect to a spec.

The spec usually says something to this effect:

something bad cannot happen and something good will happen

Testing vs verification

Although formal verification doesn't mean 100% guarantee, it can come quite close. It definitely increases the trustworthiness of the system.

Errors in spec

Wrong spec means result of verification cannot be relied upon either.

Types of errors in th spec level include:

LTL

Linear Temporal Logic

Syntax:

φ := true
   | p
   | φ ∧ φ
   | ¬ φ
   | φ U φ
   | X φ

Derived:

 - F φ ≡ true U φ

 - G φ ≡ φ U false
       ≡ φ U (¬ true)
       ≡ ¬ [◇ (¬ φ)]

 - φ ∨ ψ ≡ ¬ [(¬ φ) ∧ (¬ ψ)]

 - φ → ψ ≡ (¬ φ) ∨ ψ

Originally LTL specs were made for sequences of states, but for RV we usually indicate occurrence of events.

Monitor

A monitor checks whether an execution (ie, a finite prefix of a run) satisfies a property.

If ⟦φ⟧ is the set of executions that satisfies a spec φ, and the current execution is w, runtime verification boils down to checking if w ∈ ⟦φ⟧. [1]

So, runtime verification corresponds to a word problem. ie, checking whether a given word (w) is part of a given language (⟦φ⟧).

References

  1. Alpern, B. and Schneider, F.B., 1985. Defining liveness. Information processing letters, 21(4), pp.181-185.
  2. Peled, D. and Havelund, K., 2019. Refining the safety–liveness classification of temporal properties according to monitorability. In Models, Mindsets, Meta: The What, the How, and the Why Not? (pp. 218-234). Springer, Cham.
  3. Lamport, L., 1977. Proving the correctness of multiprocess programs. IEEE transactions on software engineering, (2), pp.125-143.
  1. Leucker, M. and Schallhart, C., 2009. A brief account of runtime verification. The journal of logic and algebraic programming, 78(5), pp.293-303.
  2. Daian, P., Guth, D., Hathhorn, C., Li, Y., Pek, E., Saxena, M., Şerbănuţă, T.F. and Roşu, G., 2016, September. Runtime verification at work: A tutorial. In International Conference on Runtime Verification (pp. 46-67). Springer, Cham.