Metamath Proof Explorer


Theorem prmgaplem6

Description: Lemma for prmgap : for each positive integer there is a greater prime closest to this integer, i.e. there is a greater prime and no other prime is between this prime and the integer. (Contributed by AV, 10-Aug-2020)

Ref Expression
Assertion prmgaplem6 N p N < p z N + 1 ..^ p z

Proof

Step Hyp Ref Expression
1 prmunb N n N < n
2 eqid q | N < q q n = q | N < q q n
3 2 prmgaplem4 N n N < n p q | N < q q n z q | N < q q n p z
4 breq2 q = p N < q N < p
5 breq1 q = p q n p n
6 4 5 anbi12d q = p N < q q n N < p p n
7 6 elrab p q | N < q q n p N < p p n
8 simplrl N n N < n p N < p p n z q | N < q q n p z p
9 simprrl N n N < n p N < p p n N < p
10 9 adantr N n N < n p N < p p n z q | N < q q n p z N < p
11 breq2 q = z N < q N < z
12 breq1 q = z q n z n
13 11 12 anbi12d q = z N < q q n N < z z n
14 simpll z N n N < n p N < p p n z N + 1 ..^ p z
15 elfzo2 z N + 1 ..^ p z N + 1 p z < p
16 eluz2 z N + 1 N + 1 z N + 1 z
17 nnz N N
18 prmz z z
19 zltp1le N z N < z N + 1 z
20 17 18 19 syl2an N z N < z N + 1 z
21 20 exbiri N z N + 1 z N < z
22 21 3ad2ant1 N n N < n z N + 1 z N < z
23 22 adantr N n N < n p N < p p n z N + 1 z N < z
24 23 impcom z N n N < n p N < p p n N + 1 z N < z
25 24 com12 N + 1 z z N n N < n p N < p p n N < z
26 25 adantr N + 1 z p z N n N < n p N < p p n N < z
27 26 adantr N + 1 z p z < p z N n N < n p N < p p n N < z
28 27 imp N + 1 z p z < p z N n N < n p N < p p n N < z
29 prmnn z z
30 29 nnred z z
31 30 ad2antrl n z p z
32 prmnn p p
33 32 nnred p p
34 33 adantl z p p
35 34 adantl n z p p
36 prmnn n n
37 36 nnred n n
38 37 adantr n z p n
39 ltleletr z p n z < p p n z n
40 31 35 38 39 syl3anc n z p z < p p n z n
41 40 exp4b n z p z < p p n z n
42 41 3ad2ant2 N n N < n z p z < p p n z n
43 42 expdcom z p N n N < n z < p p n z n
44 43 com45 z p N n N < n p n z < p z n
45 44 com14 p n p N n N < n z z < p z n
46 45 adantl N < p p n p N n N < n z z < p z n
47 46 impcom p N < p p n N n N < n z z < p z n
48 47 impcom N n N < n p N < p p n z z < p z n
49 48 impcom z N n N < n p N < p p n z < p z n
50 49 adantld z N n N < n p N < p p n N + 1 z p z < p z n
51 50 impcom N + 1 z p z < p z N n N < n p N < p p n z n
52 28 51 jca N + 1 z p z < p z N n N < n p N < p p n N < z z n
53 52 exp41 N + 1 z p z < p z N n N < n p N < p p n N < z z n
54 53 3ad2ant3 N + 1 z N + 1 z p z < p z N n N < n p N < p p n N < z z n
55 16 54 sylbi z N + 1 p z < p z N n N < n p N < p p n N < z z n
56 55 3imp z N + 1 p z < p z N n N < n p N < p p n N < z z n
57 15 56 sylbi z N + 1 ..^ p z N n N < n p N < p p n N < z z n
58 57 impcom z N n N < n p N < p p n z N + 1 ..^ p N < z z n
59 13 14 58 elrabd z N n N < n p N < p p n z N + 1 ..^ p z q | N < q q n
60 elfzolt2 z N + 1 ..^ p z < p
61 33 ad2antrl N n N < n p N < p p n p
62 ltnle z p z < p ¬ p z
63 62 biimpd z p z < p ¬ p z
64 30 61 63 syl2an z N n N < n p N < p p n z < p ¬ p z
65 64 imp z N n N < n p N < p p n z < p ¬ p z
66 65 pm2.21d z N n N < n p N < p p n z < p p z z
67 60 66 sylan2 z N n N < n p N < p p n z N + 1 ..^ p p z z
68 59 67 embantd z N n N < n p N < p p n z N + 1 ..^ p z q | N < q q n p z z
69 68 ex z N n N < n p N < p p n z N + 1 ..^ p z q | N < q q n p z z
70 69 com23 z N n N < n p N < p p n z q | N < q q n p z z N + 1 ..^ p z
71 70 ex z N n N < n p N < p p n z q | N < q q n p z z N + 1 ..^ p z
72 df-nel z ¬ z
73 2a1 z z q | N < q q n p z z N + 1 ..^ p z
74 73 a1d z N n N < n p N < p p n z q | N < q q n p z z N + 1 ..^ p z
75 72 74 sylbir ¬ z N n N < n p N < p p n z q | N < q q n p z z N + 1 ..^ p z
76 71 75 pm2.61i N n N < n p N < p p n z q | N < q q n p z z N + 1 ..^ p z
77 76 ralimdv2 N n N < n p N < p p n z q | N < q q n p z z N + 1 ..^ p z
78 77 imp N n N < n p N < p p n z q | N < q q n p z z N + 1 ..^ p z
79 8 10 78 jca32 N n N < n p N < p p n z q | N < q q n p z p N < p z N + 1 ..^ p z
80 79 exp31 N n N < n p N < p p n z q | N < q q n p z p N < p z N + 1 ..^ p z
81 7 80 syl5bi N n N < n p q | N < q q n z q | N < q q n p z p N < p z N + 1 ..^ p z
82 81 impd N n N < n p q | N < q q n z q | N < q q n p z p N < p z N + 1 ..^ p z
83 82 reximdv2 N n N < n p q | N < q q n z q | N < q q n p z p N < p z N + 1 ..^ p z
84 3 83 mpd N n N < n p N < p z N + 1 ..^ p z
85 84 rexlimdv3a N n N < n p N < p z N + 1 ..^ p z
86 1 85 mpd N p N < p z N + 1 ..^ p z