Metamath Proof Explorer


Theorem fsum

Description: The value of a sum over a nonempty finite set. (Contributed by Mario Carneiro, 20-Apr-2014) (Revised by Mario Carneiro, 13-Jun-2019)

Ref Expression
Hypotheses fsum.1 k = F n B = C
fsum.2 φ M
fsum.3 φ F : 1 M 1-1 onto A
fsum.4 φ k A B
fsum.5 φ n 1 M G n = C
Assertion fsum φ k A B = seq 1 + G M

Proof

Step Hyp Ref Expression
1 fsum.1 k = F n B = C
2 fsum.2 φ M
3 fsum.3 φ F : 1 M 1-1 onto A
4 fsum.4 φ k A B
5 fsum.5 φ n 1 M G n = C
6 df-sum k A B = ι x | m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m
7 fvex seq 1 + G M V
8 eleq1w n = j n A j A
9 csbeq1 n = j n / k B = j / k B
10 8 9 ifbieq1d n = j if n A n / k B 0 = if j A j / k B 0
11 10 cbvmptv n if n A n / k B 0 = j if j A j / k B 0
12 4 ralrimiva φ k A B
13 nfcsb1v _ k j / k B
14 13 nfel1 k j / k B
15 csbeq1a k = j B = j / k B
16 15 eleq1d k = j B j / k B
17 14 16 rspc j A k A B j / k B
18 12 17 mpan9 φ j A j / k B
19 fveq2 n = i f n = f i
20 19 csbeq1d n = i f n / k B = f i / k B
21 csbcow f i / j j / k B = f i / k B
22 20 21 eqtr4di n = i f n / k B = f i / j j / k B
23 22 cbvmptv n f n / k B = i f i / j j / k B
24 11 18 23 summo φ * x m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m
25 f1of F : 1 M 1-1 onto A F : 1 M A
26 3 25 syl φ F : 1 M A
27 ovex 1 M V
28 fex F : 1 M A 1 M V F V
29 26 27 28 sylancl φ F V
30 nnuz = 1
31 2 30 eleqtrdi φ M 1
32 elfznn n 1 M n
33 fvex G n V
34 5 33 eqeltrrdi φ n 1 M C V
35 eqid n C = n C
36 35 fvmpt2 n C V n C n = C
37 32 34 36 syl2an2 φ n 1 M n C n = C
38 5 37 eqtr4d φ n 1 M G n = n C n
39 38 ralrimiva φ n 1 M G n = n C n
40 nffvmpt1 _ n n C k
41 40 nfeq2 n G k = n C k
42 fveq2 n = k G n = G k
43 fveq2 n = k n C n = n C k
44 42 43 eqeq12d n = k G n = n C n G k = n C k
45 41 44 rspc k 1 M n 1 M G n = n C n G k = n C k
46 39 45 mpan9 φ k 1 M G k = n C k
47 31 46 seqfveq φ seq 1 + G M = seq 1 + n C M
48 3 47 jca φ F : 1 M 1-1 onto A seq 1 + G M = seq 1 + n C M
49 f1oeq1 f = F f : 1 M 1-1 onto A F : 1 M 1-1 onto A
50 fveq1 f = F f n = F n
51 50 csbeq1d f = F f n / k B = F n / k B
52 fvex F n V
53 52 1 csbie F n / k B = C
54 51 53 eqtrdi f = F f n / k B = C
55 54 mpteq2dv f = F n f n / k B = n C
56 55 seqeq3d f = F seq 1 + n f n / k B = seq 1 + n C
57 56 fveq1d f = F seq 1 + n f n / k B M = seq 1 + n C M
58 57 eqeq2d f = F seq 1 + G M = seq 1 + n f n / k B M seq 1 + G M = seq 1 + n C M
59 49 58 anbi12d f = F f : 1 M 1-1 onto A seq 1 + G M = seq 1 + n f n / k B M F : 1 M 1-1 onto A seq 1 + G M = seq 1 + n C M
60 29 48 59 spcedv φ f f : 1 M 1-1 onto A seq 1 + G M = seq 1 + n f n / k B M
61 oveq2 m = M 1 m = 1 M
62 61 f1oeq2d m = M f : 1 m 1-1 onto A f : 1 M 1-1 onto A
63 fveq2 m = M seq 1 + n f n / k B m = seq 1 + n f n / k B M
64 63 eqeq2d m = M seq 1 + G M = seq 1 + n f n / k B m seq 1 + G M = seq 1 + n f n / k B M
65 62 64 anbi12d m = M f : 1 m 1-1 onto A seq 1 + G M = seq 1 + n f n / k B m f : 1 M 1-1 onto A seq 1 + G M = seq 1 + n f n / k B M
66 65 exbidv m = M f f : 1 m 1-1 onto A seq 1 + G M = seq 1 + n f n / k B m f f : 1 M 1-1 onto A seq 1 + G M = seq 1 + n f n / k B M
67 66 rspcev M f f : 1 M 1-1 onto A seq 1 + G M = seq 1 + n f n / k B M m f f : 1 m 1-1 onto A seq 1 + G M = seq 1 + n f n / k B m
68 2 60 67 syl2anc φ m f f : 1 m 1-1 onto A seq 1 + G M = seq 1 + n f n / k B m
69 68 olcd φ m A m seq m + n if n A n / k B 0 seq 1 + G M m f f : 1 m 1-1 onto A seq 1 + G M = seq 1 + n f n / k B m
70 breq2 x = seq 1 + G M seq m + n if n A n / k B 0 x seq m + n if n A n / k B 0 seq 1 + G M
71 70 anbi2d x = seq 1 + G M A m seq m + n if n A n / k B 0 x A m seq m + n if n A n / k B 0 seq 1 + G M
72 71 rexbidv x = seq 1 + G M m A m seq m + n if n A n / k B 0 x m A m seq m + n if n A n / k B 0 seq 1 + G M
73 eqeq1 x = seq 1 + G M x = seq 1 + n f n / k B m seq 1 + G M = seq 1 + n f n / k B m
74 73 anbi2d x = seq 1 + G M f : 1 m 1-1 onto A x = seq 1 + n f n / k B m f : 1 m 1-1 onto A seq 1 + G M = seq 1 + n f n / k B m
75 74 exbidv x = seq 1 + G M f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m f f : 1 m 1-1 onto A seq 1 + G M = seq 1 + n f n / k B m
76 75 rexbidv x = seq 1 + G M m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m m f f : 1 m 1-1 onto A seq 1 + G M = seq 1 + n f n / k B m
77 72 76 orbi12d x = seq 1 + G M m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m m A m seq m + n if n A n / k B 0 seq 1 + G M m f f : 1 m 1-1 onto A seq 1 + G M = seq 1 + n f n / k B m
78 77 moi2 seq 1 + G M V * x m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m m A m seq m + n if n A n / k B 0 seq 1 + G M m f f : 1 m 1-1 onto A seq 1 + G M = seq 1 + n f n / k B m x = seq 1 + G M
79 7 78 mpanl1 * x m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m m A m seq m + n if n A n / k B 0 seq 1 + G M m f f : 1 m 1-1 onto A seq 1 + G M = seq 1 + n f n / k B m x = seq 1 + G M
80 79 ancom2s * x m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m m A m seq m + n if n A n / k B 0 seq 1 + G M m f f : 1 m 1-1 onto A seq 1 + G M = seq 1 + n f n / k B m m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m x = seq 1 + G M
81 80 expr * x m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m m A m seq m + n if n A n / k B 0 seq 1 + G M m f f : 1 m 1-1 onto A seq 1 + G M = seq 1 + n f n / k B m m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m x = seq 1 + G M
82 24 69 81 syl2anc φ m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m x = seq 1 + G M
83 69 77 syl5ibrcom φ x = seq 1 + G M m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m
84 82 83 impbid φ m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m x = seq 1 + G M
85 84 adantr φ seq 1 + G M V m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m x = seq 1 + G M
86 85 iota5 φ seq 1 + G M V ι x | m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m = seq 1 + G M
87 7 86 mpan2 φ ι x | m A m seq m + n if n A n / k B 0 x m f f : 1 m 1-1 onto A x = seq 1 + n f n / k B m = seq 1 + G M
88 6 87 eqtrid φ k A B = seq 1 + G M