Metamath Proof Explorer


Theorem modid

Description: Identity law for modulo. (Contributed by NM, 29-Dec-2008)

Ref Expression
Assertion modid A B + 0 A A < B A mod B = A

Proof

Step Hyp Ref Expression
1 modval A B + A mod B = A B A B
2 1 adantr A B + 0 A A < B A mod B = A B A B
3 rerpdivcl A B + A B
4 3 adantr A B + 0 A A < B A B
5 4 recnd A B + 0 A A < B A B
6 addid2 A B 0 + A B = A B
7 6 fveq2d A B 0 + A B = A B
8 5 7 syl A B + 0 A A < B 0 + A B = A B
9 rpregt0 B + B 0 < B
10 divge0 A 0 A B 0 < B 0 A B
11 9 10 sylan2 A 0 A B + 0 A B
12 11 an32s A B + 0 A 0 A B
13 12 adantrr A B + 0 A A < B 0 A B
14 simpr B + A < B A < B
15 rpcn B + B
16 15 mulid1d B + B 1 = B
17 16 adantr B + A < B B 1 = B
18 14 17 breqtrrd B + A < B A < B 1
19 18 ad2ant2l A B + 0 A A < B A < B 1
20 simpll A B + 0 A A < B A
21 9 ad2antlr A B + 0 A A < B B 0 < B
22 1re 1
23 ltdivmul A 1 B 0 < B A B < 1 A < B 1
24 22 23 mp3an2 A B 0 < B A B < 1 A < B 1
25 20 21 24 syl2anc A B + 0 A A < B A B < 1 A < B 1
26 19 25 mpbird A B + 0 A A < B A B < 1
27 0z 0
28 flbi2 0 A B 0 + A B = 0 0 A B A B < 1
29 27 4 28 sylancr A B + 0 A A < B 0 + A B = 0 0 A B A B < 1
30 13 26 29 mpbir2and A B + 0 A A < B 0 + A B = 0
31 8 30 eqtr3d A B + 0 A A < B A B = 0
32 31 oveq2d A B + 0 A A < B B A B = B 0
33 15 mul01d B + B 0 = 0
34 33 ad2antlr A B + 0 A A < B B 0 = 0
35 32 34 eqtrd A B + 0 A A < B B A B = 0
36 35 oveq2d A B + 0 A A < B A B A B = A 0
37 recn A A
38 37 subid1d A A 0 = A
39 38 ad2antrr A B + 0 A A < B A 0 = A
40 36 39 eqtrd A B + 0 A A < B A B A B = A
41 2 40 eqtrd A B + 0 A A < B A mod B = A