Quotient of a formal language
In mathematics and computer science, the right quotient (or simply quotient) of a language with respect to language is the language consisting of strings such that is in for some string in Template:Nowrap where and are defined on the same alphabet Template:Nowrap Formally:[1][2]
where is the Kleene star on , is the language formed by concatenating with each element of Template:Nowrap and is the empty set.
In other words, for all strings in that have a suffix in , the suffix (right part of the string) is removed.
Similarly, the left quotient of with respect to is the language consisting of strings such that is in for some string in . Formally:
In other words, for all strings in that have a prefix in , the prefix (left part of the string) is removed.
Note that the operands of are in reverse order, so that precedes .
The right and left quotients of with respect to may also be written as and respectively.[1][3]
Example
Consider and
If an element of is split into two parts, then the right part will be in if and only if the split occurs somewhere after the final Template:Nowrap Assuming this is the case, if the split occurs before the first then and Template:Nowrap, otherwise and Template:Nowrap For instance:
where is the empty string.
Thus, the left part will be either or Template:Nowrap Template:Nowrap and can be written as:
Basic properties
If are languages over the same alphabet then:[3]
Example proof
As an example, the third property is proved as follows:
If Template:Nowrap there exists such that Template:No wrap Since then and Template:Nowrap it must be that Template:Nowrap Conversely, let and Template:Nowrap then there exists such that and (given Template:Nowrap if then may differ). Now and only if Template:Nowrap hence Template:Nowrap
For instance, let Template:Nowrap
Then Template:No wrap, hence Template:Nowrap
Also and Template:Nowrap, hence Template:Nowrap
Relationship between right and left quotients
The right and left quotients of languages and are related through the language reversals and by the equalities:[3]
Proof
To prove the first equality, let Template:Nowrap Then there exists such that Template:Nowrap Therefore, there must exist such that Template:Nowrap hence by definition Template:Nowrap It follows that Template:Nowrap and so Template:Nowrap
The second equality is proved in a similar manner.
Other properties
Some common closure properties of the quotient operation include:
- The quotient of a regular language with any other language is regular.
- The quotient of a context free language with a regular language is context free.
- The quotient of two context free languages can be any recursively enumerable language.
- The quotient of two recursively enumerable languages is recursively enumerable.
These closure properties hold for both left and right quotients.