Metamath Proof Explorer


Theorem ballotlemro

Description: Range of R is included in O . (Contributed by Thierry Arnoux, 17-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 ballotlemro
|- ( C e. ( O \ E ) -> ( R ` C ) e. O )

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 1 2 3 4 5 6 7 8 9 10 ballotlemrval
 |-  ( C e. ( O \ E ) -> ( R ` C ) = ( ( S ` C ) " C ) )
12 imassrn
 |-  ( ( S ` C ) " C ) C_ ran ( S ` C )
13 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 ) ) )
14 13 simpld
 |-  ( C e. ( O \ E ) -> ( S ` C ) : ( 1 ... ( M + N ) ) -1-1-onto-> ( 1 ... ( M + N ) ) )
15 f1ofo
 |-  ( ( S ` C ) : ( 1 ... ( M + N ) ) -1-1-onto-> ( 1 ... ( M + N ) ) -> ( S ` C ) : ( 1 ... ( M + N ) ) -onto-> ( 1 ... ( M + N ) ) )
16 forn
 |-  ( ( S ` C ) : ( 1 ... ( M + N ) ) -onto-> ( 1 ... ( M + N ) ) -> ran ( S ` C ) = ( 1 ... ( M + N ) ) )
17 14 15 16 3syl
 |-  ( C e. ( O \ E ) -> ran ( S ` C ) = ( 1 ... ( M + N ) ) )
18 12 17 sseqtrid
 |-  ( C e. ( O \ E ) -> ( ( S ` C ) " C ) C_ ( 1 ... ( M + N ) ) )
19 11 18 eqsstrd
 |-  ( C e. ( O \ E ) -> ( R ` C ) C_ ( 1 ... ( M + N ) ) )
20 f1of1
 |-  ( ( S ` C ) : ( 1 ... ( M + N ) ) -1-1-onto-> ( 1 ... ( M + N ) ) -> ( S ` C ) : ( 1 ... ( M + N ) ) -1-1-> ( 1 ... ( M + N ) ) )
21 14 20 syl
 |-  ( C e. ( O \ E ) -> ( S ` C ) : ( 1 ... ( M + N ) ) -1-1-> ( 1 ... ( M + N ) ) )
22 eldifi
 |-  ( C e. ( O \ E ) -> C e. O )
23 1 2 3 ballotlemelo
 |-  ( C e. O <-> ( C C_ ( 1 ... ( M + N ) ) /\ ( # ` C ) = M ) )
24 22 23 sylib
 |-  ( C e. ( O \ E ) -> ( C C_ ( 1 ... ( M + N ) ) /\ ( # ` C ) = M ) )
25 24 simpld
 |-  ( C e. ( O \ E ) -> C C_ ( 1 ... ( M + N ) ) )
26 id
 |-  ( C e. ( O \ E ) -> C e. ( O \ E ) )
27 f1imaeng
 |-  ( ( ( S ` C ) : ( 1 ... ( M + N ) ) -1-1-> ( 1 ... ( M + N ) ) /\ C C_ ( 1 ... ( M + N ) ) /\ C e. ( O \ E ) ) -> ( ( S ` C ) " C ) ~~ C )
28 21 25 26 27 syl3anc
 |-  ( C e. ( O \ E ) -> ( ( S ` C ) " C ) ~~ C )
29 11 28 eqbrtrd
 |-  ( C e. ( O \ E ) -> ( R ` C ) ~~ C )
30 hasheni
 |-  ( ( R ` C ) ~~ C -> ( # ` ( R ` C ) ) = ( # ` C ) )
31 29 30 syl
 |-  ( C e. ( O \ E ) -> ( # ` ( R ` C ) ) = ( # ` C ) )
32 24 simprd
 |-  ( C e. ( O \ E ) -> ( # ` C ) = M )
33 31 32 eqtrd
 |-  ( C e. ( O \ E ) -> ( # ` ( R ` C ) ) = M )
34 1 2 3 ballotlemelo
 |-  ( ( R ` C ) e. O <-> ( ( R ` C ) C_ ( 1 ... ( M + N ) ) /\ ( # ` ( R ` C ) ) = M ) )
35 19 33 34 sylanbrc
 |-  ( C e. ( O \ E ) -> ( R ` C ) e. O )