|
| 1 | +/- |
| 2 | +Copyright (c) 2025-present Ching-Tsun Chou All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Ching-Tsun Chou |
| 5 | +-/ |
| 6 | + |
| 7 | +import Cslib.Computability.Automata.DA |
| 8 | +import Mathlib.Order.Filter.AtTopBot.Defs |
| 9 | + |
| 10 | +open Filter |
| 11 | + |
| 12 | +/-! # Deterministic Muller Automata |
| 13 | +-/ |
| 14 | + |
| 15 | +/-- `xs.infOcc` is the set of elements that occurs infinitely many times in `xs`. |
| 16 | +TODO: This definition should be be moved to a different file. |
| 17 | +-/ |
| 18 | +def ωList.infOcc {X : Type*} (xs : ωList X) : Set X := |
| 19 | + { x | ∃ᶠ k in atTop, xs k = x } |
| 20 | + |
| 21 | +/-- A deterministic Muller automaton consists of a labelled transition function |
| 22 | +`tr` over finite sets of states and labels (called symbols), a starting state `start`, |
| 23 | +and a finite set of finite accepting sets `accept`. -/ |
| 24 | +structure MullerDA (State : Type _) (Symbol : Type _) extends DA State Symbol where |
| 25 | + /-- The set of accepting sets of the automaton. -/ |
| 26 | + accept : Set (Set State) |
| 27 | + /-- The automaton is finite-state. -/ |
| 28 | + finite_state : Finite State |
| 29 | + /-- The type of symbols (also called 'alphabet') is finite. -/ |
| 30 | + finite_symbol : Finite Symbol |
| 31 | + |
| 32 | +namespace MullerDA |
| 33 | + |
| 34 | +variable {State : Type _} {Symbol : Type _} |
| 35 | + |
| 36 | +/-- A deterministic Muller automaton `mda` accepts an ω-word `xs` iff the set of states that |
| 37 | +occurs infinite often when running `mda` on `xs` is one of the accepting sets. |
| 38 | +-/ |
| 39 | +@[scoped grind →] |
| 40 | +def Accepts (mda : MullerDA State Symbol) (xs : ωList Symbol) := |
| 41 | + (mda.infRun xs).infOcc ∈ mda.accept |
| 42 | + |
| 43 | +/-- The ω-language of a deterministic Muller automaton is the set of ω-words that it accepts. -/ |
| 44 | +@[scoped grind =] |
| 45 | +def language (mda : MullerDA State Symbol) : Set (ωList Symbol) := |
| 46 | + { xs | mda.Accepts xs } |
| 47 | + |
| 48 | +/-- An ω-word is accepted by a deterministic Muller automaton iff it is in its ω-language. -/ |
| 49 | +@[scoped grind _=_] |
| 50 | +theorem accepts_mem_language (mda : MullerDA State Symbol) (xs : ωList Symbol) : |
| 51 | + mda.Accepts xs ↔ xs ∈ mda.language := by rfl |
| 52 | + |
| 53 | +end MullerDA |
0 commit comments