Você está na página 1de 180

-

- - --

- -
-
-- -- -
- - ---

- -

w -- --

- - -
- -
- -
- - - --
-
- - -

- - - - -
- - - -
- - - -
- -
- - - - -
--- - - --
- - -- - - - - -
-
- -- -
-
- - -
- -
- - - -
- -
- -
- -
- --
- - -
- - - -
- --
--- - - -
- - - - -
- - -
-- -
- -- - -
-

Preface

Preface

- -
- -
-
- - --
- - - -
-- - - -

vi

-
-

-
- -
- --


-
- -
--

-

--
--
-
-


- ^
- -
- -

F
G
^

o
r

X
Y
R
S

Notations

d d d d

-
- -

--


- - -
-

- --
-

B
F

7'
5%

Notations

viii

-- --- -- ---
- --

-

--

-
-
-

- - -

--
-- -- --

--

Contents


- --- -

-
- -
-

- -- -




- -




-
-


--
-- -- --

-

-
-

- - -

- -

Contents

-

--
---- --

-
- -- -

- -
- - --

--
--
-- --

- -

- -

-

- -

-
-

-
- -

-

- -

xi

Contents

xii

--
- - -
-

--
-- -- --

- -
- -
-
-
--

--
-- -- --


-

-- -

- -
-
- -

- --



--

- -

Contents

--
-- -- --


- - -

- - -

--

--
-- -- --

-
-
-

-- -

--
-- -- --

-- --

xiii

Contents

Union

-- - - - - - -
-- --

(a)

- - - -

- - R
- - - - -
- -- S
- - - - - - - - -
-- T
- - Z

- - - --

- -
- - -

- - - - - -
- - - -
- - - Z
- --
- - - - -
- -
- - -

- - - -
- - - -

0.1.1 Sets

0.1 BASICS

Introduction

Ch ap te r 0

Intersection

Set Difference

Complement

--

X
Y
X X
Y Y
X X X X
Y Y Y Y

- - - -
- --

Properties of set operations

- - - -

(d)

R Q

- - - - - - -

(c)

Y
Y

Y R

- -- Y - - -
- -

(b)

X Y Y X Y
Y X X Y X
X Y
Y X
X Y
Y X

Introduction

X S Y

S Y ~

R B R Q
B R R
B R Y ~

Solution

Y ~
Y Z
Z S

Example 0.1.2: -- --- - -

X Y

Y S X

R Y B R R
B R Q R Q
B R Q Q
B R Q X
B R X

R X B R Q X
B R Q Q
B R Q R Q
B R R
B R Y

Solution

Example 0.1.1: X Y

- -

X R R

Theory of Automata, Formal Languages and Computation

- -- X - -


Y
Y
Z

Y
B Y Z
B Y
B S

B
B

X Y
B Y
B Y Z

X Y
B X Z - Y Z
B

Y Z

Y ~

R Y ~ B R R
B R Q
B R

- R Y ~

Theory of Automata, Formal Languages and Computation

R X X
B R R X
B R R R
B R R R

X X T X X

- -

Solution

X X X X

Example 0.1.3: --

Y Y T Y Y

Y Y T Y Y

Y Y T Y Y

B R Y R

- -- R Y Y

R Y Y
B R R Y
B R R R
B R R R
B R Y R
B R Y Y

Solution

Y Y Y Y

--

Example 0.1.4: - -- - --

X X X X

X X T X X

R X X
B R X R
B R R R
B R R R
B R X X

-- - - X X

X X T X X

- -

X X T X X

B R X R
B R X X

Introduction

X
X

X Y X Y Y ~
Q Y ~
X Y ~ X ~
X Y ~ X X Y ~
Y ~ X Y ~ X Y ~
X Y ~

Solution


X Y

- X

Example 0.1.6: - -- -

Y ~ ~ X ~

R X ~ E Q X
E Q Q
E R ~ R ~
E R ~ Y ~
R Y ~ E Q Y
E Q Q
E R ~ R ~
E R ~ X ~

Solution

X ~ ~ Y ~
Y ~ ~ X ~

Example 0.1.5: -- - -

Y Y Y Y

Y Y T Y Y

B R R R
B R R R
B R R Y
B R Y Y

Theory of Automata, Formal Languages and Computation

l X l R l R l
R R R R
R R R
R R X
l X

Example 0.1.9: l X l l X

4 $
3
#
2 Z
"

- - - -

Solution

Example 0.1.8:

- - - - -
-

Solution

Example 0.1.7: -

l R R

- -- -
- R R - - --
- l

- - - - - ---
- - - - -

- -
- -

- - - Y Z
-- - -

Additional Terminology

Y ~ X Y ~
Q Y ~ Y ~ Z
X

Introduction

Theory of Automata, Formal Languages and Computation

(2, x, 3)

(2, x, 4)

(2, y, 3)

(2, z, 4)

(1, z, 4)

(2, z, 3)

(1, z, 3)

(1, y, 4)

(1, y, 3)

(2, y, 4)

(1, x, 4)

(1, x, 3)

l l I I

Set T

- -

Set S

- R - -
R

- - -
- - - -

- - - - -

-- - - - -

0.1.2 Relations and Functions

Solution

l l l l

Example 0.1.10:

- --

- - -- - --
- -
- - -

R - -
g Y Z

- ---
-

Partition

} - - -
- - } -

- - - -
- - -
-

Partial Ordering Relations

R R -
R R R - -
R R R - -

-- l - ---
-

Equivalence Relation

- - - - -

Introduction

Theory of Automata, Formal Languages and Computation

-- - -
R f - -

Solution

- - - -

Example 0.1.12:

R R B R - - -
B -

R R B R - - -
B R - - -
B -

- -
- - - - -
-

R R B R - -
B R - - -
B - -

R R B R - -
- -- R R - -

R - -

R R B R - -

- -
- -

Solution

R B R -
- - -

Example 0.1.11: - R

- - -

--- -
-

10

11

- -
R Q
- - -
R Q
- - -

R R Q

Solution

- - -
- -

Example 0.1.14: -

-- - -

Solution

- -
- -

Example 0.1.13: - -

- -
- - -
-

- f R -
f B
B
B f
- -
f f
B -
B
B
B f - - -

Introduction

r - -
- - -

- ~ - ~

Kinds of Functions

r - -- l -
R -

Functions as relations

- - - - -
- -
-
- -

- - - -
- - -
- -

- - - g
R R - R

Theory of Automata, Formal Languages and Computation

Functions

12

13

Example 0.1.16: - r

- -
g

Solution

- - - -

Example 0.1.15: -

r - - -
-
r - -

-
- -
- -

r - -
- -
r - -
-

Introduction

Theory of Automata, Formal Languages and Computation

- - R

Solution

R g

Example 0.1.18: r

I g I - -
-

Solution


- - -

Example 0.1.17:

- - - -
-

Solution

14

15

- - - -

- - -

- - -- -
-

- - -

- -

--- - - - -
- - --- --
- -

Graphs

0.1.3 Graphs and Trees

R - -

: *
9 )

8 ( : *
9 )
8 (

R --

R -

Introduction

Theory of Automata, Formal Languages and Computation

17

- - - -

- - -

- - - -
-

- -

- -

- - - -
- -

- - - - -
-

- - - - - -
- -- - - -
- - - - -

- - - - -

Introduction

- -
- - -

- - -
-

- - - -

--- --

- -
-
- - -
- -

16

Theory of Automata, Formal Languages and Computation

-- - - - -- --

- -

- - -

4
6
47
8
K

-- - -
- - -
- K K
- - - - --

- - -- - -
- - --

- K R - L

- - - - R
- - --

- - - - -
- - -

- -
K - - -

- - - --
- - -
-

- - - --

- -
- - -- --

0.1.4 Strings and Languages

18

19

R -

- -

-- - -- -

Example 0.1.19: --

R -
i i i i i i - -- -

4 R i K i - m
$
3
#
- K R "
2

-
-
- - -- -

R - -

- - -

R i - R R

- -
- i -

R
- - -

- -- -
- -- - -
- -

-- - R
K

Introduction

Theory of Automata, Formal Languages and Computation

- -

-- - -- -

-- --

Solution

--

Example 0.1.20: - -

- -

--

- -
- --
- -- -

R ~ - - -

Solution

20

21

r -
r - - - -- -

r -

Solution


m --

Example 0.1.22:

I


I



- --

Solution

R R - -

Example 0.1.21: - - - - -

Introduction

Theory of Automata, Formal Languages and Computation

Example 0.1.25: m

r - - -
r - - -

s
s


- - -
r - - -

X KK

- - -

X X KK

- - --

Solution

Example 0.1.24: --


- -
- -

m m

Solution

Example 0.1.23: m

22

X X KK
X X KK

23

- --
- -

Example 0.1.27:




- -




Solution

Example 0.1.26:




KKK
KKK

X X KK

X X KK

Solution

Introduction



B

B

Theory of Automata, Formal Languages and Computation

- - -

Solution:

Example 0.1.30:

- - -

--

Solution

Example 0.1.29: -

- - -
- - - -

- - -

- -

Solution

Example 0.1.28:

24

25

Solution

g m

m X }

m
} X
m
m Y

Example 0.1.33:

Solution

Example 0.1.32:

Solution

Example 0.1.31:

- - -

Introduction

m Y m

Theory of Automata, Formal Languages and Computation

m m

m m

m m
m m

-
-
- X
- Y
- X
- Y
- [
-
-
X -
X - X
X - Y
Y -
Y - X
Y - Y

X
Y

--

Solution

-- - -

Example 0.1.35:

X -- - -- -

Y - --

Solution

X Y

Example 0.1.34: - - -

26

27

- u -
- - -

- - -
- - [

- - - -

- - - F

- - G

H H

- -- H

- -- -
- - -
-

0.1.5 Boolean Logic

- -
- - -

Introduction

Theory of Automata, Formal Languages and Computation

Principle of Mathematical Induction

Pigeon-hole Principle

--
--

Example 0.1.37: m

- - - -- - -- -
- 7' - - - - -
- -

Solution

- - -

Example 0.1.36: - - - -

-- -
- - -
- - -

(b)

m -- - - - --
- -

-- -

- - - - -
- - - -
--
- - m - - -- - - - -
-
- -

(a)

0.1.6 Fundamental Proof Techniques

- - - - r - - - - - - - r -

28

29

-- - -

Example 0.1.39: m -

- -
-

--

- -

Example 0.1.38: m

: *
m 9 ) I
8 (

: *
m 9 ) I
8 (

m

*
:
I 9 ) I
8 (

Introduction

*
:
9 -- )
8
(

'
7

L & -
%
56

*
:
9 --
)
8
(

'

7
6

L &

%
5

--

Solution

- -

Example 0.1.40: - - m

- m

Theory of Automata, Formal Languages and Computation

--

30

: * '
7: *
69
) 9
) &

6
&
8
(
8
(

5
%



: * ' 7 : *
: * '
7: *
69
69
) 9
) &
)
) &

9
68 (
8 ( &
68 (
8 ( &
5
%
5
%

7

'

6
&
5 %

7: * : * '
) 9
)&
69
65 8 ( 8 ( &%

: * '
7: *
69
) 9
) &

68
(
8
( &
5
%

--

--

31

Example 0.1.41: - - ? / m

- - -

7
'
6 L &
5
%

Introduction

Theory of Automata, Formal Languages and Computation

L L

Q -

--

--

Example 0.1.43: m

B - -

- - - -

-- - -

-- -

Example 0.1.42: - m -

32

33

Solution

- -
- - -

Example 0.1.45: - -

B R

B - - -
-




- Q - -

- - - - -

B - -
B

-- - -- - -
-

--
-

Example 0.1.44: R -

- - - -

B -

Introduction



LLL
LLL


L
7 '
6
&

5
%

-- -- - - m

- - -

--

Example 0.1.46:

- -

; ;

35

Example 0.1.48: R

B - -

; ;

B -

--

-- ;

Example 0.1.47:

- - R

- - KK
- - -

Introduction

Theory of Automata, Formal Languages and Computation

- -
-
-

34


B
B
B
B
B

*
))
(

7
'
: *
6 9 ) &
8 (
5
%
7
: *'
6 9 ) &
8 ( %
5

7
'
: *
6 9 ) &
8 ( &
65
%

:7
: * '
99 6 9 ) &
8 ( %
85

-- - -
- -

Example 0.1.50: - -

B -

--

7
: * '
6 98 )( &

5
%

Example 0.1.49: - -

- - m

Theory of Automata, Formal Languages and Computation

-- - m

36

37

- - r
-

- -
- -
- -

- - - -
- -

0.1.7 Introduction to Grammar

- -
- - -
-
- 7'
- - -

Solution

- - - -
-

Example 0.1.51: - - -

- - -

-
- - - - - -
- -
-

KK

- --

KK

- - -

Solution

Introduction

Theory of Automata, Formal Languages and Computation

r
r

B
B
B

B
B

- r

- -

- - -



r - -

Solution

- -

Example 0.1.52:

- KK - - -

- -

B B B KK B B

R -

R B

- -- - - -

38

39

r
r
r
r

R
-- - R -

- - - -
-
-- - R -

Solution

Example 0.1.54:

r
r
r

- -

- r r
m -

Solution

Example 0.1.53: -

Introduction

Theory of Automata, Formal Languages and Computation

r
r
r
r

B
B
B

- r r
r - -
- - -

B
B
B
-
B

r - -

Solution

r
r

- - -
-

- m

B
B
B
B
B
B
B
B

--
-- -
-- -

Example 0.1.57: - --

Solution

r
r
r
r
r

Example 0.1.56: -

r
r

- - -

m

Example 0.1.55:

41

B
B

- -
- r

Introduction

- - -
- -

r
- -

- - - - - -

40

Theory of Automata, Formal Languages and Computation

} m

r
r
r

r
r
r

Soution

r
r
r

Example 0.1.58: - -

r
r
r
r
r R

-- -

r
r
rR

-- - -

r
r
rR


- - - -

Solution

42

43


-
- -
- -
- - - -
-- - -
- -
- -
- - - -
-
- - - -
-

- -

- -
-
- -
- - -
-
-
- --
- --
- - --
- --
- -- -
- - -
-
-
- -

GLOSSARY

- - -

r
r

Introduction

-
-
-
-
-
-


-- - --
--
- - - - -
- --
- -
-
-

-
-
--
--
-
- -






-

REVIEW QUESTIONS

-


-
-
-
-
-

-


-


- -
-
- -
-
- -
-

--
- -

--
-
- -



-
-




- -

- - -
- - - --
- -
- - - -

45

Introduction

Theory of Automata, Formal Languages and Computation

44

EXERCISES

Theory of Automata, Formal Languages and Computation

-
X X Y Y
-- Y
-- Y X Y
- --
X
Y

Y Y

- -- -



-- -
-
R -
R - -

-- - -
R S R
-- - S S - S
--

- --

- --

I I
- I I - - - - -
- - - l l
- l - -
- -
- -- - -

X Y

46

47

- - -
- ---
- --- -
--- -
- ---
- ---
-
- ---
-
- -- -
-
-
- ---
- -

Y T Y

- -
-
-
R
R
--- RQ -
X - -
-

X Y I
- -
R - -
-

Y X

- - - -

X Y X Y X

- -

Y X Y X Y

- - -

KK KK U I

Introduction

Theory of Automata, Formal Languages and Computation


- -
- - -
- - -

- - -
-


7 '
- -

o
-
--- - -
- -
--- -
- -
- -


- -

Y X Y


X Y
Y X
Y
X Y X

48

49

r R g

- -- - - -


r


-
r r - - -
o o
- - -
- - -
--
-- - -
- -- -
-- - - -

- -
- - - - -




- - -
-
-
-

-

- - -
- -
-- - - --
--
- - - -
- -

Introduction

Theory of Automata, Formal Languages and Computation

r
r

l -- -

-
-

-
- -- - -
- -- - -
- -- - -
- -- - -
- -

m
-- - - - - -


- - -

-
- -
KK

- - -


r r r
- -
KK

-

- - -
- - - R

m f

- - - -

50

51

-
- - -
- -
- - - - - -
-
- -
-
- - -

SHORT QUESTIONS AND ANSWERS

- L
-
-
L
- - -
- -- - -

- - -
- - --
- - -
- -
- - -
- -

-- -- -
- -
- - - -

- - - - - --
- - -

Introduction

X R R

- -- -

X X
Y Y

-
- - - -
-
-
X
Y

R Q

-
- - - - - -
- -

Y R R

- --
- -- Y - - - -

53


-- - - - - -
- R - -
R

- - - -
- - - -
-
-- l -
--- -
R R -
R R R
- -
R R R - -

l R R

- --
- Y --
- -
-
- - -
-
-
- --- - - -

- - - - - -
- - -
-
- - R R -
- -- l

- -
X Y
Y X

- -
X Y
Y X

X X X X
Y Y Y Y
- X Y Y X Y
Y X X Y X

- -
- - - - -
- -
- - - - -
--
- - - - -
-- - - S
--
- - - - - - - - --
T
- -
- - -
--
-- - - - - -
- -- --
-- -
--

Introduction

Theory of Automata, Formal Languages and Computation

52

Theory of Automata, Formal Languages and Computation

co-domain

- -

- r - - - -
-
- ~ - ~

-
r - -
- -

-
-
- -
-
r - - - -

domain


- -
- - -
-
- -
- -

- ---
-
R - -
g Y Z
-
- - - -
- -
- - -

54

- -

KK - - -
-
- - - - -
- - -

55

r - -


--- - -
- - - ---
-- -


- - -
-
- -
- - -
-
- - - -
-
- -

- -
- - - - - -
-
- -- - -
-
- - - - - -

- -


- -

- - - -
-
- - - --
- - -
-
- --

Introduction

Theory of Automata, Formal Languages and Computation

-
- -- - - -


- - H
H H

- - G
-
- - F
-

-
- - - -
-- --
R K - m - K R

-
- - - R
- -
- -
- - -
-
-- - - -
- -- --
-- - R

-
- -- -

- -- -
-
I R I - R R

56

57

- - - - --
- -
- -

-
- -
- - - -
- --
- - m - -
-- - -
- - -

- - -
- - -


- -

Introduction

Storage

- - -
- -
- - - -- - - -
- - - -

-
-

1.1.2 Types of Automaton

- - -
- - -
- - -
- - --
-

Output

Control Unit

Input File

- - -
- - - -

1.1.1 AutomataWhat is it?

1.1 DETERMINISTIC FINITE AUTOMATA (DFA)

DFA and NFA

Ch ap te r 1

59

- --
- --
-
-
--



- -
- - - -

-
-

R - - -

Example 1.1.1: - -

- -
- -
- -
-
- - -
- -

l r
R
S

- -

1.1.3 Definition of Deterministic Finite Automaton

- -- - - -

DFA and NFA

Theory of Automata, Formal Languages and Computation

q0

q1

q2

--

q3

-
-

- - -

Example 1.1.2: -

-- -
- - -
- - - - - - - - -
- - - - - - - - -
- - - - ---

- -
- - -
- - - - -
-

- - - - - -

-

Solution

60

1
q2

0,1

--

q1

0
q3

61

1
q2

q1

- - - - -
--
-
- -
-
-

Solution

Example 1.1.3:

- -
- -

- - -- - -
- -
-

- -
- - - --

- - -

Solution

DFA and NFA

Theory of Automata, Formal Languages and Computation

q0

q1

a,b

q2

a,b

- - -

- - -

Solution

-
- - -
- --

Example 1.1.5: - - --

m -- K
- -- --
- - --

Solution

Example 1.1.4: -

- - - -

62

q2

b
a

q3

q1

63

q0

q1

q2

q3

q4

q1

b,c
b

q2

a
a

b
q3

q4

a,b,c

Example 1.1.7: - -

q0

b,c

- - --
- -
- - -

- - -

Input

- - -- - -

Solution

- - - - -

R -

Example 1.1.6: --

q0

DFA and NFA

Theory of Automata, Formal Languages and Computation

q1

a,b

q3



-
-
- - - -

q2

q0

- - -

- -



-
-
-

q1

q3

a,b

q2

- -
- -
-

Solution

Example 1.1.8: -

q0

q4

- -
- - - -

Solution

64

a,b

q3

q1

q2

a,b

Solution

- - - -
-

Example 1.1.10: - -

- - -

- - -- -
- -

q0

--
- - - - -

Solution

65

Example 1.1.9: - - - --

DFA and NFA

-
-

Theory of Automata, Formal Languages and Computation

q2

- - -

Solution

q0

q2

q1

Example 1.1.11: - --

- - -

q1

q0

- -- -- -
- - - -
-- -
- - - - - -

66

67

q2

0
0

q1
1

q3

q0

q2

q1

q0

0
1

q2

q1

q3

0,1

Solution

R
- -

Example 1.1.13:

q0

Solution

- -

Example 1.1.12: - --

DFA and NFA

(b)

(a)

q1

q2

q1

- -

q0

m
- -

Solution

m
R
m
R

Example 1.1.15:


R - -

R -

Solution

q1

q0

b
a

q3

q1

q2

q1
b

q0
b
b

q3

q1

q2

--

- -- - -

q0

--

Solution

q2

--
--
-- - -
- -

Example 1.1.16:

- -

q0

m R - g -
- - -

Example 1.1.14: - -

69

DFA and NFA

Theory of Automata, Formal Languages and Computation

68

1-9

q1

+,

0-9

q2

1-9

q1

0-9

q1

q3

- -

- - - --
l X r
R - - S - - --

--

Solution

Example 1.2.1: -- --

- - -
- - - - - --
- - -

- -

Definition

1.2 NON-DETERMINISTIC FINITE AUTOMATA (NFA)

q0

- -

q0

q0

q2

Theory of Automata, Formal Languages and Computation

-- - -

70

1
q2

0,1
q3

0,1
q4

q0

q0

a,b,c

abac

q2

q1

q1

a,b,c

71

0
q2

R m -

q1

Example 1.2.4: -

- -

q0

-
-

- --

Solution

- --

Example 1.2.3: --

Solution

R -

Example 1.2.2:

- - - -

q1

- -

DFA and NFA

Theory of Automata, Formal Languages and Computation

q1

a,b

q2

a,b

0,1

q0

q2

q3

0,1

- - -

q1

--

Solution

- -

Example 1.2.5: -

q0

a,b

- -

q3

- --
- -
- - - -

Solution

72

73

a
q4

a
q1

q5

q2

a
q3

m X m

- m
- - - - -

- -- -

Solution

m X m

Example 1.2.7: --

- - - -- - - -

X - X

X -

Solution

q0

- X

Example 1.2.6: -

DFA and NFA

q1

q4

q2

- - -

- - - -
- - - - m
- - - - m

q0

q3

- - - --
m

m X m

Solution

m X m

Example 1.2.8: - -- -

- -

q0

q1

b
q2

q1

a
q2

-
- -- - -
-
- - -

Definition

a,b

q0

1.3 EQUIVALENCE OF NFA AND DFA

Solution:

Example 1.2.10: -

- -

- - - - - - - -

Solution:

Example 1.2.9: -- -

- m
- - - - - - - -
- -- - - -
- -
-

75

DFA and NFA

Theory of Automata, Formal Languages and Computation

74

a
Z

[q1]

q0

q2

q1

- - -- - - -

Solution

[q0,q1 ]

Example 1.3.2: - - - -

[q0]

X Z

~ X

- - - - -
~

~ Z
~
~

~ ~ ~ ~ ~ -

Solution

-- - - - - - -

Example 1.3.1: -

77

DFA and NFA

Theory of Automata, Formal Languages and Computation

76

Theory of Automata, Formal Languages and Computation

- - -- -

- - -- - --
- - -

Solution

Example 1.3.3: - -

- - - - --
- -

78

[q0]

[q0,q3]

[q0,q3,q4]

79

q1

- - - -

q0

- -

- - - -

Solution

q2

Z
Z

q3

Example 1.3.4: -

[q0,q1,q2 ]

[q0,q1]

- -
- -

~ - -

DFA and NFA

Theory of Automata, Formal Languages and Computation

[q2]

[q1]

a,b

[q3]

Z -
- R - -
m KK
- - - X X K K X
m KK
- - - o o K K o
- - -
- - -- - - -

-- - - -

- - - -
- - -
- - -

1.4.1 Regular Languages

1.4 REGULAR EXPRESSION

- - -

[q0]

- - - - --
- - - -

80

81

- -

- - -
- -
- - KK -

- -
- - KK -

--

1.4.3 Building Regular Expressions

R LL

-- -
-- -
-- -
-- -
I -- -

--- - - -
- - -
- - - -- --
- -- - I
-- - - - R
- Z - I
-

1.4.2 Regular Expressions

Z -
- -
- -
o - - -
X -
--
- -

DFA and NFA

Theory of Automata, Formal Languages and Computation

NFA for

-- - -
-

NFA for x

-- -
- - - - - - --

1.4.5 Regular Expressions to NFA

--

--

- - - ---
-

1.4.4 Languages defined by Regular Expressions

- - - - -

- - - -
-

- - -
-

- - - -

82

83

M(r1)

NFA for r1r2

M(r2)

NFA for r1 + r2

M (r 2 )

M (r 1 )

M(r1)

- -
- --
- - -

- --- - - -

1.4.6 NFAs to Regular Expression

- - -
-- - -

- - -
- -- -
-

- -- --

NFA for Z

-- Z - Z - - -

DFA and NFA

- - - - -
--- - -
- -
- --
- -- -
-
-- -
--

Theory of Automata, Formal Languages and Computation

-- -

-- KK -

-- - --
-

Solution

- --
KK

Example 1.4.2: --- --

- G - - -- G
- KK -
- -
- -- --

Solution

G
KK

Example 1.4.1: - -- --

-- - - -
-

84

85

m m
KK
R
- - -
-- - -

--
-- -- - -

Example 1.4.5: ---

- - - - - - --
- - - -

-- -

Solution

Example 1.4.4: - - - --

-- -- -
- -

-- R
-
- - -

--

KK

m m - --

Solution

Example 1.4.3: --- -

DFA and NFA

Theory of Automata, Formal Languages and Computation

-- - -
-- - - - -

-- - -
--

-
--

-
-

-- - -

-- --
- - -
-- -

-- -
- -

--
-- - -
- - - -

Solution

86

87

Example 1.4.8: --- -

Solution

--

Example 1.4.7: --


- -- - - -

- - - - - - -
-
-- -


- - - -
-
-- -

Solution

- -

Example 1.4.6: ---

-- - - -

- - -
-

DFA and NFA

dd

- -
- -
-
- -
-- - -

-- -- -- - -
- - - -
- - -

1.5 TWO-WAY FINITE AUTOMATA

-- -

-- R -

-- m R -

-- m m m -

DFA and NFA

89

- -
- - - - --
- - - - -
- - - -

1.6.2 Mealey Machine

- --- -
-- -
--- - -
--- - -
- - - -
- -
- --

1.6.1 Definition

1.6 FINITE AUTOMATA WITH OUTPUT

- - - - - - -

- - - - - -
- -

-- R X

- R
- R

- --

- R - - -
R - -
R - - g

l X r l - -

- - - - -
- Q
- Q

Definition

m m m

m R

Theory of Automata, Formal Languages and Computation

Solution:

88

q2

q0

1,1

1,0

0,0

0,0

0,1

0,1

q3

q1

1,0

- -- -
- - - -

Solution

- --

- -

Example 1.6.1: - - - --

- - -
- --

- - - -
-

1.6.3 Moore Machine

-
- -
- - - - - --- --
- l

- - - -
- - - - - -
- - - - - - - -
- -

1.7.1 Closure

- - -

1.7 PROPERTIES OF REGULAR SETS (LANGUAGES)

- --
--

Solution

Example 1.6.2: - -

- - - -
- - -

91

DFA and NFA

Theory of Automata, Formal Languages and Computation

90

X --
Y --
-- - -
-
-- -
--
--
-- -

- - -

Theory of Automata, Formal Languages and Computation

- - - - - - -
-

- - - -
- - - -
- - --
-
- - - - --
- - - -
- - - -

1.7.3 Intersection and Set Difference

- - -
--

Concatenation of L1 and L2

- -
- - -
- --

Union of L1 and L2

-

- -
- - -
-

- - -

1.7.2 Union, Concatenation, Negation, Kleene Star, Reverse

- - - - - -
- -

92

93

i -
i - - -- -
i - - -- -

1.8.1 Principle of Pumping Lemma

1.8 PUMPING LEMMA

- - - - - -

Set Difference

- -
- -

- -

Intersection

- - - - - -
- - -- -

- -
- -
-

Reverse of L1

- - - -
-
- -
- --
- - -
--

Kleene star of L1


- -

Negation of L1

- - - -
- - -
- - - -

DFA and NFA

i -
-
i - -
-

Theory of Automata, Formal Languages and Computation

- -- -
- - -
--- -

Solution

Example 1.8.1: m -


- R - -
-
- - - -
-
- - -

- - -

- --

- - dd

- -- - -
- - R - - -
-

Definition of Pumping Lemma

1.8.2 Applying the Pumping Lemma

-- -
- - -
- - -

- -
- - -
-

- - -
- - -
- - -

94

95

-- -
- - -
- - - -
- --- -
- - }
- - -
-

-
-
- -

Solution

Example 1.8.3: - -

-- -
- - -
--- - - - -

- -
} - -- -

- - - -
- - - -
- - - - -
- - -
- -

Solution

Example 1.8.2: m -

- - }
- -- -
- - - -
- - - - - - -

DFA and NFA

Theory of Automata, Formal Languages and Computation

4 R
3
2 R

X X - - X
X
- R

R - -
--
- - -
g Z -

- -

-
S -
- - -
--
- -

THEOREM 2: - S - - -

- - R - R--
- -
-- - - --
R--
X -
X - -

- -- Y Z
- R-- - -

R R
-

- --
-

-- - - -- -

THEOREM 1: X -

1.9 CLOSURE PROPERTIES OF REGULAR LANGUAGES

96

97

Y X

- - - f -
- - -

f E $ - $ -

S - -
-- --
- f

Myhill-Nerode Relations

- - -

- -
R R
R R

- - -
- - -
r -

Isomorphism

1.10.1 Myhill-Nerode Relations

1.10 MYHILL-NERODE THEOREM

X -
Y -

THEOREM 3: - - Y -- -

- R ~ R Q
~

- ~

- -
-

DFA and NFA

- -- f - -

Theory of Automata, Formal Languages and Computation

f B f

- - f --- g f -

Solution

m -

Example 1.10.1: -

- - -

-
--
f -

S --

1.10.2 Myhill-Nerode Theorem

f -
--- - -

- -

R $ -

- - --
- - - - --

$ - $ - - - -
-

f B R E R

- R

$ - $ -
$ - --
$ -

-- f

- R R

98

99


-
-
-
--
-

-
-

---

- ---

REVIEW QUESTIONS

-
- -- - -
-
-
- -
- -
-- - -
-
- -

- - -
-
- -
- -
- -

GLOSSARY

m
-
- -

R Q f --- -

DFA and NFA

Theory of Automata, Formal Languages and Computation

- -- -
- -

- - - - --
-- -
-- -- - -

g
- -- -
--

EXERCISES

- ---
-
--




- -
-
- --


- - -
- --
-

100

0
q2

q1

0
1
q4

q3
0,1

101

a
b

a
b

b
a

-- -


- -

q0

- -

DFA and NFA

Theory of Automata, Formal Languages and Computation

1,0

s0

1,0

s3

0,0

0,0

0,0

1,1

s4

1,0

s2

Start

s2

s0

1,1

0,0

0,0

1,1

0,0

s3

0,0

s1

1,0

1,1

- -
-- -- - -
--- - - - - - - -
- - - -
- -

Start

s1

- - - -
-

- - - -
-

102

Start
s0

1,0

1,1
s2

0,0

s1

0,1

1,0

103

s0
1

s2 0

0
s1 1


- - -
- - - - - -
- -
- -
-

-
-- -

Start

- -
-


- - - - -
- - -
- - - -
- - - - - -

- - -
- - -
- - -
KK - - - - KK -
- - KK

0,0

DFA and NFA

Start

Start

Start

s0

s0

s0

s1

s1

s1

0,1

0,1

s3

s3

0,1

s0

s2

s4

0,1

s3

- - - -
-
-

Start

s1

- - - -

- -

- -

- - -

0,1

- -

0,1

s2

s2

Theory of Automata, Formal Languages and Computation

- -

104

Start

Start

s0

s0

s0

0,1

s1
0

0
0

s1

s1

s2

s2

s2

0,1

Start

s0

s1

1
0

s2

0,1

s3

105



- - - -
-- - -
-- -- -
---


X
X

- - - X

KK

DFA and NFA

s0

s2

s1

a,b

--- ---
- -

m - - -

- - -

-- X

-- X

- KK --- - -
-
-- -- - --
- -- -
- -- --
-
- - - - --
-- - -
- -
- - -
- - - -

-

Start

q0
b

a
q1

a,b
s0

s0

a,b

s1

s1

s2

s2

s3

s3
a,b

q0

0
q1

q2

--- ---
- --
- --
- --
--

-
--

R - -
- -

R -

- -
- - -
- - -
-- --
---



--

- -
- -

107

DFA and NFA

Theory of Automata, Formal Languages and Computation

106

q0

q0

q0

q0

q1

q1

q1

q1

q2

q2

q2

q2

Theory of Automata, Formal Languages and Computation

-
- - -
- - - -

-
-

SHORT QUESTIONS AND ANSWERS

- -
---


R
-- --

108

109

R - -
S - - --
- - -

- - -
-
- -
- - - - - --
- - -

- -
- - - --
l X r

- --
- --
l r -
R -
S --
-
- -
- - -
-

- -

-
-
- - - -- - - -
-
-
- - - -- - - -

-
- -

DFA and NFA

Theory of Automata, Formal Languages and Computation

-- -
I -- -

-
- ---
-- - - - -
-
---
-- - --
- R - Z - I
-
--- -
I

Z -
- R - -
m KK
- - - X KK X
m KK
- - - o o KK o
- - -
- - -- - -
- -

- --
- -

-
- --
- - --
-
-
- - - -
- - -

-- - - -

- -
- -

110

111

- -
- Q
- Q
l X r l - -

- - --

Z

- -

-

- - -
-
-

-
- -- --
-
-
-

-

Z -
-
- X
R Z

- ---
Z

-- -
R

R LL

--

DFA and NFA

X -
Y -
-- -
-
--

-
- -
- -
- -
- -

- -

- - -
- --
- -
- - - -
- - -
- - - - - - - - -
- - -
X Y

- - -

-
- - - -

X -
-- - - --
-
- - Y --
- -

S --



- -

- m
-
-
m

- --

- - KK

-- -
- -
- - -
-
- - - -
-

- -- - -
- - R - -
- -


-
- - -- - - -- - -
-
- -
-
- - -

- R - - -
R - -
R - - g
-
-
- - - - - - - - - - - -
- -
- - - - - -

113

DFA and NFA

Theory of Automata, Formal Languages and Computation

112

Theory of Automata, Formal Languages and Computation

-
-

--
f -
-
- -- - - -

- --
- - -
- --

114

- -

X r X

2.1.3 Right-Linear Grammar

-- - -- - --
- -- - --

- - -- - -

r
r
rR


- - -

2.1.2 Example of CFG

-- - - r -
- - B

- - - - - - - - -
- -
R - -

2.1.1 Definition of CFG

2.1 INTRODUCTION

Context-Free Grammars

Ch ap te r 2

Theory of Automata, Formal Languages and Computation

A r xyzB

ArB

Arx

- - -- - -
--- - -

- -

2.1.5 Left-Linear Grammar

B r 1C

B r 0S

A r 1S

A r 0C

S r 0A

S r 0B

Sr

- -
- -
-- -- - -

A r xB

- - - - - -

2.1.4 Right-Linear Grammars and NFAs

- - - -
--- - -
-

116

117

r
r
r
r

- R
- -
-

B B B B

Solution

Example 2.1.1: - -

-

-

r
r
r
r

- -
-
- -
-
-
-


- -
- -
- -
-
-
- - -

- -

2.1.6 Conversion of Left-linear Grammar into


Right-Linear Grammar

Context-free Grammars

Theory of Automata, Formal Languages and Computation

r
r
r
r

r
r
r
r

- -- -

r K K

-
- X
- -

- R -
KK -

-
- -

2.2.1 Definition of a Derivation Tree

- -
-- - - - --

2.2 DERIVATION TREES

Solution

m m

Example 2.1.2: - -

118

119

A
B

- - -

4 r $
3 r #
2
"

2.2.4 Right Most/Left Most/Mixed Derivation

-
X X - -

2.2.3 Partial Derivation Tree

- -
- - -

B B B B

- r r r r
- - -

2.2.2 Sentential Form

Context-free Grammars

Theory of Automata, Formal Languages and Computation

r
r
r
r

B r B B B

- - -

Example 2.2.1: - -

- -- -

- --

120

S
B

a
b

(d) B r bB

(b) A r Bba

a
b

S
a

- -

B
c

(c) B r c

B B B B
B -
B
B

- -

Solution

r
r
r

(e) B r c

Example 2.2.2: - -

(a) S r aAB

Solution

Context-free Grammars

121

Theory of Automata, Formal Languages and Computation

B
B
B
B
B
B
B

R
-

B B R

B R

Solution

41 r $1
3 r #
21 r "1

Example 2.2.4:

- - -

Solution

4 r $
3
#
2 r "

Example 2.2.3:

122

id

Solution

id

B id * id + id

id

r
r
r
r

id

id

id

B id + id) * id

KK
KK

Example 2.2.5:

B
B
B R
-
-

B B R

Context-free Grammars

123

Theory of Automata, Formal Languages and Computation

B B B B B -

S B SS
B aS
B aa

SBa

r
r
r

r
r
rR

r
r r
r

r
r
rR

BR
B B
B - B B
-
-

- -

Solution

r
rR

r
r
rR

Example 2.2.7:

Solution

4 r $
3
#
2 r "

Example 2.2.6:

124

B B
B B B
B B B B B
-

m m

- -

Solution

4 r $
1 r 1
3
#
r
1
1
2 r "

Example 2.2.8:

BR
B
B
r
r
rR
r
r
r
r
r
r
r

Context-free Grammars

125

r
r
r
rR

r
rR
r

Solution

Example 2.2.10: -

- --

B B B B K K

B B

Solution

4 r $
1
1
3 r #
12 r 1"

Theory of Automata, Formal Languages and Computation

Example 2.2.9:

126

127

- - -
-
- - - - -
- - -

- --
- --

- -

2.3.1 Parsing

2.3 PARSING AND AMBIGUITY

B B B B B
B B B B

B B B B B
B B B B
B

Solution

- -
-

r
r
r
r
r
r
r
r

Example 2.2.11: -

r
r
r
r
rR

Context-free Grammars

Theory of Automata, Formal Languages and Computation

r - - -
- - - -

- - - -

r
r

- - -
-
- -
-
- - -
-

2.3.3 Topdown/Bottomup Parsing

- - - - - -
-- -
-- - --
- - - - --
- - -- - - - --
- - - - - - - -
-- -
- R - --
- - - - -
- - - --
- - -
-
- - --

2.3.2 Exhaustive Search Parsing

128

129

a
b

S
a

S
b

b
a

S
b a

S
b

- -
- - -
- -

B B B
B B B B B

- - - - -

B B B
B B B B B

- - - -

- -- - -
- - -
- - - -

2.3.4 Ambiguity

r - - -
- - - -

- - - - - -

Context-free Grammars

Theory of Automata, Formal Languages and Computation

131

b
S

(a)

b
S

S
a

S
b

(b)

S S

B
B
B

B
B

Q r
Q r

Q r
Q r

- - - R -

Solution

Example 2.3.2: r r - -

2.4.1 Simplification of CFG-Introduction

2.4 SIMPLIFICATION OF CFG

- - - -

Solution

- -

r
r

Example 2.3.3:

- -

- - -

--

Context-free Grammars

-- -
-- X - --
- -- - -
--
- -

- B
$1
- B B #

"1

r
r
r
r
r
r

- - - - - - -

Solution

- -

r
r
r

Example 2.3.1:

- - -
-- - - - - -
- -
- - - -- -
- -
- --


- R - - -
- -

- - - - -
- -

2.3.5 Ambiguous Grammars/Ambiguous Languages

130

Theory of Automata, Formal Languages and Computation

r
r

133

- --- - B

- - --- r -

- -

X - - - -

B - --

r
r
r

B B

- -
- -- -
- - -
- r
- -
- - - r - - -
- - -
- - -

(a) Empty Production Removal

- - B K -
-- -
- -
- - - -
- - - -
- - $

B R

-
- - -

- - - -- X

r KK X

- -
R -

- - -

$ $ $ $ - --- -
-

THEOREM: --

Context-free Grammars


R - - - - - R
-

r - - -
- - -
- -
-

2.4.2 Abolishing Useless Productions

r - - - -- -
- - - - -- -
- - -

Substitution Rule

r L

- - - - -
$ $ $ - -

r LL

-- -

132

Theory of Automata, Formal Languages and Computation

- - -

- -

Procedure to remove the unit productions:

R -
- - -- -
- - - -
- --
$ $ $ $ - - -

- -

(b) Unit Productions Removal

- - - - -

$
r -

- $ - - - --
-

R X

r KK m

KK
$ - - -

r KK

- r
-- -
-

Procedure to find CFG without -Productions

--
$ -

134

135

r
r

r
r

B B B

$ -
- - -

r
r

- $ -

Solution

$ - $ -

Example 2.4.1:

R X
- - - - -

- -
-

- - -

(c) Left Recursion Removal

r KK - - - $

r KK

- r B -
$ - $

-

-- B $

Context-free Grammars

B B $

Theory of Automata, Formal Languages and Computation

r
r
r
r
r

--- -- -

r
r
r
r

Example 2.4.3:

- - -
-
r - r -

r
r
r

$ ~

~ - -

B B B

- - -

Solution

$

--- - -

Example 2.4.2: -

- $

136

137

r
r
-

Solution

- - -

r
r

Example 2.4.4:

r
r

$ $ $ $ $ $

- - -

- - - ---

- -
-
- -

r
r
r

- - -
-
r r - - - -
- - - - B B
- - - - - - r
- - - - - -

Solution

Context-free Grammars

r r r r

r
r
r
r
r

r
r
r
r
r
r

Example 2.4.6: -

- - - ~
-

-
-

Solution

Example 2.4.5:

- - - -
m

r
r

- - --
-

Theory of Automata, Formal Languages and Computation

138

139

r
r
r
r
r
r

$ $

r
r
r
r

- -

r
r

Solution

r
r
r
r
r

Example 2.4.7:

$
B B r r
- - $

r r r $ -
-

$
B r - r

Solution

Context-free Grammars

Theory of Automata, Formal Languages and Computation

r
r
r

r
r
r

r
r
r

- $

r
r
r

- - -

- -

- - -

Solution

Example 2.4.8:

r
r
r

140

r
r

141

r -

r -

- - - - -
- - r -
--
r -

Solution

- $

r
r
r

Example 2.4.10:

- $

r
r

- - -- -
-
- r -

Solution

--- --

r
r

Example 2.4.9:

Context-free Grammars

~ - - -

- -

r KK

- - - -
-- - -- -


--- -- -

- -
- -

- - -
-

Procedure to find Equivalent Grammar in CNF

-
- - r r
R R

2.5.1 Chomsky Normal Form (CNF)

- - -
-

2.5 NORMAL FORMS

r
r
r

r
r

r
r
r

r
r

- -
- -

Solution

-
r
r
r

Example 2.5.1: -

~ -
- - -

r
r
LL L L
LL L L
r

- - m
r -
r KK - -

- - r KK

r ~ - - ~ -

- ~ ~ -
~ - - -

- - $
-

143

Context-free Grammars

Theory of Automata, Formal Languages and Computation

142

r
r
r

-- - -

r
r
r
r
r
r
r

~ - -

Theory of Automata, Formal Languages and Computation

r
r
r

Example 2.5.2: -

r
r
r
r
r
r
r
r
r

- -
-

144

145

r
r

r
r
r
r

- - -
-

r
r
r
r

-- - -

~
r
r

- - - ~
r
r
r
r
r
r

r
r

r
r

- - -
-
- -

Solution

Context-free Grammars

r
r

- ~
r
r
r
r
r
r

r r r

- -

Solution

Example 2.5.3:

r
r
r
r

147

r
r

- -
-

Solution

Example 2.5.4: - r

r
r
r
r
r
r
r
r
r
r
r
r

- -

r
r
r

r
r

r r r


-- -
- -
r

Context-free Grammars

Theory of Automata, Formal Languages and Computation

146

r
r
r
r
r

- -
-

r
r

r
r
r
r

- ~

r
r

Theory of Automata, Formal Languages and Computation

R R

- -
-

-- --
-- - -
-- - -
- - - - - -- -
- -

2.5.2 Greibach Normal Form

148

149

r
r
r
r




- - -
-
-

- - -
-

REVIEW QUESTIONS

- -
- - -
- - -
- - - - --
- - - -
- - -
---
r
R -
- - -
- r r
R R

GLOSSARY

- -
- -
- -

Context-free Grammars

EXERCISES


- -
-
-
- -
-

- - -
-- -
-
- -
-
-
--
- ---

-

-
- -
-


- -

Theory of Automata, Formal Languages and Computation

- -
- - -
-- - - -
-
- -
- -
- -- - - -
m
-
- - r

150

151

r
r
r
r

B -
-

r
r


-

- - r r r r r
r r r
r r r
r r r r
- - -
- r r r r r
- -



-

- - -
-
-

r r
- m
- -
- - -
--

r r r -

Context-free Grammars

Theory of Automata, Formal Languages and Computation

q5

q3

q4

r
r

r
r
r
r
r

--- -



r
r
r
r
r
r
r

- -
-

- - - --
-
- r - -

- -
-

-

q0

aba

-
r r r

152
r
r
r

153


-
- - - - - -
- - -
- - -
R - -

SHORT-QUESTIONS AND ANSWERS

- - -
-
m m

r
r R

-
R - -
R -

r
r
r

-
r
r
r
r
r -
-

r
r
r

Context-free Grammars

Theory of Automata, Formal Languages and Computation

r
r

r
r

-
-
- - -
-
- -
-- -
- - - --
-
- - -
- r r r
r - - - -
r r
r r

-
-
- -

- - -- - -
-
- -

r
r
rR

-- - - r -
- - B

- - -

154

155

--
r
- - - - - - - - - - --
-

r r - -

- -

r r - -

-
-
X X - -
-
- - - - -
- -
- - - -
- -
- - - -- - -
- - - -
- ---
- - --
-
r R
- - -
- - - -- - - - -
-
- R - -
-
- -
- -
- -- -
-
- - -
- -

Context-free Grammars

Theory of Automata, Formal Languages and Computation

KK

r KK

- -- -
r
-- -

-

-
- -

- B r - --

- ---
- --- r - - ---

r - -
- - -
- -

r
r
r

X - - - -

---
-
r
r

B B

-
R - - -
- - R -

156

157

- - - -
-
- -
-

- -
- -
-

-
-
- r r R
R
--

R X

r KK - - - $

-
- - -

r KK

B - -
$ -

$ -

-- B $

- - -
- r

R -
-
- -

Context-free Grammars

Theory of Automata, Formal Languages and Computation

R R

-- --
- --
-- - -
-
- - -

158

- --

- --

3.1.1 Nondeterministic PDA (Definition)

- --
- - --
- -- m - -

- - -

- - - -
- -
- - -

- - - - - -
- m - - -
m - --
-

- - - -
- - - -
-- - -

- - -

3.1 DEFINITIONS

Pushdown Automata

Ch ap te r 3

l X l r --- l -
-
- R
- -
S --

Theory of Automata, Formal Languages and Computation

-
- - - -
-

Pushdown Store

- - - - -
- - - - - - - -
- -

-
-

- -
- - - -

l X l r - -- l

- -

3.1.2 Transition Functions for NPDA

Finite State
Control

Input File

- - -
- -- - - m - -
- - - -
- - --
- - -

- -
- - -
- - - -

160

161

- - --
-
- -
R R R
- -

3.1.3 Drawing NPDAs

- - -
- - R -- - -- R
- - - -
- - - -

- - -
- -
- - -
-

- - - -
- - - -

- - - -

-
- - - - - -

- -- - - - --
- -
- - -
- - - - - --
- -- - -

Pushdown Automata

q3

a/0,

/0,

a/0,10

q2

b/1,

q1

b/1,


- -
- --
- - -

163

--

3.1.5 Accepting Strings with an NPDA

- - - - -
- -
- - - - - - - -

- --
K - --

-
-
- - - - -
- -

- -- - - -
- -





- -





3.1.6 An Example of NPDA Execution

-- - -

Instantaneous Description of a PDA

-
- - -
- -
- - - -
- - -

KK

- -
-- - -
- - - - -
-

KK

-- - - - -
-

- -- - -
- - -
- -

- -- --

Pushdown Automata

- -

- -
-

-- - - - -
- -

3.1.4 Execution of NPDA

- - - - -
- - - -

/0,

q0

a/1,11

Theory of Automata, Formal Languages and Computation

- - - -

162

m -

Example 3.1.2: - m

- R

- - - - -
- - - - - - - -
-
- - -

~ ~ ~ ~ ~
-

-
~ ~ ~ ~
-
~ ~ ~

THEOREM: - -

Solution

Example 3.1.4: - m

- - - -

m - -

Solution

Solution

m -
-

Example 3.1.3: m

Example 3.1.1: - -

R R R

- - - -

- - - -

-
-

165

Solution

Pushdown Automata

- - -

Theory of Automata, Formal Languages and Computation

3.1.7 Accepting Strings with NPDA (Formal Version)

164

~ ~
~ ~





Theory of Automata, Formal Languages and Computation

- -
- --

3.2.1 Simplifying CFGs

3.2 RELATIONSHIP BETWEEN PDA AND CONTEXT FREE


LANGUAGES


- -
r $
1
r #
r 1"
- -

-


~ ~ ~ ~ ~
~ ~ ~ ~
-
~ ~ ~


~

Solution

-
-
-

Example 3.1.5:

166
Empty Production Removal

167

Unit Production Removal

Left Recursion Removal

Chomsky Normal Form

r
r

Greibach Normal Form (GNF)

- -
- -

3.2.3 CFG to NPDA

- R
-
- -

- - -

- -

(b)

- -
- -

- - -

(a)

3.2.2 Normal Forms of Context-Free Grammars

R X - - - -
-
- - -

- - -

(c)

- r

(b)

- - -
r
- -
- - - - r - -
- - -

(a)

Pushdown Automata

Theory of Automata, Formal Languages and Computation

- -
- - -
- -- -

-

-- -

- - - - - -
- - -
- -
-

- -

KK

- - -
- -
--

{(q1, AB )}

a AB

169

-
- - -
- -- - -
- -- -
-

3.2.4 NPDA to CFG

- - -

B B B B

Pushdown Automata

(q1,a,S)

- - - -
-

r r r r r r

- -
- -
- - -

- - - - - - -
- - - -

- --
- - -
-- -

- -- -
- -

- - - -
- - - -- - -
-- -
- -

168

Theory of Automata, Formal Languages and Computation

-
}
m
R

- - - --
-- - -
- ---
- - --
- -- --
-
- - -
- - - -

3.3.1 Pumping Lemma for CFG

3.3 PROPERTIES OF CONTEXT FREE LANGUAGES

- -
- - --
-

- - - -

R R X
R
--
- - - --
g Z Z R

- - - -
-

- - -

--

- - -
-

3.2.5 Deterministic Pushdown Automata

-- - - --

170

171

- - -
- -

3.3.3 Proof of Pumping Lemma

r K
rK K
rK K
rK K

- -- R X
- - -

- -

- -
-

- - - -
- -

- - -
-
- - -
-

- - - - - -

3.3.2 Definitions

- - - ---
- - - -
-
- -

--

-- - -
- - - - -

- -

Pushdown Automata

- -
--
-
- - -

Theory of Automata, Formal Languages and Computation

- - --

- -- --

--

B B B

- - -

B B

- - - - - -
-

- - -
- - -
- - -
- - - - -

-
- -
-- - - - -
-
- - -
- - - - - -
- - - - - -
- - - - -
- - - -
- -
- - - - -
-
-- - - -

172

173

- -
- - - -
-

-

- - -
- - - -
- - - - - -
- - -
- - -


- - -

- R - }

- -

- - -

- -

3.3.4 Usage of Pumping Lemma

- - B B
-- - - -
- - -

- B -

- B -- - -
- -
- - - - - - - - - - -
-
- -
- - - --

- - - -

Pushdown Automata

Theory of Automata, Formal Languages and Computation

m g

Example 3.3.3:

- -
- - -
- ~ ~ -
- --
R ~ R Q
~ -

R - -

--

-
g Z - -


- -

-
- -

- -

Example 3.3.2: - S - -

- } }
--
-- - - - -- -

- -
Q - -

Solution

} }

Example 3.3.1:

-- - - -
-

174

175

- } } -

- --

Solution

m -

Example 3.3.5:

- -
- -

Y m

- --

Example 3.3.4:

m g

- -
Y -
- - -
- -

m Y

- - -
- -

- --

Pushdown Automata

KK R
m
KK

a1a2 .... aj

qi = qk

qm

KK

ak+1, .... am

q0

aj+1, .... ak

KK KK
- - -


g } KK
- -- }

m -- -- KK
- --
- } -
- -- - - -
-

- --
--

-- - - - -
- m - - } m m R

THEOREM: - -

3.4 DECISION ALGORITHMS

m -

Q -

m

-

Theory of Automata, Formal Languages and Computation

176

} }

177

- -

Example 3.4.2:

- - - -

- -- - -

- X

- --

Example 3.4.1: --

- -
- - -- } } -
- - - - - - -

- Z
- - -- -- - - -- - Z - -

- - --

- - - --

- - -
}

- -

THEOREM: - -- - -

- -- R m
KK

Pushdown Automata

Theory of Automata, Formal Languages and Computation

-- - - -- -
- - - - --
- - -
- -

Table: Transition Table for DPDA.

- - -- - - --

Solution

- --

Example 3.4.3: - - -

179

- --- l

l X l

- -
-
-

GLOSSARY

-- - -
- Q

- - - - - R
- - -
-

- - - -

Pushdown Automata

- - R m

- -- - --
- -

Solution

178

Theory of Automata, Formal Languages and Computation

-
- -
-
-- -
--
- - -
- -- -
- -

- -


- -
- -


-
- -
--- - -

REVIEW QUESTIONS

-
-
- -

-
- - - - -
- --
- - --
-- - -
- -
--

-
-
-

180

181

- -
-

r r r r

- - -
-

- -
-- -

-- -
R

- R -

-
-
-
- R -

m -

m -

- m -

} }

} }

g
- - -

- -
R

- - -

m

m X m

- -

EXERCISES

Pushdown Automata

Theory of Automata, Formal Languages and Computation

-
- - - -

-

SHORT QUESTIONS AND ANSWERS

m -

- -- - - - -
- - -
- -

- - -
- - - - -
- -

R }

-
- R
- - -- - - -

} } }

- m X m - - - -
- - m -

- -

- m m -

m m

- -

182

183

-
- - -

- -
--
- - - -
- - - -

-
-
- - - - -
- -
- - --

-
-
-
- - - - -

- -
-
-- -
-- - -

- --

- -- -
l X l r --- l - -
- R
- -
S r --
- - - -
- - -
- -
l X l r --- l -
-
-
-
- -
-

Pushdown Automata

Theory of Automata, Formal Languages and Computation

-

-
- - - - - -
- - -- - -
-- -
- -

- - - -- -
- -
- - -
- -
- - -

--
- - -
- -

R X - - -
- - -
- -
- -

-
- - -
r
- -
- - r - -
- - -
-
- r -

- -
- - -

- - -

- - - -

- --
- - -

184

185

-
- - -

- -
- -- - - - - - -
- - -
} }
- -
- - -
--
- -


-
-
-

- - - -


R R X R
--
- - - --
g Z Z R
-
- -
- - - - -

-
}
m
R -

Pushdown Automata

- - - - - --
- - --
- -

4.1.2 Definition of Turing Machines

--- - -
- - -
-- -
- - -- -
-
- --
-- - ----
- - - - -
-- -- -
- -

-
-

- - -
- -
- -- - - -
- - -
--- -- -- - -
-
- -
-

4.1.1 What is a Turing Machine?

4.1 TURING MACHINE MODEL

Turing Machines

Ch ap te r 4

187

--

-- -
-- -- - -

- -- - -
- - -

KK KK

- - - -

- -
-
-

-- -
-

- - - -
- - - - -
- - - -

l r l l

- -

4.1.3 Transition Function, Instantaneous Description


and Moves

- --- --
-

- - - --
- - --
-- -

- -
- --

R - -
R - -
S - - --

Turing Machines

Theory of Automata, Formal Languages and Computation

- -
- - -- - -

- --

4.1.6 How to Recognize a Language

-
- -

-- -- -
- - -
- - - -
- -

R - R R

- - - -
- - - - - -
-

4.1.5 Turing Machines as Acceptors

- - -
- - -
- - - - - -- -
-- - - -
-
- -

- - - -

- - -
-- - --
- - - -

4.1.4 Programming a Turing Machine

188

189

- -

- - -
-
- -
- -- R

4.1.7 Turing Machines as Transducers

-
- - -

- - m

q0: move all the way to the left


q1: erase on a
q2: move all the way to the right
q3: Erase a b
Repeat

- - -

- - - -

Turing Machines

Theory of Automata, Formal Languages and Computation

- - - - -
- - -
- - - -
-
-- -

Solution

--

Example 4.1.2:
- -

- -- -- -
-- - - -- - -
-- -
- - - -
- - - -
- - - - - - -
- --
-- - - - - -

Solution

Example 4.1.1: - - -

- --
-

190

191

q0: Move all the way to the left


q1: Erase an a.

- - -

- - - -

-- - -
- - -- - -

Solution

Example 4.1.3: - -

- - -
- - -
-


o o

- - -

Turing Machines

Theory of Automata, Formal Languages and Computation

...

...

...

...

...

...
...

...

- -
-- - - -
- - - - -

4.2 COMPLETE LANGUAGES AND FUNCTIONS

- -
-
- -
-

Solution


-
- -- -
-

Example 4.1.5: -

- - -
- - - - - -
- -
- - - ---
- - -

Solution

-
- -

Example 4.1.4: - -

- -
- - -

- - m

q2: Move all the way to the right


q3: Erase a b.
Repeat

192

193

--

Solution

Example 4.2.2: - - -- -

-- - -
- - - - -
- - - -
-

- -

- -
- - -

-- - - - - -
- - -
-

Solution

Example 4.2.1: - -

KK - - -
- KK
- - -
- - -
KK

- - KK -
- K - -

- - KK
KK -

Turing Machines


-


-- -

Theory of Automata, Formal Languages and Computation

0 1 1 ......... 1 0 1 1 1 0 1 1 1

- -
- - - - -

Solution

-- - - -
F F

Example 4.2.4: - - -

-- - -
- -

- -

-- - -
- - -
- - -
- --
--

0 0 1 1 1 0 1 1 1

Solution

Example 4.2.3: - - -

- -

- -

194

195

- -
-

- - -
-- - -
- -

4.3.1 N-Track Turing Machine

- -
-

- -
-- - -
-- - -
-- - -
- -- - --

-
-

4.3 MODIFICATION OF TURING MACHINES

- - - - -
- - - - -
-
- - -
- - -

-
- - - - - - -
- - -
-- - - -
- - -
-
- - - -

-- - -
- - - - -
- - - - -
- - -
-

Turing Machines

Theory of Automata, Formal Languages and Computation

-
- - - - -
- - -

-
r -
r -

4.4 CHURCHTURINGS THESIS

- - - -- -
- -

- -

- -
-
- - ---
--

- - -
-
-- --
- -- -

4.3.3 Multidimensional/Two-state Turing Machine

- -
-

-
-
- -
-
- - -
- - -
-
-
- -
-
-
-
- -
-

4.3.2 Semi-infinite tape/Offline/Multitape/ND Turing Machines

196
r - r -
r --

197

b
b
b
b

- - -- - - - -
- - - - -
-

-- -

4.4.2 Recursive and Recursively Enumerable Language


q
q
q
q

- -- - -

-- -
- -

4.4.1 Counting

- - -- --
- -

- --
-

- --

--

Turing Machines

4.5.1 Halting Problem

w: Z; N: 0;
for i: 1 0 do {
add the next string in * to set W;
initialize a Turing machine for this new string;
for each string in set W do {
let the Turing machine for it make one more;
if the Turing machine halts {
accept or reject the string as appro priate;
if the string is accepted {
N: = N + 1;

- - - - - --
- - - - -
--
- - -
- - - - -
- - -
- -
- - -- --
-
- -
-- - --
- - -- -

- - - --
- -- - -- - -
-
- - - ---
- - -
- - - - - - - -

4.5 UNDECIDABILITY

- - - -
- - - --
- - -- - - -
-- -- -- - - - -- --
- - -- -- -- -
- - -
- - -- -
- -
-
- - -
-- - - -
- - - - -

Languages

4.4.3 Enumerating Strings in a Language

Recursive
Languages

- - - - -
- - - -
- - -
-

Enumerable

4.4.4 Non-recursively Enumerable Languages

199

- -- - --
- - -
- - - -- -
- - - - -
- - - --- -
--- - - -

--
-
- -- -
-- -

Recursively

let this be string N of the lan guage;


}
remove the string from set W;

- - --
- - - --
-
-
}

Turing Machines

Theory of Automata, Formal Languages and Computation

198

Theory of Automata, Formal Languages and Computation

Start

Yes

Will this
program
halt?

Halt

- - -
- - - - --

Function Impos sible:


return LoopIfHaltsOnItself (LoopIfHaltsOnItself):

- -

Function LoopIfHaltsOnItself ( M):


return LoopIfHalts ( M, M):

-
-
- - - - -

Function LoopIfHalts ( M, w):


if WillHalt (M, w) then
while true do { }
else
return false;

- -
-
-
-
- -

THEOREM: - -

-
-

-
- - -
- -
- - - - - - -

200

Programming

201

Artificial Intelligence (AI)

- - -
- -

State Entry Problem

--
-
- -
-


--

4.5.3 Reduction to Halting Problem

- - - - - - - -- - --
- -
-- - --
- - -- - -

-
- - - -

- - - -
-- - - - -

(b)

- -
-
-

- -
-
- - -- - - - -
- - -

-- -
- - - - - -
- - --
- - - -

(a)

4.5.2 Implications of Halting Problem

Turing Machines

- -
-
-
- - -
- -

KK
KK

-- - - -
-

Solution

- - -

Example 4.5.1: - - -

- - - -- -
- -

-
- - -

KK KK

- - - - KK - m

-- - -

-- --

4.5.4 Posts Correspondence Problem

- - - -
- - -
- - -

- -

GLOSSARY

-- -
- - G -
- - ~ - -
~ -
~ - - - - - - - - G ~ -
- - - G
~ - - -
- - - - -
- - - ~
- -
--
-- --
- -- ~ - -- -
-- - G
-- - - G
~ -
- G ~ - --
Z - --

- - -
-- - - -
- - --
- - - -

- - -

- - -

THEOREM: - - - -- -

- - - -

- - -
- -- -

4.6 RICES THEOREM

- - - - - -
- -
- -- -- - - --
- - - - -
- - -
- -- -- -
- - - -

203

Turing Machines

Theory of Automata, Formal Languages and Computation

202

Theory of Automata, Formal Languages and Computation

-
- -

-
-- -

-

- -

REVIEW QUESTIONS

- - -
- l r l l
-
-
-
-- -- -
- - -
-
- - - -
-
- -
- -
--
-

- - -
- -
- -

- -
- --- --
--
-
--

- - --
- - - --

204

EXERCISES


- - - --




- -
-

--
- - --
- -
--
- -


- -
-
-- -

205

R

- - -
- -
-- r

- -
- --
R

- -
l m
- -
m

m
-
R

- - --
-- - - - -

Turing Machines

l r - 7 '
r - 7 '

Theory of Automata, Formal Languages and Computation

-
- - -
- -

SHORT QUESTIONS AND ANSWERS

--- - - -

- -
-- -

- - - --
-
- - - --

- --
- - - - -
- --
- -- - -
- --
- - -

R


- -
-
- -
-
- - m

- -

- - - m

- -
-
R

206

207

- - - -
- - - -
- - - - -

- -- -

-
- -
-
-
- --
- -- - -- -- -
-
-
-
- - - -
-- -
-
- -
- - - -

l r l l - -

- - - - - --
- - --
- -
R - -
R - -
S - - - -

- -
-
- -
-
-

-

Turing Machines

- -
- --
-
-
- -

-- -
-- - -

- -

- -
-
- -
-
-
- -
-- - -

- -
-
- -
-
-
- - -

-
- -
-
- -
- - -
-
- --

KK
KK

KK KK

-- - -
- - - - K - m

- --

- - -
--
- - --

- - - --
- - -
- - --
- - -
--
- -- -
--
--

- - -
-
- -
- -
- -- R

209

Turing Machines

Theory of Automata, Formal Languages and Computation

208

- - - --

Solution

--

Example 5.1.1: m -

R X }
- - - - - -
- - - - -
- - -
- - - -
- -- -- --
- X

-- - - -

R R X
-- - - r

-- - - -

-- - --

5.1 CONTEXT SENSITIVE GRAMMARS AND LANGUAGES

Chomsky Hierarchy

Ch ap te r 5

r
r
r
r
r

211

THEOREM (II): -- -- -

- r
- -- r

-

THEOREM (I): - --

5.3 RELATIONSHIP OF OTHER GRAMMARS


-
--

THEOREM (II):

-
--

THEOREM (I): -- --

- -
- - - -- - - - --

5.2 LINEAR BOUNDED AUTOMATA

- -- - - - --

B B B
B B B
B B
B B
B

- - - -

Chomsky Hierarchy

Theory of Automata, Formal Languages and Computation

r
r
r

-
-

-
-

-- --

- - - - - - -- - -

5.4 THE CHOMSKY HIERARCHY

-- -
- -
- -
-- --
- - - -
- -

THEOREM (III): -- - -

r r
r r
r
r

m -
-
- - --

- - -

212

213

- -

-
-
-

THEOREM (II): - - -

THEOREM (I): - -

B - - - B

- B

-- -- g
- - - - - -
- - - - -

- - - -

5.6 UNRESTRICTED GRAMMAR

- ---
- - - -
- - -

- -

- -
-

--- - - -- -
-- - -
- -- - -
-- - ---

5.5 EXTENDING THE CHOMSKY HIERARCHY

Chomsky Hierarchy

Theory of Automata, Formal Languages and Computation

- - - -
- --



--
-

R R X
- - - - - - - -
--
- - - -

-- --

-- - - -

GLOSSARY

- - -
-
- - - -
- -- - -
- - - - -
- -
-
- - -

- - --

-- - -

- - - -

- - - -
-

-- - - -

5.7 RANDOM-ACCESS MACHINE

214

215

EXERCISES

--
--

- --
-- -- -

-- - -



-- -
- -
- -
-
--


-
--

- --
- -
- -
- --

- --

REVIEW QUESTIONS

- r
-- -- g - -

Chomsky Hierarchy

-
- - -
-- - - -
-
- - --

- -- -- -

- --
-
-- - -

-
- -- -
- -
- - --
- -- -- --
- X
--
m - --

R X }

--
-- - - -

R R X

- --
-- -
--
--
-- - - -

SHORT QUESTIONS AND ANSWERS

-- -- g
- - - -
- -- -
- - - -
- -



--

-
-
- -


-
- -
- --


- -


- - -

-
- - --


--
-
- -
- - - -

-- -- -
-- - -

217

Chomsky Hierarchy

Theory of Automata, Formal Languages and Computation

216

-- - -- - --
-- - --

- -- -- -- -- -- - --

- - -- -- - - - -
-
- - - -
-- -
- -- - - - -
-

Russels Paradox

-- - -- -
- --
-- - - -- -
- - -- - -
- --
- -
- - - -

-- -- - - --
- ---

-- - -- -
- -- --

-- - -- -- - -

6.1 FORMAL SYSTEMS

Computability

Ch ap te r 6

219

-- - - -
- - - - - - -

R - - -
- - -- --

- - -- -

- - -

- - -- - - -
- - - -
- - - --
- - -- - -- -
- - - -
-- - - - -
- -

6.3 PRIMITIVE RECURSIVE FUNCTIONS

- - - -- --
- - -
-- - - - -
-- -- - -- --
-

-- -- -
- - -
- - -- --
- - - --
--- -

6.2 RECURSIVE FUNCTION THEORY

- - -- -- - - - -- --
-- - - -- --
- --

Computability

Theory of Automata, Formal Languages and Computation

- - --- -

Example 6.3.3: -


-
-

Solution


-
-

Example 6.3.2: -


--
KK

Solution


--

Example 6.3.1: -

- - -
- ---
- -
- - - - -
-- --

- - -
- - - -
- --

220

221


- - -

- m

- -

Solution

- - - -
-

Example 6.3.5: -


-
-

Solution

- - -


-
-

Example 6.3.4: -

-
KK

Solution

Computability


- -

- -

Theory of Automata, Formal Languages and Computation


- -

223

-
- - -

Solution

- -


- -

- -

- -

- -

- - - - -
-

Example 6.4.1:

-- -
- - -
- - - - -

-
-

- - - -
- -
- -
-

- -- - -
- - -- -
- - ---
- - - - -

- - - -

--

Computability

- - -
- - - - -

KK KK
KK - KK KK KK

- - - -
- -
- - - -
-

- -
- - - -
-

- - - - -

- - - - -
- - - -

- - - -
- - -
- -

6.4 COMPOSITION AND RECURSION

222

Theory of Automata, Formal Languages and Computation

225

- -- -


-
-

-
-

- - -
- -
-

KK KK KK

-
- - -

- -

Example 6.4.5:

- - -

4
- 3
2

Solution

- -

4
- 3
2

Example 6.4.4: -

KK KK

- - -
- -


-- I ~ -

Solution

Example 6.4.3:

- - -
- - - -
- - - -
- - -
- -

Computability

- - - --
- - -
- -

Solution

Example 6.4.2: -

- -

Solution

Example:

224

Theory of Automata, Formal Languages and Computation

Solution

- -

4 g
3
2

Example 6.4.7: -

- - -
- - -

- - -

- - --- -- -
- - -- -

- - -

- - -
- --

Solution

Example 6.4.6: -

- -

- #"

-- -

Solution

226

227

4 g
3

- -

Example 6.4.9:

-- -- --

- -- - - -

4 g
3

--

Solution

- -

Example 6.4.8: --

- -
- - -

4 g
3

-- -

4 g
3
2

Computability

Theory of Automata, Formal Languages and Computation

- -

4 g
3
2

- -

Solution

- -

Example 6.4.11: - --

- - - -
- - -
-

4 m
- 3
2

- -

Solution

- -

4 m
- 3
2

Example 6.4.10:

- - -
- -

Solution

228

-

229

Solution

Example 6.5.1: --

-
- - - -

- - -

- - - -
- - - -
- - -

6.5 ACKERMANNS FUNCTION

- - -
- - - - - -
- -- - -

K LL

- -

4 g
3

-- -

Computability

Theory of Automata, Formal Languages and Computation



-

-
-

EXERCISES

---
-- -- --
---
- -
- - -
- -
- -
- -
-
- -

REVIEW QUESTIONS

-- --
-- -- -
- -- --
-- -- - -
--
--- - - -- -- - - - -

GLOSSARY



-

-





231

- - - - ---
-
- - - -
- ---
- - - - - - - -
-

Computability

-
-



-

-

-

-

230

Theory of Automata, Formal Languages and Computation

- --
- --
-- --
- -
-- --
-- --
- -- - -
--

SHORT QUESTIONS AND ANSWERS

- -
- -

- -
4
3
2 -

- -
- -




- -



-
- -
- -
- -
4 g
3
- -

- -
- - -

232

233

- - - -
- - -

- -
- - - -

- - -
- -
- -
- - -
- ---
-
- - - - -
- -
- - - - - -
-

- - - - -
-- --
- ---
- - -

- ---
- - -- -- -
- - - -
- - -
- -- -- -- -- -- - --
- -

--

-

Computability

Theory of Automata, Formal Languages and Computation

- - - -
- - -
- --
-- - -- - --
-

--

4 g
3
2


- -
-
-
-

- -




- -
4 g
3

- -

4
- 3
2

234

- - --
- -
- - - - - - -
--
- - - -
-
- -
--
- -- -
-

Order Statistic

-
- - --

- - - -
- - - -
-- - - -
- - -- - -
- - - --
- - - -
- - - --- -
- - - - - --
-

- - -
- - - - - -
- -
- - -

- --
-

7.1 INTRODUCTION

Complexity Theory

Ch ap te r 7

Theory of Automata, Formal Languages and Computation

LL

- - -
- -
- -
- - - - -
- - - - -
- - -- - - - -
- - -
- - - -- -
- -- - -
- -
- - - - -
- - - - - -
-- -- -
- - --

7.2 POLYNOMIAL-TIME ALGORITHMS

-- -

-- -

- - - -
- - - -
- - -
- -
- - - - -

-- - - - - - - - - - - -
- -
-

7.4 INTEGER BIN PACKING

- -
-
- - -
--- - -

-
-
- -
--

- - -

7.3 NON-DETERMINISTIC POLYNOMIAL TIME ALGORITHMS

Solution

237

- - - -
-

Complexity Theory

Example 7.1.2: -

:
*
} LL 9 LL )
8
(

} LL

KK
m

Solution

Example 7.1.1: L

236

- -- - -- - -
- -

Solution

- --

7.7 NP-COMPLETE PROBLEMS

Z G F G

Example 7.5.1:

-- -
-
-- - -
-

- -
- - -

- - - - -- - -
- - - -
- -

- - - - -
- - - -
- - -

- -- - -
- - - - - - - - - - - -
-

- -
- -
- -

7.6 ADDITIONAL NP PROBLEMS

- - -

Solution

- --

F G F G F G F

Example 7.5.2:

239

-- - --
- - - --
- -- - -
- --
- - -
-- - -
- - -
- - -
-- -- -- -
- - -- - -
-- --- -
- -

7.5 BOOLEAN SATISFIABILITY

i -
i - - - - - -

i - --

Z G F G
F
Z

- - -
-
- - -
- - - - -
- - - - - - - - -
- - -
-- - - - - -
- - -
- -
-
- -
- --

Complexity Theory

Theory of Automata, Formal Languages and Computation

238

Theory of Automata, Formal Languages and Computation

-

-
--

-
-

REVIEW QUESTIONS

-- -
- -
- - -

- -- - - - - -
- -
-
-
- -
- -
-
-
-
-
- -
--

GLOSSARY

- -
- - - - - -
-- -- - - - - - -- - - -

- - -
- - - - --
- - - -
- - -

240

241

- --

G F G

--- - - -

--- - - -

--

EXERCISES

- -


--
-- -
-- -
- -
-
--
-- -

- -
--- -


Complexity Theory

-
- -
- - -

-
- -
-
- -
- -
- - -

--- - -

r -
r -
r -
- -
-
-
- -
-
-
- -
--
- -

-
-
-
-- - - - - -
- - - - - -
- - -
- --
- -- - -- - -
- -

r -- -

r -- -

r -

--- - -

- -
- - - -
- - -
- -
-
- -

- - - -
- - -
- -
-

SHORT QUESTIONS AND ANSWERS

243

Complexity Theory

Theory of Automata, Formal Languages and Computation

--

-
- - -
- -
- - - -
- -
- -- -
- -
- - - -
- -
-- -
-
- -
- -
- --
- -
--
- -
- - - - -
- - --

242

Theory of Automata, Formal Languages and Computation

- -
--

-
-- - - -
-
- - - - - -
- -
- -
-
-
- -

244

-- - -- -
--

- - - -
- - - - -
- - - - - -
- - -
-
- - -
-- - -
-
- - - - - - -
- - - - -
- - - -
- - - - - - - -
- - - -
- - -
- - - -
- - - - - -

- - - - --
- - - - -
- - -
- - - - - - - - -
--- -
- - ---
- - -
- - - - -
- - -
- - - - --
--

8.1 PROPOSITIONS

Propositions and Predicates

Ch ap te r 8

- - -

- - - -

- - -
- - -

- - - - - -

- - - - - -

Illustration

- - - - -

- - - - -
- - - --
- - - - - - - - -
- - - - - -
- - - - - - - - G

- -
- -

G - -
g

G - -

G -

Illustration

- - -- -
- G --
G

- - - - -

- - -
- - - - -
- - --- -
-

- - G
- - - -

8.1.1 Connectives

- - -

-- - -

- -
- - - - - -
- - - - H

- - - -- -
- - - -
-

247

Propositions and Predicates

Theory of Automata, Formal Languages and Computation

246

B -
- -

F G

- - - F - -


F -

Illustration

- - -
- - F - -

- - - - - E

Illustration

- E -
- - - - -
- E - - B G B
- - E -
- E

- -- -
-

E - - -

- -
- - - - -
- - B - -

- -

- - - B - -

- -- -

B -
- -- -

Illustration

B - B - -- - -
-

- - - - F
- - - -

249

Propositions and Predicates

Theory of Automata, Formal Languages and Computation

248

Theory of Automata, Formal Languages and Computation

G H
G
H G H
H G

- -


-

-
-



- - -

Solution


- - - --
-
- -
-

Example 8.1.2: -- -- -

Solution

Example 8.1.1: -- -- -

- - -- -
-

- - -- -

- - - -

- -

-- - E -

250

E
H EH
E
G
B

251

E
- - -- H E H
- --- -
E
- -
G H
- --- -
B
- - ---

Solution

- - -

- -- -
-

Example 8.1.3:

- - - -

- - -
-
-

-
-

G B

- - - - -
- - -

Propositions and Predicates

Theory of Automata, Formal Languages and Computation

E
E
E
GH
BH

-
-- -
- -
- -
-

G - - -
H G H - - -
H G - - - -
F H - - -
H H F H - - -
-

- -
- -
-
-

Example 8.1.6:

Solution

--
G H G H
H G
F H H H F H

-
- -

Example 8.1.5:

Solution

-- -

-

-

Example 8.1.4:

252

253

G H G H

F G

G H

G H

G H G H

G H

F G

Solution

F
G
F G
G H
G H G H B B E B -

- - -

Example 8.1.7: -- -

Solution

Propositions and Predicates

H F

HF

H G H

H H G H

Solution

B B - - B
B E -

Example 8.1.9: - - - E -

H F G H F

Example 8.1.9: H H G H

Solution

H F G H F

E E - B B B -

Example 8.1.8: -

B-

Theory of Automata, Formal Languages and Computation

B E B -

254

255

B H F

B E H F

FH
GH
B H H
H G E H F H

- - -

Example 8.1.11: -- --

- B - - - H F
- - - B E H F - -
-

Solution

- - B E H F -

Example 8.1.10: B - - - H F

- -
-

G H

- - -
- - -

F H

- - - -
-- - - - -

8.1.2 Tautology, Contradiction and Contingency

- - - E - B B
-
- - - B
B - E -

Propositions and Predicates

G H

H H

B H H

- - -

Example 8.1.12: -- --

H G H H H F H H G E
H F H

-
-

H G E H F H

-
-

B H H

- -
-

G H

-
-

F H

Theory of Automata, Formal Languages and Computation

F H

Solution

256

- -

- -
- -

- - - -

E G H
G
B G B
H G

- - -
--

-
-

257

B G B

Example 8.1.13: - - -

- - -
-
G F B G F G
-

H F E H G H
B E H B H
B E H B H
G F B G F G

H F E H G H

B E H B H

B G B

Solution

Propositions and Predicates

Theory of Automata, Formal Languages and Computation

- - --
- -- -
- - --
- - - - - - -
- -- -
-

8.1.3 Logical Identities

KK - -- -
-

Solution

Z KK - - -
} } - -
Z

Example 8.1.15: KK --

- - --
-

Solution

G H E H G - B

Example 8.1.14: -

E G H
-
-
G

B G B

H F
-

H G B
B
H
G H

Solution

258

- G F
- F G

G G E G F G
F G E F G F
F E
G E
F E
G E
F H E
G H E
E H H
B E H F
E E B G B
G B E B B
B G B H E H
B E H B H

259

B F
G B
G B B
B G H B H
H G F B
B G B B B
B B B B B
B G B B G B G
E G E B E

- - - -
-

Table. Logical Implications

- - -
- - - -

-
-

F
G
F
G
-- F
-- G
- -

E F
E G
F E F
G E G
F F E F F
G G E G G
H F E H G H $
#
H G E H F H "

Table. Logical Identities

Propositions and Predicates

Theory of Automata, Formal Languages and Computation

-
-
-
-

--- - F H - - --

Example 8.1.17: --- - -

F F H E H H G H F H
E H H G H G
E H H G H G
F H G B E H H G H H G B
E H H G H H H G F
E H H G H G G H
B B E B H F
E H F H F
E H F F H
E F H
E

Solution

F F H
F H G B
B B

--- - G H - - --

Example 8.1.16: --- - -

- -
- -
- -
- -
- -
-
-
- -
- -

Solution

--

Example 8.1.15: - -

260

261

-- B - - --

Example 8.1.19: - B

H H F B H
E H F F H
E H F H F
E H F
E H
E
B H G H B
E H F H G F
E HG
E

G B E H G F
E H F H F
E F H F H
E F H
E

Solution

G B E
H H F B H E
B H G H B E

- -

Example 8.1.18: -- - -

B F H G H G
E H F F H G H G
E H F F H G H G
E H G H G F G H G F H G H G
E H G F G H F H G G H F
G H G H
E H F H

G G H E H H G F
E H H F H F

Solution

G G H
B F H G H G

Propositions and Predicates

E H G

E H
E F
E G

Solution

H G

- - H G

Example 8.1.20: - -

- - -
B - - B -
-
- -

Theory of Automata, Formal Languages and Computation

Solution

262

H B B

Solution

H B B
H B B
H G B B H

H B B

Example 8.1.21: -- -


E H G H G
E H H G G H G
E H F G F
E H F
E G

E G
H G

E F
E H
E H

E H H
E H H G H
E F

E H
E H G
E H G
E H

Propositions and Predicates

263

H B B

Example 8.1.23: r G r F r

F G H G H F H F H G H F H G H
E F G H H G H G F H F F H F
E F G F G F H F F H F
E F G F F H F G F
E F G F F H F G
E F G F H F G
E

Solution

F G H H G H F H F H G H F H G H

H G B H G B B H

H B

Example 8.1.22:

H B

H G B B H

Theory of Automata, Formal Languages and Computation

H B B

264

r G r E
E
E
E

H F r H F H F
B G F H F H F
B G F H F
B G F H F
B G F H F
B F H G F H F
B G F H F
B F H F
BF H
B H F

265

-
-

8.2 LOGICAL INFERENCE

-- F G r G r -
F r r -
F - -
- - - r - -
-- - - r - - -
- F -
F G r G r -
F

Solution

F G r G r

Example 8.1.25: F -

H F G H F
H G H F
H F F
F r

H G r H F H F B H F

Example 8.1.24:

Solution

Propositions and Predicates

Theory of Automata, Formal Languages and Computation

BF $
#
BF "

H Br
Br
H r B
H r H
B G
H F B - --
r B - -
H r B H - -
r r B r -
F r r B

H H E
G E G $
# -
F E F "

G G E G G $
# -- -
F F E F F "

F G E F G F $
# -
G G E G F G "

H G E H F H $
# - -
H F E H G H "

F E
G E
F G H E
G F H E
F F H E

G B $
#
G B "

Rules of Inference

- --
r - --

266
G G H E
r E H F
H r E G H
r E Hr H
r r E G r
H E E E H
E E r G r
E E G F H G H

267

Fr H
H r G H
F r G H
G H r F
F r F
F
F

- -

F
Hr
r
Hr
Hr
r
Hr
F

Q r E H F


- r E H r H

-- F r r H

Example 8.2.3: G F - -

Solution

F G r G r

Example 8.2.2: F -

Solution

F F r H H r G H G H r F

Example 8.2.1: F - --

Propositions and Predicates

- -

- -

Q B G

G F

- - -

r H

Hr

- r E H r H

- - r B

Hr H

F F r H H r G H G H r F

Example 8.2.5: F - - --

Solution

Example 8.2.5: H r B H

- -

Solution:

-- r H F H r H

Example 8.2.4: - -

Theory of Automata, Formal Languages and Computation

Solution

268

F
Fr H
H
H r G H
G H
G H r F
F

-
-
- -

269

r
H r H
r
r
r
H r H
r
r
r
r

-
-
-

-

- - - - -
- - - - - -

Example 8.2.7: -

-
-
-

Solution

- -
- -
- -
- -

Example 8.2.6: -

Solution

Propositions and Predicates

$
1
# -1
"

H r

u H r G
u



- - - -

-- -- - -

-- - -
-

Example 8.2.8: -- -- -

-
-

H r G u B

H r
u
H r

H r G
u B

Theory of Automata, Formal Languages and Computation

-
- - - -
- -

Solution

270

-- - -
-

Example 8.2.9: - -- -

- - -
- - -
r
F

r
F

r
H
H

271

H r B H

- -
F B

-

-

- -

F
H

-


r
H
H



F
H

Solution

Propositions and Predicates

Theory of Automata, Formal Languages and Computation

- -

- -

GH

H G

HGH

- -
-

- -- --- -
- - -
-

Example 8.2.10: -

- - - -

r
r
r

- -

- -


- -
H -

r $
1
r # - G H "1

- -
-- -
- -
- - -

Solution

272

-
-

H F H G
F G

F G
H F H G
F G F
H F H G H F
F
HF
FH
F G F H
F G H
F

-

- -

- ---
- -

H F
r
H G H
H
H



-
H F
r
H

Solution

273

- --- -- -
- -- -
- - ---
- ---

Propositions and Predicates

Theory of Automata, Formal Languages and Computation

B
B
B

G
r


- -

F
B
Hr
Hr
F

B
B
B

F
B
F

G
B
G

B F
B H
BH

G H

Solution

F
B
F

G
B
G

- -

Example 8.2.11: -

274

r F

F
r H

H
rH
H H r H
r H
H

GH
B -

r F
r H
rH

G H

B
B -

275

r G
r
B r

- -

r G
r

Propositions and Predicates

- -

- - -
-
- - - - -
- -

--- - - ---
- - -

8.3 PREDICATES AND QUANTIFIERS

r H

r F

r F

r H

- -
-
- - -- - -

Solution

- - - -
- - -- - - -
- - - -- - -
-

I - --
- - - --
--- - - - -

Example 8.3.1:

- F F - F F
- _ _ - _ _
- -
--

G H G H F G H G H
F G H G H

- _ - -

F F F

- -- -
- _ - -

G G G

- F -

-- -- - - - - _ _ -

- - F F - -

- -- -

- -


-

- -

- - --

- - - -
- -- - -
- - - -
--
-
- -

Example 8.2.12: -

277

Propositions and Predicates

Theory of Automata, Formal Languages and Computation

276

F F _ F F _ }
F H H _
F
F F
_ F

F _ I
F _ I

- - - - I -

Example 8.3.3: --

_ _ _ F _ F _ KK
F F KK
F
F F
KK
F F F KK
F KK
F F FKK
F F F FKK
F F F FKK
F KK
_ F _ F _ FKK
_ _

_ _ _ _

--- --

Example 8.3.2: _ _ _ _

- --

- -
- --


- - I

Theory of Automata, Formal Languages and Computation

Solution:

278

279

F _ B _ F

Solution

F _ B _ F
_ F B F _

--- - -

Example 8.3.4: - -

_ F I
I
I
-

_ F I
I
I

F _ I -

F _ I
-

Solution

_ F I
_ F I

Propositions and Predicates

Theory of Automata, Formal Languages and Computation

- -- -
- -- - -
- --
- --

F
F
F _
_ F

Solution

F G

F F G G G
F _ F G F
_ F G F G
_ _ F F F

F
F F
F _
_ F
_ _

-- - --
- -

Example 8.3.6: - -- --- -

Solution

-- - - -
-- - - --

Example 8.3.5: - --

_ F B F _

280

281


F F _
F F _
_ F

- -- - - -
-- - -- -



8.4 QUANTIFIERS AND LOGICAL OPERATORS

Solution

- - -
- - -
- -
- - - -

- -

- ---

Example 8.3.8: - - -


g
-
g - -- -
F _ _

Solution

- - --
- F _
- --
- F _
- -- --
- F _ _

Example 8.3.7: - - -

Propositions and Predicates

F H B

- -

H F B _ G H

F G B

F F

Theory of Automata, Formal Languages and Computation

- - -
- -

_ _ F H _ _ F g

H F F _

- - - - -- - - - -
-

F F _

- -- - -
- - -
- - -- -
- - - - -

F F B

F B F

- -
--
- -
-- -- -
-

282

F B - -
B _ - -
F H E H _
F E H
_ H E H F
F G E F G
F F E F F
F G F E F G
F F F E F F
_ G E _ G
_ F E _ F
_ G E _ G _
_ F _ E _ F

283


g g g


- - -- m
- --
} } - -


- -
- -

F F B G

F F H B H G H

g g g

F B F

Solution


- -- - -

Example 8.4.1:

Logical Relations

Propositions and Predicates

F F G _ B F F G
B

- -

H F F G

F F F G B F F G
B

F F H G H B

} } - -

F F F H G H B H

- --

F H E H F

- - -- m

F E

Theory of Automata, Formal Languages and Computation

F B
F F H
_ G H
F F F G B F
F B F F B

F B
- -

Solution

- --- - --

- -
- -
- - --
- - - F

--- - - -

Example 8.4.2: - -- -

284

285

F -- _ H
-- _ - F H -- _
- F H

Example 8.4.4: -- -

B _

F _ G H G _ _ G
-

F B _ G

-
-
_ G
-
-
H _ G
-
-
- -

Solution

-
-
- - - -
- - - - - -

- -

- - -- - -

Example 8.4.3: - -

F H
- - --
_ G H
- - -
F F F G B F
-- F -- -
- -
F B F F B
-- - -- F

Propositions and Predicates

Theory of Automata, Formal Languages and Computation

_ E _ G F B

F B

F B F

_ G _ G _ - K -
- - -

Example 8.4.7: - -

-- -

Solution:

F B B F B F

Example 8.4.6: --

Solution

_ -- - F _
-

Example 8.4.5: -- -

F E H H F
E H _ H
E H _ H
_ E H H _
E H F H
E H F H

Solution

286

287

r
r

- -
-

F r
_ r
-
- -
r
- -
-
-
- -

Solution

- - -
- - -
- - - - -
- - -

-- - -
-

Example 8.4.8: -- -- -

_ G E G F G
E G F G G F
E F G F G F
G F
E F G F
E _ G _
- -

Solution

_ G B _ G _

Propositions and Predicates

_ r

F H r

_ H r

F F
F

_
_ F

Solution

Example 8.4.10: F F r H F -

B -- -

F H r
H r
_ r
r
H r
_ H r

H F r

_ r

H _ r

-
-
- -

Solution

- - -
- - -
- -
- -

Example 8.4.9: -

- - -

- -

Theory of Automata, Formal Languages and Computation

- -

288

289


_
_ _


'
&
&
&
&
&
&
&
&
&
&
%

- -

8.5 NORMAL FORMS

H F B

r EHF

H F

F r

F F r

Solution

H F F r H

Example 8.4.12:

F _

Solution

Example 8.4.11: F _ r _ _ -

Propositions and Predicates

G G F G H G F G H G
F H G H G

Theory of Automata, Formal Languages and Computation

F H r F r H

Example 8.5.1: -

- - -
- - -
-
-
- - -
- - -
-
-
-

G F H G H

H F G H G

r -

r - H F

r u
r u -

Procedure to find disjunctive Normal form

- -
-- -

Conjunctive Normal Form

- - -
- - -

Disjunctive Normal Form

- - - -
- - -
- - - -
- - - -
-

290

F H r
E
E
E
E
E
E
E
E
E
E

F r H
F H r F H F
F H r F H F F
F H r F F
F H r F
F H H F F
F F F
F F F F
F F
F F F
F F
-

F H G H F
E F H G F H F F
E G F H F F
E H F F
E F H F
-

H F H r H G

Solution
G H G F r
E G H G F H F
E G H F F H F
E G H F G F H F
E G H F H F G H F F G

G H G F r

Example 8.5.4: -

H F H r H G
E H H F H F H G
E G F H G
-

Example 8.5.3: -

Solution

F H G H F

Example 8.5.2: -

Solution

Propositions and Predicates

291

r r G H H F H
E r H F G G
E H F H F G G
E H F H F G H F G
E H F H F G H F G
E H F H F H F G H F
E H F H F G H F
E H F H F H F G H F
E H F G H F
E HF
-

- - - -
- - - - -

- -
- - - - -
-
H
G
- F

GLOSSARY

H F u G
E H F G G F H H F G H G
E H G H G G F F G H F H
E G H G G H F F G H F H
E F G H F H
-

Solution

H F u G

Example 8.5.6:

Solution

r r G H H F H

-
- -
-
- -


-

-

-

-

-

- - - -
-
- -

-

-

REVIEW QUESTIONS

B
E
- - - --
- - - -
- - - -
- -

- - G B B
- - B G H B H
- - H G G B
- B G B B B
- --- - - -- - -
-

E G H F G F G
E F F G
E G F F H
-

293

Propositions and Predicates

Theory of Automata, Formal Languages and Computation

Example 8.5.5: -

292

--
-
- --

- -
- -
-
- - - --
-
-- - -
- --
F F
G G
G F H
-
--
r F H r
r G H r
H r r
H F H G H
-
-- r H F
-- F G F G F

H F H G H G H
f H H
- - -

H G f H F H - -
- -
- -
-- H G H F H
- F H -
F F H G H -
- F G H G H -
- H G H G
- - --
- - - -
r f H F - -
- r f H F

EXERCISES

295

Propositions and Predicates

Theory of Automata, Formal Languages and Computation

-- --
- - --
-
- - -



-
-
--
- -

-
-
-
-

-
- - -
-
- -
H G
H G
H F H
G F
G H B
- - -

-
-
-- - - -
- - - -
- - -
- - - -
-- - -
- - --

294

r
r

r G
H
H

G H

-r
F r H
H - r H r

F r - G

G
r

-- - - - --
- -- - - -- --
- -
_
F
_ H
F H
-
- --
-- - -
- - -- - - --
-
- - - -
- -
- - - -
- -
- - -- --
-

r F

H F -
G r F -
H G

G r F -
G
F -

- -
-
-- - -
- - ---
-
- -
- - - -
- - -

- r f F -
- - -
- --
- - - -
- - - --
- - - - -
-
r - - - r

297

Propositions and Predicates

Theory of Automata, Formal Languages and Computation

296

Theory of Automata, Formal Languages and Computation

- -
-
- -- -
--
- -
- -
- - - -
- - -
- -
-

H r G u

r r G H r

F H r F H r


H F
G F H G F G
-

-
-
_ r _
F r _
_ H r H F
F F F F F

F F _ F _ F
-

H _ F F _ H

--

298

299

-
- - - -
-
- - - -
-
- - - -
- - - -
-
-
--- -
-
-
- --- - -
- - -
- - - -
- -
-
- - -
- -- --


- -
- - - -

- --
- - - -
- -

SHORT QUESTIONS AND ANSWERS

Propositions and Predicates

Theory of Automata, Formal Languages and Computation

- -

F
-
B - -

--
- - -

- - -

--



-- -
G
G -- -
-

300

301

B G H B H

- - -

G B B


- - - -
-- - - - -
F H

- - - - -
G H

- -
-
--
r
r
- - -

-
- -

- - -

Propositions and Predicates

Theory of Automata, Formal Languages and Computation

F G E F G F
G G E G F G

- - - -

H G E H F H
H F E H G H

- - - -

HH E

-
-
- -
r r B r
H F B
-
- - r B
H r B H
-

B E H F

E E B G B

B G B H E H

G B E B B

B E B

B G B B B

- -

H G F B

- - --

302

303

-
--- - - ---
- -
-

G E G
F EG

- - -

G G E G F
F F E F F

-- - - -

Propositions and Predicates

- -
- R S - - R S
R R - R - S







- - - -
l R R
R R
l





S
S
Y
- - - -

KK

CHAPTER 0

Answers to Exercises

Y X Y X Y
X Y
Y

X G X Y X
Y X
X

F R F R Y
Y


Y T
T Y
X Y
Y X Y X Y
X Y

R E R G Q
E R G R
E R Y


Y Y Y
B Y T Y

Y T Y

U m X X KK

R
X
Y
R G R

U m X X KK

R


R KK m
m
m

Answers to Exercises

305

Theory of Automata, Formal Languages and Computation

r
r

I
- R R
R -



-
-
-
- -
-

- - -
-








--
- -

-


-
- -


o
o

306

307

; I

CHAPTER 1

q0

q0

q1

q1

:
*
; I 98 ; I )( I


I



-- - - - - - -
- - - -- -

--

-- - - ; I

; I


r r r

- r r r r r r



-
- r r r
r r r r
r r
r r r r r r r
r r r r r r
r r r r r
r r r r r r

Answers to Exercises

308

q2

q0

q3

0,1

q2

q1

00

q2

a,b

q2

q2

q2

q2

a,b

q1

q1

q1

q1

q1

q1

a,b

q0

q0

q0

q0

q0

q0

q3

001

0,1

q3

q3

q3

q3

Theory of Automata, Formal Languages and Computation

q0

q4

q1

q4

q5

q2

309

q3

q3

a,b

- ~ ~ ~ ~ ~ ~


m
Z

Answers to Exercises

-
-
-

-
-
-

0,0

Start

-
-

s0

s0

0,0

1,0

0,0

s1

-
-
-

1,0

s2

1,1

0,0

s3

-
-

1,1

s2

0,0

1,0

1,1

s1

0,1

-
-

Start

1,0

Theory of Automata, Formal Languages and Computation

310

-
-
-

Start
s0
1,0

0,0

-
-
-

s2

s1

Start

1
s0
1

s1

s2
0

-
-
-

1,0

s4

0,0

s3

1,0

1,0

0,0

1,1

s3

0,0

1,0

s6

Start

s0

s2

1 0,1

s1

1
s3

1,1

s5


K - -

KK

0,0

0,0
0,0

Answers to Exercises

311

-
-
-
-
-

{s0}

0,1

{s1}

Start

s0

s3

s1

m X m

m m

{s3}


X m m

Start

{s0, s2}

-
-

- -
-

s2

{s4}

0,1

{s1,s4}

0,1

{s3,s4}

Theory of Automata, Formal Languages and Computation

312

s0

s2

s0

s2

s3

0,1

0,1

s1

0,1

s4

0,1

s1

0,1

Start

s0
1

s1

s2

Start

s0

s1

0
0

s2


X X X

0
0

s3

s4

- -
- -
-
-

Start

Start


r r r r r
r r r r

Answers to Exercises

s5

313

Theory of Automata, Formal Languages and Computation

{3}

a,b

{1,3}

{1}

{2,3}

{2}

a,b

{1,2,3}

{1,2}

m R m
- - -
- - - - -
- - - - - - --
-
-- - - - -- - -- - - -

R - -
m } - -
- - - - - - -
-

b
a

- - m -

-- - -- - - --

314

x0

x0

x0

S S

x1

S
S

x1

315

- -- -
- -
- r r
r
r r




CHAPTER 2

Answers to Exercises

{q
s0}

a,b

{q1,q4}

a,b

{q4}

{q2}

{q3}

- - -


Z - R
R -
R

R

r r r
Z
R
R

-




R
R R

CHAPTER 3

Theory of Automata, Formal Languages and Computation

316

- -
- -
- -
- -
- -

- -
- -
- -
- -

- -

- -

- -

- -

- -

- -

317


- - - - - - - - - -
- - - - - - - - - -
- - - - - - - -
- - - -
- --
- -
- - -

- -

- -

- -

- -

CHAPTER 6

r
r

r
r




- -
-
-
- - - -

CHAPTER 4

Answers to Exercises

Theory of Automata, Formal Languages and Computation

-


-
-
-
-
- -
-
g
-
H
r
r
r



- - -
- -
- - - - --
-
- - - -
- -
- -- -
- -- -

CHAPTER 8







- - -
- m
-
-

318

319

F H

G F H G F H G H
G G F G G H F H G G F H G G H
F F
G F H G F H G H

- F H
F H -
- - -
H F F H
- -- -
g -
- -




- - -- -
--
- -- - --
- - - - -
--
- -- - --
_ G
_ G H
F F F I I I I

- -- - -- - -

G F H G H
F H F H F


- -
- - -
-

Answers to Exercises

-


- -
-
-

-
- - -
-
-


- - - -

-



- -
-


-


-

r r - -



--

1. The positive closure operator denotes

(ANSWER ALL QUESTIONS)

GROUP I

THEORY OF COMPUTING

University Question Papers

321

--

PART A

- -- --
-- - - - -

Instructions

THEORY OF COMPUTING

M.Sc. COMPUTER TECHNOLOGY I SEMESTER

SEMESTER EXAMINATIONS
(NOV./DEC. 1999)

- - ---

- -
-
- -



- -
- -
-

GROUP II

- - -
- -


University Question Papers

PART B

-
- -

-
-
- - --
- -

- - -

Theory of Automata, Formal Languages and Computation


- -
- -
- -
- -- - - -
- -- - - -
- - - -
- --

X X

- -
- - ---

- -
R -

R - - --
- - -
- - --

322

323

r r

- -
-
- -
- I
- - -
- -
- - -
-
S - -
- -

-- -

- -
- -
-- - -
- -
-

- -- -
-
-
-
--- -

- --

Instructions:

THEORY OF COMPUTATION

University Question Papers

(ANSWER ALL QUESTIONS)

GROUP I

-

-


- -



- -

--
- -
- - -
-
-



r r

r r

r r




- - -
-

-

- - -




- - -- -



Start

0
1

10




--
-- -

r r r - -

(ANSWER ALL QUESTIONS)

GROUP I

THEORY OF COMPUTING

-
- - - --

- r r r
r r r
- r r r r r -

-
- -
- --

-
-

GROUP II

THEORY OF COMPUTING

- -
- - -
- - --
- --

THEORY OF COMPUTING

325

University Question Papers

Theory of Automata, Formal Languages and Computation

--- X -

324



r r r

r r r

r r r




- -
-





- -
- -

-

- -
- --- -
- - - -
- - - - -
- - -
- -- -



- -
-
-
-
-

r r r r

THEORY OF COMPUTING






r
r r r
r r r r
--- -

327

0
1
B

0
0

0
C

1
1

r r r
-
- - -
-

- -

GROUP III

r
r

- -

THEORY OF COMPUTING

B.E. COMPUTER SCIENCE & ENGINEERING IV SEMESTER

- - -

r r r

- - -

-
-
-- - - - -
r
r

Start

- - --
-- -

GROUP II

University Question Papers

Theory of Automata, Formal Languages and Computation

326

Theory of Automata, Formal Languages and Computation

GROUP III

- - -
-
- -
-
r
r
r
r
r
- - - -

r r

- -
- -
- -


- -



THEORY OF COMPUTING

- ---
- - -- -




- r r r
- -- - - -- -
-
- ---
- ---

328

329

-
-

r
r
r
r
r
r
r - -
r
r
-
-
r
r ~
r ~
r
r ~
r
r
r ~
r ~


r r

r r

r r




-



GROUP I

--

TEST II

THEORY OF COMPUTING

- -
-

m g

-
-

University Question Papers

GROUP III

-
-
r
r
r
- -
- -- - -
- --- - -

Answer Any 2 Questions


r
r
r

-

- - -

GROUP II

THEORY OF COMPUTING

- - -
-
-
-

331

-- -
-- -
R


r

r

r




- r

~ m
~ m
~ m
~ ~ ~ m
-
R

--
- -
-
-
- R

-

-
-- -

- - -

l r
l r



- -
- r
r
r

-- - -- ---
- -

GROUP I

University Question Papers

Theory of Automata, Formal Languages and Computation

330

GROUP III


- - -

-

- --
- - - -
- - - - -
- --

r
r R
r R

r
r
r

- - -

m -

-- - -- - - - - - - -
R --

GROUP II

SEMESTER IV

GROUP I

- --
- -
- -
- -
- -
- --
-- -
-

-
---

THEORY OF COMPUTING

- - - -
-

- -
- -

r
r
r
r
r

--

-
-
- -
-

B.E. COMPUTER SCIENCE & ENGINEERING


THEORY OF COMPUTING

333

University Question Papers

Theory of Automata, Formal Languages and Computation

332

Theory of Automata, Formal Languages and Computation

r
rR

GROUP I

TEST II

r
r
r

- -

THEORY OF COMPUTING

- r r r
r
- -

- -
- - - -
-
S - -
- -
-

r
r
r - r

-
- --
- -
-
-

GROUP II

-- -

334

335

r R
r
r

Answer any 2 Questions

GROUP III

r
r

- - - -

-- --
-
-

r R


- -

GROUP II



-
- - -

- -
- --- - - - -
- - -

r r r -

University Question Papers

Theory of Automata, Formal Languages and Computation

-
- - -
-

- -

r r r

- - -

r r R r R

- - -

r
r

-
-
-- - - - -

Start

-- - --
-- -

GROUP II

THEORY OF COMPUTING

- --- -
-

- -

r
r
r
r

336

337

GROUP III

- -
-

m g

- - - -

-
-

r
r
r
r
r R

- - -
-
- -
-

r r

- -
- -
- -


- -

THEORY OF COMPUTING

B.E.COMPUTER SCIENCE & ENGINEERINGIV SEMESTER

University Question Papers

Theory of Automata, Formal Languages and Computation

PART A

- - ---
- -- -

m X m

-
r r
r r
-

m - -
--
-
-

--

-
-- - m -

*Answer All Questions

THEORY OF COMPUTATIONS

COMPUTER SCIENCE AND ENGINEERING FIFTH SEMESTER

338

339

1
3

-
- -
-
- -- -

-- - --

-- - --

-- -

- -
- -
- -
- -
- - - -
-

- -

University Question Papers

Theory of Automata, Formal Languages and Computation

(0,x,R)

(1,x,R)

q1

(0,0,L)

q4

q2

q3

(y,y,L)

(0,0,L)

(1,y,L)

(y,y,R)

(x,x,R)

q5

(b,b,R)

(b,b,R)
q

-
-- -
- -
- - - -

- --
-
- -
-

- - - -- -
-
-- -

340

- - - -
- --
- -- - -
-

- - - - --

- -
-
-
- --
- -
- --

- -
- - -

- -

- - - - -

-- - - - -
-
-
- -- -
- -
- - -
-
-


- - --

Bibliography


-
-


-



- -


--
--






--
-
-

-
-

-


-
--

- -


--
--
--


-
-


- - -

-

-

-

- -
-

- --
-

Index

Você também pode gostar