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

Lax314295.LogicPrecomputation

Precomputing the answers of MSO formulas by a rational function

concepts/Lax314295/LogicPrecomputation.lean · lax-314295

proven

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

    Evidence

    Each proof establishes this claim relative to its assumptions.

    In the paper

    Theorem

    For a finite set of mso formulas with one or two free first-order variables there is a letter-to-letter rational function f:ACf : A^* \to C^* such that each formula φ(x)\varphi(x) with one free variable corresponds to a set of letters FCF \subseteq Cwφ(x)w \models \varphi(x) exactly when the letter of f(w)f(w) at position xx is in FF — and each formula φ(x,y)\varphi(x, y) with two free variables corresponds to a regular language LCL \subseteq C^* — for xyx \le y, wφ(x,y)w \models \varphi(x, y) exactly when the infix of f(w)f(w) from xx to yy belongs to LL (Lemma C.4.10 of Transducers). The function decorates every position with the states, on the prefix and on the suffix, of the automata of Lemma C.4.2 for the formulas.

    Lean source view on GitHub

    1import Lax765601.ElementaryProperties
    2import Lax132576.RationalFunctions
    3import Lax314295.MSOLogic
    4
    5/-!
    6---
    7title: Precomputing the answers of MSO formulas by a rational function
    8type: theorem
    9---
    10For a finite set of mso formulas with one or two free first-order variables
    11there is a letter-to-letter rational function f:ACf : A^* \to C^* such that each
    12formula φ(x)\varphi(x) with one free variable corresponds to a set of letters
    13FCF \subseteq Cwφ(x)w \models \varphi(x) exactly when the letter of f(w)f(w) at
    14position xx is in FF — and each formula φ(x,y)\varphi(x, y) with two free
    15variables corresponds to a regular language LCL \subseteq C^* — for
    16xyx \le y, wφ(x,y)w \models \varphi(x, y) exactly when the infix of f(w)f(w) from
    17xx to yy belongs to LL (Lemma C.4.10 of *Transducers*). The function
    18decorates every position with the states, on the prefix and on the suffix, of
    19the automata of Lemma C.4.2 for the formulas.
    20
    21# Formalization notes
    22
    23The formulas with one free variable use the variable `0`; those with two use
    24`0` and `1`, evaluated at `x ≤ y`. The infix from `x` to `y` is
    25`((f w).drop x).take (y - x + 1)`. The alphabet is assumed finite.
    26-/
    27
    28namespace Lax314295.LogicPrecomputation
    29
    30open Lax765601.ElementaryProperties Lax132576.RationalFunctions Lax314295.MSOLogic
    31
    32/-- The answers of finitely many mso formulas with one or two free variables are
    33read off a letter-to-letter rational function: as letters, respectively as regular
    34languages of infixes. -/
    35axiom exists_rational_precomputation {A : Type} [Finite A]
    36 (Φ₁ Φ₂ : Set (MSO A)) (hΦ₁ : Φ₁.Finite) (hΦ₂ : Φ₂.Finite) :
    37 ∃ (C : Type) (_ : Finite C) (f : List A → List C),
    38 IsRationalFun f ∧ LengthPreserving f ∧
    39 (∀ φ ∈ Φ₁, ∃ F : Set C, ∀ (w : List A) (x : ℕ), x < w.length →
    40 (MSO.Sat w (fun _ => x) (fun _ => ∅) φ ↔ ∃ c ∈ F, (f w)[x]? = some c)) ∧
    41 (∀ φ ∈ Φ₂, ∃ L : Language C, L.IsRegular ∧ ∀ (w : List A) (x y : ℕ),
    42 x ≤ y → y < w.length →
    43 (MSO.Sat w (fun i => if i = 0 then x else y) (fun _ => ∅) φ ↔
    44 ((f w).drop x).take (y - x + 1) ∈ L))
    45
    46end Lax314295.LogicPrecomputation
    47
    Show Proof

    Formalization notes

    The formulas with one free variable use the variable 00; those with two use 00 and 11, evaluated at xyx ≤ y. The infix from xx to yy is ((fw).dropx).take(yx+1)((f w).drop x).take (y - x + 1). The alphabet is assumed finite.

    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…