Metamath Proof Explorer


Theorem difmodm1lt

Description: The difference between an integer modulo a positive integer and the integer decreased by 1 modulo the same modulus is less than the modulus decreased by 1 (if the modulus is greater than 2). This theorem would not be valid for an odd A and N = 2 , since ( ( A mod N ) - ( ( A - 1 ) mod N ) ) would be ( 1 - 0 ) = 1 which is not less than ( N - 1 ) = 1 . (Contributed by AV, 6-Jun-2012)

Ref Expression
Assertion difmodm1lt A N 2 < N A mod N A 1 mod N < N 1

Proof

Step Hyp Ref Expression
1 simpl A mod N = 1 A N 2 < N A mod N = 1
2 zre A A
3 2 3ad2ant1 A N 2 < N A
4 nnre N N
5 4 3ad2ant2 A N 2 < N N
6 1lt2 1 < 2
7 1red N 1
8 2re 2
9 8 a1i N 2
10 7 9 4 3jca N 1 2 N
11 lttr 1 2 N 1 < 2 2 < N 1 < N
12 10 11 syl N 1 < 2 2 < N 1 < N
13 6 12 mpani N 2 < N 1 < N
14 13 a1i A N 2 < N 1 < N
15 14 3imp A N 2 < N 1 < N
16 3 5 15 3jca A N 2 < N A N 1 < N
17 16 adantl A mod N = 1 A N 2 < N A N 1 < N
18 m1mod0mod1 A N 1 < N A 1 mod N = 0 A mod N = 1
19 17 18 syl A mod N = 1 A N 2 < N A 1 mod N = 0 A mod N = 1
20 1 19 mpbird A mod N = 1 A N 2 < N A 1 mod N = 0
21 1 20 oveq12d A mod N = 1 A N 2 < N A mod N A 1 mod N = 1 0
22 df-2 2 = 1 + 1
23 22 breq1i 2 < N 1 + 1 < N
24 23 biimpi 2 < N 1 + 1 < N
25 24 adantl N 2 < N 1 + 1 < N
26 1red N 2 < N 1
27 4 adantr N 2 < N N
28 26 26 27 ltaddsub2d N 2 < N 1 + 1 < N 1 < N 1
29 25 28 mpbid N 2 < N 1 < N 1
30 1m0e1 1 0 = 1
31 30 breq1i 1 0 < N 1 1 < N 1
32 29 31 sylibr N 2 < N 1 0 < N 1
33 32 3adant1 A N 2 < N 1 0 < N 1
34 33 adantl A mod N = 1 A N 2 < N 1 0 < N 1
35 21 34 eqbrtrd A mod N = 1 A N 2 < N A mod N A 1 mod N < N 1
36 zmodfz A N A mod N 0 N 1
37 36 3adant3 A N 2 < N A mod N 0 N 1
38 elfzle2 A mod N 0 N 1 A mod N N 1
39 37 38 syl A N 2 < N A mod N N 1
40 39 adantl ¬ A mod N = 1 A N 2 < N A mod N N 1
41 nnrp N N +
42 41 3ad2ant2 A N 2 < N N +
43 3 42 modcld A N 2 < N A mod N
44 peano2rem N N 1
45 4 44 syl N N 1
46 45 3ad2ant2 A N 2 < N N 1
47 peano2zm A A 1
48 47 zred A A 1
49 48 3ad2ant1 A N 2 < N A 1
50 49 42 modcld A N 2 < N A 1 mod N
51 43 46 50 3jca A N 2 < N A mod N N 1 A 1 mod N
52 51 adantl ¬ A mod N = 1 A N 2 < N A mod N N 1 A 1 mod N
53 lesub1 A mod N N 1 A 1 mod N A mod N N 1 A mod N A 1 mod N N - 1 - A 1 mod N
54 52 53 syl ¬ A mod N = 1 A N 2 < N A mod N N 1 A mod N A 1 mod N N - 1 - A 1 mod N
55 40 54 mpbid ¬ A mod N = 1 A N 2 < N A mod N A 1 mod N N - 1 - A 1 mod N
56 49 42 jca A N 2 < N A 1 N +
57 56 adantl ¬ A mod N = 1 A N 2 < N A 1 N +
58 modge0 A 1 N + 0 A 1 mod N
59 57 58 syl ¬ A mod N = 1 A N 2 < N 0 A 1 mod N
60 16 18 syl A N 2 < N A 1 mod N = 0 A mod N = 1
61 60 bicomd A N 2 < N A mod N = 1 A 1 mod N = 0
62 61 notbid A N 2 < N ¬ A mod N = 1 ¬ A 1 mod N = 0
63 62 biimpac ¬ A mod N = 1 A N 2 < N ¬ A 1 mod N = 0
64 63 neqned ¬ A mod N = 1 A N 2 < N A 1 mod N 0
65 59 64 jca ¬ A mod N = 1 A N 2 < N 0 A 1 mod N A 1 mod N 0
66 0red A N 2 < N 0
67 66 50 jca A N 2 < N 0 A 1 mod N
68 67 adantl ¬ A mod N = 1 A N 2 < N 0 A 1 mod N
69 ltlen 0 A 1 mod N 0 < A 1 mod N 0 A 1 mod N A 1 mod N 0
70 68 69 syl ¬ A mod N = 1 A N 2 < N 0 < A 1 mod N 0 A 1 mod N A 1 mod N 0
71 65 70 mpbird ¬ A mod N = 1 A N 2 < N 0 < A 1 mod N
72 50 46 jca A N 2 < N A 1 mod N N 1
73 72 adantl ¬ A mod N = 1 A N 2 < N A 1 mod N N 1
74 ltsubpos A 1 mod N N 1 0 < A 1 mod N N - 1 - A 1 mod N < N 1
75 73 74 syl ¬ A mod N = 1 A N 2 < N 0 < A 1 mod N N - 1 - A 1 mod N < N 1
76 71 75 mpbid ¬ A mod N = 1 A N 2 < N N - 1 - A 1 mod N < N 1
77 43 50 resubcld A N 2 < N A mod N A 1 mod N
78 46 50 resubcld A N 2 < N N - 1 - A 1 mod N
79 77 78 46 3jca A N 2 < N A mod N A 1 mod N N - 1 - A 1 mod N N 1
80 79 adantl ¬ A mod N = 1 A N 2 < N A mod N A 1 mod N N - 1 - A 1 mod N N 1
81 lelttr A mod N A 1 mod N N - 1 - A 1 mod N N 1 A mod N A 1 mod N N - 1 - A 1 mod N N - 1 - A 1 mod N < N 1 A mod N A 1 mod N < N 1
82 80 81 syl ¬ A mod N = 1 A N 2 < N A mod N A 1 mod N N - 1 - A 1 mod N N - 1 - A 1 mod N < N 1 A mod N A 1 mod N < N 1
83 55 76 82 mp2and ¬ A mod N = 1 A N 2 < N A mod N A 1 mod N < N 1
84 35 83 pm2.61ian A N 2 < N A mod N A 1 mod N < N 1