1 Chapter 1 Automata: the Methods & the Madness Angkor Wat, Cambodia.

Slides:



Advertisements
Similar presentations
Chapter 2 Revision of Mathematical Notations and Techniques
Advertisements

Lecture 24 MAS 714 Hartmut Klauck
Properties of Regular Languages
1 Lecture 32 Closure Properties for CFL’s –Kleene Closure construction examples proof of correctness –Others covered less thoroughly in lecture union,
COMP-421 Compiler Design Presented by Dr Ioanna Dionysiou.
1 Languages. 2 A language is a set of strings String: A sequence of letters Examples: “cat”, “dog”, “house”, … Defined over an alphabet: Languages.
CS21 Decidability and Tractability
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
Regular Languages Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 3 Comments, additions and modifications.
Deterministic FA/ PDA Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 4 Updated by Marek Perkowski.
Regular Languages Sequential Machine Theory Prof. K. J. Hintz Department of Electrical and Computer Engineering Lecture 3 Comments, additions and modifications.
1 Languages and Finite Automata or how to talk to machines...
CS5371 Theory of Computation Lecture 1: Mathematics Review I (Basic Terminology)
Normal forms for Context-Free Grammars
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
Topics Automata Theory Grammars and Languages Complexities
1 Regular Expressions/Languages Regular languages –Inductive definitions –Regular expressions syntax semantics Not covered in lecture.
1 A Single Final State for Finite Accepters. 2 Observation Any Finite Accepter (NFA or DFA) can be converted to an equivalent NFA with a single final.
Finite State Machines Data Structures and Algorithms for Information Processing 1.
Lecture 1 String and Language. String string is a finite sequence of symbols. For example, string ( s, t, r, i, n, g) CS4384 ( C, S, 4, 3, 8) (1,
1 Introduction to Automata Theory Reading: Chapter 1.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
CS/IT 138 THEORY OF COMPUTATION Chapter 1 Introduction to the Theory of Computation.
DECIDABILITY OF PRESBURGER ARITHMETIC USING FINITE AUTOMATA Presented by : Shubha Jain Reference : Paper by Alexandre Boudet and Hubert Comon.
AUTOMATA THEORY Reference Introduction to Automata Theory Languages and Computation Hopcraft, Ullman and Motwani.
Lecture Two: Formal Languages Formal Languages, Lecture 2, slide 1 Amjad Ali.
1 Strings and Languages. 2 Review Sets and sequences Functions and relations Graphs Boolean logic:      Proof techniques: – Construction, Contradiction,
By: Er. Sukhwinder kaur.  What is Automata Theory? What is Automata Theory?  Alphabet and Strings Alphabet and Strings  Empty String Empty String 
Introduction to CS Theory Lecture 3 – Regular Languages Piotr Faliszewski
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
Lecture # 3 Chapter #3: Lexical Analysis. Role of Lexical Analyzer It is the first phase of compiler Its main task is to read the input characters and.
1 INFO 2950 Prof. Carla Gomes Module Modeling Computation: Language Recognition Rosen, Chapter 12.4.
1 Chapter 1 Introduction to the Theory of Computation.
1 Chapter 2 Finite Automata (part b) Windmills in Holland.
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} =
Learning Automata and Grammars Peter Černo.  The problem of learning or inferring automata and grammars has been studied for decades and has connections.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2006.
CS 103 Discrete Structures Lecture 10 Basic Structures: Sets (1)
1 Module 14 Regular languages –Inductive definitions –Regular expressions syntax semantics.
Theory of Computation, Feodor F. Dragan, Kent State University 1 TheoryofComputation Spring, 2015 (Feodor F. Dragan) Department of Computer Science Kent.
Complexity and Computability Theory I Lecture #2 Rina Zviel-Girshin Leah Epstein Winter
Mathematical Preliminaries
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 2 Mälardalen University 2010.
CS 203: Introduction to Formal Languages and Automata
CS 208: Computing Theory Assoc. Prof. Dr. Brahim Hnich Faculty of Computer Sciences Izmir University of Economics.
Classifications LanguageGrammarAutomaton Regular, right- linear Right-linear, left-linear DFA, NFA Context-free PDA Context- sensitive LBA Recursively.
UNIT - I Formal Language and Regular Expressions: Languages Definition regular expressions Regular sets identity rules. Finite Automata: DFA NFA NFA with.
Introduction to Automata Theory
Introduction Why do we study Theory of Computation ?
Finite Automata Great Theoretical Ideas In Computer Science Victor Adamchik Danny Sleator CS Spring 2010 Lecture 20Mar 30, 2010Carnegie Mellon.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
1 Chapter 2 Finite Automata (part a) Hokkaido, Japan.
Introduction to Automata Theory
Chapter 1 INTRODUCTION TO THE THEORY OF COMPUTATION.
Topic 3: Automata Theory 1. OutlineOutline Finite state machine, Regular expressions, DFA, NDFA, and their equivalence, Grammars and Chomsky hierarchy.
Introduction to the Theory of Computation
Languages.
Why do we study Theory of Computation ?
CIS Automata and Formal Languages – Pei Wang
Deterministic FA/ PDA Sequential Machine Theory Prof. K. J. Hintz
PROPERTIES OF REGULAR LANGUAGES
CSE 105 theory of computation
Introduction to Automata Theory
Introduction to Finite Automata
Compiler Construction
Chapter 1 Introduction to the Theory of Computation
CSE 105 theory of computation
CSCE 355 Foundations of Computation
CSE 105 theory of computation
Presentation transcript:

1 Chapter 1 Automata: the Methods & the Madness Angkor Wat, Cambodia

Chapter Outline 1.1 Why Study Automata Theory? 1.1 Why Study Automata Theory? 1.2 Introduction to Formal Proof 1.2 Introduction to Formal Proof 1.3 Additional Forms of Proof 1.3 Additional Forms of Proof 1.4 Inductive Proofs 1.4 Inductive Proofs 1.5 Central Concepts of Automata Theory 1.5 Central Concepts of Automata Theory

Chapter Why Study Automata Theory? Introduction to Automata Introduction to Automata Properties of finite-state systems Properties of finite-state systems Having a finite number of states Having a finite number of states Entire history cannot be remembered. Entire history cannot be remembered. Good to implement with a fixed set of resources Good to implement with a fixed set of resources Can be modeled by finite automata (FA) Can be modeled by finite automata (FA)

Chapter Why Study Automata Theory? Example an FA modeling an on/off switch Example an FA modeling an on/off switch Example an FA modeling recognition of the keyword “then” in a lexical analyzer Example an FA modeling recognition of the keyword “then” in a lexical analyzer The double circles specify the final or “accepting state.” The double circles specify the final or “accepting state.” start t t h th e the n then off start on push

Chapter Why Study Automata Theory? Structural Representation Structural Representation Two other models (not automaton-like) Two other models (not automaton-like) Grammar --- processing data with a recursive structure Grammar --- processing data with a recursive structure E.g., grammatical rule E  E + E for generating arithmetic expressions E.g., grammatical rule E  E + E for generating arithmetic expressions Regular expression --- describing text strings Regular expression --- describing text strings E.g., UNIX-style regular expression E.g., UNIX-style regular expression ’[A-Z][a-z]*[ ][A-Z][A-Z]’ describes Ithaca NY, Lafayette IN…

Chapter Why Study Automata Theory? Automata and Complexity Automata and Complexity What can a computer do? --- What can a computer do? --- Computability: Computability: Studying problems which can be solved by computer, called decidable problems. Studying problems which can be solved by computer, called decidable problems. Decidability is the main topic in computability. Decidability is the main topic in computability.

Chapter Why Study Automata Theory? Automata and Complexity Automata and Complexity What can a computer do efficiently? --- What can a computer do efficiently? --- Computational Complexity: Studying tractable problems solvable with some slowly growing function (like polynomial) of input size, & intractable problems solvable with fast growing function (like exponential). Studying tractable problems solvable with some slowly growing function (like polynomial) of input size, & intractable problems solvable with fast growing function (like exponential). Intractability is the main topic of computational complexity. Intractability is the main topic of computational complexity.

Chapter Introduction to Formal Proof Concepts Concepts --- Formal proof techniques are indispensable for proving theorems in theory of computation. Formal proof techniques are indispensable for proving theorems in theory of computation. Understanding workings of correct programs is equivalent to proving theorems by induction. Understanding workings of correct programs is equivalent to proving theorems by induction.

Chapter Introduction to Formal Proof Deductive Proofs ( 演繹法 ) Deductive Proofs ( 演繹法 ) Given facts (e.g. axioms), previous statements Given facts (e.g. axioms), previous statements Hypothesis  deduced statements  …  conclusion Logic principles Logic principles Logic principles: modus ponens ( 正前律、離斷規則、肯定前 件 ), syllogism ( 三段論 )… Logic principles: modus ponens ( 正前律、離斷規則、肯定前 件 ), syllogism ( 三段論 )… 1.2.2~ read by yourself 1.2.2~ read by yourself

Chapter Introduction to Formal Proof Modus ponens ( 正前律、離斷規則、肯定前 件 ) Modus ponens ( 正前律、離斷規則、肯定前 件 ) An example: An example: If it rains, the sidewalk will be wet. If it rains, the sidewalk will be wet. It rains now. It rains now. So the sidewalk is wet. So the sidewalk is wet. Syllogism ( 三段論 ) (supplemental) Syllogism ( 三段論 ) (supplemental) An example: An example: All humans will die. All humans will die. Socrates is a human. Socrates is a human. So, Socrates will die. So, Socrates will die.

Chapter Additional Forms of Proof Some more proof techniques Some more proof techniques --- Proofs about sets Proofs about sets Proofs by contradiction Proofs by contradiction Proofs by counterexamples Proofs by counterexamples 1.3.1~ read by yourself 1.3.1~ read by yourself

Chapter Inductive Proofs ( 歸納法 ) Induction on Integers Induction on Integers To prove a statement S(n) about an integer n by induction, we do: To prove a statement S(n) about an integer n by induction, we do: Basis --- show S(i) true for a particular basis integer i (0 or 1 usually) Basis --- show S(i) true for a particular basis integer i (0 or 1 usually) Inductive step --- assume n  i (basis integer), show that the statement “if S(n), then S(n + 1)” is true. Inductive step --- assume n  i (basis integer), show that the statement “if S(n), then S(n + 1)” is true ~ read by yourself 1.4.2~ read by yourself

Chapter Central Concepts of Automata Theory Three basic concepts Three basic concepts Alphabet --- a set of symbols Alphabet --- a set of symbols Strings --- a sequence of symbols from an alphabet Strings --- a sequence of symbols from an alphabet Language --- a set of strings from the same alphabet Language --- a set of strings from the same alphabet

Chapter Central Concepts of Automata Theory Alphabets Alphabets Definition --- Definition --- An alphabet is a finite, nonempty set of symbols. An alphabet is a finite, nonempty set of symbols. Conventional notation --- Conventional notation --- 

Chapter Central Concepts of Automata Theory Alphabets Alphabets symbol The term “symbol” is usually undefined. Examples --- Binary alphabet   a, b, …, z} …

Chapter Central Concepts of Automata Theory Strings Strings Definition --- Definition --- A string (or word) is a finite sequence of symbols from an alphabet. A string (or word) is a finite sequence of symbols from an alphabet. Example --- Example is a string from alphabet  1011 is a string from alphabet 

Chapter Central Concepts of Automata Theory Strings Strings Empty string  --- a string with zero occurrences of symbols Empty string  --- a string with zero occurrences of symbols Length |w| of string w --- the number of positions for symbols in w Length |w| of string w --- the number of positions for symbols in w Examples --- |0111|=4, |  |=0, … Examples --- |0111|=4, |  |=0, …

Chapter Central Concepts of Automata Theory Strings Strings Power of an alphabet  k  --- Power of an alphabet  k  --- a set of all strings of length k Examples --- Examples --- given    we have given    we have    = {  2 = {00, 01, 10, 11} Supplemental =  (01) 0 =  … Supplemental =  (01) 0 =  …

Chapter Central Concepts of Automata Theory Strings Strings Set of all strings over  --- denoted as   Set of all strings over  --- denoted as   It is not difficult to know that It is not difficult to know that     ∪   ∪   ∪ …

Chapter Central Concepts of Automata Theory Strings Strings    set of nonempty strings from     set of nonempty strings from       Therefore, we have Therefore, we have      ∪   ∪   ∪  …      ∪ 

Chapter Central Concepts of Automata Theory Strings Strings Concatenation of two strings x and y --- xy Concatenation of two strings x and y --- xy Example --- Example --- if x = 01101, y = 110, then if x = 01101, y = 110, then xy = , xx = x  = , … xy = , xx = x  = , …  is the identity for concatenation  is the identity for concatenation since  w = w  w. since  w = w  w.

Chapter Central Concepts of Automata Theory Strings (supplemental) Strings (supplemental) Power of a string --- Power of a string --- Defined by concatenation --- Defined by concatenation --- x i = xx…x (x concatenated i times) x i = xx…x (x concatenated i times) Defined by recursion --- Defined by recursion --- x 0 =  (by definition) x 0 =  (by definition) x i = xx i-1 x i = xx i-1

Chapter Central Concepts of Automata Theory Languages Languages Definition --- Definition --- a language is a set of strings all chosen from some  * If  is an alphabet, and L  *, then L is a language over . If  is an alphabet, and L  *, then L is a language over .

Chapter Central Concepts of Automata Theory Languages Languages Examples --- Examples --- The set of all legal English words is a language. Why? What is the alphabet here? The set of all legal English words is a language. Why? What is the alphabet here? Answer: the set of all letters Answer: the set of all letters A legal program of C is a language. Why? What is the alphabet here? A legal program of C is a language. Why? What is the alphabet here? Answer: a subset of the ASCII characters. Answer: a subset of the ASCII characters.

Chapter Central Concepts of Automata Theory Languages Languages More examples of languages --- More examples of languages --- The set of all strings of n 0’s followed by n 1’s for n  0 : The set of all strings of n 0’s followed by n 1’s for n  0 : { , 01, 0011, , …} { , 01, 0011, , …}  * is an infinite language for any alphabet .  * is an infinite language for any alphabet .

Chapter Central Concepts of Automata Theory Languages Languages More examples of languages (cont’d) --- More examples of languages (cont’d) ---  the empty language (not the empty string  is a language over any alphabet.  the empty language (not the empty string  is a language over any alphabet. {  } is a language over any alphabet (consisting of only one string, the empty string  ). {  } is a language over any alphabet (consisting of only one string, the empty string  ).

Chapter Central Concepts of Automata Theory Languages Languages Ways to describe languages (1/3) --- Ways to describe languages (1/3) --- Description by exhaustive listing --- Description by exhaustive listing --- L1 = {a, ab, abc} (finite language; listed one by one) L1 = {a, ab, abc} (finite language; listed one by one) L2 = {a, ab, abb, abbb,...} (infinite language; listed partially) L2 = {a, ab, abb, abbb,...} (infinite language; listed partially) L3 = L(ab*) (infinite language; expressed by a regular expression) L3 = L(ab*) (infinite language; expressed by a regular expression)

Chapter Central Concepts of Automata Theory Languages Languages Ways to define languages (2/3) --- Ways to define languages (2/3) --- Description by generic elements --- Description by generic elements --- L4 = {x | x is over V = {a, b}, begins with a, followed by any number of b, possible none} L4 = {x | x is over V = {a, b}, begins with a, followed by any number of b, possible none} (note: L4 = L3 = L2) (note: L4 = L3 = L2)

Chapter Central Concepts of Automata Theory Languages Languages Ways to define languages (3/3) --- Ways to define languages (3/3) --- Description by integer parameters --- Description by integer parameters --- L5 = {ab n | n  0} L5 = {ab n | n  0} (note: L5 = L4 = L3 = L2) (note: L5 = L4 = L3 = L2) *** b n = power of a symbol

Chapter Central Concepts of Automata Theory 1.5.3a Operations on Languages (supplemental)(1/2) 1.5.3a Operations on Languages (supplemental)(1/2) Languages are sets, and operations of sets may be applied to them: Languages are sets, and operations of sets may be applied to them: (1) union --- A ∪ B = {a | a  A or a  B} (1) union --- A ∪ B = {a | a  A or a  B} (2) intersection --- A∩B = {a | a  A and a  B} (2) intersection --- A∩B = {a | a  A and a  B} (3) difference --- A  B = {a | a  A and a  B} (3) difference --- A  B = {a | a  A and a  B}

Chapter Central Concepts of Automata Theory 1.5.3a Operations on Languages (supplemental)(2/2) 1.5.3a Operations on Languages (supplemental)(2/2) Languages are sets, and operations of sets may be applied to them: Languages are sets, and operations of sets may be applied to them: (4) product --- A  B = {(a, b) | a  A and b  B} (4) product --- A  B = {(a, b) | a  A and b  B} (5) complement --- Ā = {a | a  U and a  A} (5) complement --- Ā = {a | a  U and a  A} (6) power set A = {B | B  A} (6) power set A = {B | B  A} Note: U is the universal set, like    which is the closure of an alphabet Note: U is the universal set, like    which is the closure of an alphabet

Chapter Central Concepts of Automata Theory 1.5.3b More Operations on Languages (supplemental)(1/2) 1.5.3b More Operations on Languages (supplemental)(1/2) Concatenation of two languages L 1 and L Concatenation of two languages L 1 and L L 1 L 2 = {x 1 x 2 | x 1  L 1 and x 2  L 2 } L 1 L 2 = {x 1 x 2 | x 1  L 1 and x 2  L 2 } Power of a language L --- Power of a language L --- Defined directly --- Defined directly --- L k = {x 1 x 2 …x k | x 1, x 2, …, x k  L} L k = {x 1 x 2 …x k | x 1, x 2, …, x k  L} Defined by recursion --- Defined by recursion --- L 0 = {  } L 0 = {  } L i = LL i-1 L i = LL i-1

Chapter Central Concepts of Automata Theory 1.5.3b More Operations on Languages (supplemental)(2/2) 1.5.3b More Operations on Languages (supplemental)(2/2) Closure of language L --- Closure of language L --- L * = = L  ∪ L  ∪ L  ∪ … L * = = L  ∪ L  ∪ L  ∪ … Positive closure of a language L --- Positive closure of a language L --- L + = L  ∪ L  ∪ … L + = L  ∪ L  ∪ … It can be shown that L   L   L  – {  } when  L It can be shown that L   L   L  – {  } when  L

Chapter Central Concepts of Automata Theory Problems Problems A problem in automata theory --- A problem in automata theory --- a question of deciding whether a given string is a member of some particular language. a question of deciding whether a given string is a member of some particular language. That is, if  is an alphabet, and L is a language over , the problem L is: That is, if  is an alphabet, and L is a language over , the problem L is: given a string w in  *, decide if  w  L or not  given a string w in  *, decide if  w  L or not 