Metamath Proof Explorer


Theorem modmuladd

Description: Decomposition of an integer into a multiple of a modulus and a remainder. (Contributed by AV, 14-Jul-2021)

Ref Expression
Assertion modmuladd AB0MM+AmodM=BkA=k M+B

Proof

Step Hyp Ref Expression
1 oveq1 k=AMk M=AM M
2 1 oveq1d k=AMk M+AmodM=AM M+AmodM
3 2 eqeq2d k=AMA=k M+AmodMA=AM M+AmodM
4 zre AA
5 4 adantr AM+A
6 rpre M+M
7 6 adantl AM+M
8 rpne0 M+M0
9 8 adantl AM+M0
10 5 7 9 redivcld AM+AM
11 10 flcld AM+AM
12 11 3adant2 AB0MM+AM
13 flpmodeq AM+AM M+AmodM=A
14 4 13 sylan AM+AM M+AmodM=A
15 14 eqcomd AM+A=AM M+AmodM
16 15 3adant2 AB0MM+A=AM M+AmodM
17 3 12 16 rspcedvdw AB0MM+kA=k M+AmodM
18 oveq2 B=AmodMk M+B=k M+AmodM
19 18 eqeq2d B=AmodMA=k M+BA=k M+AmodM
20 19 eqcoms AmodM=BA=k M+BA=k M+AmodM
21 20 rexbidv AmodM=BkA=k M+BkA=k M+AmodM
22 17 21 syl5ibrcom AB0MM+AmodM=BkA=k M+B
23 oveq1 A=k M+BAmodM=k M+BmodM
24 simpr AB0MM+kk
25 simpl3 AB0MM+kM+
26 simpl2 AB0MM+kB0M
27 muladdmodid kM+B0Mk M+BmodM=B
28 24 25 26 27 syl3anc AB0MM+kk M+BmodM=B
29 23 28 sylan9eqr AB0MM+kA=k M+BAmodM=B
30 29 rexlimdva2 AB0MM+kA=k M+BAmodM=B
31 22 30 impbid AB0MM+AmodM=BkA=k M+B