Conjunctive grammars are a class of formal grammarsstudied in formal language theory.They extend the basic type of grammars,the context-free grammars,with a conjunction operation.Besides explicit conjunction,conjunctive grammars allow implicit disjunctionrepresented by multiple rules for a single nonterminal symbol,which is the only logical connective expressible in context-free grammars.Conjunction can be used, in particular,to specify intersection of languages.A further extension of conjunctive grammarsknown as Boolean grammarsadditionally allows explicit negation.
The rules of a conjunctive grammar are of the form
A\to\alpha1\And\ldots\And\alpham
where
A
\alpha1
\alpham
\Sigma
V
w
\Sigma
\alpha1
\alpham
A
A conjunctive grammar
G
G=(V,\Sigma,R,S)
v\inV
A → \alpha1\&\ldots\&\alpham
A
V
\alphai\in(V\cup\Sigma)*
It is common to list all right-hand sides for the same left-hand side on the same line, using | (the pipe symbol) to separate them. Rules
A → \alpha1\&\ldots\&\alpham
A → \beta1\&\ldots\&\betan
A → \alpha1\&\ldots\&\alpham | \beta1\&\ldots\&\betan
Two equivalent formal definitionsof the language specified by a conjunctive grammar exist.One definition is based upon representing the grammaras a system of language equations with union, intersection and concatenationand considering its least solution.The other definition generalizesChomsky's generative definition of the context-free grammarsusing rewriting of terms over conjunction and concatenation.
For any strings
u,v\in(V\cup\Sigma\cup\{“(”,“\&”,“)”\})*
u ⇒ v
A → \alpha1\&\ldots\&\alpham\inR
u=u1Au2
v=u1(\alpha1\&\ldots\&\alpham)u2
w\in(V\cup\Sigma)*
u=u1(w\&\ldots\&w)u2
v=u1wu2
For any string
w\in\Sigma*,
S \stackrel{*}{ ⇒ } w
\existsk\geq1\existsu1, … ,uk\in(V\cup\Sigma\cup\{“(”,“\&”,“)”\})*
S=u1 ⇒ u2 ⇒ … ⇒ uk=w
The language of a grammar
G=(V,\Sigma,R,S)
The grammar
G=(\{S,A,B,C,D\},\{a,b,c\},R,S)
S → AB\&DC
A → aA | \epsilon
B → bBc | \epsilon
C → cC | \epsilon
D → aDb | \epsilon
is conjunctive. A typical derivation is
S ⇒ (AB\&DC) ⇒ (aAB\&DC) ⇒ (aB\&DC) ⇒ (abBc\&DC) ⇒ (abc\&DC) ⇒ (abc\&aDbC) ⇒ (abc\&abC) ⇒ (abc\&abcC) ⇒ (abc\&abc) ⇒ abc
L(G)=\{anbncn:n\ge0\}
Though the expressive power of conjunctive grammarsis greater than those of context-free grammars,conjunctive grammars retain some of the latter.Most importantly, there are generalizations of the main context-free parsing algorithms,including the linear-time recursive descent,the cubic-time generalized LR,the cubic-time Cocke-Kasami-Younger,as well as Valiant's algorithm running as fast as matrix multiplication.
A property that is undecidable already for context-free languages or finite intersections of them, must be undecidable also for conjunctive grammars; these include: emptiness, finiteness, regularity, context-freeness,[1]
The family of conjunctive languages is closed under union, intersection, concatenation and Kleene star, but not under string homomorphism, prefix, suffix, and substring.Closure under complement and under ε-free string homomorphism are still open problems (as of 2001).[3]
The expressive power of grammars over a one-letter alphabet has been researched.
This work provided a basisfor the study of language equations of a more general form.
Aizikowitz and Kaminski[4] introduced a new class of pushdown automata (PDA) called synchronized alternating pushdown automata (SAPDA). They proved it to be equivalent to conjunctive grammars in the same way as nondeterministic PDAs are equivalent to context-free grammars.