Metamath Proof Explorer


Theorem hashgcdeq

Description: Number of initial positive integers with specified divisors. (Contributed by Stefan O'Rear, 12-Sep-2015)

Ref Expression
Assertion hashgcdeq M N x 0 ..^ M | x gcd M = N = if N M ϕ M N 0

Proof

Step Hyp Ref Expression
1 eqeq2 ϕ M N = if N M ϕ M N 0 x 0 ..^ M | x gcd M = N = ϕ M N x 0 ..^ M | x gcd M = N = if N M ϕ M N 0
2 eqeq2 0 = if N M ϕ M N 0 x 0 ..^ M | x gcd M = N = 0 x 0 ..^ M | x gcd M = N = if N M ϕ M N 0
3 nndivdvds M N N M M N
4 3 biimpa M N N M M N
5 dfphi2 M N ϕ M N = y 0 ..^ M N | y gcd M N = 1
6 4 5 syl M N N M ϕ M N = y 0 ..^ M N | y gcd M N = 1
7 eqid y 0 ..^ M N | y gcd M N = 1 = y 0 ..^ M N | y gcd M N = 1
8 eqid x 0 ..^ M | x gcd M = N = x 0 ..^ M | x gcd M = N
9 eqid z y 0 ..^ M N | y gcd M N = 1 z N = z y 0 ..^ M N | y gcd M N = 1 z N
10 7 8 9 hashgcdlem M N N M z y 0 ..^ M N | y gcd M N = 1 z N : y 0 ..^ M N | y gcd M N = 1 1-1 onto x 0 ..^ M | x gcd M = N
11 10 3expa M N N M z y 0 ..^ M N | y gcd M N = 1 z N : y 0 ..^ M N | y gcd M N = 1 1-1 onto x 0 ..^ M | x gcd M = N
12 ovex 0 ..^ M N V
13 12 rabex y 0 ..^ M N | y gcd M N = 1 V
14 13 f1oen z y 0 ..^ M N | y gcd M N = 1 z N : y 0 ..^ M N | y gcd M N = 1 1-1 onto x 0 ..^ M | x gcd M = N y 0 ..^ M N | y gcd M N = 1 x 0 ..^ M | x gcd M = N
15 hasheni y 0 ..^ M N | y gcd M N = 1 x 0 ..^ M | x gcd M = N y 0 ..^ M N | y gcd M N = 1 = x 0 ..^ M | x gcd M = N
16 11 14 15 3syl M N N M y 0 ..^ M N | y gcd M N = 1 = x 0 ..^ M | x gcd M = N
17 6 16 eqtr2d M N N M x 0 ..^ M | x gcd M = N = ϕ M N
18 simprr M N x 0 ..^ M x gcd M = N x gcd M = N
19 elfzoelz x 0 ..^ M x
20 19 ad2antrl M N x 0 ..^ M x gcd M = N x
21 nnz M M
22 21 ad2antrr M N x 0 ..^ M x gcd M = N M
23 gcddvds x M x gcd M x x gcd M M
24 20 22 23 syl2anc M N x 0 ..^ M x gcd M = N x gcd M x x gcd M M
25 24 simprd M N x 0 ..^ M x gcd M = N x gcd M M
26 18 25 eqbrtrrd M N x 0 ..^ M x gcd M = N N M
27 26 expr M N x 0 ..^ M x gcd M = N N M
28 27 con3d M N x 0 ..^ M ¬ N M ¬ x gcd M = N
29 28 impancom M N ¬ N M x 0 ..^ M ¬ x gcd M = N
30 29 ralrimiv M N ¬ N M x 0 ..^ M ¬ x gcd M = N
31 rabeq0 x 0 ..^ M | x gcd M = N = x 0 ..^ M ¬ x gcd M = N
32 30 31 sylibr M N ¬ N M x 0 ..^ M | x gcd M = N =
33 32 fveq2d M N ¬ N M x 0 ..^ M | x gcd M = N =
34 hash0 = 0
35 33 34 eqtrdi M N ¬ N M x 0 ..^ M | x gcd M = N = 0
36 1 2 17 35 ifbothda M N x 0 ..^ M | x gcd M = N = if N M ϕ M N 0