Metamath Proof Explorer


Theorem lgsqrmodndvds

Description: If the Legendre symbol of an integer A for an odd prime is 1 , then the number is a quadratic residue mod P with a solution x of the congruence ( x ^ 2 ) == A (mod P ) which is not divisible by the prime. (Contributed by AV, 20-Aug-2021) (Proof shortened by AV, 18-Mar-2022)

Ref Expression
Assertion lgsqrmodndvds ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 → A / L P = 1 → ∃ x ∈ ℤ x 2 mod P = A mod P ∧ ¬ P ∥ x

Proof

Step Hyp Ref Expression
1 lgsqrmod ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 → A / L P = 1 → ∃ x ∈ ℤ x 2 mod P = A mod P
2 1 imp ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 → ∃ x ∈ ℤ x 2 mod P = A mod P
3 eldifi ⊢ P ∈ ℙ ∖ 2 → P ∈ ℙ
4 prmnn ⊢ P ∈ ℙ → P ∈ ℕ
5 3 4 syl ⊢ P ∈ ℙ ∖ 2 → P ∈ ℕ
6 5 ad3antlr ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → P ∈ ℕ
7 zsqcl ⊢ x ∈ ℤ → x 2 ∈ ℤ
8 7 adantl ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → x 2 ∈ ℤ
9 simplll ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → A ∈ ℤ
10 moddvds ⊢ P ∈ ℕ ∧ x 2 ∈ ℤ ∧ A ∈ ℤ → x 2 mod P = A mod P ↔ P ∥ x 2 − A
11 6 8 9 10 syl3anc ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → x 2 mod P = A mod P ↔ P ∥ x 2 − A
12 5 nnzd ⊢ P ∈ ℙ ∖ 2 → P ∈ ℤ
13 12 ad3antlr ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → P ∈ ℤ
14 13 8 9 3jca ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → P ∈ ℤ ∧ x 2 ∈ ℤ ∧ A ∈ ℤ
15 14 adantl ⊢ P ∥ x ∧ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → P ∈ ℤ ∧ x 2 ∈ ℤ ∧ A ∈ ℤ
16 dvdssub2 ⊢ P ∈ ℤ ∧ x 2 ∈ ℤ ∧ A ∈ ℤ ∧ P ∥ x 2 − A → P ∥ x 2 ↔ P ∥ A
17 15 16 sylan ⊢ P ∥ x ∧ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ ∧ P ∥ x 2 − A → P ∥ x 2 ↔ P ∥ A
18 17 ex ⊢ P ∥ x ∧ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → P ∥ x 2 − A → P ∥ x 2 ↔ P ∥ A
19 bicom ⊢ P ∥ x 2 ↔ P ∥ A ↔ P ∥ A ↔ P ∥ x 2
20 3 ad3antlr ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → P ∈ ℙ
21 simpr ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → x ∈ ℤ
22 2nn ⊢ 2 ∈ ℕ
23 22 a1i ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → 2 ∈ ℕ
24 prmdvdsexp ⊢ P ∈ ℙ ∧ x ∈ ℤ ∧ 2 ∈ ℕ → P ∥ x 2 ↔ P ∥ x
25 20 21 23 24 syl3anc ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → P ∥ x 2 ↔ P ∥ x
26 25 biimparc ⊢ P ∥ x ∧ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → P ∥ x 2
27 bianir ⊢ P ∥ x 2 ∧ P ∥ A ↔ P ∥ x 2 → P ∥ A
28 5 ad2antlr ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 → P ∈ ℕ
29 dvdsmod0 ⊢ P ∈ ℕ ∧ P ∥ A → A mod P = 0
30 29 ex ⊢ P ∈ ℕ → P ∥ A → A mod P = 0
31 28 30 syl ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 → P ∥ A → A mod P = 0
32 lgsprme0 ⊢ A ∈ ℤ ∧ P ∈ ℙ → A / L P = 0 ↔ A mod P = 0
33 3 32 sylan2 ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 → A / L P = 0 ↔ A mod P = 0
34 eqeq1 ⊢ A / L P = 0 → A / L P = 1 ↔ 0 = 1
35 0ne1 ⊢ 0 ≠ 1
36 eqneqall ⊢ 0 = 1 → 0 ≠ 1 → ¬ P ∥ x
37 35 36 mpi ⊢ 0 = 1 → ¬ P ∥ x
38 34 37 biimtrdi ⊢ A / L P = 0 → A / L P = 1 → ¬ P ∥ x
39 33 38 biimtrrdi ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 → A mod P = 0 → A / L P = 1 → ¬ P ∥ x
40 39 com23 ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 → A / L P = 1 → A mod P = 0 → ¬ P ∥ x
41 40 imp ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 → A mod P = 0 → ¬ P ∥ x
42 31 41 syld ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 → P ∥ A → ¬ P ∥ x
43 42 ad2antrl ⊢ P ∥ x ∧ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → P ∥ A → ¬ P ∥ x
44 27 43 syl5com ⊢ P ∥ x 2 ∧ P ∥ A ↔ P ∥ x 2 → P ∥ x ∧ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → ¬ P ∥ x
45 44 ex ⊢ P ∥ x 2 → P ∥ A ↔ P ∥ x 2 → P ∥ x ∧ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → ¬ P ∥ x
46 45 com23 ⊢ P ∥ x 2 → P ∥ x ∧ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → P ∥ A ↔ P ∥ x 2 → ¬ P ∥ x
47 26 46 mpcom ⊢ P ∥ x ∧ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → P ∥ A ↔ P ∥ x 2 → ¬ P ∥ x
48 19 47 biimtrid ⊢ P ∥ x ∧ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → P ∥ x 2 ↔ P ∥ A → ¬ P ∥ x
49 18 48 syld ⊢ P ∥ x ∧ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → P ∥ x 2 − A → ¬ P ∥ x
50 49 ex ⊢ P ∥ x → A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → P ∥ x 2 − A → ¬ P ∥ x
51 2a1 ⊢ ¬ P ∥ x → A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → P ∥ x 2 − A → ¬ P ∥ x
52 50 51 pm2.61i ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → P ∥ x 2 − A → ¬ P ∥ x
53 11 52 sylbid ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → x 2 mod P = A mod P → ¬ P ∥ x
54 53 ancld ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 ∧ x ∈ ℤ → x 2 mod P = A mod P → x 2 mod P = A mod P ∧ ¬ P ∥ x
55 54 reximdva ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 → ∃ x ∈ ℤ x 2 mod P = A mod P → ∃ x ∈ ℤ x 2 mod P = A mod P ∧ ¬ P ∥ x
56 2 55 mpd ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 ∧ A / L P = 1 → ∃ x ∈ ℤ x 2 mod P = A mod P ∧ ¬ P ∥ x
57 56 ex ⊢ A ∈ ℤ ∧ P ∈ ℙ ∖ 2 → A / L P = 1 → ∃ x ∈ ℤ x 2 mod P = A mod P ∧ ¬ P ∥ x