feat: add reduction

This commit is contained in:
Kristofers Solo 2025-06-13 19:26:43 +03:00
parent bb63f218aa
commit eb904d5483
Signed by: kristoferssolo
GPG Key ID: 8687F2D3EEE6F0ED

View File

@ -12,6 +12,7 @@
#let TM = $T M$
#let rej = $q_"rej"$
#let acc = $q_"acc"$
#let halt = $H A L T I N G$
= Tjūringa Mašīnas
@ -202,7 +203,7 @@ $ F(1)=0, F(2)=-1, F(3)=1, F(4)=-2, ... $
Viens no veidiem, kā izveidot bijekciju pāra kopai, ir izmantot metodi, ko sauc
par Kantoro pārošanas funkciju.
Kantora pārošanas funkcija ir definēta sekojoši:
$f(k_1, k_2) := 1/2(k_1 + k_2)(k_1 + k_2 + 1) + k_2$, kur $k_1,k_2 in NN$
$f(k_1, k_2) := 1/2(k_1 + k_2)(k_1 + k_2 + 1) + k_2$, kur $k_1,k_2 in NN = {0, 1, 2, ...}$
#figure(
image("assets/img/cantors-pairing-function.png", width: 50%),
@ -231,3 +232,52 @@ attēlots uz $n$, izmantojot Kantora pārošanas funkcijas apgriezto funkciju.
Pielietojot apgriezto funkciju uz $n$, varam atgūt sākotnējo pāri $(k_1, k_2)$.
Tādējādi funkcija $f$ ir surjektīva.
= Redukcijas
Given a problem $halt 2(M, x, y) = 1$ where turing machine $M$ halts on at least
one of the inputs $x$ or $y$, prove and show that it can or can't be reduced to
$halt(halt <= halt 2)$.
To prove that the problem $halt 2(M, x, y)$ can be reduced to $halt$, we need to
show that we can construct a Turing machine that solves $halt 2$ using a
subroutine for solving $halt$.
Let's assume we have a Turing machine $H$ that solves the $halt$ problem.
We will construct a new Turing machine $H 2$ that solves the $halt 2$ problem
using H as a subroutine.
The Turing machine $H 2$ works as follows:
+ Given inputs $M$, $x$, and $y$.
+ Run $H$ on the input $(M, x)$.
+ If $H$ accepts $(M, x)$, halt and accept.
+ If $H$ rejects $(M, x)$, run $H$ on the input $(M, y)$.
+ If $H$ accepts $(M, y)$, halt and accept.
+ If $H$ rejects $(M, y)$, halt and reject.
By constructing $H 2$ in this way, we are simulating the behavior of $H$ on
both inputs $x$ and $y$.
If $H$ accepts either $(M, x)$ or $(M, y)$, $H 2$ will also accept and halt.
If $H$ rejects both $(M, x)$ and $(M, y)$, $H 2$ will also reject and halt.
Now, let's analyze the reduction:
- If $halt 2(M, x, y) = 1$, it means that Turing machine $M$ halts on at least
one of the inputs $x$ or $y$.
In this case, $H 2$ will also halt and accept, because it successfully
simulates $H$ on both inputs and accepts if $H$ accepts either of them.
Thus, $halt 2$ is reduced to $halt$.
- If $halt 2(M, x, y) = 0$, it means that Turing machine $M$ does not halt on
both inputs $x$ and $y$.
In this case, $H 2$ will also not halt and will reject, because it simulates
$H$ on both inputs and rejects if $H$ rejects both of them.
Thus, $halt 2$ is reduced to $halt$.
Therefore, we have shown that the problem $halt 2$ can be reduced to $halt$ by
constructing a Turing machine $H 2$ that uses $H$ as a subroutine.
This reduction demonstrates that $halt 2$ is computationally no harder than
$halt$, implying that $halt 2$ is at least as undecidable as $halt$.
= Daļēja atrisināmība
= Algoritmiskā sanumurējamība
= TM darbības laiks
= NP (neatrisināmas problēmas)
= Sarežģītības klases