Computability and Complexity

Size: px
Start display at page:

Download "Computability and Complexity"

Transcription

1 Computability and Complexity Non-determinism, Regular Expressions CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario, Canada Ryszard Janicki Computability and Complexity 1 / 49

2 Non-determinism vs Determinism: Example Does non-determinism increases the descriptive power? Ryszard Janicki Computability and Complexity 2 / 49

3 Non-determinism vs Determinism: Example Does non-determinism increases the descriptive power? NO. See an example below and Theorem on next page. Ryszard Janicki Computability and Complexity 2 / 49

4 Non-determinism vs Determinism Theorem Let L be a language accepted by a non-deterministic nite automaton M, i.e. L = L(M). There exists a deterministic nite automaton M such that L(M ) = L. Proof. Let M = (Q, Σ, δ, q 0, F ) be a non-deterministic automaton, i.e. δ : Q Σ 2 Q, such that L(M) = M. Dene M = (Q, Σ, δ, q 0, F ) as follows: Q = 2 Q δ : Q Σ Q, i.e. δ : 2 Q Σ 2 Q, and δ ({q 1,..., q n }, a) = n δ(q i, a) i=1 q 0 = {q 0} F = {q q Q = 2 Q q F } Ryszard Janicki Computability and Complexity 3 / 49

5 Proof - continued First we will prove that: δ ({q 0 }, x) = {q 1,..., q n } = δ(q 0, x), where {q 1,..., q n } is a set of states in M but one state in M. The proof is by induction on x (very popular technique for automata and strings theory!). We will also identify δ with ˆδ, and δ with ˆδ here. Base case: x = 0 x = ε = δ ({q 0 }, ε) = {q 0 } = δ(q 0, ε). Induction step: Suppose that the hypothesis is true for x = m. Consider xa = m + 1. We have: δ ({q 0 }, xa) = δ (δ ({q 0 }, x) }{{}, a) = δ(q 0, x) by induction hypothesis Suppose that δ(q 0, x) = {q 1,..., q k }. Ryszard Janicki Computability and Complexity 4 / 49

6 Proof - continued Hence: δ ({q 0 }, xa) = δ ({q 1,..., q k }, a) On the other hand: δ(q 0, xa) = s δ(q 0,x) δ(s, a) = By the denition of δ = s {q 1,...,q n δ(s, a) = Which means δ ({q 0 }, x) = δ(q 0, x) for all x. k δ(q i, a) i=1 k δ(q i, a) i=1 Ryszard Janicki Computability and Complexity 5 / 49

7 Proof - end Since F = {q q Q = 2 Q q F }, then δ ({q 0 }, x) F δ ({q 0 }, x) F δ(q 0, x) F. Which means that: L(M ) = {x δ ({q 0 }, x) F } = {x δ(q 0, x) F } = L(M), which ends the proof. Ryszard Janicki Computability and Complexity 6 / 49

8 Non-determinism and `Black Box' Paradigm The proof can be extended for some innities, but not for all. Important Conclusion: For most of the cases non-determinism is not observable, which means that the `Black Box' approach may not always work, we need some insider information to decide if the process is deterministic or not. Ryszard Janicki Computability and Complexity 7 / 49

9 Invisible Actions or ε-moves In many cases we need to model invisible actions! Denition A non-deterministic automaton with ε-moves is: M = (Q, Σ, δ, q 0, F ), where: Q, Σ, q 0, F are as usual, and: δ : Q (Σ {ε}) 2 Q. Problem: ε has two interpretations! Ryszard Janicki Computability and Complexity 8 / 49

10 ε-closure Dene the following family of functions ˆε i : 2 Q 2 Q, i = 0, 1, 2,... as follows: for each set of states X Q ˆε 0 (X ) = X ˆε 1 (X ) = δ(x, ε) = q X δ(q, ε) ˆε i+1 (X ) = δ(ˆε i (X ), ε) = q δ(q, ε) Denition For every X Q, we dene the ε-closure of X as: εcl(x ) = i=0 ˆεi (X ). εcl(x ) is the set of states that contains X and all the states that can be reached from X by arrows labelled with ε. Ryszard Janicki Computability and Complexity 9 / 49

11 ˆδ and Language for Automata with ε-moves Denition We dene ˆδ : Q Σ 2 Q as follows: ˆδ(q, ε) = εcl({q}) ˆδ(q, xa) = εcl(δ(ˆδ(q, x), a) or ˆδ(q, xa) = εcl(y ), where Y = r ˆδ(q,x) δ(r, a). Clearly it may happen that δ(q, ε) ˆδ(q, ε) Denition The language generated by an automaton with ε-moves M, is dened now standardly as L(M) = {x ˆδ(q 0, x) F }. Ryszard Janicki Computability and Complexity 10 / 49

12 Removal of ε-moves Theorem If L is accepted by a nondeterministic automaton with ε-moves, then L is also accepted by a nondeterministic automaton without ε-moves. sketch. Let M = (Q, Σ, δ, q 0, F ) be a nondeterministic automaton with ε-moves. We dene M = (Q, Σ, δ, q 0, F ), where s Q. a Σ. δ (q, a) = ˆδ(q, a) { F F {q0 } εcl({q = 0 }) F F otherwise We are removing ε-moves in the construction above. One can show that L(M) = L(M ). Ryszard Janicki Computability and Complexity 11 / 49

13 Removal of ε-moves: An example Ryszard Janicki Computability and Complexity 12 / 49

14 Non-determinism, ε-moves: Final Comment For nite automata, neither non-determinism nor ε-moves increase the descriptive power. We can always translate one into another, however in the worst case, a deterministic automaton may have 2 Q states. For deterministic automata, angelic and demonic semantics are identical, as we do not have any choice. Ryszard Janicki Computability and Complexity 13 / 49

15 Regular Languages Denition (The most popular one) Let Σ be an alphabet. A language L Σ is called regular if and only if there exists a deterministic nite automaton M such that L = L(M). The class of all regular languages will be denoted by L R. Since every non-deterministic automaton with ε-moves can be simulated by an appropriate non-deterministic automaton without ε-moves, and every non-deterministic automaton can be replaced by an appropriate deterministic automaton, in the denition above we can replace `deterministic' with `non-deterministic' or `non-deterministic with ε-moves'. Ryszard Janicki Computability and Complexity 14 / 49

16 Basic Operators on Languages Let Σ be an alphabet and let A, B Σ. Set operators: Union: A B = {x x A x B}. Intersection: A B = {x x A x B}. Subtraction: A \ B = {x x A x / B}. Complement: A = Σ \ A. Concatenation: AB = A B = {xy x A x B}. Star (Kleene star): A = {x 1 x 2... x k k 0 x i A}. On page 7 of Lecture Notes 1, we dene Σ as Σ = {a 1... a k a i Σ k 0}. Note that Σ = Σ, where on the left hand side we use the denition of Kleene star and on the right hand side we use the denition from page 7 of Lecture Notes 1. The operators ` ', ` ' and `Kleene star' are called regular. Ryszard Janicki Computability and Complexity 15 / 49

17 Regular Expressions: Intuition `zero or one followed by any number of zeros (0 1)0 {0, 00, 000,..., 1, 10, 100, 1000,...} including none' ab {a, ab, abb, abbb,...} (a b) {a, b} `all strings (including ε) that can be built from a and b' (a ε)(b ε) = ab εb aε εε = ab b a ε {ε, a, b, ab} Ryszard Janicki Computability and Complexity 16 / 49

18 Denition (Formal Denition of Regular Expressions) Let Σ be an alphabet. A string R built from the elements of Σ {ε,, (, ),, } is a regular expression, if it is dened by the following rules: 1, ε and each a Σ are regular expressions. 2 (R 1 R 2 ) is a regular expression if R 1 and R 2 are regular expressions. 3 (R 1 R 2 ) is a regular expression if R 1 and R 2 are regular expressions. 4 (R) is a regular expression if R is a regular expression. 5 There are no other regular expressions. The set of all regular expressions over the alphabet Σ will be denoted by Rex(Σ). We usually skip some parenthesis. Rules: rst, followed by concatenation, and nally, unless parentheses say dierently. Ryszard Janicki Computability and Complexity 17 / 49

19 Languages Dened by Regular Expressions Denition (Interpretation) Let L : Rex(Σ) 2 Σ be the following function called interpretation: 1 L( ) =, L(ε) = ε, L(a) = {a} 2 L((R 1 R 2 )) = L(R 1 ) L(R 2 ) 3 L((R 1 R 2 )) = L(R 1 )L(R 2 ) 4 L((R) ) = L(R) Denition (Language) For every regular expression R, L(R) is a language dened by R. A class of all languages dened by regular expressions will be denoted by L REX. Ryszard Janicki Computability and Complexity 18 / 49

20 Languages Dened by Regular Expressions: Examples L((0 1)0 ) = {0, 00, 000,..., 1, 10, 100, 1000,...} L(ab ) = {a, ab, abb, abbb, abbbb,...} L((a ε)(b ε)) = {ε, a, b, ab} We customarily often identify a regular expression R with L(R) but technically R is not L(R). A question: What is the relationship between L R and L REX? Ryszard Janicki Computability and Complexity 19 / 49

21 Regular Expressions and Automata Lemma For every regular expression R, L(R) L R, i.e. L(R) is a regular language. In other words, L REX L R. Proof. We have to show that for every regular expression R, there is an automaton (could be non-deterministic with ε-moves) M R such that L(M R ) = L(M). The proof is by the induction on the denition of REX (Σ). 1. R = a, then L(R) = {a}, so the automaton M R is: a 2 2. R = ε, then L(R) = {ε}, so the automaton M R is: 2 3. R =, then L(R) =, so the automaton M R is: 4. Let R = R 1 R 2 and let M R1, M R2 be automata such that L(M R1 ) = L(R 1 ) and L(M R2 ) = L(R 2 ). Dene M R as follows: Ryszard Janicki Computability and Complexity 20 / 49

22 Proof for R = R 1 R 2 4. Let R = R 1 R 2 and let M R1, M R2 be automata such that L(M R1 ) = L(R 1 ) and L(M R2 ) = L(R 2 ). Dene M R as follows: Clearly L(M R ) = L(M R1 ) L(M R2 ) = L(R 1 ) L(R 2 ) = L(R). Ryszard Janicki Computability and Complexity 21 / 49

23 Proof for R = R 1 R 2 5. Let R = R 1 R 2 and let M R1, M R2 be automata such that L(M R1 ) = L(R 1 ) and L(M R2 ) = L(R 2 ). Dene M R as follows: Clearly L(M R ) = L(M R1 )L(M R2 ) = L(R 1 )L(R 2 ) = L(R). Ryszard Janicki Computability and Complexity 22 / 49

24 Proof for R = (R 1 ) 6. Let R = (R 1 ) and let M R1 be a automaton such that L(M R1 ) = L(R 1 ). Dene M R as follows: Clearly L(M R ) = L(M R1 ) = L(R 1 ) = L(R). Hence for every regular expression R, there is an automaton (usually non-deterministic with ε-moves) M R such that L(M R ) = L(M). Ryszard Janicki Computability and Complexity 23 / 49

25 From Automata to Regular Expressions So far we have shown that every regular expression can be transformed into appropriate automaton. We provide rules for transforming regular expressions into non-deterministic automata with ε-moves, but then we can use the rules for removal of ε-moves, and removal of non-determinism. Hence every regular expression correspond to an equivalent deterministic automaton, i.e. L REX L R. What about an opposite direction? Can we nd an appropriate regular expression for every nite automaton? Is it true that L R L REX? One possible method involves the concept of generalized non-deterministic automata. Ryszard Janicki Computability and Complexity 24 / 49

26 From Automata to Regular Expressions A generalized non-deterministic nite automaton has: ONE nal state Arrows are labeled by regular expressions No arrow to the initial state No arrow from the nal state Two states are connected by at most one arrow Ryszard Janicki Computability and Complexity 25 / 49

27 Generalized Non-deterministic Automata Denition Let Σ be an alphabet. A generalized non-deterministic (nite) automaton is a 5-tuple: GM = (Q,, δ, s 0, {s final }), where: Q is the set of states (nite), REX (Σ) is the generalized alphabet (nite), δ : Q 2 Q is the transition function, s 0 Q is the initial state, s final Q is its only nal state, and s Q. R. s 0 / δ(s, R) R. δ(s final, R) = (no arrow to the initial state) (no arrow from the nal state) s, q Q. (q δ(s, R 1 ) q δ(s, R 2 ) = R 1 = R 2 ) (two states are connected by at most one arrow). Ryszard Janicki Computability and Complexity 26 / 49

28 Languages of Generalized Non-deterministic Automata Denition The set L gen (GM) = {R s final ˆδ(s 0, R)} is the generalized language of GM. Note that L gen (GM) REX (Σ), i.e. every element of L gen (GM) is a regular expression. The set L(GM) = {x R L gen (GM). x L(R)} = is the language accepted/generated by GM. R L gen(gm) In the formula above, L(R) is a language generated by a regular expression R. L(R) Ryszard Janicki Computability and Complexity 27 / 49

29 Languages of Generalized Automata: Example Consider the following generalized automaton GM: Σ = {a, b, c}, Q = {s 0, s 1, s 2, s final } ={ε, ab, (ac), cb a, a c}={(ε), (ab), (ac), (cb a ), (a c)}, L gen (GM) = ε (ab) ( (ac) (cb a ) (a c) ), L(GM) = (ab) ((ac) (cb a ) (a c)), ε (ab) (ac) (cb a ) = (ab)(ac) (cb a ) L gen (GM), abacacaccb (ab)(ac) (cb a ), so abacacaccb L(GM). Ryszard Janicki Computability and Complexity 28 / 49

30 Automata vs Generalized Automata Every automaton can easily be transformed into an equivalent generalized automaton in two easy steps: step 1: step 2: Ryszard Janicki Computability and Complexity 29 / 49

31 Automata vs Generalized Automata: Example Example Ryszard Janicki Computability and Complexity 30 / 49

32 Algorithm CONVERT (GM): Basis Idea The algorithm starts with an arbitrary generalized automaton and then remove a state, that is neither nal, nor initial, while preserving the language generated by the initial automaton. This process is repeated until only the initial and the nal state remain. A regular expression assigned to the arrow that connects the initial and nal states represents the same language as the one generated by the initial generalized automaton. Ryszard Janicki Computability and Complexity 31 / 49

33 Algorithm CONVERT (GM): State Removal The state removal is based on the following idea: Ryszard Janicki Computability and Complexity 32 / 49

34 Algorithm CONVERT (GM) Let Q = n. We may assume that all states are represented by numbers 1,..., n, with s 0 = 1 and s final = n. We also assume that if there is an arrow between states i and j, it is labeled by an regular expression R ij. If n=2 then GM = R 2 and CONVERT (GM) returns R. If n > 2, select q k Q \ {1, n} and dene GM = (Q \ {q k },, δ, s 0, {s final }), where GM is derived from GM by removing the state k, removing all arrows that start with or end at k and, for all i, j dierent from k, including the case i = j, if j δ(i, R ij ), replacing R ij by R ij = R ik(r kk ) R kj R ij. Next we compute CONVERT (GM ) This is a recursive procedure that stops when the only states are 1 and n. Ryszard Janicki Computability and Complexity 33 / 49

35 Algorithm CONVERT (GM): Example 1 Ryszard Janicki Computability and Complexity 34 / 49

36 Algorithm CONVERT (GM): Example 2 Ryszard Janicki Computability and Complexity 35 / 49

37 Antomata vs Regular Expressions: Conclusion Theorem L R = L REX Ryszard Janicki Computability and Complexity 36 / 49

38 Programs as Automata and Regular Expressions of Relations Consider the well-known procedure factorial, written in a small subset of Maple: factorial := proc(n::posint) local i, fac i:=1; fac:=1; while i < n do begin i:=i+1 fac:=fac i; end; end proc; Since n does not change its value in the above program we may consider it as a constant, so we may assume the above program has two integer variables i and fac. Ryszard Janicki Computability and Complexity 37 / 49

39 About Relations: Composition and Identity Let X, Y are sets. Any R X Y is a (binary) relation. Composition of Relations: Let R X Y, S Y Z. Then the relation R S X Z, a composition of R and Z is a relation dened as follows: x(r S)z y Y. xry ysz. Identity: For every non-empty set X, the relation I X = {(x, x) x X } X X is called the identity on X. Power: For every set X and every relation R X X, we dene: R 0 = I X R k+1 = R k R, or, equivalently, R k = R}.{{.. R}. k Ryszard Janicki Computability and Complexity 38 / 49

40 About Relations: Transitive and Reexive Closures Let X be as set and let R X X be a relation. A relation R + = is a transitive closure of R. A relation R = i=1 i=0 is a reexive and transitive closure of R (Kleene star). R i R i We have: R = R + I X and R + = R R. An alternative denitions of R + and R : xr + y i 1. xr i y, xr y i 0. xr i y Ryszard Janicki Computability and Complexity 39 / 49

41 Programs as Relations Dene D = ZZ ZZ, where ZZ is the set of integers, and denote the elements of D as (i, fac). Each assignment statement can be modeled by a function F i : D D, i = 1, 2, 4, 5, in the following manner: "i:=1" corresponds to F 1 (i, fac) = (1, fac), "fac:=1" corresponds to F 2 (i, fac) = (i, 1), "i:=i+1" corresponds to F 4 (i, fac) = (i + 1, fac), and "fac:=fac*i" maps to F 5 (i, fac) = (i, fac i). The test "i<n" can be modeled by two partial identity functions, I 3, Ī 3 : D D, where I 3 models "i<n", and Ī 3 models its complement, i.e. "i n". More precisely, "i<n" corresponds to I 3 (i, fac), and "i n" corresponds to Ī3(i, fac), where ( denotes undened) I 3 (i, fac) = { (i, fac) if i < n otherwise Ī 3 (i, fac) = { (i, fac) if i n otherwise Ryszard Janicki Computability and Complexity 40 / 49

42 Programs as Relational Expressions Let R, R 1, R 2 be relations (each function is a relation!) that model the program statements S, S1, S2, respectively. Let T be a test modeled by partial identities I T and Ī T, and let the symbols and denote the composition of relations, and transitive and reexive closure of relations (Kleene star), respectively. Formally, if R, R 1, R 2 X X, then x(r 1 R 2 )y z X. xr 1 z zr 2 y R = i=0 Ri, where R 0 = I X Alternative denition of R : xr y i 0. xr i y Ryszard Janicki Computability and Complexity 41 / 49

43 Programs as Relational Expressions We can now model the basic programming constructs as follows "S1;S2" is modeled by R 1 R 2, "if T then S1 else S2" is modeled by (I T R 1 ) (Ī T R 2 ), and "while T do S" is modeled by (I T R) Ī T. Using this scheme one can easily model the above program by writing the following (symbolic) relational expression: F = F 1 F 2 (I 3 F 4 F 5 ) Ī 3, or F = F 1 }{{} i:=1 F 2 }{{} fac:=1 i<n i:=i+1 {}}{ F 4 fac:=fac i {}}{ i n {}}{{}}{ ( I 3 F 5 ) Ī }{{ 3 } while i<n do i:=i+1;fac:=fac i od Ryszard Janicki Computability and Complexity 42 / 49

44 Programs as Automata We can now model the basic programming constructs as follows "S1;S2" is modeled by "if T then S1 else S2" is modeled by, and "while T do S" is modeled by Ryszard Janicki Computability and Complexity 43 / 49

45 Programs as Automata Using this scheme one can easily model the above program by the following nite deterministic automaton: which clearly corresponds to a regular relational expression: F = F 1 F 2 (I 3 F 4 F 5 ) Ī 3, Ryszard Janicki Computability and Complexity 44 / 49

46 Programs as Relational Expressions If R 1 and R 2 are (possibly partial) functions, calculating R = R 1 R 2 is easy: R(x 1,..., x n ) = R 2 (R 1 (x 1,..., x n )). If at least one of R 1, R 2 is not a function, in general, we have to use the rule: (x 1,..., x n )R 1 R 2 (z 1,..., z n ) (y 1,..., y n ). (x 1,..., x n )R 1 (y 1,..., y n ) (y 1,..., y n )R 2 (z 1,..., z n ). Nevertheless, it might happen that R 1 R 2 is a function even if both R 1 and R 2 are not. In general R 1 R 2 is not a function, even if both R 1 and R 2 are functions. Similarly, R = i=0 Ri is almost never a function, even if R is a function, since if R is a function, then (x 1,..., x n )R (y 1,..., y n ) i 0. (y 1,..., y n ) = R i (x 1,..., x n )), and this may happen for many, even innite number of i's. Ryszard Janicki Computability and Complexity 45 / 49

47 Programs as Relational Expressions Lemma (1) 1 For any test T, if R 1 and R 2 are functions then (I T R 1 ) (Ī T R 2 ) is always a function. 2 For any test T, if R is a function, then (I T R) Ī T is either a function or the empty relation. 3 For any test T, if R is a function and (I T R) Ī T, then ((I T R) Ī T )(x) = R k(x) (x) where k(x) is the smallest j such that Ī T (R j (x 1,..., x n ))(x). Ryszard Janicki Computability and Complexity 46 / 49

48 Dene G = I 3 F 4 F 5 and H = G Ī3, so F = F 1 F 2 H. First note that (F 1 F 2 )(i, fac) = F 2 (F 1 (i, fac)) = (1, 1), so F (i, fac) = H(F 2 (F 1 (i, fac))) = H(1, 1). For the function G we have: G(i, fac) = (I 3 F 4 F 5 )(i, fac) = F 5 (F 4 (I 3 (i, fac))) = Similarly : { (i + 1, fac (i + 1)) if i < n if i n { (i + 2, fac (i + 1) (i + 2)) G 2 if i + 1 < n (i, fac) = G(G(i, fac)) = if i + 1 n Hence : { G j (i + j, fac (i + 1) (i + 2)... (i + j)) if i + j 1 < n (i, fac) = if i + j 1 n Notice that this last step requires a small amount of human ingenuity to see the pattern (although it can be automated in some cases). Ryszard Janicki Computability and Complexity 47 / 49

49 From Lemma 1(3) it follows H(i, fac) = G k (i, fac) where k = k(i, fac) is the smallest j such that Ī 3 (G j (i, fac)). In this case we can easily show that there is only one such j and that k(i, fac) = n i. Denote fac = fac (i + 1) (i + 2)... (i + j). First note that Ī 3 (G j (i, fac)) implies G j (i, fac), i.e. G j (i, fac) = (i + j, fac ) and i + j 1 < n. Furthermore Ī 3 (i + j, fac ) implies i + j n. From i + j 1 < n and i + j n we immediately get i + j = n, or j = n i. Hence k(i, fac) = n i, i.e. H(i, fac) = G n i (i, fac) = (n, fac (i + 1) (i + 2)... n). This means so F (i, fac) = H(1, 1) = (n, n!), n IN. factorial(n) = n! Ryszard Janicki Computability and Complexity 48 / 49

50 Programs as Automata and Relational Expression To make this technique feasible for bigger, more realistic programs, we need a tool that would be able to do all those symbolic calculations. The reasoning presented above rely heavily on Lemma 1(3) and is rather typical for human beings. Many steps and observations are not easy to mechanize. Nevertheless, this technique has most likely better prospects to eventually lead to almost automatic theorem provers (at least for some special kind of programs), than for example well known Hoare Logic. On the other hand, for human beings skillful in nding loop invariant, Hoare Logic is probably more convenient. Ryszard Janicki Computability and Complexity 49 / 49

Discrete Mathematcs and Logic II.

Discrete Mathematcs and Logic II. Discrete Mathematcs and Logic II. SFWR ENG 2FA3 Ryszard Janicki Winter 2014 Acknowledgments: Material based the paper Computing Properties of Numerical Imperative Programs by Symbolic Computation by Jacques

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Sequences and Automata CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario, Canada janicki@mcmaster.ca Ryszard Janicki Computability

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Push-Down Automata CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario, Canada janicki@mcmaster.ca Ryszard Janicki Computability

More information

Discrete Mathematics and Logic II. Regular Sets

Discrete Mathematics and Logic II. Regular Sets Discrete Mathematics and Logic II. Regular Sets SFWR ENG 2FA3 Ryszard Janicki Winter 24 Acknowledgments: Material based on Automata and Computability by Dexter C. Kozen (Chapter 4). Ryszard Janicki Discrete

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Decidability, Undecidability and Reducibility; Codes, Algorithms and Languages CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario,

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

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

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

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

Introduction to Formal Languages, Automata and Computability p.1/51

Introduction to Formal Languages, Automata and Computability p.1/51 Introduction to Formal Languages, Automata and Computability Finite State Automata K. Krithivasan and R. Rama Introduction to Formal Languages, Automata and Computability p.1/51 Introduction As another

More information

Finite Automata and Regular Languages

Finite Automata and Regular Languages Finite Automata and Regular Languages Topics to be covered in Chapters 1-4 include: deterministic vs. nondeterministic FA, regular expressions, one-way vs. two-way FA, minimization, pumping lemma for regular

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

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 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

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

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

Regular Expressions. Definitions Equivalence to Finite Automata

Regular Expressions. Definitions Equivalence to Finite Automata Regular Expressions Definitions Equivalence to Finite Automata 1 RE s: Introduction Regular expressions are an algebraic way to describe languages. They describe exactly the regular languages. If E is

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

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

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

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

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism

Closure Properties of Regular Languages. Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties of Regular Languages Union, Intersection, Difference, Concatenation, Kleene Closure, Reversal, Homomorphism, Inverse Homomorphism Closure Properties Recall a closure property is a statement

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

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

2. Elements of the Theory of Computation, Lewis and Papadimitrou,

2. Elements of the Theory of Computation, Lewis and Papadimitrou, Introduction Finite Automata DFA, regular languages Nondeterminism, NFA, subset construction Regular Epressions Synta, Semantics Relationship to regular languages Properties of regular languages Pumping

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

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

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

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

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

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

Regular Expressions and Language Properties

Regular Expressions and Language Properties Regular Expressions and Language Properties Mridul Aanjaneya Stanford University July 3, 2012 Mridul Aanjaneya Automata Theory 1/ 47 Tentative Schedule HW #1: Out (07/03), Due (07/11) HW #2: Out (07/10),

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

CS21 Decidability and Tractability

CS21 Decidability and Tractability CS21 Decidability and Tractability Lecture 3 January 9, 2017 January 9, 2017 CS21 Lecture 3 1 Outline NFA, FA equivalence Regular Expressions FA and Regular Expressions January 9, 2017 CS21 Lecture 3 2

More information

Lecture 23 : Nondeterministic Finite Automata DRAFT Connection between Regular Expressions and Finite Automata

Lecture 23 : Nondeterministic Finite Automata DRAFT Connection between Regular Expressions and Finite Automata CS/Math 24: Introduction to Discrete Mathematics 4/2/2 Lecture 23 : Nondeterministic Finite Automata Instructor: Dieter van Melkebeek Scribe: Dalibor Zelený DRAFT Last time we designed finite state automata

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

Clarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata.

Clarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata. CMSC 330: Organization of Programming Languages Last Lecture Languages Sets of strings Operations on languages Finite Automata Regular expressions Constants Operators Precedence CMSC 330 2 Clarifications

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

September 11, Second Part of Regular Expressions Equivalence with Finite Aut

September 11, Second Part of Regular Expressions Equivalence with Finite Aut Second Part of Regular Expressions Equivalence with Finite Automata September 11, 2013 Lemma 1.60 If a language is regular then it is specified by a regular expression Proof idea: For a given regular language

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

Formal Models in NLP

Formal Models in NLP Formal Models in NLP Finite-State Automata Nina Seemann Universität Stuttgart Institut für Maschinelle Sprachverarbeitung Pfaffenwaldring 5b 70569 Stuttgart May 15, 2012 Nina Seemann (IMS) Formal Models

More information

Theory of computation: initial remarks (Chapter 11)

Theory of computation: initial remarks (Chapter 11) Theory of computation: initial remarks (Chapter 11) For many purposes, computation is elegantly modeled with simple mathematical objects: Turing machines, finite automata, pushdown automata, and such.

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

Computational Theory

Computational Theory Computational Theory Finite Automata and Regular Languages Curtis Larsen Dixie State University Computing and Design Fall 2018 Adapted from notes by Russ Ross Adapted from notes by Harry Lewis Curtis Larsen

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Rewriting Systems and Chomsky Grammars CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario, Canada janicki@mcmaster.ca Ryszard

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

Automata and Languages

Automata and Languages Automata and Languages Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan Nondeterministic Finite Automata with empty moves (-NFA) Definition A nondeterministic finite automaton

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

Finite Automata and Regular Languages (part III)

Finite Automata and Regular Languages (part III) Finite Automata and Regular Languages (part III) Prof. Dan A. Simovici UMB 1 / 1 Outline 2 / 1 Nondeterministic finite automata can be further generalized by allowing transitions between states without

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

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

More on Finite Automata and Regular Languages. (NTU EE) Regular Languages Fall / 41

More on Finite Automata and Regular Languages. (NTU EE) Regular Languages Fall / 41 More on Finite Automata and Regular Languages (NTU EE) Regular Languages Fall 2016 1 / 41 Pumping Lemma is not a Sufficient Condition Example 1 We know L = {b m c m m > 0} is not regular. Let us consider

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

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

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

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

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

Regular Languages. Problem Characterize those Languages recognized by Finite Automata.

Regular Languages. Problem Characterize those Languages recognized by Finite Automata. Regular Expressions Regular Languages Fundamental Question -- Cardinality Alphabet = Σ is finite Strings = Σ is countable Languages = P(Σ ) is uncountable # Finite Automata is countable -- Q Σ +1 transition

More information

Deterministic Finite Automaton (DFA)

Deterministic Finite Automaton (DFA) 1 Lecture Overview Deterministic Finite Automata (DFA) o accepting a string o defining a language Nondeterministic Finite Automata (NFA) o converting to DFA (subset construction) o constructed from a regular

More information

Lecture 2: Regular Expression

Lecture 2: Regular Expression Lecture 2: Regular Expression Instructor: Ketan Mulmuley Scriber: Yuan Li January 8, 2015 In the last lecture, we proved that DFA, NFA, and NFA with ϵ-moves are equivalent. Recall that a language L Σ is

More information

CS:4330 Theory of Computation Spring Regular Languages. Finite Automata and Regular Expressions. Haniel Barbosa

CS:4330 Theory of Computation Spring Regular Languages. Finite Automata and Regular Expressions. Haniel Barbosa CS:4330 Theory of Computation Spring 2018 Regular Languages Finite Automata and Regular Expressions Haniel Barbosa Readings for this lecture Chapter 1 of [Sipser 1996], 3rd edition. Sections 1.1 and 1.3.

More information

Foundations of

Foundations of 91.304 Foundations of (Theoretical) Computer Science Chapter 1 Lecture Notes (Section 1.3: Regular Expressions) David Martin dm@cs.uml.edu d with some modifications by Prof. Karen Daniels, Spring 2012

More information

UNIT-III REGULAR LANGUAGES

UNIT-III REGULAR LANGUAGES Syllabus R9 Regulation REGULAR EXPRESSIONS UNIT-III REGULAR LANGUAGES Regular expressions are useful for representing certain sets of strings in an algebraic fashion. In arithmetic we can use the operations

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

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

Automata Theory and Formal Grammars: Lecture 1

Automata Theory and Formal Grammars: Lecture 1 Automata Theory and Formal Grammars: Lecture 1 Sets, Languages, Logic Automata Theory and Formal Grammars: Lecture 1 p.1/72 Sets, Languages, Logic Today Course Overview Administrivia Sets Theory (Review?)

More information

Subset construction. We have defined for a DFA L(A) = {x Σ ˆδ(q 0, x) F } and for A NFA. For any NFA A we can build a DFA A D such that L(A) = L(A D )

Subset construction. We have defined for a DFA L(A) = {x Σ ˆδ(q 0, x) F } and for A NFA. For any NFA A we can build a DFA A D such that L(A) = L(A D ) Search algorithm Clever algorithm even for a single word Example: find abac in abaababac See Knuth-Morris-Pratt and String searching algorithm on wikipedia 2 Subset construction We have defined for a DFA

More information

Equivalence of Regular Expressions and FSMs

Equivalence of Regular Expressions and FSMs Equivalence of Regular Expressions and FSMs Greg Plaxton Theory in Programming Practice, Spring 2005 Department of Computer Science University of Texas at Austin Regular Language Recall that a language

More information

Theory of Computation (II) Yijia Chen Fudan University

Theory of Computation (II) Yijia Chen Fudan University Theory of Computation (II) Yijia Chen Fudan University Review A language L is a subset of strings over an alphabet Σ. Our goal is to identify those languages that can be recognized by one of the simplest

More information

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam ECS 120: Theory of Computation Handout MT UC Davis Phillip Rogaway February 16, 2012 Midterm Exam Instructions: The exam has six pages, including this cover page, printed out two-sided (no more wasted

More information

Fall 1999 Formal Language Theory Dr. R. Boyer. 1. There are other methods of nding a regular expression equivalent to a nite automaton in

Fall 1999 Formal Language Theory Dr. R. Boyer. 1. There are other methods of nding a regular expression equivalent to a nite automaton in Fall 1999 Formal Language Theory Dr. R. Boyer Week Four: Regular Languages; Pumping Lemma 1. There are other methods of nding a regular expression equivalent to a nite automaton in addition to the ones

More information

Introduction to Finite-State Automata

Introduction to Finite-State Automata Introduction to Finite-State Automata John McDonough Language Technologies Institute, Machine Learning for Signal Processing Group, Carnegie Mellon University March 26, 2012 Introduction In this lecture,

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

Critical CS Questions

Critical CS Questions Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Critical CS Questions What is a computer? And What is a Computation? real computers too complex for any

More information

Theory of computation: initial remarks (Chapter 11)

Theory of computation: initial remarks (Chapter 11) Theory of computation: initial remarks (Chapter 11) For many purposes, computation is elegantly modeled with simple mathematical objects: Turing machines, finite automata, pushdown automata, and such.

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

UNIT II REGULAR LANGUAGES

UNIT II REGULAR LANGUAGES 1 UNIT II REGULAR LANGUAGES Introduction: A regular expression is a way of describing a regular language. The various operations are closure, union and concatenation. We can also find the equivalent regular

More information

COMP4141 Theory of Computation

COMP4141 Theory of Computation COMP4141 Theory of Computation Lecture 4 Regular Languages cont. Ron van der Meyden CSE, UNSW Revision: 2013/03/14 (Credits: David Dill, Thomas Wilke, Kai Engelhardt, Peter Höfner, Rob van Glabbeek) Regular

More information

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata

CMSC 330: Organization of Programming Languages. Theory of Regular Expressions Finite Automata : Organization of Programming Languages Theory of Regular Expressions Finite Automata Previous Course Review {s s defined} means the set of string s such that s is chosen or defined as given s A means

More information

V Honors Theory of Computation

V Honors Theory of Computation V22.0453-001 Honors Theory of Computation Problem Set 3 Solutions Problem 1 Solution: The class of languages recognized by these machines is the exactly the class of regular languages, thus this TM variant

More information

Advanced Automata Theory 7 Automatic Functions

Advanced Automata Theory 7 Automatic Functions Advanced Automata Theory 7 Automatic Functions Frank Stephan Department of Computer Science Department of Mathematics National University of Singapore fstephan@comp.nus.edu.sg Advanced Automata Theory

More information

Johns Hopkins Math Tournament Proof Round: Automata

Johns Hopkins Math Tournament Proof Round: Automata Johns Hopkins Math Tournament 2018 Proof Round: Automata February 9, 2019 Problem Points Score 1 10 2 5 3 10 4 20 5 20 6 15 7 20 Total 100 Instructions The exam is worth 100 points; each part s point value

More information

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission.

CSE 105 Homework 1 Due: Monday October 9, Instructions. should be on each page of the submission. CSE 5 Homework Due: Monday October 9, 7 Instructions Upload a single file to Gradescope for each group. should be on each page of the submission. All group members names and PIDs Your assignments in this

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automata Theory and Formal Languages TMV27/DIT32 LP4 28 Lecture 5 Ana Bove March 26th 28 Recap: Inductive sets, (terminating) recursive functions, structural induction To define an inductive set

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

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

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

Takeaway Notes: Finite State Automata

Takeaway Notes: Finite State Automata Takeaway Notes: Finite State Automata Contents 1 Introduction 1 2 Basics and Ground Rules 2 2.1 Building Blocks.............................. 2 2.2 The Name of the Game.......................... 2 3 Deterministic

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

Time Magazine (1984)

Time Magazine (1984) Time Magazine (1984) Put the right kind of software into a computer, and it will do whatever you want it to. There may be limits on what you can do with the machines themselves, but there are no limits

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

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Organization of Programming Languages Theory of Regular Expressions DFAs and NFAs Reminders Project 1 due Sep. 24 Homework 1 posted Exam 1 on Sep. 25 Exam topics list posted Practice homework

More information

CONCATENATION AND KLEENE STAR ON DETERMINISTIC FINITE AUTOMATA

CONCATENATION AND KLEENE STAR ON DETERMINISTIC FINITE AUTOMATA 1 CONCATENATION AND KLEENE STAR ON DETERMINISTIC FINITE AUTOMATA GUO-QIANG ZHANG, XIANGNAN ZHOU, ROBERT FRASER, LICONG CUI Department of Electrical Engineering and Computer Science, Case Western Reserve

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

Context-free grammars and languages

Context-free grammars and languages Context-free grammars and languages The next class of languages we will study in the course is the class of context-free languages. They are defined by the notion of a context-free grammar, or a CFG for

More information

Nondeterministic Finite Automata. Nondeterminism Subset Construction

Nondeterministic Finite Automata. Nondeterminism Subset Construction Nondeterministic Finite Automata Nondeterminism Subset Construction 1 Nondeterminism A nondeterministic finite automaton has the ability to be in several states at once. Transitions from a state on an

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

Decision, Computation and Language

Decision, Computation and Language Decision, Computation and Language Non-Deterministic Finite Automata (NFA) Dr. Muhammad S Khan (mskhan@liv.ac.uk) Ashton Building, Room G22 http://www.csc.liv.ac.uk/~khan/comp218 Finite State Automata

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Mahesh Viswanathan Introducing Nondeterminism Consider the machine shown in Figure. Like a DFA it has finitely many states and transitions labeled by symbols from an input

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