Metamath Proof Explorer


Theorem 4sqlem5

Description: Lemma for 4sq . (Contributed by Mario Carneiro, 15-Jul-2014)

Ref Expression
Hypotheses 4sqlem5.2 φ A
4sqlem5.3 φ M
4sqlem5.4 B = A + M 2 mod M M 2
Assertion 4sqlem5 φ B A B M

Proof

Step Hyp Ref Expression
1 4sqlem5.2 φ A
2 4sqlem5.3 φ M
3 4sqlem5.4 B = A + M 2 mod M M 2
4 1 zcnd φ A
5 1 zred φ A
6 2 nnred φ M
7 6 rehalfcld φ M 2
8 5 7 readdcld φ A + M 2
9 2 nnrpd φ M +
10 8 9 modcld φ A + M 2 mod M
11 10 recnd φ A + M 2 mod M
12 7 recnd φ M 2
13 11 12 subcld φ A + M 2 mod M M 2
14 3 13 eqeltrid φ B
15 4 14 nncand φ A A B = B
16 4 14 subcld φ A B
17 6 recnd φ M
18 2 nnne0d φ M 0
19 16 17 18 divcan1d φ A B M M = A B
20 3 oveq2i A B = A A + M 2 mod M M 2
21 4 11 12 subsub3d φ A A + M 2 mod M M 2 = A + M 2 - A + M 2 mod M
22 20 21 eqtrid φ A B = A + M 2 - A + M 2 mod M
23 22 oveq1d φ A B M = A + M 2 - A + M 2 mod M M
24 moddifz A + M 2 M + A + M 2 - A + M 2 mod M M
25 8 9 24 syl2anc φ A + M 2 - A + M 2 mod M M
26 23 25 eqeltrd φ A B M
27 2 nnzd φ M
28 26 27 zmulcld φ A B M M
29 19 28 eqeltrrd φ A B
30 1 29 zsubcld φ A A B
31 15 30 eqeltrrd φ B
32 31 26 jca φ B A B M