0% found this document useful (0 votes)
3 views

Chapter 6 (2)

Chapter 6 discusses computability, focusing on recursive functions and their construction through primitive recursion and composition. It defines recursively enumerable languages and recursive languages, highlighting the differences between them and the implications of their complements. Additionally, it introduces unrestricted grammars and establishes that any language generated by such grammars is recursively enumerable.

Uploaded by

Shafi Esa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Chapter 6 (2)

Chapter 6 discusses computability, focusing on recursive functions and their construction through primitive recursion and composition. It defines recursively enumerable languages and recursive languages, highlighting the differences between them and the implications of their complements. Additionally, it introduces unrestricted grammars and establishes that any language generated by such grammars is recursively enumerable.

Uploaded by

Shafi Esa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Chapter 6: Computability

6.1 Recursive Functions


▪ A function is a rule that assigns to an element of one set, called the
domain of the function, a unique value in another set, called the range
of the function.
Primitive Recursive Functions
▪ We will consider only functions of one or two variables, whose
domain is either I, the set of all nonnegative integers, or I × I, and
whose range is in I. In this setting, we start with the basic functions:
▪ The zero function z (x) = 0, for all x ∈ I
▪ The successor function s (x), whose value is the integer next in
sequence to x, that is, in the usual notation, s (x) = x + 1.
▪ The projector functions
pk (x1, x2) = xk, k = 1, 2
…cont’d
▪ There are two ways of building more complicated functions from
these:
• Composition, by which we construct
f (x, y) = h (g1 (x, y), g2 (x, y))
from defined functions g1, g2, h.
• Primitive recursion, by which a function can be defined
recursively through
f (x, 0) = g1 (x),
f (x, y + 1) = h (g2 (x, y), f (x, y)),
from defined functions g1, g2, and h.
…cont’d
Example 1 – 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
…cont’d
Example 2 - Using the add function defined in Example 1, we can now
define multiplication by
mult(x, 0) = 0,
mult(x, y + 1) = add (x, mult(x, y)).
Formally, the second step is an application of primitive recursion, in
which h is identified with the add function, and g2 (x, y) is the projector
function p1 (x, y).
To multiply 3 by 2, we apply these rules successively
mult(3, 2) = add(3, mult(3,1))
= add(3, add(3, mult(3, 0)))
…cont’d
= add(3, mult(3,1))
= add(3, add(3, mult(3, 0)))
= add(3, add(3, 0))
= add(3, 3)
= add(3, 2) + 1
= (add(3, 1) +1) + 1
= ((add(3, 0) + 1) +1) +1
= ((3 + 1) + 1) + 1
= (4 +1) + 1
=5+1=6
6.2 Recursive languages and recursively
Enumerable languages
▪ Definition - A language L is said to be recursively enumerable if there
exists a Turing machine that accepts it.
▪ This definition implies only that there exists a Turing machine M, such
that, for every w ∈ L,
q0w ⊢* x1qf x2 , with qf a final state.
▪ The definition says nothing about what happens for w not in L;
▪ It may be that the machine halts in a nonfinal state or
▪ It never halts and goes into an infinite loop.
…cont’d
▪ A language L is recursive if L = L(M) for some Turing machine M
such that:
▪ If w is in L, then M accepts (and therefore halts)
▪ If w is not in L, then M eventually halts, although it never enters an
accepting states
Complement of Recursive and RE languages
▪ If L is Recursive, L is also Recursive

▪ If L is RE, L need not be RE


…cont’d
▪ If a language L and its complement L are both recursively enumerable,
then both languages are recursive. If L is recursive, then L is also
recursive, and consequently both are recursively enumerable.
▪ There exists a recursively enumerable language that is not recursive;
that is, the family of recursive languages is a proper subset of the
family of recursively enumerable languages.
Unrestricted Grammars
▪ Definition - A grammar G = (V, T, S, P) is called unrestricted if all the
productions are of the form
u → v, where u is in (V ∪ T)+ and v is in (V ∪ T)∗
▪ In an unrestricted grammar, essentially no conditions are imposed on
the productions. Any number of variables and terminals can be on the
left or right, and these can occur in any order. There is only one
restriction: λ is not allowed as the left side of a production.
▪ Theorem - Any language generated by an unrestricted grammar is
recursively enumerable.
▪ Theorem - For every recursively enumerable language L, there exists
an unrestricted grammar G, such that L = L(G)

You might also like