Metamath Proof Explorer


Theorem 4sqlem14

Description: Lemma for 4sq . (Contributed by Mario Carneiro, 16-Jul-2014) (Revised by AV, 14-Sep-2020)

Ref Expression
Hypotheses 4sq.1 S = n | x y z w n = x 2 + y 2 + z 2 + w 2
4sq.2 φ N
4sq.3 φ P = 2 N + 1
4sq.4 φ P
4sq.5 φ 0 2 N S
4sq.6 T = i | i P S
4sq.7 M = sup T <
4sq.m φ M 2
4sq.a φ A
4sq.b φ B
4sq.c φ C
4sq.d φ D
4sq.e E = A + M 2 mod M M 2
4sq.f F = B + M 2 mod M M 2
4sq.g G = C + M 2 mod M M 2
4sq.h H = D + M 2 mod M M 2
4sq.r R = E 2 + F 2 + G 2 + H 2 M
4sq.p φ M P = A 2 + B 2 + C 2 + D 2
Assertion 4sqlem14 φ R 0

Proof

Step Hyp Ref Expression
1 4sq.1 S = n | x y z w n = x 2 + y 2 + z 2 + w 2
2 4sq.2 φ N
3 4sq.3 φ P = 2 N + 1
4 4sq.4 φ P
5 4sq.5 φ 0 2 N S
6 4sq.6 T = i | i P S
7 4sq.7 M = sup T <
8 4sq.m φ M 2
9 4sq.a φ A
10 4sq.b φ B
11 4sq.c φ C
12 4sq.d φ D
13 4sq.e E = A + M 2 mod M M 2
14 4sq.f F = B + M 2 mod M M 2
15 4sq.g G = C + M 2 mod M M 2
16 4sq.h H = D + M 2 mod M M 2
17 4sq.r R = E 2 + F 2 + G 2 + H 2 M
18 4sq.p φ M P = A 2 + B 2 + C 2 + D 2
19 6 ssrab3 T
20 nnuz = 1
21 19 20 sseqtri T 1
22 1 2 3 4 5 6 7 4sqlem13 φ T M < P
23 22 simpld φ T
24 infssuzcl T 1 T sup T < T
25 21 23 24 sylancr φ sup T < T
26 7 25 eqeltrid φ M T
27 19 26 sselid φ M
28 27 nnzd φ M
29 prmz P P
30 4 29 syl φ P
31 28 30 zmulcld φ M P
32 9 27 13 4sqlem5 φ E A E M
33 32 simpld φ E
34 zsqcl2 E E 2 0
35 33 34 syl φ E 2 0
36 10 27 14 4sqlem5 φ F B F M
37 36 simpld φ F
38 zsqcl2 F F 2 0
39 37 38 syl φ F 2 0
40 35 39 nn0addcld φ E 2 + F 2 0
41 40 nn0zd φ E 2 + F 2
42 11 27 15 4sqlem5 φ G C G M
43 42 simpld φ G
44 zsqcl2 G G 2 0
45 43 44 syl φ G 2 0
46 12 27 16 4sqlem5 φ H D H M
47 46 simpld φ H
48 zsqcl2 H H 2 0
49 47 48 syl φ H 2 0
50 45 49 nn0addcld φ G 2 + H 2 0
51 50 nn0zd φ G 2 + H 2
52 41 51 zaddcld φ E 2 + F 2 + G 2 + H 2
53 31 52 zsubcld φ M P E 2 + F 2 + G 2 + H 2
54 dvdsmul1 M P M M P
55 28 30 54 syl2anc φ M M P
56 zsqcl A A 2
57 9 56 syl φ A 2
58 zsqcl B B 2
59 10 58 syl φ B 2
60 57 59 zaddcld φ A 2 + B 2
61 60 41 zsubcld φ A 2 + B 2 - E 2 + F 2
62 zsqcl C C 2
63 11 62 syl φ C 2
64 zsqcl D D 2
65 12 64 syl φ D 2
66 63 65 zaddcld φ C 2 + D 2
67 66 51 zsubcld φ C 2 + D 2 - G 2 + H 2
68 35 nn0zd φ E 2
69 57 68 zsubcld φ A 2 E 2
70 39 nn0zd φ F 2
71 59 70 zsubcld φ B 2 F 2
72 9 27 13 4sqlem8 φ M A 2 E 2
73 10 27 14 4sqlem8 φ M B 2 F 2
74 28 69 71 72 73 dvds2addd φ M A 2 E 2 + B 2 - F 2
75 9 zcnd φ A
76 75 sqcld φ A 2
77 10 zcnd φ B
78 77 sqcld φ B 2
79 33 zcnd φ E
80 79 sqcld φ E 2
81 37 zcnd φ F
82 81 sqcld φ F 2
83 76 78 80 82 addsub4d φ A 2 + B 2 - E 2 + F 2 = A 2 E 2 + B 2 - F 2
84 74 83 breqtrrd φ M A 2 + B 2 - E 2 + F 2
85 45 nn0zd φ G 2
86 63 85 zsubcld φ C 2 G 2
87 49 nn0zd φ H 2
88 65 87 zsubcld φ D 2 H 2
89 11 27 15 4sqlem8 φ M C 2 G 2
90 12 27 16 4sqlem8 φ M D 2 H 2
91 28 86 88 89 90 dvds2addd φ M C 2 G 2 + D 2 - H 2
92 11 zcnd φ C
93 92 sqcld φ C 2
94 12 zcnd φ D
95 94 sqcld φ D 2
96 43 zcnd φ G
97 96 sqcld φ G 2
98 47 zcnd φ H
99 98 sqcld φ H 2
100 93 95 97 99 addsub4d φ C 2 + D 2 - G 2 + H 2 = C 2 G 2 + D 2 - H 2
101 91 100 breqtrrd φ M C 2 + D 2 - G 2 + H 2
102 28 61 67 84 101 dvds2addd φ M A 2 + B 2 - E 2 + F 2 + C 2 + D 2 - G 2 + H 2
103 18 oveq1d φ M P E 2 + F 2 + G 2 + H 2 = A 2 + B 2 + C 2 + D 2 - E 2 + F 2 + G 2 + H 2
104 76 78 addcld φ A 2 + B 2
105 93 95 addcld φ C 2 + D 2
106 80 82 addcld φ E 2 + F 2
107 97 99 addcld φ G 2 + H 2
108 104 105 106 107 addsub4d φ A 2 + B 2 + C 2 + D 2 - E 2 + F 2 + G 2 + H 2 = A 2 + B 2 - E 2 + F 2 + C 2 + D 2 - G 2 + H 2
109 103 108 eqtrd φ M P E 2 + F 2 + G 2 + H 2 = A 2 + B 2 - E 2 + F 2 + C 2 + D 2 - G 2 + H 2
110 102 109 breqtrrd φ M M P E 2 + F 2 + G 2 + H 2
111 28 31 53 55 110 dvds2subd φ M M P M P E 2 + F 2 + G 2 + H 2
112 27 nncnd φ M
113 prmnn P P
114 4 113 syl φ P
115 114 nncnd φ P
116 112 115 mulcld φ M P
117 106 107 addcld φ E 2 + F 2 + G 2 + H 2
118 116 117 nncand φ M P M P E 2 + F 2 + G 2 + H 2 = E 2 + F 2 + G 2 + H 2
119 111 118 breqtrd φ M E 2 + F 2 + G 2 + H 2
120 27 nnne0d φ M 0
121 40 50 nn0addcld φ E 2 + F 2 + G 2 + H 2 0
122 121 nn0zd φ E 2 + F 2 + G 2 + H 2
123 dvdsval2 M M 0 E 2 + F 2 + G 2 + H 2 M E 2 + F 2 + G 2 + H 2 E 2 + F 2 + G 2 + H 2 M
124 28 120 122 123 syl3anc φ M E 2 + F 2 + G 2 + H 2 E 2 + F 2 + G 2 + H 2 M
125 119 124 mpbid φ E 2 + F 2 + G 2 + H 2 M
126 121 nn0red φ E 2 + F 2 + G 2 + H 2
127 121 nn0ge0d φ 0 E 2 + F 2 + G 2 + H 2
128 27 nnred φ M
129 27 nngt0d φ 0 < M
130 divge0 E 2 + F 2 + G 2 + H 2 0 E 2 + F 2 + G 2 + H 2 M 0 < M 0 E 2 + F 2 + G 2 + H 2 M
131 126 127 128 129 130 syl22anc φ 0 E 2 + F 2 + G 2 + H 2 M
132 elnn0z E 2 + F 2 + G 2 + H 2 M 0 E 2 + F 2 + G 2 + H 2 M 0 E 2 + F 2 + G 2 + H 2 M
133 125 131 132 sylanbrc φ E 2 + F 2 + G 2 + H 2 M 0
134 17 133 eqeltrid φ R 0