Decision Problem: a set of elements of some type
S = \{(r, s): regexp * string | s \in L(r) \} (where (r, s) : t)
Decision procedure of S: function \code{f: t -> bool} (f decides S)
Decidable (recursive): if there exists a decision procedure for S
Example:
fun acc(r, s) = accept r s
(acc decides S)
The halting problem: HALT = \{(g, x) : (int -> int) * int | g(x) is valuable (ie. no loop) \} Theorem: HALT is undecidable Proof:
Suppose H is a decision procedure for HALT (H decides whether the input is in HALT)
fun loop x = loop x
fun diag (x: int): int = if H (diag, x) then loop 0 else 0
(Contradiction, because if H says diag do not loop, then it loop)
HALT0 = \{g : int -> int | g(0) is valuable \} Theorem: HALT0 is undecidable Proof:
Suppose Z: (int -> int) -> bool decides HALT0
(* Now we are creating an H from already working Z *)
fun H (g: int -> int, x : int) : bool = Z (fn _ => g x_)
(* Therefore, Z should not exist because H does not exist *)
Reduction: HALT <= HALT0 (if I can do HALT0, then at least I can do HALT), HALT is easier than HALT0 (If HALT0 is decidable, then HALT is decidable)
Semi-Decision procedure (recursively enumerable, r.e.): may not be total (can loop)
HALT0 is r.e. (as well as HALT)
fun Z (g: int -> int) : bool = (g 0; true)
Co-r.e.: if S is in r.e., then \not S is in co-r.e.
S : decision_problem
is in the Universal set U.
U = \text{Decidable} \cup \text{R.E.ButNotDecidable} \cup \text{CoR.E.ButNotDecidable}
Lemma 1: If set S is decidable, then set \lnot S is decidable. Where the symbol \lnot was used to represent set complement (co-). (if there exists a total function to tell whether s \in S and return true, then there exists a total function to tell whether s \in S and return false)
Lemma 2: If S \in \text{R.E.} \land S \in \text{co-R.E.}, then S is decidable Proof: to decide whether x is in S.
S: original set, that is in R.E.
\lnot S: complement of the set
f: a function semi-decides S
f': a function semi-decides \lnot S
then we can run two functions in parallel and give a definite answer
Are r.e. and co-r.e. really complement of each other? If so, there exists no element in r.e. \cap co-r.e. by definition. Lemma 2's assumption is false
Table of Content