Model checking for linear temporal logic

DefinitionTruth-annotation states of the LTL tableau#✓fully proved

One Boolean for each syntactic occurrence in an LTL formula.

@[reducible]
def State : Formula Atom → Type
  | .atom _ => Bool
  | .top => Bool
  | .not φ => Bool × State φ
  | .and φ ψ => Bool × (State φ × State ψ)
  | .next φ => Bool × State φ
  | .until φ ψ => Bool × (State φ × State ψ)
Uses 1 · Used by 22

DefinitionRoot truth bit of a tableau annotation#✓fully proved

The truth bit at the root of an annotation.

def value : (φ : Formula Atom) → State φ → Bool
  | .atom _, s => s
  | .top, s => s
  | .not _, s => s.1
  | .and _ _, s => s.1
  | .next _, s => s.1
  | .until _ _, s => s.1
Uses 2 · Used by 9

DefinitionNumber of until fairness obligations#✓fully proved

The number of until occurrences, hence of fairness requirements.

def obligationCount : Formula Atom → ℕ
  | .atom _ => 0
  | .top => 0
  | .not φ => obligationCount φ
  | .and φ ψ => obligationCount φ + obligationCount ψ
  | .next φ => obligationCount φ
  | .until φ ψ => obligationCount φ + obligationCount ψ + 1
Uses 1 · Used by 17

DefinitionLocal transition relation of the LTL tableau#✓fully proved

Local equations at every occurrence. The symbol labels the source state.

Cslib.LTL.Tableau.step · 19 lines
def step (valuation : Symbol → Atom → Prop) :
    (φ : Formula Atom) → State φ → Symbol → State φ → Prop
  | .atom a, s, x, _ => s = true ↔ valuation x a
  | .top, s, _, _ => s = true
  | .not φ, s, x, t =>
      (s.1 = true ↔ ¬ value φ s.2 = true) ∧
        step valuation φ s.2 x t.2
  | .and φ ψ, s, x, t =>
      (s.1 = true ↔ value φ s.2.1 = true ∧ value ψ s.2.2 = true) ∧
        step valuation φ s.2.1 x t.2.1 ∧
        step valuation ψ s.2.2 x t.2.2
  | .next φ, s, x, t =>
      (s.1 = true ↔ value φ t.2 = true) ∧
        step valuation φ s.2 x t.2
  | .until φ ψ, s, x, t =>
      (s.1 = true ↔ value ψ s.2.2 = true ∨
        (value φ s.2.1 = true ∧ t.1 = true)) ∧
        step valuation φ s.2.1 x t.2.1 ∧
        step valuation ψ s.2.2 x t.2.2
Uses 3 · Used by 6

DefinitionBoolean test for an until fairness obligation#✓fully proved

The Boolean test for each until fairness requirement.

def obligation : (φ : Formula Atom) →
    Fin (obligationCount φ) → State φ → Bool
  | .atom _, i, _ => Fin.elim0 i
  | .top, i, _ => Fin.elim0 i
  | .not φ, i, s => obligation φ i s.2
  | .and φ ψ, i, s =>
      Fin.addCases (fun j => obligation φ j s.2.1)
        (fun j => obligation ψ j s.2.2) i
  | .next φ, i, s => obligation φ i s.2
  | .until φ ψ, i, s =>
      Fin.cases (!s.1 || value ψ s.2.2)
        (Fin.addCases (fun j => obligation φ j s.2.1)
          (fun j => obligation ψ j s.2.2)) i
Uses 4 · Used by 5

DefinitionFairness of a tableau annotation sequence#✓fully proved

Every until occurrence is absent or fulfilled at arbitrarily late times.

def Fair : (φ : Formula Atom) → ωSequence (State φ) → Prop
  | .atom _, _ => True
  | .top, _ => True
  | .not φ, ss => Fair φ (fun n => (ss n).2)
  | .and φ ψ, ss =>
      Fair φ (fun n => (ss n).2.1) ∧ Fair ψ (fun n => (ss n).2.2)
  | .next φ, ss => Fair φ (fun n => (ss n).2)
  | .until φ ψ, ss =>
      (∃ᶠ n in atTop, (ss n).1 = false ∨ value ψ (ss n).2.2 = true) ∧
        Fair φ (fun n => (ss n).2.1) ∧ Fair ψ (fun n => (ss n).2.2)
Uses 3 · Used by 3

DefinitionGeneralized Büchi tableau for an LTL formula#✓fully proved

Generalized Büchi tableau: the root is initially true.

def automaton (valuation : Symbol → Atom → Prop) (φ : Formula Atom) :
    Automata.NA.GenBuchi (State φ) Symbol where
  Tr := step valuation φ
  start := {s | value φ s = true}
  k := obligationCount φ
  accept i := {s | obligation φ i s = true}
Uses 7 · Used by 7

TheoremTableau fairness is generalized Büchi acceptance#✓fully proved

Structural fairness is exactly generalized Büchi acceptance.

theorem fair_iff (φ : Formula Atom) (ss : ωSequence (State φ)) :
    Fair φ ss ↔ ∀ i, ∃ᶠ n in atTop, obligation φ i (ss n) = true
Uses 6 · Used by 1

TheoremTableau acceptance via initial, local and fairness conditions#✓fully proved

Membership exposes exactly the initial, local, and fairness conditions.

theorem mem_language_iff (valuation : Symbol → Atom → Prop)
    (φ : Formula Atom) (w : ωSequence Symbol) :
    w ∈ language (automaton valuation φ) ↔
      ∃ ss : ωSequence (State φ), value φ (ss 0) = true ∧
        (∀ n, step valuation φ (ss n) (w n) (ss (n + 1))) ∧
        Fair φ ss
Uses 11 · Used by 1

TheoremLTL tableau accepts exactly the satisfying words#✓fully proved

The full tableau recognizes exactly the existing LTL satisfaction relation.

theorem mem_automaton_iff (valuation : Symbol → Atom → Prop)
    (φ : Formula Atom) (w : ωSequence Symbol) :
    w ∈ language (automaton valuation φ) ↔ Word.Satisfies valuation w φ
Uses 13 · Used by 1

TheoremGeneralized LTL tableau language equals the formula language#✓fully proved

Exact omega-language equality for the generalized tableau.

theorem language_automaton (valuation : Symbol → Atom → Prop) (φ : Formula Atom) :
    language (automaton valuation φ) = Word.language valuation φ
Uses 6 · Used by 1

DefinitionBüchi automaton for an LTL formula#✓fully proved

Ordinary Büchi recognition, using the existing fairness counter.

def buchi (valuation : Symbol → Atom → Prop) (φ : Formula Atom) :
    Automata.NA.Buchi (State φ × Fin (obligationCount φ + 1)) Symbol :=
  (automaton valuation φ).toBuchi
Uses 5 · Used by 8

TheoremBüchi automaton language equals the LTL formula language#✓fully proved

Every LTL formula has precisely its existing language as a Büchi language.

theorem language_buchi (valuation : Symbol → Atom → Prop) (φ : Formula Atom) :
    language (buchi valuation φ) = Word.language valuation φ
Uses 10 · Used by 2

TheoremBüchi automaton accepts exactly the satisfying words#✓fully proved

The ordinary Büchi recognizer accepts exactly satisfaction of the formula.

theorem mem_buchi_iff (valuation : Symbol → Atom → Prop)
    (φ : Formula Atom) (w : ωSequence Symbol) :
    w ∈ language (buchi valuation φ) ↔ Word.Satisfies valuation w φ
Uses 8 · Used by 1

TheoremEvery LTL formula has a finite-state Büchi automaton#✓fully proved

Every existing LTL formula has a finite-state Büchi recognizer under the same valuation. Neither atoms nor the alphabet need be finite or decidable.

theorem exists_buchi (valuation : Symbol → Atom → Prop) (φ : Formula Atom) :
    ∃ (S : Type) (_ : Finite S) (a : Automata.NA.Buchi S Symbol),
      language a = Word.language valuation φ
Uses 6

DefinitionInitial infinite run of a transition system#✓fully proved

An initial infinite state run, witnessed by a canonical action execution.

def IsRun (lts : LTS State Action) (initial : Set State)
    (w : ωSequence State) : Prop :=
  w 0 ∈ initial ∧ ∃ actions : ωSequence Action, lts.OmegaExecution w actions
Used by 6

TheoremRuns are sequences with a transition between adjacent states#✓fully proved

Equivalently, every adjacent state pair has a real model transition.

theorem isRun_iff (lts : LTS State Action) (initial : Set State)
    (w : ωSequence State) :
    IsRun lts initial w ↔ w 0 ∈ initial ∧
      ∀ n, ∃ action, lts.Tr (w n) action (w (n + 1))
Uses 1 · Used by 1

DefinitionProduct of a transition system with a Büchi recognizer#✓fully proved

Synchronized state-reading product, with the recognizer's Büchi condition.

def product (lts : LTS State Action) (initial : Set State)
    (a : Buchi Q State) : Buchi (State × Q) State where
  Tr p x q := x = p.1 ∧ (∃ action, lts.Tr p.1 action q.1) ∧ a.Tr p.2 x q.2
  start := {p | p.1 ∈ initial ∧ p.2 ∈ a.start}
  accept := {p | p.2 ∈ a.accept}
Used by 5

TheoremProduct accepts exactly the runs accepted by the recognizer#✓fully proved

A product accepts precisely the model runs accepted by its recognizer.

theorem mem_product_iff (lts : LTS State Action) (initial : Set State)
    (a : Buchi Q State) (w : ωSequence State) :
    w ∈ language (product lts initial a) ↔ IsRun lts initial w ∧ w ∈ language a
Uses 3 · Used by 1

DefinitionCounterexample product for an LTL formula#✓fully proved

The finite-state product for runs that violate the full LTL formula.

def counterexample (lts : LTS State Action) (initial : Set State)
    (valuation : State → Atom → Prop) (φ : Formula Atom) :
    Buchi (State × (Tableau.State (.not φ) ×
      Fin (Tableau.obligationCount (.not φ) + 1))) State :=
  product lts initial (Tableau.buchi valuation (.not φ))
Uses 5 · Used by 4

DefinitionSatisfaction of an LTL formula by all initial runs#✓fully proved

All initial infinite canonical executions satisfy the formula.

def Models (lts : LTS State Action) (initial : Set State)
    (valuation : State → Atom → Prop) (φ : Formula Atom) : Prop :=
  ∀ w : ωSequence State, IsRun lts initial w → Word.Satisfies valuation w φ
Uses 3 · Used by 3

TheoremCounterexample words are runs violating the formula#✓fully proved

A counterexample word is exactly an infinite model run violating LTL.

theorem mem_counterexample_iff (lts : LTS State Action) (initial : Set State)
    (valuation : State → Atom → Prop) (φ : Formula Atom) (w : ωSequence State) :
    w ∈ language (counterexample lts initial valuation φ) ↔
      IsRun lts initial w ∧ ¬ Word.Satisfies valuation w φ
Uses 10 · Used by 2

TheoremFinite-model LTL satisfaction iff no counterexample lasso#✓fully proved

Full-LTL model checking reduces to the proved finite Büchi lasso criterion. A cycle must be nonempty; neither seriality nor finite action/atom types are needed.

theorem models_iff_no_lasso [Finite State] (lts : LTS State Action)
    (initial : Set State) (valuation : State → Atom → Prop) (φ : Formula Atom) :
    Models lts initial valuation φ ↔
      ¬ (counterexample lts initial valuation φ).HasLasso
Uses 10

TheoremLTL satisfaction iff the counterexample language is empty#✓fully proved

Universal infinite-run satisfaction is emptiness of the counterexample language.

theorem models_iff_language_empty (lts : LTS State Action) (initial : Set State)
    (valuation : State → Atom → Prop) (φ : Formula Atom) :
    Models lts initial valuation φ ↔
      language (counterexample lts initial valuation φ) = ⊥
Uses 8 · Used by 1

DefinitionComputable fairness-counter update#✓fully proved

Computable fairness-counter update, reading the destination annotation.

def advance (φ : Formula Atom) (i : Fin (obligationCount φ + 1)) (t : State φ) :
    Fin (obligationCount φ + 1) :=
  if h : i.val < obligationCount φ then
    if obligation φ ⟨i.val, h⟩ t = true then ⟨i.val + 1, by omega⟩ else i
  else ⟨0, Nat.zero_lt_succ _⟩
Uses 4 · Used by 4

TheoremComputable counter update equals generic degeneralization#✓fully proved

The computable update is exactly the existing generic degeneralization.

theorem nextCount_eq_advance (valuation : Symbol → Atom → Prop) (φ : Formula Atom)
    (i : Fin (obligationCount φ + 1)) (t : State φ) :
    (automaton valuation φ).nextCount i t = advance φ i t
Uses 8 · Used by 1

TheoremBüchi transition test via the computable counter update#✓fully proved

The existing Büchi transition can be tested using the computable update.

theorem buchi_tr_iff (valuation : Symbol → Atom → Prop) (φ : Formula Atom)
    (p : State φ × Fin (obligationCount φ + 1)) (x : Symbol)
    (q : State φ × Fin (obligationCount φ + 1)) :
    (buchi valuation φ).Tr p x q ↔
      step valuation φ p.1 x q.1 ∧ q.2 = advance φ p.2 q.1
Uses 10 · Used by 2

DefinitionExecutable full-LTL model checker#✓fully proved

Full-LTL checking by the existing finite Büchi reachability algorithm. The finite/decidable data requirements are only for execution, not recognition.

def checkB : Bool := by
  letI : DecidablePred (· ∈ (Tableau.buchi valuation (.not φ)).start) :=
    Tableau.buchiStartDecidable valuation (.not φ)
  letI : DecidablePred (· ∈ (Tableau.buchi valuation (.not φ)).accept) :=
    Tableau.buchiAcceptDecidable valuation (.not φ)
  exact (product lts initial (Tableau.buchi valuation (.not φ))).isEmptyB
Uses 10 · Used by 1

TheoremCorrectness of the executable LTL model checker#✓fully proved

The executable checker is correct for all initial infinite model runs.

theorem checkB_iff :
    checkB lts initial valuation φ = true ↔ Models lts initial valuation φ
Uses 15
29 fully proved

The dependency explorer needs JavaScript and its graph data.

Download the complete graph data.