blob: 519ee7c5ebdf129627e545aa963f0289becb2d27 (
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
|
Require Import ZArith.
Require Import Lia.
Local Open Scope Z_scope.
Module ZExtra.
Lemma mod_0_bounds :
forall x y m,
0 < m ->
x mod m = 0 ->
y mod m = 0 ->
x <> y ->
x + m > y ->
y + m <= x.
Proof.
intros x y m.
intros POS XMOD YMOD NEQ H.
destruct (Z_le_gt_dec (y + m) x); eauto.
apply Znumtheory.Zmod_divide in YMOD; try lia.
apply Znumtheory.Zmod_divide in XMOD; try lia.
inversion XMOD as [x']; subst; clear XMOD.
inversion YMOD as [y']; subst; clear YMOD.
assert (x' <> y') as NEQ' by lia; clear NEQ.
rewrite <- Z.mul_succ_l in H.
rewrite <- Z.mul_succ_l in g.
apply Zmult_gt_reg_r in H;
apply Zmult_gt_reg_r in g; lia.
Qed.
Lemma Ple_not_eq :
forall x y,
(x < y)%positive -> x <> y.
Proof. lia. Qed.
Lemma Pge_not_eq :
forall x y,
(y < x)%positive -> x <> y.
Proof. lia. Qed.
Lemma Ple_Plt_Succ :
forall x y n,
(x <= y)%positive -> (x < y + n)%positive.
Proof. lia. Qed.
End ZExtra.
|