aboutsummaryrefslogtreecommitdiff
path: root/theories/Numbers/Integer/Abstract/ZBase.v
blob: ace49428d2419dd237a373adc762b016e70a62d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
(************************************************************************)
(*  v      *   The Coq Proof Assistant  /  The Coq Development Team     *)
(* <O___,, * CNRS-Ecole Polytechnique-INRIA Futurs-Universite Paris Sud *)
(*   \VV/  **************************************************************)
(*    //   *      This file is distributed under the terms of the       *)
(*         *       GNU Lesser General Public License Version 2.1        *)
(************************************************************************)
(*                      Evgeny Makarov, INRIA, 2007                     *)
(************************************************************************)

(*i i*)

Require Export ZAxioms.
Require Import NZTimesOrder.

Module ZBasePropFunct (Export ZAxiomsMod : ZAxiomsSig).

Open Local Scope IntScope.

Module Export NZTimesOrderMod := NZTimesOrderPropFunct NZOrdAxiomsMod.

Theorem Zsucc_wd : forall n1 n2 : Z, n1 == n2 -> S n1 == S n2.
Proof NZsucc_wd.

Theorem Zpred_wd : forall n1 n2 : Z, n1 == n2 -> P n1 == P n2.
Proof NZpred_wd.

Theorem Zpred_succ : forall n : Z, P (S n) == n.
Proof NZpred_succ.

Theorem Zneq_symm : forall n m : Z, n ~= m -> m ~= n.
Proof NZneq_symm.

Theorem Zsucc_inj : forall n1 n2 : Z, S n1 == S n2 -> n1 == n2.
Proof NZsucc_inj.

Theorem Zsucc_inj_wd : forall n1 n2 : Z, S n1 == S n2 <-> n1 == n2.
Proof NZsucc_inj_wd.

Theorem Zsucc_inj_wd_neg : forall n m : Z, S n ~= S m <-> n ~= m.
Proof NZsucc_inj_wd_neg.

(* Decidability and stability of equality was proved only in NZOrder, but
since it does not mention order, we'll put it here *)

Theorem Zeq_em : forall n m : Z, n == m \/ n ~= m.
Proof NZeq_em.

Theorem Zeq_dne : forall n m : Z, ~ ~ n == m <-> n == m.
Proof NZeq_dne.

Theorem Zcentral_induction :
forall A : Z -> Prop, predicate_wd Zeq A ->
  forall z : Z, A z ->
    (forall n : Z, A n <-> A (S n)) ->
      forall n : Z, A n.
Proof NZcentral_induction.

(* Theorems that are true for integers but not for natural numbers *)

Theorem Zpred_inj : forall n m : Z, P n == P m -> n == m.
Proof.
intros n m H. apply NZsucc_wd in H. now do 2 rewrite Zsucc_pred in H.
Qed.

Theorem Zpred_inj_wd : forall n1 n2 : Z, P n1 == P n2 <-> n1 == n2.
Proof.
intros n1 n2; split; [apply Zpred_inj | apply NZpred_wd].
Qed.

End ZBasePropFunct.