Models of Computation. by Costas Busch, LSU

Similar documents
Introduction to Automata

Any Wizard of Oz fans? Discrete Math Basics. Outline. Sets. Set Operations. Sets. Dorothy: How does one get to the Emerald City?

Theory of Computation

A Universal Turing Machine

Propositional Logic. What is discrete math? Tautology, equivalence, and inference. Applications

BASIC MATHEMATICAL TECHNIQUES

Sets and Functions. MATH 464/506, Real Analysis. J. Robert Buchanan. Summer Department of Mathematics. J. Robert Buchanan Sets and Functions

Before We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions?

Foundations of Informatics: a Bridging Course

Theory of Computation Lecture 1. Dr. Nahla Belal

Automata Theory for Presburger Arithmetic Logic

Introduction. Foundations of Computing Science. Pallab Dasgupta Professor, Dept. of Computer Sc & Engg INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR

In N we can do addition, but in order to do subtraction we need to extend N to the integers

a + b = b + a and a b = b a. (a + b) + c = a + (b + c) and (a b) c = a (b c). a (b + c) = a b + a c and (a + b) c = a c + b c.

Properties of the Integers

Climbing an Infinite Ladder

Sri vidya college of engineering and technology

BOOLEAN ALGEBRA INTRODUCTION SUBSETS

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

2. Sets. 2.1&2.2: Sets and Subsets. Combining Sets. c Dr Oksana Shatalov, Spring

Chapter 1 : The language of mathematics.

CA320 - Computability & Complexity

Automata Theory and Formal Grammars: Lecture 1

THEORY OF COMPUTATION

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

In N we can do addition, but in order to do subtraction we need to extend N to the integers

Chapter 1. Sets and Mappings

2.1 Sets. Definition 1 A set is an unordered collection of objects. Important sets: N, Z, Z +, Q, R.

ECS 120 Lesson 15 Turing Machines, Pt. 1

1. (B) The union of sets A and B is the set whose elements belong to at least one of A

CHAPTER 1. Preliminaries. 1 Set Theory

CITS2211 Discrete Structures (2017) Cardinality and Countability

Theory of Computation

Pushdown Automata. We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata.

Assignment #2 COMP 3200 Spring 2012 Prof. Stucki

MATH 215 Sets (S) Definition 1 A set is a collection of objects. The objects in a set X are called elements of X.

CS 208: Automata Theory and Logic

HW 4 SOLUTIONS. , x + x x 1 ) 2

Discrete Mathematics. Spring 2017

5. Partitions and Relations Ch.22 of PJE.

Automata and Languages

Preliminaries to the Theory of Computation

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Show Your Work! Point values are in square brackets. There are 35 points possible. Some facts about sets are on the last page.

CS 455/555: Mathematical preliminaries

Mathematical Preliminaries. Sipser pages 1-28

Part I: Definitions and Properties

Chapter 0 Introduction. Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin

Formal Languages, Automata and Compilers

CSE 20 DISCRETE MATH SPRING

A set is an unordered collection of objects.

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Mathematical Induction. Section 5.1

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen

CSCI 2200 Foundations of Computer Science Spring 2018 Quiz 3 (May 2, 2018) SOLUTIONS

Preparing for the CS 173 (A) Fall 2018 Midterm 1

Sets are one of the basic building blocks for the types of objects considered in discrete mathematics.

Comment: The induction is always on some parameter, and the basis case is always an integer or set of integers.

CSE 105 THEORY OF COMPUTATION

Visibly Linear Dynamic Logic

CSE 20 DISCRETE MATH WINTER

Theory Bridge Exam Example Questions

Topics COSC Administrivia. Topics Today. Administrivia (II) Acknowledgements. Slides presented May 9th and 16th,

4. Sets The language of sets. Describing a Set. c Oksana Shatalov, Fall

Economics 204 Summer/Fall 2017 Lecture 1 Monday July 17, 2017

On the Accepting Power of 2-Tape Büchi Automata

Sets. Alice E. Fischer. CSCI 1166 Discrete Mathematics for Computing Spring, Outline Sets An Algebra on Sets Summary

Sets. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Fall 2007

Computational Models - Lecture 4

1. Draw a parse tree for the following derivation: S C A C C A b b b b A b b b b B b b b b a A a a b b b b a b a a b b 2. Show on your parse tree u,

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

The integers. Chapter 3

Climbing an Infinite Ladder

Review 3. Andreas Klappenecker

Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination I (Spring 2008)

1 Chapter 1: SETS. 1.1 Describing a set

Final Exam Review. 2. Let A = {, { }}. What is the cardinality of A? Is

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Nondeterministic Finite Automata

Sets and Functions. (As we will see, in describing a set the order in which elements are listed is irrelevant).

NODIA AND COMPANY. GATE SOLVED PAPER Computer Science Engineering Theory of Computation. Copyright By NODIA & COMPANY

Formal Languages, Automata and Models of Computation

Sets. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Spring 2006

Tribhuvan University Institute of Science and Technology Micro Syllabus

Chapter Summary. Sets (2.1) Set Operations (2.2) Functions (2.3) Sequences and Summations (2.4) Cardinality of Sets (2.5) Matrices (2.

Pushdown Automata: Introduction (2)

Pushdown Automata. Chapter 12

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

Valence automata as a generalization of automata with storage

Chapter 2 - Basics Structures MATH 213. Chapter 2: Basic Structures. Dr. Eric Bancroft. Fall Dr. Eric Bancroft MATH 213 Fall / 60

CSE 20 DISCRETE MATH. Winter

Sets McGraw-Hill Education

Set Theory. CSE 215, Foundations of Computer Science Stony Brook University

Peter Wood. Department of Computer Science and Information Systems Birkbeck, University of London Automata and Formal Languages

Math Fall 2014 Final Exam Solutions

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

Economics 204 Fall 2011 Problem Set 1 Suggested Solutions

Theory of computation: initial remarks (Chapter 11)

Transcription:

Models of Computation by Costas Busch, LSU 1

Computation CPU memory 2

temporary memory input memory CPU output memory Program memory 3

Example: f ( x) x 3 temporary memory input memory Program memory compute compute CPU x x 2 x x output memory 4

f ( x) x 3 temporary memory input memory x 2 Program memory compute compute CPU x x 2 x x output memory 5

temporary memory f ( x) x 3 z 2*2 4 f ( x) z *2 8 CPU Program memory compute x x input memory x 2 output memory compute 2 x x 6

temporary memory f ( x) x 3 z 2*2 4 f ( x) z *2 8 CPU Program memory compute x x input memory f x 2 ( x) 8 output memory compute 2 x x 7

Automaton temporary memory Automaton input memory CPU output memory Program memory 8

Different Kinds of Automata Automata are distinguished by the temporary memory Finite Automata: no temporary memory Pushdown Automata: stack Turing Machines: random access memory 9

Finite Automaton temporary memory Finite Automaton input memory output memory Example: Vending Machines (small computing power) 10

Pushdown Automaton Stack Push, Pop Pushdown Automaton input memory output memory Example: Compilers for Programming Languages (medium computing power) 11

Turing Machine Random Access Memory Turing Machine input memory output memory Examples: Any Algorithm (highest computing power) 12

Power of Automata Finite Automata Pushdown Automata Turing Machine Less power Solve more More power computational problems 13

Mathematical Preliminaries 14

Mathematical Preliminaries Sets Functions Relations Graphs Proof Techniques 15

SETS A set is a collection of elements A {1,2,3} B { train, bus, bicycle, airplane} We write 1 A ship B 16

Set Representations C = { a, b, c, d, e, f, g, h, i, j, k } C = { a, b,, k } finite set S = { 2, 4, 6, } infinite set S = { j : j > 0, and j = 2k for some k>0 } S = { j : j is nonnegative and even } 17

A = { 1, 2, 3, 4, 5 } U 6 A 7 10 1 2 3 4 5 9 8 Universal Set: all possible elements U = { 1,, 10 } 18

Set Operations A = { 1, 2, 3 } B = { 2, 3, 4, 5} Union A U B = { 1, 2, 3, 4, 5 } Intersection A B = { 2, 3 } U Difference A - B = { 1 } B - A = { 4, 5 } A A-B B 19

Complement Universal set = {1,, 7} A = { 1, 2, 3 } A = { 4, 5, 6, 7} 4 5 A 1 A 2 3 7 6 A = A 20

{ even integers } = { odd integers } Integers 1 odd 3 2 even 0 4 6 7 5 21

DeMorgan s Laws A U B = A U B A U B = A U B 22

Empty, Null Set: = { } S U = S S = U = Universal Set S - = S - S = 23

Subset A = { 1, 2, 3} B = { 1, 2, 3, 4, 5 } A U B Proper Subset: A B U B A 24

Disjoint Sets A = { 1, 2, 3 } B = { 5, 6} A B = U A B 25

Set Cardinality For finite sets A = { 2, 5, 7 } A = 3 26

Powersets A powerset is a set of sets S = { a, b, c } Powerset of S = the set of all the subsets of S 2 S = {, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c} } Observation: 2 S = 2 S ( 8 = 2 3 ) 27

Cartesian Product A = { 2, 4 } B = { 2, 3, 5 } A X B = { (2, 2), (2, 3), (2, 5), ( 4, 2), (4, 3), (4, 5) } A X B = A B Generalizes to more than two sets A X B X X Z 28

FUNCTIONS domain 1 2 A 3 f(1) = a range B a b c If A = domain f : A -> B then f is a total function otherwise f is a partial function 29

RELATIONS R = {(x 1, y 1 ), (x 2, y 2 ), (x 3, y 3 ), } x i R y i e. g. if R = > : 2 > 1, 3 > 2, 3 > 1 In relations x i can be repeated 30

Equivalence Relations Reflexive: x R x Symmetric: x R y y R x Transitive: x R y and y R z x R z Example: R = = x = x x = y x = y and y = z y = x x = z 31

For equivalence relation R Equivalence Classes equivalence class of x = {y : x R y} Example: R = { (1, 1), (2, 2), (1, 2), (2, 1), (3, 3), (4, 4), (3, 4), (4, 3) } Equivalence class of 1 = {1, 2} Equivalence class of 3 = {3, 4} 32

A directed graph node a GRAPHS b e d c Nodes (Vertices) V = { a, b, c, d, e } Edges E = { (a,b), (b,c), (b,e),(c,a), (c,e), (d,c), (e,b), (e,d) } 33

Labeled Graph 2 a 1 5 b 6 c 3 6 e 2 d 34

Walk a b e d c Walk is a sequence of adjacent edges (e, d), (d, c), (c, a) 35

Path a b e d c Path is a walk where no edge is repeated Simple path: no node is repeated 36

Cycle a 3 base 2 b 1 c e d Cycle: a walk from a node (base) to itself Simple cycle: only the base node is repeated 37

Euler Tour a 4 3 b 5 8 7 6 c base e 1 2 d A cycle that contains each edge once 38

Hamiltonian Cycle a 4 3 b 5 c base e 1 2 d A simple cycle that contains all nodes 39

Finding All Simple Paths a b e d c origin 40

Step 1 a b e d (c, a) (c, e) c origin 41

Step 2 a b e d (c, a) (c, a), (a, b) (c, e) (c, e), (e, b) (c, e), (e, d) c origin 42

Step 3 a b e d (c, a) (c, a), (a, b) (c, a), (a, b), (b, e) (c, e) (c, e), (e, b) (c, e), (e, d) c origin 43

Step 4 (c, a) (c, a), (a, b) a (c, a), (a, b), (b, e) (c, a), (a, b), (b, e), (e,d) (c, e) (c, e), (e, b) (c, e), (e, d) b c e origin d 44

root Trees parent leaf child Trees have no cycles 45

root Level 0 leaf Level 1 Level 2 Height 3 Level 3 46

Binary Trees 47

PROOF TECHNIQUES Proof by induction Proof by contradiction 48

Induction We have statements P 1, P 2, P 3, If we know for some b that P 1, P 2,, P b are true for any k >= b that P 1, P 2,, P k imply P k+1 Then Every P i is true 49

Inductive basis Proof by Induction Find P 1, P 2,, P b which are true Inductive hypothesis Let s assume P 1, P 2,, P k are true, for any k >= b Inductive step Show that P k+1 is true 50

Example Theorem: A binary tree of height n has at most 2 n leaves. Proof by induction: let L(i) be the number of leaves at level i L(0) = 1 L(1) = 2 L(2) = 4 L(3) = 8 51

We want to show: L(i) <= 2 i Inductive basis L(0) = 1 (the root node) Inductive hypothesis Let s assume L(i) <= 2 i for all i = 0, 1,, k Induction step we need to show that L(k + 1) <= 2 k+1 52

Induction Step Level k+1 k From Inductive hypothesis: L(k) <= 2 k 53

Induction Step Level k L(k) <= 2 k k+1 L(k+1) <= 2 * L(k) <= 2 * 2 k = 2 k+1 54

Remark Recursion is another thing Example of recursive function: f(n) = f(n-1) + f(n-2) f(0) = 1, f(1) = 1 55

Proof by Contradiction We want to prove that a statement P is true we assume that P is false then we arrive at an incorrect conclusion therefore, statement P must be true 56

Theorem: 2 Example is not rational Proof: Assume by contradiction that it is rational 2 = n/m n and m have no common factors We will show that this is impossible 57

2 = n/m 2 m 2 = n 2 Therefore, n 2 is even n is even n = 2 k 2 m 2 = 4k 2 m 2 = 2k 2 m is even m = 2 p Thus, m and n have common factor 2 Contradiction! 58