Metamath Proof Explorer


Theorem ballotlemfrc

Description: Express the value of ( F( RC ) ) in terms of the newly defined .^ . (Contributed by Thierry Arnoux, 21-Apr-2017)

Ref Expression
Hypotheses ballotth.m
|- M e. NN
ballotth.n
|- N e. NN
ballotth.o
|- O = { c e. ~P ( 1 ... ( M + N ) ) | ( # ` c ) = M }
ballotth.p
|- P = ( x e. ~P O |-> ( ( # ` x ) / ( # ` O ) ) )
ballotth.f
|- F = ( c e. O |-> ( i e. ZZ |-> ( ( # ` ( ( 1 ... i ) i^i c ) ) - ( # ` ( ( 1 ... i ) \ c ) ) ) ) )
ballotth.e
|- E = { c e. O | A. i e. ( 1 ... ( M + N ) ) 0 < ( ( F ` c ) ` i ) }
ballotth.mgtn
|- N < M
ballotth.i
|- I = ( c e. ( O \ E ) |-> inf ( { k e. ( 1 ... ( M + N ) ) | ( ( F ` c ) ` k ) = 0 } , RR , < ) )
ballotth.s
|- S = ( c e. ( O \ E ) |-> ( i e. ( 1 ... ( M + N ) ) |-> if ( i <_ ( I ` c ) , ( ( ( I ` c ) + 1 ) - i ) , i ) ) )
ballotth.r
|- R = ( c e. ( O \ E ) |-> ( ( S ` c ) " c ) )
ballotlemg
|- .^ = ( u e. Fin , v e. Fin |-> ( ( # ` ( v i^i u ) ) - ( # ` ( v \ u ) ) ) )
Assertion ballotlemfrc
|- ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( F ` ( R ` C ) ) ` J ) = ( C .^ ( ( ( S ` C ) ` J ) ... ( I ` C ) ) ) )

Proof

Step Hyp Ref Expression
1 ballotth.m
 |-  M e. NN
2 ballotth.n
 |-  N e. NN
3 ballotth.o
 |-  O = { c e. ~P ( 1 ... ( M + N ) ) | ( # ` c ) = M }
4 ballotth.p
 |-  P = ( x e. ~P O |-> ( ( # ` x ) / ( # ` O ) ) )
5 ballotth.f
 |-  F = ( c e. O |-> ( i e. ZZ |-> ( ( # ` ( ( 1 ... i ) i^i c ) ) - ( # ` ( ( 1 ... i ) \ c ) ) ) ) )
6 ballotth.e
 |-  E = { c e. O | A. i e. ( 1 ... ( M + N ) ) 0 < ( ( F ` c ) ` i ) }
7 ballotth.mgtn
 |-  N < M
8 ballotth.i
 |-  I = ( c e. ( O \ E ) |-> inf ( { k e. ( 1 ... ( M + N ) ) | ( ( F ` c ) ` k ) = 0 } , RR , < ) )
9 ballotth.s
 |-  S = ( c e. ( O \ E ) |-> ( i e. ( 1 ... ( M + N ) ) |-> if ( i <_ ( I ` c ) , ( ( ( I ` c ) + 1 ) - i ) , i ) ) )
10 ballotth.r
 |-  R = ( c e. ( O \ E ) |-> ( ( S ` c ) " c ) )
11 ballotlemg
 |-  .^ = ( u e. Fin , v e. Fin |-> ( ( # ` ( v i^i u ) ) - ( # ` ( v \ u ) ) ) )
12 1 2 3 4 5 6 7 8 9 ballotlemsf1o
 |-  ( C e. ( O \ E ) -> ( ( S ` C ) : ( 1 ... ( M + N ) ) -1-1-onto-> ( 1 ... ( M + N ) ) /\ `' ( S ` C ) = ( S ` C ) ) )
13 12 simpld
 |-  ( C e. ( O \ E ) -> ( S ` C ) : ( 1 ... ( M + N ) ) -1-1-onto-> ( 1 ... ( M + N ) ) )
14 f1of1
 |-  ( ( S ` C ) : ( 1 ... ( M + N ) ) -1-1-onto-> ( 1 ... ( M + N ) ) -> ( S ` C ) : ( 1 ... ( M + N ) ) -1-1-> ( 1 ... ( M + N ) ) )
15 13 14 syl
 |-  ( C e. ( O \ E ) -> ( S ` C ) : ( 1 ... ( M + N ) ) -1-1-> ( 1 ... ( M + N ) ) )
16 15 adantr
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( S ` C ) : ( 1 ... ( M + N ) ) -1-1-> ( 1 ... ( M + N ) ) )
17 1 2 3 4 5 6 7 8 ballotlemiex
 |-  ( C e. ( O \ E ) -> ( ( I ` C ) e. ( 1 ... ( M + N ) ) /\ ( ( F ` C ) ` ( I ` C ) ) = 0 ) )
18 17 simpld
 |-  ( C e. ( O \ E ) -> ( I ` C ) e. ( 1 ... ( M + N ) ) )
19 18 adantr
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( I ` C ) e. ( 1 ... ( M + N ) ) )
20 elfzuz3
 |-  ( ( I ` C ) e. ( 1 ... ( M + N ) ) -> ( M + N ) e. ( ZZ>= ` ( I ` C ) ) )
21 19 20 syl
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( M + N ) e. ( ZZ>= ` ( I ` C ) ) )
22 elfzuz3
 |-  ( J e. ( 1 ... ( I ` C ) ) -> ( I ` C ) e. ( ZZ>= ` J ) )
23 22 adantl
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( I ` C ) e. ( ZZ>= ` J ) )
24 uztrn
 |-  ( ( ( M + N ) e. ( ZZ>= ` ( I ` C ) ) /\ ( I ` C ) e. ( ZZ>= ` J ) ) -> ( M + N ) e. ( ZZ>= ` J ) )
25 21 23 24 syl2anc
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( M + N ) e. ( ZZ>= ` J ) )
26 fzss2
 |-  ( ( M + N ) e. ( ZZ>= ` J ) -> ( 1 ... J ) C_ ( 1 ... ( M + N ) ) )
27 25 26 syl
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( 1 ... J ) C_ ( 1 ... ( M + N ) ) )
28 ssinss1
 |-  ( ( 1 ... J ) C_ ( 1 ... ( M + N ) ) -> ( ( 1 ... J ) i^i ( R ` C ) ) C_ ( 1 ... ( M + N ) ) )
29 27 28 syl
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( 1 ... J ) i^i ( R ` C ) ) C_ ( 1 ... ( M + N ) ) )
30 f1ores
 |-  ( ( ( S ` C ) : ( 1 ... ( M + N ) ) -1-1-> ( 1 ... ( M + N ) ) /\ ( ( 1 ... J ) i^i ( R ` C ) ) C_ ( 1 ... ( M + N ) ) ) -> ( ( S ` C ) |` ( ( 1 ... J ) i^i ( R ` C ) ) ) : ( ( 1 ... J ) i^i ( R ` C ) ) -1-1-onto-> ( ( S ` C ) " ( ( 1 ... J ) i^i ( R ` C ) ) ) )
31 16 29 30 syl2anc
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( S ` C ) |` ( ( 1 ... J ) i^i ( R ` C ) ) ) : ( ( 1 ... J ) i^i ( R ` C ) ) -1-1-onto-> ( ( S ` C ) " ( ( 1 ... J ) i^i ( R ` C ) ) ) )
32 ovex
 |-  ( 1 ... J ) e. _V
33 32 inex1
 |-  ( ( 1 ... J ) i^i ( R ` C ) ) e. _V
34 33 f1oen
 |-  ( ( ( S ` C ) |` ( ( 1 ... J ) i^i ( R ` C ) ) ) : ( ( 1 ... J ) i^i ( R ` C ) ) -1-1-onto-> ( ( S ` C ) " ( ( 1 ... J ) i^i ( R ` C ) ) ) -> ( ( 1 ... J ) i^i ( R ` C ) ) ~~ ( ( S ` C ) " ( ( 1 ... J ) i^i ( R ` C ) ) ) )
35 hasheni
 |-  ( ( ( 1 ... J ) i^i ( R ` C ) ) ~~ ( ( S ` C ) " ( ( 1 ... J ) i^i ( R ` C ) ) ) -> ( # ` ( ( 1 ... J ) i^i ( R ` C ) ) ) = ( # ` ( ( S ` C ) " ( ( 1 ... J ) i^i ( R ` C ) ) ) ) )
36 31 34 35 3syl
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( # ` ( ( 1 ... J ) i^i ( R ` C ) ) ) = ( # ` ( ( S ` C ) " ( ( 1 ... J ) i^i ( R ` C ) ) ) ) )
37 27 ssdifssd
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( 1 ... J ) \ ( R ` C ) ) C_ ( 1 ... ( M + N ) ) )
38 f1ores
 |-  ( ( ( S ` C ) : ( 1 ... ( M + N ) ) -1-1-> ( 1 ... ( M + N ) ) /\ ( ( 1 ... J ) \ ( R ` C ) ) C_ ( 1 ... ( M + N ) ) ) -> ( ( S ` C ) |` ( ( 1 ... J ) \ ( R ` C ) ) ) : ( ( 1 ... J ) \ ( R ` C ) ) -1-1-onto-> ( ( S ` C ) " ( ( 1 ... J ) \ ( R ` C ) ) ) )
39 16 37 38 syl2anc
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( S ` C ) |` ( ( 1 ... J ) \ ( R ` C ) ) ) : ( ( 1 ... J ) \ ( R ` C ) ) -1-1-onto-> ( ( S ` C ) " ( ( 1 ... J ) \ ( R ` C ) ) ) )
40 difexg
 |-  ( ( 1 ... J ) e. _V -> ( ( 1 ... J ) \ ( R ` C ) ) e. _V )
41 32 40 ax-mp
 |-  ( ( 1 ... J ) \ ( R ` C ) ) e. _V
42 41 f1oen
 |-  ( ( ( S ` C ) |` ( ( 1 ... J ) \ ( R ` C ) ) ) : ( ( 1 ... J ) \ ( R ` C ) ) -1-1-onto-> ( ( S ` C ) " ( ( 1 ... J ) \ ( R ` C ) ) ) -> ( ( 1 ... J ) \ ( R ` C ) ) ~~ ( ( S ` C ) " ( ( 1 ... J ) \ ( R ` C ) ) ) )
43 hasheni
 |-  ( ( ( 1 ... J ) \ ( R ` C ) ) ~~ ( ( S ` C ) " ( ( 1 ... J ) \ ( R ` C ) ) ) -> ( # ` ( ( 1 ... J ) \ ( R ` C ) ) ) = ( # ` ( ( S ` C ) " ( ( 1 ... J ) \ ( R ` C ) ) ) ) )
44 39 42 43 3syl
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( # ` ( ( 1 ... J ) \ ( R ` C ) ) ) = ( # ` ( ( S ` C ) " ( ( 1 ... J ) \ ( R ` C ) ) ) ) )
45 36 44 oveq12d
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( # ` ( ( 1 ... J ) i^i ( R ` C ) ) ) - ( # ` ( ( 1 ... J ) \ ( R ` C ) ) ) ) = ( ( # ` ( ( S ` C ) " ( ( 1 ... J ) i^i ( R ` C ) ) ) ) - ( # ` ( ( S ` C ) " ( ( 1 ... J ) \ ( R ` C ) ) ) ) ) )
46 1 2 3 4 5 6 7 8 9 10 ballotlemro
 |-  ( C e. ( O \ E ) -> ( R ` C ) e. O )
47 46 adantr
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( R ` C ) e. O )
48 elfzelz
 |-  ( J e. ( 1 ... ( I ` C ) ) -> J e. ZZ )
49 48 adantl
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> J e. ZZ )
50 1 2 3 4 5 47 49 ballotlemfval
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( F ` ( R ` C ) ) ` J ) = ( ( # ` ( ( 1 ... J ) i^i ( R ` C ) ) ) - ( # ` ( ( 1 ... J ) \ ( R ` C ) ) ) ) )
51 fzfi
 |-  ( 1 ... ( M + N ) ) e. Fin
52 eldifi
 |-  ( C e. ( O \ E ) -> C e. O )
53 1 2 3 ballotlemelo
 |-  ( C e. O <-> ( C C_ ( 1 ... ( M + N ) ) /\ ( # ` C ) = M ) )
54 53 simplbi
 |-  ( C e. O -> C C_ ( 1 ... ( M + N ) ) )
55 52 54 syl
 |-  ( C e. ( O \ E ) -> C C_ ( 1 ... ( M + N ) ) )
56 55 adantr
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> C C_ ( 1 ... ( M + N ) ) )
57 ssfi
 |-  ( ( ( 1 ... ( M + N ) ) e. Fin /\ C C_ ( 1 ... ( M + N ) ) ) -> C e. Fin )
58 51 56 57 sylancr
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> C e. Fin )
59 fzfid
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( ( S ` C ) ` J ) ... ( I ` C ) ) e. Fin )
60 1 2 3 4 5 6 7 8 9 10 11 ballotlemgval
 |-  ( ( C e. Fin /\ ( ( ( S ` C ) ` J ) ... ( I ` C ) ) e. Fin ) -> ( C .^ ( ( ( S ` C ) ` J ) ... ( I ` C ) ) ) = ( ( # ` ( ( ( ( S ` C ) ` J ) ... ( I ` C ) ) i^i C ) ) - ( # ` ( ( ( ( S ` C ) ` J ) ... ( I ` C ) ) \ C ) ) ) )
61 58 59 60 syl2anc
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( C .^ ( ( ( S ` C ) ` J ) ... ( I ` C ) ) ) = ( ( # ` ( ( ( ( S ` C ) ` J ) ... ( I ` C ) ) i^i C ) ) - ( # ` ( ( ( ( S ` C ) ` J ) ... ( I ` C ) ) \ C ) ) ) )
62 dff1o3
 |-  ( ( S ` C ) : ( 1 ... ( M + N ) ) -1-1-onto-> ( 1 ... ( M + N ) ) <-> ( ( S ` C ) : ( 1 ... ( M + N ) ) -onto-> ( 1 ... ( M + N ) ) /\ Fun `' ( S ` C ) ) )
63 62 simprbi
 |-  ( ( S ` C ) : ( 1 ... ( M + N ) ) -1-1-onto-> ( 1 ... ( M + N ) ) -> Fun `' ( S ` C ) )
64 imain
 |-  ( Fun `' ( S ` C ) -> ( ( S ` C ) " ( ( 1 ... J ) i^i ( R ` C ) ) ) = ( ( ( S ` C ) " ( 1 ... J ) ) i^i ( ( S ` C ) " ( R ` C ) ) ) )
65 13 63 64 3syl
 |-  ( C e. ( O \ E ) -> ( ( S ` C ) " ( ( 1 ... J ) i^i ( R ` C ) ) ) = ( ( ( S ` C ) " ( 1 ... J ) ) i^i ( ( S ` C ) " ( R ` C ) ) ) )
66 65 adantr
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( S ` C ) " ( ( 1 ... J ) i^i ( R ` C ) ) ) = ( ( ( S ` C ) " ( 1 ... J ) ) i^i ( ( S ` C ) " ( R ` C ) ) ) )
67 1 2 3 4 5 6 7 8 9 ballotlemsima
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( S ` C ) " ( 1 ... J ) ) = ( ( ( S ` C ) ` J ) ... ( I ` C ) ) )
68 1 2 3 4 5 6 7 8 9 10 ballotlemscr
 |-  ( C e. ( O \ E ) -> ( ( S ` C ) " ( R ` C ) ) = C )
69 68 adantr
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( S ` C ) " ( R ` C ) ) = C )
70 67 69 ineq12d
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( ( S ` C ) " ( 1 ... J ) ) i^i ( ( S ` C ) " ( R ` C ) ) ) = ( ( ( ( S ` C ) ` J ) ... ( I ` C ) ) i^i C ) )
71 66 70 eqtrd
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( S ` C ) " ( ( 1 ... J ) i^i ( R ` C ) ) ) = ( ( ( ( S ` C ) ` J ) ... ( I ` C ) ) i^i C ) )
72 71 fveq2d
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( # ` ( ( S ` C ) " ( ( 1 ... J ) i^i ( R ` C ) ) ) ) = ( # ` ( ( ( ( S ` C ) ` J ) ... ( I ` C ) ) i^i C ) ) )
73 imadif
 |-  ( Fun `' ( S ` C ) -> ( ( S ` C ) " ( ( 1 ... J ) \ ( R ` C ) ) ) = ( ( ( S ` C ) " ( 1 ... J ) ) \ ( ( S ` C ) " ( R ` C ) ) ) )
74 13 63 73 3syl
 |-  ( C e. ( O \ E ) -> ( ( S ` C ) " ( ( 1 ... J ) \ ( R ` C ) ) ) = ( ( ( S ` C ) " ( 1 ... J ) ) \ ( ( S ` C ) " ( R ` C ) ) ) )
75 74 adantr
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( S ` C ) " ( ( 1 ... J ) \ ( R ` C ) ) ) = ( ( ( S ` C ) " ( 1 ... J ) ) \ ( ( S ` C ) " ( R ` C ) ) ) )
76 67 69 difeq12d
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( ( S ` C ) " ( 1 ... J ) ) \ ( ( S ` C ) " ( R ` C ) ) ) = ( ( ( ( S ` C ) ` J ) ... ( I ` C ) ) \ C ) )
77 75 76 eqtrd
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( S ` C ) " ( ( 1 ... J ) \ ( R ` C ) ) ) = ( ( ( ( S ` C ) ` J ) ... ( I ` C ) ) \ C ) )
78 77 fveq2d
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( # ` ( ( S ` C ) " ( ( 1 ... J ) \ ( R ` C ) ) ) ) = ( # ` ( ( ( ( S ` C ) ` J ) ... ( I ` C ) ) \ C ) ) )
79 72 78 oveq12d
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( # ` ( ( S ` C ) " ( ( 1 ... J ) i^i ( R ` C ) ) ) ) - ( # ` ( ( S ` C ) " ( ( 1 ... J ) \ ( R ` C ) ) ) ) ) = ( ( # ` ( ( ( ( S ` C ) ` J ) ... ( I ` C ) ) i^i C ) ) - ( # ` ( ( ( ( S ` C ) ` J ) ... ( I ` C ) ) \ C ) ) ) )
80 61 79 eqtr4d
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( C .^ ( ( ( S ` C ) ` J ) ... ( I ` C ) ) ) = ( ( # ` ( ( S ` C ) " ( ( 1 ... J ) i^i ( R ` C ) ) ) ) - ( # ` ( ( S ` C ) " ( ( 1 ... J ) \ ( R ` C ) ) ) ) ) )
81 45 50 80 3eqtr4d
 |-  ( ( C e. ( O \ E ) /\ J e. ( 1 ... ( I ` C ) ) ) -> ( ( F ` ( R ` C ) ) ` J ) = ( C .^ ( ( ( S ` C ) ` J ) ... ( I ` C ) ) ) )