Conjunctive Grammar
   HOME

TheInfoList



OR:

Conjunctive grammars are a class of formal grammars studied in
formal language In logic, mathematics, computer science, and linguistics, a formal language consists of words whose letters are taken from an alphabet and are well-formed according to a specific set of rules. The alphabet of a formal language consists of symb ...
theory. They extend the basic type of grammars, the
context-free grammars In formal language theory, a context-free grammar (CFG) is a formal grammar whose production rules are of the form :A\ \to\ \alpha with A a ''single'' nonterminal symbol, and \alpha a string of terminals and/or nonterminals (\alpha can be empt ...
, with a
conjunction Conjunction may refer to: * Conjunction (grammar), a part of speech * Logical conjunction, a mathematical operator ** Conjunction introduction, a rule of inference of propositional logic * Conjunction (astronomy), in which two astronomical bodies ...
operation. Besides explicit conjunction, conjunctive grammars allow implicit
disjunction In logic, disjunction is a logical connective typically notated as \lor and read aloud as "or". For instance, the English language sentence "it is raining or it is snowing" can be represented in logic using the disjunctive formula R \lor S ...
represented 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 grammars known as
Boolean grammar Boolean grammars, introduced by , are a class of formal grammars studied in formal language theory. They extend the basic type of grammars, the context-free grammars, with conjunction and negation operations. Besides these explicit operations, Bool ...
s additionally allows explicit
negation In logic, negation, also called the logical complement, is an operation that takes a proposition P to another proposition "not P", written \neg P, \mathord P or \overline. It is interpreted intuitively as being true when P is false, and false ...
. The rules of a conjunctive grammar are of the form :A \to \alpha_1 \And \ldots \And \alpha_m where A is a nonterminal and \alpha_1, ..., \alpha_m are strings formed of symbols in \Sigma and V (finite sets of
terminal and nonterminal symbols In computer science, terminal and nonterminal symbols are the lexical elements used in specifying the production rules constituting a formal grammar. ''Terminal symbols'' are the elementary symbols of the language defined by a formal grammar. ...
respectively). Informally, such a rule asserts that every string w over \Sigma that satisfies each of the syntactical conditions represented by \alpha_1, ..., \alpha_m therefore satisfies the condition defined by A.


Formal definition

A conjunctive grammar G is defined by the 4-
tuple In mathematics, a tuple is a finite ordered list (sequence) of elements. An -tuple is a sequence (or ordered list) of elements, where is a non-negative integer. There is only one 0-tuple, referred to as ''the empty tuple''. An -tuple is defi ...
G = (V, \Sigma, R, S) where # is a finite set; each element v\in V is called ''a nonterminal symbol'' or a ''variable''. Each variable represents a different type of phrase or clause in the sentence. Variables are also sometimes called syntactic categories. # is a finite set of ''terminal''s, disjoint from , which make up the actual content of the sentence. The set of terminals is the alphabet of the language defined by the grammar . # is a finite set of productions, each of the form A \rightarrow \alpha_1\&\ldots\&\alpha_m for some A in V and \alpha_i \in (V\cup\Sigma)^*. The members of are called the ''rule''s or ''production''s of the grammar. # is the start variable (or start symbol), used to represent the whole sentence (or program). It must be an element of . 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\rightarrow\alpha_1\&\ldots\&\alpha_m and A\rightarrow\beta_1\&\ldots\&\beta_n can hence be written as A\rightarrow\alpha_1\&\ldots\&\alpha_m\ , \ \beta_1\&\ldots\&\beta_n. Two equivalent formal definitions of the language specified by a conjunctive grammar exist. One definition is based upon representing the grammar as a system of
language equation Language equations are mathematical statements that resemble numerical equations, but the variables assume values of formal languages rather than numbers. Instead of arithmetic operations in numerical equations, the variables are joined by language ...
s with union, intersection and concatenation and considering its least solution. The other definition generalizes Chomsky's generative definition of the context-free grammars using rewriting of terms over conjunction and concatenation.


Definition by derivation

For any strings u, v \in (V \cup \Sigma \cup \)^, we say directly yields , written as u\Rightarrow v\,, if * either there is a rule A \rightarrow \alpha_1 \& \ldots \& \alpha_m \in R such that u\,=u_ A u_ and v\,=u_ (\alpha_1 \& \ldots \& \alpha_m) u_, * or there exists a string w \in (V \cup \Sigma)^ such that u\,=u_ (w \& \ldots \& w) u_ and v\,=u_ w u_. For any string w \in \Sigma^, we say generates , written as S \ \stackrel \ w, if \exists k\geq 1\, \exists \, u_, \cdots, u_\in (V \cup \Sigma \cup \)^ such that S = \, u_ \Rightarrow u_ \Rightarrow \cdots \Rightarrow u_ \, = w. The language of a grammar G = (V, \Sigma, R, S) is the set of all strings it generates.


Example

The grammar G = (\, \, R, S), with productions :S\rightarrow AB \& DC, :A\rightarrow aA\ , \ \epsilon, :B\rightarrow bBc\ , \ \epsilon, :C\rightarrow cC\ , \ \epsilon, :D\rightarrow aDb\ , \ \epsilon, is conjunctive. A typical derivation is :S \Rightarrow (AB \& DC) \Rightarrow (aAB \& DC) \Rightarrow (aB \& DC) \Rightarrow (abBc \& DC) \Rightarrow (abc \& DC) \Rightarrow (abc \& aDbC) \Rightarrow (abc \& abC) \Rightarrow (abc \& abcC) \Rightarrow (abc \& abc) \Rightarrow abc It can be shown that L(G) = \. The language is not context-free, proved by the
pumping lemma for context-free languages Pumping may refer to: * The operation of a pump, for moving a liquid from one location to another **The use of a breast pump for extraction of milk * Pumping (audio), a creative misuse of dynamic range compression * Pumping (computer systems), the ...
.


Parsing algorithms

Though the expressive power of conjunctive grammars is 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 In computer science, a recursive descent parser is a kind of top-down parsing, top-down parser built from a set of mutual recursion, mutually recursive procedures (or a non-recursive equivalent) where each such procedure (computer science), proce ...
, the cubic-time generalized LR, the cubic-time Cocke-Kasami-Younger, as well as Valiant's algorithm running as fast as matrix multiplication.


Theoretical properties

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 Emptiness as a human condition is a sense of generalized boredom, social alienation and apathy. Feelings of emptiness often accompany dysthymia, depression, loneliness, anhedonia, despair, or other mental/emotional disorders, including schizoid ...
, finiteness, regularity, context-freeness,Given a conjunctive grammar, is its generated language empty / finite / regular / context-free? inclusion and equivalence.Given two conjunctive grammars, is the first's generated language a subset of / equal to the second's? The family of conjunctive languages is closed under union, intersection,
concatenation In formal language theory and computer programming, string concatenation is the operation of joining character strings end-to-end. For example, the concatenation of "snow" and "ball" is "snowball". In certain formalisations of concatenat ...
and
Kleene star In mathematical logic and computer science, the Kleene star (or Kleene operator or Kleene closure) is a unary operation, either on sets of strings or on sets of symbols or characters. In mathematics, it is more commonly known as the free monoid ...
, but not under string homomorphism,
prefix A prefix is an affix which is placed before the Word stem, stem of a word. Adding it to the beginning of one word changes it into another word. For example, when the prefix ''un-'' is added to the word ''happy'', it creates the word ''unhappy'' ...
, suffix, and substring. Closure under complement and under ε-free string homomorphism are still open problems (as of 2001). The expressive power of grammars over a one-letter alphabet has been researched. This work provided a basis for the study of
language equation Language equations are mathematical statements that resemble numerical equations, but the variables assume values of formal languages rather than numbers. Instead of arithmetic operations in numerical equations, the variables are joined by language ...
s of a more general form.


Synchronized alternating pushdown automata

Aizikowitz and Kaminski introduced a new class of
pushdown automata In the theory of computation, a branch of theoretical computer science, a pushdown automaton (PDA) is a type of automaton that employs a stack. Pushdown automata are used in theories about what can be computed by machines. They are more capab ...
(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.


Notes


References


External links

* * * * *
Technical report version (pdf)
{dead link, date=August 2017 , bot=InternetArchiveBot , fix-attempted=yes Formal languages