Download Lecture 6e (Ordered Monoids and languages in 1 and 2 )

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Propositional calculus wikipedia , lookup

Rewriting wikipedia , lookup

Structure (mathematical logic) wikipedia , lookup

Quasi-set theory wikipedia , lookup

Non-standard calculus wikipedia , lookup

Laws of Form wikipedia , lookup

Transcript
Lecture 6e: Ordered Monoids and languages definable in Σ1 and Σ2
Recall that we had characterized the class of languages definable in F O1 păq, i.e., firstorder logic sentences that use only one variable, and demonstrated an algorithm to check if
a given regular language lies in this class. A different way to parametrize formulas of F Opăq
is via the number of alternations of quantifiers.
A formula is said to be in prenex form if it consists of a sequence of quantifiers followed
by a quantifier-free formula (i.e. all the quantifiers occur before the other logical operators).
A well-known fact in logic is that every FO formula can be rewritten into an equivalent
formula in prenex form.
For eg. Dx.Dy.ppx ă yq ^ pDx.py ă xq ^ pDx.px ă yqqqq can be equivalently expressed as
Dx1 .Dx2 .ppx ă x2 q ^ pDx3 .px2 ă x3 q ^ pDx4 .px3 ă x4 qqqq and then as Dx1 .Dx2 .Dx3 .Dx4 .px1 ă
x2 q ^ px2 ă x3 q ^ px3 ă x4 q In general, by using a new variable for every quantifier and
then moving all the quantifiers to the beginning of the formula we obtain such an equivalent
prenex formula. We omit the details here.
Any formula in prenex form consists of alternating blocks of existential and universal
quantifiers. The formula written above has a single block of existential quantifiers while the
formula @[email protected] “ yq _ ppx ă zq ^ pz ă yqq _ ppy ă zq ^ pz ă xqq has two blocks, a
universal block followed by an existential block.
Let Σ0 “ Π0 be the set of quantifier free formula. The classes Σi and Πi are defined
inductively as follows: The class Σi`1 consists of formulas obtained from formulas in Πi
by adding a block of existential quantifiers while Πi`1 consists of formulas obtained from
formulas in Σi by adding a block of universal quantifiers.
The two example formulas listed above are in Σ1 and Π2 respectively. In general, Σi
consists of formulas with i blocks of quantifiers beginning with an existential block while Πi
consists of formulas with i blocks beginning with a universal block. Quite clearly, if ϕ is a
formula in Σi then ϕ can be transformed into an equivalent formula in Πi by pushing the
negation over the quantifiers. A similar result holds for formulas in Πi .
We shall say that a language L is in Σi (respectively Πi ) if it is definable by a sentence
in Σi (respectively Πi ). We will also use Σi to refer to the class of languages in Σi and soon.
Thus L P Πi iff L P Σi . We note that Πi Ď Σi`1 since we may always add an existential
quantifier on an irrelevant variable at the beginning of the formula without altering its
meaning. Similarly Σi Ď Πi`1 .
Unlike the case of the variable hierarchy, where we have F O3 păq “ F Opăq, the quantifier
alternation hierarchy is known to be infinite, providing a finer stratification of first-order
definable languages. But, as of now, our understanding of this hierarchy is limited. For
instance, decidability of membership (of regular languages) in the levels Σ1 and Σ2 (and
therefore for Π1 and Π2 ) is known, but the problem remains open for higher levels. We
now describe monoid based characterizations for Σ1 and Σ2 which lead to a solution to their
membership problems. The presentation here follows that in [3].
We hit a road block immediately! Observe that the class Σi is unlikely to be closed under
complementation, unless Πi “ Σi , and it turns out it is not. However, the set of languages
1
definable using a monoid (and hence any class of monoids) is closed under complementation
and so there is no hope of obtaining Σi as the class of languages definable using a class of
monoids.
J.E.Pin proposed a elegant solution to this problem using what are called ordered monoids
which we study now. Recall that monoids were obtained naturally from the syntactic congruence Σ˚ { ”L defined by any language L where x ”L y holds if and only if for all u, v P Σ˚ ,
uxv P L ðñ uyv P L.
What if we refined this two sided requirement into just a one sided requirement? We say
x ďL y iff for all u, v P Σ˚ , uyv P L ùñ uxv P L. This relation is a pre-order, i.e., it is
reflexive and transitive but not anti-symmetric. As a matter of fact, its symmetric core (i.e)
tpx, yq | x ďL y ^ y ďL xu is exactly the ”L relation. As with any pre-order, it induces a
partial-order on the equivalence classes of its symmetric core. In what follows we write rxsL
to denote the equivalence class of x w.r.t. ”L .
Proposition 1 The pair ptrxsL | x P Σ˚ u, ďL q is a partial order (where we lift the definition
of ďL by writing rxsL ďL rusL whenever x ďL y.)
We observe that this relation is consistent with the multiplication in the monoid. That
is, if rxsL ďL rysL then, for any u, v, rusL rxsL rvsL ďL rvsL (we leave this as an easy exercise
to the reader). Further, we observe that for any x,y if rxsL ďL rysL and rysL Ď L then
rxsL Ď L (simply use u “ v “ ǫ in the definition of ďL ).
Recall that the language L is recognized by the syntactic morphism ηL from pΣ˚ , ., ǫq to
ptrxsL | x P Σ˚ u, ., rǫsL q and L “ ηL´1 pXq where X “ trxsL | rxsL Ď Lu. The import of the
previous paragraph is that this set X is a downward closed set w.r.t the order ďL . In any
partial order a downward closed subset is called an ideal.
To summarize, we have equipped the syntactic monoid of L with a partial order, which
is consistent with its multiplication and further observed that the subset recognizing L is
an ideal. Most importantly, even though L is recognised by the same syntactic monoid
its recognizing set is not an ideal (as a matter of fact it is an upward closed set, as the
complement of any ideal is).
We shall refer to the structure ptrxsL | x P Σ˚ u, ., rǫsL , ďL q as the ordered syntactic monoid
of L. We shall write oSynpLq to denote this monoid. The ordered syntactic monoid of L
and L are different as we would like them to be (as an aside note that the ordered syntactic
monoid of L is ptrxsL | x P Σ˚ u, ., rǫsL , ďR
L q). With this reasoning in mind we define ordered
monoids and recognition via ordered monoids as follows.
Definition 2 An ordered monoid is a tuple pM, ., 1, ďq where pM, ., 1q is a monoid and ď
is a partial order on M that is consistent, that is, if x ď y then uxv ď uyv for all u, v P M .
A morphism h from an ordered monoid pM, ., 1M , ďM q to pN, ., 1N , ďN q is a monoid
morphism from the monoid pM, ., 1M q to pN, ., 1N q which further satisfies x ďM y implies
hpxq ďN hpyq (i.e. it is also monotone w.r.t. the orderings).
We observe that any monoid can be turned into an ordered monoid by using “ (i.e. the
identity relation) as the order. In particular, pΣ˚ , ., ǫ, “q, is an ordered monoid and is called
2
the free ordered monoid on Σ. Another interesting class of examples of ordered monoids are
the ordered syntactic monoids of languages as described above. The map ηL :: x ÞÑ rxsL is
an ordered monoid morphism from pΣ˚ , ., ǫ, “q to oSynpLq.
Definition 3 L is recognized by an ordered monoid morphism h : pΣ˚ , ., ǫ, “q ÝÑ pM, ., 1, ďq
if there is an ideal X Ď M such that L “ h´1 pXq.
The following is just a consequence of the above discussion:
Proposition 4 A language L over an alphabet Σ is regular if and only if it is recognized by
a finite ordered monoid.
Thus, recognition by ordered monoids provides an algebraic view of regular languages
that allows us to examine classes that are not closed under complementation. The syntactic
ordered monoid plays the role of the syntactic monoid in this setting:
Proposition 5 Let pM, ., 1, ďq be a finite ordered monoid that recognizes a regular language
L via the morphism h. Then, there is a surjective morphism hL from the ordered submonoid
phpΣ˚ q, ., 1, ďq to the ordered syntactic monoid of L such that such that ηL “ hL .h.
We leave the proof of this proposition as an exercise to the reader.
We still have to show how to compute the ordereed syntactic monoid of a regular language.
The underlying monoid of oSynpLq is SynpLq which is computable. So, we just have to
compute ďL . This is a consequence of the following lemma.
Lemma 6 Let X “ trxsL | x P Lu. Then, for any x, y P Σ˚ , rxsL ďL rysL iff for all
rusL , rvsL P SynpLq, rusL rxsL rvsL P X whenever rusL rysL rvsL P X. Thus, the ordered syntactic monoid of any regular language is computable.
Proof: Suppose rxsL ďL rysL . By the definition of ďL , for all u, v P Σ˚ , uxv P L whenever
uyv P L. But, his means that for all u, v P Σ˚ , ruxvsL P X whenever ruyvsL P X.
For the converse, suppose uyv P L. Therefore rusL rysL rvsL P X and by the hypothesis
this means rusL rxsL rvsL P X. This means uxv P η ´1 pXq and thus uxv P L.
We are now in a position to characterize the class of languages in Σ1 and Σ2 .
The class Σ1
Consider any formula ϕ “ Dx1 .Dx2 . . . . Dxm .ϕ1 in Σ1 and a word w “ a1 . . . an such that
w |ù ϕ. Then, there is a valuation σ such that w “ w1 ai1 w2 ai2 . . . wr air wr`1 , r ď m and the
positions in the image of σ are in the set ti1 , . . . ir u.
Now, observe that the sequence ai1 ai2 . . . air also satisfies the formula ϕ using the valuation that sends xi to j if σpxi q “ ij . Moreover, any word in Σ˚ ai1 Σ˚ ai2 . . . ar Σ˚ also satisfies
ϕ. Thus, we have
3
Proposition 7 Let ϕ be a formula in Σ1 with m quantifiers. Then
ď
Lpϕq “
tΣ˚ a1 Σ˚ a2 . . . ar Σ˚ | r ď m, a1 a2 . . . ar |ù ϕu
A language of the form Σ˚ a1 Σ˚ a2 . . . ar Σ˚ is called a simple monomial and finite unions
of simple monomials is called a simple polynomial. Thus every Σ1 language is a simple
polynomial.
Proposition 8 A language is in Σ1 iff it is a simple polynomial.
Proof: The remark above proves one direction. For the other direction note that the formula
Dx1 .Dx2 . . . . Dxr .px1 ă x2 q ^ . . . ^ pxr´1 ă xr q ^ a1 px1 q ^ . . . ^ ar pxr q describes the language
Σ˚ a1 Σ˚ . . . ar Σ˚ .
A language is upward closed if uav P L whenever uv P L. Clearly every simple monomial
is upward closed and upward closed languages are closed under unions. Thus, as a corollary
to the above proposition we also have
Corollary 9 Every language in Σ1 is upward closed.
If a regular language L, with a FA on say n states, is upward closed then it may be
expressed as the following simple polynomial
L “ tΣ˚ a1 Σ˚ a2 . . . ar Σ˚ | r ď n, a1 a2 . . . ar P Lu
and hence it is also in Σ1 . Thus we have
Proposition 10 A language is in Σ1 iff it is upward closed.
This also leads to an algebraic characterization of Σ1 as follows:
Theorem 11 A language L is in Σ1 iff it is recognized by a morphism h to an ordered
monoid pM, ., 1q in which 1 ď s holds for all s P M .
Proof: Note that if 1 ď s then hpuavq “ hpuqhpaqhpvq ď hpuq1hpvq “ hpuvq. Since the
language is defined by an ideal it follows that if uv P L then uav P L and thus L is upward
closed and hence in Σ1 .
For the converse, since the language is upward closed we have uv P L ùñ uwv P L and
so rusL .rǫsL .rvsL ď rusL .rwsL .rvsL for all u, v, w P Σ˚ and thus rǫsL ď rwsL for all w P Σ˚ .
Thus oSynpLq satisfies 1 ď s.
Thus one may check whether a regular language belongs to Σ1 by computing its ordered
syntactic monoid and verifying that it satisfies 1 ď s. It turns out that it is easy to check
if the language of a finite automaton is upward closed (Exercise) and so the algebraic characterization is not essential. However, it is the technique that is being enunciated here and
this works for Σ2 as well (while the ad hoc automata based algorithm does not.)
Theorem 12 Membership is decidable for Σ1 .
4
Exercise: Prove that the class of finite ordered monoids satisfying 1 ď s is closed under
products and division.
The class Σ2
A monomial is a language of the form A˚0 a1 A˚1 a2 . . . ar A˚r where ai P Σ and Ai Ď Σ. A
polynomial is simply a finite union of monomials. We shall show that the class Σ2 is precisely
the class of polynomials and obtain an effective algebraic characterization for this class.
One direction is easy. A monomial A˚0 a1 A˚1 a2 . . . ar A˚r , can be expressed by the formula
ľ
ľ
Dx1 Dx2 . . . Dxr .@y.
ai pxi q ^
pxi ă xi`1 q
1ďiďr
1ďiďr´1
^ py ă x1 q ùñ A0 pyq ^ py ą xr q ùñ Ar pyq ^
ľ
ppy ą xi q ^ py ă xi`1 q ùñ Ai pyq
1ďiăr
Proposition 13 Every polynomial is in Σ2 .
The other direction is non-trivial and uses the factorization forest theorem in its proof.
We first establish some simple properties of polynomials.
Lemma 14 The class of polynomials over Σ is the least class of languages closed under
union and concatenation which contains all the finite languages as well as all languages of
the form A˚ for A Ď Σ.
Proof: Clearly all polynomials are members of the least class containing finite languages and
languages of the form A˚ . For the converse, note that all finite languages are polynomials
and so are languages of the form A˚ . Thus, it suffices to prove that the class of polynomials
is closed under union and concatenation. Closure under union follows from the definition of
polynomials. Given two monomials A˚0 a1 . . . ar A˚r and B0 b1 . . . bm Br˚ their concatenation is
the following polynomial:
ď
˚
˚
A˚0 a1 . . . ar A˚r b1 B1˚ . . . bm Bm
Y
A˚0 a1 . . . ar A˚r bB0˚ b1 B1˚ . . . bm Bm
bPB0
Closure of polynomials under concatenation follows from the fact that pL1 Y L11 q.pL2 Y L12 q “
L1 .L2 Y L1 .L12 Y L11 .L2 Y L11 .L12 .
In what follows, we write αpwq for the set of letters that appear in the word w. Next, we
show that the ordered syntactic monoids of languages in Σ2 satisfy an useful property.
Lemma 15 Let L be a language in Σ2 and let m be the total number of quantifiers in a
Σ2 formula ϕ that defines L. For any word u P Σ˚ and v P αpuq˚ we have xuN vuN y P L
whenever xuN y P L for all N ą m2 ` m, x, y P Σ˚ . That is, ruN sL rvsL ruN sL ď ruN sL in
oSynpLq for all N ą m2 ` m.
5
Proof: Let ϕ “ Dx1 x2 . . . xk @y1 y2 . . . yl .ϕ1 and let xuN y |ù ϕ. From a valuation σ assigning positions within ρ “ xuN y for x1 . . . xk which satisfies @y1 y2 . . . yl .ϕ1 we manufacture a
valuation σ 1 assigning positions in ρ1 “ xuN vuN y satisfying @y1 y2 . . . yl .ϕ1 .
By our choice of N , we may write ρ as uk1 um uk2 such that none of the positions within
the middle um is in the range of σ. We now consider a break up of ρ1 as xuk1 um`k2 vum`k1 uk2 y.
The map σ 1 assigns all the xi s which are assigned a position within the prefix xuk1 by rho
the same position in the corresponding prefix of ρ1 . Similarly any xj assigned a position in
the suffix uk2 y by σ is assigned the corresponding position within the same suffix of ρ1 by σ 1 .
Thus, all atomic formulas involving only x1 , x2 . . . xk are either satisfied by both pρ, σq and
pρ1 , σ 1 q or neither.
Suppose σf1 is any extension of σ 1 which also assigns positions in ρ1 for the variables
y1 , y2 , . . . yl . We show that there is an extension of σf of σ assigning positions in ρ for the
variables y1 , y2 , . . . yl such that any atomic formula involving x1 , x2 . . . xk , y1 , . . . yl is either
satisfied by both pρ, σf q and pρ1 , σf1 q or neither.
If a variable yj is assigned a position within the prefix xuk1 or the suffix uk2 y by σf1 then
σf assigns the corresponding position in ρ for yj . Let Y be the set of such variables. Then,
it is easy check that both pρ, σf q and pρ, σf1 q satisfy the same set of atomic formulas w.r.t.
the variables tx1 , . . . , xk u Y Y .
Let yj1 , yj2 . . . yjr be the variables assigned positions in the infix um`k2 vum`k1 by σf1 .
Further suppose that the positions used are p1 ă p2 ă . . . ă pr1 with r1 ď r (since multiple
variables may be assigned the same position).
We pick one position, say qi , from each of the first r1 copies of t in the infix tm of ρ such
that the letter at position qi in ρ is the letter at position pi in ρ1 . This is possible since
αpuvq Ď αpuq. The map σf assigns position qi to any variable that was assigned the position
pi by the valuation σf1 .
Then pρ, σf q satisfies any atomic formula over tx1 , . . . xk , y1 , . . . , yl u iff it is also satisfied
by pρ1 , σf1 q. Hence pρ, σf q satisfies ϕ1 iff pρ1 , σf1 q satisfies ϕ1 .
Thus, ρ, σ |ù @y1 y2 . . . yk .ϕ1 implies that ρ1 , σ 1 |ù @y1 y2 . . . yk .ϕ1 , so that ρ1 |ù ϕ whenever
ρ |ù ϕ as required.
Let pM, ., 1, ďq be an ordered monoid. For any idempotent e P M , we write Se for the
semigroup generated by the elements ts | e ďJ su.
Proposition 16 If L is language in Σ2 then its ordered syntactic monoid satisfies ese ďL e,
for every idempotent e and every s P Se .
Proof: Let e ďJ s in oSynpLq. Therefore s “ rvsL for some v and since e ďJ rvsL we may
assume e “ rxvysL for some x, y P Σ˚ . In particular, if e ďJ s then we may assume that
e “ rusL and s “ rvsL and αpvq Ď αpuq.
Now, if s P Se the s “ s1 s2 . . . sk , e ďJ si , 1 ď i ď k. Let si “ rvi sL . Therefore e “ rui sL
such that αpvi q Ď αpui q. Let u “ u1 u2 . . . uk and v “ v1 v2 . . . vk . Then s “ rv1 . . . vk sL .
Further rusL “ ek “ e. Thus, if s P Se then we may assume s “ rvsL and e “ rusL and
αpvq Ď αpuq.
6
N
N
Then, by Lemma 15, rusN
L rvsL rusL ďL rusL . But e is an idempotent and so we get
rusL rvsL rusL ďL rusL as required.
Next we show that languages recognized by monoids satisfying ese ď e for s P Se are
always polynomials. This is a nontrivial fact and uses the factorization forest theorem in its
proof.
Lemma 17 Let pM, ., 1, ďq be an ordered monoid satisfying ese ď e whenever s P Se and
e is an idempotent. Let X be any ideal in M . Let h : pΣ˚ , ., ǫ, “q ÝÑ pM, ., 1, ďq be a
morphism. Then h´1 pXq is a polynomial.
Proof: The proof essentially follows the argument used to obtain well-typed regular expressions for h´1 psq for each s. Let
Lis “ tw | hpwq “ s, w has a factorization tree of height ď iu
. We construct a polynomial Psi for each 0 ď i ď 5|M | and s P M so that Lis Ď Psi and
hpPsi q Ď s Ó, where s Ó is the ideal tt|t ď su.
We let
ÿ
Ps0 “
ta | a P Σ Y tǫu, hpaq “ su
which is clearly a polynomial satisfying the required properties.
If s is not an idempotent then we set
ÿ
Psi`1 “ Psi `
tPui .Pvi | u.v “ su
which is again a polynomial since polynomials are also closed under concatenation (and
union). Also, hpxyq with x P Pui and y P Pvi is hpxq.hpyq ď u.v ď s as required. If
i
w P Li`1
s zLs , since s is not an idempotent we must have u, v and w “ w1 .w2 such that
s
w1 P Liu , w2 P Liv and s “ uv. Therefore w P Pi`1
.
Finally, if e is an idempotent then we set
ÿ
Pei`1 “ Pei `
tPui .Pvi | u.v “ eu ` pPei qA˚ pPei q
where A is the set of letters that appear in the words of the language h´1 peq. Observe that
e ďJ hpaq for each a P A.
That Pei`1 is a polynomial follows from closure under concatenation and union. If x P Pui
and y P Pvi with uv “ e then hpxyq ď e as above. If x, y P Pei and v P A˚ then hpxvyq “
hpxqhpvqhpyq “ ehpvqe. But e is an idempotent and hpvq P Se and therefore ehpvqe ď e
as required. Finally, let w P Lei`1 zLie . We need to show that w P Pei`1 . If the root of the
factorization tree for w has two children then the proof proceeds as in the previous case. If
the root has at least 3 children then w “ w1 w2 . . . wk , k ě 3 such that wi P Lie . Thus, by
induction hypothesis w1 , wk P Pei . Further, by definition αpwi q Ď A for each 1 ď i ď k and
thus w2 w3 . . . wk´1 P A˚ . Thus w P Pei`1 .
5|M |
The proof of the Lemma is now easy. Let Ps “ PŤ
. Clearly Ps is a polynomial such
s
´1
that h psq Ď Ps and hpPs q Ď s Ó. The polynomial sPX Ps is the language h´1 pXq since
s ÓĎ X for each s P X.
As a consequence of Propostions 13,16 and Lemma 17 we have the following theorem:
7
Theorem 18 A language L is in Σ2 iff it is a polynomial iff oSynpLq satisfies ese ďL e for
every idempotent e and s P Se . Thus, the membership problem for Σ2 is decidable.
The proof of the above theorem also showed that any ordered monoid satisfying ese ď s
for all s P Se recognizes only languages in Σ2 .
Exercise: Show that the class of ordered monoids satisfying ese ď e for all idempotents e
and s P Se is closed under products and division.
References
[1] M. Bojanczyk: “Factorization Forests”, Proceedings of DLT 2009, Springer LNCS 5583
(2009) 1-17.
[2] T. Colcombet: “Green’s Relations and their Use in Automata Theory”, Proceedings of
LATA 2011, Spring LNCS 6638 (2011) 1-21.
[3] V Diekart, P Gastin and M Kufleitner: “A Survey on Small Fragments of First-Order
Logic over Finite Words”, International Journal of the Foundations of Computer Science
19(3), 2008.
[4] J.E.Pin: Mathematical Foundations of Automata Theory, MPRI Lecture Notes.
8