The complete proof, step by step#

This chapter contains a complete proof of Richardson’s theorem in the form given in the original paper (D. Richardson, Some undecidable problems involving elementary functions of a real variable, J. Symbolic Logic 33 (1968), 514–520), with the details filled in. Apart from standard theorems of analysis, the only facts taken without proof are the Davis–Putnam–Robinson theorem (and, in §11, Matiyasevich’s theorem) and — only in the integration part — Liouville’s theorem; see Preliminaries. We have illustrated every step of the construction with a computation in Python.

Print version: the whole chapter in a single PDF file (the same numbering, with the preliminaries, appendices and exercises).

import math
import random
import numpy as np
import sympy as sp
import mpmath as mp
import matplotlib.pyplot as plt

0. The theorem and the plan of the proof#

Recall (Definition 3.2 in Preliminaries): \(\mathcal A_1\) consists of the expressions in one variable built from rational numbers, \(\pi\), \(\log 2\), the variable \(x\), the operations \(+,-,\cdot\) and the functions \(\exp\) and \(\sin\) (with arbitrary nesting); \(\mathcal B_1\) is the same with the absolute value \(|\cdot|\).

Theorem R (Richardson, 1968 — concrete form)

  1. (A — the sign problem.) There is no algorithm that, for an arbitrary expression \(A\in\mathcal A_1\), decides whether \(A(x)<0\) for some \(x\in\mathbb R\).

  2. (B — the zero/identity problem.) There is no algorithm that, for an arbitrary expression \(B\in\mathcal B_1\), decides whether \(B(x)=0\) for all \(x\in\mathbb R\).

  3. (C — the integration problem.) There is no algorithm that, for an arbitrary \(J\in\mathcal B_1\), decides whether there exists \(H\in\mathcal B_1\), differentiable on \(\mathbb R\), with \(H'=J\).

In §9 we give Richardson’s original, more general formulation (arbitrary effectively given classes of functions, including partial ones). All three parts follow from a single construction: for a fixed undecidable set \(U\subseteq\mathbb N\) we algorithmically build, for each \(a\in\mathbb N\), an expression \(G_a\in\mathcal A_1\) satisfying a dichotomy with a gap

\[\begin{split} \begin{array}{ll} a\in U: & G_a\ge 0 \text{ everywhere and } \inf_{t} G_a(t)=0,\\[2pt] a\notin U: & G_a(t)>1 \text{ for every } t\in\mathbb R . \end{array} \end{split}\]

Step

Construction

Purpose

§1

polynomial \(P\) with powers \(2^{x_i}\)

encode \(a\in U\) as the existence of an integer zero

§2

local majorants \(k_i\)

control the change of \(P^2\) under rounding, everywhere in space

§3

weighted penalty \(f\), squared coordinates \(F\)

“\(f\le1\)” forces an integer zero — a gap between \(0\) and \(1\)

§4

curve \(\Gamma_n(t)\) from \(t\sin t\) and \(t\sin t^3\)

one variable, image dense in \(\mathbb R^n\)

§5

\(G_a(t)=F(a,\Gamma_n(t))\)

dichotomy in one variable

§6–8

\(G_a-1\), absolute value, cutoff

sign, identity and integration problems

The whole proof is a chain of equivalences, valid for every \(a\in\mathbb N\):

\[\begin{split} \begin{aligned} a\in U &\iff \exists\,\mathbf m\in\mathbb N^n\ \ P(a,\mathbf m)=0 &&\text{(§1)}\\ &\iff \exists\,\mathbf u\in\mathbb R^n\ \ F(a,\mathbf u)=0 &&\text{(§3)}\\ &\iff \exists\,t\in\mathbb R\ \ G_a(t)<1 &&\text{(§4–5)}\\ &\iff A_a=G_a-1 \text{ is negative somewhere} &&\text{(§6)}\\ &\iff B_a=|A_a|-A_a\not\equiv 0 &&\text{(§7)}\\ &\iff J_a=e^{x^2}S_a \text{ has no antiderivative in } \mathcal B_1 &&\text{(§8)}. \end{aligned} \end{split}\]

1. The arithmetic input#

Theorem 1.1 (Davis–Putnam–Robinson in the form used by Richardson; external)

There exist \(n\ge 2\) and a polynomial \(p(Y,X_1,\dots,X_n,Z_1,\dots,Z_n)\) with integer coefficients such that for

\[ P(y,\mathbf x)=p\bigl(y,\,x_1,\dots,x_n,\,2^{x_1},\dots,2^{x_n}\bigr) \]

the set

\[ U=\{\,a\in\mathbb N:\ \exists\,\mathbf m\in\mathbb N^n\ \ P(a,\mathbf m)=0\,\} \]

is undecidable.

This follows from Theorem 2.3 in Preliminaries: exponentiation with an arbitrary base, \(c=a^b\), can be expressed through powers of two (proof in Appendices: powers of two and the integral of e^{x^2}, Appendix A), and a system of equations \(E_1=\dots=E_r=0\) is equivalent to the single equation \(\sum E_j^2=0\). “Dummy” variables allow us to assume \(n\ge2\). The polynomial \(p\) is fixed once and for all; only \(a\) varies.

We use the polynomial \(P\) only through two properties:

  • (P1) \(P\in\mathcal A_{n+1}\), since \(2^{x}=\exp\bigl(x\log 2\bigr)\) — hence the constant \(\log 2\) in the language;

  • (P2) \(P(a,\mathbf m)\in\mathbb Z\) for \(a\in\mathbb N\), \(\mathbf m\in\mathbb N^n\); in particular

    \[ 0\le P(a,\mathbf m)^2<1\ \Longrightarrow\ P(a,\mathbf m)=0 . \]

Property (P2) is the only place where the discreteness of the integers comes into play: a small approximate zero becomes an exact zero.

Remark 1.2 (on the constant \(\pi\))

In his definition of “subelementary” expressions, Richardson (p. 515) does not list \(\pi\), although he immediately uses \(\sin(\pi x_i)\), and \(\pi\) appears in the hypotheses of the main theorem. We include \(\pi\) from the start. Thanks to this, \(\cos u=\sin(u+\pi/2)\) and derivatives remain in the language (Lemma 2.3).

Remark 1.3 (where \(\log 2\) and \(\exp\) come from)

The function \(\exp\) and the constant \(\log 2\) are needed only to write \(2^{x_i}\), that is, only because in 1968 the undecidability of exponential Diophantine equations was known. After Matiyasevich’s theorem (1970) one can take an ordinary polynomial, and then the whole construction does without \(\exp\) and \(\log 2\) — see §11.

2. Local majorants#

We are going to round real points to integer points, and we must control how \(P^2\) changes in the process. The points may lie arbitrarily far away, so a bound on the derivative on a single compact set is not enough: we need a formula — an expression that, at every point, bounds the function on a whole neighborhood of that point.

Lemma 2.1 (local majorants; Richardson, Lemma One)

For every expression \(A\in\mathcal A_d\) one can algorithmically construct \(M_A\in\mathcal A_d\) such that for every \(\mathbf z\in\mathbb R^d\)

\[ M_A(\mathbf z)>1 \qquad\text{and}\qquad |A(\mathbf z+\boldsymbol\eta)|<M_A(\mathbf z)\quad\text{for every } \boldsymbol\eta \text{ with } \lVert\boldsymbol\eta\rVert_\infty\le 1 . \]

Proof. We define \(M_A\) recursively on the expression tree of \(A\):

\[\begin{split} \begin{aligned} M_c &= c^2+2 \quad(c \text{ — a constant: } q\in\mathbb Q,\ \pi,\ \log 2), & M_{x_j} &= x_j^2+2,\\ M_{A\pm B} &= M_A+M_B, & M_{A\cdot B} &= M_A\,M_B,\\ M_{\exp A} &= \exp(M_A), & M_{\sin A} &= 2 . \end{aligned} \end{split}\]

Each right-hand side belongs to \(\mathcal A_d\), and the recursion terminates because the tree is finite. We verify both properties by induction on the structure of the expression; fix \(\mathbf z\) and \(\boldsymbol\eta\) with \(\lVert\boldsymbol\eta\rVert_\infty\le1\).

  • A constant \(c\). The value does not depend on the point, and \(c^2+2-|c|=\bigl(|c|-\tfrac12\bigr)^2+\tfrac74>0\), so \(|c|<c^2+2\); obviously \(c^2+2\ge2>1\).

  • A variable \(x_j\). \(|z_j+\eta_j|\le|z_j|+1<z_j^2+2\), since \(z_j^2+2-(|z_j|+1)=\bigl(|z_j|-\tfrac12\bigr)^2+\tfrac34>0\).

  • Sum and difference. By the triangle inequality, \(|A\pm B|\le|A|+|B|<M_A+M_B\) (values at \(\mathbf z+\boldsymbol\eta\), majorants at \(\mathbf z\)); the sum of the majorants exceeds \(2\).

  • Product. \(|AB|=|A|\,|B|<M_A M_B\), since both majorants are positive; a product of numbers \(>1\) is \(>1\).

  • Exponential. \(e^{A}\le e^{|A|}<e^{M_A}\) by monotonicity, and \(e^{M_A}>e>1\).

  • Sine. \(|\sin A|\le1<2\). \(\blacksquare\)

The construction never asks for the sign or the value of any expression. For the constants of the grammar (\(q\), \(\pi\), \(\log 2\)) the sign is known, so \(|c|+2\) would also work, as in the original. We take \(c^2+2\) because this rule also works without change for any variable-free subexpression treated as a constant (this is what the function majoranta below does), e.g., \(\pi-\tfrac{22}{7}\), whose sign the algorithm need not be able to decide. Here is an implementation on SymPy trees:

def majoranta(e):
    """Majoranta lokalna M_e (Lemat 2.1) zbudowana rekurencyjnie po drzewie wyrażenia SymPy."""
    if e.is_number:                       # stała: liczba wymierna, π, log 2, ...
        return e**2 + 2
    if e.is_Symbol:                       # zmienna
        return e**2 + 2
    if e.is_Add:
        return sp.Add(*[majoranta(a) for a in e.args])
    if e.is_Mul:                          # SymPy zapisuje A - B jako A + (-1)·B
        return sp.Mul(*[majoranta(a) for a in e.args])
    if e.is_Pow and e.exp.is_Integer and e.exp > 0:
        return majoranta(e.base) ** e.exp  # potęga = wielokrotny iloczyn
    if isinstance(e, sp.exp):
        return sp.exp(majoranta(e.args[0]))
    if isinstance(e, (sp.sin, sp.cos)):   # cos u = sin(u + π/2)
        return sp.Integer(2)
    raise ValueError(f"węzeł spoza języka: {e.func}")

u, v = sp.symbols('u v')
A = sp.exp(u*v) - sp.sin(u)
M = majoranta(A)
M
\[\displaystyle e^{\left(u^{2} + 2\right) \left(v^{2} + 2\right)} + 6\]

Lemma 2.1 promises the inequality \(|A(\mathbf z+\boldsymbol\eta)|<M_A(\mathbf z)\) for every shift with \(\lVert\boldsymbol\eta\rVert_\infty\le1\). Let us check it on \(20{,}000\) random pairs \((\mathbf z,\boldsymbol\eta)\) and count the violations:

fA = sp.lambdify((u, v), A, 'math')
fM = sp.lambdify((u, v), M, 'math')
random.seed(0)
naruszenia = 0
for _ in range(20_000):
    z = (random.uniform(-1.5, 1.5), random.uniform(-1.5, 1.5))
    eta = (random.uniform(-1, 1), random.uniform(-1, 1))
    if not abs(fA(z[0] + eta[0], z[1] + eta[1])) < fM(*z):
        naruszenia += 1
naruszenia
0

No violations — as it should be: the lemma has been proved, and the test merely illustrates it. The result \(\exp\bigl((u^2+2)(v^2+2)\bigr)+6\) (rather than \(+2\)) comes from the fact that SymPy stores \(-\sin u\) as the product \((-1)\cdot\sin u\), and the product rule gives \(3\cdot2\). This is still a valid majorant. More generally:

Remark 2.2 (the majorant depends on the notation)

\(M_A\) is a function of the tree \(A\), not of the function that \(A\) denotes: the trees \(x-x\) and \(0\) get the majorants \(2(x^2+2)\) and \(2\) (SymPy would simplify \(x-x\) to \(0\) already when building the tree). This does no harm — the reduction needs some proven bound given by a formula, not the best one.

Lemma 2.3 (effective differentiation)

For \(A\in\mathcal A_d\), an expression for \(\partial A/\partial x_j\) in the language \(\mathcal A_d\) can be constructed algorithmically.

Proof. Recursively: \(\partial_j c=0\), \(\partial_j x_i\in\{0,1\}\), the sum and product rules, \(\partial_j e^{A}=e^{A}\partial_jA\) and \(\partial_j\sin A=\sin\!\bigl(A+\tfrac{\pi}{2}\bigr)\,\partial_jA\). \(\blacksquare\)

Definition 2.4 (weights)

Let \(Q(y,\mathbf x)=P(y,\mathbf x)^2\). For \(i=1,\dots,n\) we set \(k_i=M_{\partial Q/\partial x_i}\) (Lemma 2.1 applied to the expression from Lemma 2.3, in the variables \((y,x_1,\dots,x_n)\), with zero perturbation of \(y\)). Then \(k_i\in\mathcal A_{n+1}\), \(k_i>1\), and

\[ \left|\frac{\partial Q}{\partial x_i}(y,\mathbf z)\right| < k_i(y,\mathbf x) \qquad\text{whenever } \lVert\mathbf z-\mathbf x\rVert_\infty\le 1. \tag{2.1} \]

Note: the derivative is evaluated at the point \(\mathbf z\), while the weight is evaluated at the center \(\mathbf x\). A single weight controls the derivative on the whole cube around \(\mathbf x\).

3. The weighted penalty and the rounding theorem#

On the set \([0,\infty)^n\), the zeros of the expression \(P(y,\mathbf x)^2+\sum_i\sin^2(\pi x_i)\) are exactly the integer solutions (since \(\sin(\pi x)=0\iff x\in\mathbb Z\)). Later, however, we will replace the variables by the points of a dense curve, which comes arbitrarily close to a zero but need not hit it. So we need a theorem about small values, not only about zeros. The naive residual does not provide one:

Example 3.1 (no gap without weights)

For \(N\ge2\) let \(P_N(x)=Nx-1\): there is no root in \(\mathbb N\). And yet \(P_N(1/N)^2+\sin^2(\pi/N)=\sin^2(\pi/N)\to0\) as \(N\to\infty\). No fixed threshold separates “yes” from “no” across the whole family: the polynomial becomes more and more sensitive to perturbations.

Let us compare, in a plot, the unweighted residual with the weighted penalty \(f\) (Definition 3.2 below, here with \(n=1\)) for \(N=5\) and \(N=20\):

x = sp.symbols('x')
xs = np.linspace(0, 1.25, 40_001)
fig, ax = plt.subplots(figsize=(7.5, 3.4))
for N, kolor in ((5, '#d97706'), (20, '#4f46e5')):
    P = N*x - 1
    k = majoranta(sp.factor(sp.diff(P**2, x)))          # waga z Lematu 2.1
    r = sp.lambdify(x, P**2 + sp.sin(sp.pi*x)**2, 'numpy')
    f = sp.lambdify(x, 2**4 * (P**2 + sp.sin(sp.pi*x)**2 * k**4), 'numpy')
    ax.semilogy(xs, r(xs), color=kolor, lw=1.2, label=f"bez wag, N={N}: min = {r(xs).min():.4f}")
    ax.semilogy(xs, f(xs), color=kolor, lw=1.2, ls='--', label=f"kara ważona f, N={N}: min = {f(xs).min():.0f}")
ax.axhline(1, color='black', lw=0.8)
ax.set_xlabel('x'); ax.legend(fontsize=8, loc='upper right'); ax.set_ylim(1e-3, 1e30)
ax.set_title('Residuum bez wag schodzi do zera, kara ważona zostaje powyżej 1')
plt.show()
../_images/9730299c6b91c9c477d720cb3b2094e0dbf904b724dcd12be68bae80788799a5.png

Without weights, the minimum of the residual drops from \(0.27\) (\(N=5\)) to \(0.024\) (\(N=20\)), while in both cases the weighted penalty has minimum \(16\) (at \(x=0\), where \(P_N(0)^2=1\)), far above the threshold \(1\).

Definition 3.2 (weighted penalty; Richardson, p. 516)

\[ f(y,\mathbf x)=(n+1)^4\Bigl[\,P(y,\mathbf x)^2+\sum_{i=1}^n\sin^2(\pi x_i)\,k_i(y,\mathbf x)^4\Bigr]. \]

This is an expression in \(\mathcal A_{n+1}\), nonnegative everywhere. The term \(P^2\) measures the error in the equation, the sine terms measure the distance from the lattice \(\mathbb Z^n\); the larger the derivatives of \(P^2\) at a given place, the closer to the lattice the weights require the point to be.

Lemma 3.3 (the sine measures the distance to an integer)

Let \(x\ge0\), let \(m\in\mathbb N\) be the natural number nearest to \(x\) (either one in case of a tie), and \(d=|x-m|\). Then \(0\le d\le\tfrac12\), \(|\sin(\pi x)|=\sin(\pi d)\), and

\[ 2d\le|\sin(\pi x)|\qquad\text{and consequently}\qquad d\le\bigl(\sin^2(\pi x)\bigr)^{1/4}. \]

Proof. The periodicity and symmetry of the sine give \(|\sin(\pi x)|=|\sin(\pi(x-m))|=\sin(\pi d)\), since \(0\le\pi d\le\pi/2\). On \([0,\tfrac12]\) the function \(t\mapsto\sin(\pi t)\) is concave (its second derivative is \(-\pi^2\sin(\pi t)\le0\)), so it lies above the chord joining \((0,0)\) and \((\tfrac12,1)\): \(\sin(\pi d)\ge2d\). Since \(d\le\tfrac12\le2\), we have \(2d\ge d^2\); hence \(d^2\le\sin(\pi d)=|\sin(\pi x)|\), and taking square roots, \(d\le|\sin\pi x|^{1/2}=(\sin^2\pi x)^{1/4}\). \(\blacksquare\)

(Richardson proves \(t^2\le\sin(\pi t)\) on \([0,\tfrac12]\) by studying the function \(\sin(\pi t)-t^2\); the concavity argument is shorter.)

Theorem 3.4 (rounding theorem; Richardson, Theorem One)

For every \(a\in\mathbb N\) the following conditions are equivalent:

  1. \(\exists\,\mathbf m\in\mathbb N^n\ \ P(a,\mathbf m)=0\) (i.e., \(a\in U\));

  2. \(\exists\,\mathbf x\in[0,\infty)^n\ \ f(a,\mathbf x)=0\);

  3. \(\exists\,\mathbf x\in[0,\infty)^n\ \ f(a,\mathbf x)\le1\).

In particular, if \(a\notin U\), then \(f(a,\mathbf x)>1\) at every point \(\mathbf x\ge0\).

Proof. (1)⇒(2): at an integer zero \(\mathbf m\), both \(P\) and all the \(\sin(\pi m_i)\) vanish. (2)⇒(3) is obvious. It remains to prove (3)⇒(1). Let \(\mathbf x\ge0\) and \(f(a,\mathbf x)\le1\).

Step 1 (each term is small). All the terms in the brackets are nonnegative, so

\[ Q(a,\mathbf x)\le\frac1{(n+1)^4},\qquad \sin^2(\pi x_i)\,k_i(a,\mathbf x)^4\le\frac1{(n+1)^4}\quad(i=1,\dots,n). \]

Taking fourth roots (the weights are positive) gives \(\bigl(\sin^2(\pi x_i)\bigr)^{1/4}k_i(a,\mathbf x)\le\frac1{n+1}\).

Step 2 (rounding). Let \(m_i\) be the natural number nearest to \(x_i\), and \(d_i=|m_i-x_i|\le\frac12\). By Lemma 3.3,

\[ d_i\,k_i(a,\mathbf x)\le\frac1{n+1}\qquad(i=1,\dots,n). \tag{3.1} \]

Step 3 (estimating along the whole segment). Let \(\gamma(t)=\mathbf x+t(\mathbf m-\mathbf x)\), \(t\in[0,1]\). Every point of the segment lies at distance \(\le\frac12\) from \(\mathbf x\) in the maximum norm, so (2.1) applies. By Theorem 4.4 in Preliminaries:

\[ Q(a,\mathbf m)-Q(a,\mathbf x)=\int_0^1\sum_{i=1}^n(m_i-x_i)\,\frac{\partial Q}{\partial x_i}(a,\gamma(t))\,dt \le\sum_{i=1}^n d_i\,k_i(a,\mathbf x). \]

Hence, by Step 1 and (3.1),

\[ 0\le Q(a,\mathbf m)\le\frac1{(n+1)^4}+\frac{n}{n+1}<1 , \tag{3.2} \]

where the last inequality is strict because \((n+1)^{-4}<(n+1)^{-1}\).

Step 4 (integrality). Since \(a\in\mathbb N\) and \(\mathbf m\in\mathbb N^n\), by (P2) the number \(Q(a,\mathbf m)=P(a,\mathbf m)^2\) is a nonnegative integer less than \(1\), i.e., \(0\). Hence \(P(a,\mathbf m)=0\). \(\blacksquare\)

Division of labor in the proof

Nonnegative coordinates round to natural numbers (this matters, since \(2^{x}\) is not an integer for negative integers). The weights control the whole segment, not just its endpoints. The factor \((n+1)^4\) leaves a margin below \(1\). Integrality enters only in the last step, where an approximate zero becomes an exact one.

Remark 3.5 (a variant with squares)

The same weights work in the simpler penalty \(f_{\mathrm{alt}}=(n+1)^2\bigl[P^2+\sum_i\sin^2(\pi x_i)k_i^2\bigr]\): from \(f_{\mathrm{alt}}\le1\) and the stronger inequality \(2d_i\le|\sin\pi x_i|\) we get \(d_ik_i\le\frac1{2(n+1)}\), so \(Q(a,\mathbf m)\le(n+1)^{-2}+\frac{n}{2(n+1)}<1\). In what follows we stick to Richardson’s fourth powers.

Remark 3.6 (the gap is even uniform)

If \(f(a,\mathbf x)\le s\), the same computation gives \(Q(a,\mathbf m)\le\varphi(s)=\frac{s}{(n+1)^4}+\frac{n\,s^{1/4}}{n+1}\). Since \(\varphi(1)<1\) and \(\varphi\) is continuous, there is \(s_0>1\) (depending only on \(n\)) with \(\varphi(s_0)<1\). Then for \(a\notin U\) we have \(f(a,\cdot)>s_0\), i.e., \(\inf f\ge s_0>1\). This strengthened version is not needed later.

The last step of this part removes the constraint \(\mathbf x\ge0\): squares range over the entire set \([0,\infty)^n\).

Corollary 3.7 (the gap on all of \(\mathbb R^n\); Richardson, Corollary)

Let \(F(y,u_1,\dots,u_n)=f(y,u_1^2,\dots,u_n^2)\). Then \(F\in\mathcal A_{n+1}\), \(F\ge0\), and for \(a\in\mathbb N\):

  • if \(a\in U\), then \(F(a,\mathbf u)=0\) for some \(\mathbf u\in\mathbb R^n\);

  • if \(a\notin U\), then \(F(a,\mathbf u)>1\) for every \(\mathbf u\in\mathbb R^n\).

Equivalently: \(a\in U\iff\exists\mathbf u\ F(a,\mathbf u)=0\iff\exists\mathbf u\ F(a,\mathbf u)<1 \iff\exists\mathbf u\ F(a,\mathbf u)\le1\).

Proof. The map \(\mathbf u\mapsto(u_1^2,\dots,u_n^2)\) maps \(\mathbb R^n\) onto \([0,\infty)^n\) (a witness for \(\mathbf m\) is \(u_i=\sqrt{m_i}\)). The claim follows from Theorem 3.4. Square roots appear only in the proof; the expression \(F\) contains only squares. \(\blacksquare\)

4. One variable suffices: a dense curve#

We now have an undecidable inequality in \(n\) variables. Richardson replaces all the variables by functions of one variable, using two oscillations at different scales:

\[ h(t)=t\sin t,\qquad g(t)=t\sin(t^3). \]

The idea: near a large \(v\), on an interval of length of order \(\delta/v\), the function \(h\) changes by at most \(\delta\) (since \(|h'(t)|\le1+t\)), while the phase \(t^3\) changes by about \(3v^2\cdot\delta/v=3\delta v\) — arbitrarily much. So \(h\) barely moves, while \(g\) (with amplitude \(\approx v\)) sweeps the whole interval \([-v,v]\).

Lemma 4.1 (arbitrarily distant solutions of \(h(v)=a\))

For every \(a\in\mathbb R\) and \(L>0\) there is \(v>L\) with \(h(v)=a\).

Proof. Choose \(k\in\mathbb N\) so large that \(p=2\pi k+\frac\pi2>\max\{L,|a|\}\), and let \(q=2\pi k+\frac{3\pi}2\). Then \(h(p)=p>a\) and \(h(q)=-q<a\), so by the intermediate value theorem \(h(v)=a\) for some \(v\in(p,q)\); clearly \(v>L\). \(\blacksquare\)

Lemma 4.2 (lifting: one coordinate approximate, the other exact; Richardson, Lemmas Two and Three)

For any \(a,b\in\mathbb R\), \(\delta>0\) and \(M\ge0\) there is \(w>M\) such that

\[ |h(w)-a|<\delta\qquad\text{and}\qquad g(w)=b . \]

Proof. Choose \(R>\max\{M,\,|b|,\,1,\,4\pi/\delta\}\). By Lemma 4.1 we take \(v>\sqrt{R^2+\delta/2}\) with \(h(v)=a\) and set \(u=\sqrt{v^2-\delta/2}\). Then \(v>u>R\) and \(v^2-u^2=\delta/2\).

The interval \([u,v]\) is short for \(h\). Since \(u>1\),

\[ (v-u)(v+1)<(v-u)(v+u)=\tfrac{\delta}{2}<\delta . \tag{4.1} \]

On it, the phase \(t^3\) changes by more than a period. Using \(v^2=u^2+\delta/2\):

\[ v^3-u^3=v\,(u^2+\tfrac\delta2)-u^3=u^2(v-u)+\tfrac\delta2\,v>\tfrac\delta2\,u>\tfrac\delta2\,R>2\pi . \tag{4.2} \]

\(g\) passes through \(b\). The open interval \((u^3,v^3)\) has length \(>2\pi\), so it contains a number \(\theta_+\equiv\frac\pi2\) and a number \(\theta_-\equiv\frac{3\pi}2\pmod{2\pi}\) (both progressions have step \(2\pi\)). Their cube roots \(t_\pm=\theta_\pm^{1/3}\) lie in \((u,v)\) and

\[ g(t_+)=t_+>u>|b|\ge b,\qquad g(t_-)=-t_-<-u<-|b|\le b . \]

By the intermediate value theorem there is \(w\) between \(t_+\) and \(t_-\) (so \(w\in(u,v)\), \(w>M\)) with \(g(w)=b\).

\(h\) stays close to \(a\). For \(s\in[u,v]\): \(|h'(s)|=|\sin s+s\cos s|\le1+s\le1+v\). By the mean value theorem and (4.1),

\[ |h(w)-a|=|h(w)-h(v)|\le(v-w)(1+v)\le(v-u)(1+v)<\delta . \qquad\blacksquare \]

This proof is constructive and can be carried out numerically. Since the phase \(t^3\) is huge, we compute in high-precision arithmetic (mpmath, 80 digits):

mp.mp.dps = 80
h = lambda t: t * mp.sin(t)
g = lambda t: t * mp.sin(t**3)

def bisekcja(F, lo, hi, kroki=400):
    """Miejsce zerowe F na [lo, hi], gdy F(lo), F(hi) mają różne znaki (tw. Darboux)."""
    flo = F(lo)
    for _ in range(kroki):
        mid = (lo + hi) / 2
        if (F(mid) > 0) == (flo > 0):
            lo, flo = mid, F(mid)
        else:
            hi = mid
    return (lo + hi) / 2

def podnies(a, b, delta, M=0):
    """Lemat 4.2: zwraca w > M z |h(w) - a| < delta i g(w) = b — dokładnie według dowodu."""
    a, b, delta = mp.mpf(a), mp.mpf(b), mp.mpf(delta)
    R = max(mp.mpf(M), abs(b), mp.mpf(1), 4 * mp.pi / delta) * (1 + mp.mpf('1e-9'))
    dolna = mp.sqrt(R**2 + delta / 2)                        # chcemy v > sqrt(R^2 + δ/2)
    k = int(mp.ceil((max(dolna, abs(a)) - mp.pi / 2) / (2 * mp.pi))) + 1
    v = bisekcja(lambda t: h(t) - a, 2*mp.pi*k + mp.pi/2, 2*mp.pi*k + 3*mp.pi/2)   # Lemat 4.1
    u = mp.sqrt(v**2 - delta / 2)
    assert (v - u) * (v + 1) < delta / 2 and v**3 - u**3 > 2 * mp.pi          # (4.1), (4.2)
    nastepna = lambda c: c + 2 * mp.pi * mp.ceil((u**3 - c) / (2 * mp.pi))     # pierwsza ≡ c (mod 2π) > u^3
    t_plus, t_minus = mp.cbrt(nastepna(mp.pi / 2)), mp.cbrt(nastepna(3 * mp.pi / 2))
    w = bisekcja(lambda t: g(t) - b, min(t_plus, t_minus), max(t_plus, t_minus))
    return w, dict(R=R, u=u, v=v)

w, info = podnies(3, -2, 0.1)
print(f"w = {mp.nstr(w, 20)}")
print(f"|h(w) - 3| = {mp.nstr(abs(h(w) - 3), 6)}  (< δ = 0.1)")
print(f"g(w) - (-2) = {mp.nstr(g(w) + 2, 6)}")
print(f"długość przedziału v - u = {mp.nstr(info['v'] - info['u'], 6)}")
w = 135.06612167797138163
|h(w) - 3| = 0.0201545  (< δ = 0.1)
g(w) - (-2) = 3.88149e-73
długość przedziału v - u = 0.000185094

We obtained \(w\approx135.07\): \(|h(w)-3|\approx0.02<\delta\), while \(g(w)\) differs from \(-2\) by about \(4\cdot10^{-73}\), i.e., at the limit of the working precision. On the interval \([u,v]\), of length about \(1.85\cdot10^{-4}\), the function \(h\) barely moves, while \(g\) performs more than one and a half oscillations with amplitude about \(v\):

ts = [info['u'] + (info['v'] - info['u']) * j / 2000 for j in range(2001)]
fig, (a1, a2) = plt.subplots(1, 2, figsize=(9, 3))
a1.plot([float(t - info['u']) for t in ts], [float(h(t)) for t in ts], color='#d97706')
a1.axhline(3, color='black', lw=0.6); a1.set_title('h(t) = t sin t na [u, v]'); a1.set_xlabel('t − u')
a2.plot([float(t - info['u']) for t in ts], [float(g(t)) for t in ts], color='#4f46e5', lw=0.8)
a2.axhline(-2, color='black', lw=0.6); a2.set_title('g(t) = t sin t³ na [u, v]'); a2.set_xlabel('t − u')
plt.tight_layout(); plt.show()
../_images/d65e6e45d4e676df090328bfcb41caa710d766becf077ac9e5a15ca83dd5583f.png

Now we assemble the curve in \(\mathbb R^n\). We write \(g^{[j]}\) for the \(j\)-fold composition of \(g\) (not a power), \(g^{[0]}(t)=t\).

Definition 4.3 (the Richardson curve)

For \(n\ge2\):

\[ \Gamma_n(t)=\Bigl(h(t),\ h\bigl(g(t)\bigr),\ \dots,\ h\bigl(g^{[n-2]}(t)\bigr),\ g^{[n-1]}(t)\Bigr). \]

The first \(n-1\) coordinates begin with \(h\), the last one is an iterate of \(g\) alone; e.g., \(\Gamma_2=(h,g)\), \(\Gamma_4=\bigl(h(t),h(g(t)),h(g(g(t))),g(g(g(t)))\bigr)\). The following recursion holds:

\[ \Gamma_{n+1}(t)=\bigl(h(t),\ \Gamma_n(g(t))\bigr). \tag{4.3} \]

Theorem 4.4 (density with an exact last coordinate; Richardson, Theorem Two)

For \(n\ge2\), \(\mathbf a\in\mathbb R^n\), \(\delta>0\) and \(M\ge0\) there is \(w>M\) such that

\[ \bigl|h\bigl(g^{[j-1]}(w)\bigr)-a_j\bigr|<\delta\quad(1\le j\le n-1),\qquad g^{[n-1]}(w)=a_n . \]

In particular, the set \(\Gamma_n\bigl((M,\infty)\bigr)\) is dense in \(\mathbb R^n\).

Proof. Induction on \(n\). For \(n=2\) this is Lemma 4.2. Assume the claim for \(n\) and take a target \((a_1,\dots,a_{n+1})\). The induction hypothesis for the “tail” \((a_2,\dots,a_{n+1})\) (with \(M=0\)) gives \(w^*>0\) for which the first \(n-1\) coordinates of \(\Gamma_n(w^*)\) approximate \(a_2,\dots,a_n\) to within \(\delta\), and the last one equals \(a_{n+1}\). Lemma 4.2 with targets \(a_1\) and \(w^*\) gives \(w>M\) with \(|h(w)-a_1|<\delta\) and \(g(w)=w^*\). By (4.3), \(\Gamma_{n+1}(w)=\bigl(h(w),\Gamma_n(w^*)\bigr)\) — exactly the required approximation. Density: every nonempty open set contains a cube \(\{\mathbf u:\lVert\mathbf u-\mathbf a\rVert_\infty<\delta\}\). \(\blacksquare\)

Remark 4.5 (why the last coordinate is exact)

The induction step requires \(g(w)=w^*\) exactly. If we only had \(g(w)\approx w^*\), the error would be amplified by the very steeply varying iterates of \(g\); it could be controlled only by a separate argument based on the continuity of \(\Gamma_n\) at the point \(w^*\), with an astronomically small tolerance. The exact “lift” of the last coordinate ensures that the whole tail is reproduced without error.

Let us check this numerically in \(\mathbb R^3\): we aim at \((1.5, -4, 7)\) with \(\delta=0.05\).

cel, delta = (1.5, -4, 7), 0.05
w_gwiazdka, _ = podnies(cel[1], cel[2], delta)      # ogon: |h(w*) - a2| < δ, g(w*) = a3
w, _ = podnies(cel[0], w_gwiazdka, delta)            # |h(w) - a1| < δ, g(w) = w*
Gamma3 = (h(w), h(g(w)), g(g(w)))
print("w =", mp.nstr(w, 15))
for j, (c, a) in enumerate(zip(Gamma3, cel), 1):
    print(f"współrzędna {j}: {mp.nstr(c, 12):>16}   błąd = {mp.nstr(abs(c - a), 3)}")
w = 273.313041756929
współrzędna 1:    1.50843582206   błąd = 0.00844
współrzędna 2:   -3.98980322229   błąd = 0.0102
współrzędna 3:              7.0   błąd = 1.1e-64

The first two coordinates differ from the target by \(0.008\) and \(0.010\), i.e., by less than \(\delta=0.05\), and the third equals \(7\) to within the working precision, as Theorem 4.4 predicts.

Remark 4.6 (density, not surjectivity)

The image of \(\Gamma_n\) is dense, but it has measure zero in \(\mathbb R^n\) for \(n\ge2\): on a compact parameter interval of length \(\ell\) the curve is Lipschitz with some constant \(L\), so its image can be covered by \(N\) cubes of side \(2L\ell/N\), of total volume \((2L\ell)^nN^{1-n}\to0\); the whole parameter line is a countable union of such intervals. That is why hitting all coordinates exactly is the wrong goal — and it is not needed: it suffices to enter a neighborhood of the point (Fact 4.6 in Preliminaries).

Let us plot an initial portion of the curve \(\Gamma_2\), for \(t\in[0,22]\):

t = np.linspace(0, 22, 400_000)
fig, ax = plt.subplots(figsize=(5.2, 5.2))
ax.plot(t*np.sin(t), t*np.sin(t**3), lw=0.15, color='#4f46e5')
ax.set_xlim(-22, 22); ax.set_ylim(-22, 22); ax.set_aspect('equal')
ax.set_title('Γ₂(t) = (t sin t, t sin t³), t ∈ [0, 22]')
plt.show()
../_images/fa9879edd2d03e6b212860106bc53681167e58701d1737378c54a05cf0894d9a.png

In the plot, the curve merges into a solid patch: for \(t\le22\) the phase \(t^3\) makes about \(1700\) turns, so successive sweeps of the second coordinate lie very close to one another. This is an artifact of the line width, since the image of the curve itself has measure zero (Remark 4.6).

5. Transfer to one variable#

Lemma 5.1 (what substituting a dense curve preserves)

Let \(H\colon\mathbb R^n\to\mathbb R\) be continuous, \(c\in\mathbb R\), \(M\ge0\). Then

\[ \exists\,\mathbf u\in\mathbb R^n\ \ H(\mathbf u)<c\quad\iff\quad\exists\,t>M\ \ H(\Gamma_n(t))<c , \]

and also \(\inf_{t>M}H(\Gamma_n(t))=\inf_{\mathbf u\in\mathbb R^n}H(\mathbf u)\).

Proof. “⇐”: take \(\mathbf u=\Gamma_n(t)\). “⇒”: if \(H(\mathbf u_0)<c\), then by continuity \(H<c\) on a cube \(\lVert\mathbf u-\mathbf u_0\rVert_\infty<\eta\), and by Theorem 4.4 the curve \(\Gamma_n((M,\infty))\) enters it. Equality of the infima: the curve lies in \(\mathbb R^n\), so the \(\inf\) over the curve \(\ge\inf\) over \(\mathbb R^n\); and for every \(c>\inf_{\mathbb R^n}H\) the first part gives a point of the curve with \(H<c\). \(\blacksquare\)

For a non-strict inequality the analogous equivalence for an arbitrary dense set is false: \(D=\mathbb R\setminus\{0\}\) is dense in \(\mathbb R\), and \(H(z)=z^2\) has the same infimum \(0\) on \(D\) and on \(\mathbb R\), and yet \(H(z)\le0\) has a solution only in \(\mathbb R\). That is why we built the gap first (§3).

Definition 5.2

\(G(y,t)=F\bigl(y,\Gamma_n(t)\bigr)\) (substitution of \(n\) expressions for \(n\) variables) and \(G_a(t)=G(a,t)\) for \(a\in\mathbb N\). Thus \(G\in\mathcal A_2\), \(G_a\in\mathcal A_1\), and \(G_a\) is obtained from \(a\) algorithmically (by substituting the number \(a\) for \(y\)).

Theorem 5.3 (dichotomy in one variable; Richardson, Corollary to Theorem Two)

Every function \(G_a\) is nonnegative. Moreover:

  1. if \(a\in U\), then for every \(\varepsilon>0\) and \(M\ge0\) there is \(t>M\) with \(G_a(t)<\varepsilon\);

  2. if \(a\notin U\), then \(G_a(t)>1\) for every \(t\in\mathbb R\).

In particular, \(a\in U\iff\exists t\ G_a(t)<1\iff\exists t\ G_a(t)\le1\iff\inf_tG_a(t)=0\).

Proof. Nonnegativity: \(F\ge0\). If \(a\in U\), Corollary 3.7 gives \(\mathbf u_0\) with \(F(a,\mathbf u_0)=0\); Lemma 5.1 for \(H=F(a,\cdot)\) and \(c=\varepsilon\) gives the claim. If \(a\notin U\), then \(F(a,\mathbf u)>1\) at every point, in particular at the points \(\Gamma_n(t)\). \(\blacksquare\)

Remark 5.4 (why we do not claim that \(G_a\) has a zero)

A zero of the function \(F(a,\cdot)\) yields arbitrarily small values of \(G_a\) (density + continuity), but not a zero of \(G_a\) — the curve may miss that point. The arithmetic information is carried by the sharp threshold \(1\), protected by the rounding theorem. The order of the construction matters: first the gap (§3), then the curve (§4). In the direction “\(G_a(t)\le1\Rightarrow a\in U\)” we use not density but only the gap: the point \(\Gamma_n(t)\) is itself a witness of \(F\le1\).

The whole chain on a toy example#

The actual polynomial from Theorem 1.1 is huge. We can, however, trace the same construction on a “Diophantine equation” in two variables: \(x_1^2+x_2^2=5\) (which has the solution \((1,2)\)) and \(x_1^2+x_2^2=3\) (which has none). We build the weights, the penalty \(f\), \(F\) and \(G(t)=F(\Gamma_2(t))\), and then — in the “yes” case — we look for a point with \(G(t)<1\) by aiming the curve at the zero of \(F\), i.e., at \(\mathbf u=(1,\sqrt2)\) (since \(f\) vanishes at \(\mathbf x=(1,2)=(u_1^2,u_2^2)\)).

mp.mp.dps = 120
x1, x2, u1, u2 = sp.symbols('x1 x2 u1 u2')

def lancuch(P, n=2):
    """Wagi k_i, kara f i funkcja F(u) = f(u1², u2²) — dokładnie według §2–§3."""
    Q = P**2
    k = [majoranta(sp.diff(Q, xi)) for xi in (x1, x2)]
    f = (n + 1)**4 * (P**2 + sum(sp.sin(sp.pi*xi)**2 * ki**4 for xi, ki in zip((x1, x2), k)))
    F = f.subs({x1: u1**2, x2: u2**2}, simultaneous=True)
    return k, sp.lambdify((u1, u2), F, 'mpmath')

for opis, P, cel in [("x1²+x2²=5 (TAK)", x1**2 + x2**2 - 5, (mp.mpf(1), mp.sqrt(2))),
                     ("x1²+x2²=3 (NIE)", x1**2 + x2**2 - 3, (mp.mpf(1), mp.mpf(1)))]:
    k, F = lancuch(P)
    print(opis, "   waga k1 =", sp.factor(k[0]))
    for delta in ('1e-3', '1e-8', '1e-10'):
        t, _ = podnies(cel[0], cel[1], mp.mpf(delta))
        print(f"   δ = {delta:>6}:  t ≈ {mp.nstr(t, 12):>16}   G(t) = {mp.nstr(F(h(t), g(t)), 8)}")
x1²+x2²=5 (TAK)    waga k1 = 18*(x1**2 + 2)*(x1**4 + 4*x1**2 + x2**4 + 4*x2**2 + 35)
   δ =   1e-3:  t ≈    12575.7953128   G(t) = 2.524194e+10
   δ =   1e-8:  t ≈    1256637070.86   G(t) = 2.8217838
   δ =  1e-10:  t ≈   125663706279.0   G(t) = 0.00023293165
x1²+x2²=3 (NIE)    waga k1 = 18*(x1**2 + 2)*(x1**4 + 4*x1**2 + x2**4 + 4*x2**2 + 19)
   δ =   1e-3:  t ≈    12575.7953128   G(t) = 6.6458173e+8
   δ =   1e-8:  t ≈    1256637070.86   G(t) = 81.074264
   δ =  1e-10:  t ≈   125663706279.0   G(t) = 81.000006

For the solvable equation a point with \(G(t)<1\) exists, but our construction finds one only at \(t\approx1.26\cdot10^{11}\), and it has to be computed with more than a hundred digits of precision (the phase is \(t^3\approx2\cdot10^{33}\)). For the unsolvable equation, even the “best attempt” gives \(G\approx81>1\) — in accordance with the theorem, which guarantees \(G>1\) everywhere. The reduction is effective as a transformation of expressions, but the witnesses can be astronomically far away: yet another reason why numerical “checking” cannot replace deciding.

See also

A larger example — the family of expressions from the equation \(x^3+y^3+z^3=a\), including a case in which the witness has about 2770 digits and a case in which nobody knows the answer — is in Example: an expression whose sign cannot be seen.

6. The sign problem#

Theorem 6.1 (Theorem R, part A; Richardson, §2 Theorem One)

There is no algorithm that, given \(A\in\mathcal A_1\), decides whether \(\exists t\ A(t)<0\).

Proof. For \(a\in\mathbb N\) we algorithmically build \(A_a(t)=G_a(t)-1\). By Theorem 5.3, \(a\in U\iff\exists t\ A_a(t)<0\). An algorithm for the sign problem would decide \(U\), contrary to Theorem 1.1. \(\blacksquare\)

The hard instances contain no absolute value: every \(A_a\) is analytic and defined everywhere. By Theorem 5.3, the reduction also works when the witness is sought only among \(t>0\) or \(t>M\). Replacing \(A\) by \(-A\) gives the undecidability of the question “is \(A\) positive somewhere?”, and swapping the answers, that of the question “is \(A\ge0\) everywhere?”.

7. The identity (zero) problem#

The absolute value turns a question about the sign into a question about identity:

\[\begin{split} |s|-s=\begin{cases}0,& s\ge0,\\ -2s>0,& s<0.\end{cases} \end{split}\]

Theorem 7.1 (Theorem R, part B; Richardson, §2 Theorem Two)

There is no algorithm that, given \(B\in\mathcal B_1\), decides whether \(B\equiv0\).

Proof. Let \(B_a(t)=|G_a(t)-1|-\bigl(G_a(t)-1\bigr)=|A_a(t)|-A_a(t)\). If \(a\notin U\), then \(G_a>1\) everywhere, so \(B_a\equiv0\). If \(a\in U\), then \(G_a(t_0)<1\) at some \(t_0\), so \(B_a(t_0)=2(1-G_a(t_0))>0\). Hence \(B_a\equiv0\iff a\notin U\); an algorithm for the identity problem (with the answer swapped) would decide \(U\). \(\blacksquare\)

Corollary 7.2 (equality and canonical forms)

Equality of the functions defined by two expressions in \(\mathcal B_1\) is undecidable. In particular, there is no algorithm assigning to every expression in \(\mathcal B_1\) a finite canonical form (such that the forms are equal if and only if the functions are equal).

Proof. \(B\equiv C\iff B-C\equiv0\). A canonical-form algorithm would decide equality by comparing two strings. \(\blacksquare\)

This is the precise content of the conclusion in Lecture 1 that every simplify function must fail on some expressions: it fails to recognize zero, gives a wrong answer, or does not terminate (see How does a computer algebra system work?).

Remark 7.3 (the role of the absolute value)

The absolute value is the bridge from sign to identity. For the purely analytic language \(\mathcal A_1\) this proof does not give undecidability of identity: an analytic function vanishing on an interval vanishes everywhere (Theorem 4.2 in Preliminaries), so a “plateau of zeros” like \(|s|-s\) is impossible. Unlike analytic functions, functions with absolute value have zero divisors: \((|x|+x)(|x|-x)\equiv0\), although neither factor is identically zero.

8. The integration problem#

We ask whether, for a given \(J\in\mathcal B_1\), there exists an expression \(H\in\mathcal B_1\), differentiable on \(\mathbb R\), with \(H'=J\) — a question about a representable antiderivative, not about the existence of an antiderivative at all (for continuous \(J\), one always exists: \(\int_0^xJ\)).

Definition 8.1 (local obstruction to integration)

A function \(\Delta\) defined on \(\mathbb R\) and represented in a language \(\mathcal E\) is a local obstruction if there exist no \(H\in\mathcal E\) and no nonempty open interval \(I\) on which \(H\) is differentiable and \(H'=\Delta\).

In Appendices: powers of two and the integral of e^{x^2} (Appendix B) we prove that \(\Delta(x)=e^{x^2}\) is a local obstruction for \(\mathcal B_1\) (Liouville’s theorem plus local removal of absolute values).

We need an expression that in the “no” case is identically zero, and in the “yes” case equals exactly \(1\) on some interval. Richardson builds it from truncated subtraction:

\[ r\mathbin{\dot-}s=\frac{|r-s|+(r-s)}{2}=\max\{r-s,0\},\qquad m(r,s)=r-(r\mathbin{\dot-}s)=\min\{r,s\}, \]
\[\begin{split} S_a(t)=m\bigl(1,\ 2\mathbin{\dot-}2G_a(t)\bigr)=\min\bigl\{1,\max\{0,\,2-2G_a(t)\}\bigr\} =\begin{cases}1,& G_a(t)\le\tfrac12,\\ 2-2G_a(t),& \tfrac12\le G_a(t)\le1,\\ 0,& G_a(t)\ge1.\end{cases} \end{split}\]

\(S_a\in\mathcal B_1\) is continuous and takes values in \([0,1]\).

Lemma 8.2 (the switch)

If \(a\notin U\), then \(S_a\equiv0\). If \(a\in U\), then \(S_a=1\) on some nonempty open interval.

Proof. In the first case \(G_a>1\) everywhere. In the second, Theorem 5.3 gives \(t_0\) with \(G_a(t_0)<\frac12\) (here we need the full strength of “\(\inf G_a=0\)”, not just “\(G_a<1\) somewhere”), and by continuity \(G_a<\frac12\) on a neighborhood of \(t_0\). \(\blacksquare\)

Theorem 8.3 (Theorem R, part C; Richardson, §2 Theorem Three)

Let a language \(\mathcal E\) of everywhere-defined functions effectively contain \(\mathcal B_1\), be effectively closed under multiplication, and contain a local obstruction \(\Delta\). Then there is no algorithm deciding whether a given \(J\in\mathcal E\) has an antiderivative in \(\mathcal E\). In particular, this applies to \(\mathcal B_1\) with \(\Delta=e^{x^2}\).

Proof. Let \(J_a=\Delta\cdot S_a\). If \(a\notin U\), then \(J_a\equiv0\), and the constant function \(0\) is an antiderivative of it in \(\mathcal E\). If \(a\in U\), then on some interval \(I\) we have \(S_a=1\), i.e., \(J_a=\Delta\); an antiderivative \(H\in\mathcal E\) of \(J_a\) would satisfy \(H'=\Delta\) on \(I\), contrary to the definition of an obstruction. Hence \(J_a\) has an antiderivative in \(\mathcal E\) if and only if \(a\notin U\). \(\blacksquare\)

Remark 8.4 (the problem is global)

For \(a\in U\) the function \(J_a\) may vanish on some other interval — there the antiderivative \(0\) is elementary. The obstruction lies on the interval where \(S_a=1\). We ask for one expression that works on the whole line.

9. Richardson’s original, general formulation#

Richardson works with an arbitrary set \(E\) of expressions representing partial functions, and with the set of functions \(E^*\). He assumes that \(E^*\) contains the identity and the rational constants, and that for \(A,B\in E\) one can algorithmically build expressions for \(A\pm B\), \(A\cdot B\), \(A(B(x))\). He understands the equality \(f\equiv g\) with domains taken into account (Definition 3.3 in Preliminaries). The conditions:

  • (R1) \(E^*\) contains the constants \(\pi\), \(\log2\) and the functions \(e^x\), \(\sin x\);

  • (R2) there is \(\mu\in E^*\) with \(\mu(x)=|x|\) for \(x\neq0\) (the value \(\mu(0)\) is arbitrary or undefined);

  • (R3) there is an everywhere-defined \(\Delta\in E^*\) such that for no \(f\in E^*\) and no interval \(I\) does \(f'\equiv\Delta\) hold on \(I\).

Theorem 9.1 (Richardson, 1968)

Under the above effectiveness assumptions:

  1. (R1) ⇒ the question whether an expression takes a negative value at some point of its domain is undecidable;

  2. (R1)+(R2) ⇒ the identity problem \(A\equiv0\) is undecidable;

  3. (R1)+(R2)+(R3) ⇒ the integration problem \(\exists f\in E^*\ f'\equiv A\) is undecidable.

Proof. The expressions \(G_a\) from §5 have representatives in \(E\): we fix, once and for all, expressions for the finitely many constants and basic functions used in the construction (\(x\), \(e^x\), \(\sin x\)), and apply the effective constructors along the tree; the number \(a\) is built from \(1\) by addition. This gives (1) via \(G_a-1\).

(2): let \(\widetilde B_a=\mu(G_a-1)-(G_a-1)\). If \(a\notin U\), the argument of \(\mu\) is never zero, so \(\widetilde B_a\) is defined everywhere and equal to \(0\). If \(a\in U\), then at the point \(t_0\) with \(G_a(t_0)<1\) the argument is nonzero and \(\widetilde B_a(t_0)=2(1-G_a(t_0))>0\); hence \(\widetilde B_a\not\equiv0\) regardless of the behavior at other points.

(3): in the cutoff we replace the absolute value by \(\mu\): \(q_a=2-2G_a\), \(T_a=\frac{\mu(q_a)+q_a}{2}\), \(\widetilde S_a=1-\frac{\mu(1-T_a)+(1-T_a)}{2}\). If \(a\notin U\): \(q_a<0\), so \(T_a=0\) everywhere, and the outer \(\mu\) receives \(1\), so \(\widetilde S_a\) is the everywhere-defined zero function. If \(a\in U\): on the interval where \(G_a<\frac12\) we have \(q_a>1\), \(T_a=q_a\), \(1-T_a<0\), all arguments of \(\mu\) are nonzero, and \(\widetilde S_a=1\). The rest is as in Theorem 8.3, with \(\widetilde J_a=\Delta\,\widetilde S_a\) (the fact that \(\Delta\) is defined everywhere guarantees that in the “no” case \(\widetilde J_a\) is the everywhere-defined zero function). \(\blacksquare\)

At the thresholds \(G_a=1\) and \(G_a=\frac12\) the expressions involving \(\mu\) may be undefined — the proof avoids them: in the “no” case \(G_a>1\) everywhere, and in the “yes” case we use an interval where \(G_a<\frac12\).

10. What exactly we have proved#

An effectiveness audit. The reduction algorithm performs only operations on expressions: it takes the fixed \(P\), forms \(Q=P^2\), differentiates, builds the weights by the rules of Lemma 2.1, assembles \(f\), substitutes the squares, then the coordinates of the curve, and finally the number \(a\) for \(y\). It never searches for roots, points of the curve, minima or signs of constants. These objects occur only in the proof that the constructed expression has the required property.

Proposition 10.1 (negativity is semi-decidable)

There is an algorithm that, given \(A\in\mathcal B_1\), halts if and only if \(A(t)<0\) for some \(t\).

Proof. The values of the constants, \(\exp\), \(\sin\) and \(|\cdot|\) at rational points can be approximated with a guaranteed error, and finite composition preserves this property. We enumerate the pairs \((q,k)\in\mathbb Q\times\mathbb N\) and for each compute a rational \(r_{q,k}\) with \(|r_{q,k}-A(q)|\le2^{-k}\); we halt when \(r_{q,k}+2^{-k}<0\). The test never errs. If \(A(t_0)<0\), then by continuity \(A<0\) on a neighborhood of \(t_0\), hence at some rational \(q\); for large \(k\) the test succeeds. \(\blacksquare\)

The same method semi-decides not being identically zero. By Post’s theorem (Theorem 1.5 in Preliminaries) and Theorem 7.1, being identically zero is not even semi-decidable — otherwise, combining the two procedures, we could decide it. Here is a working semi-decision procedure using interval arithmetic:

from fractions import Fraction
from mpmath import iv
iv.dps = 30

def szukaj_ujemnej_wartosci(A, maks_krokow=10_000):
    """Półrozstrzyganie: przegląda wymierne q (coraz gęściej, coraz dalej) i zwraca q
    z certyfikatem A(q) < 0 (górny kraniec przedziału ujemny) albo None po limicie kroków."""
    krok = 0
    for poziom in range(1, 60):                    # siatka o kroku 2^-poziom na [-poziom, poziom]
        mianownik = 2**poziom
        for licznik in range(-poziom * mianownik, poziom * mianownik + 1):
            krok += 1
            if krok > maks_krokow:
                return None
            q = Fraction(licznik, mianownik)
            wartosc = A(iv.mpf(q.numerator) / q.denominator)
            if wartosc.b < 0:                      # cały przedział < 0: certyfikat
                return q, wartosc

print(szukaj_ujemnej_wartosci(lambda t: t**2 - 2*t + iv.mpf('0.99')))   # minimum −0,01 w t = 1
print(szukaj_ujemnej_wartosci(lambda t: t**2 - 2*t + 1))                 # (t − 1)² ≥ 0: brak certyfikatu
(Fraction(1, 1), mpi('-0.0100000000000000000000000000000907', '-0.00999999999999999999999999999999211'))
None

In the first example the procedure found a certificate at \(q=1\): the whole interval of values lies below zero. In the second, the result None means only that the step limit was exhausted, not the answer “no”: without the limit, the procedure would search for a certificate forever. Richardson’s theorem says that no such procedure can be supplemented with an opposite procedure that halts exactly when \(A\ge0\) everywhere (cf. Problem 8 in Review questions and problems).

Three different questions about zero.

Question

Logical form

What we know

identically zero

\(\forall t\ A(t)=0\)

undecidable in \(\mathcal B_1\) (Theorem 7.1)

existence of a zero

\(\exists t\ A(t)=0\)

undecidable (Wang 1974; Laczkovich 2003) — does not follow from the density of the curve alone

whether a constant is zero

\(c=0\), no variable

open problem; decidable for exponential-logarithmic constants assuming Schanuel’s conjecture (Richardson 1997)

Richardson wrote in 1968 (p. 515): “No method is known for deciding whether a subelementary expression with no variables in it represents a number less than zero. Whether or not such a method exists is an open question.” More in Context, consequences and further results.

11. The modern version: polynomials and sine suffice#

Matiyasevich’s theorem (Theorem 2.4 in Preliminaries) allows us to take as \(P\) an ordinary polynomial \(p(y,\mathbf x)\in\mathbb Z[y,\mathbf x]\) with an undecidable set \(U\). Then the derivatives of \(Q=p^2\) are polynomials, and the weights can be taken polynomial: if \(\partial Q/\partial x_i=\sum_\alpha c_{i,\alpha}\,y^{\alpha_0}x_1^{\alpha_1}\cdots x_n^{\alpha_n}\), then

\[ k_i(y,\mathbf x)=2+\sum_\alpha|c_{i,\alpha}|\,(y^2+2)^{\alpha_0}\prod_{j=1}^n(x_j^2+2)^{\alpha_j} \]

satisfies (2.1) (the coefficients are known integers, so we compute \(|c_{i,\alpha}|\) right away — this is not the absolute-value operation of the language). The penalty, the squares and the curve \(h,g\) use only arithmetic operations and the sine.

Corollary 11.1 (Caviness 1970, after Matiyasevich)

Let \(\mathcal S_1\) be the language generated by the rational numbers, \(\pi\), the variable \(x\), the operations \(+,-,\cdot\) and the function \(\sin\). The sign problem is undecidable for \(\mathcal S_1\); after adding the absolute value, the identity problem is undecidable too.

Proof. We repeat §3–§5 with the polynomial \(P\) and the above weights, and then §6–§7 without change. \(\blacksquare\)

Laczkovich (2003) also removed \(\pi\): in the ring generated by the integers and the functions \(x\), \(\sin x^n\), \(\sin(x\sin x^n)\) (\(n=1,2,\dots\)) it is undecidable whether a function takes a positive value and whether it has a root. See Context, consequences and further results.