Metamath Proof Explorer


Theorem modm1p1mod0

Description: If a real number modulo a positive real number equals the positive real number decreased by 1, the real number increased by 1 modulo the positive real number equals 0. (Contributed by AV, 2-Nov-2018)

Ref Expression
Assertion modm1p1mod0 A M + A mod M = M 1 A + 1 mod M = 0

Proof

Step Hyp Ref Expression
1 1re 1
2 modaddmod A 1 M + A mod M + 1 mod M = A + 1 mod M
3 1 2 mp3an2 A M + A mod M + 1 mod M = A + 1 mod M
4 3 eqcomd A M + A + 1 mod M = A mod M + 1 mod M
5 4 adantr A M + A mod M = M 1 A + 1 mod M = A mod M + 1 mod M
6 oveq1 A mod M = M 1 A mod M + 1 = M - 1 + 1
7 6 oveq1d A mod M = M 1 A mod M + 1 mod M = M - 1 + 1 mod M
8 rpcn M + M
9 npcan1 M M - 1 + 1 = M
10 8 9 syl M + M - 1 + 1 = M
11 10 oveq1d M + M - 1 + 1 mod M = M mod M
12 modid0 M + M mod M = 0
13 11 12 eqtrd M + M - 1 + 1 mod M = 0
14 13 adantl A M + M - 1 + 1 mod M = 0
15 7 14 sylan9eqr A M + A mod M = M 1 A mod M + 1 mod M = 0
16 5 15 eqtrd A M + A mod M = M 1 A + 1 mod M = 0
17 16 ex A M + A mod M = M 1 A + 1 mod M = 0