4

I've been reading a bit about constructive mathematics and one of the first challenges I've found is to prove that any two natural numbers are either equal or not equal assuming only intuitionistic logic and the Peano axioms. I am dividing my proof into two steps; my doubts are about the second one I will point them out. Any help is appreciated!

My procedure is the following:

  1. Any natural number is either equal to zero or different from zero.

    • To prove the base case, suppose that $n=0$. Then, of course, it's true that $n=0$ or $n\neq 0$.
    • Assume now that either $n=0$ or $n\neq 0$. Then, in either case, $n+1\neq 0$. So it's true that $n+1=0$ or $n+1\neq 0$, concluding our proof by induction.
  2. Any two natural numbers are either equal or not equal.

    • Let $m\in \mathbb{N}$ and work inductively on $n$. We already have the base case, since $m=0$ or $m\neq 0$.
    • Suppose inductively that either $m=n$ or $m\neq n$. If $m=n$, then $m\neq n+1$ (this may sound ridiculous, but I am not sure how to prove this). Otherwise if $m\neq n$, either $m=n+1$ or $m\neq n+1$ (again, not even sure if I have the right to state this directly or if I should prove it).

P.S.: How the hell do you prove trichotomy? That might be a topic for another question though.

2 Answers2

5

Unfortunately it does seem you are using $\mathsf{LEM}$ in step $2.$ As you mention yourself:

Otherwise if $m \neq n$, either $m = n+1$ or $m \neq n+1$ [...]

is not justified by anything. (It would of course hold if we had $\mathsf{LEM}$, but we don't have it at our disposal)

There is indeed something critical happening at step $2$ and it's worth pointing out. Let's illustrate this by carefully giving this proof a failed attempt.

(I will be using the notation using the successor function $Sn = n +1$)


Proof Attempt

Let $m$ be given. We will try to show $m = n ~\lor~ m \neq n$ by induction on $x$.

  • Base Case: Show $m = 0 ~\lor~ m \neq 0$. Just as you did, one can do the case distinction $m = 0 ~\lor \exists x : m = S x~$. In the first case obviously $m = 0$ and in the second case we indeed have $m = S x \neq 0$ by an axiom of $\mathsf{PA}$.

  • Induction Step: The induction hypothesis is $$m = n ~\lor m \neq n~ \text{ and we need to show } m = S n ~\lor m \neq S n.$$ Again we do the case distinction $m = 0 ~\lor \exists x : m = S x~$ and in the case $m = 0$ we have $m = 0 \neq S n$.

Now in the second case we have $m = S x$ and what remains to show is $S x = S n ~\lor S x \neq S n~$. Now it's time to remember that the induction hypothesis is $S x = n ~\lor S x \neq n~$ and with this, we are stuck. The induction hypothesis is not strong enough to finish the proof. And this hopefully becomes clearer as we try to fix it:


Fixed Proof

This time we try to show the statement $\forall m: m = n ~\lor~ m \neq n$ by induction on $n$.

  • Base Case: Show $\forall m : ~m = 0 ~\lor~ m \neq 0$. This works the same way as before.

  • Induction Step: This time the induction hypothesis is stronger! It is $$\forall m : m = n ~\lor m \neq n~ \text{ and we need to show } \forall m : ~m = S n ~\lor m \neq S n.$$ So for given $m$ we need to show $m = S n ~\lor m \neq S n~$. As previously we do the case distinction $m = 0 ~\lor \exists x : m = S x~$ and in the case $m = 0$ we have $m = 0 \neq S n$.

But unlike previously, we now have $m = S x$ with induction hypothesis $\forall m : m = n ~\lor m \neq n$, which allows us to conclude $x = n ~\lor x \neq n$. Then we are left with two cases:

  • If $x = n$ we have $S n = S x = m$.
  • Now for $x \neq n$. Assume we had $S n = m = S x$. Then by the injectivity of $S$ (an axiom of $\mathsf{PA}$) we get $n = x$, a contradiction! Therefore $m \neq S n$.

So indeed we were able to show $m = S n ~\lor m \neq S n~$. $~~\Box$


The above proof is constructively valid and hopefully showcased that the crucial part is that we do the induction on the statement which still has $y$ quantified.

Léreau
  • 3,015
  • 1
    Crystal clear! There's just one thing: in your very last bullet point, you do a proof of negation, successfully proving $\neg(Sx=y)$. But we don't have the disjunction into two cases proven for $Sx$ yet, so we can't immediately conclude that $Sx\neq y$, right? I think this is taken care of by taking into account that $S$ is strongly injective, since in this way $x\neq z$ directly implies $Sx\neq Sz = y$. – Nicolas M. Gutierrez May 11 '21 at 20:44
  • 1
    @NicolasM.Gutierrez I don't think I quite get what you mean by "we don't have the disjunction into two cases proven for $S x$ yet, so we can't immediately conclude that $Sx \neq y$, right?" – Léreau May 11 '21 at 20:51
  • 1
    @NicolasM.Gutierrez Injectivity of $S$ means $S x = S y \rightarrow x = y$ and constructively, this also implies the statement of strong injectivity you have linked: $S x \neq S y \rightarrow x \neq y$ (and in my last step I pretty much show this). The reason is that for any propositions we have $(A \rightarrow B) \rightarrow (\neg B \rightarrow \neg A)$. – Léreau May 11 '21 at 20:54
  • 1
    I meant that the inductive hypothesis was that $\forall y: x=y \lor x\neq y$, but this wasn't already proven for $Sx$. – Nicolas M. Gutierrez May 11 '21 at 20:59
  • 1
    @NicolasM.Gutierrez (My timing of changing $x, y$ to $m, n$ is a bit unfortunate, but now it's closer to your name choice). The induction hypothesis (IH) is indeed $\forall y : x = y \lor x \neq y$ and was not shown for $S x$. Instead, $\forall y : Sx = y \lor Sx \neq y$ is what we end up proving by using the IH. – Léreau May 11 '21 at 21:08
  • 1
    There's just one edit you missed by the way. In the induction step that's part of the proof attempt, $Sx$ should be $Sn$. – Nicolas M. Gutierrez May 11 '21 at 21:55
  • So I just proved that an statement implies its contrapositive, as you stated. Let me try to get across what I meant previously: Injectivity of $S$ implies then that $x\neq y \equiv \neg(x=y) \implies \neg(Sx=Sy)$, where the equivalence in the left is true by the IH. I was trying to say that $\neg(Sx=Sy)$ doesn't (yet) imply that $Sx\neq Sy$, since that implication will only be justified after we have proven the induction step. Is that right, or am I confused? – Nicolas M. Gutierrez May 11 '21 at 22:03
3

I think your (1) case is correct ! At first sight, it may seem you are using the Law of the Excluded Middle (LEM), but it is what you intend to prove and proved it via induction (which is allowed in PA, but not in Robinson Arithmetic ), so it is right.

Now, coming to (2). In the base case, you appealed to (1), (again, not LEM) so it is okay. Coming to the induction step, we use the successor function : $S^{m}(0) = S^{n}(0)$. Now, $S^{n+1}(0) = S(S^{n}(0)) = S(S^{m}(0)) = S^{m}(S(0)).$ Now, by Peano Axiom $S(0) \neq 0$ and the injectivity of $S$, we know $S^{n+1}(0) \neq S^{m}(0)$, which is precisely what you wanted to prove. For the second part, try it using the Peano Axioms themselves, and if you have a problem, please reach me as a follow to this answer!

PS : Also, what do you mean by Trichotomy?

  • 1
    Ah, so the successor function must be strongly injective, right? (according to the terminology in nlab). Oh and by trichotomy I meant the proof that given any two natural numbers $m$ and $n$, either $m<n$, $m=n$, or $m>n$. – Nicolas M. Gutierrez May 09 '21 at 21:12
  • 2
    It might be interesting to observe that if you extract an algorithm from the constructive proof, what you get is essentially a recursive function defined by eqb(m, n) := match m, n with | 0, 0 => true | S(m'), 0 => false | 0, S(n') => false | S(m'), S(n') => eqb(m', n') end. – Daniel Schepler May 09 '21 at 21:26
  • Yes, indeed, it is strongly injective! – Danish A. Alvi May 10 '21 at 09:22
  • @Daniel in said recursive function, what are $m'$ and $n'$? – Nicolas M. Gutierrez May 11 '21 at 17:43
  • $m'$ and $n'$ are the variables introduced on the left side of the match clause, i.e. they're new variables (valid only in the scope of that branch of the match statement) that get set to the values such that $m = S(m')$ and $n = S(n')$ in that case. – Daniel Schepler May 11 '21 at 17:49
  • 1
    As a similar example to see what the match notation means, a recursive definition of addition would boil down to: plus(m, n) := match m with | 0 => n | S(m') => S(plus(m', n)) end. – Daniel Schepler May 11 '21 at 17:50