Strictly piecewise languages (SP_k) #
A language L is strictly k-piecewise when membership is determined by which
subsequences (scattered, non-contiguous selections) of length at most k the input
contains [RHB+10]. Where SL_k constrains adjacent material via contiguous
factors, SP_k constrains long-distance co-occurrence — the subregular class of
unbounded-distance phonotactics. The class is the program's vocabulary for the sublist-closed
languages of Linglib.Core.Computability.ShuffleIdeal: a language is SP at some width iff
it is sublist-closed.
Main definitions #
SPGrammar α: a set of permitted subsequences; the widthkis supplied tolanguage, not baked into the carrier.SPGrammar.language k: theLanguage αit generates: every subsequence ofwof length at mostkmust be permitted.Language.IsStrictlyPiecewise L k:Lis a fixed point of the width-ktest with itself as grammar;isStrictlyPiecewise_iffrecovers the ∃-grammar form.
Main results #
Language.IsStrictlyPiecewise.mem_of_sublist: SP languages are subsequence-closed.Language.IsStrictlyPiecewise.succ:SP_k ⊆ SP_(k+1).Language.IsStrictlyPiecewise.toIsPiecewiseTestable:SP_k ⊆ PT_k.Language.isStrictlyPiecewise_avoid: shuffle-ideal complements are SP.Language.exists_isStrictlyPiecewise_iff_isSublistClosed: SP at some width is exactly sublist-closure [RHB+10].
Implementation notes #
List.Sublist (<+) is mathlib's non-contiguous "is a subsequence of", exactly the SP
primitive. Unlike SL no boundary augmentation is needed, since subsequences are blind to
position; the "≤ k" (rather than "exactly k") bound is instead what keeps words shorter than
k distinguishable, matching subseqSet.
A strictly-piecewise grammar over α: a set of permitted subsequences
[RHB+10]. Unlike SL grammars no boundary alphabet is used — subsequences
are insensitive to position. The width k is supplied to language, not baked into the
carrier.
Equations
- SPGrammar α = Set (List α)
Instances For
The language generated at width k: strings whose every subsequence of length at
most k is permitted.
Equations
- SPGrammar.language k G = {w : List α | ∀ (s : List α), s.length ≤ k → s.Sublist w → s ∈ G}
Instances For
SP membership reduces to a check against List.sublistsLen — a decide-friendly
characterisation used by the decidable-membership instance below.
Equations
- SPGrammar.decidableMemLanguage k G w = decidable_of_iff' (∀ j ≤ k, ∀ s ∈ List.sublistsLen j w, s ∈ G) ⋯
A language L is strictly k-piecewise when the width-k subsequence test with
L itself as the permitted set recovers L — the canonical-grammar fixed point;
isStrictlyPiecewise_iff recovers the ∃-grammar form.
Equations
- L.IsStrictlyPiecewise k = (SPGrammar.language k L = L)
Instances For
Some grammar generates L at width k iff L is its own grammar.
SP languages are subsequence-closed.
A nonempty SP language contains the empty word.
Avoiding one pattern: the complement of a shuffle ideal is strictly k-piecewise
as soon as the forbidden pattern fits in the window.
SP_k ⊆ SP_(k+1): widening the window loses nothing.
SP_k ⊆ PT_k: the strictly-piecewise test ("every subsequence of length at most k
is permitted") depends only on subseqSet k.
A language is strictly piecewise at some width iff it is sublist-closed
[RHB+10]. Backwards, L is its own grammar at the width bounding the
finite forbidden basis, so that any word outside L is already refuted by a basis word it
contains.