Piecewise testable languages (PT_k) #
A language is piecewise k-testable when its membership depends only on the set of
length-≤ k subsequences (scattered subwords) of the input [Sim75] — i.e. membership
factors through the map subseqSet k. PT_k is the Boolean closure of SP_k, the
piecewise analogue of locally testable over strictly local.
Main definitions #
subseqSet k w— the subsequences ofwof length≤ k.Language.IsPiecewiseTestable L k—Function.FactorsThrough (· ∈ L) (subseqSet k).
Main results #
Language.IsStrictlyPiecewise.toIsPiecewiseTestable—SP_k ⊆ PT_k.- Closure under complement comes from
Function.FactorsThrough.comp_left.
The subsequences of w of length at most k. The "≤ k" (rather than
"exactly k") bound is what keeps strings shorter than k distinguishable.
Equations
- Subregular.subseqSet k w = {s : List α | s.Sublist w ∧ s.length ≤ k}
Instances For
Subsequences of length at most k are interchangeable across strings sharing
their subseqSet k. The ratchet for proving piecewise testability from a predicate
depending only on length-≤ k subsequence presence.
A language is piecewise k-testable: membership factors through the
length-≤ k subsequence set subseqSet k.
Equations
- L.IsPiecewiseTestable k = Function.FactorsThrough (fun (x : List α) => x ∈ L) (Subregular.subseqSet k)
Instances For
Pointwise form: strings with equal subseqSet k are L-equivalent.
SP_k ⊆ PT_k: the strictly-piecewise test ("every length-k subsequence is
permitted") depends only on the set of subsequences of that length.