# Kripke structure (model checking)

A Kripke structure is a variation of the transition system, originally proposed by Saul Kripke, used in model checking to represent the behavior of a system. It consists of a graph whose nodes represent the reachable states of the system and whose edges represent state transitions, together with a labelling function which maps each node to a set of properties that hold in the corresponding state. Temporal logics are traditionally interpreted in terms of Kripke structures.

## Formal definition

Let AP be a set of atomic propositions, i.e. boolean-valued expressions formed from variables, constants and predicate symbols. Clarke et al. define a Kripke structure over AP as a 4-tuple M = (S, I, R, L) consisting of
* a finite set of states S.
* a set of initial states I ⊆ S.
* a transition relation R ⊆ S × S such that R is left-total, i.e., ∀s ∈ S ∃s' ∈ S such that (s,s') ∈ R.
* a labeling (or interpretation) function L: S → 2$^{AP}$.
Since R is left-total, it is always possible to construct an infinite path through the Kripke structure. A deadlock state can be modeled by a single outgoing edge back to itself. The labeling function L defines for each state s ∈ S the set L(s) of all atomic propositions that are valid in s.
A path of the structure M is a sequence of states ρ = s$_1$, s$_2$, s$_3$, ... such that for each i > 0, R(s$_i$, s$_{i+1}$) holds. The word on the path ρ is the sequence of sets of the atomic propositions w = L(s$_1$), L(s$_2$), L(s$_3$), ..., which is an ω-word over alphabet 2$^{AP}$.
With this definition, a Kripke structure (say, having only one initial state i ∈ I) may be identified with a Moore machine with a singleton input alphabet, and with the output function being its labeling function.

## Example

Let the set of atomic propositions AP = {p, q}. p and q can model arbitrary boolean properties of the system that the Kripke structure is modelling.
The figure at right illustrates a Kripke structure M = (S, I, R, L), where
* S = {s$_1$, s$_2$, s$_3$}.
* I = {s$_1$}.
* R = {(s$_1$, s$_2$), (s$_2$, s$_1$) (s$_2$, s$_3$), (s$_3$, s$_3$)}.
* L = {(s$_1$, {p, q}), (s$_2$, {q}), (s$_3$, {p})}.
M may produce a path ρ = s$_1$, s$_2$, s$_1$, s$_2$, s$_3$, s$_3$, s$_3$, ... and w = {p, q}, {q}, {p, q}, {q}, {p}, {p}, {p}, ... is the execution word over the path ρ. M can produce execution words belonging to the language ({p, q}{q})*({p})$^ω$ ∪ ({p, q}{q})$^ω$.

## Relation to other notions

Although this terminology is widespread in the model checking community, some textbooks on model checking do not define "Kripke structure" in this extended way (or at all in fact), but simply use the concept of a (labelled) transition system, which additionally has a set Act of actions, and the transition relation is defined as a subset of S × Act × S, which they additionally extend to include a set of atomic propositions and a labeling function for the states as well (L as defined above.) In this approach, the binary relation obtained by abstracting away the action labels is called a state graph.
Clarke et al. redefine a Kripke structure as a set of transitions (instead of just one), which is equivalent to the labeled transitions above, when they define the semantics of modal μ-calculus.