Theory of Computation Exam 2

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What does it mean when you have a symbol with a bar above it?

"any symbol except that symbol." Thus the machine R with an arrow point back at itself labeled bar space, means that you keep moving right until you reach a space.

What is a regular expression?

(1) 0 and each member of Sigma is a regular expression. (2) If a and b are regular expressions, then so is (ab). (3) If a and b are regular expressions, then so is (aUb). (4) If a is a regular expression, then so is a*. (5) Nothing is a regular expression unless it follows from (1) through (4).

What is a partition P of a set A?

(1) Each element of P is nonempty. (2) Distinct members of P are disjoint. (3) UP = A (Union of all P is A).

Create a Turing machine that accepts a^nb^nc^n.

...

Do a problem from HW 5

...

Do a problem from HW 6

...

Questions for Bob

...

What is the pumping lemma proof that L = {a^ib^ic^i| i >= 0} is not context-free?

...

What is the pumping lemma proof that L = {w in {a,b,c}^* | w has an equal number of a, b,c} is not context-free?

...

How can you show that a language is regular?

1. If you can make a language generator. 2. If you can make an FA.

How can you show that a grammar is context-free?

1. Make a PDA. 2. Make the language using the union of other known CF-languages, or the concatenation, or repetition (kleene star) 3. Create the language by taking the intersection of a CF-language with a regular language.

What is a valid configuration for a Turing machine, and what is a configuration?

A configuration shows the current status of computation of a Turing machine, or the position of the control unit. Given a TM M = (K,Sigma,delta,s,H), a configuration is an element of the form: K x >Simga* x (Sigma(Sigma-{ _ })U{e}) where > is the left hand symbol, and _ is the blank space symbol. i.e., config hould have 4 parts separated by commas and should not end with a blank space. All input tapes start with >_w___... with w is a string containing no blanks. The blanks after w are usually omitted, because we just assume that they are there.

What is an alphabet and which letter represents it?

A finite set of symbols, symbolized by a uppercase sigma.

What is a PDA and what do you use it for?

A machine that accepts or rejects context-free languages.

What is true of all regular languages?

All regular languages are context free (not vise versa, though).

What is true of all finite languages?

Any finite language is regular.

What is true about recursive languages?

Any recursive language is also recursively enumerable. If L is a recursive language then its complement is also recursive.

List the important facts about a Random presentation

Ben - NP-complete. A problem is NP if it is certifiable in polynomial time. A problem is NP-complete if it is reduceable to polynomial calls of a known NP-complete problem. Crux - Does P = NP? Example problems: Travelling salesman, hamiltonian graph. If we could find a polynomial time algorithm to solve any NP-Complete problem, we would solve P=NP. Darren - Quincy - Meghan - LL Marysia - LR Race and Pat - Charlie - Rao - Mine - Primitive recursive functions is a limited type of recursion that can be derived from a few basic functions. Anything that can be enumerated on the natural numbers.

What is an inherently ambiguous language?

Context-free language with the property that all context-free grammars that define them will be ambiguous.

What are the rules of closure for context-free languages?

Context-free languages are closed under union, concatenation, and kleene star. They are not closed under intersection of complementation.

Given (q1,a1,u1)|- (q2,a2,u2), what must be the b in the transition relation delta(q1,a1) = (q2,b)?

Either 1. b is in Sigma, w1=w2, and u1-u2, and a2=b 2. b=<-, w1=w2a2, and either a) u2 = a1u1, if a/=_ or u1/=e b) u2 = d, if a =_ and u1=e 3. b = ->, w2=w1a1, and either a) u1 = a2u2 b) u1 = u2 = e, and a2 = _

How to translate a DFA to a PDA

Every finite automaton M can be trivially viewed as a pda that never operates on its stack. i.e. a PDA M' always pushes and pops an empty string on its stack, and other wise simulates the transitions of M. Then it is immediate that M and M' accept precisely the same language.

What is a context-free grammar?

G is a quadruple (V, Sigma, R, S) where, !!!!!!!!!!!!!!!!!!!! p. 115

What is a complement language?

If L is a subset of Sigma*, Sigma*-L is the complement language.

How to show that a grammar is ambiguous.

If a grammar has two or more distinct parse-trees, it is ambiguous.

What does it mean for a TM M to decide a language? What is a recursive language?

If the string w is in L, the halting configuration will end at state y, and we will say that M accepted w. If the string w is not in L, the halting configuration will end at state n, and we will say that M rejects w. We call a language recursive if a Turing machine decides it.

What is the Pumping Lemma for Context-Free Languages?

Informal: The fact that in all sufficiently long strings in a language have a substring that cannot be repeated arbitrarily many times and still be in the language, to prove that the language is not context-free, meaning that a PDA cannot be built for it. TL;DR: if you can't pump it, it can't be context-free. Formal: Let G = (V, Sigma, R, S) be a CFG. Then any string w in L(G) of length greater than phi(G)^(V-Sigma) (fanout of G) can be rewritten as w=uxvyz in such a way that either x or y is nonempty and ux^ivy^iz is in L(G) for every i =0,1,2,3...

What does M(w) mean, given TM M and string w?

It is the output string leftover after M halted on w.

What is the definition of a language L?

L over Sigma is a subset of Sigma*.

Given a context-free grammar, how do you make a PDA?

Let G = (V, Sigma, R, S). The machine we construct has only two states: p,q and remains permanently in q after its first move. Also, M will use V, the set of terminals and nonterminals, as its stack alphabet. M = ({p,q}, Sigma, V, Delta, p, {q}), where Delta contains the following transitions: 1) ((p,e,e),(q,S)) 2) ((q,e,A),(q,x)) for each rule A->x in R 3) ((q,a,a),(q,e)) for each a in Sigma.

What does it mean for a TM M to semi-decides a language? What is a recursively enumerable language?

M semi-decides L if for any string w the following is true: w is in L iff M halts on input w. L is recursively enumerable iff there is a TM M that semi-decides L. Or, M(w) = / iff w not in L. (/ means divergence).

What is a symbol writing machine M_a?

M_a will write the symbol a at the current tape square, and then move to the right. If, however, we start on >, we move to the right first.

If a string has more than one derivation, is the language ambiguous?

No, a grammar is only ambiguous if it has more than one parse tree for a given string, and different derivations may give you the same parse tree.?????

Study guide

Read all chapters. Do practice problems. Do old hw. Look over old homework and see what you got right and what you got wrong.

Given a PDA, what does this mean ((q1,a,s),(q2,s))

Starting on state q1, if you see an a in the input and a s on the stack, go to q2 and don't modify the stack.

What is the pumping lemma proof that L = {a^n | n is prime} is not context-free?

Suppose L is regular, and let x,y,z be as specified in the pumping lemma. Then, x=a^p, y=a^q, and z=a^r, where p,r >= 0 and q>0. By the theorem, xy^nz is in L for each n>= 0; that is, p+q+nq+r is prime for each n >= 0. But this is impossible; for let n = p + 2q + r +2; then p+nq+r = (q+1)(p+2q+r), which is a product of 2 natural numbers, each greater than 1.

What is L(M) (cursive L)

The language accepted by a DFA M in Sigma*

What is the fanout of a grammar?

The largest number of symbols on the right hand side of any rule in R.

What are the following languages: R_{space} L_{space} R_{bar space} L_{bar space}

The machine that finds the first blank square to the right of the currently scanned square. The machine that finds the first blank square to the left of the currently scanned square. The machine that finds the first nonblank square to the right of the currently scanned square. The machine that finds the first nonblank square to the right of the currently scanned square.

What is a turing machine?

The most general model of computation (or at least more general than PDAs and FAs). A Turing Machine is a quintuple (K, Sigma, delta, s, H), where K is a finite set of states; Sigma is an alphabet containing the blank symbol (space) and the left-end symbol (starting symbol), but not containing the left and right arrow. s in K is the initial state; H subset of K is the set of halting states; delta is a function from (K-H) x Sigma to K x (Sigma U {left arrow, right arrow}) such that, a) for all q in K-H, if delta(q,start symbol) = (p,b), then b = right arrow, b) for all q in K-H and a in Sigma, if delta(q,a)=(p,b) then b/=start symbol.

Problem 3.5.6 (p. 148). Show that if L1 is context-free and R is regular, then L1/R is context-free. L1/R = {w in Sigma| there exists u in R such that wu is in L1}

We can create a PDA that accepts the language by adding extra states and transitions. If we ever reach a point where (q,a,e) goes to (q,e,e), and (u,a,e) goes to (u,e,e) is accepted, tack the u transition on to the end of the q transition.??????????????????

What is a parse tree?

formally: an equivalence class of derivations. informally: a way of representing derivations of strings in L(G)so that the superficial differences between derivations, owing to the order of application rules, are suppressed.

When is v a substring of w?

if there exist strings x,y such that w = xvy v is a Proper substring of w if x,y are not both the empty string.

Draw a pda

p. 130

Draw a Turing machine

p. 184

Draw the TM that accepts a^n b^n c^n

p.195


Kaugnay na mga set ng pag-aaral

NSG 334 Chapter 28: Growth and Development of the School-Age Child

View Set

Business- Chapter 6-10 Multiple Choice

View Set

Ch. 10 Making Capital Investment Decisions

View Set

Lippincott for Taylor: Fundamentals of Nursing Chapter 16- Outcome Identification & Planning

View Set

Environmental Science A Chapter 1 Unit 1

View Set

W-house: Omelets, Eggs, Waffles, Sides, Chili, Drinks, Deserts, Other, Favorites.

View Set