Quotient of a formal language

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

In mathematics and computer science, the right quotient (or simply quotient) of a language L1 with respect to language L2 is the language consisting of strings w such that wx is in L1 for some string x in L2, where L1 and L2 are defined on the same alphabet Σ. Formally:[1][2]

L1/L2={wΣ*wL2L1}={wΣ*xL2 : wxL1}

where Σ* is the Kleene star on Σ, wL2 is the language formed by concatenating w with each element of L2, and is the empty set.

In other words, for all strings in L1 that have a suffix in L2, the suffix (right part of the string) is removed.

Similarly, the left quotient of L1 with respect to L2 is the language consisting of strings w such that xw is in L1 for some string x in L2. Formally:

L2L1={wΣ*L2wL1}={wΣ*xL2 : xwL1}

In other words, for all strings in L1 that have a prefix in L2, the prefix (left part of the string) is removed.

Note that the operands of are in reverse order, so that L2 preceeds L1.

The right and left quotients of L1 with respect to L2 may also be written as L1L21 and L21L1 respectively.[1][3]

Example

Consider L1={anbncnn0} and L2={bicji,j0}.

If an element of L1 is split into two parts, then the right part will be in L2 if and only if the split occurs somewhere after the final a. Assuming this is the case, if the split occurs before the first c then 0in and j=n, otherwise i=0 and 0jn. For instance:

aabbcc  (n=2,i=j=2)

aaabbbccc  (n=3,i=2,j=3)

aabbccϵ  (n=2,i=j=0)

where ϵ is the empty string.

Thus, the left part will be either anbni or anbncnj (0i,jn), and L1/L2 can be written as:

{ apbqcr  (pq and r=0)  or  p=qr  ;  p,q,r0 }.

Basic properties

If L,L1,L2 are languages over the same alphabet then:[3]

(L1L2)/L = L1/L  L2/L (L1L2)L = L1L  L2L

(L1L2)/L  L1/L  L2/L (L1L2)L  L1L  L2L

L(L1L2) = LL1  LL2 L(L1L2)  LL1  LL2

L1/LL2/L  (L1L2)/L LL1LL2  L(L1L2)

Example proof

As an example, the third property is proved as follows:

If w(L1L2)/L, there exists xL such that Template:No wrap Since then wxL1 and wxL2, it must be that wL1/LL2/L. Conversely, let wL1/L and wL2/L, then there exists x1,x2L such that wx1L1 and wx2L2 (given w, if L1L2 then x1,x2 may differ). Now wx1L1 L2 and wx2L1 L2 only if x1=x2, hence (L1L2)/LL1/LL2/L.

Relationship between right and left quotients

The right and left quotients of languages L1 and L2 are related through the language reversals L1R and L2R by the equalities:[3]

L1/L2=(L2RL1R)R L2L1=(L1R/L2R)R

Proof

To prove the first equality, let wL1/L2. Then there exists xL2 such that wxL1. Therefore, there must exist yL2R such that ywRL1R, hence by definition wRL2RL1R. It follows that w(L2RL1R)R, and so L1/L2=(L2RL1R)R.

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.

See also

References

Template:Reflist

  1. a b Script error: No such module "citation/CS1".
  2. Script error: No such module "citation/CS1". (Fifth ed. at Google Books)
  3. a b c Script error: No such module "citation/CS1".