Você está na página 1de 4

Decidability - Lesson of 18th March

Decision problems
They answer to question like 'Is a graph cyclic?’, etc. So the answer of a decision problem could be yes or no.

Research problems
They answer to real problems, like ‘solve an equation’, ‘find a path for a graph’, etc.

Formalization
A necessary step to solve a decidability problem is formalize our problem.
For example, we could think about formalize an arithmetic expression as a problem. The expression has to be
defined in a formal way and encoded as a language.

An arithmetic expression (AE) could be defined as follow:


AE := NUM | AE + AE | AE * AE | etc

φ is an arithmetic expression
<φ> is a suitable encoding (one of the possible encodings)

For example, a good encoding could be a binary encoding over a ternary alphabet.

Symbol Encoding

0 000

1 001

+ 010

- 011

* 100

÷ 101

% 110

Example

This is our expression:


φ=3+2

So, in binary it should be encoded as:


<φ> = 11 + 10

And through our encoding we can write it as:


<φ> = 001 001 010 001 000

What is the language asssociated to this kind of equation?


L = {<φ> # <n> | φ is an A.E. over Q and {+, -, *, ÷, %} ∧
n∈Q∧
φ=n}
Notes:

1. we use Q because we use also the division (so we need rational numbers). Otherwise we can use Z.
2. φ = n means that the value of the equation has to be correct.

How to encode rational numbers?


We can encode rational numbers (Q) through a triple
(s, n, d), where s is the symbol
n is the numerator (binary encoding)
d is the denominator (binary encoding)

And using a rich alphabet

Γ = {+, 1, 0, −, ∗, ÷, %, ), (, #}

Example

3
The number 3 can be seen as + 1 , so it can be encoded as (+, 11, 1).
2
The number 2 can be seen as + 1 , so it can be encoded as (+, 10, 1).
5
The number 5 can be seen as + 1 , so it can be encoded as (+, 101, 1).

So..
(+, 11, 1) + (+, 10, 1) # (+, 101, 1) ∈ L
Now it belongs to L !

L captures all the strings that are good-encoded, and the expression represented is equal to the number after the
#.

Why this should help us?


This encoding help us classifying a problem and understanding if a certain problem can be solved through a
machine.
(?) • Check for every enumeration of the nunmbers if the strings belongs to the language (so if it’s satisfied).
The membership problem

Given a string w ∈ ϵ , decide wether w ∈ L.
If the language L is simple we could use a final state machine. Otherwise, when we meet a difficult problem, a
FSM could not be enough.

Example

+
L = L(a b ) ∈ REG
We can define a procedure to check if we can reach a final state:

1 boolean solveL (string w) {


2 set Ml = <ε, K, S0, ς, F> //or any other machine for L
3 parse w w.r.t. Ml
4
5 if you reach a state in F
6 return true
7 else
8 return false
9 }

and we can use this to compute our result solving an arithmetic expression

1 rational computeResult (AE p) {


2 for each p ∈ ℕ {
3 n := int2frac(p)
4
5 if (solveL (<p> # <n>) == true)
6 return n;
7 }
8 }

But…we don’t have always a solution (for example in a disequation)!

For example x 2 + 2a + 1 < 0 will loop forever.

Sometime we could have a bound and our procedure will not loop infinitely, for example in the case of finding a
prime number (we iterate from 1 to the sqrt of n).

Every research problem can be solved if we have a language associated to the problem and a
solution of the form

L = {< in > # < out > | relation}, where 'relation' is a relation between the input and the output.

We don’t use this brute-force enumeration in real problems, but we know that if there’s a decisional version
of a problem, there’s an algorithm that in a finite time will solve the research version of the
problem.

Turing machine
There’s some differences between a Final state machine and a Touring machine:

FSM =< ϵ, K, S 0 , δ, F >


TM =< Γ, K, S 0 , δ >
δ : Γ × K → Γ × K × {←−, −→}

Notes and differences with the FSM:

we can change the content of the tape


we can move right or left on the tape
there’s no final state: we have two special state YES (Y) and NO (N)

+
L (ab )
Example of FSM

Example of TM

We can imagine a Turing machine as a tape

At the beginning the cursor is under the blank cell before the first input, then it moves.

Você também pode gostar