Metamath Proof Explorer


Theorem pcz

Description: The prime count function can be used as an indicator that a given rational number is an integer. (Contributed by Mario Carneiro, 23-Feb-2014)

Ref Expression
Assertion pcz ⊢ A ∈ ℚ → A ∈ ℤ ↔ ∀ p ∈ ℙ 0 ≤ p pCnt A

Proof

Step Hyp Ref Expression
1 pcge0 ⊢ p ∈ ℙ ∧ A ∈ ℤ → 0 ≤ p pCnt A
2 1 ancoms ⊢ A ∈ ℤ ∧ p ∈ ℙ → 0 ≤ p pCnt A
3 2 ralrimiva ⊢ A ∈ ℤ → ∀ p ∈ ℙ 0 ≤ p pCnt A
4 elq ⊢ A ∈ ℚ ↔ ∃ x ∈ ℤ ∃ y ∈ ℕ A = x y
5 nnz ⊢ y ∈ ℕ → y ∈ ℤ
6 dvds0 ⊢ y ∈ ℤ → y ∥ 0
7 5 6 syl ⊢ y ∈ ℕ → y ∥ 0
8 7 ad2antlr ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x = 0 → y ∥ 0
9 simpr ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x = 0 → x = 0
10 8 9 breqtrrd ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x = 0 → y ∥ x
11 10 a1d ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x = 0 → ∀ p ∈ ℙ 0 ≤ p pCnt x y → y ∥ x
12 simpr ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x ≠ 0 ∧ p ∈ ℙ → p ∈ ℙ
13 simplll ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x ≠ 0 ∧ p ∈ ℙ → x ∈ ℤ
14 simplr ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x ≠ 0 ∧ p ∈ ℙ → x ≠ 0
15 simpllr ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x ≠ 0 ∧ p ∈ ℙ → y ∈ ℕ
16 pcdiv ⊢ p ∈ ℙ ∧ x ∈ ℤ ∧ x ≠ 0 ∧ y ∈ ℕ → p pCnt x y = p pCnt x − p pCnt y
17 12 13 14 15 16 syl121anc ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x ≠ 0 ∧ p ∈ ℙ → p pCnt x y = p pCnt x − p pCnt y
18 17 breq2d ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x ≠ 0 ∧ p ∈ ℙ → 0 ≤ p pCnt x y ↔ 0 ≤ p pCnt x − p pCnt y
19 pczcl ⊢ p ∈ ℙ ∧ x ∈ ℤ ∧ x ≠ 0 → p pCnt x ∈ ℕ 0
20 12 13 14 19 syl12anc ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x ≠ 0 ∧ p ∈ ℙ → p pCnt x ∈ ℕ 0
21 20 nn0red ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x ≠ 0 ∧ p ∈ ℙ → p pCnt x ∈ ℝ
22 12 15 pccld ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x ≠ 0 ∧ p ∈ ℙ → p pCnt y ∈ ℕ 0
23 22 nn0red ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x ≠ 0 ∧ p ∈ ℙ → p pCnt y ∈ ℝ
24 21 23 subge0d ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x ≠ 0 ∧ p ∈ ℙ → 0 ≤ p pCnt x − p pCnt y ↔ p pCnt y ≤ p pCnt x
25 18 24 bitrd ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x ≠ 0 ∧ p ∈ ℙ → 0 ≤ p pCnt x y ↔ p pCnt y ≤ p pCnt x
26 25 ralbidva ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x ≠ 0 → ∀ p ∈ ℙ 0 ≤ p pCnt x y ↔ ∀ p ∈ ℙ p pCnt y ≤ p pCnt x
27 id ⊢ x ∈ ℤ → x ∈ ℤ
28 pc2dvds ⊢ y ∈ ℤ ∧ x ∈ ℤ → y ∥ x ↔ ∀ p ∈ ℙ p pCnt y ≤ p pCnt x
29 5 27 28 syl2anr ⊢ x ∈ ℤ ∧ y ∈ ℕ → y ∥ x ↔ ∀ p ∈ ℙ p pCnt y ≤ p pCnt x
30 29 adantr ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x ≠ 0 → y ∥ x ↔ ∀ p ∈ ℙ p pCnt y ≤ p pCnt x
31 26 30 bitr4d ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x ≠ 0 → ∀ p ∈ ℙ 0 ≤ p pCnt x y ↔ y ∥ x
32 31 biimpd ⊢ x ∈ ℤ ∧ y ∈ ℕ ∧ x ≠ 0 → ∀ p ∈ ℙ 0 ≤ p pCnt x y → y ∥ x
33 11 32 pm2.61dane ⊢ x ∈ ℤ ∧ y ∈ ℕ → ∀ p ∈ ℙ 0 ≤ p pCnt x y → y ∥ x
34 nnne0 ⊢ y ∈ ℕ → y ≠ 0
35 simpl ⊢ x ∈ ℤ ∧ y ∈ ℕ → x ∈ ℤ
36 dvdsval2 ⊢ y ∈ ℤ ∧ y ≠ 0 ∧ x ∈ ℤ → y ∥ x ↔ x y ∈ ℤ
37 5 34 35 36 syl2an23an ⊢ x ∈ ℤ ∧ y ∈ ℕ → y ∥ x ↔ x y ∈ ℤ
38 33 37 sylibd ⊢ x ∈ ℤ ∧ y ∈ ℕ → ∀ p ∈ ℙ 0 ≤ p pCnt x y → x y ∈ ℤ
39 oveq2 ⊢ A = x y → p pCnt A = p pCnt x y
40 39 breq2d ⊢ A = x y → 0 ≤ p pCnt A ↔ 0 ≤ p pCnt x y
41 40 ralbidv ⊢ A = x y → ∀ p ∈ ℙ 0 ≤ p pCnt A ↔ ∀ p ∈ ℙ 0 ≤ p pCnt x y
42 eleq1 ⊢ A = x y → A ∈ ℤ ↔ x y ∈ ℤ
43 41 42 imbi12d ⊢ A = x y → ∀ p ∈ ℙ 0 ≤ p pCnt A → A ∈ ℤ ↔ ∀ p ∈ ℙ 0 ≤ p pCnt x y → x y ∈ ℤ
44 38 43 syl5ibrcom ⊢ x ∈ ℤ ∧ y ∈ ℕ → A = x y → ∀ p ∈ ℙ 0 ≤ p pCnt A → A ∈ ℤ
45 44 rexlimivv ⊢ ∃ x ∈ ℤ ∃ y ∈ ℕ A = x y → ∀ p ∈ ℙ 0 ≤ p pCnt A → A ∈ ℤ
46 4 45 sylbi ⊢ A ∈ ℚ → ∀ p ∈ ℙ 0 ≤ p pCnt A → A ∈ ℤ
47 3 46 impbid2 ⊢ A ∈ ℚ → A ∈ ℤ ↔ ∀ p ∈ ℙ 0 ≤ p pCnt A