Metamath Proof Explorer


Theorem 2sqlem3

Description: Lemma for 2sqlem5 . (Contributed by Mario Carneiro, 20-Jun-2015)

Ref Expression
Hypotheses 2sq.1 S = ran w i w 2
2sqlem5.1 φ N
2sqlem5.2 φ P
2sqlem4.3 φ A
2sqlem4.4 φ B
2sqlem4.5 φ C
2sqlem4.6 φ D
2sqlem4.7 φ N P = A 2 + B 2
2sqlem4.8 φ P = C 2 + D 2
2sqlem4.9 φ P C B + A D
Assertion 2sqlem3 φ N S

Proof

Step Hyp Ref Expression
1 2sq.1 S = ran w i w 2
2 2sqlem5.1 φ N
3 2sqlem5.2 φ P
4 2sqlem4.3 φ A
5 2sqlem4.4 φ B
6 2sqlem4.5 φ C
7 2sqlem4.6 φ D
8 2sqlem4.7 φ N P = A 2 + B 2
9 2sqlem4.8 φ P = C 2 + D 2
10 2sqlem4.9 φ P C B + A D
11 gzreim A B A + i B i
12 4 5 11 syl2anc φ A + i B i
13 gzreim C D C + i D i
14 6 7 13 syl2anc φ C + i D i
15 gzmulcl A + i B i C + i D i A + i B C + i D i
16 12 14 15 syl2anc φ A + i B C + i D i
17 gzcn A + i B C + i D i A + i B C + i D
18 16 17 syl φ A + i B C + i D
19 prmnn P P
20 3 19 syl φ P
21 20 nncnd φ P
22 20 nnne0d φ P 0
23 18 21 22 divcld φ A + i B C + i D P
24 20 nnred φ P
25 24 18 22 redivd φ A + i B C + i D P = A + i B C + i D P
26 prmz P P
27 3 26 syl φ P
28 zsqcl P P 2
29 27 28 syl φ P 2
30 2 nnzd φ N
31 30 29 zmulcld φ N P 2
32 dvdsmul2 P P P P P
33 27 27 32 syl2anc φ P P P
34 21 sqvald φ P 2 = P P
35 33 34 breqtrrd φ P P 2
36 dvdsmul2 N P 2 P 2 N P 2
37 30 29 36 syl2anc φ P 2 N P 2
38 27 29 31 35 37 dvdstrd φ P N P 2
39 gzcn A + i B i A + i B
40 12 39 syl φ A + i B
41 40 abscld φ A + i B
42 41 recnd φ A + i B
43 gzcn C + i D i C + i D
44 14 43 syl φ C + i D
45 44 abscld φ C + i D
46 45 recnd φ C + i D
47 42 46 sqmuld φ A + i B C + i D 2 = A + i B 2 C + i D 2
48 4 zred φ A
49 5 zred φ B
50 48 49 crred φ A + i B = A
51 50 oveq1d φ A + i B 2 = A 2
52 48 49 crimd φ A + i B = B
53 52 oveq1d φ A + i B 2 = B 2
54 51 53 oveq12d φ A + i B 2 + A + i B 2 = A 2 + B 2
55 40 absvalsq2d φ A + i B 2 = A + i B 2 + A + i B 2
56 54 55 8 3eqtr4d φ A + i B 2 = N P
57 6 zred φ C
58 7 zred φ D
59 57 58 crred φ C + i D = C
60 59 oveq1d φ C + i D 2 = C 2
61 57 58 crimd φ C + i D = D
62 61 oveq1d φ C + i D 2 = D 2
63 60 62 oveq12d φ C + i D 2 + C + i D 2 = C 2 + D 2
64 44 absvalsq2d φ C + i D 2 = C + i D 2 + C + i D 2
65 63 64 9 3eqtr4d φ C + i D 2 = P
66 56 65 oveq12d φ A + i B 2 C + i D 2 = N P P
67 2 nncnd φ N
68 67 21 21 mulassd φ N P P = N P P
69 47 66 68 3eqtrd φ A + i B C + i D 2 = N P P
70 40 44 absmuld φ A + i B C + i D = A + i B C + i D
71 70 oveq1d φ A + i B C + i D 2 = A + i B C + i D 2
72 34 oveq2d φ N P 2 = N P P
73 69 71 72 3eqtr4d φ A + i B C + i D 2 = N P 2
74 38 73 breqtrrd φ P A + i B C + i D 2
75 18 absvalsq2d φ A + i B C + i D 2 = A + i B C + i D 2 + A + i B C + i D 2
76 elgz A + i B C + i D i A + i B C + i D A + i B C + i D A + i B C + i D
77 76 simp2bi A + i B C + i D i A + i B C + i D
78 16 77 syl φ A + i B C + i D
79 zsqcl A + i B C + i D A + i B C + i D 2
80 78 79 syl φ A + i B C + i D 2
81 80 zcnd φ A + i B C + i D 2
82 76 simp3bi A + i B C + i D i A + i B C + i D
83 16 82 syl φ A + i B C + i D
84 zsqcl A + i B C + i D A + i B C + i D 2
85 83 84 syl φ A + i B C + i D 2
86 85 zcnd φ A + i B C + i D 2
87 81 86 addcomd φ A + i B C + i D 2 + A + i B C + i D 2 = A + i B C + i D 2 + A + i B C + i D 2
88 75 87 eqtrd φ A + i B C + i D 2 = A + i B C + i D 2 + A + i B C + i D 2
89 74 88 breqtrd φ P A + i B C + i D 2 + A + i B C + i D 2
90 6 zcnd φ C
91 5 zcnd φ B
92 90 91 mulcld φ C B
93 4 zcnd φ A
94 7 zcnd φ D
95 93 94 mulcld φ A D
96 92 95 addcomd φ C B + A D = A D + C B
97 90 91 mulcomd φ C B = B C
98 97 oveq2d φ A D + C B = A D + B C
99 96 98 eqtrd φ C B + A D = A D + B C
100 10 99 breqtrd φ P A D + B C
101 40 44 immuld φ A + i B C + i D = A + i B C + i D + A + i B C + i D
102 50 61 oveq12d φ A + i B C + i D = A D
103 52 59 oveq12d φ A + i B C + i D = B C
104 102 103 oveq12d φ A + i B C + i D + A + i B C + i D = A D + B C
105 101 104 eqtrd φ A + i B C + i D = A D + B C
106 100 105 breqtrrd φ P A + i B C + i D
107 2nn 2
108 107 a1i φ 2
109 prmdvdsexp P A + i B C + i D 2 P A + i B C + i D 2 P A + i B C + i D
110 3 83 108 109 syl3anc φ P A + i B C + i D 2 P A + i B C + i D
111 106 110 mpbird φ P A + i B C + i D 2
112 dvdsadd2b P A + i B C + i D 2 A + i B C + i D 2 P A + i B C + i D 2 P A + i B C + i D 2 P A + i B C + i D 2 + A + i B C + i D 2
113 27 80 85 111 112 syl112anc φ P A + i B C + i D 2 P A + i B C + i D 2 + A + i B C + i D 2
114 89 113 mpbird φ P A + i B C + i D 2
115 prmdvdsexp P A + i B C + i D 2 P A + i B C + i D 2 P A + i B C + i D
116 3 78 108 115 syl3anc φ P A + i B C + i D 2 P A + i B C + i D
117 114 116 mpbid φ P A + i B C + i D
118 dvdsval2 P P 0 A + i B C + i D P A + i B C + i D A + i B C + i D P
119 27 22 78 118 syl3anc φ P A + i B C + i D A + i B C + i D P
120 117 119 mpbid φ A + i B C + i D P
121 25 120 eqeltrd φ A + i B C + i D P
122 24 18 22 imdivd φ A + i B C + i D P = A + i B C + i D P
123 dvdsval2 P P 0 A + i B C + i D P A + i B C + i D A + i B C + i D P
124 27 22 83 123 syl3anc φ P A + i B C + i D A + i B C + i D P
125 106 124 mpbid φ A + i B C + i D P
126 122 125 eqeltrd φ A + i B C + i D P
127 elgz A + i B C + i D P i A + i B C + i D P A + i B C + i D P A + i B C + i D P
128 23 121 126 127 syl3anbrc φ A + i B C + i D P i
129 18 21 22 absdivd φ A + i B C + i D P = A + i B C + i D P
130 20 nnnn0d φ P 0
131 130 nn0ge0d φ 0 P
132 24 131 absidd φ P = P
133 132 oveq2d φ A + i B C + i D P = A + i B C + i D P
134 129 133 eqtrd φ A + i B C + i D P = A + i B C + i D P
135 134 oveq1d φ A + i B C + i D P 2 = A + i B C + i D P 2
136 18 abscld φ A + i B C + i D
137 136 recnd φ A + i B C + i D
138 137 21 22 sqdivd φ A + i B C + i D P 2 = A + i B C + i D 2 P 2
139 73 oveq1d φ A + i B C + i D 2 P 2 = N P 2 P 2
140 20 nnsqcld φ P 2
141 140 nncnd φ P 2
142 140 nnne0d φ P 2 0
143 67 141 142 divcan4d φ N P 2 P 2 = N
144 139 143 eqtrd φ A + i B C + i D 2 P 2 = N
145 135 138 144 3eqtrrd φ N = A + i B C + i D P 2
146 fveq2 x = A + i B C + i D P x = A + i B C + i D P
147 146 oveq1d x = A + i B C + i D P x 2 = A + i B C + i D P 2
148 147 rspceeqv A + i B C + i D P i N = A + i B C + i D P 2 x i N = x 2
149 128 145 148 syl2anc φ x i N = x 2
150 1 2sqlem1 N S x i N = x 2
151 149 150 sylibr φ N S