Metamath Proof Explorer


Theorem 2lgslem3a1

Description: Lemma 1 for 2lgslem3 . (Contributed by AV, 15-Jul-2021)

Ref Expression
Hypothesis 2lgslem2.n
|- N = ( ( ( P - 1 ) / 2 ) - ( |_ ` ( P / 4 ) ) )
Assertion 2lgslem3a1
|- ( ( P e. NN /\ ( P mod 8 ) = 1 ) -> ( N mod 2 ) = 0 )

Proof

Step Hyp Ref Expression
1 2lgslem2.n
 |-  N = ( ( ( P - 1 ) / 2 ) - ( |_ ` ( P / 4 ) ) )
2 nnnn0
 |-  ( P e. NN -> P e. NN0 )
3 8nn
 |-  8 e. NN
4 nnrp
 |-  ( 8 e. NN -> 8 e. RR+ )
5 3 4 ax-mp
 |-  8 e. RR+
6 modmuladdnn0
 |-  ( ( P e. NN0 /\ 8 e. RR+ ) -> ( ( P mod 8 ) = 1 -> E. k e. NN0 P = ( ( k x. 8 ) + 1 ) ) )
7 2 5 6 sylancl
 |-  ( P e. NN -> ( ( P mod 8 ) = 1 -> E. k e. NN0 P = ( ( k x. 8 ) + 1 ) ) )
8 simpr
 |-  ( ( P e. NN /\ k e. NN0 ) -> k e. NN0 )
9 nn0cn
 |-  ( k e. NN0 -> k e. CC )
10 8cn
 |-  8 e. CC
11 10 a1i
 |-  ( k e. NN0 -> 8 e. CC )
12 9 11 mulcomd
 |-  ( k e. NN0 -> ( k x. 8 ) = ( 8 x. k ) )
13 12 adantl
 |-  ( ( P e. NN /\ k e. NN0 ) -> ( k x. 8 ) = ( 8 x. k ) )
14 13 oveq1d
 |-  ( ( P e. NN /\ k e. NN0 ) -> ( ( k x. 8 ) + 1 ) = ( ( 8 x. k ) + 1 ) )
15 14 eqeq2d
 |-  ( ( P e. NN /\ k e. NN0 ) -> ( P = ( ( k x. 8 ) + 1 ) <-> P = ( ( 8 x. k ) + 1 ) ) )
16 15 biimpa
 |-  ( ( ( P e. NN /\ k e. NN0 ) /\ P = ( ( k x. 8 ) + 1 ) ) -> P = ( ( 8 x. k ) + 1 ) )
17 1 2lgslem3a
 |-  ( ( k e. NN0 /\ P = ( ( 8 x. k ) + 1 ) ) -> N = ( 2 x. k ) )
18 8 16 17 syl2an2r
 |-  ( ( ( P e. NN /\ k e. NN0 ) /\ P = ( ( k x. 8 ) + 1 ) ) -> N = ( 2 x. k ) )
19 oveq1
 |-  ( N = ( 2 x. k ) -> ( N mod 2 ) = ( ( 2 x. k ) mod 2 ) )
20 2cnd
 |-  ( k e. NN0 -> 2 e. CC )
21 20 9 mulcomd
 |-  ( k e. NN0 -> ( 2 x. k ) = ( k x. 2 ) )
22 21 oveq1d
 |-  ( k e. NN0 -> ( ( 2 x. k ) mod 2 ) = ( ( k x. 2 ) mod 2 ) )
23 nn0z
 |-  ( k e. NN0 -> k e. ZZ )
24 2rp
 |-  2 e. RR+
25 mulmod0
 |-  ( ( k e. ZZ /\ 2 e. RR+ ) -> ( ( k x. 2 ) mod 2 ) = 0 )
26 23 24 25 sylancl
 |-  ( k e. NN0 -> ( ( k x. 2 ) mod 2 ) = 0 )
27 22 26 eqtrd
 |-  ( k e. NN0 -> ( ( 2 x. k ) mod 2 ) = 0 )
28 19 27 sylan9eqr
 |-  ( ( k e. NN0 /\ N = ( 2 x. k ) ) -> ( N mod 2 ) = 0 )
29 8 18 28 syl2an2r
 |-  ( ( ( P e. NN /\ k e. NN0 ) /\ P = ( ( k x. 8 ) + 1 ) ) -> ( N mod 2 ) = 0 )
30 29 rexlimdva2
 |-  ( P e. NN -> ( E. k e. NN0 P = ( ( k x. 8 ) + 1 ) -> ( N mod 2 ) = 0 ) )
31 7 30 syld
 |-  ( P e. NN -> ( ( P mod 8 ) = 1 -> ( N mod 2 ) = 0 ) )
32 31 imp
 |-  ( ( P e. NN /\ ( P mod 8 ) = 1 ) -> ( N mod 2 ) = 0 )