Stuff I need to know fr tomorrw

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Union-Find

(Disjoint-set data structure) keeps track of a set of elements partitioned into a number of disjoint (nonoverlapping) subsets. It supports two useful operations: find and union. Find: Determine which subset a particular element is in. Find typically returns an item from this set that serves as its "representative"; by comparing the result of two Find operations, one can determine whether two elements are in the same subset. Union: Join two subsets into a single subset. In order to define these operations more precisely, some way of representing the sets is needed. One common approach is to select a fixed element of each set, called its representative, to represent the set as a whole. Then, Find(x) returns the representative of the set that x belongs to, and Union takes two set representatives as its arguments.

(0 ∪ ε)1∗

01∗ ∪ 1∗.

PSPACE-c

1. B is in PSPACE, and 2. every A in PSPACE is polynomial time reducible to B. If B merely satisfies condition 2, we say that it is PSPACE-hard.

EXPSPACE-c

1. B ∈ EXPSPACE, and 2. every A in EXPSPACE is polynomial time reducible to B.

NL-complete

1. B ∈ NL, and 2. every A in NL is log space reducible to B.

mu recursion

1. constant function, 2. successor function, 3. projection function, 4. composition operator, 5. primitive recursion operator, 6. minimization operator (mu) does not necessarily halt, as Ackerman Function has been proven to always need at least one more recursive function

Primitive Recursive Function

1. f is the function that is always 0, i.e. f(x1, . . . , xn) = 0; This is denoted by Z when the number of arguments is understood. This rule for deriving a primitive recursive function is called the Zero rule. 2. f is the successor function, i.e. f(x1, . . . , xn) = xi + 1; This rule for deriving a primitive recursive function is called the Successor rule. 3. f is the projection function, i.e. f(x1, . . . , xn) = xi ; This is denoted by πi when the number of arguments is understood. This rule for deriving a primitive recursive function is called the Projection rule. 4. f is defined by the composition of (previously defined) primitive recursive functions, i.e. if g1(x1, . . . , xn), g2(x1, . . . , xn), . . ., gk(x1, . . . , xn) are primitive recursive and h(x1, . . . , xk) is primitive recursive, then f(x1, . . . , xn) = h(g1(x1, . . . , xn), . . . , gk(x1, . . . , xn)) is primitive recursive. This rule for deriving a primitive recursive function is called the Composition rule. 5. f is defined by recursion of two primitive recursive functions, i.e. if g(x1, . . . , xn−1) and h(x1, . . . , xn+1) are primitive recursive then the following function is also primitive recursive f(x1, . . . , xn−1, 0) = g(x1, . . . , xn−1) f(x1, . . . , xn−1, m + 1) = h(x1, . . . , xn−1, m, f(x1, . . . , xn−1, m)) This rule for deriving a primitive recursive function is called the Recursion rule. It is a very powerful rule and is why these functions are called 'primitive recursive.'

finite automaton

5 tuple (Q, sigma, delta qnaught, F) where Q is a finite set called states, sigma is a finite set called the alphabet, delta is Qxsigma is Q is the transition function, qnaught is the start state, and F subsets Q is the set of accept states(final states)

Universal Turing Machine

A TM that when given any input w and another TM M, can simulate M on w.

Turing machine formal def

A Turing machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite sets and 1. Q is the set of states, 2. Σ is the input alphabet not containing the blank symbol ␣, 3. Γ is the tape alphabet, where ␣ ∈ Γ and Σ ⊆ Γ, 4. δ : Q × Γ−→Q × Γ × {L, R} is the transition function, 5. q0 ∈ Q is the start state, 6. qaccept ∈ Q is the accept state, and 7. qreject ∈ Q is the reject state, where qreject ̸= qaccept.

deterministic context free grammar

A deterministic context-free grammar is a context-free grammar such that every valid string has a forced handle.

concatenation

A dot B= {xy|x in A and y in B}

computable function

A function f : Σ∗−→Σ∗ is a computable function if some Turing machine M, on every input w, halts with just f(w) on its tape.

np-c membership

A language B is NP-complete if it satisfies two conditions: 1. B is in NP, and 2. every A in NP is polynomial time reducible to B.

recogn w TM

A language is Turing-recognizable if and only if some multitape Turing machine recognizes it.

CF from PDA

A language is context free if and only if some pushdown automaton recognizes it.

regular under NDA

A language is regular if and only if some nondeterministic finite automaton recognizes it.

reg ex= reg l

A language is regular if and only if some regular expression describes it.

NDA

A nondeterministic finite automaton is a 5-tuple (Q, Σ, δ, q0, F), where 1. Q is a finite set of states, 2. Σ is a finite alphabet, 3. δ : Q × Σε→P(Q) is the transition function, 4. q0 ∈ Q is the start state, and 5. F ⊆ Q is the set of accept states.

ambiguity

A string w is derived ambiguously in context-free grammar G if it has two or more different leftmost derivations. Grammar G is ambiguous if it generates some string ambiguously.

Star

A*={x1x2...xk|k greater than or equal to 0 and each xi in A}

Chomsky NF

A-> BC A->a S->ε where S start

union

AUB={x|x in A and x in B}

Diagonalization Theorem

An n x n matrix A is diagonalizable if and only if A has n linearly independent eigenvectors. In fact, A = PDP^-1, with D a diagonal matrix, if and only if the columns of P are n linearly independent eigenvectors of A. In this case, the diagonal entries of D are eigenvalues of A that correspond, respectively, to the eigenvectors in P.

Choms to CFL

Any context-free language is generated by a context-free grammar in Chomsky normal form.

diagonalization book

Assume that we have sets A and B and a function f from A to B. Say that f is one-to-one if it never maps two different elements to the same place—that is, if f(a) ̸= f(b) whenever a ̸= b. Say that f is onto if it hits every element of B—that is, if for every b ∈ B there is an a ∈ A such that f(a) = b. Say that A and B are the same size if there is a one-to-one, onto function f : A−→B. A function that is both one-to-one and onto is called a correspondence. In a correspondence, every element of A maps to a unique element of B and each element of B has a unique element of A mapping to it. A correspondence is simply a way of pairing the elements of A with the elements of B.

DPDA and PDAs

DPDAs describe ambiguous CFGs/CFLs, PDAs cannot

Myhill-Nerode Theorem

Defining equivalence relation =L, we say that two strings x and y are indistinguishable, and we write it x ≈L y if they are not distinguishable. Let L be a language over Σ. If Σ∗ has infinitely many equivalence classes with respect to ≈L, then L is not regular. Otherwise, L can be decided by a DFA whose number of states is equal to the number of equivalence classes in Σ∗ with respect to ≈L.

dpda equiv

Every DPDA has an equivalent DPDA that always reads the entire input string.

mult to single TM

Every multitape Turing machine has an equivalent single-tape Turing machine.

equivalence TM

Every nondeterministic Turing machine has an equivalent deterministic Turing machine.

Savitch's Theorem

For any1 function f : N −→R+, where f(n) ≥ n, NSPACE(f(n)) ⊆ SPACE(f 2(n)).

Vertex cover NP-c

Here are the details of a reduction from 3SAT to VERTEX-COVER that operates in polynomial time. The reduction maps a Boolean formula φ to a graph G and a value k. For each variable x in φ, we produce an edge connecting two nodes. We label the two nodes in this gadget x and x. Setting x to be TRUE corresponds to selecting the node labeled x for the vertex cover, whereas FALSE corresponds to the node labeled x. The gadgets for the clauses are a bit more complex. Each clause gadget is a triple of nodes that are labeled with the three literals of the clause. These three nodes are connected to each other and to the nodes in the variable gadgets that have the identical labels. Thus, the total number of nodes that appear in G is 2m + 3l, where φ has m variables and l clauses. Let k be m + 2l. For example, if φ = (x1 ∨ x1 ∨ x2) ∧ (x1 ∨ x2 ∨ x2) ∧ (x1 ∨ x2 ∨ x2), the reduction produces ⟨G, k⟩ from φ, where k = 8 and G takes the form shown in the following figure. To prove that this reduction works, we need to show that φ is satisfiable if and only if G has a vertex cover with k nodes. We start with a satisfying assignment. We first put the nodes of the variable gadgets that correspond to the true literals in the assignment into the vertex cover. Then, we select one true literal in every clause and put the remaining two nodes from every clause gadget into the vertex cover. Now we have a total of k nodes. They cover all edges because every vari- able gadget edge is clearly covered, all three edges within every clause gadget are covered, and all edges between variable and clause gadgets are covered. Hence G has a vertex cover with k nodes. Second, if G has a vertex cover with k nodes, we show that φ is satisfiable by constructing the satisfying assignment. The vertex cover must contain one node in each variable gadget and two in every clause gadget in order to cover the edges of the variable gadgets and the three edges within the clause gadgets. That accounts for all the nodes, so none are left over. We take the nodes of the vari- able gadgets that are in the vertex cover and assign TRUE to the corresponding literals. That assignment satisfies φ because each of the three edges connecting the variable gadgets with each clause gadget is covered, and only two nodes of the clause gadget are in the vertex cover. Therefore, one of the edges must be covered by a node from a variable gadget and so that assignment satisfies the corresponding clause.

pumping CF

If A is a context-free language, then there is a number p (the pumping length) where, if s is any string in A of length at least p, then s may be divided into five pieces s = uvxyz satisfying the conditions 1. for each i ≥ 0, uv^ixy^iz ∈ A, 2. |vy| > 0, and 3. |vxy| ≤ p.

reg pumping lemma

If A is a regular language, then there is a number p (the pumping length) where if s is any string in A of length at least p, then s may be divided into three pieces, s = xyz, satisfying the following conditions: 1. for each i ≥ 0, xy^iz ∈ A, 2. |y| > 0, and 3. |xy| ≤ p.

l redux

If A ≤L B and B ∈ L, then A ∈ L.

np mapping

If A ≤P B and B ∈ P, then A ∈ P.

turing redux

If A ≤T B and B is decidable, then A is decidable.

map r A is undex

If A ≤m B and A is undecidable, then B is undecidable.

np-c redux p

If B is NP-complete and B ∈ P, then P = NP.

np-c redux

If B is NP-complete and B ≤P C for C in NP, then C is NP-complete.

NL to L

If any NL-complete language is in L, then L = NL.

turing recog, semi-dec

If something is Turing-recog, semi-decidable. If not Turing-recog, not semi-decidable

DPLL

Iteratively set variables until - you find a satisfying assignment (done!) - you reach a conflict (backtrack and try different value) • Two main rules: - Unit Literal Rule: If an unsatisfied clause has all but 1 literal set to 0, the remaining literal must be set to 1 (a + b + c) (d' + e) (a + c' + d) - Conflict Rule: If all literals in a clause have been set to 0, the formula is unsatisfiable along the current assignment path

mapping reducible

Language A is mapping reducible to language B, written A ≤m B, if there is a computable function f : Σ∗−→Σ∗, where for every w, w ∈ A ⇐⇒ f(w) ∈ B. The function f is called the reduction from A to B.

Cantor's Theorem

Let A be any set, then |A| < |P(A)|

reg pumping lemma proof

Let B be the language {0n1n|n ≥ 0}. We use the pumping lemma to prove that B is not regular. The proof is by contradiction. Assume to the contrary that B is regular. Let p be the pumping length given by the pumping lemma. Choose s to be the string 0p1p. Because s is a member of B and s has length more than p, the pumping lemma guarantees that s can be split into three pieces, s = xyz, where for any i ≥ 0 the string xyi z is in B. We consider three cases to show that this result is impossible. 1. The string y consists only of 0s. In this case, the string xyyz has more 0s than 1s and so is not a member of B, violating condition 1 of the pumping lemma. This case is a contradiction. 2. The string y consists only of 1s. This case also gives a contradiction. 3. The string y consists of both 0s and 1s. In this case, the string xyyz may have the same number of 0s and 1s, but they will be out of order with some 1s before 0s. Hence it is not a member of B, which is a contradiction.

rejecting computational history

Let M be a Turing machine and w an input string. For M on w it is a sequence of configurations, C1, C2,...,Cl, where C1 is the start configuration of M on w, Cl is a rejecting configuration of M, and each Ci legally follows from Ci−1 according to the rules of M.

accepting computational history

Let M be a Turing machine and w an input string. For M on w it is a sequence of configurations, C1, C2,...,Cl, where C1 is the start configuration of M on w, Cl is an accepting configuration of M, and each Ci legally follows from Ci−1 according to the rules of M.

running time

Let M be a deterministic Turing machine that halts on all in- puts. The running time or time complexity of M is the function f : N −→N , where f(n) is the maximum number of steps that M uses on any input of length n. If f(n) is the running time of M, we say that M runs in time f(n) and that M is an f(n) time Tur- ing machine. Customarily we use n to represent the length of the input.

union regular closure

Let M1 recognize A1, where M1 = (Q1, Σ, δ1, q1, F1), and M2 recognize A2, where M2 = (Q2, Σ, δ2, q2, F2). Construct M to recognize A1 ∪ A2, where M = (Q, Σ, δ, q0, F). 1. Q = {(r1, r2)| r1 ∈ Q1 and r2 ∈ Q2}. This set is the Cartesian product of sets Q1 and Q2 and is written Q1 ×Q2. It is the set of all pairs of states, the first from Q1 and the second from Q2. 2. Σ, the alphabet, is the same as in M1 and M2. In this theorem and in all subsequent similar theorems, we assume for simplicity that both M1 and M2 have the same input alphabet Σ. The theorem remains true if they have different alphabets, Σ1 and Σ2. We would then modify the proof to let Σ = Σ1 ∪ Σ2. 3. δ, the transition function, is defined as follows. For each (r1, r2) ∈ Q and each a ∈ Σ, let δ((r1, r2), a)= δ1(r1, a), δ2(r2, a)) Hence δ gets a state of M (which actually is a pair of states from M1 and M2), together with an input symbol, and returns M's next state. 4. q0 is the pair (q1, q2). 5. F is the set of pairs in which either member is an accept state of M1 or M2. We can write it as F = {(r1, r2)| r1 ∈ F1 or r2 ∈ F2}. This expression is the same as F = (F1 × Q2) ∪ (Q1 × F2). (Note that it is not the same as F = F1 × F2.)

NFA=DFA proof

Let N = (Q, Σ, δ, q0, F) be the NFA recognizing some language A. We construct a DFA M = (Q′, Σ, δ′, q0′, F′) recognizing A. Before doing the full construction, let's first consider the easier case wherein N has no ε arrows. Later we take the ε arrows into account. 1. Q′ = P(Q). Every state of M is a set of states of N. Recall that P(Q) is the set of subsets of Q. 2. For R ∈ Q′ and a ∈ Σ, let δ′ (R, a) = {q ∈ Q| q ∈ δ(r, a) for some r ∈ R}. If R is a state of M, it is also a set of states of N. When M reads a symbol a in state R, it shows where a takes each state in R. Because each state may go to a set of states, we take the union of all these sets. Another way to write this expression is δ′(R, a) = U(r∈R)δ(r, a). 3. q0= {q0}. M starts in the state corresponding to the collection containing just the start state of N. 4. F′ = {R ∈ Q′| R contains an accept state of N}. The machine M accepts if one of the possible states that N could be in at this point is an accept state.

regular closed under star

Let N1 = (Q1, Σ, δ1, q1, F1) recognize A1. Construct N = (Q, Σ, δ, q0, F) to recognize A∗ 1. 1. Q = {q0} ∪ Q1. The states of N are the states of N1 plus a new start state. 2. The state q0 is the new start state. 3. F = {q0} ∪ F1. The accept states are the old accept states plus the new start state. 4. Define δ so that for any q ∈ Q and any a ∈ Σε, δ(q, a) = ⎧ ⎩ δ1(q, a) q ∈ Q1 and q ̸∈ F1 δ1(q, a) q ∈ F1 and a ̸= ε δ1(q, a) ∪ {q1} q ∈ F1 and a = ε {q1} q = q0 and a = ε ∅ q = q0 and a ̸= ε.

Arden's Lemma

Let P and Q be two regular expressions, if P does not contain null string, then R=Q+RP has unique solution that is R=QP*

Rice's Theorem

Let P be any nontrivial property of the language of a Turing machine. Prove that the problem of determining whether a given Turing machine's language has property P is undecidable. In more formal terms, let P be a language consisting of Turing machine descrip- tions where P fulfills two conditions. First, P is nontrivial—it contains some, but not all, TM descriptions. Second, P is a property of the TM's language—whenever L(M1) = L(M2), we have ⟨M1⟩ ∈ P iff ⟨M2⟩ ∈ P. Here, M1 and M2 are any TMs. Prove that P is an undecidable language.

Big O Notation

Let f and g be functions f,g : N −→R+. Say that f(n) = O(g(n)) if positive integers c and n0 exist such that for every integer n ≥ n0, f(n) ≤ c g(n). When f(n) = O(g(n)), we say that g(n) is an upper bound for f(n), or more precisely, that g(n) is an asymptotic upper bound for f(n), to emphasize that we are suppressing constant factors. less than or equal to g if we disregard differences up to a constant factor.

little o

Let f and g be functions f,g : N −→R+. Say that f(n) = o(g(n)) if limn→∞f(n)/g(n) = 0. In other words, f(n) = o(g(n)) means that for any real number c > 0, a number n0 exists, where f(n) <cg(n) for all n ≥ n0 .

3sat to clique

Let φ be a formula with k clauses such as φ = (a1 ∨ b1 ∨ c1) ∧ (a2 ∨ b2 ∨ c2) ∧ ··· ∧ (ak ∨ bk ∨ ck). The reduction f generates the string ⟨G, k⟩, where G is an undirected graph defined as follows. The nodes in G are organized into k groups of three nodes each called the triples, t1,...,tk. Each triple corresponds to one of the clauses in φ, and each node in a triple corresponds to a literal in the associated clause. Label each node of G with its corresponding literal in φ. The edges of G connect all but two types of pairs of nodes in G. No edge is present between nodes in the same triple, and no edge is present between two nodes with contradictory labels, as in x2 and x2. Figure 7.33 illustrates this construction when φ = (x1 ∨ x1 ∨ x2) ∧ (x1 ∨ x2 ∨ x2) ∧ (x1 ∨ x2 ∨ x2). Now we demonstrate why this construction works. We show that φ is satisfi- able iff G has a k-clique. Suppose that φ has a satisfying assignment. In that satisfying assignment, at least one literal is true in every clause. In each triple of G, we select one node corresponding to a true literal in the satisfying assignment. If more than one literal is true in a particular clause, we choose one of the true literals arbitrarily. The nodes just selected form a k-clique. The number of nodes selected is k because we chose one for each of the k triples. Each pair of selected nodes is joined by an edge because no pair fits one of the exceptions described previously. They could not be from the same triple because we selected only one node per triple. They could not have contradictory labels because the associated literals were both true in the satisfying assignment. Therefore, G contains a k-clique. Suppose that G has a k-clique. No two of the clique's nodes occur in the same triple because nodes in the same triple aren't connected by edges. Therefore, each of the k triples contains exactly one of the k clique nodes. We assign truth values to the variables of φ so that each literal labeling a clique node is made true. Doing so is always possible because two nodes labeled in a contradictory way are not connected by an edge and hence both can't be in the clique. This assignment to the variables satisfies φ because each triple contains a clique node and hence each clause contains a literal that is assigned TRUE. Therefore, φ is satisfiable.

Complexity order

L⊆ NL = coNL ⊆P ⊆ NP ⊆ PSPACE = NPSPACE ⊆ EXPTIME⊆ EXPSPACE

B = {w#w| w ∈ {0,1}*}

M1 = "On input string w: 1. Zig-zag across the tape to corresponding positions on either side of the # symbol to check whether these positions contain the same symbol. If they do not, or if no # is found, reject. Cross off symbols as they are checked to keep track of which symbols correspond. 2. When all symbols to the left of the # have been crossed off, check for any remaining symbols to the right of the #. If any symbols remain, reject; otherwise, accept."

an example of space

M1 = "On input ⟨φ⟩, where φ is a Boolean formula: 1. For each truth assignment to the variables x1,...,xm of φ: 2. Evaluate φ on that truth assignment. 3. If φ ever evaluated to 1, accept; if not, reject." Machine M1 clearly runs in linear space because each iteration of the loop can reuse the same portion of the tape. The machine needs to store only the current truth assignment, and that can be done with O(m) space. The number of variables m is at most n, the length of the input, so this machine runs in space O(n).

A = {0^(2n) | n ≥ 0},

M2 = "On input string w: 1. Sweep left to right across the tape, crossing off every other 0. 2. If in stage 1 the tape contained a single 0, accept. 3. If in stage 1 the tape contained more than a single 0 and the number of 0s was odd, reject. 4. Return the head to the left-hand end of the tape. 5. Go to stage 1."

{a^ib^jc^k| i × j = k and i, j, k ≥ 1}.

M3 = "On input string w: 1. Scan the input from left to right to determine whether it is a member of a+b+c+ and reject if it isn't. 2. Return the head to the left-hand end of the tape. 3. Cross off an a and scan to the right until a b occurs. Shuttle between the b's and the c's, crossing off one of each until all b's are gone. If all c's have been crossed off and some b's remain, reject. 4. Restore the crossed off b's and repeat stage 3 if there is another a to cross off. If all a's have been crossed off, determine whether all c's also have been crossed off. If yes, accept; otherwise, reject."

NL to coNL

NL = coNL.

NL to P

NL ⊆ P.

SAT

NP

P

P is the class of languages that are decidable in polynomial time on a deterministic single-tape Turing machine. In other words, P = U TIME(n^k). k

union closed under regular part 2

PROOF Let N1 = (Q1, Σ, δ1, q1, F1) recognize A1, and N2 = (Q2, Σ, δ2, q2, F2) recognize A2. Construct N = (Q, Σ, δ, q0, F) to recognize A1 ∪ A2. 1. Q = {q0} ∪ Q1 ∪ Q2. The states of N are all the states of N1 and N2, with the addition of a new start state q0. 2. The state q0 is the start state of N. 3. The set of accept states F = F1 ∪ F2. The accept states of N are all the accept states of N1 and N2. That way, N accepts if either N1 accepts or N2 accepts. 4. Define δ so that for any q ∈ Q and any a ∈ Σε, δ(q, a) = ⎧ ⎨ ⎩ δ1(q, a) q ∈ Q1 δ2(q, a) q ∈ Q2 {q1, q2} q = q0 and a = ε ∅ q = q0 and a ̸= ε.

Countability of all reals

R is uncountable

B reduction

Replacing the bound variable with the argument expression in the body of the abstraction

Conjunctive normal form

Represented as a canonical conjunction of disjunctions

Cook Levin Theorem

SAT is NP-c

space complexity classes

SPACE(f(n)) and NSPACE(f(n))

DCFLs closure complement

The class of DCFLs is closed under complementation.

PCP

The problem of matching the total top string and total bottom string from a given collection of two faced dominoes where each face contains a string by manipulating the order of the dominoes

intersection closed under regular

To prove this theorem, let's try something along the lines of the proof of the union case. As before, we can start with finite automata M1 and M2 recognizing the regular languages A1 and A2. But now, instead of constructing automaton M to accept its input if either M1 or M2 accept, it must accept if its input can be broken into two pieces, where M1 accepts the first piece and M2 accepts the second piece. The problem is that M doesn't know where to break its input (i.e., where the first part ends and the second begins). To solve this problem, we introduce a new technique called nondeterminism.

diff between big and small o

To say that one func- tion is asymptotically less than another, we use small-o notation. The difference between the big-O and small-o notations is analogous to the difference between ≤ and <.

undecidability

Turing-recog and not co-Turing recog

turing co-rec

Turing-recognizable complement of language

example of not cf

Use the pumping lemma to show that the language B = {anbncn| n ≥ 0} is not context free. We assume that B is a CFL and obtain a contradiction. Let p be the pumping length for B that is guaranteed to exist by the pumping lemma. Select the string s = apbpcp. Clearly s is a member of B and of length at least p. The pumping lemma states that s can be pumped, but we show that it cannot. In other words, we show that no matter how we divide s into uvxyz, one of the three conditions of the lemma is violated. First, condition 2 stipulates that either v or y is nonempty. Then we consider one of two cases, depending on whether substrings v and y contain more than one type of alphabet symbol. 1. When both v and y contain only one type of alphabet symbol, v does not contain both a's and b's or both b's and c's, and the same holds for y. In this case, the string uv2xy2z cannot contain equal numbers of a's, b's, and c's. Therefore, it cannot be a member of B. That violates condition 1 of the lemma and is thus a contradiction. 2. When either v or y contains more than one type of symbol, uv2xy2z may contain equal numbers of the three alphabet symbols but not in the correct order. Hence it cannot be a member of B and a contradiction occurs. One of these cases must occur. Because both cases result in a contradiction, a contradiction is unavoidable. So the assumption that B is a CFL must be false. Thus we have proved that B is not a CFL.

SUBSET sum NP-C

We already know that SUBSET-SUM ∈ NP, so we now show that 3SAT ≤P SUBSET-SUM. Let φ be a Boolean formula with variables x1,...,xl and clauses c1,...,ck. The reduction converts φ to an instance of the SUBSET-SUM problem ⟨S, t⟩, wherein the elements of S and the number t are the rows in the table in Fig- ure 7.57, expressed in ordinary decimal notation. The rows above the double line are labeled y1, z1, y2, z2,...,yl, zl and g1, h1, g2, h2,...,gk, hk and constitute the elements of S. The row below the double line is t. Thus, S contains one pair of numbers, yi, zi, for each variable xi in φ. The decimal representation of these numbers is in two parts, as indicated in the table. The left-hand part comprises a 1 followed by l − i 0s. The right-hand part contains one digit for each clause, where the digit of yi in column cj is 1 if clause cj contains literal xi, and the digit of zi in column cj is 1 if clause cj contains literal xi. Digits not specified to be 1 are 0. The table is partially filled in to illustrate sample clauses, c1, c2, and ck: (x1 ∨ x2 ∨ x3) ∧ (x2 ∨ x3 ∨ ···) ∧ ··· ∧ (x3 ∨ ··· ∨ ···). Additionally, S contains one pair of numbers, gj , hj, for each clause cj . These two numbers are equal and consist of a 1 followed by k − j 0s. Finally, the target number t, the bottom row of the table, consists of l 1s followed by k 3s. Next, we show why this construction works. We demonstrate that φ is satis- fiable iff some subset of S sums to t. Suppose that φ is satisfiable. We construct a subset of S as follows. We select yi if xi is assigned TRUE in the satisfying assignment, and zi if xi is assigned FALSE. If we add up what we have selected so far, we obtain a 1 in each of the first l digits because we have selected either yi or zi for each i. Furthermore, each of the last k digits is a number between 1 and 3 because each clause is satisfied and so contains between 1 and 3 true literals. We additionally select enough of the g and h numbers to bring each of the last k digits up to 3, thus hitting the target. Suppose that a subset of S sums to t. We construct a satisfying assignment to φ after making several observations. First, all the digits in members of S are either 0 or 1. Furthermore, each column in the table describing S contains at most five 1s. Hence a "carry" into the next column never occurs when a subset of S is added. To get a 1 in each of the first l columns, the subset must have either yi or zi for each i, but not both. Now we make the satisfying assignment. If the subset contains yi, we assign xi TRUE; otherwise, we assign it FALSE. This assignment must satisfy φ because in each of the final k columns, the sum is always 3. In column cj , at most 2 can come from gj and hj, so at least 1 in this column must come from some yi or zi in the subset. If it is yi, then xi appears in cj and is assigned TRUE, so cj is satisfied. If it is zi, then xi appears in cj and xi is assigned FALSE, so cj is satisfied. Therefore, φ is satisfied. Finally, we must be sure that the reduction can be carried out in polynomial time. The table has a size of roughly (k + l)2 and each entry can be easily calculated for any φ. So the total time is O(n2) easy stages.

idea + proof for regular closed under concat

We have regular languages A1 and A2 and want to prove that A1 ◦ A2 is regular. The idea is to take two NFAs, N1 and N2 for A1 and A2, and combine them into a new NFA N as we did for the case of union, but this time in a different way, as shown in Figure 1.48. Assign N's start state to be the start state of N1. The accept states of N1 have additional ε arrows that nondeterministically allow branching to N2 whenever N1 is in an accept state, signifying that it has found an initial piece of the input that constitutes a string in A1. The accept states of N are the accept states of N2 only. Therefore, it accepts when the input can be split into two parts, the first accepted by N1 and the second by N2. We can think of N as nondeterministically guessing where to make the split. Let N1 = (Q1, Σ, δ1, q1, F1) recognize A1, and N2 = (Q2, Σ, δ2, q2, F2) recognize A2. Construct N = (Q, Σ, δ, q1, F2) to recognize A1 ◦ A2. 1. Q = Q1 ∪ Q2. The states of N are all the states of N1 and N2. 2. The state q1 is the same as the start state of N1. 3. The accept states F2 are the same as the accept states of N2. 4. Define δ so that for any q ∈ Q and any a ∈ Σε, δ(q, a) = ⎧ ⎨ ⎩ δ1(q, a) q ∈ Q1 and q ̸∈ F1 δ1(q, a) q ∈ F1 and a ̸= ε δ1(q, a) ∪ {q2} q ∈ F1 and a = ε δ2(q, a) q ∈ Q2.

PDA

a 6-tuple (Q, Σ, Γ, δ, q0, F), where Q, Σ, Γ, and F are all finite sets, and 1. Q is the set of states, 2. Σ is the input alphabet, 3. Γ is the stack alphabet, 4. δ : Q × Σε × Γε→P(Q × Γε) is the transition function, 5. q0 ∈ Q is the start state, and 6. F ⊆ Q is the set of accept states.

ACFG = {⟨G, w⟩| G is a CFG that generates string w}.

a CFG gens string w, decidable

log space transducer

a Turing machine with a read-only input tape, a write-only output tape, and a read/write work tape. The head on the output tape cannot move leftward, so it cannot read what it has written. The work tape may contain O(log n) symbols. A log space transducer M computes a function f : Σ∗−→Σ∗, where f(w) is the string remaining on the output tape after M halts when it is started with w on its input tape. We call f a log space com- putable function. Language A is log space reducible to language B, written A ≤L B, if A is mapping reducible to B by means of a log space computable function f.

np-c

a class of problems for which individual complexity is related to the rest of the class', if a single is shown in to be P, all will be in P.

mapping

a function

Turing-recognizable

a language is Turning-recognizable if some Turning machine recognizes it; that is to say, the language is recursively enumerable, meaning some enumerator enumerates it, or that a TM can be constructed which allows for the computation of every string in L TM recognizes language L iff the strings in L put M into accept state OR the strings not in L A)put M into reject state B) cause M to loop forever

decidability

a language is decidable iff it is Turing-recognizable and co-Turing recognizable

regular language

a regular language is regular iff an FSA accepts it

LBA

a restricted type of Turing machine wherein the tape head isn't permitted to move off the portion of the tape containing the input. If the machine tries to move its head off either end of the input, the head stays where it is—in the same way that the head will not move off the left-hand end of an ordinary Turing machine's tape.

formal proof

a sequence of statements where each follows from the preceding statement and certain basic axioms about numbers, using simple and precise rules of implication

reducibility

a way of converting one problem to another

ADFA = {⟨B, w⟩| B is a DFA that accepts input string w}.

acceptance problem DFAs of testing whether a particular deterministic finite automaton accepts a given string can beexpressed as a language, ADFA, decidable

NFA ambiguity

accepts some strig along two different computation branches

type 0

all formal grammars turing machine recursively enumerable alpha->beta where alpha is ( V + T)* V ( V + T)* V : Variables T : Terminals. \beta is ( V + T )*. In type 0 there must be at least one variable on Left side of production. For example, Sab -> ba A -> S. Here, Variables are S, A and Terminals a, b.

Alpha rule

alpha conversion renames a bound variable in the expression-- lambdax.x can be alpha converted to lambday.y

verifier

an algorithm V , where A = {w| V accepts ⟨w, c⟩ for some string c}. We measure the time of a verifier only in terms of the length of w, so a polynomial time verifier runs in polynomial time in the length of w. A language A is polynomially verifiable if it has a polynomial time verifier.

function

an object that sets up an input-output relationship

L

class of languages that are decidable in logarithmic space on a deterministic Turing machine. In other words, L = SPACE(log n).

PSPACE

class of languages that are decidable in polynomial space on a deterministic Turing machine. In other words, PSPACE = U SPACE(nk). k

NP

class of languages that have poly verifiers

closure context sensitive

closed under union, intersection, complement, concat, kleene, reversal

recursively enumerable closure

closed under union, intersection, concat, and Star, not under complement

ε

contains empty string

type 2, grammar

context free NDPDA, PDA A context-free grammar is a 4-tuple (V, Σ, R, S), where 1. V is a finite set called the variables, 2. Σ is a finite set, disjoint from V , called the terminals, 3. R is a finite set of rules, with each rule being a variable and a string of variables and terminals, and 4. S ∈ V is the start variable.

type 1

context sensitive linear bound automata all type 1 should also be type 0 alpha->beta where the length of alpha is less than or equal to beta For Example, S -> AB AB -> abc B -> b

AREX = {⟨R, w⟩| R is a regular expression that generates string w}.

deciable

ANFA = {⟨B, w⟩| B is an NFA that accepts input string w}.

decidable

decidability of every CFL

decidable

set of possible inputs to function

domain

EDFA = {⟨A⟩| A is a DFA and L(A) = ∅}.

emptiness testing, decidable

ECFG = {⟨G, w⟩| G is a CFG and L(G) =∅}.

empty CFG is decidable

Turing and Lamb calc

equivalent

CFL P

every CFL is a member of P

reg to cf

every regular language is CF

intersection closed regular

final state F1x F2, for which input that satisfies both languages is accepts

predicate or property

function whose range is {TRUE, FALSE}

countable

if either it is finite or it has the same size as N .

CFG normal

iif all production rules are of the form: A → BC, or A → a, or S → ε,

certificate/proof

info verifier uses to check an answer is correct for a given problem

is empty string

CDCL

keep list of literals that have been chosen and derived during DPLL, list can be extended if decide, if a literal is derived by unit resolution(Unit Propagate), or part may be removed if case analysis continued after contradiction (backtrack)

identity function lamdba

lambdax.x

outcome of pred

lamdbaf.lambdax.(f^n-1x)

Turing-decidable

language is both Turing-recognizable

can pumping prove cf

no, cannot prove cf, only not cf

can pumping proof CFL

no, only non CFL

can pumping prove regularity

no, only nonregularity

alphabet

nonempty finite set, with members

why min in NP

not MIN-FORMULA doesn't seem to be in NP (though whether it actually be- longs to NP is not known). However, not MIN-FORMULA is in NPSAT because a nondeterministic polynomial time oracle Turing machine with a SAT oracle can test whether φ is a member, as follows. First, the inequivalence problem for two Boolean formulas is solvable in NP, and hence the equivalence problem is in coNP because a nondeterministic machine can guess the assignment on which the two formulas have different values. Then, the nondeterministic oracle ma- chine for not MIN-FORMULA nondeterministically guesses the smaller equivalent formula, tests whether it actually is equivalent, using the SAT oracle, and accepts if it is. "On input ⟨φ⟩: 1. Universally select all formulas ψ that are shorter than φ. 2. Existentially select an assignment to the variables of φ. 3. Evaluate both φ and ψ on this assignment. 4. Accept if the formulas evaluate to different values. Reject if they evaluate to the same value."

Space Complexity

of M is the function f : N −→N , where f(n) is the maximum number of tape cells that M scans on any input of length n. If the space complexity of M is f(n), we also say that M runs in space f(n). If M is a nondeterministic Turing machine wherein all branches halt on all inputs, we define its space complexity f(n) to be the maximum number of tape cells that M scans on any branch of its computation for any input of length n.

Th(N,+) dec

pg 256, 280 in pdf

outputs from function

range

godel

recursive functions to prove axiomatic set of numbers both consistent and complete

type 3

regular NDA, FSA, DSA, A->a, A-> aB

regular expressions

regular operations used to build expressions describing languages 1. a for some a in the alphabet Σ, 2. ε, 3. ∅, 4. (R1 ∪ R2), where R1 and R2 are regular expressions, 5. (R1 ◦ R2), where R1 and R2 are regular expressions, or 6. (R1*), where R1 is a regular expression.

NL

the class of languages that are decidable in logarithmic space on a nondeterministic Turing machine. In other words, NL = NSPACE(log n).

church-rosser normal form

the lambda expression has been reduced st no more b reductions can be applied and it is unique

Power Set

the set of all subsets of a set |P(S)|>|S|

EQCFG = {⟨G, H⟩| G and H are CFGs and L(G) = L(H)}.

two cfgs gen same language, undecidable

EQDFA = {⟨A, B⟩| A and B are DFAs and L(A) = L(B)}.

two dfas recognize the same language, decidable

equivalence relation

two objects being equivalent on some feature r is reflexive r is symmetric r is transitive

th(N, +, x)

undec

ATM = {⟨M,w⟩| M is a TM and M accepts w}.

undecidable, a TM accepts a given input string

CFG closure

union, concat, Star, reversal. Not under intersection or complement

regular closures

union, intersection, complement, concatention, star, reversal

when are sets equal?

when they have cardinality the same size w/ all the same elemets

terminating

will always give output

Do NFAs and DFAs have same power?

yes Every nondeterministic finite automaton has an equivalent deterministic finite automaton.

01 ∪ 10

{01, 10}.

NSPACE(f(n))

{L| L is a language decided by an O(f(n)) space deterministic Turing machine}.

SPACE(f(n))

{L| L is a language decided by an O(f(n)) space deterministic Turing machine}.

language of grammar

{w ∈ Σ∗| S ∗⇒ w}.

1∗(01+)∗

{w| every 0 in w is followed by at least one 1}.

(ΣΣΣ)∗

{w| the length of w is a multiple of 3}.

0*10*

{w| w contains a single 1}.

Σ∗001Σ∗

{w| w contains the string 001 as a substring}.

Σ*1Σ*

{w| w has at least one 1}.

(ΣΣ)∗

{w| w is a string of even length}.

0Σ∗0 ∪ 1Σ∗1 ∪ 0 ∪ 1

{w| w starts and ends with the same symbol}.

(0 ∪ ε)(1 ∪ ε)

{ε, 0, 1, 01}.

∅∗

{ε}.

y combinator

λf. (λx. f (x x))(λx. f (x x)),

DP

• Iteratively select a variable x to perform resolution on • Retain only the newly added clauses and the ones not containing x • Termination: You either - Derive the empty clause (conclude UNSAT) - Or all variables have been selected

1∗∅

space hierarchy theorem

⊆ NL = coNL ⊆


Ensembles d'études connexes

Accounting Solutions from Reading Questions - Chapter 7 module 2

View Set

Unit 9 The Effects of Distracted Driving

View Set

Chapter 11: Industry Vocabulary Def & Examples & Why? / Significance

View Set

HR (Chapter 6-Training, Learning, Talent Management, and Development)

View Set

COMP2121 - Analog Input and Output

View Set

Property and Casualty Practice PSI Exam

View Set

Entrepreneurial Small Business 5th Edition; Chapter 3

View Set

MGT 434 Consumer Behavior QUIZZES

View Set

Multiple Sclerosis, Myasthenia Gravis, Parkinsons e11, e12, flashcards, P,D, +A

View Set