Skip to content

Commit b5d78d1

Browse files
committed
simpler def of bounded minimization
1 parent 6e66ddd commit b5d78d1

4 files changed

Lines changed: 38 additions & 43 deletions

File tree

computability/recursive-functions/bounded-minimization.tex

Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,55 +12,45 @@
1212

1313
\begin{prop}
1414
If $R(x, \vec z)$ is primitive recursive, so is the function $m_R(y,
15-
\vec z)$ which returns the least~$x$ less than $y$ such that $R(x,\vec
16-
z)$ holds, if there is one, and 0 otherwise. We will write the
17-
function~$m_R$ as
15+
\vec{z})$ which returns the least~$x$ less than $y$ such that
16+
$R(x,\vec{z})$ holds, if there is one, and 0 otherwise. We will write
17+
the function~$m_R$ as
1818
\[
19-
\fn{min} \; x < y \; R(x, \vec z),
19+
\bmin{x < y}{R(x, \vec{z})},
2020
\]
2121
\end{prop}
2222

2323
\begin{proof}
24-
We first define the function~$m'_R(y, \vec z)$ which returns the
25-
least~$x$ less than $y$ such that $R(x,\vec z)$ holds, if there is
26-
one, and $y$ otherwise. First, we define
27-
\[
28-
f(u, \vec z) =
29-
\begin{cases}
30-
0 & \text{if $\lexists[x \le u][R(x, \vec z)]$} \\
31-
1 & \text{otherwise.}
32-
\end{cases}
33-
\]
34-
$f$ is primitive recursive. $f(u, \vec z)$ is 1 for all $u$ less than
35-
the least $x$ such that $R(x, \vec z)$, and is~$0$ thereafter. Since
36-
there are exactly $x$ natural numbers less than~$x$, if we sum the
37-
values of $f(u, \vec z)$ for all $u = 0$, \dots,~$y$, we get the least
38-
$x$ such that $R(x, \vec z)$ if that $x$ is less than $y$, and $y+1$
39-
otherwise:
40-
\[
41-
m'_R(y, \vec z) = \sum_{u = 0}^y f(u, \vec z)
42-
\]
43-
To get $m_R$, we set:
44-
\[
45-
m_R(u, \vec z) =
24+
Note than there can be no~$x < y$ such that $R(x, \vec{z})$ since
25+
there is no $x < y$ at all. So $m_R(x, 0) = 0$.
26+
27+
In case the bound is $y + 1$ we have three cases: (a) There is an $x <
28+
y$ such that $R(x, \vec{z})$, in which case $m_R(y+1, \vec{z}) =
29+
m_R(y, \vec{z})$. (b) There is no such~$x$ but $R(y, \vec{z})$, then
30+
$m_R(y+1, \vec{z}) = y$. (c) There is no $x < y+1$ such that $R(x,
31+
\vec{z})$, then $m_R(y+1,\vec{z}) = 0$. So,
32+
\begin{align*}
33+
m_R(0, \vec{z}) & = 0\\
34+
m_R(y+1, \vec{z}) & =
4635
\begin{cases}
47-
m'_R(y, \vec z) & \text{if $m'_R(y, \vec z) < y$}\\
36+
m_R(y, \vec{z}) & \text{if $\lexists[x < y][R(x, \vec{z})]$} \\
37+
y & \text{otherwise, provided $R(y, \vec{z})$}\\
4838
0 & \text{otherwise.}
4939
\end{cases}
50-
\]
40+
\end{align*}
5141
\end{proof}
5242

5343
\begin{explain}
54-
The choice of ``$0$ otherwise'' is somewhat arbitrary. As we saw, it
55-
is in fact easier to recursively define the function~$m'$ which
56-
returns the least $x$ less than $y$ such that $R(x,\vec z)$ holds, and
57-
$y+1$ otherwise. When we use $\fn{min}$, however, we will always know
58-
that the least $x$ such that $R(x, \vec z)$ exists and is less than
59-
$y$. Thus, in practice, we will not have to worry about the
60-
possibility that if $\fn{min}$ returns $0$ we do not know if that
44+
The choice of ``$0$ otherwise'' is somewhat arbitrary. It is in fact
45+
even easier to recursively define the function~$m'_R$ which returns
46+
the least $x$ less than $y$ such that $R(x,\vec z)$ holds, and $y+1$
47+
otherwise. When we use $\fn{min}$, however, we will always know that
48+
the least $x$ such that $R(x, \vec z)$ exists and is less
49+
than~$y$. Thus, in practice, we will not have to worry about the
50+
possibility that if $\bmin{x<y}{R(x, \vec{z})} = 0$ we do not know if that
6151
value indicates that $R(0, \vec z)$ or that for no $x < y$, $R(x, \vec
62-
z)$. As with bounded quantification, $\fn{min} \; x \leq y \; \dots$
63-
can be understood as $\fn{min} \; x < y + 1 \; \dots$.
52+
z)$. As with bounded quantification, $\bmin{x \leq y}{\dots}$
53+
can be understood as $\bmin{x < y + 1}{\dots}$.
6454
\end{explain}
6555

6656
All this provides us with a good deal of machinery to show that
@@ -81,7 +71,8 @@
8171
\item The function $\fn{nextPrime(x)}$, which returns the first prime
8272
number larger than $x$, defined by
8373
\[
84-
\fn{nextPrime(x)} = \fn{min} \; {y \leq x\fac+1} \\ (y > x \land \fn{Prime}(y))
74+
\fn{nextPrime(x)} =
75+
\bmin{y \leq x\fac+1}{(y > x \land \fn{Prime}(y))}
8576
\]
8677
Here we are relying on Euclid's proof of the fact that there is always
8778
a prime number between $x$ and $x\fac+1$.
@@ -92,7 +83,7 @@
9283
\end{enumerate}
9384

9485
\begin{prob}
95-
Define integer division using bounded minimization.
86+
Define integer division $d(x, y)$ using bounded minimization.
9687
\end{prob}
9788

9889
\end{document}

computability/recursive-functions/examples.tex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@
5353

5454
\begin{prob}
5555
Show that $d(x, y) = \lfloor x/y \rfloor$ (i.e., division, where you
56-
disregard everything after the decimal point) is primitive recursive.
56+
disregard everything after the decimal point) is primitive
57+
recursive. When $y = 0$, we stipulate $d(x, y) = 0$. Give an explicit
58+
definifion of $d$ using primitive recursion and composition. You will
59+
have detour through an axiliary function---you cannot use recursion on
60+
the arguments $x$ or $y$ themselves.
5761
\end{prob}
5862

5963
The set of primitive recursive functions is further closed under the

computability/recursive-functions/sequences.tex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
\len{s} =
3232
\begin{cases}
3333
0 & \text{if $s = 0$ or $s = 1$} \\
34-
\fn{min} \; i < s \; (p_i | s \land \lforall[j < s][(j > i \lif
35-
p_j \not | s)])+1 & \text{otherwise}
34+
\bmin{i < s}{(p_i \mid s \land \lforall[j < s][(j > i \lif
35+
p_j \mathrel{\not\mid} s)])}+1 & \text{otherwise}
3636
\end{cases}
3737
\]
3838
Note that we need to bound the search on $i$; clearly $s$ provides an

open-logic-config.sty

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@
318318

319319
% - `\bmin{x < y}{!A}`: bounded minimization
320320

321-
\DeclareDocumentCommand \bmin { m m } {\mu #1 \; #2}
321+
\DeclareDocumentCommand \bmin { m m } {\fn{min} \; #1 \; #2}
322322

323323
% - `\cfind{e}[n]`: partial computable function with index $e$
324324

0 commit comments

Comments
 (0)