Metamath Proof Explorer


Theorem moddiffl

Description: Value of the modulo operation rewritten to give two ways of expressing the quotient when " A is divided by B using Euclidean division." Multiplying both sides by B , this implies that A mod B differs from A by an integer multiple of B . (Contributed by Jeff Madsen, 17-Jun-2010) (Revised by Mario Carneiro, 6-Sep-2016)

Ref Expression
Assertion moddiffl AB+AAmodBB=AB

Proof

Step Hyp Ref Expression
1 modval AB+AmodB=ABAB
2 1 oveq2d AB+AAmodB=AABAB
3 simpl AB+A
4 3 recnd AB+A
5 rpcn B+B
6 5 adantl AB+B
7 rerpdivcl AB+AB
8 7 flcld AB+AB
9 8 zcnd AB+AB
10 6 9 mulcld AB+BAB
11 4 10 nncand AB+AABAB=BAB
12 2 11 eqtrd AB+AAmodB=BAB
13 12 oveq1d AB+AAmodBB=BABB
14 rpne0 B+B0
15 14 adantl AB+B0
16 9 6 15 divcan3d AB+BABB=AB
17 13 16 eqtrd AB+AAmodBB=AB