Database
ELEMENTARY NUMBER THEORY
Elementary prime number theory
Lagrange's four-square theorem
4sqlem10
Next ⟩
4sqlem1
Metamath Proof Explorer
Ascii
Unicode
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