0
Dr. Hussien Sharaf
Computer Science Department
dr.sharaf@from-masr.com
Part one
Introduction
Dr. Hussien M. Sharaf
What is TC and how old?
 TC is an accumulation of mathematicians work to
make a model for a machine that can do thinking
...
Let s hear a Story
 It started before World War II, Germans
army used Enigma encryption.
 Alan Turing and many mathemati...
Enigma machine
Dr. Hussien M. Sharaf
Enigma wiring
Dr. Hussien M. Sharaf
Back to TC
 Von Newman, Alan Turing and many
others continued working on creating a
model for a generic machine that can
...
What is TC?
 TC emerged to give answers for
“What are the fundamental capabilities and
limitations of computing machines?...
Why we still need TC?
 Technologies become obsolete but basic
theories remain forever.
 TC provides tools for solving co...
Branches of TC
Dr. Hussien M. Sharaf
Branches of TC
TC consists of:
1. Automata theory: mathematical
models for computational problems
such as pattern recognit...
Part two
Mathematical notations and
Terminology
Dr. Hussien M. Sharaf
Sets-[1]
 A set is a group of elements represented
as a unit.
 For example
S ={a, b, c} a set of 3 elements
Elements inc...
Sets-[2]
 If S ={a, b, c} and
T = {a, b} Then
T S
T is a subset of S
T S ={a, b}
T intersects S ={a, b}
T S ={a, b, c}
...
Sequences and Tuples
 A sequence is a list of elements in some order.
(2, 4, 6, 8, ….) parentheses
 A finite sequence of...
Example for Cartesian Product
 Example (1)
If N ={1,2,…} set of integers; O ={+, -}
N x O ={(1,+), (1,-), (2,+), (2,-), …...
Continue Cartesian Product
 Example (3)
If A ={a, b,…, z} set of English alphabets;
A x A ={(a, a), (a, b), ..,(d, g), (d...
 Example (5)
If U={0, 1, 2, 3…, 9} set of digits then
U x… x U ={(1,..,1), (1,..,2),...,(7,..,1), ..., (9,..,9)}
Continue...
Relations and functions
 A relation is more general than a function.
 Both maps a set of elements called domain to
anoth...
Surjective
function
t1
T
t3
t2

P1
P2
Pn
P4
P3
s1
s3
s2
t1
t3
t2
S T
Bijective
function
Many planes fly at
the same time
...
What is the use of functions in TC?
 Helps to describe the
transition function that
transfer the computing
device from on...
Graphs
 Is a visual representation
of a set and a relation of
this set over itself.
 G = (V, E)
V ={1, 2, 3, 4, 5}
E = {...
Graphs Construct
 Is there a formal language to
describe a graph?
 G =(V, E)
Where :
 V is a set of n vertices
={i| i <...
Definitions
 S (Alphabet) : a finite set of letters, denoted S
 Letter: an element of an alphabet S
 Word: a finite seq...
Strings and languages
 A string w1 over an alphabet Σ is a finite
sequence of symbols from that alphabet.
1. Σ: is a set ...
Strings -2
2.1 String: is a sequence of Σ (sigma) symbols
Σ Σ to the
power?
Example Description
{a, b, c, …, z} Σ
5
apple ...
Strings - 3
2.2 Empty String is Λ (Lamda) is of length zero
Σ
0
= Λ
2.3 Reverse(xyz) =zyx
2.4 Palindrome is a string whose...
Strings - 4
2.5 Kleene star * or Kleene closure
is similar to cross product of a set/string over itself.
If Σ = {x}, then ...
Part Three
Exercises
Dr. Hussien M. Sharaf
Exercise 1
 Assume Σ={0, 1}
1. How many elements are there in Σ2
?
Length(Σ) X Length(Σ) = 2 X 2 = 23
=4
2. How many comb...
Exercise 2
 Assume A1={AM, PM}, A2 = {1, 2, …59},
A3 = {1, 2, …12}
1. How many elements are there in A1 A3?
Length(A1) X ...
Exercise 3
 Assume L1={Add, Subtract},
DecimalDigits = {0,1, 2, …9}
1. Construct integer numbers out of L2.
DecimalDigits...
Exercise 4
 Assume HexaDecimal =
{0,1, …9,A,B,C,D,E,F}
1. How many HexaDecimals of length 4?
164
2. How many HexaDecimals...
End of Lecture 1
Dr. Hussien M. Sharaf
Upcoming SlideShare
Loading in...5
×

Theory of computation Lec1

415

Published on

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
415
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
54
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Theory of computation Lec1"

  1. 1. Dr. Hussien Sharaf Computer Science Department dr.sharaf@from-masr.com
  2. 2. Part one Introduction Dr. Hussien M. Sharaf
  3. 3. What is TC and how old?  TC is an accumulation of mathematicians work to make a model for a machine that can do thinking and calculations.  The concept of a machine at early 1900 was a device that does physical work.  Scientists effort started with a machine that can do specific calculations like encrypting text using specific set of steps.  Alan Turing believed he could invent a generic machine that can solve more than one type of problems. Dr. Hussien M. Sharaf
  4. 4. Let s hear a Story  It started before World War II, Germans army used Enigma encryption.  Alan Turing and many mathematicians tried to break the Enigma encryption.  Their efforts resulted in emergence of a mechanical device that was dedicated for deciphering Enigma encrypted messages.  As a result many German submarines were attacked and destroyed. Dr. Hussien M. Sharaf
  5. 5. Enigma machine Dr. Hussien M. Sharaf
  6. 6. Enigma wiring Dr. Hussien M. Sharaf
  7. 7. Back to TC  Von Newman, Alan Turing and many others continued working on creating a model for a generic machine that can solve different types of problems.  The accumulation of their work resulted in emergence of a collection of theorems called theory of computation. Dr. Hussien M. Sharaf
  8. 8. What is TC?  TC emerged to give answers for “What are the fundamental capabilities and limitations of computing machines?”  Most powerful and modern super computers can NOT solve some problems!!  No matter how much processors get fast , no matter how much memory can be installed; the unsolved problems remain unsolved!  We might need life time of the universe to find prime factors of a 500-digits number! Dr. Hussien M. Sharaf
  9. 9. Why we still need TC?  Technologies become obsolete but basic theories remain forever.  TC provides tools for solving computational problems like regular expressions for string parsing and pattern matching.  Studying different types of grammars like CFG would help in many other areas like compilers design and natural language processing. Dr. Hussien M. Sharaf
  10. 10. Branches of TC Dr. Hussien M. Sharaf
  11. 11. Branches of TC TC consists of: 1. Automata theory: mathematical models for computational problems such as pattern recognition and other problems. 2. Computability theory: computational models and algorithms for general purpose. 3. Complexity theory: classifying problems according to their difficulty. Dr. Hussien M. Sharaf
  12. 12. Part two Mathematical notations and Terminology Dr. Hussien M. Sharaf
  13. 13. Sets-[1]  A set is a group of elements represented as a unit.  For example S ={a, b, c} a set of 3 elements Elements included in curly brackets { }  a S  a belongs to S  f S  f does NOT belong to S   Dr. Hussien M. Sharaf
  14. 14. Sets-[2]  If S ={a, b, c} and T = {a, b} Then T S T is a subset of S T S ={a, b} T intersects S ={a, b} T S ={a, b, c} T Union S ={a, b, c}    Venn diagram for S and T Dr. Hussien M. Sharaf
  15. 15. Sequences and Tuples  A sequence is a list of elements in some order. (2, 4, 6, 8, ….) parentheses  A finite sequence of K-elements is called k-tuple. (2, 4) 2-tuple or pair (2, 4, 6) 3-tuple  A Cartesian product of S and P (S x P) is a set of 2-tuples/pairs (i, j) where i S and j P  Dr. Hussien M. Sharaf
  16. 16. Example for Cartesian Product  Example (1) If N ={1,2,…} set of integers; O ={+, -} N x O ={(1,+), (1,-), (2,+), (2,-), …..} Meaningless?  Example (2) N x O x N={(1,+,1), (1,-,1), (2,+,1), (2,-,2), …..}  Does this make sense? Dr. Hussien M. Sharaf
  17. 17. Continue Cartesian Product  Example (3) If A ={a, b,…, z} set of English alphabets; A x A ={(a, a), (a, b), ..,(d, g), (d, h), …(z, z)} These are all pairs of set A.  Example (4) If U={0,1,2,3…,9} set of digits then U x U x U ={(1,1,1), (1,1,2),...,(7,4,1), ….., (9,9,9)} Dr. Hussien M. Sharaf
  18. 18.  Example (5) If U={0, 1, 2, 3…, 9} set of digits then U x… x U ={(1,..,1), (1,..,2),...,(7,..,1), ..., (9,..,9)} Continue Cartesian Product n  Can be written as Un Dr. Hussien M. Sharaf
  19. 19. Relations and functions  A relation is more general than a function.  Both maps a set of elements called domain to another set called co-domain.  In case of functions the co-domain can be called range.  R : D C  A relation has no restrictions.  f : D R  A function can not map one element to two differnet elements in the range. Dr. Hussien M. Sharaf
  20. 20. Surjective function t1 T t3 t2  P1 P2 Pn P4 P3 s1 s3 s2 t1 t3 t2 S T Bijective function Many planes fly at the same time Only one plane lands on one runway at a time Dr. Hussien M. Sharaf
  21. 21. What is the use of functions in TC?  Helps to describe the transition function that transfer the computing device from one state to another.  Any computing device must have clear states. s1 s3 s2 D s2 shalt s3 R Dr. Hussien M. Sharaf
  22. 22. Graphs  Is a visual representation of a set and a relation of this set over itself.  G = (V, E) V ={1, 2, 3, 4, 5} E = {(i, j) and (j, i)| i, j belongs to V} E is a set of pairs ={(1, 3), (3, 1) …(5, 4), (4, 5)} 1 35 2 4 Dr. Hussien M. Sharaf
  23. 23. Graphs Construct  Is there a formal language to describe a graph?  G =(V, E) Where :  V is a set of n vertices ={i| i < n-1}  E is a set of edges. Each edge is a pair of elements in V ={(i, j), (j, i)|i, j V} or={(i, j) |i, j V } 1 35 2 4   Dr. Hussien M. Sharaf
  24. 24. Definitions  S (Alphabet) : a finite set of letters, denoted S  Letter: an element of an alphabet S  Word: a finite sequence of letters from the alphabet S  L (empty string): a word without letters.  Language S * (Kleene ‘s Star): the set of all words on S Dr. Hussien M. Sharaf
  25. 25. Strings and languages  A string w1 over an alphabet Σ is a finite sequence of symbols from that alphabet. 1. Σ: is a set of symbols i.e. {a, b, c, …, z} English letters; {0,1, 2,…,9,.} digits of Arabic numbers {AM, PM}different clocking system {1, 2, …, 12}hours of a clock; Dr. Hussien M. Sharaf
  26. 26. Strings -2 2.1 String: is a sequence of Σ (sigma) symbols Σ Σ to the power? Example Description {a, b, c, …, z} Σ 5 apple English string {0,1, 2,…,9,.} Σ 2 35 the oldest age for girls {AM, PM} Σ 1 PM clocking system {1, 2, …, 12} Σ 1 or Σ 2 12 a specific hour in the day Dr. Hussien M. Sharaf
  27. 27. Strings - 3 2.2 Empty String is Λ (Lamda) is of length zero Σ 0 = Λ 2.3 Reverse(xyz) =zyx 2.4 Palindrome is a string whose reverse is identical to itself. If Σ = {a, b} then PALINDROME ={Λ and all strings x such that reverse(x) = x } radar, level, reviver, racecar, madam, pop and noon. Dr. Hussien M. Sharaf
  28. 28. Strings - 4 2.5 Kleene star * or Kleene closure is similar to cross product of a set/string over itself. If Σ = {x}, then Σ * = {Λ x xx xxx ….} If Σ = {x}, then Σ + = {x xx xxx ….} If S = {w1 , w2 , w3 } then S * ={Λ, w1 , w2 , w3 , w1w1 , w1w2 , w1w3 , ….} S + ={w1 , w2 , w3 , w1w1 , w1w2 , w1w3 , ….} Note1: if w3 =Λ, then Λ S + Note2: S * = S **  Dr. Hussien M. Sharaf
  29. 29. Part Three Exercises Dr. Hussien M. Sharaf
  30. 30. Exercise 1  Assume Σ={0, 1} 1. How many elements are there in Σ2 ? Length(Σ) X Length(Σ) = 2 X 2 = 23 =4 2. How many combinations of in Σ3 ? 2 X 2 X 2 = 23 3. How many elements are there in Σn ? (Length(Σ))n = 2n Dr. Hussien M. Sharaf
  31. 31. Exercise 2  Assume A1={AM, PM}, A2 = {1, 2, …59}, A3 = {1, 2, …12} 1. How many elements are there in A1 A3? Length(A1) X Length(A3) = 2 X 12 =24 2. How many elements are there in A1 A2 A3)? Length(A1) X Length(A3) = 2 X 59 X 12 = 1416 Dr. Hussien M. Sharaf
  32. 32. Exercise 3  Assume L1={Add, Subtract}, DecimalDigits = {0,1, 2, …9} 1. Construct integer numbers out of L2. DecimalDigits + -A number of any length of digits. 2. Construct a language for assembly commands from L1 and DecimalDigits . L1 DecimalDigits + {,} DecimalDigits + - Commands in form of Add 1000, 555 Dr. Hussien M. Sharaf
  33. 33. Exercise 4  Assume HexaDecimal = {0,1, …9,A,B,C,D,E,F} 1. How many HexaDecimals of length 4? 164 2. How many HexaDecimals of length n? 16n 3. How many elements are there in {0, 1}8 ? 28 = 256 Dr. Hussien M. Sharaf
  34. 34. End of Lecture 1 Dr. Hussien M. Sharaf
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×