-
Notifications
You must be signed in to change notification settings - Fork 1
/
Zarith_operations.v
64 lines (52 loc) · 1.38 KB
/
Zarith_operations.v
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
(* This code is copyrighted by its authors; it is distributed under *)
(* the terms of the LGPL license (see LICENSE and description files) *)
Require Import ZArith.
Require Import Reals.
Lemma Zplus_INZ :
forall n m : nat, (Z_of_nat n + Z_of_nat m)%Z = Z_of_nat (n + m).
Proof.
intros.
case n; case m; simpl in |- *; trivial.
intro n0; rewrite <- plus_n_O; trivial.
simple induction n1; simpl in |- *; intros.
rewrite Pplus_one_succ_l; trivial.
rewrite Pplus_comm.
rewrite Pplus_succ_permute_r.
rewrite Pplus_comm.
injection H.
intro eq; rewrite eq; trivial.
Qed.
Hint Resolve Zplus_INZ: zarith.
Lemma IZR_eq_O : forall z : Z, z = 0%Z -> IZR z = 0%R.
Proof.
intros.
rewrite H; simpl in |- *; auto.
Qed.
Hint Resolve IZR_eq_O: real.
Lemma IZR_trivial : forall z z1 : Z, z = z1 -> IZR z = IZR z1.
Proof.
intros.
rewrite H; auto.
Qed.
Hint Resolve IZR_trivial: real.
Lemma Zle_not_lt : forall z z1 : Z, (z1 <= z)%Z -> z <> z1 -> (z1 < z)%Z.
Proof.
intros z z1.
auto with zarith.
Qed.
Hint Resolve Zle_not_lt: zarith.
Lemma Zle_2_Zs :
forall z z1 : Z, (z1 <= z <= Z.succ z1)%Z -> z = z1 \/ z = Z.succ z1.
Proof.
intros z z1 h. omega.
Qed.
Hint Resolve Zle_2_Zs: zarith.
Lemma Zle_2_Zs_dec :
forall z z1 : Z, (z1 <= z <= Z.succ z1)%Z -> {z = z1} + {z = Z.succ z1}.
Proof.
intros z z1 h.
elim (Z_lt_ge_dec z (Z.succ z1)); intro.
left; omega.
right; omega.
Qed.
Hint Resolve Zle_2_Zs_dec: zarith.