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 ψ)
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
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
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
@[reducible]
def State : Formula Atom → Type
| .atom _ => Bool
| .top => Bool
| .not φ => Bool × State φ
| .and φ ψ => Bool × (State φ × State ψ)
| .next φ => Bool × State φ
| .until φ ψ => Bool × (State φ × State ψ)
CSLibExt/Logics/LTL/Tableau.lean:34
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
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
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
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
@[reducible]
def State : Formula Atom → Type
| .atom _ => Bool
| .top => Bool
| .not φ => Bool × State φ
| .and φ ψ => Bool × (State φ × State ψ)
| .next φ => Bool × State φ
| .until φ ψ => Bool × (State φ × State ψ)
CSLibExt/Logics/LTL/Tableau.lean:34
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
CSLibExt/Logics/LTL/Tableau.lean:81
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
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
def obligationCount : Formula Atom → ℕ
| .atom _ => 0
| .top => 0
| .not φ => obligationCount φ
| .and φ ψ => obligationCount φ + obligationCount ψ
| .next φ => obligationCount φ
| .until φ ψ => obligationCount φ + obligationCount ψ + 1
CSLibExt/Logics/LTL/Tableau.lean:90
@[reducible]
def State : Formula Atom → Type
| .atom _ => Bool
| .top => Bool
| .not φ => Bool × State φ
| .and φ ψ => Bool × (State φ × State ψ)
| .next φ => Bool × State φ
| .until φ ψ => Bool × (State φ × State ψ)
CSLibExt/Logics/LTL/Tableau.lean:34
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
CSLibExt/Logics/LTL/Tableau.lean:81
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)
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
@[reducible]
def State : Formula Atom → Type
| .atom _ => Bool
| .top => Bool
| .not φ => Bool × State φ
| .and φ ψ => Bool × (State φ × State ψ)
| .next φ => Bool × State φ
| .until φ ψ => Bool × (State φ × State ψ)
CSLibExt/Logics/LTL/Tableau.lean:34
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
CSLibExt/Logics/LTL/Tableau.lean:81
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}
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
structure GenBuchi (State Symbol : Type*) extends NA State Symbol where
/-- The number of acceptance sets. -/
k : ℕ
/-- The acceptance sets. -/
accept : Fin k → Set State
CSLibExt/Computability/Automata/NA/GeneralizedBuchi.lean:56
@[reducible]
def State : Formula Atom → Type
| .atom _ => Bool
| .top => Bool
| .not φ => Bool × State φ
| .and φ ψ => Bool × (State φ × State ψ)
| .next φ => Bool × State φ
| .until φ ψ => Bool × (State φ × State ψ)
CSLibExt/Logics/LTL/Tableau.lean:34
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 =>
⋯
CSLibExt/Logics/LTL/Tableau.lean:99
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
CSLibExt/Logics/LTL/Tableau.lean:81
def obligationCount : Formula Atom → ℕ
| .atom _ => 0
| .top => 0
| .not φ => obligationCount φ
| .and φ ψ => obligationCount φ + obligationCount ψ
| .next φ => obligationCount φ
| .until φ ψ => obligationCount φ + obligationCount ψ + 1
CSLibExt/Logics/LTL/Tableau.lean:90
accept : Fin k → Set State
CSLibExt/Computability/Automata/NA/GeneralizedBuchi.lean:60
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)
⋯
CSLibExt/Logics/LTL/Tableau.lean:120
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
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
@[reducible]
def State : Formula Atom → Type
| .atom _ => Bool
| .top => Bool
| .not φ => Bool × State φ
| .and φ ψ => Bool × (State φ × State ψ)
| .next φ => Bool × State φ
| .until φ ψ => Bool × (State φ × State ψ)
CSLibExt/Logics/LTL/Tableau.lean:34
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)
CSLibExt/Logics/LTL/Tableau.lean:137
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)
⋯
CSLibExt/Logics/LTL/Tableau.lean:120
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
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
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}
CSLibExt/Logics/LTL/Tableau.lean:149
@[reducible]
def State : Formula Atom → Type
| .atom _ => Bool
| .top => Bool
| .not φ => Bool × State φ
| .and φ ψ => Bool × (State φ × State ψ)
| .next φ => Bool × State φ
| .until φ ψ => Bool × (State φ × State ψ)
CSLibExt/Logics/LTL/Tableau.lean:34
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
CSLibExt/Logics/LTL/Tableau.lean:81
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 =>
⋯
CSLibExt/Logics/LTL/Tableau.lean:99
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)
CSLibExt/Logics/LTL/Tableau.lean:137
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 φ
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
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}
CSLibExt/Logics/LTL/Tableau.lean:149
def Satisfies (valuation : Symbol → Atom → Prop) (w : ωSequence Symbol) :
Formula Atom → Prop
| .atom a => valuation (w 0) a
| .top => True
| .not φ => ¬ Satisfies valuation w φ
| .and φ ψ => Satisfies valuation w φ ∧ Satisfies valuation w ψ
| .next φ => Satisfies valuation w.tail φ
| .until φ ψ =>
∃ k, Satisfies valuation (w.drop k) ψ ∧ ∀ j < k, Satisfies valuation (w.drop j) φ
CSLibExt/Logics/LTL/OmegaWord.lean:66
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 φ
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
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}
CSLibExt/Logics/LTL/Tableau.lean:149
def language (valuation : Symbol → Atom → Prop) (φ : Formula Atom) : ωLanguage Symbol :=
{ w : ωSequence Symbol | Satisfies valuation w φ }
CSLibExt/Logics/LTL/OmegaWord.lean:82
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
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
@[reducible]
def State : Formula Atom → Type
| .atom _ => Bool
| .top => Bool
| .not φ => Bool × State φ
| .and φ ψ => Bool × (State φ × State ψ)
| .next φ => Bool × State φ
| .until φ ψ => Bool × (State φ × State ψ)
CSLibExt/Logics/LTL/Tableau.lean:34
def obligationCount : Formula Atom → ℕ
| .atom _ => 0
| .top => 0
| .not φ => obligationCount φ
| .and φ ψ => obligationCount φ + obligationCount ψ
| .next φ => obligationCount φ
| .until φ ψ => obligationCount φ + obligationCount ψ + 1
CSLibExt/Logics/LTL/Tableau.lean:90
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}
CSLibExt/Logics/LTL/Tableau.lean:149
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 φ
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
def buchi (valuation : Symbol → Atom → Prop) (φ : Formula Atom) :
Automata.NA.Buchi (State φ × Fin (obligationCount φ + 1)) Symbol :=
(automaton valuation φ).toBuchi
CSLibExt/Logics/LTL/FullBuchi.lean:251
def language (valuation : Symbol → Atom → Prop) (φ : Formula Atom) : ωLanguage Symbol :=
{ w : ωSequence Symbol | Satisfies valuation w φ }
CSLibExt/Logics/LTL/OmegaWord.lean:82
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 φ
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
def buchi (valuation : Symbol → Atom → Prop) (φ : Formula Atom) :
Automata.NA.Buchi (State φ × Fin (obligationCount φ + 1)) Symbol :=
(automaton valuation φ).toBuchi
CSLibExt/Logics/LTL/FullBuchi.lean:251
def Satisfies (valuation : Symbol → Atom → Prop) (w : ωSequence Symbol) :
Formula Atom → Prop
| .atom a => valuation (w 0) a
| .top => True
| .not φ => ¬ Satisfies valuation w φ
| .and φ ψ => Satisfies valuation w φ ∧ Satisfies valuation w ψ
| .next φ => Satisfies valuation w.tail φ
| .until φ ψ =>
∃ k, Satisfies valuation (w.drop k) ψ ∧ ∀ j < k, Satisfies valuation (w.drop j) φ
CSLibExt/Logics/LTL/OmegaWord.lean:66
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 φ
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
def language (valuation : Symbol → Atom → Prop) (φ : Formula Atom) : ωLanguage Symbol :=
{ w : ωSequence Symbol | Satisfies valuation w φ }
CSLibExt/Logics/LTL/OmegaWord.lean:82
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))
def IsRun (lts : LTS State Action) (initial : Set State)
(w : ωSequence State) : Prop :=
w 0 ∈ initial ∧ ∃ actions : ωSequence Action, lts.OmegaExecution w actions
CSLibExt/Logics/LTL/ModelChecking.lean:37
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}
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
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}
CSLibExt/Logics/LTL/ModelChecking.lean:55
def IsRun (lts : LTS State Action) (initial : Set State)
(w : ωSequence State) : Prop :=
w 0 ∈ initial ∧ ∃ actions : ωSequence Action, lts.OmegaExecution w actions
CSLibExt/Logics/LTL/ModelChecking.lean:37
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 φ))
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
@[reducible]
def State : Formula Atom → Type
| .atom _ => Bool
| .top => Bool
| .not φ => Bool × State φ
| .and φ ψ => Bool × (State φ × State ψ)
| .next φ => Bool × State φ
| .until φ ψ => Bool × (State φ × State ψ)
CSLibExt/Logics/LTL/Tableau.lean:34
def obligationCount : Formula Atom → ℕ
| .atom _ => 0
| .top => 0
| .not φ => obligationCount φ
| .and φ ψ => obligationCount φ + obligationCount ψ
| .next φ => obligationCount φ
| .until φ ψ => obligationCount φ + obligationCount ψ + 1
CSLibExt/Logics/LTL/Tableau.lean:90
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}
CSLibExt/Logics/LTL/ModelChecking.lean:55
def buchi (valuation : Symbol → Atom → Prop) (φ : Formula Atom) :
Automata.NA.Buchi (State φ × Fin (obligationCount φ + 1)) Symbol :=
(automaton valuation φ).toBuchi
CSLibExt/Logics/LTL/FullBuchi.lean:251
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 φ
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
def IsRun (lts : LTS State Action) (initial : Set State)
(w : ωSequence State) : Prop :=
w 0 ∈ initial ∧ ∃ actions : ωSequence Action, lts.OmegaExecution w actions
CSLibExt/Logics/LTL/ModelChecking.lean:37
def Satisfies (valuation : Symbol → Atom → Prop) (w : ωSequence Symbol) :
Formula Atom → Prop
| .atom a => valuation (w 0) a
| .top => True
| .not φ => ¬ Satisfies valuation w φ
| .and φ ψ => Satisfies valuation w φ ∧ Satisfies valuation w ψ
| .next φ => Satisfies valuation w.tail φ
| .until φ ψ =>
∃ k, Satisfies valuation (w.drop k) ψ ∧ ∀ j < k, Satisfies valuation (w.drop j) φ
CSLibExt/Logics/LTL/OmegaWord.lean:66
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 φ
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
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 φ))
CSLibExt/Logics/LTL/ModelChecking.lean:80
def IsRun (lts : LTS State Action) (initial : Set State)
(w : ωSequence State) : Prop :=
w 0 ∈ initial ∧ ∃ actions : ωSequence Action, lts.OmegaExecution w actions
CSLibExt/Logics/LTL/ModelChecking.lean:37
def Satisfies (valuation : Symbol → Atom → Prop) (w : ωSequence Symbol) :
Formula Atom → Prop
| .atom a => valuation (w 0) a
| .top => True
| .not φ => ¬ Satisfies valuation w φ
| .and φ ψ => Satisfies valuation w φ ∧ Satisfies valuation w ψ
| .next φ => Satisfies valuation w.tail φ
| .until φ ψ =>
∃ k, Satisfies valuation (w.drop k) ψ ∧ ∀ j < k, Satisfies valuation (w.drop j) φ
CSLibExt/Logics/LTL/OmegaWord.lean:66
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
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
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 φ
CSLibExt/Logics/LTL/ModelChecking.lean:87
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 φ))
CSLibExt/Logics/LTL/ModelChecking.lean:80
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 φ) = ⊥
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
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 φ
CSLibExt/Logics/LTL/ModelChecking.lean:87
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 φ))
CSLibExt/Logics/LTL/ModelChecking.lean:80
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 _⟩
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
def obligationCount : Formula Atom → ℕ
| .atom _ => 0
| .top => 0
| .not φ => obligationCount φ
| .and φ ψ => obligationCount φ + obligationCount ψ
| .next φ => obligationCount φ
| .until φ ψ => obligationCount φ + obligationCount ψ + 1
CSLibExt/Logics/LTL/Tableau.lean:90
@[reducible]
def State : Formula Atom → Type
| .atom _ => Bool
| .top => Bool
| .not φ => Bool × State φ
| .and φ ψ => Bool × (State φ × State ψ)
| .next φ => Bool × State φ
| .until φ ψ => Bool × (State φ × State ψ)
CSLibExt/Logics/LTL/Tableau.lean:34
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)
⋯
CSLibExt/Logics/LTL/Tableau.lean:120
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
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
def obligationCount : Formula Atom → ℕ
| .atom _ => 0
| .top => 0
| .not φ => obligationCount φ
| .and φ ψ => obligationCount φ + obligationCount ψ
| .next φ => obligationCount φ
| .until φ ψ => obligationCount φ + obligationCount ψ + 1
CSLibExt/Logics/LTL/Tableau.lean:90
@[reducible]
def State : Formula Atom → Type
| .atom _ => Bool
| .top => Bool
| .not φ => Bool × State φ
| .and φ ψ => Bool × (State φ × State ψ)
| .next φ => Bool × State φ
| .until φ ψ => Bool × (State φ × State ψ)
CSLibExt/Logics/LTL/Tableau.lean:34
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}
CSLibExt/Logics/LTL/Tableau.lean:149
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 _⟩
CSLibExt/Logics/LTL/DecidableModelChecking.lean:64
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
inductive Formula (Atom : Type u) : Type u where
| atom (a : Atom) : Formula Atom
| top : Formula Atom
| not (φ : Formula Atom) : Formula Atom
| and (φ ψ : Formula Atom) : Formula Atom
| next (φ : Formula Atom) : Formula Atom
| until (φ ψ : Formula Atom) : Formula Atom
deriving DecidableEq, Repr
CSLibExt/Logics/LTL/Syntax.lean:37
@[reducible]
def State : Formula Atom → Type
| .atom _ => Bool
| .top => Bool
| .not φ => Bool × State φ
| .and φ ψ => Bool × (State φ × State ψ)
| .next φ => Bool × State φ
| .until φ ψ => Bool × (State φ × State ψ)
CSLibExt/Logics/LTL/Tableau.lean:34
def obligationCount : Formula Atom → ℕ
| .atom _ => 0
| .top => 0
| .not φ => obligationCount φ
| .and φ ψ => obligationCount φ + obligationCount ψ
| .next φ => obligationCount φ
| .until φ ψ => obligationCount φ + obligationCount ψ + 1
CSLibExt/Logics/LTL/Tableau.lean:90
def buchi (valuation : Symbol → Atom → Prop) (φ : Formula Atom) :
Automata.NA.Buchi (State φ × Fin (obligationCount φ + 1)) Symbol :=
(automaton valuation φ).toBuchi
CSLibExt/Logics/LTL/FullBuchi.lean:251
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 =>
⋯
CSLibExt/Logics/LTL/Tableau.lean:99
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 _⟩
CSLibExt/Logics/LTL/DecidableModelChecking.lean:64
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 φ
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
CSLibExt/Logics/LTL/DecidableModelChecking.lean:148
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 φ
CSLibExt/Logics/LTL/ModelChecking.lean:87
Uses 15
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.