intro automata

18
 CS142 Introduction to Theory of Computing

Upload: patricia-sacrez

Post on 14-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 1/18

 CS142

Introduction to Theory of

Computing

Page 2: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 2/18

Components of Computer Theory

• Theory of Mathematical Logic– Georg Cantor (1845-1918) – Theory of Sets

– David Hilbert (1862-1943) – Algorithm and Rules ofInference

– Kurt Godel (1906-1978) – Incompleteness Theorem• True statements without any possible proof

– Alonzo Church, Stephen Cole Kleene, Emil Post• That there are problems that no algorithm could solve

– Alan Mathison Turing (1912-1954)

• Developed the concept of a theoretical “universal-algorithm”machine

• Theory of Computer Languages– Noam Chomsky

• Mathematical models for the description of languages

Page 3: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 3/18

• Theoretically explore the capabilities

and limitations of computers– Complexity theory

• What makes some problems computationallyhard and others easy?

– Computability theory• What problems can be solved by a computer?

– Automata theory

• How can we mathematically modelcomputation?

Page 4: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 4/18

Sets, multisets and sequences

• Set– Order and repetition don’t matter 

• {7,4,7,3} = {3,4,7}

• Multiset– Order doesn’t matter, repetition does 

• {7,4,7,3} = {3,4,7,7} {3,4,7}

• Sequence

– Order and repetition matter• (7,4,7,3) (3,4,7,7)• Finite sequence of k elements may be called

a k -tuple

Page 5: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 5/18

Sets, multisets and sequences

• Set– Subset A B– Proper subset A B– Infinite set { 1, 2, 3, . . . }– Empty set { } or  – Venn Diagram

Page 6: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 6/18

Set notation

• Union: AB• Intersection: AB

• Complement: A

• Cartesian Product: AB– Also called cross product

• Power set: P  

(A)

Page 7: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 7/18

Example

• A = {1,2}, B={2,3}, U = {x N|x < 6}– AB =

– AB =

– A =– AB =

–  P  (A) =

• A = {1,2}, B={2,3}, U = {x N|x < 6}– AB = {1,2,3}

– AB = {2}

– A = {3,4,5}– AB = {(1,2), (1,3), (2,2), (2,3)}

–  P  (A) = {Ø, {1}, {2}, {1,2}}

Page 8: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 8/18

Function

• Mechanism associating each input value with exactly one output value– Domain: set of all possible input values

– Range: set containing all possible outputvaluesf : D  R 

n f (n )

1

2

3

4

2

4

2

4

f : {1, 2, 3, 4} {2, 4}

f : {1, 2, 3, 4} {1, 2, 3, 4}

Page 9: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 9/18

Relation

• Predicate: function whose outputvalue is always either true or false

• Relation: predicate whose domain is

the set A×A×…×A– If domain is all k -tuples of A, the

relation is a k -ary relation on A

– Properties of Relations (Reflexive,Irreflexive, Symmetric, Asymmetric,Transitive)

Page 10: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 10/18

Graphs

Nodes

Page 11: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 11/18

Graphs

Edges

Page 12: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 12/18

Graphs

Degree = 2Degree = 1Degree = 3

Page 13: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 13/18

Graphs

Binary tree Subgraph

Page 14: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 14/18

Directed graphs

1

5

43

2

{(2,1),(3,1),(4,3),(5,2)}

Page 15: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 15/18

Alphabets and strings

• Alphabet: any finite set1 = {1,2,3}

2 = {,,}

• String: finite sequence of symbolsfrom the given alphabet1212123

 • Empty string, ε, contains no symbols of the

alphabet

• Language: a set of strings

Page 16: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 16/18

Boolean logic

• Conjunction (and)  • Disjunction (or )  

• Negation (not)  

• Exclusive or (xor )  • Equality  

• Implication  

Page 17: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 17/18

Proof techniques

• Construction– Prove a “there exists” statement by

finding the object that exists

• Contradiction– Assume the opposite and find a

contradiction

• Induction– Show true for a base case and show thatif the property holds for the value k ,then it must also hold for the value k + 1

Page 18: Intro Automata

7/29/2019 Intro Automata

http://slidepdf.com/reader/full/intro-automata 18/18

Find the error in the following proof that 2 = 1.

Consider the equation

a = b

Multiply both sides by a to obtain

a2 = ab

Subtract b2 from both sides to get

a2  –

b2 = ab –

b2 Now factor each side,

(a+b)(a-b) = b(a-b)

and divide each side by (a-b), to get

a+b = b

Finally, let a and b equal 1, which shows that

2 = 1