INF Introduction and Regular Languages. Daniel Lupp. 18th January University of Oslo. Department of Informatics. Universitetet i Oslo

Size: px
Start display at page:

Download "INF Introduction and Regular Languages. Daniel Lupp. 18th January University of Oslo. Department of Informatics. Universitetet i Oslo"

Transcription

1 INF28 1. Introduction and Regular Languages Daniel Lupp Universitetet i Oslo 18th January 218 Department of Informatics University of Oslo INF28 Lecture :: 18th January 1 / 33

2 Details on the Course consists of two parts: computability theory (first half of semester) and complexity theory (second half, held by Evgenij Thorstensen) INF28 Lecture :: 18th January 2 / 33

3 Details on the Course consists of two parts: computability theory (first half of semester) and complexity theory (second half, held by Evgenij Thorstensen) closely follows Michael Sipser s book An Introduction to the Theory of Computation (3rd International Edition) both in course content and exercises INF28 Lecture :: 18th January 2 / 33

4 Details on the Course consists of two parts: computability theory (first half of semester) and complexity theory (second half, held by Evgenij Thorstensen) closely follows Michael Sipser s book An Introduction to the Theory of Computation (3rd International Edition) both in course content and exercises prerequisites are INF18/IN115 and chapter of the book (very brief and incomplete refresher soon) INF28 Lecture :: 18th January 2 / 33

5 Details on the Course consists of two parts: computability theory (first half of semester) and complexity theory (second half, held by Evgenij Thorstensen) closely follows Michael Sipser s book An Introduction to the Theory of Computation (3rd International Edition) both in course content and exercises prerequisites are INF18/IN115 and chapter of the book (very brief and incomplete refresher soon) as always: lectures are useful, but doing exercises yourself is the most important! group exercises INF28 Lecture :: 18th January 2 / 33

6 Setup for Computability Theory For the first half of the course: Thursday lecture: new theory and material Friday lecture: new theory and material, but mostly reserved for in-depth discussion, examples, open Q&A INF28 Lecture :: 18th January 3 / 33

7 So what s it all about? INF28 Lecture :: 18th January 4 / 33

8 So what s it all about? Alan Turing ( ) INF28 Lecture :: 18th January 4 / 33

9 So what s it all about? Alan Turing ( ) Father of modern computing very interesting (and sad) story INF28 Lecture :: 18th January 4 / 33

10 So what s it all about? Alan Turing ( ) Father of modern computing very interesting (and sad) story Turing machines INF28 Lecture :: 18th January 4 / 33

11 So what s it all about? Alan Turing ( ) Father of modern computing very interesting (and sad) story Turing machines INF28 Lecture :: 18th January 4 / 33

12 So what s it all about? Alan Turing ( ) Noam Chomsky (1928-) Father of modern computing Father of modern linguistics very interesting (and sad) story Turing machines INF28 Lecture :: 18th January 4 / 33

13 So what s it all about? Alan Turing ( ) Noam Chomsky (1928-) Father of modern computing Father of modern linguistics very interesting (and sad) story classification of formal languages Turing machines INF28 Chomsky hierarchy Lecture :: 18th January 4 / 33

14 So what s it all about? Automata and formal languages (e.g., programming languages: programs considered as words in a language) INF28 Lecture :: 18th January 5 / 33

15 So what s it all about? Automata and formal languages (e.g., programming languages: programs considered as words in a language) What is an algorithm? INF28 Lecture :: 18th January 5 / 33

16 So what s it all about? Automata and formal languages (e.g., programming languages: programs considered as words in a language) What is an algorithm? Turing machines INF28 Lecture :: 18th January 5 / 33

17 So what s it all about? Automata and formal languages (e.g., programming languages: programs considered as words in a language) What is an algorithm? Turing machines Does a solver for a given problem always terminate? INF28 Lecture :: 18th January 5 / 33

18 So what s it all about? Automata and formal languages (e.g., programming languages: programs considered as words in a language) What is an algorithm? Turing machines Does a solver for a given problem always terminate? If yes, how expensive is it? ( complexity) INF28 Lecture :: 18th January 5 / 33

19 The Basics Set: an unordered collection of distinct objects called elements {a, b} = {a, a, b} = {b, a} Set union: A B = {x x A or x B} Set intersection: A B = {x x A and x B} Set complement: Ā = {x x A} de Morgan s laws: A B = Ā B and A B = Ā B Power Set: P(A) = {S S A} INF28 Lecture :: 18th January 6 / 33

20 The Basics Set: an unordered collection of distinct objects called elements {a, b} = {a, a, b} = {b, a} Set union: A B = {x x A or x B} Set intersection: A B = {x x A and x B} Set complement: Ā = {x x A} de Morgan s laws: A B = Ā B and A B = Ā B Power Set: P(A) = {S S A}, example: P({, 1}) = {, {}, {1}, {, 1}}. INF28 Lecture :: 18th January 6 / 33

21 The Basics Tuple: ordered collection of objects (a, a, b) (a, b) Cartesian product: A B = {(a, b) a A, b B} Function: f : A B. Assigns to each element a A a unique element f (a) B. INF28 Lecture :: 18th January 7 / 33

22 Finite Automata computational model of a computer with finite memory INF28 Lecture :: 18th January 8 / 33

23 Finite Automata computational model of a computer with finite memory Takes an input w and decides whether to accept or reject INF28 Lecture :: 18th January 8 / 33

24 Finite Automata computational model of a computer with finite memory Takes an input w and decides whether to accept or reject Can be used to answer such questions as Is w a palindrome? or Is w a valid program in a given programming language? INF28 Lecture :: 18th January 8 / 33

25 Finite Automata computational model of a computer with finite memory Takes an input w and decides whether to accept or reject Can be used to answer such questions as Is w a palindrome? or Is w a valid program in a given programming language? usual depicted as a graph for ease of reading: nodes represent states in which the automaton can be INF28 Lecture :: 18th January 8 / 33

26 Finite Automata computational model of a computer with finite memory Takes an input w and decides whether to accept or reject Can be used to answer such questions as Is w a palindrome? or Is w a valid program in a given programming language? usual depicted as a graph for ease of reading: nodes represent states in which the automaton can be edges between nodes represent the transition between states given a parsed input INF28 Lecture :: 18th January 8 / 33

27 Finite Automata computational model of a computer with finite memory Takes an input w and decides whether to accept or reject Can be used to answer such questions as Is w a palindrome? or Is w a valid program in a given programming language? usual depicted as a graph for ease of reading: nodes represent states in which the automaton can be edges between nodes represent the transition between states given a parsed input always exactly one start node: start INF28 Lecture :: 18th January 8 / 33

28 Finite Automata computational model of a computer with finite memory Takes an input w and decides whether to accept or reject Can be used to answer such questions as Is w a palindrome? or Is w a valid program in a given programming language? usual depicted as a graph for ease of reading: nodes represent states in which the automaton can be edges between nodes represent the transition between states given a parsed input always exactly one start node: start as well as some accept states: INF28 Lecture :: 18th January 8 / 33

29 Finite Automata Example: 1 start INF28 Lecture :: 18th January 9 / 33

30 Finite Automata What does it mean for a finite automaton to accept an input w? 1 start INF28 Lecture :: 18th January 1 / 33

31 Finite Automata What does it mean for a finite automaton to accept an input w? 1 starting at the start state, for each symbol in the input, follow a corresponding transition edge to the next state; start INF28 Lecture :: 18th January 1 / 33

32 Finite Automata What does it mean for a finite automaton to accept an input w? 1 starting at the start state, for each symbol in the input, follow a corresponding transition edge to the next state; the entire input must be parsed; start INF28 Lecture :: 18th January 1 / 33

33 Finite Automata What does it mean for a finite automaton to accept an input w? start 1 starting at the start state, for each symbol in the input, follow a corresponding transition edge to the next state; the entire input must be parsed; the final state must be an accepting state. INF28 Lecture :: 18th January 1 / 33

34 Finite Automata What does it mean for a finite automaton to accept an input w? start 1 starting at the start state, for each symbol in the input, follow a corresponding transition edge to the next state; the entire input must be parsed; the final state must be an accepting state. the example automaton accepts all inputs, words, that start and end with, with only 1 s in between. INF28 Lecture :: 18th January 1 / 33

35 Deterministic Finite Automata Definition A deterministic finite automaton (DFA) is a 5-tuple (Q, Σ, δ, q, F ), where 1 Q is a finite set of states INF28 Lecture :: 18th January 11 / 33

36 Deterministic Finite Automata Definition A deterministic finite automaton (DFA) is a 5-tuple (Q, Σ, δ, q, F ), where 1 Q is a finite set of states 2 Σ is a finite set called the alphabet INF28 Lecture :: 18th January 11 / 33

37 Deterministic Finite Automata Definition A deterministic finite automaton (DFA) is a 5-tuple (Q, Σ, δ, q, F ), where 1 Q is a finite set of states 2 Σ is a finite set called the alphabet 3 δ : Q Σ Q the transition function INF28 Lecture :: 18th January 11 / 33

38 Deterministic Finite Automata Definition A deterministic finite automaton (DFA) is a 5-tuple (Q, Σ, δ, q, F ), where 1 Q is a finite set of states 2 Σ is a finite set called the alphabet 3 δ : Q Σ Q the transition function 4 q the start state INF28 Lecture :: 18th January 11 / 33

39 Deterministic Finite Automata Definition A deterministic finite automaton (DFA) is a 5-tuple (Q, Σ, δ, q, F ), where 1 Q is a finite set of states 2 Σ is a finite set called the alphabet 3 δ : Q Σ Q the transition function 4 q the start state 5 F Q the set of accept states. INF28 Lecture :: 18th January 11 / 33

40 Finite Automata What does it mean for a finite automaton to accept an input w? start 1 starting at the start state, for each symbol in the input, follow a corresponding transition edge to the next state; the entire input must be parsed; the final state must be an accepting state. the example automaton accepts all inputs, words, that start and end with, with only 1 s in between. INF28 Lecture :: 18th January 12 / 33

41 Deterministic Finite Automata Definition A DFA (Q, Σ, δ, q, F ) accepts an input w = w 1 w 2 w n if there exists a sequence of states s s n such that 1 s is the start state q 2 δ(s i, w i+1 ) = s i+1 (a valid transition is chosen for the currently parsed input symbol) 3 s n F, i.e., is an accept state. INF28 Lecture :: 18th January 13 / 33

42 Deterministic Finite Automata Definition A DFA (Q, Σ, δ, q, F ) accepts an input w = w 1 w 2 w n if there exists a sequence of states s s n such that 1 s is the start state q 2 δ(s i, w i+1 ) = s i+1 (a valid transition is chosen for the currently parsed input symbol) 3 s n F, i.e., is an accept state. Example: 1 B For w = w 1 w 2 w 3 w 4 w 5 = 111, start A C INF28 Lecture :: 18th January 13 / 33

43 Deterministic Finite Automata Definition A DFA (Q, Σ, δ, q, F ) accepts an input w = w 1 w 2 w n if there exists a sequence of states s s n such that 1 s is the start state q 2 δ(s i, w i+1 ) = s i+1 (a valid transition is chosen for the currently parsed input symbol) 3 s n F, i.e., is an accept state. Example: 1 B For w = w 1 w 2 w 3 w 4 w 5 = 111, s = s s 1 s 2 s 3 s 4 s 5 = ABBBBC start A C INF28 Lecture :: 18th January 13 / 33

44 Regular Languages Given an alphabet Σ a language L is a set of words w = w 1 w n such that each w i Σ. INF28 Lecture :: 18th January 14 / 33

45 Regular Languages Given an alphabet Σ a language L is a set of words w = w 1 w n such that each w i Σ. Definition A language L is a regular language if there exists a DFA M that accepts each word in L, i.e., L = {w M accepts w}. INF28 Lecture :: 18th January 14 / 33

46 Regular Languages Given an alphabet Σ a language L is a set of words w = w 1 w n such that each w i Σ. Definition A language L is a regular language if there exists a DFA M that accepts each word in L, i.e., L = {w M accepts w}. 1 describes B L 1 = {w w starts and ends with, with only 1 s in between}. start A C L 1 is regular INF28 Lecture :: 18th January 14 / 33

47 Regular languages Since languages are sets, we can apply various operations on them: Union: the union of two languages L 1 and L 2 is L 1 L 2 = {w w L 1 or w L 2 } INF28 Lecture :: 18th January 15 / 33

48 Regular languages Since languages are sets, we can apply various operations on them: Union: the union of two languages L 1 and L 2 is L 1 L 2 = {w w L 1 or w L 2 } Intersection: similarly, L 1 L 2 = {w w L 1 and w L 2 }. INF28 Lecture :: 18th January 15 / 33

49 Regular languages Since languages are sets, we can apply various operations on them: Union: the union of two languages L 1 and L 2 is L 1 L 2 = {w w L 1 or w L 2 } Intersection: similarly, L 1 L 2 = {w w L 1 and w L 2 }. Concatanation: L 1 L 2 = {w w = w 1 w 2, w 1 L 1, w 2 L 2 } INF28 Lecture :: 18th January 15 / 33

50 Regular languages Since languages are sets, we can apply various operations on them: Union: the union of two languages L 1 and L 2 is L 1 L 2 = {w w L 1 or w L 2 } Intersection: similarly, L 1 L 2 = {w w L 1 and w L 2 }. Concatanation: L 1 L 2 = {w w = w 1 w 2, w 1 L 1, w 2 L 2 } Kleene star: L 1 = {x 1x 2 x k k, each x i L 1 } INF28 Lecture :: 18th January 15 / 33

51 Regular Languages Theorem The class of regular languages is closed under union [intersection], i.e., the union [intersection] of two regular languages is regular. INF28 Lecture :: 18th January 16 / 33

52 Regular Languages Theorem The class of regular languages is closed under union [intersection], i.e., the union [intersection] of two regular languages is regular. Proof idea: We multitask! Construct product automaton that runs both DFA s in parallel: (Q 1 Q 2, Σ, δ, F ) where δ((s 1, s 2 ), w i ) := (δ 1 (s 1, w i ), δ 2 (s 2, w i )) INF28 Lecture :: 18th January 16 / 33

53 Regular Languages Theorem The class of regular languages is closed under union [intersection], i.e., the union [intersection] of two regular languages is regular. Proof idea: We multitask! Construct product automaton that runs both DFA s in parallel: (Q 1 Q 2, Σ, δ, F ) where δ((s 1, s 2 ), w i ) := (δ 1 (s 1, w i ), δ 2 (s 2, w i )) F = {(s 1, s 2 ) s 1 or s 2 is an accepting state} for union, F = {(s 1, s 2 ) s 1 and s 2 is an accepting state} for intersection INF28 Lecture :: 18th January 16 / 33

54 Regular Languages Theorem The class of regular languages is closed under union [intersection], i.e., the union [intersection] of two regular languages is regular. Proof idea: We multitask! Construct product automaton that runs both DFA s in parallel: (Q 1 Q 2, Σ, δ, F ) where δ((s 1, s 2 ), w i ) := (δ 1 (s 1, w i ), δ 2 (s 2, w i )) F = {(s 1, s 2 ) s 1 or s 2 is an accepting state} for union, F = {(s 1, s 2 ) s 1 and s 2 is an accepting state} for intersection INF28 Lecture :: 18th January 16 / 33

55 Union of regular languages: Example 1 B1 B2 1 with implicit sink states S 1, S 2. start A1 C1 start A2 C2 INF28 Lecture :: 18th January 17 / 33

56 Union of regular languages: Example 1 B1 B2 1 with implicit sink states S 1, S 2. start A1 C1 start A2 C2 B1, C2 B1, S2 C1, S2 start A1, A2 B1, B2 C1, B2 S1, B2 S1, C2 INF28 Lecture :: 18th January 17 / 33

57 Union of regular languages: Example 1 B1 B2 1 with implicit sink states S 1, S 2. start A1 C1 start A2 C2 B1, C2 1 B1, S2 C1, S2 1 1 start A1, A2 B1, B2 C1, B2 S1, B2 1 S1, C2 INF28 Lecture :: 18th January 18 / 33

58 Union of regular languages: Example 1 B1 B2 1 with implicit sink states S 1, S 2. start A1 C1 start A2 C2 B1, C2 1 B1, S2 C1, S2 1 1 start A1, A2 B1, B2 C1, B2 S1, B2 1 S1, C2 INF28 Lecture :: 18th January 19 / 33

59 Nondeterministic Finite Automata So far, the transition function δ gave for a given state and input symbol precisely one following state. determinism INF28 Lecture :: 18th January 2 / 33

60 Nondeterministic Finite Automata So far, the transition function δ gave for a given state and input symbol precisely one following state. determinism Now we allow for multiple possible next states. nondeterminism INF28 Lecture :: 18th January 2 / 33

61 NFA - An example, 1 q 1 start q q 2 INF28 Lecture :: 18th January 21 / 33

62 NFA - An example, 1 q 1 start q q 2 Language consists of all,1 sequences starting and ending with. INF28 Lecture :: 18th January 21 / 33

63 NFA - Another example,1 q 1,1,1 start q 1 q 2 q 3 INF28 Lecture :: 18th January 22 / 33

64 NFA - Another example,1 q 1,1,1 start q 1 q 2 q 3 Language consists of all,1 sequences with a 1 in the third position from the end. INF28 Lecture :: 18th January 22 / 33

65 NFA - an example with empty transitions start 1 a ε a b 2 a, b 3 INF28 Lecture :: 18th January 23 / 33

66 Nondeterministic Finite Automata Definition A nondeterministic finite automaton (NFA) is a 5-tuple (Q, Σ, δ, q, F ) where 1 Q is a finite set of states, 2 Σ is a finite alphabet, 3 δ : Q Σ ε P(Q) is the transition function, and 4 F Q is the set of accepting states. INF28 Lecture :: 18th January 24 / 33

67 NFA First notice that DFA s are special cases of NFA s. INF28 Lecture :: 18th January 25 / 33

68 NFA First notice that DFA s are special cases of NFA s. DFA s accept regular languages, but what languages do NFA s accept? INF28 Lecture :: 18th January 25 / 33

69 NFA First notice that DFA s are special cases of NFA s. DFA s accept regular languages, but what languages do NFA s accept? As it turns out: regular languages! In other words, in a sense, DFA=NFA. INF28 Lecture :: 18th January 25 / 33

70 DFA=NFA Theorem Every NFA N = (Q, Σ, δ, q, F ) has an equivalent DFA M = (Q, Σ, δ, q, F ). INF28 Lecture :: 18th January 26 / 33

71 DFA=NFA Theorem Every NFA N = (Q, Σ, δ, q, F ) has an equivalent DFA M = (Q, Σ, δ, q, F ). Proof: Each state in the NFA has multiple possible following states. We need to simultaneously keep track of all these possible following states in one state in the DFA. INF28 Lecture :: 18th January 26 / 33

72 DFA=NFA Theorem Every NFA N = (Q, Σ, δ, q, F ) has an equivalent DFA M = (Q, Σ, δ, q, F ). Proof: Each state in the NFA has multiple possible following states. We need to simultaneously keep track of all these possible following states in one state in the DFA. Since the set of possible following states in the NFA could be any subset of the state set Q, the DFA s state set Q must be P(Q). INF28 Lecture :: 18th January 26 / 33

73 DFA=NFA Theorem Every NFA N = (Q, Σ, δ, q, F ) has an equivalent DFA M = (Q, Σ, δ, q, F ). Proof: Each state in the NFA has multiple possible following states. We need to simultaneously keep track of all these possible following states in one state in the DFA. Since the set of possible following states in the NFA could be any subset of the state set Q, the DFA s state set Q must be P(Q). Let us first assume there are no ε transitions. INF28 Lecture :: 18th January 26 / 33

74 DFA=NFA: Example 2 1 start INF28 Lecture :: 18th January 27 / 33

75 DFA=NFA: Example 2 1 {2, 3} start 1 1 start {1} {1, 2, 3} INF28 Lecture :: 18th January 27 / 33

76 NFA=DFA Then q = {q }. What about the transition function δ? INF28 Lecture :: 18th January 28 / 33

77 NFA=DFA Then q = {q }. What about the transition function δ? a state R in the DFA M corresponds to a set of states in the NFA N. So for an input w i at state R, we need to consider all possible following states to the set of possible states R. INF28 Lecture :: 18th January 28 / 33

78 NFA=DFA Then q = {q }. What about the transition function δ? a state R in the DFA M corresponds to a set of states in the NFA N. So for an input w i at state R, we need to consider all possible following states to the set of possible states R. Or, more formally, δ (R, w i ) = δ(r, w i ) r R = {q Q q δ(r, w i ) for some r R} INF28 Lecture :: 18th January 28 / 33

79 NFA=DFA Then q = {q }. What about the transition function δ? a state R in the DFA M corresponds to a set of states in the NFA N. So for an input w i at state R, we need to consider all possible following states to the set of possible states R. Or, more formally, δ (R, w i ) = δ(r, w i ) r R = {q Q q δ(r, w i ) for some r R} 2 1 {2, 3} start 1 1 start {1} {1, 2, 3} INF28 Lecture :: 18th January 28 / 33

80 NFA=DFA Since an NFA accepts an input if any of the possible computations ends in an accept state, F = {R Q R contains a state r F }. INF28 Lecture :: 18th January 29 / 33

81 NFA=DFA Since an NFA accepts an input if any of the possible computations ends in an accept state, F = {R Q R contains a state r F }. Almost done! Now we need to adjust what we did in order to take ε transitions into account. To that end, let E(R) = {q q can be reached from R with or more ε transitions} for R Q. INF28 Lecture :: 18th January 29 / 33

82 NFA=DFA Since an NFA accepts an input if any of the possible computations ends in an accept state, F = {R Q R contains a state r F }. Almost done! Now we need to adjust what we did in order to take ε transitions into account. To that end, let E(R) = {q q can be reached from R with or more ε transitions} for R Q. Then q = E({q }). INF28 Lecture :: 18th January 29 / 33

83 NFA=DFA Since an NFA accepts an input if any of the possible computations ends in an accept state, F = {R Q R contains a state r F }. Almost done! Now we need to adjust what we did in order to take ε transitions into account. To that end, let E(R) = {q q can be reached from R with or more ε transitions} for R Q. Then q = E({q }). Transition function δ : δ (R, w i ) = E(δ(r, w i )) r R = {q Q q E(δ(r, w i )) for some r R} INF28 Lecture :: 18th January 29 / 33

84 NFA=DFA In other words, we have just proven: Theorem A language is regular iff (if and only if) there exists an NFA that accepts it. INF28 Lecture :: 18th January 3 / 33

85 Concatanation of regular languages So what about concatanation of languages? Given two regular languages L 1, L 2, is L 1 L 2 = {w 1 w 2 w 1 L 1, w 2 L 2 } a regular language? INF28 Lecture :: 18th January 31 / 33

86 Concatanation of regular languages So what about concatanation of languages? Given two regular languages L 1, L 2, is L 1 L 2 = {w 1 w 2 w 1 L 1, w 2 L 2 } a regular language? an automaton gets an input w and must guess how to split it w = w 1 w 2 in order to check L 1 and L 2 membership. INF28 Lecture :: 18th January 31 / 33

87 Concatanation of regular languages So what about concatanation of languages? Given two regular languages L 1, L 2, is L 1 L 2 = {w 1 w 2 w 1 L 1, w 2 L 2 } a regular language? an automaton gets an input w and must guess how to split it w = w 1 w 2 in order to check L 1 and L 2 membership. Example: L 1 = {w w begins and ends with 1} and L 2 = {w w begins and ends with } How to split the word w = 1111? Multiple options INF28 Lecture :: 18th January 31 / 33

88 Concatanation of regular languages So what about concatanation of languages? Given two regular languages L 1, L 2, is L 1 L 2 = {w 1 w 2 w 1 L 1, w 2 L 2 } a regular language? an automaton gets an input w and must guess how to split it w = w 1 w 2 in order to check L 1 and L 2 membership. Example: L 1 = {w w begins and ends with 1} and L 2 = {w w begins and ends with } How to split the word w = 1111? Multiple options This guessing is done by using nondeterminism: NFA s try out all computational branches and accept if one leads to an accepting state. INF28 Lecture :: 18th January 31 / 33

89 Concatanation of regular languages So what about concatanation of languages? Given two regular languages L 1, L 2, is L 1 L 2 = {w 1 w 2 w 1 L 1, w 2 L 2 } a regular language? an automaton gets an input w and must guess how to split it w = w 1 w 2 in order to check L 1 and L 2 membership. Example: L 1 = {w w begins and ends with 1} and L 2 = {w w begins and ends with } How to split the word w = 1111? Multiple options This guessing is done by using nondeterminism: NFA s try out all computational branches and accept if one leads to an accepting state. for concatanation: after having M 1 parse a part of the input that led to an accept state, nondeterministically hop into the second automaton M 2. INF28 Lecture :: 18th January 31 / 33

90 Concatanation of regular languages, 1, 1 B 1 B start A 1 C 1 start A 2 C 2 INF28 Lecture :: 18th January 32 / 33

91 Concatanation of regular languages, 1, 1 B 1 B start A 1 C 1 ε A 2 C 2 INF28 Lecture :: 18th January 33 / 33

COM364 Automata Theory Lecture Note 2 - Nondeterminism

COM364 Automata Theory Lecture Note 2 - Nondeterminism COM364 Automata Theory Lecture Note 2 - Nondeterminism Kurtuluş Küllü March 2018 The FA we saw until now were deterministic FA (DFA) in the sense that for each state and input symbol there was exactly

More information

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

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism, CS 54, Lecture 2: Finite Automata, Closure Properties Nondeterminism, Why so Many Models? Streaming Algorithms 0 42 Deterministic Finite Automata Anatomy of Deterministic Finite Automata transition: for

More information

Theory of Computation (I) Yijia Chen Fudan University

Theory of Computation (I) Yijia Chen Fudan University Theory of Computation (I) Yijia Chen Fudan University Instructor Yijia Chen Homepage: http://basics.sjtu.edu.cn/~chen Email: yijiachen@fudan.edu.cn Textbook Introduction to the Theory of Computation Michael

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 5-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY NON-DETERMINISM and REGULAR OPERATIONS THURSDAY JAN 6 UNION THEOREM The union of two regular languages is also a regular language Regular Languages Are

More information

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova. Introduction to the Theory of Computation Automata 1VO + 1PS Lecturer: Dr. Ana Sokolova http://cs.uni-salzburg.at/~anas/ Setup and Dates Lectures Tuesday 10:45 pm - 12:15 pm Instructions Tuesday 12:30

More information

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova. Introduction to the Theory of Computation Automata 1VO + 1PS Lecturer: Dr. Ana Sokolova http://cs.uni-salzburg.at/~anas/ Setup and Dates Lectures and Instructions 23.10. 3.11. 17.11. 24.11. 1.12. 11.12.

More information

Intro to Theory of Computation

Intro to Theory of Computation Intro to Theory of Computation 1/19/2016 LECTURE 3 Last time: DFAs and NFAs Operations on languages Today: Nondeterminism Equivalence of NFAs and DFAs Closure properties of regular languages Sofya Raskhodnikova

More information

September 7, Formal Definition of a Nondeterministic Finite Automaton

September 7, Formal Definition of a Nondeterministic Finite Automaton Formal Definition of a Nondeterministic Finite Automaton September 7, 2014 A comment first The formal definition of an NFA is similar to that of a DFA. Both have states, an alphabet, transition function,

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Not A DFA Does not have exactly one transition from every state on every symbol: Two transitions from q 0 on a No transition from q 1 (on either a or b) Though not a DFA,

More information

Chap. 1.2 NonDeterministic Finite Automata (NFA)

Chap. 1.2 NonDeterministic Finite Automata (NFA) Chap. 1.2 NonDeterministic Finite Automata (NFA) DFAs: exactly 1 new state for any state & next char NFA: machine may not work same each time More than 1 transition rule for same state & input Any one

More information

Equivalence of DFAs and NFAs

Equivalence of DFAs and NFAs CS 172: Computability and Complexity Equivalence of DFAs and NFAs It s a tie! DFA NFA Sanjit A. Seshia EECS, UC Berkeley Acknowledgments: L.von Ahn, L. Blum, M. Blum What we ll do today Prove that DFAs

More information

Computational Models Lecture 2 1

Computational Models Lecture 2 1 Computational Models Lecture 2 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. March 16/18, 2015 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Context-Free Languages

Context-Free Languages CS:4330 Theory of Computation Spring 2018 Context-Free Languages Pushdown Automata Haniel Barbosa Readings for this lecture Chapter 2 of [Sipser 1996], 3rd edition. Section 2.2. Finite automaton 1 / 13

More information

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable? } We ll now take a look at Turing Machines at a high level and consider what types of problems can be solved algorithmically and what types can t: What languages are Turing-decidable? What languages are

More information

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT. Recap DFA,NFA, DTM Slides by Prof. Debasis Mitra, FIT. 1 Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { {, } } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 3.3, 4.1 State and use the Church-Turing thesis. Give examples of decidable problems.

More information

CS 455/555: Finite automata

CS 455/555: Finite automata CS 455/555: Finite automata Stefan D. Bruda Winter 2019 AUTOMATA (FINITE OR NOT) Generally any automaton Has a finite-state control Scans the input one symbol at a time Takes an action based on the currently

More information

Inf2A: Converting from NFAs to DFAs and Closure Properties

Inf2A: Converting from NFAs to DFAs and Closure Properties 1/43 Inf2A: Converting from NFAs to DFAs and Stuart Anderson School of Informatics University of Edinburgh October 13, 2009 Starter Questions 2/43 1 Can you devise a way of testing for any FSM M whether

More information

Finite Automata and Regular languages

Finite Automata and Regular languages Finite Automata and Regular languages Huan Long Shanghai Jiao Tong University Acknowledgements Part of the slides comes from a similar course in Fudan University given by Prof. Yijia Chen. http://basics.sjtu.edu.cn/

More information

CS 154. Finite Automata, Nondeterminism, Regular Expressions

CS 154. Finite Automata, Nondeterminism, Regular Expressions CS 54 Finite Automata, Nondeterminism, Regular Expressions Read string left to right The DFA accepts a string if the process ends in a double circle A DFA is a 5-tuple M = (Q, Σ, δ, q, F) Q is the set

More information

Computability Theory

Computability Theory CS:4330 Theory of Computation Spring 2018 Computability Theory Decidable Languages Haniel Barbosa Readings for this lecture Chapter 4 of [Sipser 1996], 3rd edition. Section 4.1. Decidable Languages We

More information

Chapter Five: Nondeterministic Finite Automata

Chapter Five: Nondeterministic Finite Automata Chapter Five: Nondeterministic Finite Automata From DFA to NFA A DFA has exactly one transition from every state on every symbol in the alphabet. By relaxing this requirement we get a related but more

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Lecture 6 Section 2.2 Robb T. Koether Hampden-Sydney College Mon, Sep 5, 2016 Robb T. Koether (Hampden-Sydney College) Nondeterministic Finite Automata Mon, Sep 5, 2016

More information

Computational Models Lecture 2 1

Computational Models Lecture 2 1 Computational Models Lecture 2 1 Handout Mode Iftach Haitner. Tel Aviv University. October 30, 2017 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.

More information

Theory of Computation Lecture 1. Dr. Nahla Belal

Theory of Computation Lecture 1. Dr. Nahla Belal Theory of Computation Lecture 1 Dr. Nahla Belal Book The primary textbook is: Introduction to the Theory of Computation by Michael Sipser. Grading 10%: Weekly Homework. 30%: Two quizzes and one exam. 20%:

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION FORMAL LANGUAGES, AUTOMATA AND COMPUTATION DECIDABILITY ( LECTURE 15) SLIDES FOR 15-453 SPRING 2011 1 / 34 TURING MACHINES-SYNOPSIS The most general model of computation Computations of a TM are described

More information

CS 154 Introduction to Automata and Complexity Theory

CS 154 Introduction to Automata and Complexity Theory CS 154 Introduction to Automata and Complexity Theory cs154.stanford.edu 1 INSTRUCTORS & TAs Ryan Williams Cody Murray Lera Nikolaenko Sunny Rajan 2 Textbook 3 Homework / Problem Sets Homework will be

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION "Winter" 2018 http://cseweb.ucsd.edu/classes/wi18/cse105-ab/ Today's learning goals Sipser Ch 4.1 Explain what it means for a problem to be decidable. Justify the use of encoding.

More information

CS 154, Lecture 3: DFA NFA, Regular Expressions

CS 154, Lecture 3: DFA NFA, Regular Expressions CS 154, Lecture 3: DFA NFA, Regular Expressions Homework 1 is coming out Deterministic Finite Automata Computation with finite memory Non-Deterministic Finite Automata Computation with finite memory and

More information

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA)

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA) Deterministic Finite Automata Non deterministic finite automata Automata we ve been dealing with have been deterministic For every state and every alphabet symbol there is exactly one move that the machine

More information

CSC173 Workshop: 13 Sept. Notes

CSC173 Workshop: 13 Sept. Notes CSC173 Workshop: 13 Sept. Notes Frank Ferraro Department of Computer Science University of Rochester September 14, 2010 1 Regular Languages and Equivalent Forms A language can be thought of a set L of

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY REVIEW for MIDTERM 1 THURSDAY Feb 6 Midterm 1 will cover everything we have seen so far The PROBLEMS will be from Sipser, Chapters 1, 2, 3 It will be

More information

Lecture 17: Language Recognition

Lecture 17: Language Recognition Lecture 17: Language Recognition Finite State Automata Deterministic and Non-Deterministic Finite Automata Regular Expressions Push-Down Automata Turing Machines Modeling Computation When attempting to

More information

Finite Automata Part Two

Finite Automata Part Two Finite Automata Part Two DFAs A DFA is a Deterministic Finite Automaton A DFA is defined relative to some alphabet Σ. For each state in the DFA, there must be exactly one transition defined for each symbol

More information

Finite Automata and Languages

Finite Automata and Languages CS62, IIT BOMBAY Finite Automata and Languages Ashutosh Trivedi Department of Computer Science and Engineering, IIT Bombay CS62: New Trends in IT: Modeling and Verification of Cyber-Physical Systems (2

More information

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

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS Automata Theory Lecture on Discussion Course of CS2 This Lecture is about Mathematical Models of Computation. Why Should I Care? - Ways of thinking. - Theory can drive practice. - Don t be an Instrumentalist.

More information

2017/08/29 Chapter 1.2 in Sipser Ø Announcement:

2017/08/29 Chapter 1.2 in Sipser Ø Announcement: Nondeterministic Human-aware Finite Robo.cs Automata 2017/08/29 Chapter 1.2 in Sipser Ø Announcement: q Piazza registration: http://piazza.com/asu/fall2017/cse355 q First poll will be posted on Piazza

More information

CS 208: Automata Theory and Logic

CS 208: Automata Theory and Logic CS 28: Automata Theory and Logic b a a start A x(la(x) y(x < y) L b (y)) B b Department of Computer Science and Engineering, Indian Institute of Technology Bombay of 32 Nondeterminism Alternation 2 of

More information

UNIT-VIII COMPUTABILITY THEORY

UNIT-VIII COMPUTABILITY THEORY CONTEXT SENSITIVE LANGUAGE UNIT-VIII COMPUTABILITY THEORY A Context Sensitive Grammar is a 4-tuple, G = (N, Σ P, S) where: N Set of non terminal symbols Σ Set of terminal symbols S Start symbol of the

More information

CPS 220 Theory of Computation REGULAR LANGUAGES

CPS 220 Theory of Computation REGULAR LANGUAGES CPS 22 Theory of Computation REGULAR LANGUAGES Introduction Model (def) a miniature representation of a thing; sometimes a facsimile Iraq village mockup for the Marines Scientific modelling - the process

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2018 http://cseweb.ucsd.edu/classes/sp18/cse105-ab/ Today's learning goals Sipser Ch 4.1 Explain what it means for a problem to be decidable. Justify the use of encoding.

More information

CS21 Decidability and Tractability

CS21 Decidability and Tractability CS21 Decidability and Tractability Lecture 2 January 5, 2018 January 5, 2018 CS21 Lecture 2 1 Outline Finite Automata Nondeterministic Finite Automata Closure under regular operations NFA, FA equivalence

More information

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata CISC 4090: Theory of Computation Chapter Regular Languages Xiaolan Zhang, adapted from slides by Prof. Werschulz Section.: Finite Automata Fordham University Department of Computer and Information Sciences

More information

Lecture 3: Nondeterministic Finite Automata

Lecture 3: Nondeterministic Finite Automata Lecture 3: Nondeterministic Finite Automata September 5, 206 CS 00 Theory of Computation As a recap of last lecture, recall that a deterministic finite automaton (DFA) consists of (Q, Σ, δ, q 0, F ) where

More information

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is,

T (s, xa) = T (T (s, x), a). The language recognized by M, denoted L(M), is the set of strings accepted by M. That is, Recall A deterministic finite automaton is a five-tuple where S is a finite set of states, M = (S, Σ, T, s 0, F ) Σ is an alphabet the input alphabet, T : S Σ S is the transition function, s 0 S is the

More information

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r

UNIT-II. NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: SIGNIFICANCE. Use of ε-transitions. s t a r t. ε r. e g u l a r Syllabus R9 Regulation UNIT-II NONDETERMINISTIC FINITE AUTOMATA WITH ε TRANSITIONS: In the automata theory, a nondeterministic finite automaton (NFA) or nondeterministic finite state machine is a finite

More information

Great Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2

Great Theoretical Ideas in Computer Science. Lecture 4: Deterministic Finite Automaton (DFA), Part 2 5-25 Great Theoretical Ideas in Computer Science Lecture 4: Deterministic Finite Automaton (DFA), Part 2 January 26th, 27 Formal definition: DFA A deterministic finite automaton (DFA) M =(Q,,,q,F) M is

More information

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1)

CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1) CS 530: Theory of Computation Based on Sipser (second edition): Notes on regular languages(version 1.1) Definition 1 (Alphabet) A alphabet is a finite set of objects called symbols. Definition 2 (String)

More information

Final exam study sheet for CS3719 Turing machines and decidability.

Final exam study sheet for CS3719 Turing machines and decidability. Final exam study sheet for CS3719 Turing machines and decidability. A Turing machine is a finite automaton with an infinite memory (tape). Formally, a Turing machine is a 6-tuple M = (Q, Σ, Γ, δ, q 0,

More information

Lecture 1: Finite State Automaton

Lecture 1: Finite State Automaton Lecture 1: Finite State Automaton Instructor: Ketan Mulmuley Scriber: Yuan Li January 6, 2015 1 Deterministic Finite Automaton Informally, a deterministic finite automaton (DFA) has finite number of s-

More information

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed HKN CS/ECE 374 Midterm 1 Review Nathan Bleier and Mahir Morshed For the most part, all about strings! String induction (to some extent) Regular languages Regular expressions (regexps) Deterministic finite

More information

Theory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is

Theory of Computation p.1/?? Theory of Computation p.2/?? Unknown: Implicitly a Boolean variable: true if a word is Abstraction of Problems Data: abstracted as a word in a given alphabet. Σ: alphabet, a finite, non-empty set of symbols. Σ : all the words of finite length built up using Σ: Conditions: abstracted as a

More information

Computational Models - Lecture 5 1

Computational Models - Lecture 5 1 Computational Models - Lecture 5 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. April 10/22, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Computational Models: Class 5

Computational Models: Class 5 Computational Models: Class 5 Benny Chor School of Computer Science Tel Aviv University March 27, 2019 Based on slides by Maurice Herlihy, Brown University, and modifications by Iftach Haitner and Yishay

More information

CSE 105 Theory of Computation Professor Jeanne Ferrante

CSE 105 Theory of Computation  Professor Jeanne Ferrante CSE 105 Theory of Computation http://www.jflap.org/jflaptmp/ Professor Jeanne Ferrante 1 Today s agenda NFA Review and Design NFA s Equivalence to DFA s Another Closure Property proof for Regular Languages

More information

Uses of finite automata

Uses of finite automata Chapter 2 :Finite Automata 2.1 Finite Automata Automata are computational devices to solve language recognition problems. Language recognition problem is to determine whether a word belongs to a language.

More information

CPSC 421: Tutorial #1

CPSC 421: Tutorial #1 CPSC 421: Tutorial #1 October 14, 2016 Set Theory. 1. Let A be an arbitrary set, and let B = {x A : x / x}. That is, B contains all sets in A that do not contain themselves: For all y, ( ) y B if and only

More information

Outline. Nondetermistic Finite Automata. Transition diagrams. A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F)

Outline. Nondetermistic Finite Automata. Transition diagrams. A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F) Outline Nondeterminism Regular expressions Elementary reductions http://www.cs.caltech.edu/~cs20/a October 8, 2002 1 Determistic Finite Automata A finite automaton is a 5-tuple (Q, Σ,δ,q 0,F) Q is a finite

More information

Announcements. Problem Set Four due Thursday at 7:00PM (right before the midterm).

Announcements. Problem Set Four due Thursday at 7:00PM (right before the midterm). Finite Automata Announcements Problem Set Four due Thursday at 7:PM (right before the midterm). Stop by OH with questions! Email cs3@cs.stanford.edu with questions! Review session tonight, 7PM until whenever

More information

Fooling Sets and. Lecture 5

Fooling Sets and. Lecture 5 Fooling Sets and Introduction to Nondeterministic Finite Automata Lecture 5 Proving that a language is not regular Given a language, we saw how to prove it is regular (union, intersection, concatenation,

More information

Theory of Computation

Theory of Computation Theory of Computation COMP363/COMP6363 Prerequisites: COMP4 and COMP 6 (Foundations of Computing) Textbook: Introduction to Automata Theory, Languages and Computation John E. Hopcroft, Rajeev Motwani,

More information

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018 CS 301 Lecture 18 Decidable languages Stephen Checkoway April 2, 2018 1 / 26 Decidable language Recall, a language A is decidable if there is some TM M that 1 recognizes A (i.e., L(M) = A), and 2 halts

More information

CS243, Logic and Computation Nondeterministic finite automata

CS243, Logic and Computation Nondeterministic finite automata CS243, Prof. Alvarez NONDETERMINISTIC FINITE AUTOMATA (NFA) Prof. Sergio A. Alvarez http://www.cs.bc.edu/ alvarez/ Maloney Hall, room 569 alvarez@cs.bc.edu Computer Science Department voice: (67) 552-4333

More information

CSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs

CSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs CSE : Foundations of Computing Lecture : Finite State Machine Minimization & NFAs State Minimization Many different FSMs (DFAs) for the same problem Take a given FSM and try to reduce its state set by

More information

Non-deterministic Finite Automata (NFAs)

Non-deterministic Finite Automata (NFAs) Algorithms & Models of Computation CS/ECE 374, Fall 27 Non-deterministic Finite Automata (NFAs) Part I NFA Introduction Lecture 4 Thursday, September 7, 27 Sariel Har-Peled (UIUC) CS374 Fall 27 / 39 Sariel

More information

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen Pushdown automata Twan van Laarhoven Institute for Computing and Information Sciences Intelligent Systems Version: fall 2014 T. van Laarhoven Version: fall 2014 Formal Languages, Grammars and Automata

More information

DM17. Beregnelighed. Jacob Aae Mikkelsen

DM17. Beregnelighed. Jacob Aae Mikkelsen DM17 Beregnelighed Jacob Aae Mikkelsen January 12, 2007 CONTENTS Contents 1 Introduction 2 1.1 Operations with languages...................... 2 2 Finite Automata 3 2.1 Regular expressions/languages....................

More information

Sri vidya college of engineering and technology

Sri vidya college of engineering and technology Unit I FINITE AUTOMATA 1. Define hypothesis. The formal proof can be using deductive proof and inductive proof. The deductive proof consists of sequence of statements given with logical reasoning in order

More information

Nondeterminism. September 7, Nondeterminism

Nondeterminism. September 7, Nondeterminism September 7, 204 Introduction is a useful concept that has a great impact on the theory of computation Introduction is a useful concept that has a great impact on the theory of computation So far in our

More information

3515ICT: Theory of Computation. Regular languages

3515ICT: Theory of Computation. Regular languages 3515ICT: Theory of Computation Regular languages Notation and concepts concerning alphabets, strings and languages, and identification of languages with problems (H, 1.5). Regular expressions (H, 3.1,

More information

Computational Models - Lecture 4

Computational Models - Lecture 4 Computational Models - Lecture 4 Regular languages: The Myhill-Nerode Theorem Context-free Grammars Chomsky Normal Form Pumping Lemma for context free languages Non context-free languages: Examples Push

More information

Decidability (intro.)

Decidability (intro.) CHAPTER 4 Decidability Contents Decidable Languages decidable problems concerning regular languages decidable problems concerning context-free languages The Halting Problem The diagonalization method The

More information

Chapter 6: NFA Applications

Chapter 6: NFA Applications Chapter 6: NFA Applications Implementing NFAs The problem with implementing NFAs is that, being nondeterministic, they define a more complex computational procedure for testing language membership. To

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 2 Define push down automata Trace the computation of a push down automaton Design

More information

Computational Models - Lecture 1 1

Computational Models - Lecture 1 1 Computational Models - Lecture 1 1 Handout Mode Ronitt Rubinfeld and Iftach Haitner. Tel Aviv University. February 29/ March 02, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames

More information

Theory of Languages and Automata

Theory of Languages and Automata Theory of Languages and Automata Chapter 1- Regular Languages & Finite State Automaton Sharif University of Technology Finite State Automaton We begin with the simplest model of Computation, called finite

More information

Nondeterministic finite automata

Nondeterministic finite automata Lecture 3 Nondeterministic finite automata This lecture is focused on the nondeterministic finite automata (NFA) model and its relationship to the DFA model. Nondeterminism is an important concept in the

More information

Automata: a short introduction

Automata: a short introduction ILIAS, University of Luxembourg Discrete Mathematics II May 2012 What is a computer? Real computers are complicated; We abstract up to an essential model of computation; We begin with the simplest possible

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 2 Design a PDA and a CFG for a given language Give informal description for a PDA,

More information

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont )

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont ) CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata (cont ) Sungjin Im University of California, Merced 2-3-214 Example II A ɛ B ɛ D F C E Example II A ɛ B ɛ D F C E NFA accepting

More information

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) September,

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever.  ETH Zürich (D-ITET) September, Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu ETH Zürich (D-ITET) September, 24 2015 Last week was all about Deterministic Finite Automaton We saw three main

More information

Computer Sciences Department

Computer Sciences Department 1 Reference Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER 3 objectives Finite automaton Infinite automaton Formal definition State diagram Regular and Non-regular

More information

Non-Deterministic Finite Automata

Non-Deterministic Finite Automata Slides modified Yishay Mansour on modification by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 8 Non-Deterministic Finite Automata 0,1 0,1 0 0,ε q q 1 q 2 3 1 q 4 an NFA

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION "Winter" 2018 http://cseweb.ucsd.edu/classes/wi18/cse105-ab/ Today's learning goals Sipser Section 1.1 Design an automaton that recognizes a given language. Specify each of

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata COMP2600 Formal Methods for Software Engineering Katya Lebedeva Australian National University Semester 2, 206 Slides by Katya Lebedeva. COMP 2600 Nondeterministic Finite

More information

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013

CMPSCI 250: Introduction to Computation. Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013 CMPSCI 250: Introduction to Computation Lecture #22: From λ-nfa s to NFA s to DFA s David Mix Barrington 22 April 2013 λ-nfa s to NFA s to DFA s Reviewing the Three Models and Kleene s Theorem The Subset

More information

Closure under the Regular Operations

Closure under the Regular Operations September 7, 2013 Application of NFA Now we use the NFA to show that collection of regular languages is closed under regular operations union, concatenation, and star Earlier we have shown this closure

More information

Theory of Computation (IX) Yijia Chen Fudan University

Theory of Computation (IX) Yijia Chen Fudan University Theory of Computation (IX) Yijia Chen Fudan University Review The Definition of Algorithm Polynomials and their roots A polynomial is a sum of terms, where each term is a product of certain variables and

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/ Review of CFG, CFL, ambiguity What is the language generated by the CFG below: G 1 = ({S,T 1,T 2 }, {0,1,2}, { S

More information

Lecture 4 Nondeterministic Finite Accepters

Lecture 4 Nondeterministic Finite Accepters Lecture 4 Nondeterministic Finite Accepters COT 4420 Theory of Computation Section 2.2, 2.3 Nondeterminism A nondeterministic finite automaton can go to several states at once. Transitions from one state

More information

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta

CSE 2001: Introduction to Theory of Computation Fall Suprakash Datta CSE 2001: Introduction to Theory of Computation Fall 2013 Suprakash Datta datta@cse.yorku.ca Office: CSEB 3043 Phone: 416-736-2100 ext 77875 Course page: http://www.eecs.yorku.ca/course/2001 9/10/2013

More information

Harvard CS 121 and CSCI E-207 Lecture 4: NFAs vs. DFAs, Closure Properties

Harvard CS 121 and CSCI E-207 Lecture 4: NFAs vs. DFAs, Closure Properties Harvard CS 121 and CSCI E-207 Lecture 4: NFAs vs. DFAs, Closure Properties Salil Vadhan September 13, 2012 Reading: Sipser, 1.2. How to simulate NFAs? NFA accepts w if there is at least one accepting computational

More information

Kleene Algebras and Algebraic Path Problems

Kleene Algebras and Algebraic Path Problems Kleene Algebras and Algebraic Path Problems Davis Foote May 8, 015 1 Regular Languages 1.1 Deterministic Finite Automata A deterministic finite automaton (DFA) is a model of computation that can simulate

More information

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 6 CHAPTER 2 FINITE AUTOMATA 2. Nondeterministic Finite Automata NFA 3. Finite Automata and Regular Expressions 4. Languages

More information

Languages, regular languages, finite automata

Languages, regular languages, finite automata Notes on Computer Theory Last updated: January, 2018 Languages, regular languages, finite automata Content largely taken from Richards [1] and Sipser [2] 1 Languages An alphabet is a finite set of characters,

More information

Nondeterministic Finite Automata and Regular Expressions

Nondeterministic Finite Automata and Regular Expressions Nondeterministic Finite Automata and Regular Expressions CS 2800: Discrete Structures, Spring 2015 Sid Chaudhuri Recap: Deterministic Finite Automaton A DFA is a 5-tuple M = (Q, Σ, δ, q 0, F) Q is a finite

More information

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc.

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc. The Pumping Lemma For every regular language L, there is a number l 1 satisfying the pumping lemma property: All w L with w l can be expressed as a concatenation of three strings, w = u 1 vu 2, where u

More information

Finite Automata. Mahesh Viswanathan

Finite Automata. Mahesh Viswanathan Finite Automata Mahesh Viswanathan In this lecture, we will consider different models of finite state machines and study their relative power. These notes assume that the reader is familiar with DFAs,

More information

Foundations of Informatics: a Bridging Course

Foundations of Informatics: a Bridging Course Foundations of Informatics: a Bridging Course Week 3: Formal Languages and Semantics Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen University noll@cs.rwth-aachen.de http://www.b-it-center.de/wob/en/view/class211_id948.html

More information

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata

CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata CSE 135: Introduction to Theory of Computation Nondeterministic Finite Automata Sungjin Im University of California, Merced 1-27-215 Nondeterminism Michael Rabin and Dana Scott (1959) Michael Rabin Dana

More information