Metamath Proof Explorer


Theorem 2lgslem3

Description: Lemma 3 for 2lgs . (Contributed by AV, 16-Jul-2021)

Ref Expression
Hypothesis 2lgslem2.n 𝑁 = ( ( ( 𝑃 − 1 ) / 2 ) − ( ⌊ ‘ ( 𝑃 / 4 ) ) )
Assertion 2lgslem3 ( ( 𝑃 ∈ ℕ ∧ ¬ 2 ∥ 𝑃 ) → ( 𝑁 mod 2 ) = if ( ( 𝑃 mod 8 ) ∈ { 1 , 7 } , 0 , 1 ) )

Proof

Step Hyp Ref Expression
1 2lgslem2.n 𝑁 = ( ( ( 𝑃 − 1 ) / 2 ) − ( ⌊ ‘ ( 𝑃 / 4 ) ) )
2 nnz ( 𝑃 ∈ ℕ → 𝑃 ∈ ℤ )
3 lgsdir2lem3 ( ( 𝑃 ∈ ℤ ∧ ¬ 2 ∥ 𝑃 ) → ( 𝑃 mod 8 ) ∈ ( { 1 , 7 } ∪ { 3 , 5 } ) )
4 2 3 sylan ( ( 𝑃 ∈ ℕ ∧ ¬ 2 ∥ 𝑃 ) → ( 𝑃 mod 8 ) ∈ ( { 1 , 7 } ∪ { 3 , 5 } ) )
5 elun ( ( 𝑃 mod 8 ) ∈ ( { 1 , 7 } ∪ { 3 , 5 } ) ↔ ( ( 𝑃 mod 8 ) ∈ { 1 , 7 } ∨ ( 𝑃 mod 8 ) ∈ { 3 , 5 } ) )
6 ovex ( 𝑃 mod 8 ) ∈ V
7 6 elpr ( ( 𝑃 mod 8 ) ∈ { 1 , 7 } ↔ ( ( 𝑃 mod 8 ) = 1 ∨ ( 𝑃 mod 8 ) = 7 ) )
8 1 2lgslem3a1 ( ( 𝑃 ∈ ℕ ∧ ( 𝑃 mod 8 ) = 1 ) → ( 𝑁 mod 2 ) = 0 )
9 8 a1d ( ( 𝑃 ∈ ℕ ∧ ( 𝑃 mod 8 ) = 1 ) → ( ¬ 2 ∥ 𝑃 → ( 𝑁 mod 2 ) = 0 ) )
10 9 expcom ( ( 𝑃 mod 8 ) = 1 → ( 𝑃 ∈ ℕ → ( ¬ 2 ∥ 𝑃 → ( 𝑁 mod 2 ) = 0 ) ) )
11 10 impd ( ( 𝑃 mod 8 ) = 1 → ( ( 𝑃 ∈ ℕ ∧ ¬ 2 ∥ 𝑃 ) → ( 𝑁 mod 2 ) = 0 ) )
12 1 2lgslem3d1 ( ( 𝑃 ∈ ℕ ∧ ( 𝑃 mod 8 ) = 7 ) → ( 𝑁 mod 2 ) = 0 )
13 12 a1d ( ( 𝑃 ∈ ℕ ∧ ( 𝑃 mod 8 ) = 7 ) → ( ¬ 2 ∥ 𝑃 → ( 𝑁 mod 2 ) = 0 ) )
14 13 expcom ( ( 𝑃 mod 8 ) = 7 → ( 𝑃 ∈ ℕ → ( ¬ 2 ∥ 𝑃 → ( 𝑁 mod 2 ) = 0 ) ) )
15 14 impd ( ( 𝑃 mod 8 ) = 7 → ( ( 𝑃 ∈ ℕ ∧ ¬ 2 ∥ 𝑃 ) → ( 𝑁 mod 2 ) = 0 ) )
16 11 15 jaoi ( ( ( 𝑃 mod 8 ) = 1 ∨ ( 𝑃 mod 8 ) = 7 ) → ( ( 𝑃 ∈ ℕ ∧ ¬ 2 ∥ 𝑃 ) → ( 𝑁 mod 2 ) = 0 ) )
17 7 16 sylbi ( ( 𝑃 mod 8 ) ∈ { 1 , 7 } → ( ( 𝑃 ∈ ℕ ∧ ¬ 2 ∥ 𝑃 ) → ( 𝑁 mod 2 ) = 0 ) )
18 17 imp ( ( ( 𝑃 mod 8 ) ∈ { 1 , 7 } ∧ ( 𝑃 ∈ ℕ ∧ ¬ 2 ∥ 𝑃 ) ) → ( 𝑁 mod 2 ) = 0 )
19 iftrue ( ( 𝑃 mod 8 ) ∈ { 1 , 7 } → if ( ( 𝑃 mod 8 ) ∈ { 1 , 7 } , 0 , 1 ) = 0 )
20 19 adantr ( ( ( 𝑃 mod 8 ) ∈ { 1 , 7 } ∧ ( 𝑃 ∈ ℕ ∧ ¬ 2 ∥ 𝑃 ) ) → if ( ( 𝑃 mod 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0 , 1 ) )
66 65 a1d ( ( ( ( 𝑃 mod 8 ) = 3 ∨ ( 𝑃 mod 8 ) = 5 ) ∧ 𝑃 ∈ ℕ ) → ( ¬ 2 ∥ 𝑃 → ( 𝑁 mod 2 ) = if ( ( 𝑃 mod 8 ) ∈ { 1 , 7 } , 0 , 1 ) ) )
67 66 expimpd ( ( ( 𝑃 mod 8 ) = 3 ∨ ( 𝑃 mod 8 ) = 5 ) → ( ( 𝑃 ∈ ℕ ∧ ¬ 2 ∥ 𝑃 ) → ( 𝑁 mod 2 ) = if ( ( 𝑃 mod 8 ) ∈ { 1 , 7 } , 0 , 1 ) ) )
68 23 67 sylbi ( ( 𝑃 mod 8 ) ∈ { 3 , 5 } → ( ( 𝑃 ∈ ℕ ∧ ¬ 2 ∥ 𝑃 ) → ( 𝑁 mod 2 ) = if ( ( 𝑃 mod 8 ) ∈ { 1 , 7 } , 0 , 1 ) ) )
69 22 68 jaoi ( ( ( 𝑃 mod 8 ) ∈ { 1 , 7 } ∨ ( 𝑃 mod 8 ) ∈ { 3 , 5 } ) → ( ( 𝑃 ∈ ℕ ∧ ¬ 2 ∥ 𝑃 ) → ( 𝑁 mod 2 ) = if ( ( 𝑃 mod 8 ) ∈ { 1 , 7 } , 0 , 1 ) ) )
70 5 69 sylbi ( ( 𝑃 mod 8 ) ∈ ( { 1 , 7 } ∪ { 3 , 5 } ) → ( ( 𝑃 ∈ ℕ ∧ ¬ 2 ∥ 𝑃 ) → ( 𝑁 mod 2 ) = if ( ( 𝑃 mod 8 ) ∈ { 1 , 7 } , 0 , 1 ) ) )
71 4 70 mpcom ( ( 𝑃 ∈ ℕ ∧ ¬ 2 ∥ 𝑃 ) → ( 𝑁 mod 2 ) = if ( ( 𝑃 mod 8 ) ∈ { 1 , 7 } , 0 , 1 ) )