What is the set of languages that TM’s accept?
We know that they accept RL’s and CFL’s.
And additional languages.
Question: Is there any language that a TM cannot accept?
Definition: A language \(L\) is recursively enumerable
if there exists a TM \(M\) such that \(L = L(M)\).
[Hah! All that says is that the languages that a TM can deal with now
have a name!]
We say that \(M\) accepts the language.
For every \(w\) in \(L\), \(M\) should accept \(w\).
Question: What happens if \(w\) is not in \(L\)?
Saying that \(M\) can properly accepting strings in \(L\)
doesn’t define happens if \(w\) is not in \(L\).
\(M\) may not halt in that case.
Note: We do not get a yes or no answer, just a yes if w is in L!
Definition: A language \(L\) is recursive if there exists a
TM \(M\) such that \(L = L(M)\) and \(M\) halts on every
\(w \in \Sigma^+\).
Thus, A language \(L\) is recursive if and only if there exists a
membership algorithm for it.
[Note the difference beteen a recursive language (one that is
recognized by a TM) and a recursive algorithm (which merely means
that it calls itself).]
NOTE: We will ignore the empty string.
In Chapter 9, the definition of the TM assumes that the input string
is always padded on both sides of the input.
If the input could be a blank, the tape head would not
know where the input string was.
It would be easy to adjust the definition to include the empty string,
but for now we will just examine languages that do not include
\(\lambda\).
Note
Not a problem if we use a one-sided tape as our base definition,
which is a good argument for doing it that way.
11.2.1.1. Enumeration procedure for recursive languages¶
To enumerate all \(w \in \Sigma^+\) in a recursive language \(L\):
* Let \(M\) be a TM that recognizes \(L, L = L(M)\).
* Construct 2-tape TM \(M'\)
Tape 1 will enumerate the strings in \(\Sigma^+\)
Tape 2 will enumerate the strings in \(L\).
- On Tape 1 generate the next string \(v\) in \(\Sigma^+\)
- Simulate \(M\) on \(v\)
If \(M\) accepts \(v\), then write \(v\) on Tape 2.
11.2.1.2. Enumeration procedure for recursively enumerable languages¶
The above procedure does not work, since \(M\) might not halt
on strings that are not in the language.
To enumerate all \(w \in \Sigma^+\) in a recursively enumerable
language \(L\):
Repeat forever:
* Generate next string (Suppose k strings have been generated:
\(w_1, w_2, ..., w_k\))
* Run \(M\) for one step on \(w_k\).
Run \(M\) for two steps on \(w_{k-1}\).
…
Run \(M\) for \(k\) steps on \(w_{1}\).
If any of the strings are accepted then write them to Tape 2.
Are there languages that are RE but not recursive? yes.
Are there languages that are not RE? yes
We will prove that there is a language that is not recursively
enumerable.
Note
Ask what is a powerset. \(2^{\{a,b\}}, 2^{pos. int.}\)
The next two theorems in conjunction with the previous theorem
will show that there are some languages that are recursively
enumerable, but not recursive.
If \(L\) is not recursive, then neither \(L\) nor
\(\bar{L}\) can be RE.
The language \(L = \{ a^i | a^i \in L(M_i) \}\) is RE but not
recursive (since we proved that its complement was not RE).
Hierarchy of Languages:
Now we will look at the grammar that represents the same language as
the turing machine.
Note
Also mention DCFL (which is between reg and CFL),
CS (which is between CFL and REC)
Definition: A grammar \(G = (V,T,S,P)\) is unrestricted if
all productions are of the form
\(u \rightarrow v\)
where \(u \in (V \cup T)^+\) and \(v \in (V \cup T)^*\).
No conditions are imposed on the productions.
You can have any number of variables and terminals on the left
hand side.
Definition: A grammar \(G\) is
context-sensitive if
all productions are of the form
\(x \rightarrow y\)
where \(x,y \in (V \cup T)^{+}\) and \(|x|\le |y|\)
Can be shown that another way to define these is that all productions
are of the form:
\(xAy \rightarrow xvy\)
This is equivalent to saying \(A \rightarrow v\) can be applied
in the context of\(x\) on the left and \(x\) on the right.
Definition:\(L\) is context-sensitive (CSL) if there exists a
context-sensitive grammar \(G\) such that \(L = L(G)\) or
\(L = L(G) \cup \{\lambda\}\).
In the definition of the grammar, we can’t have any lambda rules.
We put \(\lambda\) in there so we can claim that CFL \(\subset\) CSL
Theorem: For every CSL \(L\) not including \(\lambda\),
\(\exists\) an LBA \(M\) such that \(L = L(M)\).
Theorem: If \(L\) is accepted by an LBA \(M\), then
\(\exists\) CSG \(G\) such that \(L(M) = L(G)\).
Theorem: Every context-sensitive language \(L\) is recursive.
Theorem: There exists a recursive language that is not CSL.
Note
Section 11.3 covers context-sensitive languages (CSL).
These languages lie between the context-free languages and the
recursive languages.
CSL’s and LBA’s (linear bounded automata) represent the same class
of languages.