Büchi automata for a fragment of linear temporal logic
InductivePropositional formulas#✓fully proved
The propositional formulas over a set of atoms are generated by the atoms, the constant truth \(\top\), negation \(\neg\varphi\) and conjunction \(\varphi \wedge \psi\).
inductive PropFormula (Atom : Type*) where
/-- An atom, true at a letter containing it. -/
| atom (a : Atom) : PropFormula Atom
/-- Truth. -/
| top : PropFormula Atom
/-- Negation. -/
| not (φ : PropFormula Atom) : PropFormula Atom
/-- Conjunction. -/
| and (φ ψ : PropFormula Atom) : PropFormula Atom
Used by 13
DefinitionEvaluating a propositional formula at a letter#✓fully proved
A letter is a set \(s\) of atoms (the atoms true at it). A propositional formula is evaluated at \(s\) by recursion: an atom \(a\) is true iff \(a \in s\), truth \(\top\) is true, \(\neg\varphi\) is true iff \(\varphi\) is not, and \(\varphi \wedge \psi\) is true iff both \(\varphi\) and \(\psi\) are true.
def eval : PropFormula Atom → Set Atom → Prop
| .atom a, s => a ∈ s
| .top, _ => True
| .not φ, s => ¬ eval φ s
| .and φ ψ, s => eval φ s ∧ eval ψ s
inductive PropFormula (Atom : Type*) where
/-- An atom, true at a letter containing it. -/
| atom (a : Atom) : PropFormula Atom
/-- Truth. -/
| top : PropFormula Atom
/-- Negation. -/
| not (φ : PropFormula Atom) : PropFormula Atom
/-- Conjunction. -/
| and (φ ψ : PropFormula Atom) : PropFormula Atom
CSLibExt/Logics/LTL/FragmentBuchi.lean:83
Uses 1 · Used by 8
DefinitionPropositional formulas as LTL formulas#✓fully proved
The translation of propositional formulas into LTL formulas is defined by recursion: an atom \(a\) goes to the LTL atom \(a\), truth goes to the LTL truth constant \(\top\), \(\neg\varphi\) goes to the LTL negation of the translation of \(\varphi\), and \(\varphi \wedge \psi\) goes to the LTL conjunction of the translations of \(\varphi\) and \(\psi\).
def toLTL : PropFormula Atom → Formula Atom
| .atom a => .atom a
| .top => .top
| .not φ => .not (toLTL φ)
| .and φ ψ => .and (toLTL φ) (toLTL ψ)
inductive PropFormula (Atom : Type*) where
/-- An atom, true at a letter containing it. -/
| atom (a : Atom) : PropFormula Atom
/-- Truth. -/
| top : PropFormula Atom
/-- Negation. -/
| not (φ : PropFormula Atom) : PropFormula Atom
/-- Conjunction. -/
| and (φ ψ : PropFormula Atom) : PropFormula Atom
CSLibExt/Logics/LTL/FragmentBuchi.lean:83
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 2 · Used by 7
TheoremPropositional formulas are evaluated at the first letter#✓fully proved
Let \(\varphi\) be a propositional formula and let \(w = w_0 w_1 w_2 \dots\) be an ω-word whose letters are sets of atoms. Under the valuation in which an atom holds at a letter exactly when it belongs to that letter, \(w\) satisfies the LTL translation of \(\varphi\) if and only if \(\varphi\) evaluates to true on the first letter \(w_0\).
theorem satisfies_toLTL (φ : PropFormula Atom) (w : ωSequence (Set Atom)) :
Word.Satisfies (fun s a => a ∈ s) w φ.toLTL ↔ φ.eval (w 0)
inductive PropFormula (Atom : Type*) where
/-- An atom, true at a letter containing it. -/
| atom (a : Atom) : PropFormula Atom
/-- Truth. -/
| top : PropFormula Atom
/-- Negation. -/
| not (φ : PropFormula Atom) : PropFormula Atom
/-- Conjunction. -/
| and (φ ψ : PropFormula Atom) : PropFormula Atom
CSLibExt/Logics/LTL/FragmentBuchi.lean:83
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
TheoremPropositional formulas are evaluated at the current letter#✓fully proved
Let \(\varphi\) be a propositional formula, let \(w = w_0 w_1 w_2 \dots\) be an ω-word whose letters are sets of atoms, and let \(k \in \mathbb{N}\). Under the valuation in which an atom holds at a letter exactly when it belongs to that letter, the LTL translation of \(\varphi\) holds at position \(k\) of \(w\) if and only if \(\varphi\) evaluates to true on the letter \(w_k\).
theorem satisfiesAt_toLTL (φ : PropFormula Atom) (w : ωSequence (Set Atom)) (k : ℕ) :
Word.SatisfiesAt (fun s a => a ∈ s) w k φ.toLTL ↔ φ.eval (w k)
inductive PropFormula (Atom : Type*) where
/-- An atom, true at a letter containing it. -/
| atom (a : Atom) : PropFormula Atom
/-- Truth. -/
| top : PropFormula Atom
/-- Negation. -/
| not (φ : PropFormula Atom) : PropFormula Atom
/-- Conjunction. -/
| and (φ ψ : PropFormula Atom) : PropFormula Atom
CSLibExt/Logics/LTL/FragmentBuchi.lean:83
def SatisfiesAt (valuation : Symbol → Atom → Prop) (w : ωSequence Symbol) (k : ℕ)
(φ : Formula Atom) : Prop :=
Satisfies valuation (w.drop k) φ
CSLibExt/Logics/LTL/OmegaWord.lean:77
Uses 7 · Used by 3
The always automaton
DefinitionOne-state Büchi automaton for always φ#✓fully proved
The one-state Büchi automaton for G φ with φ propositional: it stays
forever, requiring every letter to satisfy φ.
def alwaysNa (φ : PropFormula Atom) : Buchi Unit (Set Atom) where
Tr _ s _ := φ.eval s
start := {()}
accept := {()}
inductive PropFormula (Atom : Type*) where
/-- An atom, true at a letter containing it. -/
| atom (a : Atom) : PropFormula Atom
/-- Truth. -/
| top : PropFormula Atom
/-- Negation. -/
| not (φ : PropFormula Atom) : PropFormula Atom
/-- Conjunction. -/
| and (φ ψ : PropFormula Atom) : PropFormula Atom
CSLibExt/Logics/LTL/FragmentBuchi.lean:83
Uses 2 · Used by 2
TheoremThe always automaton recognizes G φ#✓fully proved
For a propositional formula \(\varphi\), the one-state Büchi automaton for \(\mathbf{G}\,\varphi\) accepts exactly the infinite words of letters (sets of atoms) that satisfy the LTL formula \(\mathbf{G}\,\varphi\), where an atom \(a\) holds at a letter \(s\) iff \(a \in s\).
theorem language_alwaysNa (φ : PropFormula Atom) :
language (alwaysNa φ) =
Word.language (fun s a => a ∈ s) (Formula.always φ.toLTL)
inductive PropFormula (Atom : Type*) where
/-- An atom, true at a letter containing it. -/
| atom (a : Atom) : PropFormula Atom
/-- Truth. -/
| top : PropFormula Atom
/-- Negation. -/
| not (φ : PropFormula Atom) : PropFormula Atom
/-- Conjunction. -/
| and (φ ψ : PropFormula Atom) : PropFormula Atom
CSLibExt/Logics/LTL/FragmentBuchi.lean:83
def alwaysNa (φ : PropFormula Atom) : Buchi Unit (Set Atom) where
Tr _ s _ := φ.eval s
start := {()}
accept := {()}
CSLibExt/Logics/LTL/FragmentBuchi.lean:132
def language (valuation : Symbol → Atom → Prop) (φ : Formula Atom) : ωLanguage Symbol :=
{ w : ωSequence Symbol | Satisfies valuation w φ }
CSLibExt/Logics/LTL/OmegaWord.lean:82
def always (φ : Formula Atom) : Formula Atom := .not (eventually (.not φ))
CSLibExt/Logics/LTL/Syntax.lean:66
Uses 13 · Used by 1
The G F / F G automata
TheoremThe infinitely-often automaton recognizes G F φ#✓fully proved
Let \(\varphi\) be a propositional formula and \(p\) the set of letters (sets of atoms) at which \(\varphi\) evaluates to true. The two-state Büchi automaton for “infinitely often \(p\)” accepts exactly the infinite words that satisfy the LTL formula \(\mathbf{G}\,\mathbf{F}\,\varphi\), where an atom \(a\) holds at a letter \(s\) iff \(a \in s\). Equivalently, a word is accepted iff \(\varphi\) holds at infinitely many positions.
theorem language_always_eventually (φ : PropFormula Atom) :
language (infinitelyOftenNa {s | φ.eval s}) =
Word.language (fun s a => a ∈ s) (Formula.always (Formula.eventually φ.toLTL))
inductive PropFormula (Atom : Type*) where
/-- An atom, true at a letter containing it. -/
| atom (a : Atom) : PropFormula Atom
/-- Truth. -/
| top : PropFormula Atom
/-- Negation. -/
| not (φ : PropFormula Atom) : PropFormula Atom
/-- Conjunction. -/
| and (φ ψ : PropFormula Atom) : PropFormula Atom
CSLibExt/Logics/LTL/FragmentBuchi.lean:83
def infinitelyOftenNa (p : Set Symbol) : NA.Buchi Bool Symbol where
Tr _ x s' := (s' = true ↔ x ∈ p)
start := {true}
accept := {true}
CSLibExt/Computability/Languages/ExampleInfinitelyOften.lean:67
def language (valuation : Symbol → Atom → Prop) (φ : Formula Atom) : ωLanguage Symbol :=
{ w : ωSequence Symbol | Satisfies valuation w φ }
CSLibExt/Logics/LTL/OmegaWord.lean:82
def always (φ : Formula Atom) : Formula Atom := .not (eventually (.not φ))
CSLibExt/Logics/LTL/Syntax.lean:66
def eventually (φ : Formula Atom) : Formula Atom := .until .top φ
CSLibExt/Logics/LTL/Syntax.lean:63
TheoremThe eventually-always automaton recognizes F G φ#✓fully proved
Let \(\varphi\) be a propositional formula and \(p\) the set of letters (sets of atoms) at which \(\varphi\) evaluates to true. The two-state Büchi automaton for “eventually always \(p\)” accepts exactly the infinite words that satisfy the LTL formula \(\mathbf{F}\,\mathbf{G}\,\varphi\), where an atom \(a\) holds at a letter \(s\) iff \(a \in s\). Equivalently, a word is accepted iff \(\varphi\) holds at all but finitely many positions.
theorem language_eventually_always (φ : PropFormula Atom) :
language (eventuallyAlwaysNa {s | φ.eval s}) =
Word.language (fun s a => a ∈ s)
(Formula.eventually (Formula.always φ.toLTL))
inductive PropFormula (Atom : Type*) where
/-- An atom, true at a letter containing it. -/
| atom (a : Atom) : PropFormula Atom
/-- Truth. -/
| top : PropFormula Atom
/-- Negation. -/
| not (φ : PropFormula Atom) : PropFormula Atom
/-- Conjunction. -/
| and (φ ψ : PropFormula Atom) : PropFormula Atom
CSLibExt/Logics/LTL/FragmentBuchi.lean:83
def eventuallyAlwaysNa (p : Set Symbol) : NA.Buchi Bool Symbol where
Tr s x s' := s = true → x ∈ p ∧ s' = true
start := {false}
accept := {true}
CSLibExt/Computability/Languages/ExampleInfinitelyOften.lean:102
def language (valuation : Symbol → Atom → Prop) (φ : Formula Atom) : ωLanguage Symbol :=
{ w : ωSequence Symbol | Satisfies valuation w φ }
CSLibExt/Logics/LTL/OmegaWord.lean:82
def eventually (φ : Formula Atom) : Formula Atom := .until .top φ
CSLibExt/Logics/LTL/Syntax.lean:63
def always (φ : Formula Atom) : Formula Atom := .not (eventually (.not φ))
CSLibExt/Logics/LTL/Syntax.lean:66
The propositional automaton
DefinitionBüchi automaton for a propositional formula#✓fully proved
For a propositional formula \(\varphi\), this Büchi automaton over letters that are sets of atoms has a start state \(u\) and two verdict states \(t\) and \(f\), of which only \(t\) is accepting. From \(u\), on a letter \(s\) it moves to \(t\) if \(\varphi\) evaluates to true at \(s\) and to \(f\) otherwise; from \(t\) and from \(f\) it stays in the same state on every letter. So it records the verdict of \(\varphi\) on the first letter.
def propNa (φ : PropFormula Atom) : Buchi (Option Bool) (Set Atom) where
Tr p x q :=
(∃ b, p = none ∧ q = some b ∧ ((b = true ∧ φ.eval x) ∨ (b = false ∧ ¬ φ.eval x))) ∨
(∃ b, p = some b ∧ q = some b)
start := {none}
accept := {some true}
inductive PropFormula (Atom : Type*) where
/-- An atom, true at a letter containing it. -/
| atom (a : Atom) : PropFormula Atom
/-- Truth. -/
| top : PropFormula Atom
/-- Negation. -/
| not (φ : PropFormula Atom) : PropFormula Atom
/-- Conjunction. -/
| and (φ ψ : PropFormula Atom) : PropFormula Atom
CSLibExt/Logics/LTL/FragmentBuchi.lean:83
Uses 2 · Used by 2
TheoremThe propositional automaton recognizes φ#✓fully proved
For a propositional formula \(\varphi\), the three-state Büchi automaton for \(\varphi\) accepts exactly the infinite words of letters (sets of atoms) that satisfy \(\varphi\) read as an LTL formula, where an atom \(a\) holds at a letter \(s\) iff \(a \in s\).
theorem language_propNa (φ : PropFormula Atom) :
language (propNa φ) =
Word.language (fun s a => a ∈ s) φ.toLTL
inductive PropFormula (Atom : Type*) where
/-- An atom, true at a letter containing it. -/
| atom (a : Atom) : PropFormula Atom
/-- Truth. -/
| top : PropFormula Atom
/-- Negation. -/
| not (φ : PropFormula Atom) : PropFormula Atom
/-- Conjunction. -/
| and (φ ψ : PropFormula Atom) : PropFormula Atom
CSLibExt/Logics/LTL/FragmentBuchi.lean:83
def propNa (φ : PropFormula Atom) : Buchi (Option Bool) (Set Atom) where
Tr p x q :=
(∃ b, p = none ∧ q = some b ∧ ((b = true ∧ φ.eval x) ∨ (b = false ∧ ¬ φ.eval x))) ∨
(∃ b, p = some b ∧ q = some b)
start := {none}
accept := {some true}
CSLibExt/Logics/LTL/FragmentBuchi.lean:193
def language (valuation : Symbol → Atom → Prop) (φ : Formula Atom) : ωLanguage Symbol :=
{ w : ωSequence Symbol | Satisfies valuation w φ }
CSLibExt/Logics/LTL/OmegaWord.lean:82
Uses 8 · Used by 1
The shift automaton
DefinitionThe shift of a Büchi automaton#✓fully proved
Let \(A\) be a Büchi automaton over the alphabet of sets of atoms. Its shift is the Büchi automaton whose states are the states of \(A\) together with one new state \(\bot\), whose only start state is \(\bot\), and whose accepting states are the accepting states of \(A\). Its transitions are exactly the following: on every letter, from \(\bot\) to each start state of \(A\); and on a letter \(x\), from a state \(q\) of \(A\) to a state \(q'\) of \(A\) whenever \(A\) has a transition from \(q\) to \(q'\) on \(x\).
The shift accepts a word exactly when \(A\) accepts the word with its first letter removed.
TheoremThe shift automaton reads the tail#✓fully proved
For a Büchi automaton \(A\) over letters that are sets of atoms, the shift automaton of \(A\) accepts an infinite word \(x_0 x_1 x_2 \ldots\) iff \(A\) accepts its tail \(x_1 x_2 x_3 \ldots\).
theorem language_shiftBuchi (a : Buchi State (Set Atom)) :
language (shiftBuchi a) = {xs : ωSequence (Set Atom) | xs.tail ∈ language a}
def shiftBuchi (a : Buchi State (Set Atom)) : Buchi (Option State) (Set Atom) where
Tr p x q :=
(∃ s, p = none ∧ q = some s ∧ s ∈ a.start) ∨
(∃ s s', p = some s ∧ q = some s' ∧ a.Tr s x s')
start := {none}
accept := some '' a.accept
CSLibExt/Logics/LTL/FragmentBuchi.lean:260
Uses 1 · Used by 1
The safety fragment
InductiveThe restricted safety fragment of LTL#✓fully proved
The safety formulas over a type of atoms are generated by the following rules: every propositional formula \(\varphi\) is a safety formula; if \(\psi\) and \(\rho\) are safety formulas, then so are \(\psi \wedge \rho\), \(\psi \vee \rho\) and \(X\,\psi\) (next \(\psi\)); and for every propositional formula \(\varphi\), \(G\,\varphi\) (always \(\varphi\)) is a safety formula.
The operator \(G\) is applied only to propositional formulas: for atoms \(p\) and \(q\), the formula \(G(p \vee X\,q)\) is not in this fragment, since \(G\) does not distribute over \(\vee\).
inductive Safety (Atom : Type*) where
/-- A propositional formula, checked on the first letter. -/
| prop (φ : PropFormula Atom) : Safety Atom
/-- Conjunction. -/
| and (ψ ρ : Safety Atom) : Safety Atom
/-- Disjunction. -/
| or (ψ ρ : Safety Atom) : Safety Atom
/-- Next. -/
| next (ψ : Safety Atom) : Safety Atom
/-- `always` of a propositional formula. -/
| alwaysProp (φ : PropFormula Atom) : Safety Atom
inductive PropFormula (Atom : Type*) where
/-- An atom, true at a letter containing it. -/
| atom (a : Atom) : PropFormula Atom
/-- Truth. -/
| top : PropFormula Atom
/-- Negation. -/
| not (φ : PropFormula Atom) : PropFormula Atom
/-- Conjunction. -/
| and (φ ψ : PropFormula Atom) : PropFormula Atom
CSLibExt/Logics/LTL/FragmentBuchi.lean:83
Uses 1 · Used by 2
DefinitionSafety formulas as LTL formulas#✓fully proved
The translation \(t\) of safety formulas into LTL formulas is defined by recursion: \(t(\varphi)\) is the LTL translation of \(\varphi\) for a propositional formula \(\varphi\); \(t(\psi \wedge \rho) = t(\psi) \wedge t(\rho)\); \(t(\psi \vee \rho) = \neg(\neg t(\psi) \wedge \neg t(\rho))\), the derived LTL disjunction; \(t(X\,\psi) = X\,t(\psi)\), where \(X\) is next; and \(t(G\,\varphi) = G\,t(\varphi)\) for a propositional formula \(\varphi\), where \(G\) is the derived LTL operator always.
def toLTL : Safety Atom → Formula Atom
| .prop φ => φ.toLTL
| .and ψ ρ => .and ψ.toLTL ρ.toLTL
| .or ψ ρ => Formula.or ψ.toLTL ρ.toLTL
| .next ψ => .next ψ.toLTL
| .alwaysProp φ => Formula.always φ.toLTL
inductive Safety (Atom : Type*) where
/-- A propositional formula, checked on the first letter. -/
| prop (φ : PropFormula Atom) : Safety Atom
/-- Conjunction. -/
| and (ψ ρ : Safety Atom) : Safety Atom
/-- Disjunction. -/
| or (ψ ρ : Safety Atom) : Safety Atom
/-- Next. -/
| next (ψ : Safety Atom) : Safety Atom
/-- `always` of a propositional formula. -/
| alwaysProp (φ : PropFormula Atom) : Safety Atom
CSLibExt/Logics/LTL/FragmentBuchi.lean:355
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 or (φ ψ : Formula Atom) : Formula Atom := .not (.and (.not φ) (.not ψ))
CSLibExt/Logics/LTL/Syntax.lean:54
def always (φ : Formula Atom) : Formula Atom := .not (eventually (.not φ))
CSLibExt/Logics/LTL/Syntax.lean:66
Uses 6 · Used by 1
TheoremBüchi automata for the restricted safety fragment#✓fully proved
Take as letters the sets of atoms, an atom \(a\) holding at a letter \(s\) iff \(a \in s\). For every formula \(\psi\) of the restricted safety fragment there is a nondeterministic Büchi automaton with finitely many states whose ω-language is exactly the set of infinite words satisfying \(\psi\), read as an LTL formula.
The finite state set is what makes the automaton a certificate of ω-regularity: every ω-language is accepted by some Büchi automaton with infinitely many states. The fragment applies the always operator \(\mathbf{G}\) only to propositional formulas, so for example \(\mathbf{G}(p \vee \mathbf{X}\,q)\), for atoms \(p\) and \(q\) and the next operator \(\mathbf{X}\), is not covered.
theorem exists_buchi_of_safety (ψ : Safety Atom) :
∃ (S : Type) (_ : Finite S) (a : Buchi S (Set Atom)),
language a = Word.language (fun s a => a ∈ s) ψ.toLTL
inductive Safety (Atom : Type*) where
/-- A propositional formula, checked on the first letter. -/
| prop (φ : PropFormula Atom) : Safety Atom
/-- Conjunction. -/
| and (ψ ρ : Safety Atom) : Safety Atom
/-- Disjunction. -/
| or (ψ ρ : Safety Atom) : Safety Atom
/-- Next. -/
| next (ψ : Safety Atom) : Safety Atom
/-- `always` of a propositional formula. -/
| alwaysProp (φ : PropFormula Atom) : Safety Atom
CSLibExt/Logics/LTL/FragmentBuchi.lean:355
def language (valuation : Symbol → Atom → Prop) (φ : Formula Atom) : ωLanguage Symbol :=
{ w : ωSequence Symbol | Satisfies valuation w φ }
CSLibExt/Logics/LTL/OmegaWord.lean:82
Uses 15
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.