Locally testable languages #
A language is locally k-testable when membership of a word depends only on its prefix and
suffix of length k - 1 and on the set of its factors of length k. Over all k these are the
locally testable events of McNaughton and Papert.
Main definitions #
List.kTestVector k w: the prefix ofwof lengthk - 1, the set of its factors of lengthk, and its suffix of lengthk - 1.Language.IsLocallyTestable: membership in the language factors throughList.kTestVector k.
Main results #
List.kTestVector_append_congr: words with the samek-test vectors have concatenations with the samek-test vector.Language.IsLocallyTestable.isStarFree: over a finite alphabet, locally testable languages are star-free, and with them the generalized definite and the finite or cofinite languages.Language.IsLocallyTestable.leftQuotient,Language.IsLocallyTestable.rightQuotient,Language.IsLocallyTestable.preimage_map: closure under quotients and under inverse images of letter-to-letter maps.Language.isStarFree_setOf_infix: the words containing a given factor form a star-free language, over any alphabet.
Implementation notes #
The name is McNaughton and Papert's, the convention Pin's. McNaughton and Papert take the two ends
at length k and only the interior factors, and leave words shorter than k unconstrained. Here
the ends have length k - 1 and every factor counts, so that a factor crossing the seam of a
concatenation lies in the suffix of one word followed by the prefix of the other.
References #
The k-test vector of w is its prefix of length k - 1, the set of its factors of length
k, and its suffix of length k - 1.
Equations
- List.kTestVector k w = (Edge.left.takeAt (k - 1) w, {f : List α | f ∈ List.kFactors k w}, Edge.right.takeAt (k - 1) w)
Instances For
Words with the same k-test vectors have concatenations with the same k-test vector, since
a factor across the seam lies in the suffix of one word followed by the prefix of the other.
Mapping a function over a word maps it over the k-test vector.
k + 1 copies of a word have the same k-test vector as k copies, since a factor of length
k reaches across at most k consecutive copies.
Over a finite alphabet List.kTestVector k takes finitely many values.
A language is locally k-testable when membership factors through the prefix and suffix of
length k - 1 and the set of factors of length k.
Equations
- L.IsLocallyTestable k = Function.FactorsThrough (fun (x : List α) => x ∈ L) (List.kTestVector k)
Instances For
The words whose set of factors of length k lies in a given family form a locally
k-testable language.
Locally testable languages are closed under inverse images of letter-to-letter maps.
Over a finite alphabet locally testable languages are star-free.
Generalized definite languages #
A generalized k-definite language is locally (k + 1)-testable.
Over a finite alphabet generalized definite languages are star-free.
Over a finite alphabet finite and cofinite languages are star-free.
Containing a factor #
The words containing c as a factor form a locally testable language.
The words containing c as a factor form a star-free language over any alphabet, finite or
not.