Langlib

Langlib.Classes.ContextSensitive.Basics.FiniteAlphabet

Finite terminal support for context-sensitive languages #

Every grammar in this repository has finitely many rules, and every rule is a finite list of symbols. Hence every grammar-generated language uses only finitely many terminal symbols. This file packages that observation for context-sensitive languages as a finite-alphabet image theorem.

The terminals appearing in a sentential form.

Equations
Instances For

    The terminals appearing anywhere in a grammar rule.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      The finite terminal support syntactically mentioned by a grammar.

      Equations
      Instances For

        A derivation from the start symbol mentions only terminals syntactically present in the grammar's rules.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          The same grammar, with terminals restricted to the finite set syntactically appearing in its rules.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For

            Restrict a language to words over a finite terminal set.

            Equations
            Instances For

              Every word generated by a grammar is supported by the finite terminal set occurring in the grammar's rules.

              theorem GrammarFiniteAlphabet.map_finiteAlphabetRestriction_eq_of_supported {T : Type} (S : Finset T) (L : Language T) (hS : wL, tw, t S) :
              (Language.map fun (t : { t : T // t S }) => t) (finiteAlphabetRestriction S L) = L

              If S supports L, then L is the image of its restriction to the finite subtype S.

              theorem GrammarFiniteAlphabet.grammar_language_finiteAlphabet_image {T : Type} [DecidableEq T] (g : grammar T) :
              ∃ (S : Finset T) (L' : Language { t : T // t S }), (Language.map fun (t : { t : T // t S }) => t) L' = grammar_language g

              Any grammar language is an image of a language over a finite subtype of the terminal alphabet.

              theorem GrammarFiniteAlphabet.grammar_language_finiteAlphabet_CS_image {T : Type} [DecidableEq T] (g : grammar T) (hg : grammar_context_sensitive g) :
              ∃ (S : Finset T) (L' : Language { t : T // t S }), is_CS L' (Language.map fun (t : { t : T // t S }) => t) L' = grammar_language g

              A context-sensitive grammar language is the image of a context-sensitive language over the finite subtype of terminals appearing in the grammar.

              theorem is_CS_exists_finiteAlphabet_image {T : Type} {L : Language T} (hL : is_CS L) :
              ∃ (S : Finset T) (L' : Language { t : T // t S }), (Language.map fun (t : { t : T // t S }) => t) L' = L

              Every context-sensitive language is the image of a language over a finite subtype of its terminal alphabet.

              theorem is_CS_exists_finiteAlphabet_CS_image {T : Type} {L : Language T} (hL : is_CS L) :
              ∃ (S : Finset T) (L' : Language { t : T // t S }), is_CS L' (Language.map fun (t : { t : T // t S }) => t) L' = L

              Every context-sensitive language is equivalent to a context-sensitive language over a finite terminal subtype.

              theorem is_CS_exists_fintype_alphabet_CS_image {T : Type} {L : Language T} (hL : is_CS L) :
              ∃ (A : Type) (x : Fintype A) (x : DecidableEq A) (L' : Language A) (f : AT), is_CS L' (Language.map f) L' = L

              Every context-sensitive language is equivalent to a context-sensitive language over some finite terminal alphabet. The finite alphabet is represented as a type carrying Fintype and DecidableEq, together with a terminal map into the original alphabet.

              theorem is_CS_of_finiteAlphabet_CS_image {T : Type} {S : Finset T} {L' : Language { t : T // t S }} (hL' : is_CS L') :
              is_CS ((Language.map fun (t : { t : T // t S }) => t) L')

              The inclusion image of a context-sensitive language over a finite subtype is context-sensitive over the ambient alphabet.

              theorem is_CS_iff_exists_finiteAlphabet_CS_image {T : Type} {L : Language T} :
              is_CS L ∃ (S : Finset T) (L' : Language { t : T // t S }), is_CS L' (Language.map fun (t : { t : T // t S }) => t) L' = L

              A language is context-sensitive iff it is the inclusion image of a context-sensitive language over a finite terminal subtype.

              theorem is_CS_iff_exists_fintype_alphabet_CS_image {T : Type} {L : Language T} :
              is_CS L ∃ (A : Type) (x : Fintype A) (x : DecidableEq A) (L' : Language A) (f : AT), is_CS L' (Language.map f) L' = L

              A language is context-sensitive iff it is the image of a context-sensitive language over some finite terminal alphabet.

              theorem is_CS_finite_terminal_support {T : Type} {L : Language T} (hL : is_CS L) :
              ∃ (S : Finset T), wL, tw, t S

              Every context-sensitive language has finite terminal support.