Presentation is loading. Please wait.

Presentation is loading. Please wait.

Theory of computation 605401 1. Introduction theory of computation: It comprises the fundamental mathematical properties of computer hardware, software,

Similar presentations


Presentation on theme: "Theory of computation 605401 1. Introduction theory of computation: It comprises the fundamental mathematical properties of computer hardware, software,"— Presentation transcript:

1 Theory of computation 605401 1

2 Introduction theory of computation: It comprises the fundamental mathematical properties of computer hardware, software, and certain applications thereof. In studying this subject we – seek to determine what can and cannot be computed, – how quickly, – on which type of computational model. 2

3 Introduction Theory is relevant to student because it shows him – a new, simpler, and more elegant side of computers, which we normally consider to be complicated machines. – The best computer designs and applications are conceived with elegance in mind. – A theoretical course can heighten your aesthetic sense and help you build more beautiful systems.

4 Mathematical Notions and Terminology As in any mathematical subject, we begin with a discussion of the basic mathematical objects, tools, and notation that we expect to use. Set {7, 21, 57} A set is a group of objects represented as a unit. Sets may contain any type of object numbers, symbols, and even other sets. The objects in a set called elements/members. Sets may be described formally in several ways. One way is by listing a set's elements inside braces. Set {7, 21, 57} A set is a group of objects represented as a unit. Sets may contain any type of object numbers, symbols, and even other sets. The objects in a set called elements/members. Sets may be described formally in several ways. One way is by listing a set's elements inside braces.

5 Set {7, 21, 57}, contains the elements 7, 21, and 57. A = {1, 2, 4, 8}, A is the set whose elements are 1, 2, 4, and 8 The symbols  denote set membership The symbols  denote non-membership We write 7  {7, 21, 57} 8  {7, 21, 57} The symbols  denote set membership The symbols  denote non-membership We write 7  {7, 21, 57} 8  {7, 21, 57} For any set A, x is an element of A is written x ∈ A, x is not an element of A is written x  A For any set A, x is an element of A is written x ∈ A, x is not an element of A is written x  A

6 For two sets A and B A is a subset of B A  B, if every member of A is a member of B. A is a subset of B A  B, if every member of A is a member of B. A is not a subset of B, A  B, if A is a subset of B and not equal to B. there is at least one element of A that is not an element of B. A is not a subset of B, A  B, if A is a subset of B and not equal to B. there is at least one element of A that is not an element of B.

7 Set The order of describing a set doesn't matter, nor does repetition of its members. We get the same set by writing {57, 7, 7, 7, 21}. If we do want to take the number of occurrences of members into account we call the group a multiset instead of a set. Thus {7} and {7, 7} are different as multisets but identical as sets. The order of describing a set doesn't matter, nor does repetition of its members. We get the same set by writing {57, 7, 7, 7, 21}. If we do want to take the number of occurrences of members into account we call the group a multiset instead of a set. Thus {7} and {7, 7} are different as multisets but identical as sets.

8 Set An infinite set contains infinitely many elements. We cannot write a list of all the elements of an infinite set, so we sometimes use the ".." notation to mean, "continue the sequence forever." Thus we write the set of natural numbers X as {1,2,3,...}. An infinite set contains infinitely many elements. We cannot write a list of all the elements of an infinite set, so we sometimes use the ".." notation to mean, "continue the sequence forever." Thus we write the set of natural numbers X as {1,2,3,...}.

9 Set The set of integers Z is written {..., -2, -1,0, 1,2,... }. Exp. B = {0, 3, 6, 9,... } Exp. C = {13, 14, 15,..., 71} the empty set, the set with no elements, is denoted by ∅. The set with 0 members is called the empty set. The set of integers Z is written {..., -2, -1,0, 1,2,... }. Exp. B = {0, 3, 6, 9,... } Exp. C = {13, 14, 15,..., 71} the empty set, the set with no elements, is denoted by ∅. The set with 0 members is called the empty set.

10 Formal Languages A formal language is an abstraction of the general characteristics of programming languages. A formal language consists of a set of symbols and some rules of formation by which these symbols can be combined into entities called sentences. A formal language is the set of all strings permitted by the rules of formation. – 1. A Formal Language is a set of words, i.e. finite strings of letters, symbols, or tokens. The set from which these letters are taken is called the alphabet over which the language is defined. – 2. A formal language is often defined by means of a formal grammar (also called its formation rules). 10

11 11 Alphabet and Strings An alphabet is a finite set of symbols, non-empty set of symbols. – { 0, 1 } is a binary alphabet. – { A, B, …, Z, a, b, …, z } is an English alphabet. A string over an alphabet  is a sequence of any number of symbols from . – 0, 1, 11, 00, and 01101 are strings over { 0, 1 }. – Cat, CAT, and compute are strings over the English alphabet.

12 12 Empty String An empty string, denoted by є, is a string containing no symbol. (zero occurrences of symbols). є is a string over any alphabet.

13 13 Length The length of a string x, denoted by length(x), |x|, is the number of positions of symbols in the string. |automata| = 8 |computation| = 11 |ε| = 0, Let Σ = { a, b, …, z } X=01101, |x|=5 Y=110, |y|=3 x(i), denotes the symbol in the i th position of a string x, for 1  i  |x|.

14 String Operations: Power Power of an alphabet: Σ k :The set of strings of length k. Ex: Σ={a} Σ 0 ={є} Σ 1 ={a} Σ 2 ={aa} Σ 3 ={aaa} … Ex: Σ={0,1}, the binary alphabet Σ 0 ={є} Σ 1 ={0,1} Σ 2 ={00,01,10,11} Σ 3 ={000,001,010,011,100,101,110,111} 14

15 15 Σ *: Kleene star The set of strings created from any number (0 or 1 or …) of symbols in an alphabet  is denoted by  *. That is,  * =  0  i – Let  = { 0, 1 }. –  * = {є, 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, … }.

16 16 Σ + = K leene plus The set of strings created from at least one symbol (1 or 2 or …) in an alphabet  is denoted by  +. That is,  + =  1  i = 0..   i -  0 = 0..   i - {  } Let  = { 0, 1 }.  + = { 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, … }.  * and  + are infinite sets.

17 17 Languages A language over an alphabet Σ is a set of strings over Σ. (set of strings) A set of strings all of which are chosen from some Σ*. If Σ is an alphabet, and L e ⊆ Σ*, then L is a language over Σ. – Let Σ = {0, 1} be the alphabet. – L e = {  Σ * | the number of 1 ’ s in  is even}. – , 0, 00, 11, 000, 110, 101, 011, 0000, 1100, 1010, 1001, 0110, 0101, 0011, … are in L e

18 Example 1.the set of strings of 0’s and 1’s with an equal number of each. {є,01,10,0011,0101,1001,0110,….} 2. The set of binary numbers whose value is prime {10,11,101,111,1011,…..} 3. The language of all strings consisting of n 0’s followed by n 1’s, for some n ≥0: {є, 01,0011,000111,00001111,……} 18

19 Example 4. The language of all strings consisting of n 0’s followed by 2*n 1’s, for some n >0: {011,001111,000111111,000011111111,……} 5. The empty language, with no strings: ∅ 6. {є}, the language consisting of only the empty string (has one string). Note: ∅ ≠ {є} 7. The set of strings with length ≥2, of 0’s or 1’s: {01,10,00,11,000,101,111,……} 19

20 Example 8. The set of strings with length <5 of 0’s and 1’s: {є,0,1,00,01,10,11,000,001,010,011,100,101,110,111,0000,0001,0010, 0011,0100,0101, 0110,0111,1000,1001,1010,1011,1100, 1101, 1110,1111} 9. The set of all strings over {a,b} in which each string begins with a and has even length: {aa,ab,aaaa,aaab,aaba,abaa,aabb,abab,…} 10. The set of all strings over {a,b} in which each occurrence of b is immediately preceded by an a: {є,a,aa,ba,aba,aaa,baa,aaaa, aaba,baba,…} 20

21 21 Concatenation The concatenation of strings x and y, denoted by x  y or x y, is a string z such that: – z ( i ) = x ( i ) for 1  i  | x| – z ( i ) = y ( i ) for |x|< i  | x|+|y| Exp. automata  computation = automatacomputation x=a1a2…ai, y=b1b2….bj |xy|=i+j; xy=a1a2…aib1b2…bj x=01101, y=011 = xy=01101011 yx=?

22 22 Concatenation The concatenation of string x for n times, where n  0, is denoted by x n – x 0 =  – x 1 = x – x 2 = x x – x 3 = x x x – …– …


Download ppt "Theory of computation 605401 1. Introduction theory of computation: It comprises the fundamental mathematical properties of computer hardware, software,"

Similar presentations


Ads by Google