Draft — mutable and not usable as a dependency; its citation marks the draft state.

Lax765601.Continuity

Continuous string-to-string functions

concepts/Lax765601/Continuity.lean · lax-765601

definition

Loading review…

Sign in with ORCID

Community review

Flags

Each flag is tied to a public ORCID identity and explains why this concept may be incorrect.

No flags have been submitted.

    Community review

    Flag this concept

    State precisely what appears incorrect. This explanation will be public under your ORCID name.

    No source line selected.

    Concept map

    Proven claimDefinitionThis conceptRelated conceptA → B: B builds on A

    In the paper

    Definition

    A function f:ABf : A^* \to B^* between the sets of strings over two alphabets is continuous if for every regular language LBL \subseteq B^* over the output alphabet, the inverse image f1(L)f^{-1}(L) is a regular language over the input alphabet (Definition 0.1 of Transducers). Continuity is the compatibility with regular languages that every transducer model of the book is required to have: for functions with two possible outputs it is exactly regularity of a language, and composing a continuous function with a regular language, seen as a string-to-Boolean function, gives a regular language again.

    The same requirement makes sense for a relation RA×BR \subseteq A^* \times B^* and for a partial function: the set of input strings that are related to (respectively, mapped to) some string of LL has to be regular. The relational form is the one Part B proves for rational relations, and the partial form the one it proves for subsequential functions.

    Lean source view on GitHub

    1import Mathlib.Computability.DFA
    2
    3/-!
    4---
    5title: Continuous string-to-string functions
    6type: definition
    7---
    8A function f:ABf : A^* \to B^* between the sets of strings over two alphabets is
    9*continuous* if for every regular language LBL \subseteq B^* over the output
    10alphabet, the inverse image f1(L)f^{-1}(L) is a regular language over the input
    11alphabet (Definition 0.1 of *Transducers*). Continuity is the compatibility with
    12regular languages that every transducer model of the book is required to have:
    13for functions with two possible outputs it is exactly regularity of a language,
    14and composing a continuous function with a regular language, seen as a
    15string-to-Boolean function, gives a regular language again.
    16
    17The same requirement makes sense for a relation RA×BR \subseteq A^* \times B^* and
    18for a partial function: the set of input strings that are related to (respectively,
    19mapped to) some string of LL has to be regular. The relational form is the one
    20Part B proves for rational relations, and the partial form the one it proves for
    21subsequential functions.
    22
    23# Formalization notes
    24
    25Strings over an alphabet `A` are `List A`, languages are mathlib's `Language A`
    26(a set of strings), and regularity is mathlib's `Language.IsRegular`: recognition
    27by a deterministic finite automaton with a finite state set. This dictionary is
    28used by every concept of the book and is not repeated.
    29
    30Alphabets are arbitrary types here. The finiteness of the alphabets, which the
    31book assumes throughout, is an instance hypothesis `[Finite A]` on the statements
    32that need it, so that a definition never carries a hypothesis it does not use. A
    33partial function is a function into `Option (List B)`, with `none` for
    34"undefined".
    35-/
    36
    37namespace Lax765601.Continuity
    38
    39/-- A string-to-string function is *continuous* if the inverse image of every
    40regular language over the output alphabet is a regular language. -/
    41def Continuous {A B : Type} (f : List A → List B) : Prop :=
    42 ∀ L : Language B, L.IsRegular → Language.IsRegular ({w : List A | f w ∈ L} : Language A)
    43
    44/-- A relation `R ⊆ A* × B*` is continuous if, for every regular language `L` over
    45the output alphabet, the set of input strings related to some string of `L` is
    46regular. -/
    47def RelContinuous {A B : Type} (R : List A → List B → Prop) : Prop :=
    48 ∀ L : Language B, L.IsRegular →
    49 Language.IsRegular ({w : List A | ∃ v, R w v ∧ v ∈ L} : Language A)
    50
    51/-- A partial function is continuous if, for every regular language `L` over the
    52output alphabet, the set of input strings whose output is defined and belongs to
    53`L` is regular. -/
    54def PartialContinuous {A B : Type} (f : List A → Option (List B)) : Prop :=
    55 ∀ L : Language B, L.IsRegular →
    56 Language.IsRegular ({w : List A | ∃ v, f w = some v ∧ v ∈ L} : Language A)
    57
    58end Lax765601.Continuity
    59

    Formalization notes

    Strings over an alphabet AA are ListAList A, languages are mathlib's LanguageALanguage A (a set of strings), and regularity is mathlib's Language.IsRegularLanguage.IsRegular: recognition by a deterministic finite automaton with a finite state set. This dictionary is used by every concept of the book and is not repeated.

    Alphabets are arbitrary types here. The finiteness of the alphabets, which the book assumes throughout, is an instance hypothesis [FiniteA][Finite A] on the statements that need it, so that a definition never carries a hypothesis it does not use. A partial function is a function into Option(ListB)Option (List B), with nonenone for "undefined".

    Community review

    Discussion

    Ask a question or add context. Endorsements and structured flags are kept in the review panel above; your ORCID profile must share a public name.

    0 comments

    Loading discussion…