Metamath Proof Explorer


Theorem ballotlemrval

Description: Value of R . (Contributed by Thierry Arnoux, 14-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 ) )
Assertion ballotlemrval
|- ( C e. ( O \ E ) -> ( R ` C ) = ( ( S ` C ) " 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 fveq2
 |-  ( d = C -> ( S ` d ) = ( S ` C ) )
12 id
 |-  ( d = C -> d = C )
13 11 12 imaeq12d
 |-  ( d = C -> ( ( S ` d ) " d ) = ( ( S ` C ) " C ) )
14 fveq2
 |-  ( c = d -> ( S ` c ) = ( S ` d ) )
15 id
 |-  ( c = d -> c = d )
16 14 15 imaeq12d
 |-  ( c = d -> ( ( S ` c ) " c ) = ( ( S ` d ) " d ) )
17 16 cbvmptv
 |-  ( c e. ( O \ E ) |-> ( ( S ` c ) " c ) ) = ( d e. ( O \ E ) |-> ( ( S ` d ) " d ) )
18 10 17 eqtri
 |-  R = ( d e. ( O \ E ) |-> ( ( S ` d ) " d ) )
19 fvex
 |-  ( S ` C ) e. _V
20 imaexg
 |-  ( ( S ` C ) e. _V -> ( ( S ` C ) " C ) e. _V )
21 19 20 ax-mp
 |-  ( ( S ` C ) " C ) e. _V
22 13 18 21 fvmpt
 |-  ( C e. ( O \ E ) -> ( R ` C ) = ( ( S ` C ) " C ) )