Built with Alectryon, running Coq+SerAPI v8.10.0+0.7.0. Coq sources are in this panel; goals and messages will appear in the other. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑ Ctrl+↓ to navigate, Ctrl+🖱️ to focus.
(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *   INRIA, CNRS and contributors - Copyright 1999-2018       *)
(* <O___,, *       (see CREDITS file for the list of authors)           *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)
(*                      Evgeny Makarov, INRIA, 2007                     *)
(************************************************************************)

Require Export NBase.

Module NAddProp (Import N : NAxiomsMiniSig').
Include NBaseProp N.
For theorems about add that are both valid for N and Z, see NZAdd
Now comes theorems valid for natural numbers but not for Z

forall n m : t, n + m == 0 <-> n == 0 /\ m == 0

forall n m : t, n + m == 0 <-> n == 0 /\ m == 0
m:t

0 + m == 0 <-> 0 == 0 /\ m == 0
m:t
forall n : t, n + m == 0 <-> n == 0 /\ m == 0 -> S n + m == 0 <-> S n == 0 /\ m == 0
m:t

forall n : t, n + m == 0 <-> n == 0 /\ m == 0 -> S n + m == 0 <-> S n == 0 /\ m == 0
m, n:t
IH:n + m == 0 <-> n == 0 /\ m == 0

S n + m == 0 <-> S n == 0 /\ m == 0
m, n:t
IH:n + m == 0 <-> n == 0 /\ m == 0

S (n + m) == 0 <-> S n == 0 /\ m == 0
m, n:t
IH:n + m == 0 <-> n == 0 /\ m == 0

False <-> S n == 0 /\ m == 0
m, n:t
IH:n + m == 0 <-> n == 0 /\ m == 0

False <-> False /\ m == 0
tauto. Qed.

forall n m : t, (exists p : t, n + m == S p) <-> (exists n' : t, n == S n') \/ (exists m' : t, m == S m')

forall n m : t, (exists p : t, n + m == S p) <-> (exists n' : t, n == S n') \/ (exists m' : t, m == S m')
m:t

(exists p : t, 0 + m == S p) <-> (exists n' : t, 0 == S n') \/ (exists m' : t, m == S m')
m:t
forall n : t, (exists p : t, S n + m == S p) <-> (exists n' : t, S n == S n') \/ (exists m' : t, m == S m')
m:t
H:exists p : t, 0 + m == S p

(exists n' : t, 0 == S n') \/ (exists m' : t, m == S m')
m:t
H:(exists n' : t, 0 == S n') \/ (exists m' : t, m == S m')
exists p : t, 0 + m == S p
m:t
forall n : t, (exists p : t, S n + m == S p) <-> (exists n' : t, S n == S n') \/ (exists m' : t, m == S m')
m, p:t
H:0 + m == S p

(exists n' : t, 0 == S n') \/ (exists m' : t, m == S m')
m:t
H:(exists n' : t, 0 == S n') \/ (exists m' : t, m == S m')
exists p : t, 0 + m == S p
m:t
forall n : t, (exists p : t, S n + m == S p) <-> (exists n' : t, S n == S n') \/ (exists m' : t, m == S m')
m:t
H:(exists n' : t, 0 == S n') \/ (exists m' : t, m == S m')

exists p : t, 0 + m == S p
m:t
forall n : t, (exists p : t, S n + m == S p) <-> (exists n' : t, S n == S n') \/ (exists m' : t, m == S m')
m, n':t
H:0 == S n'

exists p : t, 0 + m == S p
m, m':t
H:m == S m'
exists p : t, 0 + m == S p
m:t
forall n : t, (exists p : t, S n + m == S p) <-> (exists n' : t, S n == S n') \/ (exists m' : t, m == S m')
m, m':t
H:m == S m'

exists p : t, 0 + m == S p
m:t
forall n : t, (exists p : t, S n + m == S p) <-> (exists n' : t, S n == S n') \/ (exists m' : t, m == S m')
m:t

forall n : t, (exists p : t, S n + m == S p) <-> (exists n' : t, S n == S n') \/ (exists m' : t, m == S m')
m, n:t
H:exists p : t, S n + m == S p

(exists n' : t, S n == S n') \/ (exists m' : t, m == S m')
m, n:t
H:(exists n' : t, S n == S n') \/ (exists m' : t, m == S m')
exists p : t, S n + m == S p
m, n:t
H:(exists n' : t, S n == S n') \/ (exists m' : t, m == S m')

exists p : t, S n + m == S p
exists (n + m); now rewrite add_succ_l. Qed.

forall n m : t, n + m == 1 -> n == 1 /\ m == 0 \/ n == 0 /\ m == 1

forall n m : t, n + m == 1 -> n == 1 /\ m == 0 \/ n == 0 /\ m == 1
n, m:t

n + m == 1 -> n == 1 /\ m == 0 \/ n == 0 /\ m == 1
n, m:t

n + m == S 0 -> n == S 0 /\ m == 0 \/ n == 0 /\ m == S 0
n, m:t
H:n + m == S 0

n == S 0 /\ m == 0 \/ n == 0 /\ m == S 0
n, m:t
H:n + m == S 0
H1:exists p : t, n + m == S p

n == S 0 /\ m == 0 \/ n == 0 /\ m == S 0
n, m:t
H:n + m == S 0
H1:(exists n' : t, n == S n') \/ (exists m' : t, m == S m')

n == S 0 /\ m == 0 \/ n == 0 /\ m == S 0
n, m:t
H:n + m == S 0
n':t
H1:n == S n'

n == S 0 /\ m == 0 \/ n == 0 /\ m == S 0
n, m:t
H:n + m == S 0
m':t
H1:m == S m'
n == S 0 /\ m == 0 \/ n == 0 /\ m == S 0
n, m:t
H:n + m == S 0
n':t
H1:n == S n'

n == S 0 /\ m == 0
n, m:t
H:n + m == S 0
m':t
H1:m == S m'
n == S 0 /\ m == 0 \/ n == 0 /\ m == S 0
n, m, n':t
H:n' + m == 0
H1:n == S n'

n == S 0 /\ m == 0
n, m:t
H:n + m == S 0
m':t
H1:m == S m'
n == S 0 /\ m == 0 \/ n == 0 /\ m == S 0
n, m, n':t
H:n' == 0 /\ m == 0
H1:n == S n'

n == S 0 /\ m == 0
n, m:t
H:n + m == S 0
m':t
H1:m == S m'
n == S 0 /\ m == 0 \/ n == 0 /\ m == S 0
n, m:t
H:n + m == S 0
m':t
H1:m == S m'

n == S 0 /\ m == 0 \/ n == 0 /\ m == S 0
n, m:t
H:n + m == S 0
m':t
H1:m == S m'

n == 0 /\ m == S 0
n, m, m':t
H:n + m' == 0
H1:m == S m'

n == 0 /\ m == S 0
n, m, m':t
H:n == 0 /\ m' == 0
H1:m == S m'

n == 0 /\ m == S 0
destruct H as [H2 H3]; rewrite H3 in H1; now split. Qed.

forall n m : t, m ~= S (n + m)

forall n m : t, m ~= S (n + m)
n:t

0 ~= S (n + 0)
n:t
forall n0 : t, n0 ~= S (n + n0) -> S n0 ~= S (n + S n0)
n:t

S (n + 0) ~= 0
n:t
forall n0 : t, n0 ~= S (n + n0) -> S n0 ~= S (n + S n0)
n:t

forall n0 : t, n0 ~= S (n + n0) -> S n0 ~= S (n + S n0)
n, m:t
IH:m ~= S (n + m)
H:S m == S (n + S m)

False
n, m:t
IH:m ~= S (n + m)
H:m == n + S m

False
n, m:t
IH:m ~= S (n + m)
H:m == S (n + m)

False
unfold not in IH; now apply IH. Qed.

forall n m : t, n ~= 0 -> P n + m == P (n + m)

forall n m : t, n ~= 0 -> P n + m == P (n + m)
m:t

0 ~= 0 -> P 0 + m == P (0 + m)
m:t
forall n : t, S n ~= 0 -> P (S n) + m == P (S n + m)
m:t

forall n : t, S n ~= 0 -> P (S n) + m == P (S n + m)
intros n IH; rewrite add_succ_l; now do 2 rewrite pred_succ. Qed.

forall n m : t, m ~= 0 -> n + P m == P (n + m)

forall n m : t, m ~= 0 -> n + P m == P (n + m)
intros n m H; rewrite (add_comm n (P m)); rewrite (add_comm n m); now apply add_pred_l. Qed. End NAddProp.