INFORMATION SCIENCES 8, 123-140 (1975)
123
L-Fuzzy Grammars HYO HENG KIM, MASAHARU MIZUMOTO, JUNICHI TOYODA, and KOKICHI TANAKA Faculty of Engineering Science, Osaka University, Tyonaka, Osaka 560, Japan Communicated
by John M. Richardson
ABSTRACT An L-fuzzy grammar is defined by assigning the element of lattice to the rewriting rules of a formal grammar. According to the kind of lattice, say, distributive lattice, latticeordered group, and latticeordered monoid, two type of L-fuzzy grammars are defined. It is shown that some context-sensitive languages can be generated by type 3 *-L-fuzzy grammars with cut points. It is also shown that for type 2 L-fuzzy grammars, Chomsky and Greibach normal form can be constructed as an extension of corresponding notion in the theory of formal grammars.
1. INTRODUCTION Recently, in order to reduce the gap between natural languages and formal languages, stochastic grammars and fuzzy grammars have been formulated by introducing the concept of randomness and fuzziness into the structure of the formal grammars [3-S, 7,8] . In addition, several interesting grammars with weights are also defined by corresponding the element of the appropriate algebraic system to each rewriting rule of grammars [6] . Now, incorrectness and ambiguity, which natural languages such as English have syntactically and semantically, may be reduced to impose consistency among means of words in the sentence, valuation of means of the word, and so forth on formal languages. Therefore, if the suitable characteristic parameters which describe the property of grammars or languages may be given, then the grammar with such characteristic parameters may be considered as a model for natural languages. In this paper, we define L-fuzzy grammars by introducing the concept of L-fuzzyy sets [l] into the structure of formal grammars, that is, L-fuzzy grammars are defined by assigning the element of lattice to the rewriting rules of formal grammars. Two types of L-fuzzy grammars will be considered. One is the A-L-fuzzy grammar (A-lfg for short) whose membership space consists of a 0 AmericanElsevier Publishing Company, Inc., 1975
124
HYOHENG
KIM.era/.
distributive lattice or a Boolean lattice. A fuzzy grammar is a special case of the A-lfg. The other is the *-L-fuzzy grammar (*-ffg for short), whose membership space consists of a lattice-ordered group or a lattice-ordered monoid. Some basic results concerning the families of languages generated by the A-ffg and the *-lfg are given in Sec. 3. In Sec. 4, it is shown that the so called Chomsky and Greibach normal form for a type 2 A-lfg and a type 2 *-lfg can be constructed as the extension of the corresponding notion in the theory of formal grammars. 2. BASIC DEFINITIONS We shall review L-fuzzy sets [ 1] for the purpose of defining L-fuzzy grammars later. L-FUZZY
SETS
An L-fuzzy set A in a space X = {x} is a function
such that
A : X-+L,
(1)
where L is called a membership space which is a partially ordered set or, more precisely, lattice-ordered semigroup or lattice [ 1 I] , and the value A (x) in L represents the “grade of membership” of X in A. When L is the unit interval [O,l] , A is the fuzzy set originated by Zadeh [2] . PRODUCT OF L-FUZZY
RELATIONS
An L-fuzzy relation R is a function x E X,y E Y) to L, i.e.,
R:XX
from product space X X Y = {(x,y) I Y-L.
(2)
If RI and R2 are two L-fuzzy relations in X X X, then the product of R I and R2 is defined by an L-fuzzy relation denoted as R ,Rz and is written as follows:
R,Rz(x,z)=V
[R,(x,Y)OR~C_Y,Z)I,
(3)
where V is an operation of supremum, o is an operation of intimum when L is a distributive lattice of a Boolean lattice, or an operation of group or monoid when L is a lattice-ordered group or a lattice-ordered monoid, respectively. In general, if L is distributive, the product of R, . . *, R of L-fuzzy relation R in XX X is defined as follows: R . ..R(~.y)=R"(x,y)=~~,_.~~~_,
[R(x,xl)oR(xl,x2)
.o...
oR(x,-i
,Y)I.
(4)
L-FUZZY
GRAMMARS
L-FUZZY
GRAMMARS
125
An L-fuzzy grammar (lfg for short) is a system such that
G=(V,,
V,,P,S,J,P,L),
(5)
where VN is the set of nonterminal, VT is a set of terminal, S is an initial symbol, J is a set of labels of rules, and P is a finite set of productions such as (4 u-0
p(r),
(6)
in which r E J, u + u is an ordinary rewriting rule, and ~1is an L-fuzzy set from J to L, i.e., p : J+ L. L consists of a distributive lattice, a Boolean lattice, a lattice-ordered group of a lattice-ordered monoid. The value g(r) in L is called the grade of the application of the rule r. Concerning with the L-fuzzy relation R in ( VN U VT)* X ( VN U VT)*, the value of R is defined as follows: R(cr@, w/3) =
P(r)if(r)u
-+ul.c(r)EP,
--if(r)24
-_,up(r)&P,
I
(7)
where crufl and oluf3 are in ( VN U VT)*. If L is a complete lattice,may be assumed as an infinum of L, i.e., inf L = --oo. In parallel with the standard classification of formal grammars [9] , four principal types of Ifg may be distinguished as type 0, 1,2, and 3 lfg. Furthermore, according to differences among lattices, two types of lfg may be considered. That is, A-ffg, whose membership space consists of a distributive lattice or a Boolean lattice, and *-lfg, whose membership space consists of a lattice-ordered group or a lattice-ordered monoid, may be considered. L-FUZZY LANGUAGES An L-fuzzy languages, L(G), is a set of ordered pairs,
L(G)= where pc(x)
{(x+~(x))],x~
is the grade of membership
VT*,
(8)
of x generated by Ifg G and is given by
/J&X) = R+(S, x), where R+ = U R’, i 1 1. When the derivation IJ
r(ril ‘il
(9)
chains from S to x are expressed as ai,
r(rizl, ‘iz
ai
+
.
.
.
-(rim?
aim
=x,
‘im
the value of PC(X) is also given by
(11) where the supremum
V is taken over all derivation chains from S tox, 0 is an
126
HYOHENG
KIM,erd.
operation of intinum when an L-fuzzy grammar is a A-lfg, or an operation of group or monoid when an L-fuzzy grammar is a *-lfg. The language, L (G, A), which is generated by an lfg G with cut point X(E L) is defined as follows: L(G,X)= 3. CLASS OF L-FUZZY
{XE V; Il&x)~X}.
(12)
LANGUAGES
3.1. THE CLASS OF LANGUAGES
GENERATED
BY A-lfg
In this section, to discuss the class of L-fuzzy languages, let us consider the language, L(G, A), by an A-1fgG with cut point X(E L). In general, we may assume that an L-fuzzy relation R assigns a sublat tice of membership space L to an L-fuzzy grammar. In Lemma 1, we investigate the property of sublattices. Using this property, it is shown that the class of the languages generated by the type 3 A-lfg is a regular set. Theorem 2 shows that the class of languages generated by type 2 A-lfg with cut point properly contains the class of context-free languages. In Theorem 3, it is shown that type 1 A-&g is recursive. LEMMA 1. In the distributive lattice whose number of elements is infinite, the number of elements of the sublattice which is generated from arbitrary finite elements of lattice is finite.
Proof: In lattice, an arbitrary finite subset of the elements has its supremum and infinum. Also the arbitrary lattice polynominal of distributive lattice can be expressed such that P{x*,xz,...,
x,}=V
{xi1 Axi,
A.. .AXik},XijE{X,,X2,...,X,),
or
Pbl,X2,. . .,x,}=A
{xi, Vxi2
V..
eVXik13XijE
{XI,X?,“‘,X~l.
(13)
Therefore, the number of elements of the sublattice which is generated from arbitrary finite elements of L is equal to the number of lattice polynominals. From the above fact, it can be seen that the number of elements of the sublattice is finite. And the number of elements of the sublattice Y is obtained as follows:
(14) where Y is the sublattice generated from the set of arbitrary elements X = x,}, and an operation ( ) is an operation of combination.
X2,“‘,
{x, ,
L-FUZZYGRAMMARS
127
THEOREM 2. The class of languages generated by type 3 A-lfg with cut point X is the class of regular sets.
Proof. Let G = (V,,
V , P, S, J, p, L ) be the type 3 II-lfg with VN = {S, A,, 5 m t 1). Then the equivalence relation E of x, y (E V$ ) is defined as follows: For any AI E V, U {e} (e is a null symbol), define
A2,***,
A,),IJI=n(n=
x = y --R+(S,
xAi) = R+(S, yAj).
(15)
Then R+(S, XZA ) = !’ [R+(S, xAj) R+(xA j, xzA)] , i = V [R+(S, xAi) R+(Ai, zA)] , i =
V [R+(S, yAi) R+(Ai, zA)] ,
=
vi P+(S,~4)
i
R+b4, YzA)I ,
=R+(S, yzA).
(16)
Therefore the equivalence relation = is a right invariant equivalence relation. Here let us define the m t 2 array vector consisted of the elements of the membership space L as follows: (R+(S, xS), R+(S, xA,), R+(S, xA2), . * *, R+(S,xA,),
R+(S, x)) (17)
=(~0,~1,~2,...,~,,~,+1),
A,,, E V,, then the number of equivalent wherexE V+,andS,AI,A2;--, classes by the relation - is less than the number of the m + 2 array vectors (ve, ). And from Lemma 1, it is evident that the number of ~l,V2,“‘,%l>hn+l vectors is finite. Consequently, the language generated by the type 3 A-lfg G is the union of the equivalent class of a right invariant equivalence relation E of finite index. We conclude that the class of the languages generated by the type 3 A-lfg’s is the class of regular sets. THEOREM 3. The class of languages generated by the type 2 A-lfg’s with cut point properly contains the class of context-free languages.
Proof: In the first place, let us show that the context-sensitive language is generated by the type 2 A-lfg with cut point. Consider the type 2 A-lfg with the productions (1) S+AB
vl,
(2) A+
aAb v2,
(3) A+
ab v3,
(4) B+
CB v4,
(5) B-+cvj, (6) S-CD
&,
128
HYO HENG KIM,
et al.
‘6
Fig. 1. Membership space of L.
(7) C+
(9) D+
aC vs ,
bDc ~2,
(10) D+ bc u4. (8) C--+aV4, where the membership space L is as in Fig 1. Now, let us generate a2 b2 c2 by A-Zfg in practice. The derivation a2 bZc2 is obtained as follows: (1) S +
AB =$9 aAbB =$+ aabbB=$$
(2) S+
CD =$# aCD +
aaD +
chains of
aabbcB =$+ aabbcc,
aabDc =$+ aabbcc,
The derivation chains of a2 b2 c2 may be obtained from another source than the derivation chains of (1) and (2). However, the same rules of the derivation chains as (1) and (2) are used in those derivation chains. Thus the membership grade of a2 b2c2 is obtained as follows: pc(a2b2c2)=(v1
Au2 Aus ilv4 Avg)V(v6 Aus Au4 Au2 Av4)
= VI v&j =v2 In general, the membership grade of anbnc”, ambmc”, and ambncn is obtained as pG(anbnc”) = v2, pG (a”b”cn) = vl, and pG(ambnc”) = v6 , respectively. Therefore, let the cut point h = v2, then the type 1 language is obtained, that is, L(G, u2) = {a”b”c”
I n 2 1).
In the next place, we show that any context-free languages can be generated by type 2 A-lfg.It is enough to consider the case that the class of type 2 A-lfg whose membership space,L,is equal to {O,Z}. Suppose that the membership function p of type 2 A-ZfgG assigns the element Z for each rule r E J, then type 2 A-ZfgG may be regarded as the context-free
129
~-FUZZY~RAMMARS
grammar in the sense of formal grammar. Therefore the class.of the languages L (G, 1) is the class of context-free languages. THEOREM
4. Type 1 A-lfg is recursive.
Proof. From the definition of type 1 A-lfg, it is easily determined whether (E, V)is in L(G) or not by inspecting the productions of G. Then we can assume that P does not contain a production (r)S + E ,u( r). Suppose that there is a derivation 5’z* x(x E V$) whose derivation chain C is given as follows:
where rj is the label of rule and p(ri) is the grade of rule ri. In addition, suppose that in the derivation chain C, a i is the same as OLD, i < j. Now, consider the shorter derivation chain C’, which is obtained by replacing the subchain
inCby
Clearly C’ is a derivation chains from S to X. And following equation holds. P(ri)A*
* -Ap(q)
.A~(rj)A~(rj+l)A...A~(r,) sp(rI)A.*
aA~.l(rdAdrj+l)A.
.*A/~(rd.
(18)
Thus the derivation chain C wilI not take part in the vaIue ptc (x). Therefore the value of @G (x) can be given by taking the supremum over all loop-free derivation chains from S to X. That is to say, if G is a type 1 A-lfg, IxI= n,and 1V, U VT I = k, then the value of (IG (x) can be given by taking the supremum over finite set of derivation chains from S to x of Iength 12 1 + k + . * - + kn. Next, in order to show the algorithm whether (x, V)E L (G) or not, we have to show a way for generating all finite derivation chains from S to x of length Ii1 tkt.* * + k” = lo. As already mentioned, it can be determined whether (E, V)EL(G) or not by inspecting the productions of G. Therefore, we also assume that the set of productions P does not contain (r) 5’ + E p(r). Now, let us define the set Q, as the set of ordered pairsJar, R m(a)) in which (Yis the string of length at most n (= Ix I) in ( VNU VT) and R m(cr) is the membership grade of arin G such that S$ (Yby the derivations of at most m steps. Formally, Q, =I(~,R”-‘(S,p)AR(P,~))
If&R”-‘(W))fQ,-,, R@,c~)=~(r),and
ItvI s,}.
(19)
130
HYOHENGKIM,et al.
Clearly, Qt = C(o,R(S, o)) I R(S, o) = p(r), ICYISn). We construct consecutively Q, , Q,,Q3,- - *,Qm until rrr = Ee or Q, = & whichever happens first. It is apparent that if Q, = $J,then Q, = Q,,,+r = * * . = $I since Q, depends only on Q,,, _r . From above, it is evident that the set Q,,, is finite set and all of the ordered pairs of (x, /.IG(x)) generated by all derivations of E($ le) steps can be obtained. That (x, ZJ)is the element of L (G) is equal to that (x, Vi)is in lJ,Q, and v = sup {Vi 1(x, Vi)E U, Q, ), where x VG and v, ViEL. Therefore, it can be determined recursively whether (x, v) is the element of L (G) or not. It can also be determined recursively whether x is the element of L (G, h) or not, since x is the element of L (G, X) equal to (x, Vi)in g, Q, and X 5 sup {vi1(x, vi) E U, Qm> 3.2 THE CLASS OF LANGUAGES
GENERATED BY *-lfg
In this section, we shall consider the class of languages generated by *-lfg's with cut points. As mentioned in Sec. 1, *-lfg is defined as the lfg whose membership space is a lattice-ordered group or a lattice-ordered monoid. Here we would like to mention simply the property of a lattice-ordered group and a lattice-ordered monoid. Both a lattice-ordered group (for short L,) and a latticeordered monoid (for short L,) have the following properties. (a} Both L, and L, are lattice. Let the operation * be an operation of group in L, or an operation of monoid in L, . (b) Both an operation in Lg and an operation in L, preserve the order, that is,ifp~q,thena*p*b~cz*q*b,foralla,binLgorL,. (c) The distributive law holds such as a*(pVq)*b=a*p*bVa*q*b, a*(pAq)*b=a*p*bAa*q*b. From the properties of L, or L,, an interesting property can be seen in the class of languages generated by *-lfg. THEOREM5. The &US of the lan~ages L (G, h) generates by type 3 *lfg G withcut point properly includes the classof regularsets. Proof: At first, we shall show that context-sensitive languages and contextfree languages are generated by the type 3 *-lfg with cut point. Consider the type 3 *-lfg G whose membership space is L, such that L, = (Q’ X Q’ X Q+X Q+X Q+X Q+, X, V, A), where Q’ is positive rational numbers, X is a multiple operation, V is an operation of supremum, and A is an operation of infinum. The productions are (1) s+fr&s (2) s-G24
(2,1/2,1,1,2, I/2), (2,112,1,1,2,1/2),
L-FUZZY
GRAMMARS
(3) A-bA (4) (5) (6) (7) (8) Then the
131 (1,1,2,112,112,2),
A-bB n--+~ B-A’ G-K
(1,1,2, l/2, l/2,2), (l/2,2,1,1,1, l), (l/2,2,1,1,1, 1), (1, 1, l/2,2, 1, l), C-6 (1, 1, l/2,2, 1, 1). L-fuzzy languages, L(G), generated by this type 3 *-lfg G are
L(G) = ((a’b&z*b’, (2i-k, 2 k-i, 2i-l, 2l-j, 2’-j, 2i-j)) 1i, j, k, 12 1). Therefore context-sensitive languages are obtained by choosing the suitable cut points. For example, L(G,(l,
1, 1, 1, 1, I))= {a”b”a”b”ln
1 I],
L(G,(l,l,l,l,I,O))={a”b”a”bmIn~m~l~, L(G,(l,
1, l,O,l,
L(G,(O,l,l,l, L(G,(l,O,
l))=
l,l))= l,O, 1, l))=
{a”b”u”bm
In&z~
11,
(amb”a”b”In&n~l},
{a”b’Vb’In&z~l,n~.~
1).
Also, context-free languages are obtained by choosing the suitable cut points. For example, I))= (a”b”amb%,m,l~l~,
L(G,(O,O,O,O,I, L(G, (1, l,O,O,
O,O))=
{cPb*a”b
In,m, i?
l},
L(G,(O,0,1,1,0,0))={$“b”a’b”In,m,1~1}. When the membership space is not I!,~but 15, , context-sensitive languages and context-free languages are obtained in the same manner as in the case of L,. From the definition of type 3 *-&g, it is evident that any regular sets are generated by type 3 *4fg with cut point. In the above type 3 *-Ifg G with cut point h = (O,O, 0, O,O, 0), the language L(G, A) is the regular set. fhzmpfe. Consider the type 3 *-lfg G whose membership space is the lattice-ordered group Lg such that L, = (Q+ X Q+ X Q+ X Q+, X, V, A). The productions are (1) S-as
(2, l/2,1, l),
(2) S-bS
(l/2,2,2,
(3) s---,cs
(1,l.
(4) S-a
(2, lf2,I,
l/2),
l/2,2), 11,
HYO HENC KIM. erol.
132 (5) S--b
(l/2,2,2,
(6) s---+c
(l,l,
l/2),
l/2,2).
Let us actually generate x E {a, b, cp in which the number of a’s I x, I, the number of b’s 1xb I and the number of c’s Ix, I are ail two, and denote the set of 1x,1= 1x61= lx,l=Z}. Fort~eelement~~ccQ~~ word as X2 = {xlx~~~, X2, the derivation chain C is obtained as (2, g/2, 1.1)
C; S -)aS
1
(1, 1, I/2,
(1, 1, i/2,2)
(If% 2, 2, 112)
>=======FabS
y+abcS
2
(2, l/2,
.?pabccS
2)
(112, 2,2, f/2)
1, 1)
YpzbccaS
AT+abccab.
Thus, the membership grade of abccab is obtained as & (ubccab) = (2, 1/2, 1, 1) x (l/2,2,2, x (1,1,1/2,2)X
=(l, l,l,
(2,1/Z,
112) x (1, 1, l/2,2)
I,l>X (l/2,2,2,1/2)
1).
Lngeneral, the membership grade of x E {x I x E V$, lx, I = i, I xb I = j, lx, I = k, and i, j, k 2 1)is given as
Et,_(x) = (2i-i, 2i-i, 2P-k, 2k-/)_ Therefore many languages can be obtained by suitable cut points. For example, L(C,(l,
{XIXE VS, Ix,I= IiQl=
l,l,l))=
L(G,(l,O,
l,O))=
(XIXE
L(G,(l,
l/4,1,1/2))=
v;,
lx,lZ
{XIXE
v;,
lx&
I&
L(G,(1/4,1/4,1/4,1/4))=
lx& Ix,l~
Ix,lk Ix,lZ
l},
l),
ix&lx,l-2,
Ix*i-1},
{XlXE V& IIXJ-Ix*llJ2, llxt,I-lx,11~2),
L(G,(l,
l,l,O))=
{XIXE
V$,
Ix,l=
Ii&
lx,l}.
4. NORMAL FORM OF TYPE 2 lf-g In formal grammars, Chomsky and Greibach normal forms can be given for any context-free grammars 191. In this section, we shall show that Chomsky and Greibach normal forms for type 2 lfg can be constructed as the extension of the corresponding notion in the theory of formal grammars.
L-FUZZY
GRAMMARS
133
Chomsky and Greibach normal forms can be constructed for any A-lfg but not necessarily for *-1.g. That reason is reduced to the difference of membership space, since we must consider both words and the grade of m~mbers~p of those words generated by lfg. Lkj%zition 6. An L-fuzzy language L(G) and an L-fuzzy language L (G’) are equivalent if and only if PC (x) = fi~r (x), for any x E VF.
LEMMA7. For a type 2 I\-lfgG with e-rule, there exists the type 2 e-free hlfg
G'such that L(G’)=L(G)-
&w&~~.
Cm
&00&f LetWI={AI(r)A-,E~(r)},W*+l=W*U(AI(~)~A_t~(r), t E W,*), where A is a nonterminal of G and p(r) is the grade of the applica-
tion of the rule r of G. It is evident that if A E IV,,then A se. So the set of productions of G’ is constructed as follows: When @)A -+ f p(r) is a production of G, for the string o(# E) given by taking the string away any element of W, from the string !&tet the production (r’) A + w I’ be the production of G’. Suppose that w is obtained by taking , A, of IV,, the value I’ is given by awaytheelementAi,A2;.~‘(~‘)=~(~)AR*(A~,~)AR+(A~,~)A”.AR+(A~,~).
(21)
Suppose that (r) B +- t p(r) is a production of G and B E IV,, then the production (r’) B + $jI’ is given as the element of the set of production P’, and its value is g’ (r’) = ct(r). Here suppose that the grade of members~p of x E V.$by G is given as p&)=4/
@(S,crii)A
. ..AR(cuii.(~iAPi)AR(oliAP~,c~i~Pj)A’*
*
AR(oliJIPj,oliwpi)A...AR(cri,,x)l, and the e-rule is applied only to the relation between oi&.I,and ofW&, then the following equation should hold from the construction of G’. pG(x)=y
[R’(s,oji)A**
* AR’(ajj, EiA&) A R’(QiA&, aiW&) A
***
AR@imx)l In the same way, @G(x) = pG’(x) holds for any stringx E V;t. LEMMA8. Given type 2 A-&, we can find an equiuaZe~ttype 2 fkifg with 110productions of the form (r) A -+ B p(r), where A and B are nonterminals, r is a label of mle, and p(r) is a value of membership jimction of rule r.
134
HYOHENG
KIM.etaZ.
&oof: It may be assumed that G is an e-free and a loop-free type 2 hlfg. We construct the set of production P’ of G’ from P by first including all productions not of the forp (r) A -+E p(r). Suppose that A $B and there is a loop-free derivation chain from A to B such as A !!&$r r1
SB,
+
. . ‘zi+ B, r(rm!B.
rz
‘m
And suppose that the production (re) B + E p(rO) is in P, where 4;E V,. Then we add to P’ all productions of the form (I’) A-+ f I’, where the value of membership function of r’, p’(r)), is given by ~‘(r’)=~(rl)A~(rz)A.‘.A~(r,)A~(ro).
(22)
From the construction of the set of productions P’, it is evident that if S~x,thenS~xand~~(x)=PG’(r’). THEOREM 9. ~~~s~ normal form e~uiy~~entto a given type 2 A-lfg an be constructed. Chomsky normal form for lfg has productions of the form (ri) A + BC p(rI) or (q) A + a p(rj), where A, B, and Care nonterminal symbols, a is a terminal symbol, and p(ri) is the vaIue of the membership function of rule ri.
Proof: From Lemma 7 and Lemma 8, it may be assumed that the productions of a given type 2 A-ifg G are of the form (ri) A + B1 B2 * . * B, p(rj), m 2 2, or (rj) A +a v(ri), where A is a nonterminal symbol, and B1, Bz , * * . , B, are in V, U VT. If productions are of the form (q) A + a p(rj), then those are already in an acceptable form. Now consider the productions of the form (ri)A+BlB2 * - . B, g(ri), m 2 2. Each terminal Bk is replaced by a new symbol Ck, which appears on the right of no other productions. If Bk is a terminal symbol, then a new production (r;) C, + Bk I is created and the value I is given such that
(23) when the set of label is J = (rl , r2, * * *, I;, 1. And the production (ri) A + p(r& is replaced by (r,!) A -+ C1 C.‘, - . . C,,, p’fri), where Bk = C’, if Bk is a nonterminal symbol, and p(rJ = p’(ri). By these replacements, we have now the set of productions P’ of G’ with productions being either of the form (?$)A + Cr C2 . * . C,,, /_i(ri) or (r;) A~aEs’(r~),whereA,C1,C2;.,C, E Vi,aE Vi (= VT),andp(rj)= y(rf). Next we modify G’ by replacing the production of the form (ri) A “CrC2 .* . C, y’(ri) by the set of productions {($)A + CIDl p”(r;‘), ($J D1 + CzD, I, . * . ,(r~!+,_,)D,_,+C,_rC,I),whereDkisanadditional new nonterminal symbol to V,&,and &“(ri’) = p’(r,!). Then the new set of BIB2 -* f B,
135
L-FUZZYGRAMMARS
productions P” of G” is obtained. Clearly P” is the set of productions either of the form @;‘)A -+K’~J”($) or ($)A +a Jo”. So let G” be (VG, V;, P”, S,J”, u”), where Vl = VN U {C’,} U {&}, and VG = VT, then G” is the normal form equivalent to a given type 2 A-lfg G. COROLLARY 10. Greibach normal form equivalent to a given type 2 hlfg am be constructed. Greibach normal form for type 2 hlfg has productions of the form (ri) A + aa! u(ri), where A is a nonterminal symbol, a is a terminal symbol, and (ILE V$ .
B-oaf Since the proof is much the same as the proof in fuzzy languages [3], we shall omit the proof. Next we continue the discussion on the normal form for type 2 *-lfg. Before mentioning the construction of the normal form for type 2 *-lfg, we would like to mention the property of definability on *-lfg. Definition 11. Definability on *-lfg is that the grade of any word generated by *-lfg is obtained uniquely as the bounded value.
Generally speaking, derivation chains with loop are ad?itted in type 0, 1, and 2 grammars. That is, suppose that there is a derivation S 8 x whose derivation chain C is given as c;s==+*.
‘*cWi*”
'+O!j*aj+1
*".+&,=X,
and oi = oj. Then the following derivation chain C’ is also the derivation chain from S to x. C1;S3.“=)Crij’.‘~(lli3”‘=)oli=)Ori+l
=$“‘*o,=X.
Also, the derivation chains with infinite loop subchain oi * * * - * CY~ are the derivation chains from S to x. In this case, the value pG (x) is given by
PC(X)=
9 Mrl)
* . . . * (/..i(rJ
* **. *
/.l(rj))n
*
/.l(rj+l) * . ’
. *
P(rm>].
n=1
Now let u(ri) * . - * * p(ri) = v and suppose that v < y2 <. . * < v” < . . * , where
v2 = v * V, * * . ) v” = v * e1 - * v, then the value PG (x) can not be obtained uniquely as the bounded value. In the above case, *-lfg is not definable. Evidently, both any A-lfg and loop-free *-lfg are definable. LEMMA 12. Given a definable e-free type 2 *-lfg whose membership space is a complete lattice ordered group or a complete lattice ordered monoid, we can find an equivalent e-free type 2 *-lfg with no loops.
PLoof Let G be a given definable e-free type 2 *-lfg. As G is e-free type
HYO HENG KIM, etal.
136
2 *-lfg, we may consider only the case that there are loops between nonterminals A and B, that is, there are derivations A 5 B and B $A. It may be assumed that G has no productions of the form (r) A + B p(r) except that there is a loop between nonterminals A and B, because we can construct the equivalent grammar with no productions of the form (r) A + B p(r) in the same way as in Lemma 8 when there is no loop between nonterminais A and B. Suppose that there is a loop between nonterminals A and Bsuchthat(ro)A~Boo,(ri)A~~i,i=1,2,...,n,(r6)B-,Av,,and , m, are the set of all productions having A and B as (~~)B+~jUj,i=1,2,--* the premise. It is evident that fi can be derived from A by means of an infinite number of derivations which can be obtained by applying the productions (r,,) A -+ B u. and (r:) B -+A v. an arbitrary number of times before applying the production (ri) B + {i vi. Therefore the value of R+(A) fj) is given as follows: R’(A,~i)=R(A,B)*R(B,Si)VR(A,B)*R(B,A)*R(A,B)*R(B,~~)V.‘. *R(B,A))n
V(R(A,B)
=uo *vjvoo =
*R(A,B)*R(B,5;)V-.*,
*vo *og *,v+~*v(a,
C(UO* VO)n *
“Vo)” *uo “VjV”-,
CT0 * Vi.
(24)
n=O
Since G is a definable *-lfg, the value R+(A, {i) must be a boundary value, i.e., it is required that (u. * v~)~ * u. * Vi 5 b for any natural number n, where b is an element of the membership space L. When the membership space L is a complete lattice-ordered group, L is Archimedean, i.e., the following equation holds. (u. * vo) n<= b * v; * u; ==+ Qo * vo < = E,
(25)
where vj and 06 are inverse element of ~8and u. , respectively, and e is the unit element of L. From the property of the operation * in a lattice ordered group, it is clear that eloo
*v,~(u,
*Vo)2&**&70
*VJQ-.
(26)
So the value R+(A, {I) is given by R+(A) {i) = (~0* vi. When the membership space L is a complete lattice-ordered monoid, L is residuated, i.e., the following equation holds,
i n=o
cc 00 *voY *Go *&b=b3u,u=(oo
*voy=
(vlu*@o
*pi&}. (27)
137
L-FUZZYGRAMMARS
Since the above equation requires that u. * V. 5 e, the value R+(A, [J is also given such that R’(A, ci) = ~0 * Vi. Similary, it can be shown that R+(B, &) = ve * u‘i. Let G’ be the *-lfg modified by replacing the set of productions
by the set of productions {(r;)A-t{iUe
*vi,j=1,2,...,m,(ri)B-t~ivo
*Ui,i=1,2;*.,n}.
Then it can easily be seen that there are no loops in G’ and pc (x) = pG’(x) for any string x E V$. THEOREM 13. Given a definable type 2 *-lfg G whose membership space is a complete lattice-ordered group or a lattice-ordered monoid, there exists an equivalent type 2 *-lfg G’ with no loops.
Proof As in Lemma 12 we discussed the case where e-free type 2 *-lfg has loops, we shall discuss here on loops depending only on the e-rule. Suppose that the *-lfg G has productions such as (ro) A + AA v, (rl ) A + E p, (rz) A -+ .$u, where A is a nonterminal, [ # E, and C;=$e. Then [’ can be derived from A by means of infinite number of derivations which can be obtained by applying the productions (ro) A + AA v and (rl ) A + E p an arbitrary number of times before replacing A by [. Therefore the value R’(A, t’), i = 0, 1, 2, . . * , are obtained as follows: R+(A, e) = R(A, e) V R(A, AA) * R(AA,A) * R(A, E) V R(A, AA) * R(AA, AAA) * R(AAA, AA) * R(AA, A)
*R(A,e)‘/..., =pVv*p*pV(v*p)2
*pv’.‘v(v*p)“*pv*~~.
Similary, we can show that R+(A,[)=R(A,.$)VR(A,AA)*R(AA,A)*R(A,[)’/~.’, = u v v * p * u v (v * p)’ * u v - . . v (v * p)” * (5 v . . . , R+(A,4‘*)=v*o*a’/v*v*p*u2 v**.v
v*(v*p)“*u2v~~~,
‘/v*(v*~)~
*u2
(28)
HYOHENG
138
R+(‘4,Em)=um-l
*umVum-l
v...vp-1
*
KIM, etal.
*(u*p)*o”
(u * /I)” * u”
v ...) (29)
Since G is a definable *-lfg and its membership space is a complete latticeordered group or a complete lattice monoid, the value R+(A) t’), i = 0, 1,2, . . . are obtained in the same way as in the proof of Lemma 12 such that R+(;1,E)=p,R+(A,E)=o,R+(A,~2)=vo2,...,R*(A,~m)=vm_l~m;... Let G’ be the *-lfg modified by replacing the production (re) A + AA v by the production (rb) A + A [ VU. Then it can easily be seen that G’ has no loops and /.Q (x) = PG’(X) for any string x E V$. THEOREM 14. Given a definable type 2 *-lfg G whose membership space is a complete lattice-ordered group or a complete lattice-ordered monoid, there exists an equivalent Chomsky normal form.
ProoJ: It may be assumed that G has neither loops nor productions of the form (r) A -+ B p(r) from Lemma 12 and Theorem 13. Therefore Chomsky normal form grammar G’ can be constructed in the same way as in Theorem 9, that is, it can be constructed by means of replacing the operation A and value I in Theorem 9 by the operation * and value e, respectively, in which the operation A is the operation of infinum, the operation * is the operation of group or monoid, and value e is the unit element. Example. Consider the following definable type 2 *-lfg G in which VN = {A, B, S), VT = {a, b}, and membership space is a complete lattice ordered group such that L = (@ X Q’, X, V, A). And the productions are given by (1) S+aAB
(2, l/2),
(5) ‘4-e
(l/3,
(2) -4-M
(2,3),
(6) B -bB
(l/2,2),
(3) A-+aA
(2, l/2),
(7) B-A
(l/3,3),
(4) A-B
(1, l/2),
(8). B--+a
(l/2,2).
To find the equivalent follows.
l/4),
*-Zfgin Chomsky normal form, we proceed as
Step 1. As loops between nonterminals A and B are derived by applying the productions (4) A + B (1, l/2) and (7) B + A (l/3,3) an aribtrary number of times, Lemma 12 is applied to the above productions. The resulting set of productions is P’; (1’) S--_,aAB (2’) A+fi
(2, l/2),
(3’) A+aA
(2,1/2),
(2,3),
(4’) A--+bB
(l/2, l),
139
L-FUZZYGRAMMARS
(5’) A-b
(l/Z I>,
(9’)
(6’) A-e (7’) BAbB
(I/3, l/4), (l/2,2),
(10’) B+b
(l/2,2),
(11’) B-E
(l/9,3/4).
(8’) B-d
(2/3,3/2),
B-AA
(2/3,9),
Step 2. Since there are productions (2’) A + AA (2,3) and (6’) A + E (l/3, l/4) in P’, the following new set of productions P” is obtained by means of the same modification as in the proof of Theorem 13. P”; (1”) S+aAB (2”) A-
(2, l/2), aA4 (4,3/2),
(3”) A-ax4
(2, l/2),
(7”)
B-bB
(l/2,2),
(8”)
B-u/l
(2/3,3/2),
(9”)
B-AA
(2/3,9),
(4”) A-+bB
(l/2, 1),
(10”) B-b
(5”) A+b
(l/2,
I),
(11”)
(6”) ~--+e
(l/3,
l/4),
(l/2,2),
B-E
(l/9,3/4).
Step 3. Since the set of productions P” ;oes not derive loops, Chomsky normal form with the set of productions P” can be obtained in the similar manner of Theorem 9. P”‘; (1”‘) S -D,B
(2, l/2),
(2”‘) D,--_,C,A
(1, 1),
(3”‘) A -
DIA (4,3/2),
(4”‘) A +
CIA (2, l/2),
(8”‘)
B -
(9”‘)
B -AA
C,A (2/3,3/2), (2/3,9),
(10”‘) B +
C2B (l/2,2),
(1 1”‘) B -
b E
(l/2,2), (l/9,3/4),
a
(1, l),
b
(1, L).
(5”‘) A -C,B
(l/2,
I),
(6”‘) A -b
(l/2,
1),
(12”‘) B , (13”) cr+
(7”‘) A +e
(l/3,
l/4),
(14”‘)
C,--_,
COROLLARY 15. Greibach normal form equivalent to a given definable type 2 *-lfg whose membership space is a complete lattice-ordered group or a complete lattice-ordered monoid can be constructed.
5. CONCLUSIONS We have defined L-fuzzy grammars by introducing the concept of L-fuzzy sets and mentioned some properties of L-fuzzy grammars and languages generated by L-fuzzy grammars. In this paper, we have mainly discussed Lfuzzy grammars whose membership spaces are commutative. The interesting results for the properties of languages generated by L-fuzzy grammars whose membership spaces are not commutative will be obtained, since the membership grade of a string generated by such L-fuzzy grammars depends not only on the rules but also on the order of applying rules.
140
HYO HENG KIM. et al.
The membership grade of a string generated by an L-fuzzy grammar may be reregarded as an element which is described by some arguments of characteristic parameters. Therefore, it may be interesting to obtain the grade of similarity of incorrectness or ambiguity of strings by means of defining the distance between strings generated by an L-fuzzy grammar. REFERENCES 1. J. A. Goguen, L-fuzzy sets, J. Math. Anal. Appl. 18,145 (1967). 2. L. A. Zadeh, Fuzzy sets, Inform, Control 8, 338 (1965). 3. E. T. Lee and L. A. Zadeh, Note on fuzzy languages, Inform. Sci. 1,421 (1969). 4. T. Huang and K. S. Fu, Gn stochastic context-free languages, Inform. Sci. 3,201 (1971). 5. A. Salomma, Probabilistic and weighted grammars, Inform. Control 15,529 (1969). 6. M. Mizumoto, J. Toyoda, and K. Tanaka, General formulation of formal grammars, Inform. Sci. 4,87 (1972). 7. M. Mizumoto, J. Toyoda, and K. Tanaka, N-fold fuzzy grammars,Znform. Sci 5, 25 (1973). 8. M. Mizumoto, Fuzzy Automata and Fuzzy Grammars, Ph.D. Thesis, Osaka University, Feb. 1971. 9. J. E. Hopcroft and J. D. Ullman, Formal Languages and Their Relation to Automata, Addison-Wesley, Reading, Mass. (1969). 10. S. Ginsburg, The Mathematical Theory of Context-Free Languages, McGraw-Hill, New York (1966). 11. G. Bizkhoff, Lattice Theory, American Math. Sot., Rhode Island (1942). Received June, 1973