Metamath Proof Explorer


Theorem pc2dvds

Description: A characterization of divisibility in terms of prime count. (Contributed by Mario Carneiro, 23-Feb-2014) (Revised by Mario Carneiro, 3-Oct-2014)

Ref Expression
Assertion pc2dvds A B A B p p pCnt A p pCnt B

Proof

Step Hyp Ref Expression
1 pcdvdstr p A B A B p pCnt A p pCnt B
2 1 ancoms A B A B p p pCnt A p pCnt B
3 2 ralrimiva A B A B p p pCnt A p pCnt B
4 3 3expia A B A B p p pCnt A p pCnt B
5 oveq2 A = 0 p pCnt A = p pCnt 0
6 5 breq1d A = 0 p pCnt A p pCnt B p pCnt 0 p pCnt B
7 6 ralbidv A = 0 p p pCnt A p pCnt B p p pCnt 0 p pCnt B
8 breq1 A = 0 A B 0 B
9 7 8 imbi12d A = 0 p p pCnt A p pCnt B A B p p pCnt 0 p pCnt B 0 B
10 gcddvds A B A gcd B A A gcd B B
11 10 simpld A B A gcd B A
12 gcdcl A B A gcd B 0
13 12 nn0zd A B A gcd B
14 simpl A B A
15 dvdsabsb A gcd B A A gcd B A A gcd B A
16 13 14 15 syl2anc A B A gcd B A A gcd B A
17 11 16 mpbid A B A gcd B A
18 17 adantr A B A 0 A gcd B A
19 simpl A = 0 B = 0 A = 0
20 19 necon3ai A 0 ¬ A = 0 B = 0
21 gcdn0cl A B ¬ A = 0 B = 0 A gcd B
22 20 21 sylan2 A B A 0 A gcd B
23 22 nnzd A B A 0 A gcd B
24 22 nnne0d A B A 0 A gcd B 0
25 nnabscl A A 0 A
26 25 adantlr A B A 0 A
27 26 nnzd A B A 0 A
28 dvdsval2 A gcd B A gcd B 0 A A gcd B A A A gcd B
29 23 24 27 28 syl3anc A B A 0 A gcd B A A A gcd B
30 18 29 mpbid A B A 0 A A gcd B
31 nnre A A
32 nngt0 A 0 < A
33 31 32 jca A A 0 < A
34 nnre A gcd B A gcd B
35 nngt0 A gcd B 0 < A gcd B
36 34 35 jca A gcd B A gcd B 0 < A gcd B
37 divgt0 A 0 < A A gcd B 0 < A gcd B 0 < A A gcd B
38 33 36 37 syl2an A A gcd B 0 < A A gcd B
39 26 22 38 syl2anc A B A 0 0 < A A gcd B
40 elnnz A A gcd B A A gcd B 0 < A A gcd B
41 30 39 40 sylanbrc A B A 0 A A gcd B
42 elnn1uz2 A A gcd B A A gcd B = 1 A A gcd B 2
43 41 42 sylib A B A 0 A A gcd B = 1 A A gcd B 2
44 10 simprd A B A gcd B B
45 44 adantr A B A 0 A gcd B B
46 breq1 A gcd B = A A gcd B B A B
47 45 46 syl5ibcom A B A 0 A gcd B = A A B
48 26 nncnd A B A 0 A
49 22 nncnd A B A 0 A gcd B
50 1cnd A B A 0 1
51 48 49 50 24 divmuld A B A 0 A A gcd B = 1 A gcd B 1 = A
52 49 mulid1d A B A 0 A gcd B 1 = A gcd B
53 52 eqeq1d A B A 0 A gcd B 1 = A A gcd B = A
54 51 53 bitrd A B A 0 A A gcd B = 1 A gcd B = A
55 absdvdsb A B A B A B
56 55 adantr A B A 0 A B A B
57 47 54 56 3imtr4d A B A 0 A A gcd B = 1 A B
58 exprmfct A A gcd B 2 p p A A gcd B
59 simprl A B A 0 p p A A gcd B p
60 26 adantr A B A 0 p p A A gcd B A
61 60 nnzd A B A 0 p p A A gcd B A
62 60 nnne0d A B A 0 p p A A gcd B A 0
63 22 adantr A B A 0 p p A A gcd B A gcd B
64 pcdiv p A A 0 A gcd B p pCnt A A gcd B = p pCnt A p pCnt A gcd B
65 59 61 62 63 64 syl121anc A B A 0 p p A A gcd B p pCnt A A gcd B = p pCnt A p pCnt A gcd B
66 simplll A B A 0 p p A A gcd B A
67 zq A A
68 66 67 syl A B A 0 p p A A gcd B A
69 pcabs p A p pCnt A = p pCnt A
70 59 68 69 syl2anc A B A 0 p p A A gcd B p pCnt A = p pCnt A
71 70 oveq1d A B A 0 p p A A gcd B p pCnt A p pCnt A gcd B = p pCnt A p pCnt A gcd B
72 65 71 eqtrd A B A 0 p p A A gcd B p pCnt A A gcd B = p pCnt A p pCnt A gcd B
73 simprr A B A 0 p p A A gcd B p A A gcd B
74 41 adantr A B A 0 p p A A gcd B A A gcd B
75 pcelnn p A A gcd B p pCnt A A gcd B p A A gcd B
76 59 74 75 syl2anc A B A 0 p p A A gcd B p pCnt A A gcd B p A A gcd B
77 73 76 mpbird A B A 0 p p A A gcd B p pCnt A A gcd B
78 72 77 eqeltrrd A B A 0 p p A A gcd B p pCnt A p pCnt A gcd B
79 59 63 pccld A B A 0 p p A A gcd B p pCnt A gcd B 0
80 79 nn0zd A B A 0 p p A A gcd B p pCnt A gcd B
81 simplr A B A 0 p p A A gcd B A 0
82 pczcl p A A 0 p pCnt A 0
83 59 66 81 82 syl12anc A B A 0 p p A A gcd B p pCnt A 0
84 83 nn0zd A B A 0 p p A A gcd B p pCnt A
85 znnsub p pCnt A gcd B p pCnt A p pCnt A gcd B < p pCnt A p pCnt A p pCnt A gcd B
86 80 84 85 syl2anc A B A 0 p p A A gcd B p pCnt A gcd B < p pCnt A p pCnt A p pCnt A gcd B
87 78 86 mpbird A B A 0 p p A A gcd B p pCnt A gcd B < p pCnt A
88 79 nn0red A B A 0 p p A A gcd B p pCnt A gcd B
89 83 nn0red A B A 0 p p A A gcd B p pCnt A
90 88 89 ltnled A B A 0 p p A A gcd B p pCnt A gcd B < p pCnt A ¬ p pCnt A p pCnt A gcd B
91 87 90 mpbid A B A 0 p p A A gcd B ¬ p pCnt A p pCnt A gcd B
92 simpllr A B A 0 p p A A gcd B B
93 nprmdvds1 p ¬ p 1
94 93 ad2antrl A B A 0 p p A A gcd B ¬ p 1
95 gcdid0 A A gcd 0 = A
96 66 95 syl A B A 0 p p A A gcd B A gcd 0 = A
97 96 oveq2d A B A 0 p p A A gcd B A A gcd 0 = A A
98 48 adantr A B A 0 p p A A gcd B A
99 98 62 dividd A B A 0 p p A A gcd B A A = 1
100 97 99 eqtrd A B A 0 p p A A gcd B A A gcd 0 = 1
101 100 breq2d A B A 0 p p A A gcd B p A A gcd 0 p 1
102 94 101 mtbird A B A 0 p p A A gcd B ¬ p A A gcd 0
103 oveq2 B = 0 A gcd B = A gcd 0
104 103 oveq2d B = 0 A A gcd B = A A gcd 0
105 104 breq2d B = 0 p A A gcd B p A A gcd 0
106 73 105 syl5ibcom A B A 0 p p A A gcd B B = 0 p A A gcd 0
107 106 necon3bd A B A 0 p p A A gcd B ¬ p A A gcd 0 B 0
108 102 107 mpd A B A 0 p p A A gcd B B 0
109 pczcl p B B 0 p pCnt B 0
110 59 92 108 109 syl12anc A B A 0 p p A A gcd B p pCnt B 0
111 110 nn0red A B A 0 p p A A gcd B p pCnt B
112 lemin p pCnt A p pCnt A p pCnt B p pCnt A if p pCnt A p pCnt B p pCnt A p pCnt B p pCnt A p pCnt A p pCnt A p pCnt B
113 89 89 111 112 syl3anc A B A 0 p p A A gcd B p pCnt A if p pCnt A p pCnt B p pCnt A p pCnt B p pCnt A p pCnt A p pCnt A p pCnt B
114 pcgcd p A B p pCnt A gcd B = if p pCnt A p pCnt B p pCnt A p pCnt B
115 59 66 92 114 syl3anc A B A 0 p p A A gcd B p pCnt A gcd B = if p pCnt A p pCnt B p pCnt A p pCnt B
116 115 breq2d A B A 0 p p A A gcd B p pCnt A p pCnt A gcd B p pCnt A if p pCnt A p pCnt B p pCnt A p pCnt B
117 89 leidd A B A 0 p p A A gcd B p pCnt A p pCnt A
118 117 biantrurd A B A 0 p p A A gcd B p pCnt A p pCnt B p pCnt A p pCnt A p pCnt A p pCnt B
119 113 116 118 3bitr4rd A B A 0 p p A A gcd B p pCnt A p pCnt B p pCnt A p pCnt A gcd B
120 91 119 mtbird A B A 0 p p A A gcd B ¬ p pCnt A p pCnt B
121 120 expr A B A 0 p p A A gcd B ¬ p pCnt A p pCnt B
122 121 reximdva A B A 0 p p A A gcd B p ¬ p pCnt A p pCnt B
123 rexnal p ¬ p pCnt A p pCnt B ¬ p p pCnt A p pCnt B
124 122 123 syl6ib A B A 0 p p A A gcd B ¬ p p pCnt A p pCnt B
125 58 124 syl5 A B A 0 A A gcd B 2 ¬ p p pCnt A p pCnt B
126 57 125 orim12d A B A 0 A A gcd B = 1 A A gcd B 2 A B ¬ p p pCnt A p pCnt B
127 43 126 mpd A B A 0 A B ¬ p p pCnt A p pCnt B
128 127 ord A B A 0 ¬ A B ¬ p p pCnt A p pCnt B
129 128 con4d A B A 0 p p pCnt A p pCnt B A B
130 2prm 2
131 130 ne0ii
132 r19.2z p p pCnt 0 p pCnt B p p pCnt 0 p pCnt B
133 131 132 mpan p p pCnt 0 p pCnt B p p pCnt 0 p pCnt B
134 id p p
135 zq B B
136 135 adantl A B B
137 pcxcl p B p pCnt B *
138 134 136 137 syl2anr A B p p pCnt B *
139 pnfge p pCnt B * p pCnt B +∞
140 138 139 syl A B p p pCnt B +∞
141 140 biantrurd A B p +∞ p pCnt B p pCnt B +∞ +∞ p pCnt B
142 pc0 p p pCnt 0 = +∞
143 142 adantl A B p p pCnt 0 = +∞
144 143 breq1d A B p p pCnt 0 p pCnt B +∞ p pCnt B
145 pnfxr +∞ *
146 xrletri3 p pCnt B * +∞ * p pCnt B = +∞ p pCnt B +∞ +∞ p pCnt B
147 138 145 146 sylancl A B p p pCnt B = +∞ p pCnt B +∞ +∞ p pCnt B
148 141 144 147 3bitr4d A B p p pCnt 0 p pCnt B p pCnt B = +∞
149 pnfnre +∞
150 149 neli ¬ +∞
151 eleq1 p pCnt B = +∞ p pCnt B +∞
152 150 151 mtbiri p pCnt B = +∞ ¬ p pCnt B
153 109 nn0red p B B 0 p pCnt B
154 153 adantll A p B B 0 p pCnt B
155 154 an4s A B p B 0 p pCnt B
156 155 expr A B p B 0 p pCnt B
157 156 necon1bd A B p ¬ p pCnt B B = 0
158 152 157 syl5 A B p p pCnt B = +∞ B = 0
159 148 158 sylbid A B p p pCnt 0 p pCnt B B = 0
160 159 rexlimdva A B p p pCnt 0 p pCnt B B = 0
161 0dvds B 0 B B = 0
162 161 adantl A B 0 B B = 0
163 160 162 sylibrd A B p p pCnt 0 p pCnt B 0 B
164 133 163 syl5 A B p p pCnt 0 p pCnt B 0 B
165 9 129 164 pm2.61ne A B p p pCnt A p pCnt B A B
166 4 165 impbid A B A B p p pCnt A p pCnt B