Metamath Proof Explorer


Theorem mul2sq

Description: Fibonacci's identity (actually due to Diophantus). The product of two sums of two squares is also a sum of two squares. We can take advantage of Gaussian integers here to trivialize the proof. (Contributed by Mario Carneiro, 19-Jun-2015)

Ref Expression
Hypothesis 2sq.1 ⊢ S = ran ⁡ w ∈ ℤ i ⟼ w 2
Assertion mul2sq ⊢ A ∈ S ∧ B ∈ S → A ⁢ B ∈ S

Proof

Step Hyp Ref Expression
1 2sq.1 ⊢ S = ran ⁡ w ∈ ℤ i ⟼ w 2
2 1 2sqlem1 ⊢ A ∈ S ↔ ∃ x ∈ ℤ i A = x 2
3 1 2sqlem1 ⊢ B ∈ S ↔ ∃ y ∈ ℤ i B = y 2
4 reeanv ⊢ ∃ x ∈ ℤ i ∃ y ∈ ℤ i A = x 2 ∧ B = y 2 ↔ ∃ x ∈ ℤ i A = x 2 ∧ ∃ y ∈ ℤ i B = y 2
5 gzmulcl ⊢ x ∈ ℤ i ∧ y ∈ ℤ i → x ⁢ y ∈ ℤ i
6 gzcn ⊢ x ∈ ℤ i → x ∈ ℂ
7 gzcn ⊢ y ∈ ℤ i → y ∈ ℂ
8 absmul ⊢ x ∈ ℂ ∧ y ∈ ℂ → x ⁢ y = x ⁢ y
9 6 7 8 syl2an ⊢ x ∈ ℤ i ∧ y ∈ ℤ i → x ⁢ y = x ⁢ y
10 9 oveq1d ⊢ x ∈ ℤ i ∧ y ∈ ℤ i → x ⁢ y 2 = x ⁢ y 2
11 6 abscld ⊢ x ∈ ℤ i → x ∈ ℝ
12 11 recnd ⊢ x ∈ ℤ i → x ∈ ℂ
13 7 abscld ⊢ y ∈ ℤ i → y ∈ ℝ
14 13 recnd ⊢ y ∈ ℤ i → y ∈ ℂ
15 sqmul ⊢ x ∈ ℂ ∧ y ∈ ℂ → x ⁢ y 2 = x 2 ⁢ y 2
16 12 14 15 syl2an ⊢ x ∈ ℤ i ∧ y ∈ ℤ i → x ⁢ y 2 = x 2 ⁢ y 2
17 10 16 eqtr2d ⊢ x ∈ ℤ i ∧ y ∈ ℤ i → x 2 ⁢ y 2 = x ⁢ y 2
18 fveq2 ⊢ z = x ⁢ y → z = x ⁢ y
19 18 oveq1d ⊢ z = x ⁢ y → z 2 = x ⁢ y 2
20 19 rspceeqv ⊢ x ⁢ y ∈ ℤ i ∧ x 2 ⁢ y 2 = x ⁢ y 2 → ∃ z ∈ ℤ i x 2 ⁢ y 2 = z 2
21 5 17 20 syl2anc ⊢ x ∈ ℤ i ∧ y ∈ ℤ i → ∃ z ∈ ℤ i x 2 ⁢ y 2 = z 2
22 1 2sqlem1 ⊢ x 2 ⁢ y 2 ∈ S ↔ ∃ z ∈ ℤ i x 2 ⁢ y 2 = z 2
23 21 22 sylibr ⊢ x ∈ ℤ i ∧ y ∈ ℤ i → x 2 ⁢ y 2 ∈ S
24 oveq12 ⊢ A = x 2 ∧ B = y 2 → A ⁢ B = x 2 ⁢ y 2
25 24 eleq1d ⊢ A = x 2 ∧ B = y 2 → A ⁢ B ∈ S ↔ x 2 ⁢ y 2 ∈ S
26 23 25 syl5ibrcom ⊢ x ∈ ℤ i ∧ y ∈ ℤ i → A = x 2 ∧ B = y 2 → A ⁢ B ∈ S
27 26 rexlimivv ⊢ ∃ x ∈ ℤ i ∃ y ∈ ℤ i A = x 2 ∧ B = y 2 → A ⁢ B ∈ S
28 4 27 sylbir ⊢ ∃ x ∈ ℤ i A = x 2 ∧ ∃ y ∈ ℤ i B = y 2 → A ⁢ B ∈ S
29 2 3 28 syl2anb ⊢ A ∈ S ∧ B ∈ S → A ⁢ B ∈ S