Documentation

Linglib.Phonology.Subregular.OSL

Output Strictly Local (OSL) Functions #

A function f : List α → List β is k-Output Strictly Local when each output block depends only on the last k - 1 output symbols plus the current input symbol. OSL captures iterative processes where the output already emitted at position i feeds forward to the decision at position i + 1. The function-level subregular hierarchy at this layer is ISL ⊊ OSL ⊊ Subsequential.

Main definitions #

Main results #

Implementation notes #

The witness style IsX k f := ∃ r : OSLRule k α β, r.apply = f mirrors Subregular.IsLeftInputStrictlyLocal. Unlike ISL, whose window is over input symbols and threads independently of what was emitted, the OSL window is over already-emitted output — each step truncates outputWindow ++ windowOutput outputWindow x to the last k - 1 symbols before recursing. The k parameter is a type-level annotation; window-length truncation in applyAux is what enforces it semantically.

structure Subregular.OSLRule (k : ) (α : Type u_3) (β : Type u_4) :
Type (max u_3 u_4)

A k-Output-Strictly-Local rule over input alphabet α and output alphabet β. The single field windowOutput consumes the (k − 1)-symbol output context window plus the current input symbol and emits an output block.

In contrast to ISLRule (whose window is over input symbols), the window here is over already-emitted output symbols. This lets the rule see what it has just produced and react accordingly — the mechanism behind iterative output dependence.

The k parameter is a type-level annotation; semantic enforcement happens in apply's window threading.

  • windowOutput : List βαList β

    Map from (output context window, current input symbol) to output block. The window argument has length at most k - 1 when called by OSLRule.apply.

Instances For
    def Subregular.OSLRule.applyAux {α : Type u_1} {β : Type u_2} {k : } (r : OSLRule k α β) (outputWindow : List β) (rest : List α) :
    List β

    Apply the rule, threading a window of accumulated output symbols. At each input position, emit r.windowOutput outputWindow x, then extend the output window with the just-emitted block (truncated to keep at most k − 1 symbols).

    Equations
    Instances For
      def Subregular.OSLRule.apply {α : Type u_1} {β : Type u_2} {k : } (r : OSLRule k α β) (input : List α) :
      List β

      Apply a k-OSL rule to an input string, scanning left-to-right.

      Equations
      Instances For
        @[simp]
        theorem Subregular.OSLRule.applyAux_nil {α : Type u_1} {β : Type u_2} {k : } (r : OSLRule k α β) (outputWindow : List β) :
        r.applyAux outputWindow [] = []
        @[simp]
        theorem Subregular.OSLRule.applyAux_cons {α : Type u_1} {β : Type u_2} {k : } (r : OSLRule k α β) (outputWindow : List β) (x : α) (xs : List α) :
        r.applyAux outputWindow (x :: xs) = r.windowOutput outputWindow x ++ r.applyAux ((outputWindow ++ r.windowOutput outputWindow x).rtake (k - 1)) xs
        @[simp]
        theorem Subregular.OSLRule.apply_nil {α : Type u_1} {β : Type u_2} {k : } (r : OSLRule k α β) :
        r.apply [] = []
        @[simp]
        theorem Subregular.OSLRule.apply_singleton {α : Type u_1} {β : Type u_2} {k : } (r : OSLRule k α β) (x : α) :
        r.apply [x] = r.windowOutput [] x
        def Subregular.IsLeftOutputStrictlyLocal {α : Type u_1} {β : Type u_2} (k : ) (f : List αList β) :

        A function f : List α → List β is k-Left-Output-Strictly-Local iff some k-OSL rule computes it via left-to-right scan.

        Equations
        Instances For
          def Subregular.IsRightOutputStrictlyLocal {α : Type u_1} {β : Type u_2} (k : ) (f : List αList β) :

          A function f : List α → List β is k-Right-Output-Strictly-Local iff its reverse-conjugate is k-Left-OSL — some k-OSL rule computes it via right-to-left scan.

          Equations
          Instances For
            def Subregular.IsOutputStrictlyLocal {α : Type u_1} {β : Type u_2} (d : ScanDirection) (k : ) (f : List αList β) :

            ScanDirection-parameterised OSL predicate.

            Equations
            Instances For
              @[simp]
              theorem Subregular.isOutputStrictlyLocal_left {α : Type u_1} {β : Type u_2} (k : ) (f : List αList β) :
              @[simp]
              theorem Subregular.isOutputStrictlyLocal_right {α : Type u_1} {β : Type u_2} (k : ) (f : List αList β) :
              theorem Subregular.OSLRule.isLeftOutputStrictlyLocal_apply {α : Type u_1} {β : Type u_2} {k : } (r : OSLRule k α β) :

              Every OSL rule witnesses IsLeftOutputStrictlyLocal for the function it computes.

              theorem Subregular.isRightOutputStrictlyLocal_iff_left_reverse {α : Type u_1} {β : Type u_2} {k : } (f : List αList β) :
              IsRightOutputStrictlyLocal k f IsLeftOutputStrictlyLocal k fun (xs : List α) => (f xs.reverse).reverse

              Reverse-conjugation lemma: a function is k-Right-OSL iff its reverse-conjugate is k-Left-OSL — definitionally, with the conjugated class as primary.

              OSL ⊆ Subsequential #

              OSLRule.toFinSubsequentialTransducer projects an OSL rule into the sliding-window transducer SubsequentialTransducer.ofWindow, with the bounded output window (length ≤ k − 1) as state. Co-located on the source side because the dependency direction (the transducer lives in Subsequential.lean; OSL projects into it) forces both construction and cast into this file.

              The output alphabet [Fintype β] constraint matches [Moh97]'s finite-alphabet assumption — the state space (a bounded output window) is finite precisely when the output alphabet is.

              def Subregular.OSLRule.toFinSubsequentialTransducer {α : Type u_1} {β : Type u_2} {k : } (r : OSLRule k α β) :
              SubsequentialTransducer { l : List β // l.length k - 1 } α β

              Every Left-OSL rule induces a window transducer tracking the last k − 1 output symbols (the window accumulates what windowOutput emits), with empty finalOutput.

              Equations
              Instances For

                OSLRule.applyAux is the canonical window recursion accumulating the output.

                The window transducer induced by an OSL rule computes the same string function.

                theorem Subregular.isLeftOutputStrictlyLocal_left_subsequential {α : Type u_1} {β : Type u_2} {k : } [Fintype β] {f : List αList β} (h : IsLeftOutputStrictlyLocal k f) :

                Left-OSL ⊆ Left-Subsequential (over a finite output alphabet). The [Fintype β] matches [Moh97]'s finite-alphabet assumption and lets the bounded output window serve as a finite state space.

                theorem Subregular.isMealyComputable_of_OSLRule {α : Type u_1} {β : Type u_2} {k : } [Fintype β] (r : OSLRule k α β) (hs : ∀ (w : List β) (x : α), (r.windowOutput w x).length = 1) :

                A single-symbol left-OSL rule is Mealy-computable, with the bounded output window as the synchronous state.

                theorem Subregular.isRightOutputStrictlyLocal_right_subsequential {α : Type u_1} {β : Type u_2} {k : } [Fintype β] {f : List αList β} (h : IsRightOutputStrictlyLocal k f) :

                Right-OSL ⊆ Right-Subsequential: the left inclusion at the reverse-conjugate, since both right classes are the List.revConj-images of their left classes.

                theorem Subregular.isOutputStrictlyLocal_isSubsequential {α : Type u_1} {β : Type u_2} {d : ScanDirection} {k : } [Fintype β] {f : List αList β} (h : IsOutputStrictlyLocal d k f) :

                ScanDirection-parameterised OSL ⊆ Subsequential umbrella: in both scan directions, OSL functions are subsequential. Delegates to the Left- / Right- specialised theorems.