محاضرات نظرية الحوسبة theory of computation

Download محاضرات نظرية الحوسبة  Theory of Computation

If you can't read please download the document

Upload: -

Post on 27-Jul-2015

4.395 views

Category:

Documents


46 download

DESCRIPTION

محاضرات ألقاها د.ايمن حمارشه على طلبة قسم الحاسوب تم تجميعها في كتاب نظرا لقلة المصادر باللغة العربية

TRANSCRIPT

Theory of Computation

.

1

Theory of Computation (calculating counting) . intermediate steps . algorithm . , , .() . Algorithms Inputs . . Computational Complexity Theory theoretical computationally solvable : Computability Theory science computer . computational , solvable complexity theory , . .( ) : (Computation) . "Computing" and

outputs input computation

Computability Theory

.

2

: Computational Complexity (, ) . ( ) , :

.

( . . .

)

. models of computation . . Turing machine . RAM . )( cache memory . external-memory model . . Computations .

3

(. (.

) )

. .

.

. writing .

. . . . , , . . . . ) (Alphabets ): (Strings . .

4

. a1a2-an

a1,a2,..,an

.

Empty String

: } 1={a,..,z }9,..,1{=2 : 1 2 1 1 abb 321 21ba 413 . . 1 2(2 U 1) ,

Binary Alphabet . Unary String =0. Empty String 0 . . X 2. : 11 } 1{ X

Unary Alphabet )(String Length

: }1,0{

5

Xi . X

,X=X1X2 ..Xn Reverse String

n

X

: 1. X = XnXn-1 X : X = abcd . X = dcba Substring X . X . abracada : X X n XY Y XY m Y X Z : cad Concatenation . XY=X1X2.XmY1Y2Yn X k . : 10= Y=100 , X 00110=XY . . X X

: 10= X . X =010101 , X =0101 , X =01 , X = Permutations Strings . X * . }. =* - { 110= X 110, 101, 011

X

: 110= X 110, 11, 10, 1, 0,

10, 0, Proper Prefixes Strings 11, 1, . Proper Suffixes Strings

6

Searching

: Ordering of Strings Information

.

.

: 00110 )

.

}1,0{= 10 10 1110 00110 00110 (.

1110 00110. 3 }111,011,11,101,001,01,1,110,010,10,100,000,00,0,* = { . }1,0{= 1 Canonical . * Canonically Smaller : X Y 1. X Y Y 000= Y X.7

. .,000,00,0 . Ordering

2. X }1,0{= 11=X :

X . Y

00= X 11=Y :

}111,011,101,001,110,010,100,000,11,01,10,00,1,0,* = { Objects . Encoding . . : } . . . ,0000 ,000 ,00 ,0{ = )0(1f } . . . ,1000 ,100 ,10 ,1{ = )1(1f } . . . ,01000 ,0100 ,010 ,01{ = )2(1f } . . . ,11000 ,1100 ,110 ,11{ = )3(1f } . . . ,001000 ,00100 ,0010 ,001{ = )4(1f : ,}f2(0) = { ,}0{ = )1(2f ,}1{ = )2(2f 2f : Representation of Information

: }1,0{= 1f

8

,}00{ = )3(2f ,}10{ = )4(2f ,}01{ = )5(2f ,}11{ = )6(2f ,}000{ = )7(2f ,}0001{ = )8(2f . . . ,}1001{ = )9(2f }1{= : ,}f3(0) = { ,}1{ = )1(3f ,}11{ = )2(3f ,}111{ = )3(3f . .. . . ,}1111{ = )4(3f : : }f3(i) = {1i 3f

9

Representation Interpretation . 7 . 111 ) ( 3 Parties Interpretation . : Languages L Subset * L Sender Process 111 Function

Representation Receiver . Programs

Sentence Word . String *}1,0{

Language L : *}1,0{ ,}01,{0,11,001} , { }1,0{ .

01

}{

}{ 2L1 U L }2. {x x is in L1or X is in L 2L1L }2{x x is in L1 and in L 2L1,L Union

1 L 2L L1, L2 Intersection 1 L 2 L

Complementation L L }. {x x is in * but not in L L

: }1,0 , L2= {, 01, 11} , L1= { }11 ,10 ,1 ,0 ,L1 U L2 = { }L1 L2 = { }. ,100 ,000 ,11 ,01 ,10,00{ = 1L UL=L L= * = * =

11

L1

(L1-L2)

L2 L1

Difference L2

. {x x is in L1 but not in L2} (L1 L2) : L2 L1

Cross Product (x,y)

L2 y L1 x

{(x, y) | x is in L1 and y is in L2 } : (L1L2) L2 L1 Composition { xy | x is in L1 and y is in L2 } : L2={1,01,101} L1= {,1,01,11} : : L1 L2 = {, 11} L2 L1 = {101} : L2= {01,11} L1={,0,1} : L1 L2 = {(, 01), (, 11), (0, 01), (0, 11), (1, 01), (1, 11)} L1L2 = {01, 11, 001, 011, 101, 111} L - = L, - L = , L = , {}L = L.

12

0 L L

Composition i L 1 ..... L3 L2 L

Li } , { 0L *. L

Kleene closure

positive closure L +. L

.......

1L3 L2 L

}1,0, L1= { }11,10{=2 L : }11,01,10,00,1,0,L1 2 = { }111111,1011111,111011,101011,111110,111010,101010{ = 3 2L . , * * x 2 R1,R * * x: } 2{ (x, y) | (x, y) is in R1 or in R 2 R1 U R

2 R1 R } 2{ (x, y) | (x, y) is in R1 and in R 2 R1R } 2{ (x1x2, y1y2) | (x1, y1) is in R1 and (x2, y2) is in R : } )1,01(,)0, R1={( })01,0(,) R2= {( 1,: })10 ,0( ,) ,1( ,)1 ,01( ,)0 , ({ = 2R1 U R R1 R2 = })011 ,001( ,)1 ,101( ,)010 ,0( ,)0 ,1({ = 2R1R })101 ,010( ,)001 ,0( ,)1 ,011( ,)0 ,1({ = 1R2R } { (x, y) | (x, y) is in * * but not in R R

1- R } { (y, x) | (x, y) is in R31

: })10, R= {( ,) , ( : })R-1 = {( , ), (01, })R0 = {( , })1010 , R2 = {( , ), (, 01), ( Formal System Formal axioms . Language : Grammars . )( Subject )( Predicate . Noun Noun Phrase . Mary sang a song : > < > < > < >

> < > < a >