Metamath Proof Explorer


Theorem 4sqlem10

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

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

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 4sqlem10.5 φ ψ M 2 2 2 B 2 = 0
5 2 adantr φ ψ M
6 5 nnzd φ ψ M
7 zsqcl M M 2
8 6 7 syl φ ψ M 2
9 1 adantr φ ψ A
10 5 nnred φ ψ M
11 10 rehalfcld φ ψ M 2
12 11 recnd φ ψ M 2
13 12 negnegd φ ψ M 2 = M 2
14 1 2 3 4sqlem5 φ B A B M
15 14 adantr φ ψ B A B M
16 15 simpld φ ψ B
17 16 zred φ ψ B
18 1 2 3 4sqlem6 φ M 2 B B < M 2
19 18 adantr φ ψ M 2 B B < M 2
20 19 simprd φ ψ B < M 2
21 17 20 ltned φ ψ B M 2
22 21 neneqd φ ψ ¬ B = M 2
23 2cnd φ ψ 2
24 23 sqvald φ ψ 2 2 = 2 2
25 24 oveq2d φ ψ M 2 2 2 = M 2 2 2
26 5 nncnd φ ψ M
27 2ne0 2 0
28 27 a1i φ ψ 2 0
29 26 23 28 sqdivd φ ψ M 2 2 = M 2 2 2
30 26 sqcld φ ψ M 2
31 30 23 23 28 28 divdiv1d φ ψ M 2 2 2 = M 2 2 2
32 25 29 31 3eqtr4d φ ψ M 2 2 = M 2 2 2
33 30 halfcld φ ψ M 2 2
34 33 halfcld φ ψ M 2 2 2
35 16 zcnd φ ψ B
36 35 sqcld φ ψ B 2
37 34 36 4 subeq0d φ ψ M 2 2 2 = B 2
38 32 37 eqtr2d φ ψ B 2 = M 2 2
39 sqeqor B M 2 B 2 = M 2 2 B = M 2 B = M 2
40 35 12 39 syl2anc φ ψ B 2 = M 2 2 B = M 2 B = M 2
41 38 40 mpbid φ ψ B = M 2 B = M 2
42 41 ord φ ψ ¬ B = M 2 B = M 2
43 22 42 mpd φ ψ B = M 2
44 43 16 eqeltrrd φ ψ M 2
45 44 znegcld φ ψ M 2
46 13 45 eqeltrrd φ ψ M 2
47 9 46 zaddcld φ ψ A + M 2
48 zsqcl A + M 2 A + M 2 2
49 47 48 syl φ ψ A + M 2 2
50 47 6 zmulcld φ ψ A + M 2 M
51 47 zred φ ψ A + M 2
52 5 nnrpd φ ψ M +
53 51 52 modcld φ ψ A + M 2 mod M
54 53 recnd φ ψ A + M 2 mod M
55 0cnd φ ψ 0
56 df-neg M 2 = 0 M 2
57 43 3 56 3eqtr3g φ ψ A + M 2 mod M M 2 = 0 M 2
58 54 55 12 57 subcan2d φ ψ A + M 2 mod M = 0
59 dvdsval3 M A + M 2 M A + M 2 A + M 2 mod M = 0
60 5 47 59 syl2anc φ ψ M A + M 2 A + M 2 mod M = 0
61 58 60 mpbird φ ψ M A + M 2
62 dvdssq M A + M 2 M A + M 2 M 2 A + M 2 2
63 6 47 62 syl2anc φ ψ M A + M 2 M 2 A + M 2 2
64 61 63 mpbid φ ψ M 2 A + M 2 2
65 26 sqvald φ ψ M 2 = M M
66 5 nnne0d φ ψ M 0
67 dvdsmulcr M A + M 2 M M 0 M M A + M 2 M M A + M 2
68 6 47 6 66 67 syl112anc φ ψ M M A + M 2 M M A + M 2
69 61 68 mpbird φ ψ M M A + M 2 M
70 65 69 eqbrtrd φ ψ M 2 A + M 2 M
71 8 49 50 64 70 dvds2subd φ ψ M 2 A + M 2 2 A + M 2 M
72 47 zcnd φ ψ A + M 2
73 72 sqvald φ ψ A + M 2 2 = A + M 2 A + M 2
74 73 oveq1d φ ψ A + M 2 2 A + M 2 M = A + M 2 A + M 2 A + M 2 M
75 72 72 26 subdid φ ψ A + M 2 A + M 2 - M = A + M 2 A + M 2 A + M 2 M
76 26 2halvesd φ ψ M 2 + M 2 = M
77 76 oveq2d φ ψ A + M 2 - M 2 + M 2 = A + M 2 - M
78 9 zcnd φ ψ A
79 78 12 12 pnpcan2d φ ψ A + M 2 - M 2 + M 2 = A M 2
80 77 79 eqtr3d φ ψ A + M 2 - M = A M 2
81 80 oveq2d φ ψ A + M 2 A + M 2 - M = A + M 2 A M 2
82 subsq A M 2 A 2 M 2 2 = A + M 2 A M 2
83 78 12 82 syl2anc φ ψ A 2 M 2 2 = A + M 2 A M 2
84 32 oveq2d φ ψ A 2 M 2 2 = A 2 M 2 2 2
85 81 83 84 3eqtr2d φ ψ A + M 2 A + M 2 - M = A 2 M 2 2 2
86 74 75 85 3eqtr2d φ ψ A + M 2 2 A + M 2 M = A 2 M 2 2 2
87 71 86 breqtrd φ ψ M 2 A 2 M 2 2 2