Quotient of a formal language

From testwiki
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 Template:Nowrap where L1 and L2 are defined on the same alphabet Template:Nowrap Formally:[1][2]

L1/L2={w∈Σ∗∣wL2∩L1≠∅}={w∈Σ∗∣∃x∈L2 : wx∈L1}

where Σ∗ is the Kleene star on Σ, wL2 is the language formed by concatenating w with each element of Template:Nowrap 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:

L2∖L1={w∈Σ∗∣L2w∩L1≠∅}={w∈Σ∗∣∃x∈L2 : xw∈L1}

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 precedes L1.

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

Example

Consider L1={anbncn∣n≥0} and L2={bicj∣i,j≥0}.

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 Template:Nowrap Assuming this is the case, if the split occurs before the first c then 0≤i≤n and Template:Nowrap, otherwise i=0 and Template:Nowrap For instance:

aa∣bbcc  (n=2,i=j=2)

aaab∣bbccc  (n=3,i=2,j=3)

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

where ϵ is the empty string.

Thus, the left part will be either anbn−i or Template:Nowrap Template:Nowrap and L1/L2 can be written as:

{ apbqcr ∣ (p≥q and r=0)  or  p=q≥r  ;  p,q,r≥0 }.

Basic properties

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

(L1∪L2)/L = L1/L ∪ L2/L (L1∪L2)∖L = L1∖L ∪ L2∖L

(L1∩L2)/L ⊆ L1/L ∩ L2/L (L1∩L2)∖L ⊆ L1∖L ∩ L2∖L

L∖(L1∪L2) = L∖L1 ∪ L∖L2 L∖(L1∩L2) ⊆ L∖L1 ∩ L∖L2

L1/L−L2/L ⊆ (L1−L2)/L L∖L1−L∖L2 ⊆ L∖(L1−L2)

Example proof

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

If Template:Nowrap there exists x∈L such that Template:No wrap Since then wx∈L1 and Template:Nowrap it must be that Template:Nowrap Conversely, let w∈L1/L and Template:Nowrap then there exists x1,x2∈L such that wx1∈L1 and wx2∈L2 (given Template:Nowrap if L1≠L2 then x1,x2 may differ). Now wx1∈L1∩ L2 and wx2∈L1∩ L2 only if Template:Nowrap hence Template:Nowrap

For instance, let L1={aab,bbb}, L2={abb,bbb}, Template:Nowrap

Then Template:No wrap, hence Template:Nowrap

Also L1/L={a,b} and Template:Nowrap, hence Template:Nowrap

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=(L2R∖L1R)R L2∖L1=(L1R/L2R)R

Proof

To prove the first equality, let Template:Nowrap Then there exists x∈L2 such that Template:Nowrap Therefore, there must exist y∈L2R 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.

See also

References

Template:Reflist