350 likes | 388 Views
Explore the methods and madness of automata theory, from finite-state systems to computational complexity. Learn formal proof techniques and delve into central concepts like alphabets and strings.
E N D
Chapter 1 Automata: the Methods & the Madness Angkor Wat, Cambodia
Outline • 1.1 Why Study Automata Theory? • 1.2 Introduction to Formal Proof • 1.3 Additional Forms of Proof • 1.4 Inductive Proofs • 1.5 Central Concepts of Automata Theory
1.1 Why Study Automata Theory? • 1.1.1 Introduction to Automata • Properties of finite-state systems • Having a finite number of states • Entire history cannot be remembered. • Good to implement with a fixed set of resources • Can be modeled by finite automata (FA)
push start off push e t h n t th on start the then 1.1 Why Study Automata Theory? • Example 1.1 --- an FA modeling an on/off switch • Example 1.2 --- an FA modeling recognition of the keyword “then” in a lexical analyzer • The double circles specify the final or “accepting state.”
1.1 Why Study Automata Theory? • 1.1.2 Structural Representation • Two other models (not automaton-like) • Grammar --- processing data with a recursive structure • E.g., grammatical rule E E + E for generating arithmetic expressions • Regular expression --- describing text strings • E.g., UNIX-style regular expression ’[A-Z][a-z]*[ ][A-Z][A-Z]’ describes Ithaca NY, Lafayette IN…
1.1 Why Study Automata Theory? • 1.1.3 Automata and Complexity • What can a computer do? --- Computability: • Studying problems which can be solved by computer, called decidable problems. • Decidability is the main topic in computability.
1.1 Why Study Automata Theory? • 1.1.3 Automata and Complexity • What can a computer do efficiently? --- Computational Complexity: • Studying tractable problems solvable with some slowly growing function (like polynomial) of input size, & intractableproblems solvable with fast growing function (like exponential). • Intractability is the main topic of computational complexity.
1.2 Introduction to Formal Proof • 1.2.0 Concepts --- • Formal proof techniques are indispensable for proving theorems in theory of computation. • Understanding workings of correct programs is equivalent to proving theorems by induction.
1.2 Introduction to Formal Proof • 1.2.1 Deductive Proofs (演繹法) Given facts (e.g. axioms), previous statements Hypothesis deduced statements … conclusion Logic principles • Logic principles: modus ponens (正前律、離斷規則、肯定前件), syllogism (三段論)… • 1.2.2~1.2.4 --- read by yourself
1.2 Introduction to Formal Proof • Modus ponens (正前律、離斷規則、肯定前件) • An example: • If it rains, the sidewalk will be wet. • It rains now. • So the sidewalk is wet. • Syllogism (三段論) (supplemental) • An example: • All humans will die. • Socrates is a human. • So, Socrates will die.
1.3 Additional Forms of Proof • 1.3.0 Some more proof techniques --- • Proofs about sets • Proofs by contradiction • Proofs by counterexamples • 1.3.1~1.3.4 --- read by yourself
1.4 Inductive Proofs (歸納法) • 1.4.1 Induction on Integers • To prove a statement S(n) about an integer n by induction, we do: • Basis --- show S(i) true for a particular basis integeri (0 or 1 usually) • Inductive step--- assume n i (basis integer), show that the statement “if S(n), then S(n + 1)” is true. • 1.4.2~1.4.4 --- read by yourself
1.5 Central Concepts of Automata Theory • 1.5.0 Three basic concepts • Alphabet --- a set of symbols • Strings --- a sequence of symbols from an alphabet • Language --- a set of strings from the same alphabet
1.5 Central Concepts of Automata Theory • 1.5.1 Alphabets • Definition --- An alphabet is a finite, nonempty set of symbols. • Conventional notation --- S
1.5 Central Concepts of Automata Theory • 1.5.1 Alphabets • The term “symbol” is usually undefined. • Examples --- • Binary alphabet S = {0, 1}. • S = {a, b, …, z} …
1.5 Central Concepts of Automata Theory • 1.5.2 Strings • Definition --- A string (or word) is a finite sequence of symbols from an alphabet. • Example --- • 1011 is a string from alphabet S = {0, 1}
1.5 Central Concepts of Automata Theory • 1.5.2 Strings • Empty string e--- a string with zero occurrences of symbols • Length |w| of string w --- the number of positions for symbols in w • Examples --- |0111|=4, |e|=0, …
1.5 Central Concepts of Automata Theory • 1.5.2 Strings • Power of an alphabet Sk --- a set of all strings of length k • Examples --- • givenS= {0, 1}, we have • S0 = {e}, S2 = {00, 01, 10, 11} • Supplemental --- 10 = e, (01)0 = e, …
1.5 Central Concepts of Automata Theory • 1.5.2 Strings • Set of all strings over S --- denoted as S* • It is not difficult to know that S* = S0 ∪S1 ∪S2 ∪…
1.5 Central Concepts of Automata Theory • 1.5.2 Strings • S+ = set of nonempty strings from S = S* {e} • Therefore, we have • S+ = S1 ∪S2 ∪S3 ∪… • S* = S+ ∪{e}
1.5 Central Concepts of Automata Theory • 1.5.2 Strings • Concatenation of two strings x and y --- xy • Example --- • if x = 01101, y = 110, then xy = 01101110, xx = x2= 0110101101, … • e is the identity for concatenation since ew = we = w.
1.5 Central Concepts of Automata Theory • 1.5.2 Strings (supplemental) • Powerof a string --- • Defined by concatenation --- • xi = xx…x (x concatenated i times) • Defined by recursion --- • x0 = e (by definition) • xi = xxi-1
1.5 Central Concepts of Automata Theory • 1.5.3 Languages • Definition --- a language is a set of strings all chosen from some S* • If S is an alphabet, and LS*, then L is a language over S.
1.5 Central Concepts of Automata Theory • 1.5.3 Languages • Examples --- • The set of all legal English words is a language. Why? What is the alphabet here? Answer: the set of all letters • A legal program of C is a language. Why? What is the alphabet here? Answer: a subset of the ASCII characters.
1.5 Central Concepts of Automata Theory • 1.5.3 Languages • More examples of languages --- • The set of all strings of n 0’s followed by n 1’s for n 0: {e, 01, 0011, 000111, …} • S* is aninfinite language for any alphabet S.
1.5 Central Concepts of Automata Theory • 1.5.3 Languages • More examples of languages (cont’d) --- • = the empty language (not the empty string e) is a language over any alphabet. • {e} is a language over any alphabet (consisting of only one string, the empty string e).
1.5 Central Concepts of Automata Theory • 1.5.3 Languages • Ways to describe languages (1/3) --- • Description by exhaustive listing --- • L1 = {a, ab, abc} (finite language; listed one by one) • L2 = {a, ab, abb, abbb, ...} (infinite language; listed partially) • L3 = L(ab*) (infinite language; expressed by a regular expression)
1.5 Central Concepts of Automata Theory • 1.5.3 Languages • Ways to define languages (2/3) --- • Description by generic elements --- • L4 = {x | x is over V = {a, b}, begins with a, followed by any number of b, possible none} (note: L4 = L3 = L2)
1.5 Central Concepts of Automata Theory • 1.5.3 Languages • Ways to define languages (3/3) --- • Description by integer parameters --- • L5 = {abn | n 0} (note: L5 = L4 = L3 = L2) *** bn = power of a symbol
1.5 Central Concepts of Automata Theory • 1.5.3a Operations on Languages (supplemental)(1/2) • Languages are sets, and operations of sets may be applied to them: (1) union --- A∪B = {a | aA or aB} (2) intersection --- A∩B = {a | aA and aB} (3) difference --- AB = {a | aA and aB}
1.5 Central Concepts of Automata Theory • 1.5.3a Operations on Languages (supplemental)(2/2) • Languages are sets, and operations of sets may be applied to them: (4) product --- AB = {(a, b) | aA and bB} (5) complement --- Ā= {a | aU and aA} (6) power set --- 2A = {B | BA} Note:Uis the universal set, like S*which is the closure of an alphabet
1.5 Central Concepts of Automata Theory • 1.5.3b More Operations on Languages (supplemental)(1/2) • Concatenation of two languages L1 and L2 --- • L1L2 = {x1x2 | x1 L1 and x2 L2} • Power of a language L --- • Defined directly --- • Lk = {x1x2…xk | x1, x2, …, xkL} • Defined by recursion --- • L0 = {e} • Li= LLi-1
1.5 Central Concepts of Automata Theory • 1.5.3b More Operations on Languages (supplemental)(2/2) • Closure of language L --- • L* = = L0 ∪L1 ∪L2 ∪… • Positive closure of a language L --- • L+ = L1 ∪L2 ∪… • It can be shown that L* L0 = L* – {e} when e L
1.5 Central Concepts of Automata Theory • 1.5.4 Problems • A problem in automata theory --- a question of deciding whether a given string is a member of some particular language. • That is, if S is an alphabet, and L is a language over S, the problem L is: given a string w in S*, decide ifw L or not.