# 6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 4 Nancy Lynch

Save this PDF as:

Size: px
Start display at page:

Download "6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, 2010. Class 4 Nancy Lynch"

## Transcription

1 6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, 2010 Class 4 Nancy Lynch

2 Today Two more models of computation: Nondeterministic Finite Automata (NFAs) Add a guessing capability to FAs. But provably equivalent to FAs. Regular expressions A different sort of model---expressions rather than machines. Also provably equivalent. Topics: Nondeterministic Finite Automata and the languages they recognize NFAs vs. FAs Closure of FA-recognizable languages under various operations, revisited Regular expressions Regular expressions denote FA-recognizable languages Reading: Sipser, Sections 1.2, 1.3 Next: Section 1.4

3 Nondeterministic Finite Automata and the languages they recognize

4 Nondeterministic Finite Automata Generalize FAs by adding nondeterminism, allowing several alternative computations on the same input string. Ordinary deterministic FAs follow one path on each input. Two changes: Allow δ(q, a) to specify more than one successor state: a q a Add -transitions, transitions made for free, without consuming any input symbols. q 1 q 2 Formally, combine these changes:

5 Formal Definition of an NFA An NFA is a 5-tuple ( Q, Σ, δ, q 0, F ), where: Q is a finite set of states, Σ is a finite set (alphabet) of input symbols, δ: Q Σ P(Q) is the transition function, The arguments are a state and either an alphabet symbol or. Σ means Σ { }. The result is a set of states. q 0 Q, is the start state, and F Q is the set of accepting, or final states.

6 Formal Definition of an NFA An NFA is a 5-tuple ( Q, Σ, δ, q 0, F ), where: Q is a finite set of states, Σ is a finite set (alphabet) of input symbols, δ: Q Σ P(Q) is the transition function, q 0 Q, is the start state, and F Q is the set of accepting, or final states. How many states in P(Q)? 2 Q Example: Q = { a, b, c } P(Q) = {, {a}, {b}, {c}, {a,b}, {a,c}, {b,c}, {a,b,c} }

7 NFA Example 1 0,1 0 1 a b c Q = { a, b, c } Σ = { 0, 1 } q 0 = a 0 1 F = { c } a {a,b} {a} δ: b {c} c

8 NFA Example 2 0,1 b 0 1 c d a 0 1 a {a} {a} {b,c} b {c} c {d} d e {f} f {g} g 1 0 e f g

9 Nondeterministic Finite Automata NFAs are like DFAs with two additions: Allow δ(q, a) to specify more than one successor state. Add -transitions. Formally, an NFA is a 5-tuple ( Q, Σ, δ, q 0, F ), where: Q is a finite set of states, Σ is a finite set (alphabet) of input symbols, δ: Q Σ P(Q) is the transition function, Σ means Σ { }. q 0 Q, is the start state, and F Q is the set of accepting, or final states.

10 Example 1: NFA Examples 0,1 a 0 1 b c Example 2: 0,1 b 0 1 c d a 1 0 e f g

11 Informally: How NFAs compute Follow allowed arrows in any possible way, while consuming the designated input symbols. Optionally follow any arrow at any time, without consuming any input. Accepts a string if some allowed sequence of transitions on that string leads to an accepting state.

12 Example 1 0,1 a 0 1 b c L(M) = { w w ends with 01 } M accepts exactly the strings in this set. Computations for input word w = 101: Input word w: States: a a a a Or: a a b c Since c is an accepting state, M accepts 101

13 Example 1 0,1 a 0 1 b c Computations for input word w = 0010: Possible states after 0: { a, b } Then after another 0: { a, b } After 1: { a, c } After final 0: { a, b } Since neither a nor b is accepting, M does not accept { a } Æ { a, b } Æ { a, b } Æ { a, c } Æ { a, b } 1

14 Example 2 0,1 b 0 1 c d a 1 0 e f g L(M) = { w w ends with 01 or 10 } Computations for w = 0010: Possible states after no input: { a, b, e } After 0: { a, b, e, c } After 0: { a, b, e, c } After 1: { a, b, e, d, f } After 0: { a, b, e, c, g } Since g is accepting, M accepts { a, b, e } Æ { a, b, e, c } Æ { a, b, e, c} Æ { a, b, e, d, f } Æ { a, b, e, c, g }

15 Example 2 0,1 b 0 1 c d a 1 0 e f g Computations for w = 0010: 0 0 { a, b, e } Æ { a, b, e, c } Æ { a, b, e, c } 1 0 Æ { a, b, e, d, f } Æ { a, b, e, c, g } Path to accepting state: a Æ a Æ a Æ e Æ f Æ g

16 Viewing computations as a tree 0, 1 a b 0 1 c d 1 0 e f g In general, accept if there is a path labeled by the entire input string, possibly interspersed with s, leading to an accepting state. Here, leads to accepting state d. b a 1 e Input w = 01 b a 0 Stuck: No moves on or 1 e f 1 a b 0 c d 1 e Stuck: No moves on or 0 Done, accept

17 Formal definition of computation Define E(q) = set of states reachable from q using zero or more -moves (includes q itself). Example 2: E(a) = { a, b, e } Define δ*: Q Σ* P(Q), state and string yield a set of states: δ*( q, w ) = states that can be reached from q by following w. Defined iteratively: Compute δ*( q, a 1 a 2 a k ) by: S : = E(q) for i = 1 to k do S := r δ( r, ai) for some r in S E(r ) Or define recursively, LTTR.

18 Formal definition of computation δ*( q, w ) = states that can be reached from q by following w. String w is accepted if δ*( q 0, w ) F, that is, at least one of the possible end states is accepting. String w is rejected if it isn t accepted. L(M), the language recognized by NFA M, = { w w is accepted by M}.

19 NFAs vs. FAs

20 NFAs vs. DFAs DFA = Deterministic Finite Automaton, new name for ordinary Finite Automata (FA). To emphasize the difference from NFAs. What languages are recognized by NFAs? Since DFAs are special cases of NFAs, NFAs recognize at least the DFA-recognizable (regular) languages. Nothing else! Theorem: If M is an NFA then L(M) is DFA-recognizable. Proof: Given NFA M 1 = ( Q 1, Σ, δ 1, q 01, F 1 ), produce an equivalent DFA M 2 = ( Q 2, Σ, δ 2, q 02, F 2 ). Equivalent means they recognize the same language, L(M 2 ) = L(M 1 ). Each state of M 2 represents a set of states of M 1 : Q 2 = P(Q 1 ). Start state of M 2 is E(start state of M 1 ) = all states M 1 could be in after scanning : q 02 = E(q 01 ).

21 NFAs vs. DFAs Theorem: If M is an NFA then L(M) is DFArecognizable. Proof: Given NFA M 1 = ( Q 1, Σ, δ 1, q 01, F 1 ), produce an equivalent DFA M 2 = ( Q 2, Σ, δ 2, q 02, F 2 ). Q 2 = P(Q 1 ) q 02 = E(q 01 ) F 2 = { S Q 1 S F 1 } Accepting states of M 2 are the sets that contain an accepting state of M 1. δ 2 ( S, a ) = r S E( δ 1 ( r, a ) ) Starting from states in S, δ 2 ( S, a ) gives all states M 1 could reach after a and possibly some -transitions. M 2 recognizes L(M 1 ): At any point in processing the string, the state of M 2 represents exactly the set of states that M 1 could be in.

22 Example: NFA Æ DFA M 1 : 0,1 0 1 a b c States of M 2 :, {a}, {b}, {c}, {a,b}, {a,c}, {b,c}, {a,b,c} 1 0 δ 2 : {a} 0 1 {a,b} {a,c} Other 5 subsets aren t reachable from start state, don t bother drawing them. 0 1 F 2

23 NFAs vs. DFAs NFAs and DFAs have the same power. But sometimes NFAs are simpler than equivalent DFAs. Example: L = strings ending in 01 or 10 Simple NFA, harder DFA (LTTR) Example: L = strings having substring 101 Recall DFA: 0 1 0,1 NFA: a b c d 0, ,1 Simpler---has the power to guess when to start matching.

24 NFAs vs. DFAs Which brings us back to last time. We got stuck in the proof of closure for DFA languages under concatenation: Example: L = { 0, 1 }* { 0 } { 0 }* 0,1 0 0 NFA can guess when the critical 0 occurs.

25 Closure of regular (FA- recognizable) languages under various operations, revisited

26 Closure under operations The last example suggests we retry proofs of closure of FA languages under concatenation and star, this time using NFAs. OK since they have the same expressive power (recognize the same languages) as DFAs. We already proved closure under common settheoretic operations---union, intersection, complement, difference---using DFAs. Got stuck on concatenation and star. First (warmup): Redo union proof in terms of NFAs.

27 Closure under union Theorem: FA-recognizable languages are closed under union. Old Proof: Start with DFAs M 1 and M 2 for the same alphabet Σ. Get another DFA, M 3, with L(M 3 ) = L(M 1 ) L(M 2 ). Idea: Run M 1 and M 2 in parallel on the same input. If either reaches an accepting state, accept.

28 Closure under union Example: M 1 : Substring ,1 0 a b c 1 M 2 : Odd number of 1s M 3 : ad bd 1 cd ae be ce 1 d 1 1 e

29 Closure under union, general rule Assume: M 1 = ( Q 1, Σ, δ 1, q 01, F 1 ) M 2 = ( Q 2, Σ, δ 2, q 02, F 2 ) Define M 3 = ( Q 3, Σ, δ 3, q 03, F 3 ), where Q 3 =Q 1 Q 2 Cartesian product, {(q 1,q 2 ) q 1 Q 1 and q 2 Q 2 } δ 3 ((q 1,q 2 ), a) = (δ 1 (q 1, a), δ 2 (q 2, a)) q 03 = (q 01, q 02 ) F 3 ={ (q 1,q 2 ) q 1 F 1 or q 2 F 2 }

30 Closure under union Theorem: FA-recognizable languages are closed under union. New Proof: Start with NFAs M 1 and M 2. Get another NFA, M 3, with L(M 3 ) = L(M 1 ) L(M 2 ). M 1 Use final states from M 1 and M 2. Add new start state M 2

31 Closure under union Theorem: FA-recognizable languages are closed under union. New Proof: Simpler! Intersection: NFAs don t seem to help. Concatenation, star: Now try NFA-based constructions.

32 Closure under concatenation L 1 L 2 = { x y x L 1 and y L 2 } Theorem: FA-recognizable languages are closed under concatenation. Proof: Start with NFAs M 1 and M 2. Get another NFA, M 3, with L(M 3 ) = L(M 1 ) L(M 2 ). M 1 M 2 These are no longer final states. These are still final states.

33 Closure under concatenation Example: Σ = { 0, 1}, L 1 = Σ*, L 2 = {0} {0}*. L 1 L 2 = strings that end with a block of at least one 0 M 1 : M 2 : 0,1 NFAs 0 0 Now combine: 0,1 0 0

34 Closure under star L* = { x x = y 1 y 2 y k for some k 0, every y in L } = L 0 L 1 L 2 Theorem: FA-recognizable languages are closed under star. Proof: Start with FA M 1. Get an NFA, M 2, with L(M 2 ) = L(M 1 )*. M 1 Use final states from M 1 and M 2. Add new start state; it s also a final state, since is in L(M 1 )*.

35 Closure under star Example: Σ = { 0, 1}, L 1 = { 01, 10 } (L 1 )* = even-length strings where each pair consists of a 0 and a 1. M 1 : Construct M 2 :

36 Closure, summary FA-recognizable (regular) languages are closed under set operations, concatenation, and star. Regular operations: Union, concatenation, and star. Can be used to build regular expressions, which denote languages. E.g., regular expression ( 0 1 )* 0 0* denotes the language { 0, 1 }* {0} {0}* Study these next

37 Regular Expressions

38 Regular expressions An algebraic-expression notation for describing (some) languages, rather than a machine representation. Languages described by regular expressions are exactly the FA-recognizable languages. That s why FA-recognizable languages are called regular. Definition: R is a regular expression over alphabet Σ exactly if R is one of the following: a, for some a in Σ,,, ( R 1 R 2 ), where R 1 and R 2 are smaller regular expressions, ( R 1 R 2 ), where R 1 and R 2 are smaller regular expressions, or ( R 1 * ), where R 1 is a smaller regular expression. A recursive definition.

39 Regular expressions Definition: R is a regular expression over alphabet Σ exactly if R is one of the following: a, for some a in Σ,,, ( R 1 R 2 ), where R 1 and R 2 are smaller regular expressions, ( R 1 R 2 ), where R 1 and R 2 are smaller regular expressions, or ( R 1 * ), where R 1 is a smaller regular expression. These are just formal expressions---we haven t said yet what they mean. Example: ( ( ( 0 1 ) )* 0 ) Abbreviations: Sometimes omit, use juxtaposition. Sometimes omit parens, use precedence of operations: * highest, then, then. Example: Abbreviate above as ( ( 0 1 ) )* 0 Example: ( 0 1 )* 111 ( 0 1 )*

40 How regular expressions denote languages Define the languages recursively, based on the expression structure: Definition: L(a) = { a }; one string, with one symbol a. L() = { }; one string, with no symbols. L( ) = ; no strings. L( R 1 R 2 ) = L( R 1 ) L( R 2 ) L( R 1 R 2 ) = L( R 1 ) L( R 2 ) L( R 1 * ) = ( L(R 1 ) )* Example: Expression ( ( 0 1 ) )* 0 denotes language { 0, 1 }* { 0 } = { 0, 1 }*, all strings. Example: ( 0 1 )* 111 ( 0 1 )* denotes { 0, 1 }* { 111 } { 0, 1 }*, all strings with substring 111.

41 More examples Definition: L(a) = { a }; one string, with one symbol a. L() = { }; one string, with no symbols. L( ) = ; no strings. L( R 1 R 2 ) = L( R 1 ) L( R 2 ) L( R 1 R 2 ) = L( R 1 ) L( R 2 ) L( R 1 * ) = ( L(R 1 ) )* Example: L = strings over { 0, 1 } with odd number of 1s. 0* 1 0* ( 0* 1 0* 1 0* )* Example: L = strings with substring 01 or 10. ( 0 1 )* 01 ( 0 1 )* ( 0 1 )* 10 ( 0 1 )* Abbreviate (writing Σ for ( 0 1 )): Σ* 01 Σ* Σ* 10 Σ*

42 More examples Example: L = strings with substring 01 or 10. ( 0 1 )* 01 ( 0 1 )* ( 0 1 )* 10 ( 0 1 )* Abbreviate: Σ* 01 Σ* Σ* 10 Σ* Example: L = strings with neither substring 01 or 10. Can t write complement. But can write: 0* 1*. Example: L = strings with no more than two consecutive 0s or two consecutive 1s Would be easy if we could write complement. ( 1 11 ) (( 0 00 ) (1 11 ) )* ( 0 00 ) Alternate one or two of each.

43 More examples Regular expressions commonly used to specify syntax. For (portions of) programming languages Editors Command languages like UNIX shell Example: Decimal numbers D D*. D* D*. D D*, where D is the alphabet { 0,, 9 } Need a digit either before or after the decimal point.

44 Regular Expressions Denote FA-Recognizable Languages

45 Languages denoted by regular expressions The languages denoted by regular expressions are exactly the regular (FA-recognizable) languages. Theorem 1: If R is a regular expression, then L(R) is a regular language (recognized by a FA). Proof: Easy. Theorem 2: If L is a regular language, then there is a regular expression R with L = L(R). Proof: Harder, more technical.

46 Theorem 1 Theorem 1: If R is a regular expression, then L(R) is a regular language (recognized by a FA). Proof: For each R, define an NFA M with L(M) = L(R). Proceed by induction on the structure of R: Show for the three base cases. Show how to construct NFAs for more complex expressions from NFAs for their subexpressions. Case 1: R = a a L(R) = { a } Accepts only a. Case 2: R = L(R) = { }. Accepts only

47 Theorem 1 Theorem 1: If R is a regular expression, then L(R) is a regular language (recognized by a FA). Proof: Case 3: R = L(R) = Accepts nothing. Case 4: R = R 1 R 2 M 1 recognizes L(R 1 ), M 1 M 2 recognizes L(R 2 ). Same construction we used to show regular languages are closed under M 2 union.

48 Theorem 1 Theorem 1: If R is a regular expression, then L(R) is a regular language (recognized by a FA). Proof: Case 5: R = R 1 R 2 M 1 recognizes L(R 1 ), M 2 recognizes L(R 2 ). Same construction we used to show regular languages are closed under concatenation. M 1 M 2

49 Theorem 1 Theorem 1: If R is a regular expression, then L(R) is a regular language (recognized by a FA). Proof: Case 6: R = (R 1 )* M 1 recognizes L(R 1 ), Same construction we used to show regular languages are closed under star. M 1

50 Example for Theorem 1 L = ab a* Construct machines recursively: a: a b: b ab: a b a*: a a b ab a*: a

51 Theorem 2 Theorem 2: If L is a regular language, then there is a regular expression R with L = L(R). Proof: For each NFA M, define a regular expression R with L(R) = L(M). Show with an example: b a a a x y z Convert to a special form with only one final state, no incoming arrows to start state, no outgoing arrows from final state. b b q 0 b a a a b x y z q f b

52 Theorem 2 b a a a b q 0 x y z q f b Now remove states one at a time (any order), replacing labels of edges with more complicated regular expressions. First remove z: q 0 b a a b a* x y q f b New label b a* describes all strings that can move the machine from state y to state q f, visiting (just) z any number of times.

53 Theorem 2 q 0 b a a b a* x b y q f Then remove x: q 0 b*a a bb* a y b a* q f New label b*a describes all strings that can move the machine from q 0 to y, visiting (just) x any number of times. New label a bb* a describes all strings that can move the machine from y to y, visiting (just) x any number of times.

54 Theorem 2 q 0 a bb* a b*a b a* y q f Finally, remove y: b*a (a bb* a)* b a* q 0 q f New label describes all strings that can move the machine from q 0 to q f, visiting (just) y any number of times. This final label is the needed regular expression.

55 Theorem 2 Define a generalized NFA (gnfa). Same as NFA, but: Only one accept state, start state. Start state has no incoming arrows, accept state no outgoing arrows. Arrows are labeled with regular expressions. How it computes: Follow an arrow labeled with a regular expression R while consuming a block of input that is a word in the language L(R). Convert the original NFA M to a gnfa. Successively transform the gnfa to equivalent gnfas (recognize same language), each time removing one state. When we have 2 states and one arrow, the regular expression R on the arrow is the final answer: R q 0 q f

56 Theorem 2 To remove a state x, consider every pair of other states, y and z, including y = z. New label for edge (y, z) is the union of two expressions: What was there before, and One for paths through (just) x. If y z: y z we get: y z S U R x T R SU*T If y = z: R U R SU*T S y x y T

57 Next time Existence of non-regular languages Showing specific languages aren t regular The Pumping Lemma Algorithms that answer questions about FAs. Reading: Sipser, Section 1.4; some pieces from 4.1

58 MIT OpenCourseWare J / J Automata, Computability, and Complexity Spring 2011 For information about citing these materials or our Terms of Use, visit:

### Automata and Languages

Automata and Languages Computational Models: An idealized mathematical model of a computer. A computational model may be accurate in some ways but not in others. We shall be defining increasingly powerful

### Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Formal Languages and Automata Theory - Regular Expressions and Finite Automata - Samarjit Chakraborty Computer Engineering and Networks Laboratory Swiss Federal Institute of Technology (ETH) Zürich March

### Automata and Computability. Solutions to Exercises

Automata and Computability Solutions to Exercises Fall 25 Alexis Maciel Department of Computer Science Clarkson University Copyright c 25 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata

### C H A P T E R Regular Expressions regular expression

7 CHAPTER Regular Expressions Most programmers and other power-users of computer systems have used tools that match text patterns. You may have used a Web search engine with a pattern like travel cancun

### Finite Automata. Reading: Chapter 2

Finite Automata Reading: Chapter 2 1 Finite Automaton (FA) Informally, a state diagram that comprehensively captures all possible states and transitions that a machine can take while responding to a stream

### CS154. Turing Machines. Turing Machine. Turing Machines versus DFAs FINITE STATE CONTROL AI N P U T INFINITE TAPE. read write move.

CS54 Turing Machines Turing Machine q 0 AI N P U T IN TAPE read write move read write move Language = {0} q This Turing machine recognizes the language {0} Turing Machines versus DFAs TM can both write

### Automata and Formal Languages

Automata and Formal Languages Winter 2009-2010 Yacov Hel-Or 1 What this course is all about This course is about mathematical models of computation We ll study different machine models (finite automata,

### Finite Automata. Reading: Chapter 2

Finite Automata Reading: Chapter 2 1 Finite Automata Informally, a state machine that comprehensively captures all possible states and transitions that a machine can take while responding to a stream (or

### Regular Expressions and Automata using Haskell

Regular Expressions and Automata using Haskell Simon Thompson Computing Laboratory University of Kent at Canterbury January 2000 Contents 1 Introduction 2 2 Regular Expressions 2 3 Matching regular expressions

### FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION REDUCIBILITY ( LECTURE 16) SLIDES FOR 15-453 SPRING 2011 1 / 20 THE LANDSCAPE OF THE CHOMSKY HIERARCHY ( LECTURE 16) SLIDES FOR 15-453 SPRING 2011 2 / 20 REDUCIBILITY

### Scanner. tokens scanner parser IR. source code. errors

Scanner source code tokens scanner parser IR errors maps characters into tokens the basic unit of syntax x = x + y; becomes = + ; character string value for a token is a lexeme

### Reading 13 : Finite State Automata and Regular Expressions

CS/Math 24: Introduction to Discrete Mathematics Fall 25 Reading 3 : Finite State Automata and Regular Expressions Instructors: Beck Hasti, Gautam Prakriya In this reading we study a mathematical model

### Regular Languages and Finite State Machines

Regular Languages and Finite State Machines Plan for the Day: Mathematical preliminaries - some review One application formal definition of finite automata Examples 1 Sets A set is an unordered collection

### 3515ICT Theory of Computation Turing Machines

Griffith University 3515ICT Theory of Computation Turing Machines (Based loosely on slides by Harald Søndergaard of The University of Melbourne) 9-0 Overview Turing machines: a general model of computation

### Turing Machines: An Introduction

CIT 596 Theory of Computation 1 We have seen several abstract models of computing devices: Deterministic Finite Automata, Nondeterministic Finite Automata, Nondeterministic Finite Automata with ɛ-transitions,

### Deterministic Finite Automata

1 Deterministic Finite Automata Definition: A deterministic finite automaton (DFA) consists of 1. a finite set of states (often denoted Q) 2. a finite set Σ of symbols (alphabet) 3. a transition function

### Automata on Infinite Words and Trees

Automata on Infinite Words and Trees Course notes for the course Automata on Infinite Words and Trees given by Dr. Meghyn Bienvenu at Universität Bremen in the 2009-2010 winter semester Last modified:

### CS 3719 (Theory of Computation and Algorithms) Lecture 4

CS 3719 (Theory of Computation and Algorithms) Lecture 4 Antonina Kolokolova January 18, 2012 1 Undecidable languages 1.1 Church-Turing thesis Let s recap how it all started. In 1990, Hilbert stated a

### (IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems.

3130CIT: Theory of Computation Turing machines and undecidability (IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems. An undecidable problem

### CMPSCI 250: Introduction to Computation. Lecture #19: Regular Expressions and Their Languages David Mix Barrington 11 April 2013

CMPSCI 250: Introduction to Computation Lecture #19: Regular Expressions and Their Languages David Mix Barrington 11 April 2013 Regular Expressions and Their Languages Alphabets, Strings and Languages

### Finite Automata and Regular Languages

CHAPTER 3 Finite Automata and Regular Languages 3. Introduction 3.. States and Automata A finite-state machine or finite automaton (the noun comes from the Greek; the singular is automaton, the Greek-derived

CS5236 Advanced Automata Theory Frank Stephan Semester I, Academic Year 2012-2013 Advanced Automata Theory is a lecture which will first review the basics of formal languages and automata theory and then

### Genetic programming with regular expressions

Genetic programming with regular expressions Børge Svingen Chief Technology Officer, Open AdExchange bsvingen@openadex.com 2009-03-23 Pattern discovery Pattern discovery: Recognizing patterns that characterize

### Regular Languages and Finite Automata

Regular Languages and Finite Automata 1 Introduction Hing Leung Department of Computer Science New Mexico State University Sep 16, 2010 In 1943, McCulloch and Pitts [4] published a pioneering work on a

### ω-automata Automata that accept (or reject) words of infinite length. Languages of infinite words appear:

ω-automata ω-automata Automata that accept (or reject) words of infinite length. Languages of infinite words appear: in verification, as encodings of non-terminating executions of a program. in arithmetic,

### Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy

Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy Kim S. Larsen Odense University Abstract For many years, regular expressions with back referencing have been used in a variety

### Finite Automata and Formal Languages

Finite Automata and Formal Languages TMV026/DIT321 LP4 2011 Lecture 14 May 19th 2011 Overview of today s lecture: Turing Machines Push-down Automata Overview of the Course Undecidable and Intractable Problems

### Motivation. Automata = abstract computing devices. Turing studied Turing Machines (= computers) before there were any real computers

Motivation Automata = abstract computing devices Turing studied Turing Machines (= computers) before there were any real computers We will also look at simpler devices than Turing machines (Finite State

### Lecture I FINITE AUTOMATA

1. Regular Sets and DFA Lecture I Page 1 Lecture I FINITE AUTOMATA Lecture 1: Honors Theory, Spring 02, Yap We introduce finite automata (deterministic and nondeterministic) and regular languages. Some

### Compiler Construction

Compiler Construction Regular expressions Scanning Görel Hedin Reviderad 2013 01 23.a 2013 Compiler Construction 2013 F02-1 Compiler overview source code lexical analysis tokens intermediate code generation

### CS103B Handout 17 Winter 2007 February 26, 2007 Languages and Regular Expressions

CS103B Handout 17 Winter 2007 February 26, 2007 Languages and Regular Expressions Theory of Formal Languages In the English language, we distinguish between three different identities: letter, word, sentence.

### Deterministic Push-Down Store Automata

Deterministic Push-Down tore Automata 1 Context-Free Languages A B C D... A w 0 w 1 D...E The languagea n b n : a b ab 2 Finite-tate Automata 3 Pushdown Automata Pushdown automata (pda s) is an fsa with

### Theory of Computation

Theory of Computation For Computer Science & Information Technology By www.thegateacademy.com Syllabus Syllabus for Theory of Computation Regular Expressions and Finite Automata, Context-Free Grammar s

### Pushdown Automata. place the input head on the leftmost input symbol. while symbol read = b and pile contains discs advance head remove disc from pile

Pushdown Automata In the last section we found that restricting the computational power of computing devices produced solvable decision problems for the class of sets accepted by finite automata. But along

### Solutions to Exercises 8

Discrete Mathematics Lent 2009 MA210 Solutions to Exercises 8 (1) Suppose that G is a graph in which every vertex has degree at least k, where k 1, and in which every cycle contains at least 4 vertices.

### Applications of Methods of Proof

CHAPTER 4 Applications of Methods of Proof 1. Set Operations 1.1. Set Operations. The set-theoretic operations, intersection, union, and complementation, defined in Chapter 1.1 Introduction to Sets are

### Regular Expressions. Languages. Recall. A language is a set of strings made up of symbols from a given alphabet. Computer Science Theory 2

Regular Expressions Languages Recall. A language is a set of strings made up of symbols from a given alphabet. Computer Science Theory 2 1 String Recognition Machine Given a string and a definition of

### Lecture 2: Regular Languages [Fa 14]

Caveat lector: This is the first edition of this lecture note. Please send bug reports and suggestions to jeffe@illinois.edu. But the Lord came down to see the city and the tower the people were building.

### CSE 135: Introduction to Theory of Computation Decidability and Recognizability

CSE 135: Introduction to Theory of Computation Decidability and Recognizability Sungjin Im University of California, Merced 04-28, 30-2014 High-Level Descriptions of Computation Instead of giving a Turing

### Pushdown automata. Informatics 2A: Lecture 9. Alex Simpson. 3 October, 2014. School of Informatics University of Edinburgh als@inf.ed.ac.

Pushdown automata Informatics 2A: Lecture 9 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 3 October, 2014 1 / 17 Recap of lecture 8 Context-free languages are defined by context-free

### CSC4510 AUTOMATA 2.1 Finite Automata: Examples and D efinitions Definitions

CSC45 AUTOMATA 2. Finite Automata: Examples and Definitions Finite Automata: Examples and Definitions A finite automaton is a simple type of computer. Itsoutputislimitedto yes to or no. It has very primitive

### Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras

Theory of Computation Prof. Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture No. # 31 Recursive Sets, Recursively Innumerable Sets, Encoding

### Computational Models Lecture 8, Spring 2009

Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown Univ. p. 1 Computational Models Lecture 8, Spring 2009 Encoding of TMs Universal Turing Machines The Halting/Acceptance

### What The Regex_Cat Dragged In

What The Regex_Cat Dragged In Kyle Hamilton COS210 - MCCC, Prof. Bostain December 2013 Regular Expression: From Wikipedia, the free encyclopedia In computing, a regular expression (abbreviated regex or

### Automata Theory. Şubat 2006 Tuğrul Yılmaz Ankara Üniversitesi

Automata Theory Automata theory is the study of abstract computing devices. A. M. Turing studied an abstract machine that had all the capabilities of today s computers. Turing s goal was to describe the

### 1 Definition of a Turing machine

Introduction to Algorithms Notes on Turing Machines CS 4820, Spring 2012 April 2-16, 2012 1 Definition of a Turing machine Turing machines are an abstract model of computation. They provide a precise,

### INSTITUTE OF AERONAUTICAL ENGINEERING

INSTITUTE OF AERONAUTICAL ENGINEERING DUNDIGAL 500 043, HYDERABAD COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Name : FORMAL LANGUAGES AND AUTOMATA THEORY Code : A40509 Class : II B. Tech II

### Regular Languages and Finite Automata

Regular Languages and Finite Automata A C Norman, Lent Term 1996 Part IA 1 Introduction This course is short, but it is present in Part 1A because of the way it introduces links between many different

### SRM UNIVERSITY FACULTY OF ENGINEERING & TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF SOFTWARE ENGINEERING COURSE PLAN

Course Code : CS0355 SRM UNIVERSITY FACULTY OF ENGINEERING & TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF SOFTWARE ENGINEERING COURSE PLAN Course Title : THEORY OF COMPUTATION Semester : VI Course : June

### The Halting Problem is Undecidable

185 Corollary G = { M, w w L(M) } is not Turing-recognizable. Proof. = ERR, where ERR is the easy to decide language: ERR = { x { 0, 1 }* x does not have a prefix that is a valid code for a Turing machine

### Computing Functions with Turing Machines

CS 30 - Lecture 20 Combining Turing Machines and Turing s Thesis Fall 2008 Review Languages and Grammars Alphabets, strings, languages Regular Languages Deterministic Finite and Nondeterministic Automata

### Sets. A set is a collection of (mathematical) objects, with the collection treated as a single mathematical object.

Sets 1 Sets Informally: A set is a collection of (mathematical) objects, with the collection treated as a single mathematical object. Examples: real numbers, complex numbers, C integers, All students in

### Sets and Subsets. Countable and Uncountable

Sets and Subsets Countable and Uncountable Reading Appendix A Section A.6.8 Pages 788-792 BIG IDEAS Themes 1. There exist functions that cannot be computed in Java or any other computer language. 2. There

### 6.080/6.089 GITCS Feb 12, 2008. Lecture 3

6.8/6.89 GITCS Feb 2, 28 Lecturer: Scott Aaronson Lecture 3 Scribe: Adam Rogal Administrivia. Scribe notes The purpose of scribe notes is to transcribe our lectures. Although I have formal notes of my

### Introduction to Finite Automata

Introduction to Finite Automata Our First Machine Model Captain Pedro Ortiz Department of Computer Science United States Naval Academy SI-340 Theory of Computing Fall 2012 Captain Pedro Ortiz (US Naval

### Informatique Fondamentale IMA S8

Informatique Fondamentale IMA S8 Cours 1 - Intro + schedule + finite state machines Laure Gonnord http://laure.gonnord.org/pro/teaching/ Laure.Gonnord@polytech-lille.fr Université Lille 1 - Polytech Lille

### Markov Algorithm. CHEN Yuanmi December 18, 2007

Markov Algorithm CHEN Yuanmi December 18, 2007 1 Abstract Markov Algorithm can be understood as a priority string rewriting system. In this short paper we give the definition of Markov algorithm and also

### ÖVNINGSUPPGIFTER I SAMMANHANGSFRIA SPRÅK. 15 april 2003. Master Edition

ÖVNINGSUPPGIFTER I SAMMANHANGSFRIA SPRÅK 5 april 23 Master Edition CONTEXT FREE LANGUAGES & PUSH-DOWN AUTOMATA CONTEXT-FREE GRAMMARS, CFG Problems Sudkamp Problem. (3.2.) Which language generates the grammar

### Mathematical Induction. Lecture 10-11

Mathematical Induction Lecture 10-11 Menu Mathematical Induction Strong Induction Recursive Definitions Structural Induction Climbing an Infinite Ladder Suppose we have an infinite ladder: 1. We can reach

### OHJ-2306 Fall 2011 Introduction to Theoretical Computer Science

1 OHJ-2306 Fall 2011 Introduction to Theoretical Computer Science 2 3 Organization & timetable Lectures: prof. Tapio Elomaa, M.Sc. Timo Aho Tue and Thu 14 16 TB220 Aug. 30 Dec. 8, 2011 Exceptions: Thu

### Inf1A: Deterministic Finite State Machines

Lecture 2 InfA: Deterministic Finite State Machines 2. Introduction In this lecture we will focus a little more on deterministic Finite State Machines. Also, we will be mostly concerned with Finite State

### Computability Theory

CSC 438F/2404F Notes (S. Cook and T. Pitassi) Fall, 2014 Computability Theory This section is partly inspired by the material in A Course in Mathematical Logic by Bell and Machover, Chap 6, sections 1-10.

### Introduction to Automata Theory. Reading: Chapter 1

Introduction to Automata Theory Reading: Chapter 1 1 What is Automata Theory? Study of abstract computing devices, or machines Automaton = an abstract computing device Note: A device need not even be a

### We give a basic overview of the mathematical background required for this course.

1 Background We give a basic overview of the mathematical background required for this course. 1.1 Set Theory We introduce some concepts from naive set theory (as opposed to axiomatic set theory). The

### THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER

THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER JASPER DEANTONIO Abstract. This paper is a study of the Turing Degrees, which are levels of incomputability naturally arising from sets of natural numbers.

### Online EFFECTIVE AS OF JANUARY 2013

2013 A and C Session Start Dates (A-B Quarter Sequence*) 2013 B and D Session Start Dates (B-A Quarter Sequence*) Quarter 5 2012 1205A&C Begins November 5, 2012 1205A Ends December 9, 2012 Session Break

### Lights and Darks of the Star-Free Star

Lights and Darks of the Star-Free Star Edward Ochmański & Krystyna Stawikowska Nicolaus Copernicus University, Toruń, Poland Introduction: star may destroy recognizability In (finitely generated) trace

### An Exponential Gap between LasVegas and Deterministic Sweeping Finite Automata

An Exponential Gap between LasVegas and Deterministic Sweeping Finite Automata Christos Kapoutsis, Richard Královič, and Tobias Mömke Department of Computer Science, ETH Zürich Abstract. A two-way finite

### Automata and Rational Numbers

Automata and Rational Numbers Jeffrey Shallit School of Computer Science University of Waterloo Waterloo, Ontario N2L 3G1 Canada shallit@cs.uwaterloo.ca http://www.cs.uwaterloo.ca/~shallit 1/40 Representations

### Honors Class (Foundations of) Informatics. Tom Verhoeff. Department of Mathematics & Computer Science Software Engineering & Technology

Honors Class (Foundations of) Informatics Tom Verhoeff Department of Mathematics & Computer Science Software Engineering & Technology www.win.tue.nl/~wstomv/edu/hci c 2011, T. Verhoeff @ TUE.NL 1/20 Information

### T-79.186 Reactive Systems: Introduction and Finite State Automata

T-79.186 Reactive Systems: Introduction and Finite State Automata Timo Latvala 14.1.2004 Reactive Systems: Introduction and Finite State Automata 1-1 Reactive Systems Reactive systems are a class of software

### 1. Nondeterministically guess a solution (called a certificate) 2. Check whether the solution solves the problem (called verification)

Some N P problems Computer scientists have studied many N P problems, that is, problems that can be solved nondeterministically in polynomial time. Traditionally complexity question are studied as languages:

### CHAPTER 3 Numbers and Numeral Systems

CHAPTER 3 Numbers and Numeral Systems Numbers play an important role in almost all areas of mathematics, not least in calculus. Virtually all calculus books contain a thorough description of the natural,

### Boolean Algebra Part 1

Boolean Algebra Part 1 Page 1 Boolean Algebra Objectives Understand Basic Boolean Algebra Relate Boolean Algebra to Logic Networks Prove Laws using Truth Tables Understand and Use First Basic Theorems

### Elementary Number Theory We begin with a bit of elementary number theory, which is concerned

CONSTRUCTION OF THE FINITE FIELDS Z p S. R. DOTY Elementary Number Theory We begin with a bit of elementary number theory, which is concerned solely with questions about the set of integers Z = {0, ±1,

### Converting Finite Automata to Regular Expressions

Converting Finite Automata to Regular Expressions Alexander Meduna, Lukáš Vrábel, and Petr Zemek Brno University of Technology, Faculty of Information Technology Božetěchova 1/2, 612 00 Brno, CZ http://www.fit.vutbr.cz/

### Lecture Notes on Spanning Trees

Lecture Notes on Spanning Trees 15-122: Principles of Imperative Computation Frank Pfenning Lecture 26 April 26, 2011 1 Introduction In this lecture we introduce graphs. Graphs provide a uniform model

### Automata, languages, and grammars

Automata, languages, and grammars Cristopher Moore January 24, 2015 Abstract These lecture notes are intended as a supplement to Moore and Mertens The Nature of Computation, and are available to anyone

### COMPRESSION SPRINGS: STANDARD SERIES (INCH)

: STANDARD SERIES (INCH) LC 014A 01 0.250 6.35 11.25 0.200 0.088 2.24 F F M LC 014A 02 0.313 7.94 8.90 0.159 0.105 2.67 F F M LC 014A 03 0.375 9.52 7.10 0.126 0.122 3.10 F F M LC 014A 04 0.438 11.11 6.00

### Theory of Computation Chapter 2: Turing Machines

Theory of Computation Chapter 2: Turing Machines Guan-Shieng Huang Feb. 24, 2003 Feb. 19, 2006 0-0 Turing Machine δ K 0111000a 01bb 1 Definition of TMs A Turing Machine is a quadruple M = (K, Σ, δ, s),

### INCIDENCE-BETWEENNESS GEOMETRY

INCIDENCE-BETWEENNESS GEOMETRY MATH 410, CSUSM. SPRING 2008. PROFESSOR AITKEN This document covers the geometry that can be developed with just the axioms related to incidence and betweenness. The full

### Magic Squares and Modular Arithmetic

Magic Squares and Modular Arithmetic Jim Carlson November 7, 2001 1 Introduction Recall that a magic square is a square array of consecutive distinct numbers such that all row and column sums and are the

### ASSIGNMENT ONE SOLUTIONS MATH 4805 / COMP 4805 / MATH 5605

ASSIGNMENT ONE SOLUTIONS MATH 4805 / COMP 4805 / MATH 5605 (1) (a) (0 + 1) 010 (finite automata below). (b) First observe that the following regular expression generates the binary strings with an even

### CAs and Turing Machines. The Basis for Universal Computation

CAs and Turing Machines The Basis for Universal Computation What We Mean By Universal When we claim universal computation we mean that the CA is capable of calculating anything that could possibly be calculated*.

### Omega Automata: Minimization and Learning 1

Omega Automata: Minimization and Learning 1 Oded Maler CNRS - VERIMAG Grenoble, France 2007 1 Joint work with A. Pnueli, late 80s Summary Machine learning in general and of formal languages in particular

### Fundamentele Informatica II

Fundamentele Informatica II Answer to selected exercises 1 John C Martin: Introduction to Languages and the Theory of Computation M.M. Bonsangue (and J. Kleijn) Fall 2011 Let L be a language. It is clear

### 2110711 THEORY of COMPUTATION

2110711 THEORY of COMPUTATION ATHASIT SURARERKS ELITE Athasit Surarerks ELITE Engineering Laboratory in Theoretical Enumerable System Computer Engineering, Faculty of Engineering Chulalongkorn University

### Markov random fields and Gibbs measures

Chapter Markov random fields and Gibbs measures 1. Conditional independence Suppose X i is a random element of (X i, B i ), for i = 1, 2, 3, with all X i defined on the same probability space (.F, P).

### Hint 1. Answer (b) first. Make the set as simple as possible and try to generalize the phenomena it exhibits. [Caution: the next hint is an answer to

Problem. Consider the collection of all subsets A of the topological space X. The operations of osure A Ā and ementation A X A are functions from this collection to itself. (a) Show that starting with

### Welcome to... Problem Analysis and Complexity Theory 716.054, 3 VU

Welcome to... Problem Analysis and Complexity Theory 716.054, 3 VU Birgit Vogtenhuber Institute for Software Technology email: bvogt@ist.tugraz.at office hour: Tuesday 10:30 11:30 slides: http://www.ist.tugraz.at/pact.html

### Master s Thesis. One-Pass Strategies for Context-Free Games. Christian Cöster August 2015

Master s Thesis One-Pass Strategies for Context-Free Games Christian Cöster August 2015 Examiners: Prof. Dr. Thomas Schwentick Prof. Dr. Christoph Buchheim Technische Universität Dortmund Fakultät für

### The Language of Mathematics

CHPTER 2 The Language of Mathematics 2.1. Set Theory 2.1.1. Sets. set is a collection of objects, called elements of the set. set can be represented by listing its elements between braces: = {1, 2, 3,

### Discrete mathematics is the study of techniques, ideas and modes

CHAPTER 1 Discrete Systems Discrete mathematics is the study of techniques, ideas and modes of reasoning that are indispensable in applied disciplines such as computer science or information technology.

### We can express this in decimal notation (in contrast to the underline notation we have been using) as follows: 9081 + 900b + 90c = 9001 + 100c + 10b

In this session, we ll learn how to solve problems related to place value. This is one of the fundamental concepts in arithmetic, something every elementary and middle school mathematics teacher should

### Continued Fractions and the Euclidean Algorithm

Continued Fractions and the Euclidean Algorithm Lecture notes prepared for MATH 326, Spring 997 Department of Mathematics and Statistics University at Albany William F Hammond Table of Contents Introduction

### Introduction to mathematical arguments

Introduction to mathematical arguments (background handout for courses requiring proofs) by Michael Hutchings A mathematical proof is an argument which convinces other people that something is true. Math

### A set is an unordered collection of objects.

Section 2.1 Sets A set is an unordered collection of objects. the students in this class the chairs in this room The objects in a set are called the elements, or members of the set. A set is said to contain

### Preventing Denial of Service Attacks in a Calculus of Mobile Resources

Preventing Denial of Service Attacks in a Calculus of Mobile Resources Bilge Hösükoǧlu, David Sánchez Hernández, Julian Driver June 1, 2006 Abstract In this paper we introduce membranes for the calculus