|
12 | 12 |
|
13 | 13 | \begin{prop} |
14 | 14 | 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 |
18 | 18 | \[ |
19 | | -\fn{min} \; x < y \; R(x, \vec z), |
| 19 | +\bmin{x < y}{R(x, \vec{z})}, |
20 | 20 | \] |
21 | 21 | \end{prop} |
22 | 22 |
|
23 | 23 | \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}) & = |
46 | 35 | \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})$}\\ |
48 | 38 | 0 & \text{otherwise.} |
49 | 39 | \end{cases} |
50 | | -\] |
| 40 | +\end{align*} |
51 | 41 | \end{proof} |
52 | 42 |
|
53 | 43 | \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 |
61 | 51 | 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}$. |
64 | 54 | \end{explain} |
65 | 55 |
|
66 | 56 | All this provides us with a good deal of machinery to show that |
|
81 | 71 | \item The function $\fn{nextPrime(x)}$, which returns the first prime |
82 | 72 | number larger than $x$, defined by |
83 | 73 | \[ |
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))} |
85 | 76 | \] |
86 | 77 | Here we are relying on Euclid's proof of the fact that there is always |
87 | 78 | a prime number between $x$ and $x\fac+1$. |
|
92 | 83 | \end{enumerate} |
93 | 84 |
|
94 | 85 | \begin{prob} |
95 | | -Define integer division using bounded minimization. |
| 86 | +Define integer division $d(x, y)$ using bounded minimization. |
96 | 87 | \end{prob} |
97 | 88 |
|
98 | 89 | \end{document} |
0 commit comments