Embed
Email

Languages

Document Sample

Shared by: ewghwehws
Categories
Tags
Stats
views:
3
posted:
1/25/2012
language:
pages:
33
Theory of Computation





Shakir Al Faraji



Computer Science Dept.,

Petra University

Amman - Jordan.

email: shussain@uop.edu.jo





Thank you, Shakir

Dr. Shakir Al Faraji

IMPORTANT NOTES

 Students…

This presentation is designed to be used in

class as part of a guided discovery

sequence. It is not self-explanatory! Please

use it only for revision purposes after having

taken the class. Simply going through the

slides will teach you nothing. You must be

actively thinking, doing and questioning to

learn!





Thank you, Shakir.



Dr. Shakir Al Faraji

Course Strategy

 Be Warned: This is not a course

that spoon-feeds students.

 Students are expected to be

investigative and resourceful.

 Reading books and other research

of topics are expected.





Thank you, Shakir.

Dr. Shakir Al Faraji

Material

 There is a book:



Hopcroft, Rajeev,

& Ullman 3ed Edition

(2007), Addison Wesley



These were the lecture notes.

Well, apart from the slides.



Thank you, Shakir.

Dr. Shakir Al Faraji

Languages









Dr. Shakir Al Faraji

Introduction

 In English we distinguish three

different entities: letters, words,

and sentences.

 Groups of letters make up words

 Group of words make up sentences









Dr. Shakir Al Faraji

Formal language.

 The word “formal” refers to the fact

that all the rules for the language

are explicitly stated in terms of what

strings of symbols can occur.

 Language considered as symbols on

paper and not as expressions of

ideas in the minds of humans.





Dr. Shakir Al Faraji

Formal language - Cont.

 Language is not communication

among intellects, but a game of

symbols with formal rules.

 The term formal: used to

emphasize that it is the form of the

string of symbols we are interested

in, not the meaning.





Dr. Shakir Al Faraji

Alphabet (  ) .

 An alphabet  is a nonempty finite set

such that every string formed by elements

of  can be decomposed uniquely into

elements of .









Dr. Shakir Al Faraji

Language .

 A certain specified set of strings of

characters from the alphabet will be called

the language.

 Those strings that are permissible in the

language we call words.

 Empty string (  or  ):

string with no letters and sometimes

called null string.



Dr. Shakir Al Faraji

Language - Cont.

 null string

Word has no letters (  or  ):

 null set

Language that has no words (  ):

 Language L

L + {  } this is not same as L

L+ this is the same as L

Dr. Shakir Al Faraji

Example ( English language

).

 ={a b c d... z ‘ -}

 ENGLISH-WORDS = { all the words in a

standard dictionary }

 ENGLISH-WORDS does not have any

grammar.

 Formal definition of the language of the

sentences in English. Let us call this

alphabet (  )



Dr. Shakir Al Faraji

Example ( English language ).

  = { the entries in a standard

dictionary, plus a blank space,

plus the usual punctuation marks }

 ENGLISH-SENTENCES – examples

I ate one apple.

I ate two apples.

I ate three Tuesdays ? That’s wrong

sentence



Dr. Shakir Al Faraji

Example - Cont.

 ={a c d g o t}



 MY-PET = { cat , dog }









Dr. Shakir Al Faraji

Defining Languages.

 ={x}

 Language ,L , any nonempty string of

alphabet characters is a word.

 Can write it as

 L = { x xx xxx . . . }

 Can write it as

 L = { xn for n= 1, 2, 3, . . . }



Dr. Shakir Al Faraji

Example.

 ={x}

 L = { x xxx xxxxx . . . }

 L = { xodd }

 L = { x2n+1 for n= 0, 1, 2, 3, . . . }









Dr. Shakir Al Faraji

Example - Cont.

  = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }

 Can define the set of words:

L = { any finite string of alphabet

letters that does not start with

the letter zero }

 L = { 1 2 3 4 5 6 7 8 9 10 11 . . . }







Dr. Shakir Al Faraji

Example - Cont.

 Want to include the word ( zero )

 Can define the set of words:

L = { any finite string of alphabet

letters that, if start with a 0, has

no more letters after the first }

 L = { 0 1 2 3 4 5 6 7 8 9 10 . . . }







Dr. Shakir Al Faraji

Definitions.

 Length of string

 If a = xxxx, length(a) = 4

 Length(xxxx) = 4

 Length(439) = 3

 Length(  ) = 0









Dr. Shakir Al Faraji

Definition - Cont.

 reverse

 Reverse(274) = 472

 PLAINDROME

 PLAINDROME = { , and all strings x such

that reverse(x) = x }

  = { a, b }

 PALINDROME = { , a, b, aa, bb, aaa, aba,

bab, bbb, aaaa, abba, . . . }



Dr. Shakir Al Faraji

Kleene Closure.

 Given , we wish to define a language in

which any string of letters from  is a word,

even the null string.

 This language we shall cal the closure of the

alphabet ( * ) – kleene star

 ={x}



* = { , x, xx, xxx, . . . }





Dr. Shakir Al Faraji

Kleene Closure - Cont.

  = { 0, 1 }

* = { , 0, 1, 00, 01, 10, 11, 000,

001, . . . }

  = { a, b, c }

* = { , a, b, c, aa, ab, ac, ba, bc,

bb, bc, ca, cb, cc, aaa, . . . }







Dr. Shakir Al Faraji

Kleene Closure - Cont.

 S = { aa, b }

S* = {  plus any word composed of

factors of aa and b }



S* = {  plus all strings of a’s and b’s in

which the a’s occur in even

clumps }



S* = { , b, aa, bb, aab, baa, bbb, aaaa

aabb baab, bbaa, . . . }

Dr. Shakir Al Faraji

Kleene Closure - Cont.

 S = { a, ab }

S* = {  plus any word composed of

factors of a and ab }



S* = {  plus all strings of a’s and b’s

except those that start with b and

those that contain a double b }



S* = { , aa, ab, aaa, aab, aba, aaaa

aaab aaba, abaa, abab, abaab,. . . }

Dr. Shakir Al Faraji

Kleene Closure - Cont.

 Closure is a concatenation of words

from the base set.

 last example the word abaab

factors of (ab)(a)(ab)

 These three factors are all in the set S;

therefore, their concatenation is in S*







Dr. Shakir Al Faraji

Kleene Closure - Cont.

 If  =  ( empty set )

* = {  }

 If  = { x }

+ = { x, xx, xxx, . . . }

 * = + + 









Dr. Shakir Al Faraji

Subset

Given two sets A and B, we say that A

is a subset of B (which we denote as A

 B or simply A  B ) if every element

of A is also in B . That is, the following

implication holds:

xAxB









Dr. Shakir Al Faraji

Theorem S* = S**

 Every word in S** is made up of factors from

S*

 Every factor from S* is made up of factors

from S.

 Therefore

 Every word in S** is made up of factors from

S

 Therefore

 Every word in S** is also a word in S*

 Can write this S**  S*

Dr. Shakir Al Faraji

Theorem S* = S**

 symbol “” “is contained in”

 In general, A  A*

 Assume A = S*

 S*  S**

 Hence S* = S**









Dr. Shakir Al Faraji

SETS

 A set a group of objects represented

as a unit

 Sets may contain any type of object:

Numbers, symbols, and even other

sets

 Objects is called members or elements

 Sets described formally { 4, 5, 81 }







Dr. Shakir Al Faraji

Operations on SET

 Given sets A and B

 Union A  B

 Intersection A ∩ B



 Cartesian product A  B (cross

product)

 Power set of A ( 2A ):

Set of all possible subset from A



Dr. Shakir Al Faraji

Operations on SET

 Given sets A and B

 Union A  B

 Intersection A ∩ B



 Cartesian product A  B (cross

product)

 Power set of A ( 2A ):

Set of all possible subset from A



Dr. Shakir Al Faraji

END





Dr. Shakir Al Faraji



Related docs
Other docs by ewghwehws
By registering with docstoc.com you agree to our
privacy policy

You are almost ready to download!

You are almost ready to download!