Metamath Proof Explorer


Theorem divalglem4

Description: Lemma for divalg . (Contributed by Paul Chapman, 21-Mar-2011)

Ref Expression
Hypotheses divalglem0.1 N
divalglem0.2 D
divalglem1.3 D 0
divalglem2.4 S = r 0 | D N r
Assertion divalglem4 S = r 0 | q N = q D + r

Proof

Step Hyp Ref Expression
1 divalglem0.1 N
2 divalglem0.2 D
3 divalglem1.3 D 0
4 divalglem2.4 S = r 0 | D N r
5 nn0z z 0 z
6 zsubcl N z N z
7 1 5 6 sylancr z 0 N z
8 divides D N z D N z q q D = N z
9 2 7 8 sylancr z 0 D N z q q D = N z
10 nn0cn z 0 z
11 zmulcl q D q D
12 2 11 mpan2 q q D
13 12 zcnd q q D
14 zcn N N
15 1 14 ax-mp N
16 subadd N z q D N z = q D z + q D = N
17 15 16 mp3an1 z q D N z = q D z + q D = N
18 addcom z q D z + q D = q D + z
19 18 eqeq1d z q D z + q D = N q D + z = N
20 17 19 bitrd z q D N z = q D q D + z = N
21 10 13 20 syl2an z 0 q N z = q D q D + z = N
22 eqcom N z = q D q D = N z
23 eqcom q D + z = N N = q D + z
24 21 22 23 3bitr3g z 0 q q D = N z N = q D + z
25 24 rexbidva z 0 q q D = N z q N = q D + z
26 9 25 bitrd z 0 D N z q N = q D + z
27 26 pm5.32i z 0 D N z z 0 q N = q D + z
28 oveq2 r = z N r = N z
29 28 breq2d r = z D N r D N z
30 29 4 elrab2 z S z 0 D N z
31 oveq2 r = z q D + r = q D + z
32 31 eqeq2d r = z N = q D + r N = q D + z
33 32 rexbidv r = z q N = q D + r q N = q D + z
34 33 elrab z r 0 | q N = q D + r z 0 q N = q D + z
35 27 30 34 3bitr4i z S z r 0 | q N = q D + r
36 35 eqriv S = r 0 | q N = q D + r