{ "cells": [ { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "view-in-github" }, "source": [ "\"Open" ] }, { "cell_type": "markdown", "metadata": { "id": "afi51Ew09l9E" }, "source": [ "# Reduction of one problem to another" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "We are very interested in *relations between problems*. Here is the main definition that we will use.\n", " \n", "```{admonition} Definition\n", "\n", "Let $S$ and $T$ be well-defined sets of mathematical objects, and let $A\\subseteq S$ and $B\\subseteq T$ be problems. We do not assume that $S$ or $T$ is decidable. We write \n", "\n", "$$\n", "A \\leq B\n", "$$\n", "\n", "and say that $B$ is *at least as hard as $A$*, or that *$A$ is reducible to $B$* if there is an intuitively computable $t: S\\to T$ such that for all $x$,\n", "\n", "\n", "$$\n", "\\mbox{$x\\in A \\quadiff t(x) \\in B$}\n", "$$\n", "\n", "We sometimes call $t$ the *translation* map.\n", "\n", "\n", "```\n", "\n", "We are going to see a few examples of this soon. But first, here is the result that shows why we are interested in this definition in the first place.\n", " \n", "\n", "```{prf:proposition}\n", ":label: proposition_intuitive_decidability\n", "\n", "If $A\\leq B$ and $B$ is intuitively decidable, \n", "then $A$ is also intuitively decidable.\n", " \n", "If $A\\leq B$ and $A$ is intuitively undecidable, \n", "then $B$ is also intuitively undecidable.\n", "```\n", "\n", "\n", "```{prf:proof}\n", "\n", "For the first part: given $x$, to see if $x\\in A$ or not, \n", "apply the intuitively computable translation $t$, and then see if $t(x)\\in B$ or not. The answer must be the same!\n", "\n", " The second assertion follows from the first.\n", "```\n", "\n", "Incidentally, we read $A\\leq B$ as *$B$ is at least as hard as $A$*. However, there are situations where $A\\leq B$ according to our definition but where most people would say that $A$ is much harder to decide.\n", "\n", "\n", "```{exercise}\n", "Let $S$ and $T$ be the set of natural numbers, let $A$ be the set of prime numbers, and let $B = \\set{1,2,3}$. Show that according to our definitions $A\\leq B$. However, $A$ and $B$ are both intuitively decidable, and most people who know about such things would agree that $A$ is harder than $B$.\n", "\n", "The moral of the story is that our English rendering of $A\\leq B$ is only good for comparisons of decidable vs. undecidable problems.\n", "\n", "```\n", "\n", "\n", "\n", "\n", "## Example related to the PCP\n", "\n", "Recall that [the Post Correspondence Problem (PCP)](content:firstPCP) is the set of finite domino sets which have a post word. We introduce a variant of this problem, the *Modified PCP (MPCP)*: A *pointed domino set* is one that comes with a distinguished domino $d^*$ called the *start domino*. Technically, it is a pair $(\\mathcal{D},d^*)$, where $d^*\\in \\DD$. The MPCP is the set of finite pointed domino sets which have a Post sequence starting with $d^*$. \n", "\n", "```{prf:proposition} \n", "\n", "$MPCP \\leq PCP$. That is, there is an intuitively computable translation function $t: MPCP \\to PCP$ such that each pointed domino system $(\\mathcal{D},d^*)$, has a Post sequence iff its translation $t(\\mathcal{D},d^*)$ is an ordinary domino system which has a Post sequence.\n", "```\n", "\n", "\n", "Given an input to the MPCP, say $(\\DD,d^*)$, take two new symbols, say $\\blacksquare$ and \n", "$\\$ $, and then define $t(\\DD,d^*)$ in the following way:\n", "\n", "1. Add $\\blacksquare$ after all letters in all top words in the original domino set. \n", "\n", "2. Add $\\blacksquare$ before all letters in all bottom words in the original domino set. \n", "\n", "3. Add a new copy of the start domino, $d^*$, but modify it by adding $\\blacksquare$ after all letters in the top and before all letters in the bottom, and also add $\\blacksquare$ before the first letter of the top word. This one is called the *first special domino*.\n", "\n", "4. Add a new domino with top word $\\$ $ and bottom word $\\blacksquare$ $\\$ $. This last one is called the *second special domino*.\n", "\n", "---\n", "\n", "Note that we have a *intuitively computable function* $f$ from pointed tile sets to tile sets. That is, adding the symbols $\\$ $ and $\\blacksquare$ like this is intuitively computable. In particular, we don't need to know whether the original pointed domino set has a Post word or not in order to add the new symbols.\n", " \n", "\n", "```{admonition} Example\n", ":class: tip\n", "Here is a pointed domino set $(\\mathcal{D},d^*)$:\n", "\n", "\n", "\n", "The green domino is $d^*$. Here is the domino set $t(\\mathcal{D},d^*)$.\n", "\n", "\n", "\n", "The two special dominoes are shown at the end.\n", "```\n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", "```{admonition} Claim\n", "\n", " If $\\DD$ has any Post sequence starting with $d^*$, then $t(\\DD)$ has a Post sequence.\n", " \n", " And if $t(\\DD)$ has a Post sequence, then $\\DD$ has one that starts with $d^*$.\n", "```\n", " \n", " ```{prf:proof}\n", "The first assertion is easier. If we have a Post sequence in the original $(\\mathcal{D},d^*)$ with word $w$, then\n", "we trade in these dominoes for the evident corresponding dominoes in $t(\\mathcal{D},d^*)$, except that we begin the first special domino. We also add the second special domino at the end. Then it is easy to see that we have a Post sequence in $t(\\mathcal{D},d^*)$: the word across the top and bottom is the same word $w$ as above, except that we add $\\blacksquare$ before all the letters, and also at the end, and follow it with $\\$ $.\n", "\n", "In the more challenging direction, suppose that $t(\\DD, d^*)$ has a Post sequence, then $\\DD$ has one that starts with $d^*$. The main fact here is that a Post sequence for $t(\\DD)$ must start with the first special domino, since this is the only one whose top and bottom words start with the same symbol. It also has to end with the second special domino.\n", "\n", "\n", "``\n", "\n", "\n", "\n", "\n", "\n", "```{exercise}\n", "Show that $PCP \\leq MPCP$. Here is what this means, spelled out. You need to define an intuitively computable function $t$ from domino sets to pointed domino sets with the property that for all domino sets $\\DD$:\n", "\n", "1. If $\\DD$ has a Post sequence, then $t(\\DD)$ has one also, and one that starts with the start domino of $t(\\DD)$.\n", "\n", "2. Conversely, if $t(\\DD)$ has a Post sequence that starts with its start domino, then $\\DD$ has a Post sequence.\n", "```" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Why does $t$ have to be intuitively computable?\n", "\n", "Similarly, we can now say why our definition of $A \\leq B$ requires the translation function $t: S\\to T$ to be intuitively computable. If we took away this restriction, {prf:ref}`proposition_intuitive_decidability` would be false in general: consider the case when $A$ is undecidable and $B$ is decidable, and $t$ is a constant function." ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Examples related to integer roots of polynomials\n", "\n", "We turn to some examples related to *polynomials* and *systems* of them. In this discussion, we are looking at polynomials in many variables with integer coefficients. Consider the following sets:\n", "\n", "$$\n", "\\begin{array}{lcl}\n", "A & = & \\mbox{all polynomials which have an integer root}\\\\\n", "A_{\\leq 4} & = & \\mbox{all polynomials of degree $\\leq 4$ which have an integer root}\\\\\n", "B & = & \\mbox{all systems of polynomials which have a common integer root}\\\\\n", "\\end{array}\n", "$$" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "As an example of an element of $B$, consider \n", "\n", "$$\n", "\\begin{array}{l}\n", "2x^2 - y \\\\\n", "x^{449} -8y + wz \\\\\n", "xyzw - 15\n", "\\end{array}\n", "$$\n", "\n", "One common root is $x = 1$, $y = 2$, $z = 3$, $w = 5$. There might be others, but it only takes one common root to put a system into $B$.\n" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "```{prf:proposition} \n", "$A \\leq B$.\n", "```\n", "\n", "Every polynomial is a system with just one polynomial. So we may take the translation map $t$ taking polynomials into systems to be the *inclusion* map." ] }, { "cell_type": "markdown", "metadata": {}, "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "```{prf:proposition} \n", "$B \\leq A$.\n", "```\n", "\n", "\n", "We need to exhibit an intuitively computable translation $t$ from systems of polynomials to single polynomials with the property that \n", "\n", "$$\\begin{array}{cl}\n", " & \\mbox{$(p_1,\\ldots, p_k)$ has a common integer root}\\\\ \n", "\\quadiff & \\mbox{$t((p_1,\\ldots, p_k))$ has an integer root}\\\\\n", "\\end{array}\n", "$$\n", "\n", "\n", "\n", "\n", "Let $t$ be defined by\n", "\n", "$$\n", "\\begin{array}{lcl}\n", "t((p_1,\\ldots, p_k)) & = & \\sum_{i=1}^k {p}_i^2\n", "\\end{array}\n", "$$\n", "\n", "To see that this works, fix $p_1,\\ldots, p_k$ and let $\\overline{x} = x_1, \\ldots, x_n$ be all the variables that occur in these polynomials. Then\n", "\n", "$$\n", "\\begin{array}{ll}\n", "& \\mbox{$(p_1,\\ldots, p_k)$ has a common integer root} \\\\\n", "\\mbox{iff} & (\\exists x_1, \\ldots, x_n\\in\\mathbb{Z}) \\mbox{ for $i = 1, \\ldots, k$}, p_i(\\overline{x} ) = 0 \\\\\n", "\\mbox{iff} & (\\exists x_1, \\ldots, x_n\\in\\mathbb{Z}) \\mbox{ for $i = 1, \\ldots, k$}, p_i^{2}(\\overline{x} ) = 0 \\\\\n", "\\mbox{iff} & (\\exists x_1, \\ldots, x_n\\in\\mathbb{Z}) {\\sum_{i=1}^k} p_i^{2}(\\overline{x} ) \\ = 0 \\\\\n", "\\mbox{iff} & (\\exists x_1, \\ldots, x_n\\in\\mathbb{Z}) t(p_1,\\ldots, p_k) (\\overline{x}) = 0 \\\\\n", "\\mbox{iff} & t((p_1,\\ldots, p_k)) \\mbox{ has an integer root} \\\\\n", "\\end{array}\n", "$$\n", "\n", "This calculation shows that $A\\leq B$ via $t$.\n" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "```{lemma} $A\\leq A_4$\n", "```\n", "\n", "This is the most difficult of the verifications. We present an example and invite you to work out the full details as an exercise.\n", "\n", "Consider \n", "\n", "$$\n", "\\begin{array}{lcl}\n", "4x^3 y^4 + 3y^3 - 13 z^5 & = & 0\n", "\\end{array}\n", "$$\n", "\n", "Let's introduce seven new variables: $a$, $b$, $c$, $d$, $e$, $f$, and $g$. Then we make the linear system\n", "\n", "\n", "$$\n", "\\begin{array}{c}\n", "\\begin{array}{lcl}\n", "a & = & x^2 \\\\\n", "b & = &ax \\\\\n", "\\\\\n", "\\end{array}\\qquad\n", "\\begin{array}{lcl}\n", "c & = & y^2 \\\\\n", "d & = &c^2 \\\\\n", "e & = & c y \\\\\n", "\\end{array}\\qquad\n", "\\begin{array}{lcl}\n", "f & = & z^2 \\\\\n", "g & = & f^2 \\\\\n", "h & = & gz \\\\\n", "\\end{array} \\\\ \\\\\n", "\\begin{array}{lcl}\n", "4 bd + 3e - 13 h & = & 0 \\\\\n", "\\end{array}\n", "\\end{array}\n", "$$\n", "\n", "This shows that $A \\leq B_2$, where $E_2$ is the set of linear systems with roots. Then we compose with the function which we already saw which shows that $B\\leq A$. This turns the system above into a single equation of degree $4$:\n", "\n", "$$\n", "\\begin{array}{lcl}\n", "(a - x^2)^2 + (b - ax)^2 + (c-y^2)^2 + (d - c^2)^2 + (e - cy)^2 & & \\\\\n", " + (f- z^2)^2 + (g - f^2)^2\n", "+ (h-gz)^2 + (4 bd + 3e - 13 h )^2 & = & 0\n", "\\end{array}\n", "$$\n", "\n", "This transformation preserves satisfiability in $\\mathbb{Z}$ and shows that $A \\leq A_{\\leq 4}$. \n", "\n", "The method of introducing variables to make something simpler is sometimes called *Skolem's trick*." ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Exercises\n", "\n", "Here are some exercises to help you get catch on. Some of these will be quite tricky, and the trickiness is due to two things: first, the definition of the translation function $t$ often requires ingenuity and cleverness. Your first attempt might not be correct. That is, you might not be able to prove the required 'if and only if' statement; this itself might require a tricky argument. \n", "\n", "```{admonition} Observation\n", "\n", "In showing that $t: S\\to T$ works, the hard direction is often the one that \"goes backwards\", saying: \"if $t(x)\\in B$, then $x\\in A$.\"\n", "```" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Tiling" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "vscode": { "languageId": "plaintext" } }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "vscode": { "languageId": "plaintext" } }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "vscode": { "languageId": "plaintext" } }, "outputs": [], "source": [] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "```{exercise}\n", "The *one-row* tiling problem* is the problem of deciding whether a tile set can tile the \"positive $x$-axis\" part of the quadrant (the bottom infinite row). Show that this problem is decidable by reducing to the problem of whether a finite graph has a cycle.\n", "```" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "vscode": { "languageId": "plaintext" } }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "vscode": { "languageId": "plaintext" } }, "outputs": [], "source": [] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "```{exercise}\n", "The *two-row tiling problem* is the same problem, but we want to tile the bottom-most two infinite rows. Is this problem decidable or undecidable?\n", "\n", "What about the two-column tiling problem?\n", "```" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Roots of polynomials" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "```{exercise}\n", "Let $X$ be the set of multi-variable polynomials $p(x_1, \\ldots, x_n)$ with integer coefficients which have a root consisting of positive integers, and let $Y$ be the polynomials with integer coefficients which have a root consisting of negative integers. Show that $X \\leq Y$ and $Y\\leq X$.\n", "```" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "```{exercise}\n", "We presented an example of how $A \\leq A_4$ could work, but we didn't really define a function that does this. Your task is to do this.\n", "```" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## PCP" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "```{exercise}\n", "Assuming that $PCP$ is undecidable, show that it is undecidable even if the alphabet has only two letters.\n", "```" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Matrix mortality" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "```{exercise}\n", "Let $P_3$ be the matrix mortality problem for $3\\times 3$ matrices. Let $P_2$ and $P_4$ be defined similarly, for the $2\\times 2$ and $4\\times 4$ matrices. Show that $P_2 \\leq P_3 \\leq P_4$. This is a straightforward algebraic argument.\n", "\n", "Later we will see that $P_4 \\leq P_3$, but the argument will not be not as easy.\n", "```" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Here is an exercise pertaining to the matrix mortality problem. Although it looks long, we are presenting it as result in outlined form. All you have to do is to fill in the steps. This result will be used in [our later work on the undecidability of matrix mortality](content:matrixMortalityUndecidable).\n" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "```{exercise}\n", ":label: matrix-mortality-exercise\n", "\n", "Let $M_{1,1}$ be the set of finite sets of $3\\times 3$ integer matrices which have some finite product which equals $0$. Let $M_{0}$ be the set of finite sets of $3\\times 3$ integer matrices which have some finite product with $0$ in the upper-left corner. In this exercise, we show that $M_{1,1} \\leq M_0$.\n", "\n", "\n", "Let $A$ be the $3\\times 3$ matrix\n", "\n", "$$\n", "\\left[ \n", "\\begin{array}{lll} 1 & 0 & 0 \\\\ 0 & 0 & 0 \\\\ 0 & 0 & 0 \\end{array}\n", "\\right]\n", "$$\n", "\n", "There are two key features of $A$:\n", "\n", "$$\n", "\\begin{array}{rcl}\n", "\\left[ \\begin{array}{lll} 1 & 0 & 0 \\\\ 0 & 0 & 0 \\\\ 0 & 0 & 0 \\end{array} \\right]\n", "\\left[ \\begin{array}{lll} a & b & c \\\\ d & e & f \\\\ g & h & i \\end{array}\\right]\n", "%\\left[ \\begin{array}{lll} 1 & 0 & 0 \\\\ 0 & 0 & 0 \\\\ 0 & 0 & 0 \\end{array} \\right]\n", "& = & \n", "\\left[\\begin{array}{lll} a & b & c \\\\ 0 & 0 & 0 \\\\ 0 & 0 & 0 \\end{array}\\right]\n", "\\\\ \\ \\\\\n", "\\left[ \\begin{array}{lll} 1 & 0 & 0 \\\\ 0 & 0 & 0 \\\\ 0 & 0 & 0 \\end{array} \\right]\n", "\\left[ \\begin{array}{lll} a & b & c \\\\ d & e & f \\\\ g & h & i \\end{array}\\right]\n", "\\left[ \\begin{array}{lll} 1 & 0 & 0 \\\\ 0 & 0 & 0 \\\\ 0 & 0 & 0 \\end{array} \\right]\n", "& = & \n", "\\left[\\begin{array}{lll} a & 0 & 0 \\\\ 0 & 0 & 0 \\\\ 0 & 0 & 0 \\end{array}\\right]\n", "\\end{array}\n", "$$\n", "\n", "Let $Q$ be the set of finite sets of $3\\times 3$ integer matrices.\n", "\n", "Here is a computable function $t: Q \\to Q$:\n", "\n", "$$\n", "t(S) = S\\cup \\{A\\}\n", "$$\n", "\n", "Our goal is to prove the following fact:\n", "\n", "\n", "\n", "\n", "Let $S$ be a finite set of $3\\times 3$ matrices.\n", "\n", "1. Show that if $S \\in M_{1,1}$, then $t(S) \\in M_0$. [This is easy given the facts above.]\n", "\n", "2. In the other direction, suppose that $t(S) \\in M_0$. Take a finite sequence from $t(S)$ whose product has a zero in the upper-left corner. Let us assume that the sequence both begins and ends with $A$. Write the product as\n", "\n", "$$\n", "A B^1_1 B^1_2 \\cdots B^1_{n_1} A B^2_1 B^2_2 \\cdots B^2_{n_1}\\cdots A B^k_1 B^k_2 \\cdots B^k_{n_k} A\n", "$$\n", "\n", "where the $B^i_j$ matrices belong to $S$.\n", "\n", "Divide the product above into $k+1$ groups:\n", "\n", "$$\n", "(A B^1_1 B^1_2 \\cdots B^1_{n_1}) \\quad (A B^2_1 B^2_2 \\cdots B^2_{n_1}) \\quad\\cdots\\quad\n", " (A B^k_1 B^k_2 \\cdots B^k_{n_k}) \n", "\\quad A\n", "$$\n", "\n", "And then multiply it group-by-group:\n", "\n", "$$\n", "\\left[\\begin{array}{lll} a^1 & b^1 & c^1 \\\\ 0 & 0 & 0 \\\\ 0 & 0 & 0 \\end{array}\\right]\n", "\\left[\\begin{array}{lll} a^2 & b^2 & c^2 \\\\ 0 & 0 & 0 \\\\ 0 & 0 & 0 \\end{array}\\right]\n", "\\cdots\n", "\\left[\\begin{array}{lll} a^k & b^k & c^k \\\\ 0 & 0 & 0 \\\\ 0 & 0 & 0 \\end{array}\\right]\n", "\\left[\\begin{array}{lll} 1 & 0 & 0 \\\\ 0 & 0 & 0 \\\\ 0 & 0 & 0 \\end{array}\\right]\n", "$$\n", "\n", "Figure out what each $a^i$ represents in terms of the groups of matrices above. \n", "\n", "Evaluate the upper-left corner of the product, and check that one of the groups $ B^i_1 B^i_2 \\cdots B^i_{n_i}$ must multiply to give a matrix with $0$ in the upper-left corner. \n", "```" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "```{admonition} Credits\n", ":class: warning\n", "\n", "\n", "The source for the reduction involving $3\\times 3$ matrices is\n", "\n", "Vesa Halava and Tero Harju, (2001). Mortality in Matrix Semigroups. The American Mathematical Monthly, 108(7), 649–653." ] } ], "metadata": { "colab": { "authorship_tag": "ABX9TyP205rqn48v0Nn/uuhLo23v", "include_colab_link": true, "provenance": [] }, "kernelspec": { "display_name": "Python 3", "name": "python3" }, "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 0 }