Description: Wilson's theorem. A number is prime iff it is greater than or equal to 2 and ( N - 1 ) ! is congruent to -u 1 , mod N , or alternatively if N divides ( N - 1 ) ! + 1 . In this part of the proof we show the relatively simple reverse implication; see wilthlem3 for the forward implication. This is Metamath 100 proof #51. (Contributed by Mario Carneiro, 24-Jan-2015) (Proof shortened by Fan Zheng, 16-Jun-2016)
Ref | Expression | ||
---|---|---|---|
Assertion | wilth | |
Step | Hyp | Ref | Expression |
---|---|---|---|
1 | prmuz2 | |
|
2 | eqid | |
|
3 | eleq2w | |
|
4 | oveq1 | |
|
5 | 4 | oveq1d | |
6 | 5 | eleq1d | |
7 | 6 | cbvralvw | |
8 | eleq2w | |
|
9 | 8 | raleqbi1dv | |
10 | 7 9 | syl5bb | |
11 | 3 10 | anbi12d | |
12 | 11 | cbvrabv | |
13 | 2 12 | wilthlem3 | |
14 | 1 13 | jca | |
15 | simpl | |
|
16 | elfzuz | |
|
17 | 16 | adantl | |
18 | eluz2nn | |
|
19 | 17 18 | syl | |
20 | elfzuz3 | |
|
21 | 20 | adantl | |
22 | dvdsfac | |
|
23 | 19 21 22 | syl2anc | |
24 | eluz2nn | |
|
25 | 24 | ad2antrr | |
26 | nnm1nn0 | |
|
27 | faccl | |
|
28 | 25 26 27 | 3syl | |
29 | 28 | nnzd | |
30 | eluz2gt1 | |
|
31 | 17 30 | syl | |
32 | ndvdsp1 | |
|
33 | 29 19 31 32 | syl3anc | |
34 | 23 33 | mpd | |
35 | simplr | |
|
36 | 19 | nnzd | |
37 | 25 | nnzd | |
38 | 29 | peano2zd | |
39 | dvdstr | |
|
40 | 36 37 38 39 | syl3anc | |
41 | 35 40 | mpan2d | |
42 | 34 41 | mtod | |
43 | 42 | ralrimiva | |
44 | isprm3 | |
|
45 | 15 43 44 | sylanbrc | |
46 | 14 45 | impbii | |