Chapter 3 Complexity New
Chapter 3 Complexity New
Chapter 3
Computation
Recursive and Recursively Enumerable Languages
Definition A language L is said to be recursively enumerable if there
exists a Turing machine that accepts it.
⇒There exists a Turing machine M, such that, for every w ∈ L,
q0w├*M x1qfx2
with qf a final state.
⇒ For w not in L; it may be that the machine halts in a nonfinal state or
that it never halts and goes into an infinite loop.
Definition A language L on Σ is said to be recursive if there exists a
Turing machine M that accepts L and that halts on every w in Σ+.
Languages That Are Not Recursively Enumerable
Theorem For any non empty Σ, there exist languages that are not
recursively enumerable.
There exists a recursively enumerable language whose complement is
not recursively enumerable.
A Language That Is Recursively Enumerable but Not Recursive
Theorem If a language L and its complement are both recursively
enumerable, then both languages are recursive. If L is recursive, then
is also recursive, and consequently both are recursively enumerable.
Example
Addition of integers x and y can be implemented with the function
add (x, y), defined by
add ( x, 0) = x,
add ( x, y +1) = add ( x, y)+1.
To add 2 and 3, we apply these rules successively:
add (3, 2) = add (3,1) + 1
= (add (3,0) + 1) + 1= (3+1) + 1 = 4 + 1 = 5.
Example
Multiplication of integers x and y can be implemented with the
function
mult(x, y), defined by
mult( x, 0) = 0, projection
mult( x, y +1) = add ( x, mult(x, y)). ,recursion
mult(3,4)=mult(3,3+1)=add(3,mult(3,3))=add(3,mult(3,2+1))
=add(3,add(3,mult(3,2)))=add(3,add(3,mult(3,1+1))))=
add(3,add(3,add(3,mult(3,1))))=add(3,add(3,add(3,mult(3,1+0))))
=add(3,add(3,add(3,add(3,mult(3,0)))))
=add(3,add(3,add(3,add(3,0))))
=add(3,add(3,add(3,add(3,0))))
=add(3,add(3,add(3,3))))
=add(3,add(3,6))=add(3,9)=12
Example A kind of subtraction is defined from usual subtraction by
x y = x – y if x ≥ y,
x y = 0 if x < y
Now we define the predecessor function
pred (0) = 0,
pred (y +1) = y,
and from it, the subtracting function
subtr (x, 0) = x,
subtr (x, y +1) = pred (subtr (x, y)).
Subtr(5,3)=pred(subtr(5,2)= pred(pred(subtr(5,1)))=
pred(pred(pred(subtr(5,0))))= pred(pred(pred(5)))= pred(pred(4))=
pred(3)= 2.
Definition A function is called primitive recursive if and only if it can
be constructed from the basic functions z, s, pk , by successive
composition and primitive recursion.