shuffle of languages
Let Σ be an alphabet and u,v words over Σ. A shuffle w of u and v can be loosely defined as a word that is obtained by first decomposing u and v into individual pieces, and then combining (by concatenation) the pieces to form w, in a way that the order of the pieces in each of u and v is preserved.
More precisely, a shuffle of u and v is a word of the form
u1v1⋯ukvk |
where u=u1⋯un and v=v1⋯vn. In other words, a shuffle of u and v is either a k-insertion of either u into v or v into u, for some positive integer k.
The set of all shuffles of u and v is called the shuffle of u and v, and is denoted by
u⋄v. |
The shuffle operation can be more generally applied to languages
. If L1,L2 are languages, the shuffle of L1 and L2, denoted by L1⋄L2, is the set of all shuffles of words in L1 and L2. In short,
L1⋄L2=⋃{u⋄v∣u∈L1,v∈L2}. |
Clearly, u⋄v={u}⋄{v}. We shall also identify L⋄u and u⋄L with L⋄{u} and {u}⋄L respectively.
A language L is said to be shuffle closed if L⋄L⊆L. Clearly Σ* is shuffle closed, and arbitrary intersections shuffle closed languages are shuffle closed. Given any language L, the smallest shuffle closed containing L is called the shuffle closure of L, and is denoted by L⋄.
It is easy to see that ⋄ is a commutative operation: u⋄v=v⋄u. It is also not hard to see that ⋄ is associative: (u⋄v)⋄w=u⋄(v⋄w).
In addition, the shuffle operation has the following recursive property: for any u,v over Σ, and any a,b∈Σ:
-
1.
u⋄λ={u},
-
2.
λ⋄v={v},
-
3.
ua⋄vb=(ua⋄v){b}∪(u⋄vb){a}.
For example, suppose u=aba, v=bab. Then
u⋄v | = | [aba⋄ba]{b}∪[ab⋄bab]{a} | ||
= | [(aba⋄b)∪(ab⋄ba)]{ab}∪[(ab⋄ba)∪(a⋄bab)]{ba} | |||
= | (ab⋄ba){ab,ba}∪(aba⋄b){ab}∪(a⋄bab){ba} | |||
= | {abba,baab,abab,baba}{ab,ba}∪{baba,abba,abab}{ab}∪{abab,baab,baba}{ba} | |||
= | {abba,baab,abab,baba}{ab,ba} | |||
= | {abbaab,baabab,ababab,babaab,abbaba,baabba,ababba,bababa} |
Remark. Some closure properties with respect to the shuffle operation: let ℛ be the family of regular languages, and ℱ the family of context-free languages. Then ℛ is closed under ⋄. ℱ is not closed under ⋄. However, if L1∈ℛ and L2∈ℱ, then L1⋄L2∈ℱ. The proofs of these closure properties can be found in the reference.
References
- 1 M. Ito, Algebraic Theory of Automata and Languages, World Scientific, Singapore (2004).
Title | shuffle of languages |
Canonical name | ShuffleOfLanguages |
Date of creation | 2013-03-22 18:56:16 |
Last modified on | 2013-03-22 18:56:16 |
Owner | CWoo (3771) |
Last modified by | CWoo (3771) |
Numerical id | 11 |
Author | CWoo (3771) |
Entry type | Definition |
Classification | msc 68Q70 |
Classification | msc 68Q45 |
Synonym | shuffle product |
Synonym | shuffle-closed |
Synonym | shuffle-closure |
Related topic | PqShuffle |
Related topic | DeletionOperationOnLanguages |
Related topic | InsertionOperationOnLanguages |
Defines | shuffle |
Defines | shuffle closed |
Defines | shuffle closure |