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, the piecewise analogue of locally testable.
Main definitions #
subseqSet k w: the subsequences ofwof length≤ k.Language.IsPiecewiseTestable L k:Function.FactorsThrough (· ∈ L) (subseqSet k).
Main results #
subseqSet_append_congr: sharingsubseqSet kis a congruence for concatenation.Language.IsPiecewiseTestable.compl/.inter/.union: boolean closure.Language.IsPiecewiseTestable.isRegular: over a finite alphabet PT languages are regular.
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.
Sharing subseqSet k is a congruence for concatenation: a subsequence of u ++ v
splits as a subsequence of u followed by one of v, each transferable separately.
Over a finite alphabet subseqSet k takes finitely many values: the piecewise
congruence has finite index.
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) (subseqSet k)
Instances For
Pointwise form: strings with equal subseqSet k are L-equivalent.
Piecewise testable languages are closed under complement.
Piecewise testable languages are closed under intersection.
Piecewise testable languages are closed under union.
Over a finite alphabet piecewise testable languages are regular: left quotients
factor through the finitely many values of subseqSet k.