8 Determine if L in P

  1. Input: Sets A1,...,An, and a number k.
    Question: do there exist k mutually disjoint sets Ai1,...,Aik not in P

  2. Input: Sets A1,...,An.
    Question: do there exist 3 mutually disjoint sets Ai,Aj,Ak in P

  3. Input: Sets A1,...,An, and a number k.
    Question: do there exist k sets such that Ai1,...,Aik such that AiAj not in P

  4. Input: a CNF formula ψ with at most 50 variables.
    Question: does there exist an assignment that satisfies ψ in P

  5. Input: a CNF formula ψ with at most 50 clauses.
    Question: does there exist an assignment that satisfies ψ in P

  6. Input: a 3CNF formula ψ with even number of variables.
    Question: does there exist an assignment that satisfies ψ and gives True for exactly one half of the variables? not in P

  7. Input: undirected graph G, a number k.
    Question: does there exist in G a clique of size at least k or an independent set of size at least k? not in P

Resulting regular expres­sion:

L={0i1j:i,j0 and wLs.t|w|=i+j} is regular if L regular T. built NFA Q×{0,1},δ((q,0),0)={(δ(q,σ),0):σΣ}.δ((q,0),ϵ)={(δ(q,1),σ):σΣ}
L={0i1j:i,j0 and wLs.t|w|=|ij|}is regular if L regular F. take L=ϵ r = r1* r2(r4+­r3r­1*r2)* where: r1: initial → initial r2: initial → accepting r3: accepting → initial r4: accepting → accepting

L2={y:x,z  s.t.|x|=|z| and xyzL}

(Example) is regular.onsider some DFA for L. For every n0, let An be the set of states s such that there is *some* word of length n which leads the DFA from the initial state to s. Let Bn be the set of states t such that there is *some* word of length n which leads the DFA from t to an accepting state. Finally, for any two states s,t, let Rs,t be the (regular) set of words leading the DFA from s to t. We have

L2=n0sAntBnRs,t.

Since there are only finitely many possibilities for s,t, the union is in fact finite, and so regular.

8.1 Examples

  1. L={M:M is a TM and |L(M)|>10}RE/R

  2. L={M:M is a TM that accepts 1 but does not accept 0}REco-RE

  3. L={M1,M2:M1,M2 are TMs and L(M1)L(M2)=}co-RE/R

  4. L={M1,M2:M1,M2 are TMs and L(M1)L(M2)}REco-RE

  5. Ln={w0wn|w{0,1}wn{0,1}n1} is Regular

  6. L1={w:#a(w)#b(w)} over Σ={a,b,c} L1 is not regular

  7. L2={w:|w|Nevenw=wR)} over  L2 is not regular

  8. L4={w:|w|N s.t |w|=n3} over  L4 is not regular

  9. L={M|M is a TM and there exists an input on which M halts in less than |M| steps }R

  10. L={M|M is a TM and |L(M)|3}co-RE reduce HALT. idea copies M and x to its tape, and runs M on x; it accepts if M halts on x.

  11. L={M|M M is a TM and |L(M)|3} RE reduce HALT. It erases w, puts M and x on its tape, and runs M on x and accepts if M halts on x.

  12. L={M|M is a TM that accepts all even numbers }not RE

  13. L={M|M is a TM and L(M) is finite }not RE

  14. L={M|M is a TM and L(M) is infinite }not RE

  15. L={M| is a TM and L(M) is countable }R This is the language of all TM’s, since there are no uncountable languages ( finite alphabets and finite-length strings).

  16. L={M|M is a TM and L(M) is uncountable } R This is the empty set

  17. L={M1,M2| are TM’s and ϵL(M1)L(M2)} RE. reduce HALT s.t M,xM,M M,x halts on xM accepts all strings, and in particular it accepts ϵϵL(M)L(M).

  18. L={M1,M2| are TM’s and ϵL(M1)L(M2)} RE.

  19. L={M1,M2| are TM’s and ϵL(M1)/L(M2)} not RE.
    HALT(M,x)(M1,M2). s.t L(M1)=Σ

  20. L={M|M is a TM. and M0 halt on all input, and M0L(M)} RE using Rice C={LRE:M0L}

  21. L={M|M is a TM. and M0 halt on all input, and ML(M0)} R

  22. L={M|M is a TM. and x is str and there exists a TM, M , such that ML(M)L(M)} R

  23. L={M|M is a TM. , and there exists an input whose length is less than 100, on which M halts }. RE

  24. L={k,x,M1,Mk|iM is a TM, and at least k/2 TM’s of halt on x }. RE its reduce HALT(M,X)(2,x,M,M)

  25. L={M|M is a TM and M halts on all palindromes .}.not RE .HALT(M,w)M on input x works as follows: M runs M on w for |x| steps: if M halts on w within |x| steps, reject, otherwise accept.(if x is polindrome)

  26. L={M|M is a TM and L(M){a2n}} is empty.}.not RE HALT(M,w)M M on input x: erase x, and run M on w. If M halts on w then M accepts.

  27. L={M|M is a TM that halts on all inputs and L(M)=L for some undecidable language L .}.R

  28. L={M|M is a TM and M accepts (at least) two strings of different lengths .}.RE

  29. L={M|M M is a TM such that both L(M) and L(M) are infinite .}.not RE M’ on input x works as follows: if x is of odd length, accept. if x is of even length, run M on w. If M halts, accept.
    (M,w)HALTM does not halt on wM accept all odd length str and reject all even.L(M) contain even-length strings,|L|=inf

  30. L={M|M is a TM, and |L(M)| is prime.}.not RE M on input x: if x is one of the first three strings (in lexicographic order) of Σ , then accept. Otherwise, run M on w. If M halts on w, and x is the 4 th string in Σ accept; otherwise, reject.

  31. L={M|M and exists x s.t for every yL(M),xyL(M).}.not RE M on input x: it runs M on w; if M halts on w, M accepts.

  32. L={M|M and exists x,y s.t for every yL(M),yL(M).}.Recursive (the language of all Turing machines)

  33. L={M|M is TM and exists M s.t MM and L(M)=L(M).}.Recursive(the language of all Turing machines)

  34. L={M1,M2|M and L(M1)mL(M2)}not RE HT(M,w)=M1,M2. s.t L(M2)=. M1 on input y: run M on w if M halts, check whether y is of the form M,z where M is TM and z is str. if so run M on z. if M halts, M1 accept . hence (1)if (M,w)HTL(M1)= (2) otherwize then L(M1)=HALT

  35. L={M1,M2|M M does not accept any string w such that 001 is a prefix of w}not RE

  36. L={M|M M does not accept any string w s x is a prefix of w}not RE

  37. L={M|M x is prefix of M}Recurcive

  38. L={M1,M2,M3|L(M1)=L(M2)L(m3)}not RE

  39. L={M1,M2,M3|L(M1)L(M2)L(m3)}not RE M1 on x: runs M on w; if M halts, M1 accepts.M2 on y: reject. M3 on z: reject.

  40. L={M1 there exist two TM’s M2 and M3 such that |L(M1)L(M2)L(m3)}Recursive

  41. L={M,w M is a TM that accepts w using at most 2|w| squares of its tape}Recursive Let m be the number of states in M, and k be the size of the alphabet that M uses, and r=|w| if M uses at most 2r squares of its tape, then there are at most a=mk2r2r configurations.If M runs on w for more than a steps, and does not use more than 2r squares of its tape, then M must be in the one configuration at least twice.
    M runs M on w for at most a + 1 steps.If M accepts w within a steps with using at most 2r squares, m halts and accepts

  42. Wich one is False for sure DTIME[n2]=LP=NPRLP

  43. Wich one we dont know if it close under klee star LPNPEXP

  44. Let f be computable with circut size |S| we can construct circuit size O(S) with only AND,NOT gate for sure.

  45. L={G|G is an undirected graph that contains no odd length cycle}RL,NL(mybe)

  46. L={G,1k| G is an undirected with exactly k triangles}L

  47. L={ψ is ( always true) }CoNP complete

  48. L={G,k| G is an undirected with exactly k diffrent SCC}SPACE(log2n),P

  49. If we find that S={G,s,t dont have path between s and t }L then L=CoNL

  50. {G,s,t

G is an directed graph, and the shortest patch between s,tisatleastsize|V|/2 }NL {G,s,t G is an directed graph, and exsit patch between s,texcatliysize|V|/2 }NPC If NTIME(n100)TIME(n1000) then P=NP,EXP=NEXP,NSPACE(n50)SPACE(n500) EXACT3SAT={φ3SAT:every clause of ϕhasexactly3distinctvariables} is NPC L2={M,1n:M is a TM and there exists a string that M accepts in n steps}is NPC L={xyz:xyRzL} is regular if L Recursive L={xyΣ:(xL) XOR (yL)} is regular regular if L Recursive.

stand for respect under logspace reduction
CVAL={C,x:C is boolean circut and C(x)=1}\Pcomplete
STCON={G,s,t:G is a directed graph and exsit path from s to t }\P,NLcomplete
UHAMPATH={G,s,t:G is a undirected graph and exsit ham' path from s to t }NPC
UHAMCYCLE={G:G is a undirected graph has Hamiltonian cycle }NPC
SUBSET-SUM={S=s1sk,t:TS,sTs=t}NPC

Theorem

(extended rice) Let CRE s.t ΣC,C. then LCRE

LC={M:M is TM andL(M)C}RE
Proof

ACCmLC and Let MA be TM that accept some AC. Define f(M,w)BM,w,
BM,w On input x: Emulate MA(x) and M(w) in parallel, and accept if one of them does.

M,wACCL(BM,w)=ACM,wACCL(BM,w)=ΣC

2-NFA with same L

to compare languages accepted by both we have to figure out if L(A) is equal to L(B) or not. Thus, you have to find out if L(A)-L(B) and L(B)-L(A) is null set or not. (Reason1)
Part1: To find this out, we construct NFA X from NFA A and NFA B, . If X is empty set then L(A) = L(B) else L(A) != L(B). (Reason2)
Part2: Now, we have to find out an efficient way of proving or disproving X is empty set. When will be X empty as DFA or NFA? Answer: X will be empty when there is no path leading from starting state to any of the final state of X. We can use BFS or DFS for this.X=(AB)(BA)=?

(a)L={M,wMattempts to move its head left when its head is on the leftmost tape cell}

We prove by contradiction that L is undecidable. Assume L was decidable, and let M be a TM that decides it. We construct a TM, M0 , that decides HP (the halting problem), i.e., we show HP is decidable as well, which is a contradiction. The TM M0 on input hM, wi: i. build a TM, M00 , from M, where M00 shifts w one tape cell to the right, and mark the leftmost tape cell with ]. ii. TM M00 runs M on w. iii. If M00 encounters the ] symbol during the run of M on w, then M00 moves to the right and simulates M reaching the leftmost tape cell. iv. If M halts and accepts, M00 simulates moving its head all the way to the left and off the leftmost tape cell The TM M0 runs M on the input hM0 , wi. If M accepts, M0 accepts; otherwise, M0 rejects. Notice that M always halts (accepts or rejects) since we assumed it is a decider. You can prove now that M00 moves its head off of the leftmost tape cell iff M halts (and accepts) w. It then follows that M0 decides HP, and hence HP is decidable, which is a contradiction. Therfore, the language L is not decidable.

(b)L={M,wMmoves its head left on input w}

The trick to proving this language is decidable is to notice that M moves its head left on an input w if and only if it does so within the first |w|+|Q|+1 steps of its run on w, where |Q| is the number of states of the machine M. Prove it! Therefore, to decide whether an input hM, wi is an instance of L, the deciderM simply runs M on w for at most |w|+|Q|+1steps and accepts iff M does moves its head left (the correctness of this construction follows immediately after you prove the validity of the above trick)

ACCBS={M,w,kM is a TM that accepts w using k cells}R b=|Q|×|Γ|k×k is a bound on the number of k cell configurations of M. Any f(n) space bounded Turing machine also runs in time 2O(f(n)). Is this because a configuration consists of a state, a position of the head and the contents of the work tape, which is |Q|f(n)|Γ|f(n) If there are k possible configurations, then any such Turing machine either runs in time at most k, or it loops forever. That’s because if it runs for at least k+1 time steps, some configuration must be repeated; and if a configuration is repeated, it will continue repeating forever.

Let |Γ|=2c, i.e., c=lg|Γ|. Then |Γ|f(n)=(2c)f(n)=2cf(n)=2O(f(n). For similar reasons, |Q|f(n)|Γ|f(n)=2O(f(n). So, the number of possible configurations of a f(n)-space-bounded Turing machine is 2O(f(n), and thus any such machine must either halt in time at most 2O(f(n) or loop forever.
{MM is a Turing machine such that L(M)P } is undecidable.

{ MM is a Turing machine such that MP }={M|(kx)M(x) halts in O(|x|k) time} We reduce from the halting problem. Suppose that we are given a machine M, and we are to decide whether M halts on the empty input. We construct a new machine M accepting a single input x, which operates as follows:

1. Let n=|x|. 2. M runs M for n steps. 3. If M halted within n steps then M runs a dummy loop taking exponential time Ω(2n). Otherwise, M just halts.

Since Turing machines can be simulated with only polynomial overhead, if M doesn’t halt then M runs in polynomial time. If M halts, then M takes exponential time. Hence M halts iff M is not polynomial time.

More generally, this shows that even if we know that M runs in time at most f(n) for some superpolynomial time-constructible f, then we cannot decide whether M runs in polynomial time.

Proof
ϕ=m=1n(xmymzm)SATpIndSet

with m clauses, produce the graph Gϕ that contains a triangle for each clause, with vertices of the triangle labeled by the literals of the clause. Add an edge between any two complementary literals from different triangles. Finally, set k=m. In our example, we have triangles on x,y,z and on x,w,z plus the edges (x,x) and (z,z).

>We need to prove two directions. First, if ϕ is satisfiable, then Gϕ has an independent set of size at least k. Secondly, if Gϕ has an independent set of size at least k, then ϕ is satisfiable. (Note that the latter is the contrapositive of the implication "if ϕ is not satisfiable, then Gϕ does not have an independent set of size at least k".)

>For the first direction, consider a satisfying assignment for ϕ. Take one true literal from every clause, and put the corresponding graph vertex into a set S. Observe that S is an independent set of size k (where k is the number of clauses in ϕ).

>For the other direction, take an independent set S of size k in Gϕ. Observe that S contains exactly one vertex from each triangle (clause) , and that S does not contain any conflicting pair of literals (such as x and x, since any such pair of conflicting literals are connected by an edge in Gϕ). Hence, we can assign the value True to all the literals corresponding with the vertices in the set S, and thereby satisfy the formula ϕ.

>This reduction is polynomial in time because ?

I’ve looked at many different examples of how this is done, and everything I find online includes everything in the proof except the argument of why this is polynomial. I presume it’s being left out because it’s trivial, but that doesn’t help me when I’m trying to learn how to explain such things.

L={M,1n:M is a TM and exists a string that M accepts in n steps} (cook-levin)
a.LNPC The witness is a word that M accepts in at most n steps b. LNP and let V be a verifier for L of running time at most p for some polynomial p. For a string w, let vw be the TM that on input c, emulates V(w,c). Consider the reduction f(w)=(Vw,1p(|w|) It is easy to verify that f is polytime computable, and that f(w)LwL

3-SAT: Given a CNF formula φ, where every clause in φ has *exactly* 3 literals in it, one should determine if there exist an assignment that satisfies it.
Max-2-SAT: Given a CNF formula, where every clause in ϕ has *exactly* 2 literals in it, and a positive number k, one should determine if there exist an assignment that satisfies *at least* k clauses.
Proof

Replace a singleton clause a with ab and many copies of ¬bc, ¬b¬c. Reductions without extra variables don’t work even when singleton clauses are allowed. There are five types of clauses: 1,¬1,12, 1¬2, ¬1¬2. Suppose that k of 1,2,2 are true. The probability that a random clause of each type is true is:

k0123101/32/31¬112/31/301202/3111¬211/31/31¬1¬2112/30

We would like to take a convex combination of these rows which is of the form

αβββ

However, all such convex combinations have α=β.

3SATPexactly 1/3 SAT
Proof

Let z be a new variable not in ϕ. Let there be m clauses in ϕ. We add (z¬z) and 2m+2 copies of (z) to ϕ. In every exactly 1/3-satisfying assignment z must be false.

Let ϕ(z¬z)(z)(z)...(2m+2) copies ...(z)=ϕ. The following claim is easy to prove.

Claim: ϕ is satisfiable iff ϕ has exactly 1/3rd satisfiable clauses.

Therfore 3SAT P 1/3-CNFSAT, and hence 1/3-CNFSAT is NP-complete.