CS 637: Mathematics-II

Lecture 13: Boolean Functions, DTIME, and 3SAT to INDSET

From Languages to Functions

Encoding a Computational Problem

A mathematical problem is first encoded as a binary string. If an instance \(I\) is encoded as \(\operatorname{enc}(I) \in \{0,1\}^*\), then the problem itself can be viewed as a function

\[ F_{\Pi} : \{0,1\}^* \to \{0,1\}^* \]

whose input is the encoding of an instance and whose output is the required answer.

Decision problems are the special case where the output is just one bit. Then \(F_{\Pi}\) is a Boolean function.

What It Means for a TM to Compute an Arbitrary Function

Let \(f : \{0,1\}^* \to \{0,1\}^*\). A Turing machine \(M\) computes \(f\) if for every input \(x \in \{0,1\}^*\):

  1. \(M\) starts with \(x\) written on its input tape.
  2. \(M\) halts after finitely many steps.
  3. At halting, the designated output tape contains exactly \(f(x)\).
\[ M(x) \downarrow \quad \text{and} \quad \operatorname{out}_M(x)=f(x) \quad \text{for every } x \in \{0,1\}^*. \]

When \(f\) has range \(\{0,1\}\), the machine is solving a yes/no problem.

Example: Palindrome as a Boolean Function

Define the Boolean function

\[ \operatorname{PAL}(x)= \begin{cases} 1 & \text{if } x=x^R, \\ 0 & \text{otherwise}. \end{cases} \]

This is the function version of the language

\[ L_{\operatorname{PAL}} = \{x \in \{0,1\}^* : \operatorname{PAL}(x)=1\}. \]

So a language \(L\) and its characteristic function \(\chi_L\) carry the same information:

\[ \chi_L(x)=1 \iff x \in L, \qquad L_f=\{x \in \{0,1\}^* : f(x)=1\}. \]

Why Revisit Problems as Functions?

  • Decision problems become Boolean functions \(f:\{0,1\}^* \to \{0,1\}\).
  • Search problems and optimization problems naturally need outputs in \(\{0,1\}^*\), not just one bit.
  • Complexity theory often states classes using languages, but the function viewpoint helps us talk about output and simulation directly.

Remark: Common Set Notation

Notation Meaning
\(\mathbb{N}\), \(\mathbb{Z}\) Natural numbers and integers
\([n]\) \(\{1,2,\dots,n\}\)
\(A \subseteq B\), \(A \subsetneq B\) \(A\) is a subset, or a proper subset, of \(B\)
\(|A|\) Cardinality of the set \(A\)
\(A \cup B\), \(A \cap B\) Union and intersection
\(A \setminus B\) Elements of \(A\) not in \(B\)
\(A \times B\) Cartesian product
\(\varnothing\), \(2^A\) Empty set and power set
\(\Sigma^*\), \(\Sigma^{\le n}\) All strings over \(\Sigma\), and all strings of length at most \(n\)

Certificates and Verifiers

Mathematical Definition of a Certificate

Let \(f : \{0,1\}^* \to \{0,1\}\) be a decision problem. A certificate system for \(f\) consists of:

  1. a polynomial \(p\), and
  2. a verifier \(V : \{0,1\}^* \times \{0,1\}^* \to \{0,1\}\)

such that for every input \(x\),

\[ f(x)=1 \iff \exists y \in \{0,1\}^{\le p(|x|)} \text{ such that } V(x,y)=1. \]

Any string \(y\) satisfying this condition for a particular yes-instance \(x\) is called a certificate (or witness) for \(x\).

Interpretation

  • The instance \(x\) is the question.
  • The certificate \(y\) is the proposed proof.
  • The verifier \(V\) checks the proof quickly.
  • No certificate is required when \(f(x)=0\); all certificates must fail in that case.

Example Certificates

Problem Certificate Verifier Check
\(\operatorname{3SAT}(\varphi)\) An assignment \(a \in \{0,1\}^m\) Evaluate \(\varphi(a)\) and accept iff every clause is satisfied
\(\operatorname{INDSET}(G,k)\) A list of \(k\) vertices Check all chosen vertices are distinct and no chosen pair forms an edge
\(\operatorname{PAL}(x)\) No helpful certificate is needed The verifier can check directly in polynomial time

Verifier View of NP

The class \(NP\) can be described in terms of polynomial-size certificates:

\[ x \in L \iff \exists y \in \{0,1\}^{\le |x|^{O(1)}} \text{ such that } V(x,y)=1, \]

where \(V\) is a deterministic polynomial-time algorithm. This is equivalent to the nondeterministic definition of \(NP\).

Alphabet Reduction and Binary Simulation

Time-Constructible Functions

A function \(T : \mathbb{N} \to \mathbb{N}\) is time-constructible if there is a Turing machine that, on input \(1^n\), writes \(1^{T(n)}\) and halts in \(O(T(n))\) time.

This condition lets a simulator budget its work in a controlled way.

Binary Alphabet Simulation Theorem

For every \(f : \{0,1\}^* \to \{0,1\}\) and time-constructible \(T : \mathbb{N} \to \mathbb{N}\), if \(f\) is computable in time \(T(n)\) by a Turing machine \(M\) using alphabet \(\Gamma\), then \(f\) is computable in time \(4 \log |\Gamma| \, T(n)\) by a Turing machine \(\widetilde{M}\) using the alphabet \(\{0,1,\sqcup,B\}\).

Here \(\sqcup\) is the blank symbol and \(B\) is used as a block marker.

Idea of the Simulation

Step 1

Choose a fixed-length binary encoding for each symbol of \(\Gamma\). Let \(\ell=\lceil \log |\Gamma| \rceil\).

Step 2

Represent one tape cell of \(M\) by a block \(B\,b_1b_2\dots b_{\ell}\) on \(\widetilde{M}\).

Step 3

To simulate one transition, decode the current block, compute the next move, rewrite the block, and move to the adjacent block.

Step 4

One simulated step costs \(O(\ell)\) time, giving total time \(O(\log |\Gamma| \cdot T(n))\).

Precision About the Constant

The lecture statement writes \(4 \log |\Gamma| \, T(n)\). A precise block-length argument often gives \(4 \lceil \log |\Gamma| \rceil T(n)\). The important message is that changing from any finite alphabet to a binary-style alphabet costs only a constant-factor slowdown.

Oblivious TMs and DTIME

Oblivious Turing Machine

A multi-tape Turing machine is oblivious if the head position on each tape depends only on the input length and the time step, not on the actual contents of the input.

\[ \text{For tape } i,\ \text{head position at time } t = h_i(n,t) \]

for some fixed function \(h_i\), where \(n=|x|\).

So the movement schedule is predetermined; only the symbols written and the branch decisions depend on the input.

Why Obliviousness Matters

  • It separates where the head goes from what data is stored there.
  • It is useful in uniform circuit constructions and simulation theorems.
  • Obliviousness does not change what is computable; it only changes the schedule of the computation.

Definition of \(DTIME(T(n))\)

In the Boolean-function viewpoint,

\[ DTIME(T(n)) = \left\{ f : \{0,1\}^* \to \{0,1\} \;\middle|\; \begin{array}{l} \text{there exists a deterministic TM } M \\ \text{computing } f \text{ in time } O(T(|x|)) \end{array} \right\}. \]

For languages, the equivalent definition is

\[ DTIME(T(n)) = \{L \subseteq \{0,1\}^* : \chi_L \in DTIME(T(n))\}. \]

Matching Language and Function Viewpoints

The language view and the Boolean-function view agree perfectly for decision problems. We simply move between \(L\) and \(\chi_L\).

Decision problem = Boolean function = language characteristic function.

Defining P and NP

Arora-Barak Style Definitions

Using standard complexity-class notation,

\[ P = \bigcup_{c \ge 1} DTIME(n^c), \qquad NP = \bigcup_{c \ge 1} NTIME(n^c). \]

Here

\[ NTIME(T(n)) = \{L \subseteq \{0,1\}^* : \text{some nondeterministic TM decides } L \text{ in time } O(T(n))\}. \]

How the Two Classes Differ

  • \(P\): deterministic polynomial-time solvability.
  • \(NP\): nondeterministic polynomial-time solvability, or equivalently, polynomial-time verifiability.
  • \(P \subseteq NP\) because a deterministic machine is a special case of a nondeterministic one.

Examples to Keep in Mind

  • \(\operatorname{PAL} \in P\): compare the string with its reverse using a polynomial-time algorithm.
  • \(\operatorname{3SAT} \in NP\): a satisfying assignment is a polynomial-size certificate.
  • \(\operatorname{INDSET} \in NP\): a chosen vertex set is a polynomial-size certificate.

Verifier Form of NP

A language \(L\) is in \(NP\) iff there exist a polynomial \(p\) and a deterministic polynomial-time verifier \(V\) such that

\[ x \in L \iff \exists y \in \{0,1\}^{\le p(|x|)} \text{ with } V(x,y)=1. \]

This is exactly the certificate definition from the previous tab.

Detailed Reduction: \(\operatorname{3SAT} \le_p \operatorname{INDSET}\)

The Two Problems

\[ \operatorname{3SAT} = \{\varphi : \varphi \text{ is a satisfiable CNF formula with 3 literals per clause}\} \] \[ \operatorname{INDSET} = \{\langle G,k \rangle : G \text{ has an independent set of size at least } k\}. \]

We reduce a formula \(\varphi\) with clauses \(C_1,\dots,C_m\) to a graph \(G_{\varphi}\) and choose \(k=m\).

Construction of \(G_{\varphi}\)

Suppose each clause has the form

\[ C_i = (\ell_{i1} \vee \ell_{i2} \vee \ell_{i3}). \]
  1. Create one vertex \(v_{ij}\) for each literal occurrence \(\ell_{ij}\). So the graph has \(3m\) vertices.
  2. Within each clause \(C_i\), connect the three vertices \(v_{i1},v_{i2},v_{i3}\) to form a triangle.
  3. If two vertices correspond to contradictory literals, such as \(x\) and \(\neg x\), connect them by an edge even if they belong to different clauses.
  4. Set \(k=m\).
\[ R(\varphi)=\langle G_{\varphi},m\rangle . \]

Why the Reduction Works

If \(\varphi\) is satisfiable If \(G_{\varphi}\) has an independent set of size \(m\)
Choose one true literal from each clause. This gives \(m\) vertices, one per triangle. Two chosen vertices cannot be adjacent:
  • they are from different clauses, so no triangle edge applies;
  • they cannot be contradictory, because a satisfying assignment never makes both \(x\) and \(\neg x\) true.
Hence these \(m\) vertices form an independent set.
Any independent set can contain at most one vertex from each clause triangle. Since there are \(m\) clauses and the set has size \(m\), it must contain exactly one vertex from each clause. Because no two chosen vertices are joined by contradiction edges, the chosen literals are mutually consistent. Assign them all to be true, extend the remaining variables arbitrarily, and every clause is satisfied.

Polynomial-Time Bound

The graph has \(3m\) vertices. Adding all clause edges and contradiction edges can be done by checking pairs of literal occurrences, so the reduction runs in polynomial time in \(|\varphi|\).

Therefore \(\operatorname{3SAT} \le_p \operatorname{INDSET}\).

Worked Example

Take

\[ \varphi = (x_1 \vee \neg x_2 \vee x_3) \wedge (\neg x_1 \vee x_2 \vee x_4) \wedge (\neg x_3 \vee \neg x_4 \vee x_2). \]

Then \(G_{\varphi}\) has three triangles:

  • \(T_1 = \{x_1,\neg x_2,x_3\}\)
  • \(T_2 = \{\neg x_1,x_2,x_4\}\)
  • \(T_3 = \{\neg x_3,\neg x_4,x_2\}\)
C1 (x1 v ~x2 v x3) C2 (~x1 v x2 v x4) C3 (~x3 v ~x4 v x2) T1 T2 T3 x1 ~x2 x3 ~x1 x2 x4 ~x3 ~x4 x2
Each clause becomes a triangle, and every pair of contradictory literals gets a dashed red edge. The green nodes show one independent set of size \(3\): \(x_1\), \(x_2\), and \(\neg x_4\).
Clause edges inside a triangle
Contradiction edges
Chosen independent-set vertices

Add contradiction edges between \(x_1\) and \(\neg x_1\), between \(\neg x_2\) and each occurrence of \(x_2\), between \(x_3\) and \(\neg x_3\), and between \(x_4\) and \(\neg x_4\).

The assignment \(x_1=1, x_2=1, x_3=1, x_4=0\) satisfies \(\varphi\). Picking vertices \(x_1 \in T_1\), \(x_2 \in T_2\), and \(\neg x_4 \in T_3\) gives an independent set of size \(3\).

🏠