Metamath Proof Explorer


Theorem eulerpartlemgc

Description: Lemma for eulerpart . (Contributed by Thierry Arnoux, 9-Aug-2018)

Ref Expression
Hypotheses eulerpartlems.r R = f | f -1 Fin
eulerpartlems.s S = f 0 R k f k k
Assertion eulerpartlemgc A 0 R t n bits A t 2 n t S A

Proof

Step Hyp Ref Expression
1 eulerpartlems.r R = f | f -1 Fin
2 eulerpartlems.s S = f 0 R k f k k
3 2re 2
4 3 a1i A 0 R t n bits A t 2
5 bitsss bits A t 0
6 simprr A 0 R t n bits A t n bits A t
7 5 6 sselid A 0 R t n bits A t n 0
8 4 7 reexpcld A 0 R t n bits A t 2 n
9 simprl A 0 R t n bits A t t
10 9 nnred A 0 R t n bits A t t
11 8 10 remulcld A 0 R t n bits A t 2 n t
12 1 2 eulerpartlemelr A 0 R A : 0 A -1 Fin
13 12 simpld A 0 R A : 0
14 13 ffvelrnda A 0 R t A t 0
15 14 adantrr A 0 R t n bits A t A t 0
16 15 nn0red A 0 R t n bits A t A t
17 16 10 remulcld A 0 R t n bits A t A t t
18 1 2 eulerpartlemsf S : 0 R 0
19 18 ffvelrni A 0 R S A 0
20 19 adantr A 0 R t n bits A t S A 0
21 20 nn0red A 0 R t n bits A t S A
22 14 nn0red A 0 R t A t
23 22 adantrr A 0 R t n bits A t A t
24 9 nnrpd A 0 R t n bits A t t +
25 24 rprege0d A 0 R t n bits A t t 0 t
26 bitsfi A t 0 bits A t Fin
27 15 26 syl A 0 R t n bits A t bits A t Fin
28 3 a1i A 0 R t n bits A t i bits A t 2
29 5 a1i A 0 R t n bits A t bits A t 0
30 29 sselda A 0 R t n bits A t i bits A t i 0
31 28 30 reexpcld A 0 R t n bits A t i bits A t 2 i
32 0le2 0 2
33 32 a1i A 0 R t n bits A t i bits A t 0 2
34 28 30 33 expge0d A 0 R t n bits A t i bits A t 0 2 i
35 6 snssd A 0 R t n bits A t n bits A t
36 27 31 34 35 fsumless A 0 R t n bits A t i n 2 i i bits A t 2 i
37 8 recnd A 0 R t n bits A t 2 n
38 oveq2 i = n 2 i = 2 n
39 38 sumsn n bits A t 2 n i n 2 i = 2 n
40 6 37 39 syl2anc A 0 R t n bits A t i n 2 i = 2 n
41 bitsinv1 A t 0 i bits A t 2 i = A t
42 15 41 syl A 0 R t n bits A t i bits A t 2 i = A t
43 36 40 42 3brtr3d A 0 R t n bits A t 2 n A t
44 lemul1a 2 n A t t 0 t 2 n A t 2 n t A t t
45 8 23 25 43 44 syl31anc A 0 R t n bits A t 2 n t A t t
46 fzfid A 0 R t 1 S A 1 S A Fin
47 elfznn k 1 S A k
48 ffvelrn A : 0 k A k 0
49 13 47 48 syl2an A 0 R k 1 S A A k 0
50 49 nn0red A 0 R k 1 S A A k
51 47 adantl A 0 R k 1 S A k
52 51 nnred A 0 R k 1 S A k
53 50 52 remulcld A 0 R k 1 S A A k k
54 53 adantlr A 0 R t 1 S A k 1 S A A k k
55 49 nn0ge0d A 0 R k 1 S A 0 A k
56 0red A 0 R k 1 S A 0
57 51 nngt0d A 0 R k 1 S A 0 < k
58 56 52 57 ltled A 0 R k 1 S A 0 k
59 50 52 55 58 mulge0d A 0 R k 1 S A 0 A k k
60 59 adantlr A 0 R t 1 S A k 1 S A 0 A k k
61 fveq2 k = t A k = A t
62 id k = t k = t
63 61 62 oveq12d k = t A k k = A t t
64 simpr A 0 R t 1 S A t 1 S A
65 46 54 60 63 64 fsumge1 A 0 R t 1 S A A t t k = 1 S A A k k
66 65 adantlr A 0 R t t 1 S A A t t k = 1 S A A k k
67 eldif t 1 S A t ¬ t 1 S A
68 nndiffz1 S A 0 1 S A = S A + 1
69 68 eleq2d S A 0 t 1 S A t S A + 1
70 19 69 syl A 0 R t 1 S A t S A + 1
71 70 pm5.32i A 0 R t 1 S A A 0 R t S A + 1
72 1 2 eulerpartlems A 0 R t S A + 1 A t = 0
73 71 72 sylbi A 0 R t 1 S A A t = 0
74 73 oveq1d A 0 R t 1 S A A t t = 0 t
75 simpr A 0 R t 1 S A t 1 S A
76 75 eldifad A 0 R t 1 S A t
77 76 nncnd A 0 R t 1 S A t
78 77 mul02d A 0 R t 1 S A 0 t = 0
79 74 78 eqtrd A 0 R t 1 S A A t t = 0
80 fzfid A 0 R 1 S A Fin
81 80 53 59 fsumge0 A 0 R 0 k = 1 S A A k k
82 81 adantr A 0 R t 1 S A 0 k = 1 S A A k k
83 79 82 eqbrtrd A 0 R t 1 S A A t t k = 1 S A A k k
84 67 83 sylan2br A 0 R t ¬ t 1 S A A t t k = 1 S A A k k
85 84 anassrs A 0 R t ¬ t 1 S A A t t k = 1 S A A k k
86 66 85 pm2.61dan A 0 R t A t t k = 1 S A A k k
87 1 2 eulerpartlemsv3 A 0 R S A = k = 1 S A A k k
88 87 adantr A 0 R t S A = k = 1 S A A k k
89 86 88 breqtrrd A 0 R t A t t S A
90 89 adantrr A 0 R t n bits A t A t t S A
91 11 17 21 45 90 letrd A 0 R t n bits A t 2 n t S A