Langlib

Langlib.Classes.Regular.Decidability.Emptiness

Decidability of Emptiness #

This file proves that emptiness is decidable for regular languages.

Main results #

Part 1: Regular Languages #

theorem DFA.short_word_of_reachable {α : Type u_1} {σ : Type u_2} [Fintype σ] [DecidableEq σ] (M : DFA α σ) (w : List α) :
∃ (w' : List α), w'.length Fintype.card σ M.evalFrom M.start w' = M.evalFrom M.start w

Any state reachable by a DFA can be reached by a word of length at most Fintype.card σ. By the pigeonhole principle.

def DFA.reachableSet {α : Type u_1} {σ : Type u_2} [Fintype α] [Fintype σ] [DecidableEq σ] (M : DFA α σ) :

The set of states reachable from M.start by following transitions.

Equations
Instances For
    theorem DFA.mem_reachableSet_iff {α : Type u_1} {σ : Type u_2} [Fintype α] [Fintype σ] [DecidableEq σ] (M : DFA α σ) (s : σ) :
    s M.reachableSet ∃ (w : List α), M.evalFrom M.start w = s

    A state is in reachableSet iff it is reachable from M.start by some word.

    noncomputable def dfa_emptiness_decidable {α : Type u_1} {σ : Type u_2} [Fintype α] [Fintype σ] [DecidableEq α] [DecidableEq σ] (M : DFA α σ) [DecidablePred fun (x : σ) => x M.accept] :

    Emptiness of a DFA's accepted language is decidable.

    Equations
    Instances For
      noncomputable def regular_emptiness_decidable {α : Type u_1} [Fintype α] [DecidableEq α] (L : Language α) (hL : L.IsRegular) :

      Emptiness of a regular language is decidable.

      Equations
      Instances For

        Part 2: Uniform computability over encoded right-regular grammars #

        The raw uniform emptiness decider for encoded right-regular grammars, obtained by composing the context-free emptiness decider with the primitive-recursive translation toCFG : EncodedRG T → EncodedCFG T.

        Emptiness is uniformly computable for the regular languages: encoded right-regular grammars are an adequate, effective presentation (regularLanguageOf_characterizes) with uniformly decidable emptiness.