Strictly piecewise languages (SP_k) #
A language L is strictly k-piecewise when membership is determined by which
length-k subsequences (scattered, non-contiguous selections) the input contains.
Where SL_k constrains adjacent material via contiguous factors, SP_k constrains
long-distance co-occurrence via subsequences — so no boundary augmentation is needed
(subsequences are blind to position).
Main definitions #
Subregular.SPGrammar α— a set of permitted subsequences; the widthkis supplied tolanguage, not baked into the carrier.Subregular.SPGrammar.language k— theLanguage αit generates: every length-ksubsequence ofwmust be permitted.Language.IsStrictlyPiecewise L k—Lis strictlyk-piecewise.
Implementation notes #
List.Sublist (<+) is mathlib's non-contiguous "is a subsequence of", exactly the
SP primitive.
A strictly-piecewise grammar over α: a set of permitted subsequences.
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
- Subregular.SPGrammar α = Set (List α)
Instances For
The language generated at width k: strings whose every length-k subsequence
is permitted.
Equations
- Subregular.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.sublists — a decide-friendly
characterisation used by the decidable-membership instance below.
Equations
- Subregular.SPGrammar.decidableMemLanguage k G w = decidable_of_iff (∀ s ∈ w.sublists, s.length = k → s ∈ G) ⋯
A language L is strictly k-piecewise iff some SPGrammar α generates it
at width k.
Equations
- L.IsStrictlyPiecewise k = ∃ (G : Subregular.SPGrammar α), Subregular.SPGrammar.language k G = L