<?xml version="1.0" encoding="UTF-8"?>

<record version="5" id="11785">
 <title>linear language</title>
 <name>LinearLanguage</name>
 <created>2009-05-15 19:19:55</created>
 <modified>2009-06-09 05:36:19</modified>
 <type>Definition</type>
 <creator id="3771" name="CWoo"/>
 <author id="3771" name="CWoo"/>
 <classification>
	<category scheme="msc" code="68Q42"/>
	<category scheme="msc" code="68Q45"/>
 </classification>
 <defines>
	<concept>linear grammar</concept>
	<concept>left-linear</concept>
	<concept>right-linear</concept>
	<concept>strong left-linear</concept>
	<concept>strong right-linear</concept>
	<concept>minimal linear grammar</concept>
	<concept>even linear grammar</concept>
	<concept>deterministic linear grammar</concept>
 </defines>
 <synonyms>
	<synonym concept="linear language" alias="left linear"/>
	<synonym concept="linear language" alias="right linear"/>
	<synonym concept="linear language" alias="strong left linear"/>
	<synonym concept="linear language" alias="strong right linear"/>
 </synonyms>
 <related>
	<object name="MetalinearLanguage"/>
 </related>
 <preamble>\usepackage{amssymb,amscd}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathrsfs}

% used for TeXing text within eps files
%\usepackage{psfrag}
% need this for including graphics (\includegraphics)
%\usepackage{graphicx}
% for neatly defining theorems and propositions
\usepackage{amsthm}
% making logically defined graphics
\usepackage{xypic}
\usepackage{pst-plot}

% define commands here
\newcommand*{\abs}[1]{\left\lvert #1\right\rvert}
\newtheorem{prop}{Proposition}
\newtheorem{thm}{Theorem}
\newtheorem{ex}{Example}
\newcommand{\real}{\mathbb{R}}
\newcommand{\pdiff}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\mpdiff}[3]{\frac{\partial^#1 #2}{\partial #3^#1}}</preamble>
 <content>A formal grammar $G=(\Sigma,N,P,\sigma)$ is said to be \emph{linear} if each of its productions has the form $A\to x$, where $A$ is a non-terminal, and $x$ is a word over $\Sigma$ containing no more than one occurrence of a non-terminal.  In other words, a production in $G$ has one of the following forms:
\begin{enumerate}
\item $A\to \lambda$ (the empty word)
\item $A\to u$, where $u$ is a terminal word (over the set of terminal symbols $\Sigma-N$), or
\item $A\to uBv$, where $u,v$ are terminal words, and $B$ is a non-terminal symbol (in $N$).
\end{enumerate}

A langauge generated by a linear grammar is called a \emph{linear language}.

By definition, any linear language is context-free.  However, not all context-free languages are linear.  A Dyck language is an example of a non-linear context-free language.

Furthermore, every regular language is linear, since any production of a regular grammar has one of the above three forms, except $v=\lambda$ in the last form.  The converse is also not true.  For example, the language $\lbrace a^n b^n \mid n \ge 0\rbrace$ is known to be not regular (apply the pumping lemma), but it is linear, generated by the following productions $\sigma \to \lambda$, $\sigma \to a\sigma b$.

It can be shown that a language is linear iff it can be generated by a 1-turn pushdown automaton (once it starts popping, it never pushes again).

As we have seen above, a regular grammar is a more restricted form of a linear grammar.  Various restrictions may be placed on a linear grammar $G$:
\begin{itemize}
\item $G$ is \emph{right linear} if $v=\lambda$ is the third form above (so a regular grammar is also known as a right linear grammar)
\item $G$ is \emph{strong right linear} if it is right linear, and there are no productions of the second form
\item $G$ is \emph{left linear} if $u=\lambda$ in the third form above
\item $G$ is \emph{strong left linear} if it is left linear, and there are no productions of the second form
\end{itemize}

However, it can be shown that all of the restricted types of linear grammars mentioned above are equivalent, in the sense that a language generated by one restricted type can be generated by all other restricted types.

\textbf{Remark}.  Subfamilies of the family of linear languages can be formed by putting restrictions on the linear grammars.  In some cases, the subfamily formed properly sits between the family of regular languages and the family of linear languages.  Here are some examples:  let $G=(\Sigma,N,P,\sigma)$ be a linear grammar,
\begin{itemize}
\item $G$ is \emph{minimal} if $N=\lbrace \sigma \rbrace$, and there is exactly one production of the form $\sigma \to a$, where $a\in \Sigma$ such that $a$ occurs in no other productions.  Therefore, if $\sigma \to u$ is another production of $G$, then $u\notin \Sigma$, and $a$ does not occur in $u$.
\item $G$ is \emph{even} if every production having the third form above ($A\to uBv$) has the property that $|u|=|v|$ (same length).  It can be shown that every regular language can be generated by an even linear grammar, and that the converse is not true.
\item $G$ is \emph{deterministic} if every production has the form $A\to aW$, where $a\in \Sigma-N$, and $W$ is either the empty word $\lambda$, or in $N(\Sigma-N)^*$.  Furthermore, every $(A,a)\in N\times (\Sigma-N)$ corresponds to at most one production.
\end{itemize}

\begin{thebibliography}{9}
\bibitem{sg} S. Ginsburg, {\em The Mathematical Theory of Context-Free Languages}, McGraw-Hill, New York (1966).
\bibitem{hlcp} H.R. Lewis, C.H. Papadimitriou, {\em Elements of the Theory of Computation}. Prentice-Hall, Englewood Cliffs, New Jersey (1981).
\bibitem{hu} J.E. Hopcroft, J.D. Ullman, {\em Formal Languages and Their Relation to Automata}, Addison-Wesley, (1969).
\end{thebibliography}</content>
</record>
