Metamath Proof Explorer


Theorem modprmn0modprm0

Description: For an integer not being 0 modulo a given prime number and a nonnegative integer less than the prime number, there is always a second nonnegative integer (less than the given prime number) so that the sum of this second nonnegative integer multiplied with the integer and the first nonnegative integer is 0 ( modulo the given prime number). (Contributed by Alexander van der Vekens, 10-Nov-2018)

Ref Expression
Assertion modprmn0modprm0 PNNmodP0I0..^Pj0..^PI+j NmodP=0

Proof

Step Hyp Ref Expression
1 simpl1 PNNmodP0I0..^PP
2 prmnn PP
3 zmodfzo NPNmodP0..^P
4 2 3 sylan2 NPNmodP0..^P
5 4 ancoms PNNmodP0..^P
6 5 3adant3 PNNmodP0NmodP0..^P
7 fzo1fzo0n0 NmodP1..^PNmodP0..^PNmodP0
8 7 simplbi2com NmodP0NmodP0..^PNmodP1..^P
9 8 3ad2ant3 PNNmodP0NmodP0..^PNmodP1..^P
10 6 9 mpd PNNmodP0NmodP1..^P
11 10 adantr PNNmodP0I0..^PNmodP1..^P
12 simpr PNNmodP0I0..^PI0..^P
13 nnnn0modprm0 PNmodP1..^PI0..^Pj0..^PI+jNmodPmodP=0
14 1 11 12 13 syl3anc PNNmodP0I0..^Pj0..^PI+jNmodPmodP=0
15 elfzoelz j0..^Pj
16 15 zcnd j0..^Pj
17 2 anim1ci PNNP
18 zmodcl NPNmodP0
19 nn0cn NmodP0NmodP
20 17 18 19 3syl PNNmodP
21 20 3adant3 PNNmodP0NmodP
22 21 adantr PNNmodP0I0..^PNmodP
23 mulcom jNmodPjNmodP=NmodPj
24 16 22 23 syl2anr PNNmodP0I0..^Pj0..^PjNmodP=NmodPj
25 24 oveq2d PNNmodP0I0..^Pj0..^PI+jNmodP=I+NmodPj
26 25 oveq1d PNNmodP0I0..^Pj0..^PI+jNmodPmodP=I+NmodPjmodP
27 elfzoelz I0..^PI
28 27 zred I0..^PI
29 28 adantl PNNmodP0I0..^PI
30 29 adantr PNNmodP0I0..^Pj0..^PI
31 zre NN
32 31 3ad2ant2 PNNmodP0N
33 32 adantr PNNmodP0I0..^PN
34 33 adantr PNNmodP0I0..^Pj0..^PN
35 15 adantl PNNmodP0I0..^Pj0..^Pj
36 2 nnrpd PP+
37 36 3ad2ant1 PNNmodP0P+
38 37 adantr PNNmodP0I0..^PP+
39 38 adantr PNNmodP0I0..^Pj0..^PP+
40 modaddmulmod INjP+I+NmodPjmodP=I+NjmodP
41 30 34 35 39 40 syl31anc PNNmodP0I0..^Pj0..^PI+NmodPjmodP=I+NjmodP
42 zcn NN
43 42 adantr Nj0..^PN
44 16 adantl Nj0..^Pj
45 43 44 mulcomd Nj0..^PNj=j N
46 45 ex Nj0..^PNj=j N
47 46 3ad2ant2 PNNmodP0j0..^PNj=j N
48 47 adantr PNNmodP0I0..^Pj0..^PNj=j N
49 48 imp PNNmodP0I0..^Pj0..^PNj=j N
50 49 oveq2d PNNmodP0I0..^Pj0..^PI+Nj=I+j N
51 50 oveq1d PNNmodP0I0..^Pj0..^PI+NjmodP=I+j NmodP
52 26 41 51 3eqtrrd PNNmodP0I0..^Pj0..^PI+j NmodP=I+jNmodPmodP
53 52 eqeq1d PNNmodP0I0..^Pj0..^PI+j NmodP=0I+jNmodPmodP=0
54 53 rexbidva PNNmodP0I0..^Pj0..^PI+j NmodP=0j0..^PI+jNmodPmodP=0
55 14 54 mpbird PNNmodP0I0..^Pj0..^PI+j NmodP=0
56 55 ex PNNmodP0I0..^Pj0..^PI+j NmodP=0