Theoretical Computer Science COMP 335 Fall 2004

Slides:



Advertisements
Similar presentations
Mathematical Preliminaries
Advertisements

Chapter 2 Revision of Mathematical Notations and Techniques
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
Review of Mathematical Notation / Terminology
Courtesy Costas Busch - RPI1 A Universal Turing Machine.
1 CSCI-2400 Models of Computation. 2 Computation CPU memory.
1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse.
CS 454 Theory of Computation Sonoma State University, Fall 2011 Instructor: B. (Ravi) Ravikumar Office: 116 I Darwin Hall Original slides by Vahid and.
Costas Busch - RPI1 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
CS 310 – Fall 2006 Pacific University CS310 Strings, String Operators, and Languages Sections: August 30, 2006.
1 Languages and Finite Automata or how to talk to machines...
CS5371 Theory of Computation Lecture 1: Mathematics Review I (Basic Terminology)
Sets 1.
Sets 1.
Courtesy Costas Busch - RPI1 Non-regular languages.
Costas Busch - RPI1 Mathematical Preliminaries. Costas Busch - RPI2 Mathematical Preliminaries Sets Functions Relations Graphs Proof Techniques.
Courtesy Costas Busch - RPI1 Mathematical Preliminaries.
Fall 2004COMP 3351 Standard Representations of Regular Languages Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
Fall 2004COMP 3351 A Universal Turing Machine. Fall 2004COMP 3352 Turing Machines are “hardwired” they execute only one program A limitation of Turing.
Fall 2006Costas Busch - RPI1 Languages. Fall 2006Costas Busch - RPI2 Language: a set of strings String: a sequence of symbols from some alphabet Example:
Fall 2004COMP 3351 Languages. Fall 2004COMP 3352 A language is a set of strings String: A sequence of letters/symbols Examples: “cat”, “dog”, “house”,
1 CSCI 2400 section 3 Models of Computation Instructor: Costas Busch.
CS355 - Theory of Computation Lecture 2: Mathematical Preliminaries.
Introduction Chapter 0. Three Central Areas 1.Automata 2.Computability 3.Complexity.
1 CSSE 350 Automata, Formal Languages, and Computability.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
CSC312 Automata Theory Lecture # 1 Introduction.
CSCI 4325 / 6339 Theory of Computation Chapter One Zhixiang Chen Department of Computer Science University of Texas-Pan American.
INTRODUCTION TO THE THEORY OF COMPUTATION INTRODUCTION MICHAEL SIPSER, SECOND EDITION 1.
CSC312 Automata Theory Lecture # 2 Languages.
CSC312 Automata Theory Lecture # 2 Languages.
Costas Busch - LSU1 Languages. Costas Busch - LSU2 Language: a set of strings String: a sequence of symbols from some alphabet Example: Strings: cat,
Mathematical Preliminaries Strings and Languages Preliminaries 1.
Week 15 - Wednesday.  What did we talk about last time?  Review first third of course.
1 Chapter 1 Introduction to the Theory of Computation.
Mathematical Preliminaries (Hein 1.1 and 1.2) Sets are collections in which order of elements and duplication of elements do not matter. – {1,a,1,1} =
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2006.
Mathematical Preliminaries. Sets Functions Relations Graphs Proof Techniques.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet:
Fall 2005Costas Busch - RPI1 Mathematical Preliminaries.
Prof. Busch - LSU1 Mathematical Preliminaries. Prof. Busch - LSU2 Mathematical Preliminaries Sets Functions Relations Graphs Proof Techniques.
Basic Structures: Sets, Functions, Sequences, and Sums CSC-2259 Discrete Structures Konstantin Busch - LSU1.
CSC312 Automata Theory Lecture # 1 Introduction.
CSC312 Automata Theory Lecture # 1 Introduction.
1 Theory of Computation 計算理論 2 Instructor: 顏嗣鈞 Web: Time: 2:20-5:10 PM, Tuesday Place: BL 112.
Mathematical Preliminaries
THEORY OF COMPUTATION Komate AMPHAWAN 1. 2.
CS 203: Introduction to Formal Languages and Automata
Models of Computation نظریه زبان ها و ماشین ها Iranai.blog.ir IRANAI.BLOG.ir _
Lecture 2 Overview Topics What I forgot from last lecture Proof techniques continued Alphabets, strings, languages Automata June 2, 2015 CSCE 355 Foundations.
1 Mathematical Preliminaries. 2 Sets Functions Relations Graphs Proof Techniques.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 0 Introduction Some slides are in courtesy of Prof.
Module #3 - Sets 3/2/2016(c) , Michael P. Frank 2. Sets and Set Operations.
Introduction to Graph Theory & its Applications
Chapter 2 1. Chapter Summary Sets (This Slide) The Language of Sets - Sec 2.1 – Lecture 8 Set Operations and Set Identities - Sec 2.2 – Lecture 9 Functions.
Chapter 1 INTRODUCTION TO THE THEORY OF COMPUTATION.
Formal Language & Automata Theory
BCS2143 – Theory of Computer Science
Languages.
Standard Representations of Regular Languages
Languages Prof. Busch - LSU.
Languages Costas Busch - LSU.
Computer Science Department
Elementary Questions about Regular Languages
CSCI-2400 Models of Computation.
Mathematical Preliminaries Strings and Languages
Mathematical Preliminaries
Chapter 1 Introduction to the Theory of Computation
Languages Fall 2018.
CSCE 355 Foundations of Computation
Presentation transcript:

Theoretical Computer Science COMP 335 Fall 2004 Introduction to Theoretical Computer Science COMP 335 Fall 2004 Slides by Costas Busch, Rensselaer Polytechnic Institute, Modified by N. Shiri & G. Grahne, Concordia University Fall 2004 COMP 335

abstract models of computers and computation. This course: A study of abstract models of computers and computation. Why theory, when computer field is so practical? Theory provides concepts and principles, for both hardware and software that help us understand the general nature of the field. Fall 2004 COMP 335

Mathematical Preliminaries Fall 2004 COMP 335

Mathematical Preliminaries Sets Functions Relations Graphs Proof Techniques Fall 2004 COMP 335

SETS A set is a collection of elements We write Fall 2004 COMP 335

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

A = { 1, 2, 3, 4, 5 } 1 2 3 4 5 A U 6 7 8 9 10 Universal Set: all possible elements U = { 1 , … , 10 } Fall 2004 COMP 335

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 } Difference A - B = { 1 } B - A = { 4, 5 } A B 2 4 1 3 5 U 2 3 1 Venn diagrams Fall 2004 COMP 335

A A Complement Universal set = {1, …, 7} 4 A A 6 3 1 2 5 7 A = A Fall 2004 COMP 335

{ even integers } = { odd integers } 1 odd even 5 6 2 4 3 7 Fall 2004 COMP 335

DeMorgan’s Laws A U B = A B U A B = A U B U Fall 2004 COMP 335

Empty, Null Set: = { } S U = S S = S - = S U = Universal Set - S = Fall 2004 COMP 335

Subset A = { 1, 2, 3} B = { 1, 2, 3, 4, 5 } A B U Proper Subset: A B U Fall 2004 COMP 335

Disjoint Sets A = { 1, 2, 3 } B = { 5, 6} A B = U A B Fall 2004 COMP 335

Set Cardinality (set size) For finite sets A = { 2, 5, 7 } |A| = 3 Fall 2004 COMP 335

Powersets A powerset is a set of sets S = { a, b, c } Powerset of S = the set of all the subsets of S 2S = { , {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c} } Observation: | 2S | = 2|S| ( 8 = 23 ) Fall 2004 COMP 335

Generalizes to more than two sets 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 Fall 2004 COMP 335

FUNCTIONS domain range 4 A B f(1) = a a 1 2 b c 3 5 f : A -> B If A = domain then f is a total function otherwise f is a partial function Fall 2004 COMP 335

RELATIONS R = {(x1, y1), (x2, y2), (x3, y3), …} xi R yi e. g. if R = ‘>’: 2 > 1, 3 > 2, 3 > 1 Fall 2004 COMP 335

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 y = x x = y and y = z x = z Fall 2004 COMP 335

Equivalence Classes For an equivalence relation R, we define equivalence class of x [x]R = {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]R = {1, 2} Equivalence class of [3]R = {3, 4} Fall 2004 COMP 335

GRAPHS A directed graph G=〈V, E〉 e b d a c Nodes (Vertices) edge 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) } Fall 2004 COMP 335

Labeled Graph 2 6 e 2 b 1 3 d a 6 5 c Fall 2004 COMP 335

Walk e b d a c Walk is a sequence of adjacent edges (e, d), (d, c), (c, a) Fall 2004 COMP 335

Path e b d a c A path is a walk where no edge is repeated A simple path is a path where no node is repeated Fall 2004 COMP 335

Cycle e base b 3 1 d a 2 c A cycle is a walk from a node (base) to itself A simple cycle: only the base node is repeated Fall 2004 COMP 335

Trees root parent leaf child Trees have no cycles Ordered trees? Fall 2004 COMP 335

root Level 0 Level 1 Height 3 leaf Level 2 Level 3 Fall 2004 COMP 335

PROOF TECHNIQUES Proof by induction Proof by contradiction Fall 2004 COMP 335

Induction We have statements P1, P2, P3, … If we know for some b that P1, P2, …, Pb are true for any k >= b that P1, P2, …, Pk imply Pk+1 Then Every Pi is true, that is, ∀i P(i) Fall 2004 COMP 335

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 Fall 2004 COMP 335

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

Thus, m and n have common factor 2 Contradiction! = n/m 2 m2 = n2 n is even n = 2 k Therefore, n2 is even m is even m = 2 p 2 m2 = 4k2 m2 = 2k2 Thus, m and n have common factor 2 Contradiction! Fall 2004 COMP 335

Pigeon Hole Principle: If n+1 objects are put into n boxes, then at least one box must contain 2 or more objects. Ex: Can show if 5 points are placed inside a square whose sides are 2 cm long  at least one pair of points are at a distance ≤ 2 cm. According to the PHP, if we divide the square into 4, at least two of the points must be in one of these 4 squares. But the length of the diagonals of these squares is 2.  the two points cannot be further apart than 2 cm. Fall 2004 COMP 335

Languages Fall 2004 COMP 335

A language is a set of strings String: A sequence of letters/symbols Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Fall 2004 COMP 335

Alphabets and Strings We will use small alphabets: Strings Fall 2004 COMP 335

String Operations Concatenation Fall 2004 COMP 335

Reverse Fall 2004 COMP 335

String Length Length: Examples: Fall 2004 COMP 335

Length of Concatenation Example: Fall 2004 COMP 335

The Empty String A string with no letters: Observations: Fall 2004 COMP 335

Substring Substring of string: a subsequence of consecutive characters Fall 2004 COMP 335

Prefix and Suffix Prefixes Suffixes prefix suffix Fall 2004 COMP 335

Another Operation Example: Definition: Fall 2004 COMP 335

The * Operation : the set of all possible strings from alphabet COMP 335

The + Operation : the set of all possible strings from alphabet except COMP 335

Languages A language is any subset of Example: Languages: Fall 2004 COMP 335

Note that: Sets Set size Set size String length Fall 2004 COMP 335

Another Example An infinite language Fall 2004 COMP 335

Operations on Languages The usual set operations Complement: Fall 2004 COMP 335

Reverse Definition: Examples: Fall 2004 COMP 335

Concatenation Definition: Example: Fall 2004 COMP 335

Another Operation Definition: Special case: Fall 2004 COMP 335

More Examples Fall 2004 COMP 335

Star-Closure (Kleene *) Definition: Example: Fall 2004 COMP 335

Positive Closure Definition: Fall 2004 COMP 335