Theory of Computation Context-Free Languages. (NTU EE) Context-Free Languages Fall / 1

Size: px
Start display at page:

Download "Theory of Computation Context-Free Languages. (NTU EE) Context-Free Languages Fall / 1"

Transcription

1 Theory of Computation Context-Free Languages (NTU EE) Context-Free Languages Fall / 1

2 Context-Free Grammars Here is an example of a context-free grammar G 1 : A 0A1 A B B # Each line is a substitution rule (or production). A, B are variables. 0, 1, # are terminals. The left-hand side of the first rule (A) is the start variable. (NTU EE) Context-Free Languages Fall / 1

3 Grammars and Languages A grammar describes a language. A grammar generates a string of its language as follows. 1 Write down the start variable. 2 Find a written variable and a rule whose left-hand side is that variable. 3 Replace the written variable with the right-hand side of the rule. 4 Repeat steps 2 and 3 until no variable remains. Any language that can be generated by some context-free grammar is called a context-free language. (NTU EE) Context-Free Languages Fall / 1

4 Grammars and Languages For example, consider the following derivation of the string 00#11 generated by G 1 : A 0A1 00A11 00B11 00#11 We also use a parse tree to denote a string generated by a grammar: A A A B 0 0 # 1 1 (NTU EE) Context-Free Languages Fall / 1

5 Context-Free Grammars Formal Definition Definition A context-free grammar is a 4-tuple (V, Σ, R, S) where V is a finite set of variables; Σ is a finite set of terminals where V Σ = ; R is a fintie set of rules. Each rule consists of a variable and a string of variables and terminals; and S V is the start variable. Let u, v, w are strings of variables and terminals, and A w a rule. We say uav yields uwv (written uav uwv). u derives v (written u = v) if u = v or there is a sequence u 1, u 2,..., u k (k 0) that u u 1 u 2 u k v. The language of the grammar is {w Σ : S = w}. (NTU EE) Context-Free Languages Fall / 1

6 Context-Free Languages Examples Example Consider G 3 = ({S}, {(, )}, R, S) where R is S (S) SS ɛ. A w 1 w 2 w k stands for A w 1 A w 2. A w k Examples of the strings generated by G 3 : ɛ, (), (())(),.... (NTU EE) Context-Free Languages Fall / 1

7 Context-Free Languages Examples From a DFA M, we can construct a context-free grammar G M such that the language of G is L(M). Let M = (Q, Σ, δ, q 0, F) be a DFA. Define G M = (V, Σ, P, S) where V = {Ri : q i Q} and S = {R 0 }; and P = {Ri ar j : δ(q i, a) = q j } {R i ɛ : q i F}. Recall M 3 and construct G M3 = ({R 1, R 2 }, {0, 1}, P, {R 1 }) with R 1 0R 1 1R 2 ɛ R 2 0R 1 1R q 1 q 2 0 (NTU EE) Context-Free Languages Fall / 1

8 Context-Free Languages Examples Example Consider G 4 = (V, Σ, R, EXPR ) where V = { EXPR, TERM, FACTOR }, Σ = {a, +,, (, )}; and R is EXPR EXPR + TERM TERM TERM TERM FACTOR FACTOR FACTOR ( EXPR ) a EXPR EXPR TERM TERM TERM FACTOR FACTOR FACTOR a + a a (NTU EE) Context-Free Languages Fall / 1

9 Ambiguity Example Consider G 5 : EXPR EXPR + EXPR EXPR EXPR ( EXPR ) a We have two parse trees for a + a a. EXPR EXPR EXPR EXPR EXPR EXPR EXPR EXPR EXPR EXPR a + a a a + a a If a grammar generates the same in different ways, the string is derived ambiguously in that grammar. If a grammar generates some string ambiguously, it is ambiguous. (NTU EE) Context-Free Languages Fall / 1

10 Ambiguity Formal Definition Definition A string is derived ambiguously in a grammar if it has two or more different leftmost derivations. A grammar is ambiguous if it generates some string ambiguously. A derivation is a leftmost derivation if the leftmost variable is the one replaced at every step. Two leftmost derivations of a + a a: EXPR EXPR EXPR EXPR + EXPR EXPR a+ EXPR EXPR a+a EXPR a+a a EXPR EXPR + EXPR a+ EXPR a+ EXPR EXPR a+a EXPR a+a a If a language can only be generated by ambiguous grammars, we call it is inherently ambiguous. {a i b j c k : i = j or j = k} is inherently ambiguous. (NTU EE) Context-Free Languages Fall / 1

11 Chomsky Normal Form Definition A context-free grammar is in Chomsky normal form if every rule is of the form S ɛ A BC A a where a is a terminal, S is the start variable, A is a variable, and B, C are non-start variables. A normal form means a uniform representation. conjunctive normal form, negative normal form, etc. Theorem Any context-free language is generated by a context-free grammar in Chomsky normal form. (NTU EE) Context-Free Languages Fall / 1

12 Chomsky Normal Form Proof. Given a context-free grammar for a context-free language, we will convert the grammar into Chomsky normal form. (start variable) Add a new start variable S 0 and a rule S 0 S. (ɛ-rules) For each ɛ-rule A ɛ(a S 0 ), remove it. Then for each occurrence of A on the right-hand side of a rule, add a new rule with that occurrence deleted. R uavaw becomes R uavaw uvaw uavw uvw. (unit rules) For each unit rule A B, remove it. Add the rule A u for each B u. For each rule A u 1 u 2 u k (k 3) and u i is a variable or terminal, replace it by A u 1 A 1, A 1 u 2 A 2,..., A k 2 u k 1 u k. For each rule A u 1 u 2 with u 1 a terminal, replace it by A U 1 u 2, U 1 u 1. Similarly when u 2 is a terminal. (NTU EE) Context-Free Languages Fall / 1

13 Chomsky Normal Form Example Consider G 6 on the left. We add a new start variable on the right. S ASA ab A B S B b ɛ S 0 S S ASA ab A B S B b ɛ Remove B ɛ (left) and then A ɛ (right): S 0 S S ASA ab a A B S ɛ B b S 0 S S ASA ab a SA AS S A B S B b Remove S S (left) and then S 0 S (right): S 0 S S 0 ASA ab a SA AS S ASA ab a SA AS S ASA ab a SA AS A B S A B S B b B b (NTU EE) Context-Free Languages Fall / 1

14 Chomsky Normal Form Example Remove A B (left) and then A S (right): S 0 ASA ab a SA AS S ASA ab a SA AS A S b B b Remove S 0 ASA, S ASA, and A ASA: S 0 AA 1 ab a SA AS S AA 1 ab a SA AS A b AA 1 ab a SA AS B b A 1 SA Add U a: S 0 AA 1 UB a SA AS S AA 1 UB a SA AS A b AA 1 UB a SA AS B b A 1 SA U a S 0 ASA ab a SA AS S ASA ab a SA AS A b ASA ab a SA AS B b (NTU EE) Context-Free Languages Fall / 1

15 A pushdown automaton has a finite set of control states. A pushdown automaton reads input symbols from left to right. A pushdown automaton has an unbounded stack. A pushdown automaton accepts or rejects an input after reading the input. (NTU EE) Context-Free Languages Fall / 1 Schematic of Pushdown Automata control b b a b Figure: Schematic of Pushdown Automata

16 Pushdown Automata Consider L = {0 n 1 n : n 0}. We have the following table: Language Automata Regular Finite Context-free Pushdown A pushdown automaton is a finite automaton with a stack. A stack is a last-in-first-out storage. Stack symbols can be pushed and poped from the stack. Computation depends on the content of the stack. It is not hard to see L is recognized by a pushdown automaton. (NTU EE) Context-Free Languages Fall / 1

17 Pushdown Automata Consider L = {0 n 1 n : n 0}. We have the following table: Language Automata Regular Finite Context-free Pushdown A pushdown automaton is a finite automaton with a stack. A stack is a last-in-first-out storage. Stack symbols can be pushed and poped from the stack. Computation depends on the content of the stack. It is not hard to see L is recognized by a pushdown automaton. (NTU EE) Context-Free Languages Fall / 1

18 Pushdown Automata Formal Definition Definition A pushdown automaton is a 6-tuple (Q, Σ, Γ, δ, q 0, F) where Q is the set of states; Σ is the input alphabet; Γ is the stack alphabet; δ : Q Σ ɛ Γ ɛ P(Q Γ ɛ ) is the transition function; q 0 Q is the start state; and F Q is the accept states. Recall Σ ɛ = Σ {ɛ} and Γ ɛ = Γ {ɛ}. We consider nondeterministic pushdown automata in the definition. It convers deterministic pushdown automata. Deterministic pushdown automata are strictly less powerful. There is a langauge recognized by only nondeterministic pushdown automata. (NTU EE) Context-Free Languages Fall / 1

19 Computation of Pushdown Automata A pushdown automaton M = (Q, Σ, Γ, δ, q 0, F) accepts input w if w can be written as w = w 1 w 2 w m with w i Σ ɛ and there are sequences of states r 0, r 1,..., r m Q and strings s 0, s 1,..., s m Γ such that r0 = q 0 and s 0 = ɛ; M starts with the start state and the empty stack. For 0 i < m, we have (r i+1, b) δ(r i, w i+1, a), s i = at, and s i+1 = bt for some a, b Γ ɛ and t Γ. On reading w i+1, M moves from r i with stack at to r i+1 with stack bt. Write c, a b(c Σ ɛ and a, b Γ ɛ) to denote that the machine is reading c from the input and replacing the top of stack a with b. rm F. M is at an accept state after reading w. The language recognized by M is denoted by L(M). That is, L(M) = {w : M accepts w}. (NTU EE) Context-Free Languages Fall / 1

20 Pushdown Automata Example Let M 1 = (Q, Σ, Γ, δ, q 1, F) where Q = {q1, q 2, q 3, q 4 }, Σ = {0, 1}, Γ = {0, $}, F = {q 1, q 4 }; and δ is the following table: input 0 1 ɛ stack 0 $ ɛ 0 $ ɛ 0 $ ɛ q 1 {(q 2, $)} q 2 {(q 2, 0)} {(q 3, ɛ)} q 3 {(q 3, ɛ)} {(q 4, ɛ)} q 4 q1 ɛ, ɛ $ q2 0, ɛ 0 1, 0 ɛ 1, 0 ɛ q4 ɛ, $ ɛ q3 L(M 1 ) = {0 n 1 n : n 0} (NTU EE) Context-Free Languages Fall / 1

21 Pushdown Automata Example Let M 1 = (Q, Σ, Γ, δ, q 1, F) where Q = {q1, q 2, q 3, q 4 }, Σ = {0, 1}, Γ = {0, $}, F = {q 1, q 4 }; and δ is the following table: input 0 1 ɛ stack 0 $ ɛ 0 $ ɛ 0 $ ɛ q 1 {(q 2, $)} q 2 {(q 2, 0)} {(q 3, ɛ)} q 3 {(q 3, ɛ)} {(q 4, ɛ)} q 4 q1 ɛ, ɛ $ q2 0, ɛ 0 1, 0 ɛ 1, 0 ɛ q4 ɛ, $ ɛ q3 L(M 1 ) = {0 n 1 n : n 0} (NTU EE) Context-Free Languages Fall / 1

22 Pushdown Automata Example Consider the following pushdown automaton M 2 : b, a ɛ c, ɛ ɛ q1 q3 ɛ, $ ɛ q4 ɛ, ɛ $ ɛ, ɛ ɛ ɛ, $ ɛ q7 q2 ɛ, ɛ ɛ ɛ, ɛ ɛ q5 q6 a, ɛ a b, ɛ ɛ c, a ɛ L(M 2 ) = {a i b j c k : i, j, k 0 and, i = j or i = k} (NTU EE) Context-Free Languages Fall / 1

23 Pushdown Automata Example Consider the following pushdown automaton M 2 : b, a ɛ c, ɛ ɛ q1 q3 ɛ, $ ɛ q4 ɛ, ɛ $ ɛ, ɛ ɛ ɛ, $ ɛ q7 q2 ɛ, ɛ ɛ ɛ, ɛ ɛ q5 q6 a, ɛ a b, ɛ ɛ c, a ɛ L(M 2 ) = {a i b j c k : i, j, k 0 and, i = j or i = k} (NTU EE) Context-Free Languages Fall / 1

24 Context-Free Grammars and Pushdown Automata Lemma If a language is context-free, some pushdown automaton recognizes it. Proof. Let G = (V, Σ, R, S) be a context-free grammar generating the language. Define P = ({q start, q loop, q accept,...}, Σ, V Σ {$}, δ, q start, {q accept }) where δ(q start, ɛ, ɛ) = {(q loop, S$)} δ(q loop, ɛ, A) = {(q loop, w) : A w R} δ(q loop, a, a) = {(q loop, ɛ)} δ(q loop, ɛ, $) = {(q accept, ɛ)} Note that (r, u 1 u 2 u l ) δ(q, a, s) is simulated by (q 1, u l ) δ(q, a, s), δ(q 1, ɛ, ɛ) = {(q 2, u l 1 )},..., δ(q l 1, ɛ, ɛ) = {(r, u 1 )}. (NTU EE) Context-Free Languages Fall / 1

25 Example Example Find a pushdown automaton recognizing the language of the following context-free grammar: S atb b T Ta ɛ ɛ, ɛ T q start ɛ, ɛ $ ɛ, S b ɛ, ɛ a ɛ, ɛ S ɛ, T a q accept ɛ, $ ɛ q loop ɛ, S b ɛ, T ɛ a, a ɛ b, b ɛ ɛ, ɛ T (NTU EE) Context-Free Languages Fall / 1

26 Context-Free Grammars and Pushdown Automata Lemma If a pushdown automaton recognizes a language, the language is context-free. Proof. Without loss of generality, we consider a pushdown automaton that has a single accept state q accept and empties the stack before accepting. Moreover, its transition either pushes or pops a stack symbol at any time. Let P = (Q, Σ, Γ, δ, q 0, {q accept }). Define the context-free grammar G = (V, Σ, R, S) where V = {A pq : p, q Q}, S = A q0,q accept ; and R has the following rules: For each p, q, r, s Q, t Γ, and a, b Σɛ, if (r, t) δ(p, a, ɛ) and (q, ɛ) δ(s, b, t), then A pq aa rs b R. For each p, q, r Q, A pq A pr A rq R. For each p Q, App ɛ R. (NTU EE) Context-Free Languages Fall / 1

27 Example q1 ɛ, ɛ $ q2 0, ɛ 0 1, 0 ɛ 1, 0 ɛ q4 ɛ, $ ɛ q3 We write A i,j for A qi q j. Consider the following context-free grammar: A 14 A 23 since (q 2, $) δ(q 1, ɛ, ɛ) and (q 4, ɛ) δ(q 3, ɛ, $) A 23 0A 23 1 since (q 2, 0) δ(q 2, 0, ɛ) and (q 3, ɛ) δ(q 3, 1, 0) A 23 0A 22 1 since (q 2, 0) δ(q 2, 0, ɛ) and (q 3, ɛ) δ(q 2, 1, 0) A 22 ɛ (NTU EE) Context-Free Languages Fall / 1

28 Context-Free Grammars and Pushdown Automata Lemma If A pq generates x in G, then x can bring P from p with empty stack to q with empty stack. Proof. Prove by induction on the length k of derivation. k = 1. The only possible derivation of length 1 is A pp ɛ. Consider A pq = x of length k + 1. Two cases for the first step: Apq aa rs b. Then x = ayb with A rs = y. By IH, y brings P from r to s with empty stack. Moreover, (r, t) δ(p, a, ɛ) and (q, ɛ) δ(s, b, t) since A pq aa rs b R. Let P start from p with empty stack, P first moves to r and pushes t to the stack after reading a. It then moves to s with t in the stack. Finally, P moves to q with empty stack after reading b and popping t. Apq A pr A rq. Then x = yz with A pr = y and A rq = z. By IH, P moves from p to r, and then r to q. (NTU EE) Context-Free Languages Fall / 1

29 Context-Free Grammars and Pushdown Automata Lemma If x can bring P from p with empty stack to q with empty stack, A pq generates x in G. Proof. Prove by induction on the length k of computation. k = 0. The only possible 0-step computation is to stay at the same state while reading ɛ. Hence x = ɛ. Clearly, A pp = ɛ in G. Two possible cases for computation of length k + 1. The stack is empty only at the beginning and end of the computation. If P reads a, pushes t, and moves to r from p at step 1, (r, t) δ(q, a, ɛ). Similarly, if P reads b, pops t, and moves to q from s at step k + 1, (q, ɛ) δ(s, b, t). Hence A pq aa rsb G. Let x = ayb. By IH, A rs = y. We have A pq = x. The stack is empty elsewhere. Let r be a state where the stack becomes empty. Say y and z are the inputs read during the computation from p to r and r to q respectively. Hence x = yz. By IH, A pr = y and A rq = z. Since A pq A pra rq G. We have A pq = x. (NTU EE) Context-Free Languages Fall / 1

30 Context-Free Grammars and Pushdown Automata Theorem A language is context-free if and only if some pushdown automaton recognizes it. Corollary Every regular language is context-free. (NTU EE) Context-Free Languages Fall / 1

31 Pumping Lemma Theorem If A is a context-free language, then there is a number p (the puming length) such that for every s A with s p, there is a partition s = uvxyz that 1 for each i 0, uv i xy i z A; 2 vy > 0; and 3 vxy p. Proof. Let G = (V, Σ, R, T) be a context-free grammar for A. Define b to be the maximum number of symbols in the right-hand side of a rule. Observe that a parse tree of height h has at most b h leaves and hence can generate strings of length at most b h. Choose p = b V +1. Let s A with s p and τ the smallest parse tree for s. Then the height of τ V + 1. There are V + 1 variables along the longest branch. A variable R must appear twice. (NTU EE) Context-Free Languages Fall / 1

32 Pumping Lemma T R T R R u v x y z (a) Smallest parse tree τ x u z (b) A parse tree if vy = 0 Figure: Pumping Lemma Proof. (cont d). From Figure (a), we see uv i xy i z A for i 0. Suppose vy = 0. Then Figure (b) is a smaller parse tree than τ. A contradiction. Hence vy > 0. Finally, recall R is in the longest branch of length V + 1. Hence the subtree R generating vxy has height V + 1. vxy b V +1 = p. (NTU EE) Context-Free Languages Fall / 1

33 Pumping Lemma Examples Example Show B = {a n b n c n : n 0} is not a context-free language. Proof. Let p be the pumping length. s = a p b p c p B. Consider a partition s = uvxyz with vy > 0. There are two cases: v or y contain more than one type of symbol. Then uv 2 xy 2 z B. v and y contain only one type of symbol. Then one of a, b, or c does not appear in v nor y (pigeon hole principle). Hence uv 2 xy 2 z B for vy > 0. (NTU EE) Context-Free Languages Fall / 1

34 Pumping Lemma Examples Example Show C = {a i b j c k : 0 i j k} is not a context-free language. Proof. Let p be the pumping length and s = a p b p c p C. Consider any partition s = uvxyz with vy > 0. There are two cases: v or y contain more than one type of symbol. Then uv 2 xy 2 z C. v and y contain only one type of symbol. Then one of a, b, or c does not appear in v nor y. We have three subcases: a does not appear in v nor y. uxz C for it has more a then b or c. b does not appear in v nor y. Since vy > 0, a or c must appear in v or y. If a appears, uv 2 xy 2 z C for it has more a than b. If c appears, uxy C for it has more b than c. c does not appear in v nor y. uv 2 xy 2 z C for it has less c than a or b. (NTU EE) Context-Free Languages Fall / 1

35 Pumping Lemma Examples Example Show D = {ww : w {0, 1} } is not a context-free language. Proof. Let p be the pumping length and s = 0 p 1 p 0 p 1 p. Consider a partition s = uvxyz with vy > 0 and vxy p. vxy {}}{ If p 1 p, uv 2 xy 2 z moves 1 into the second half and thus uv 2 xy 2 z D. Similarly, uv 2 xy 2 z moves 0 into the first half if vxy {}}{ 0 p 1 p vxy {}}{ It remains to consider 0 p p. But then uxz = 0 p 1 i 0 j 1 p with i < p or j < p for vy > 0. uxz D. (NTU EE) Context-Free Languages Fall / 1

Automata and Computability. Solutions to Exercises

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

More information

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

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

More information

The Halting Problem is Undecidable

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

More information

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

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

More information

Regular Languages and Finite State Machines

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

More information

Automata and Formal Languages

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

More information

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

Pushdown Automata. place the input head on the leftmost input symbol. while symbol read = b and pile contains discs advance head remove disc from pile Pushdown Automata In the last section we found that restricting the computational power of computing devices produced solvable decision problems for the class of sets accepted by finite automata. But along

More information

Introduction to Automata Theory. Reading: Chapter 1

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

More information

Turing Machines: An Introduction

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

More information

Automata on Infinite Words and Trees

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

More information

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

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

More information

Deterministic Finite Automata

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

More information

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

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, 2010. Class 4 Nancy Lynch 6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, 2010 Class 4 Nancy Lynch Today Two more models of computation: Nondeterministic Finite Automata (NFAs)

More information

Increasing Interaction and Support in the Formal Languages and Automata Theory Course

Increasing Interaction and Support in the Formal Languages and Automata Theory Course Increasing Interaction and Support in the Formal Languages and Automata Theory Course [Extended Abstract] Susan H. Rodger rodger@cs.duke.edu Jinghui Lim Stephen Reading ABSTRACT The introduction of educational

More information

3515ICT Theory of Computation Turing Machines

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

More information

Fundamentele Informatica II

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

More information

On Winning Conditions of High Borel Complexity in Pushdown Games

On Winning Conditions of High Borel Complexity in Pushdown Games Fundamenta Informaticae (2005) 1 22 1 IOS Press On Winning Conditions of High Borel Complexity in Pushdown Games Olivier Finkel Equipe de Logique Mathématique U.F.R. de Mathématiques, Université Paris

More information

Finite Automata. Reading: Chapter 2

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

More information

CS5236 Advanced Automata Theory

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

More information

Composability of Infinite-State Activity Automata*

Composability of Infinite-State Activity Automata* Composability of Infinite-State Activity Automata* Zhe Dang 1, Oscar H. Ibarra 2, Jianwen Su 2 1 Washington State University, Pullman 2 University of California, Santa Barbara Presented by Prof. Hsu-Chun

More information

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

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

More information

Finite Automata. Reading: Chapter 2

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

More information

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

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

More information

Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy

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

More information

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

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

More information

CS 103X: Discrete Structures Homework Assignment 3 Solutions

CS 103X: Discrete Structures Homework Assignment 3 Solutions CS 103X: Discrete Structures Homework Assignment 3 s Exercise 1 (20 points). On well-ordering and induction: (a) Prove the induction principle from the well-ordering principle. (b) Prove the well-ordering

More information

Regular Expressions and Automata using Haskell

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

More information

Reading 13 : Finite State Automata and Regular Expressions

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

More information

C H A P T E R Regular Expressions regular expression

C H A P T E R Regular Expressions regular expression 7 CHAPTER Regular Expressions Most programmers and other power-users of computer systems have used tools that match text patterns. You may have used a Web search engine with a pattern like travel cancun

More information

CSC4510 AUTOMATA 2.1 Finite Automata: Examples and D efinitions Definitions

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

More information

Model 2.4 Faculty member + student

Model 2.4 Faculty member + student Model 2.4 Faculty member + student Course syllabus for Formal languages and Automata Theory. Faculty member information: Name of faculty member responsible for the course Office Hours Office Number Email

More information

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

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

More information

Mathematical Induction

Mathematical Induction Mathematical Induction (Handout March 8, 01) The Principle of Mathematical Induction provides a means to prove infinitely many statements all at once The principle is logical rather than strictly mathematical,

More information

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES

I. GROUPS: BASIC DEFINITIONS AND EXAMPLES I GROUPS: BASIC DEFINITIONS AND EXAMPLES Definition 1: An operation on a set G is a function : G G G Definition 2: A group is a set G which is equipped with an operation and a special element e G, called

More information

CSE 135: Introduction to Theory of Computation Decidability and Recognizability

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

More information

GREATEST COMMON DIVISOR

GREATEST COMMON DIVISOR DEFINITION: GREATEST COMMON DIVISOR The greatest common divisor (gcd) of a and b, denoted by (a, b), is the largest common divisor of integers a and b. THEOREM: If a and b are nonzero integers, then their

More information

Fast nondeterministic recognition of context-free languages using two queues

Fast nondeterministic recognition of context-free languages using two queues Fast nondeterministic recognition of context-free languages using two queues Burton Rosenberg University of Miami Abstract We show how to accept a context-free language nondeterministically in O( n log

More information

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

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

More information

Lecture 2: Universality

Lecture 2: Universality CS 710: Complexity Theory 1/21/2010 Lecture 2: Universality Instructor: Dieter van Melkebeek Scribe: Tyson Williams In this lecture, we introduce the notion of a universal machine, develop efficient universal

More information

1. Prove that the empty set is a subset of every set.

1. Prove that the empty set is a subset of every set. 1. Prove that the empty set is a subset of every set. Basic Topology Written by Men-Gen Tsai email: b89902089@ntu.edu.tw Proof: For any element x of the empty set, x is also an element of every set since

More information

CS 3719 (Theory of Computation and Algorithms) Lecture 4

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

More information

1 Definition of a Turing machine

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

More information

Informatique Fondamentale IMA S8

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

More information

Computability Theory

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

More information

Chapter 7 Uncomputability

Chapter 7 Uncomputability Chapter 7 Uncomputability 190 7.1 Introduction Undecidability of concrete problems. First undecidable problem obtained by diagonalisation. Other undecidable problems obtained by means of the reduction

More information

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

Automata Theory. Şubat 2006 Tuğrul Yılmaz Ankara Üniversitesi Automata Theory Automata theory is the study of abstract computing devices. A. M. Turing studied an abstract machine that had all the capabilities of today s computers. Turing s goal was to describe the

More information

24 Uses of Turing Machines

24 Uses of Turing Machines Formal Language and Automata Theory: CS2004 24 Uses of Turing Machines 24 Introduction We have previously covered the application of Turing Machine as a recognizer and decider In this lecture we will discuss

More information

Notes on Complexity Theory Last updated: August, 2011. Lecture 1

Notes on Complexity Theory Last updated: August, 2011. Lecture 1 Notes on Complexity Theory Last updated: August, 2011 Jonathan Katz Lecture 1 1 Turing Machines I assume that most students have encountered Turing machines before. (Students who have not may want to look

More information

Learning Analysis by Reduction from Positive Data

Learning Analysis by Reduction from Positive Data Learning Analysis by Reduction from Positive Data František Mráz 1, Friedrich Otto 1, and Martin Plátek 2 1 Fachbereich Mathematik/Informatik, Universität Kassel 34109 Kassel, Germany {mraz,otto}@theory.informatik.uni-kassel.de

More information

CPS 140 - Mathematical Foundations of CS Dr. S. Rodger Section: Properties of Context-Free Languages èhandoutè Section 3.5 Which of the following languages are CFL? æ L=fa n b n c j j 0 énçjg æ L=fa n

More information

Philadelphia University Faculty of Information Technology Department of Computer Science First Semester, 2007/2008.

Philadelphia University Faculty of Information Technology Department of Computer Science First Semester, 2007/2008. Philadelphia University Faculty of Information Technology Department of Computer Science First Semester, 2007/2008 Course Syllabus Course Title: Theory of Computation Course Level: 3 Lecture Time: Course

More information

T ( a i x i ) = a i T (x i ).

T ( a i x i ) = a i T (x i ). Chapter 2 Defn 1. (p. 65) Let V and W be vector spaces (over F ). We call a function T : V W a linear transformation form V to W if, for all x, y V and c F, we have (a) T (x + y) = T (x) + T (y) and (b)

More information

Properties of Stabilizing Computations

Properties of Stabilizing Computations Theory and Applications of Mathematics & Computer Science 5 (1) (2015) 71 93 Properties of Stabilizing Computations Mark Burgin a a University of California, Los Angeles 405 Hilgard Ave. Los Angeles, CA

More information

Turing Machines, Part I

Turing Machines, Part I Turing Machines, Part I Languages The $64,000 Question What is a language? What is a class of languages? Computer Science Theory 2 1 Now our picture looks like Context Free Languages Deterministic Context

More information

T-79.186 Reactive Systems: Introduction and Finite State Automata

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

More information

A First Investigation of Sturmian Trees

A First Investigation of Sturmian Trees A First Investigation of Sturmian Trees Jean Berstel 2, Luc Boasson 1 Olivier Carton 1, Isabelle Fagnot 2 1 LIAFA, CNRS Université Paris 7 2 IGM, CNRS Université de Marne-la-Vallée Atelier de Combinatoire,

More information

Genetic programming with regular expressions

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

More information

NFAs with Tagged Transitions, their Conversion to Deterministic Automata and Application to Regular Expressions

NFAs with Tagged Transitions, their Conversion to Deterministic Automata and Application to Regular Expressions NFAs with Tagged Transitions, their Conversion to Deterministic Automata and Application to Regular Expressions Ville Laurikari Helsinki University of Technology Laboratory of Computer Science PL 9700,

More information

CONTINUED FRACTIONS AND PELL S EQUATION. Contents 1. Continued Fractions 1 2. Solution to Pell s Equation 9 References 12

CONTINUED FRACTIONS AND PELL S EQUATION. Contents 1. Continued Fractions 1 2. Solution to Pell s Equation 9 References 12 CONTINUED FRACTIONS AND PELL S EQUATION SEUNG HYUN YANG Abstract. In this REU paper, I will use some important characteristics of continued fractions to give the complete set of solutions to Pell s equation.

More information

MATH10212 Linear Algebra. Systems of Linear Equations. Definition. An n-dimensional vector is a row or a column of n numbers (or letters): a 1.

MATH10212 Linear Algebra. Systems of Linear Equations. Definition. An n-dimensional vector is a row or a column of n numbers (or letters): a 1. MATH10212 Linear Algebra Textbook: D. Poole, Linear Algebra: A Modern Introduction. Thompson, 2006. ISBN 0-534-40596-7. Systems of Linear Equations Definition. An n-dimensional vector is a row or a column

More information

6.080/6.089 GITCS Feb 12, 2008. Lecture 3

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

More information

Lecture summary for Theory of Computation

Lecture summary for Theory of Computation Lecture summary for Theory of Computation Sandeep Sen 1 January 8, 2015 1 Department of Computer Science and Engineering, IIT Delhi, New Delhi 110016, India. E- mail:ssen@cse.iitd.ernet.in Contents 1 The

More information

Compiler Construction

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

More information

8 Divisibility and prime numbers

8 Divisibility and prime numbers 8 Divisibility and prime numbers 8.1 Divisibility In this short section we extend the concept of a multiple from the natural numbers to the integers. We also summarize several other terms that express

More information

Implementation of Recursively Enumerable Languages using Universal Turing Machine in JFLAP

Implementation of Recursively Enumerable Languages using Universal Turing Machine in JFLAP International Journal of Information and Computation Technology. ISSN 0974-2239 Volume 4, Number 1 (2014), pp. 79-84 International Research Publications House http://www. irphouse.com /ijict.htm Implementation

More information

Regular Languages and Finite Automata

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

More information

How To Understand The Theory Of Computer Science

How To Understand The Theory Of Computer Science Theory of Computation Lecture Notes Abhijat Vichare August 2005 Contents 1 Introduction 2 What is Computation? 3 The λ Calculus 3.1 Conversions: 3.2 The calculus in use 3.3 Few Important Theorems 3.4 Worked

More information

Systems of Linear Equations

Systems of Linear Equations Systems of Linear Equations Beifang Chen Systems of linear equations Linear systems A linear equation in variables x, x,, x n is an equation of the form a x + a x + + a n x n = b, where a, a,, a n and

More information

The Optimum One-Pass Strategy for Juliet

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

More information

k, then n = p2α 1 1 pα k

k, then n = p2α 1 1 pα k Powers of Integers An integer n is a perfect square if n = m for some integer m. Taking into account the prime factorization, if m = p α 1 1 pα k k, then n = pα 1 1 p α k k. That is, n is a perfect square

More information

Practice with Proofs

Practice with Proofs Practice with Proofs October 6, 2014 Recall the following Definition 0.1. A function f is increasing if for every x, y in the domain of f, x < y = f(x) < f(y) 1. Prove that h(x) = x 3 is increasing, using

More information

Rewriting of Visibly Pushdown Languages for XML Data Integration

Rewriting of Visibly Pushdown Languages for XML Data Integration Rewriting of Visibly Pushdown Languages for XML Data Integration Alex Thomo University of Victoria British Columbia, Canada thomo@cs.uvic.ca S. Venkatesh University of Victoria British Columbia, Canada

More information

. 0 1 10 2 100 11 1000 3 20 1 2 3 4 5 6 7 8 9

. 0 1 10 2 100 11 1000 3 20 1 2 3 4 5 6 7 8 9 Introduction The purpose of this note is to find and study a method for determining and counting all the positive integer divisors of a positive integer Let N be a given positive integer We say d is a

More information

Single machine models: Maximum Lateness -12- Approximation ratio for EDD for problem 1 r j,d j < 0 L max. structure of a schedule Q...

Single machine models: Maximum Lateness -12- Approximation ratio for EDD for problem 1 r j,d j < 0 L max. structure of a schedule Q... Lecture 4 Scheduling 1 Single machine models: Maximum Lateness -12- Approximation ratio for EDD for problem 1 r j,d j < 0 L max structure of a schedule 0 Q 1100 11 00 11 000 111 0 0 1 1 00 11 00 11 00

More information

Push-down Automata and Context-free Grammars

Push-down Automata and Context-free Grammars 14 Push-down Automata and Context-free Grammars This chapter details the design of push-down automata (PDA) for various languages, the conversion of CFGs to PDAs, and vice versa. In particular, after formally

More information

CS 301 Course Information

CS 301 Course Information CS 301: Languages and Automata January 9, 2009 CS 301 Course Information Prof. Robert H. Sloan Handout 1 Lecture: Tuesday Thursday, 2:00 3:15, LC A5 Weekly Problem Session: Wednesday, 4:00 4:50 p.m., LC

More information

How To Compare A Markov Algorithm To A Turing Machine

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

More information

NP-Completeness and Cook s Theorem

NP-Completeness and Cook s Theorem NP-Completeness and Cook s Theorem Lecture notes for COM3412 Logic and Computation 15th January 2002 1 NP decision problems The decision problem D L for a formal language L Σ is the computational task:

More information

Web Data Extraction: 1 o Semestre 2007/2008

Web Data Extraction: 1 o Semestre 2007/2008 Web Data : Given Slides baseados nos slides oficiais do livro Web Data Mining c Bing Liu, Springer, December, 2006. Departamento de Engenharia Informática Instituto Superior Técnico 1 o Semestre 2007/2008

More information

Kevin James. MTHSC 412 Section 2.4 Prime Factors and Greatest Comm

Kevin James. MTHSC 412 Section 2.4 Prime Factors and Greatest Comm MTHSC 412 Section 2.4 Prime Factors and Greatest Common Divisor Greatest Common Divisor Definition Suppose that a, b Z. Then we say that d Z is a greatest common divisor (gcd) of a and b if the following

More information

Ambiguity, closure properties, Overview of ambiguity, and Chomsky s standard form

Ambiguity, closure properties, Overview of ambiguity, and Chomsky s standard form Ambiguity, closure properties, and Chomsky s normal form Overview of ambiguity, and Chomsky s standard form The notion of ambiguity Convention: we assume that in every substitution, the leftmost remaining

More information

Full and Complete Binary Trees

Full and Complete Binary Trees Full and Complete Binary Trees Binary Tree Theorems 1 Here are two important types of binary trees. Note that the definitions, while similar, are logically independent. Definition: a binary tree T is full

More information

Solving Linear Systems, Continued and The Inverse of a Matrix

Solving Linear Systems, Continued and The Inverse of a Matrix , Continued and The of a Matrix Calculus III Summer 2013, Session II Monday, July 15, 2013 Agenda 1. The rank of a matrix 2. The inverse of a square matrix Gaussian Gaussian solves a linear system by reducing

More information

Pushdown Automata. International PhD School in Formal Languages and Applications Rovira i Virgili University Tarragona, Spain

Pushdown Automata. International PhD School in Formal Languages and Applications Rovira i Virgili University Tarragona, Spain Pushdown Automata transparencies made for a course at the International PhD School in Formal Languages and Applications Rovira i Virgili University Tarragona, Spain Hendrik Jan Hoogeboom, Leiden http://www.liacs.nl/

More information

A Brief History of Strahler Numbers

A Brief History of Strahler Numbers A Brief History of Strahler Numbers Javier Esparza Michael Luttenberger Maximilian Schlund Technical University of Munich Robert E. Horton (945) Robert E. Horton (945) Which is the main stream of a stream

More information

Continued Fractions and the Euclidean Algorithm

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

More information

n k=1 k=0 1/k! = e. Example 6.4. The series 1/k 2 converges in R. Indeed, if s n = n then k=1 1/k, then s 2n s n = 1 n + 1 +...

n k=1 k=0 1/k! = e. Example 6.4. The series 1/k 2 converges in R. Indeed, if s n = n then k=1 1/k, then s 2n s n = 1 n + 1 +... 6 Series We call a normed space (X, ) a Banach space provided that every Cauchy sequence (x n ) in X converges. For example, R with the norm = is an example of Banach space. Now let (x n ) be a sequence

More information

Lecture I FINITE AUTOMATA

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

More information

6.2 Permutations continued

6.2 Permutations continued 6.2 Permutations continued Theorem A permutation on a finite set A is either a cycle or can be expressed as a product (composition of disjoint cycles. Proof is by (strong induction on the number, r, of

More information

MATH10040 Chapter 2: Prime and relatively prime numbers

MATH10040 Chapter 2: Prime and relatively prime numbers MATH10040 Chapter 2: Prime and relatively prime numbers Recall the basic definition: 1. Prime numbers Definition 1.1. Recall that a positive integer is said to be prime if it has precisely two positive

More information

ASSIGNMENT ONE SOLUTIONS MATH 4805 / COMP 4805 / MATH 5605

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

More information

Formal Grammars and Languages

Formal Grammars and Languages Formal Grammars and Languages Tao Jiang Department of Computer Science McMaster University Hamilton, Ontario L8S 4K1, Canada Bala Ravikumar Department of Computer Science University of Rhode Island Kingston,

More information

Computational Models Lecture 8, Spring 2009

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

More information

Class One: Degree Sequences

Class One: Degree Sequences Class One: Degree Sequences For our purposes a graph is a just a bunch of points, called vertices, together with lines or curves, called edges, joining certain pairs of vertices. Three small examples of

More information

2) Write in detail the issues in the design of code generator.

2) Write in detail the issues in the design of code generator. COMPUTER SCIENCE AND ENGINEERING VI SEM CSE Principles of Compiler Design Unit-IV Question and answers UNIT IV CODE GENERATION 9 Issues in the design of code generator The target machine Runtime Storage

More information

Regular Languages and Finite Automata

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

More information

Course Manual Automata & Complexity 2015

Course Manual Automata & Complexity 2015 Course Manual Automata & Complexity 2015 Course code: Course homepage: Coordinator: Teachers lectures: Teacher exercise classes: Credits: X_401049 http://www.cs.vu.nl/~tcs/ac prof. dr. W.J. Fokkink home:

More information

God created the integers and the rest is the work of man. (Leopold Kronecker, in an after-dinner speech at a conference, Berlin, 1886)

God created the integers and the rest is the work of man. (Leopold Kronecker, in an after-dinner speech at a conference, Berlin, 1886) Chapter 2 Numbers God created the integers and the rest is the work of man. (Leopold Kronecker, in an after-dinner speech at a conference, Berlin, 1886) God created the integers and the rest is the work

More information

NOTES ON LINEAR TRANSFORMATIONS

NOTES ON LINEAR TRANSFORMATIONS NOTES ON LINEAR TRANSFORMATIONS Definition 1. Let V and W be vector spaces. A function T : V W is a linear transformation from V to W if the following two properties hold. i T v + v = T v + T v for all

More information

Two Way F finite Automata and Three Ways to Solve Them

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

More information