CS 314
FORMAL LANGUAGES AND AUTOMATE
THEORY
Introduction
1
TA. Anfal M. AlHazzaa
Grading ( 10 points)
Quizzes (7 points)
Participation ( 2 point)
Attendance ( 1 point )
Quiz2 Quiz1
3.5 3.5
Communication info.
Subject blog
http:// cs314.wordpress.com
Office: 1.505.5
Office Hours :
Saturday (10-12)
Sunday (12:0-2:20)
Monday(10-10:50)
Tuesday(12:30-1:20)
CS 314
FORMAL LANGUAGES AND AUTOMATE
THEORY
Sheet # 1 Exercises (From the textbook –Introduction to The
Theory of Computation – Ch. 0)
4
TA. Anfal M. AlHazzaa
Question 1
Examine the following formal descriptions of sets so
that you understand which members they contain.
Write a short informal English description of each set.
a-{1,3,5,7, ... }
odd natural numbers
b. {..., -4, -2,0,2,4,...}
even integers numbers
Question 1 cont.
c. {n |n = 2m for some m in N}
even numbers
e. {w | w is a string of 0's and 1's and w equals
the reverse of w}
e.x 0110
f. {n| n is an integer and n = n + 1}
Z
Question 2
Write formal descriptions of the following sets
a. The set containing the numbers 1, 10, and 100
{n|n = 𝟏𝟎𝒎 for m є {0,1,2}} or
{0,1} {i| i ={0,1}}
b. The set containing all integers that are greater than 5
{n|n > 5 for n є Z }
c. The set containing all natural numbers that are less than 5
{n|n < 5 for n є N }
Question 2 cont.
d. The set containing the string aba
{a,b}
e. The set containing the empty string
{ } or
f. The set containing nothing at all
Ø
FYI 1
It says "the set of all x's, such that x is greater than 0".
In other words any value greater than 0
Notes:
The "x" is just a place-holder, it could be anything, such as { q | q > 0 }
Some people use ":" instead of "|", so they would write { x : x > 0 }
FYI 2
Question 3
Let A be the set {x, y, z} and B be the set {x, y}.
a. Is A a subset of B?
No it is not
b. Is B a subset of A?
Yes it is
c. What is A ∩ B?
{x,y}
Question 3 cont.
d. What is A U B?
{x,y,z}
e. What is A × B?
{(x,x),(x,y),(y,x),(y,y),(z,x),(z,y)}
f. What is the power set of B
{Ø,{x},{y},{x,y}}
Question 4
Let x be the set {1, 2, 3, 4, 5} and y be the set {6, 7, 8, 9, 10}. The unary function
f: x y and the binary function g: X ×Y Y are described in the following tables.
n f(n) g 6 7 8 9 10
1 6 1 10 10 10 10 10
2 7 2 7 8 9 10 6
3 6 3 7 7 8 8 9
4 7 4 9 8 7 6 10
5 6 5 6 6 6 6 6
a. What is the value of f (2)?
7
Question 4 cont.
b. What are the range and domain of f?
the range {6,7} the domain {1,2,3,4,5}
c. What is the value of g(2, 10)?
6
d. What are the range and domain of g?
the range {6,7,8,9,10}
the domain {(1,6),(1,7),(1,8),(1,9),(1,10),(2,6)(2,7),(2,8),(2,9),(2,10),(3,6),(3,7),(3,8),(3,9),(3,10),(4,6),(4,7),(4,8),(4,9),(4,10),(5,6),(5,7),(5,8),(5,9),(5,10)}
e. What is the value of g(4, f(4))?
8
Question 5
Write a formal description of the following graph
G = (V, E)
any order
G={{1,2,3,4,5,6},{(1,4),(1,5),(1,6),(2,4),(2,5),(2,6),(
3,4),(3,5),(3,6)}
Question 5 cont.
a. what is the degree of node 1?
3
Question 6
let x = 01101; y = 110 two strings over the set ∑= {0,1},
a.what is xy ? xy=01101110
b. what is the length of the string x ?
|01101|= 5
c. what is | | ? | | = 0
d. what is the reverse of y ? 011
Question 7
𝞢1 = {a, . . . , z} and 𝞢2 = {0, . . . , 9} are alphabets ,
choose the correct answers :
a. abb is string over :
1- 𝞢1
2- 𝞢𝟐
3- none from the above
4- both 1 and 2
Question 7 cont.
123 is string over :
1- 𝞢1
2- 𝞢𝟐
3- none from the above
4- both 1 and 2
Question 7 cont.
is string over :
1- 𝞢1
2- 𝞢𝟐
3- none from the above
4- both 1 and 2