Metamath Proof Explorer


Theorem muladdmodid

Description: The sum of a positive real number less than an upper bound and the product of an integer and the upper bound is the positive real number modulo the upper bound. (Contributed by AV, 5-Jul-2020)

Ref Expression
Assertion muladdmodid N M + A 0 M N M + A mod M = A

Proof

Step Hyp Ref Expression
1 0red M + 0
2 rpxr M + M *
3 elico2 0 M * A 0 M A 0 A A < M
4 1 2 3 syl2anc M + A 0 M A 0 A A < M
5 4 adantl N M + A 0 M A 0 A A < M
6 zcn N N
7 rpcn M + M
8 mulcl N M N M
9 6 7 8 syl2an N M + N M
10 9 adantr N M + A 0 A A < M N M
11 recn A A
12 11 3ad2ant1 A 0 A A < M A
13 12 adantl N M + A 0 A A < M A
14 10 13 addcomd N M + A 0 A A < M N M + A = A + N M
15 14 oveq1d N M + A 0 A A < M N M + A mod M = A + N M mod M
16 simp1 A 0 A A < M A
17 16 adantl N M + A 0 A A < M A
18 simpr N M + M +
19 18 adantr N M + A 0 A A < M M +
20 simpll N M + A 0 A A < M N
21 modcyc A M + N A + N M mod M = A mod M
22 17 19 20 21 syl3anc N M + A 0 A A < M A + N M mod M = A mod M
23 18 16 anim12ci N M + A 0 A A < M A M +
24 3simpc A 0 A A < M 0 A A < M
25 24 adantl N M + A 0 A A < M 0 A A < M
26 modid A M + 0 A A < M A mod M = A
27 23 25 26 syl2anc N M + A 0 A A < M A mod M = A
28 15 22 27 3eqtrd N M + A 0 A A < M N M + A mod M = A
29 28 ex N M + A 0 A A < M N M + A mod M = A
30 5 29 sylbid N M + A 0 M N M + A mod M = A
31 30 3impia N M + A 0 M N M + A mod M = A