Title: Module 4: Formal Definition of Solvability
1Module 4 Formal Definition of Solvability
- Analysis of decision problems
- Two types of inputsyes inputs and no inputs
- Language recognition problem
- Analysis of programs which solve decision
problems - Four types of inputs yes, no, crash, loop inputs
- Solving and not solving decision problems
- Classifying Decision Problems
- Formal definition of solvable and unsolvable
decision problems
2Analyzing Decision Problems
- Can be defined by two sets
3Decision Problems and Sets
- Decision problems consist of 3 sets
- The set of legal input instances (or universe of
input instances) - The set of yes input instances
- The set of no input instances
4Redundancy
- Only two of these sets are needed the third is
redundant - Given
- The set of legal input instances (or universe of
input instances) - This is given by the description of a typical
input instance - The set of yes input instances
- This is given by the yes/no question
- We can compute
- The set of no input instances
5Typical Input Universes
- S The set of all finite length strings over
finite alphabet S - Examples
- a /\, a, aa, aaa, aaaa, aaaaa,
- a,b /\, a, b, aa, ab, ba, bb, aaa, aab, aba,
abb, - 0,1 /\, 0, 1, 00, 01, 10, 11, 000, 001, 010,
011, - The set of all integers
- If the input universe is understood, a decision
problem can be specified by just giving the set
of yes input instances
6Language Recognition Problem
- Input Universe
- S for some finite alphabet S
- Yes input instances
- Some set L subset of S
- No input instances
- S - L
- When S is understood, a language recognition
problem can be specified by just stating what L
is.
7Language Recognition Problem
- Traditional Formulation
- Input
- A string x over some finite alphabet S
- Task
- Is x in some language L subset of S?
- 3 set formulation
- Input Universe
- S for a finite alphabet S
- Yes input instances
- Some set L subset of S
- No input instances
- S - L
- When S is understood, a language recognition
problem can be specified by just stating what L
is.
8Equivalence of Decision Problems and Languages
- All decision problems can be formulated as
language recognition problems - Simply develop an encoding scheme for
representing all inputs of the decision problem
as strings over some fixed alphabet S - The corresponding language is just the set of
strings encoding yes input instances - In what follows, we will often use decision
problems and languages interchangeably
9Visualization
10Analyzing Programs which Solve Decision Problems
11Program Declaration
- Suppose a program P is designed to solve some
decision problem P. What does Ps declaration
look like? - What should P return on a yes input instance?
- What should P return on a no input instance?
12Program Declaration II
- Suppose a program P is designed to solve a
language recognition problem P. What does Ps
declaration look like? - bool main(string x)
- We will assume that the string declaration is
correctly defined for the input alphabet S - If S a,b, then string will define variables
consisting of only as and bs - If S a, b, , z, A, , Z, then string will
define variables consisting of any string of
alphabet characters
13Programs and Inputs
- Notation
- P denotes a program
- x denotes an input for program P
- 4 possible outcomes of running P on x
- P halts and says yes P accepts input x
- P halts and says no P rejects input x
- P halts without saying yes or no P crashes on
input x - We typically ignore this case as it can be
combined with rejects - P never halts P infinite loops on input x
14Programs and the Set of Legal Inputs
- Based on the 4 possible outcomes of running P on
x, P partitions the set of legal inputs into 4
groups - Y(P) The set of inputs P accepts
- When the problem is a language recognition
problem, Y(P) is often represented as L(P) - N(P) The set of inputs P rejects
- C(P) The set of inputs P crashes on
- I(P) The set of inputs P infinite loops on
- Because L(P) is often used in place of Y(P) as
described above, we use notation I(P) to
represent this set
15Illustration
All Inputs
I(P)
16Analyzing Programs and Decision Problems
- Distinguish the two carefully
17Program solving a decision problem
- Formal Definition
- A program P solves decision problem P if and only
if - The set of legal inputs for P is identical to the
set of input instances of P - Y(P) is the same as the set of yes input
instances for P - N(P) is the same as the set of no input instances
for P - Otherwise, program P does not solve problem P
- Note C(P) and I(P) must be empty in order for P
to solve problem P
18Solvable Problem
- A decision problem P is solvable if and only if
there exists some C program P which solves P - When the decision problem is a language
recognition problem for language L, we often say
that L is solvable or L is decidable - A decision problem P is unsolvable if and only if
all C programs P do not solve P - Similar comment as above
19Illustration of Solvability
Inputs of Program P
Y(P)
N(P)
20Program half-solving a problem
- Formal Definition
- A program P half-solves problem P if and only if
- The set of legal inputs for P is identical to the
set of input instances of P - Y(P) is the same as the set of yes input
instances for P - N(P) union C(P) union I(P) is the same as the set
of no input instances for P - Otherwise, program P does not half-solve problem
P - Note C(P) and I(P) need not be empty
21Half-solvable Problem
- A decision problem P is half-solvable if and only
if there exists some C program P which
half-solves P - When the decision problem is a language
recognition problem for language L, we often say
that L is half-solvable - A decision problem P is not half-solvable if and
only if all C programs P do not half-solve P
22Illustration of Half-Solvability
Inputs of Program P
Y(P)
N(P)
23Hierarchy of Decision Problems
All decision problems
The set of half-solvable decision problems is a
proper subset of the set of all decision
problems The set of solvable decision problems is
a proper subset of the set of half-solvable
decision problems.
24Why study half-solvable problems?
- A correct program must halt on all inputs
- Why then do we define and study half-solvable
problems? - One Answer the set of half-solvable problems is
the natural class of problems associated with
general computational models like C - Every program half-solves some decision problem
- Some programs do not solve any decision problem
- In particular, programs which do not halt do not
solve their corresponding decision problems
25Key Concepts
- Four possible outcomes of running a program on an
input - The four subsets every program divides its set of
legal inputs into - Formal definition of
- a program solving (half-solving) a decision
problem - a problem being solvable (half-solvable)
- Be precise with the above two statements!