Metamath Proof Explorer


Theorem 41prothprmlem2

Description: Lemma 2 for 41prothprm . (Contributed by AV, 5-Jul-2020)

Ref Expression
Hypothesis 41prothprm.p
|- P = ; 4 1
Assertion 41prothprmlem2
|- ( ( 3 ^ ( ( P - 1 ) / 2 ) ) mod P ) = ( -u 1 mod P )

Proof

Step Hyp Ref Expression
1 41prothprm.p
 |-  P = ; 4 1
2 1 41prothprmlem1
 |-  ( ( P - 1 ) / 2 ) = ; 2 0
3 2 oveq2i
 |-  ( 3 ^ ( ( P - 1 ) / 2 ) ) = ( 3 ^ ; 2 0 )
4 3 oveq1i
 |-  ( ( 3 ^ ( ( P - 1 ) / 2 ) ) mod P ) = ( ( 3 ^ ; 2 0 ) mod P )
5 5cn
 |-  5 e. CC
6 4cn
 |-  4 e. CC
7 5t4e20
 |-  ( 5 x. 4 ) = ; 2 0
8 5 6 7 mulcomli
 |-  ( 4 x. 5 ) = ; 2 0
9 8 eqcomi
 |-  ; 2 0 = ( 4 x. 5 )
10 9 oveq2i
 |-  ( 3 ^ ; 2 0 ) = ( 3 ^ ( 4 x. 5 ) )
11 3cn
 |-  3 e. CC
12 4nn0
 |-  4 e. NN0
13 5nn0
 |-  5 e. NN0
14 expmul
 |-  ( ( 3 e. CC /\ 4 e. NN0 /\ 5 e. NN0 ) -> ( 3 ^ ( 4 x. 5 ) ) = ( ( 3 ^ 4 ) ^ 5 ) )
15 11 12 13 14 mp3an
 |-  ( 3 ^ ( 4 x. 5 ) ) = ( ( 3 ^ 4 ) ^ 5 )
16 10 15 eqtri
 |-  ( 3 ^ ; 2 0 ) = ( ( 3 ^ 4 ) ^ 5 )
17 16 oveq1i
 |-  ( ( 3 ^ ; 2 0 ) mod ; 4 1 ) = ( ( ( 3 ^ 4 ) ^ 5 ) mod ; 4 1 )
18 3z
 |-  3 e. ZZ
19 zexpcl
 |-  ( ( 3 e. ZZ /\ 4 e. NN0 ) -> ( 3 ^ 4 ) e. ZZ )
20 18 12 19 mp2an
 |-  ( 3 ^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