Metamath Proof Explorer


Theorem ballotlemrinv

Description: R is its own inverse : it is an involution. (Contributed by Thierry Arnoux, 10-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 ballotlemrinv
|- `' R = R

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 ballotlemrinv0
 |-  ( ( c e. ( O \ E ) /\ d = ( ( S ` c ) " c ) ) -> ( d e. ( O \ E ) /\ c = ( ( S ` d ) " d ) ) )
12 1 2 3 4 5 6 7 8 9 10 ballotlemrinv0
 |-  ( ( d e. ( O \ E ) /\ c = ( ( S ` d ) " d ) ) -> ( c e. ( O \ E ) /\ d = ( ( S ` c ) " c ) ) )
13 11 12 impbii
 |-  ( ( c e. ( O \ E ) /\ d = ( ( S ` c ) " c ) ) <-> ( d e. ( O \ E ) /\ c = ( ( S ` d ) " d ) ) )
14 13 a1i
 |-  ( T. -> ( ( c e. ( O \ E ) /\ d = ( ( S ` c ) " c ) ) <-> ( d e. ( O \ E ) /\ c = ( ( S ` d ) " d ) ) ) )
15 14 mptcnv
 |-  ( T. -> `' ( c e. ( O \ E ) |-> ( ( S ` c ) " c ) ) = ( d e. ( O \ E ) |-> ( ( S ` d ) " d ) ) )
16 15 mptru
 |-  `' ( c e. ( O \ E ) |-> ( ( S ` c ) " c ) ) = ( d e. ( O \ E ) |-> ( ( S ` d ) " d ) )
17 fveq2
 |-  ( d = c -> ( S ` d ) = ( S ` c ) )
18 id
 |-  ( d = c -> d = c )
19 17 18 imaeq12d
 |-  ( d = c -> ( ( S ` d ) " d ) = ( ( S ` c ) " c ) )
20 19 cbvmptv
 |-  ( d e. ( O \ E ) |-> ( ( S ` d ) " d ) ) = ( c e. ( O \ E ) |-> ( ( S ` c ) " c ) )
21 16 20 eqtri
 |-  `' ( c e. ( O \ E ) |-> ( ( S ` c ) " c ) ) = ( c e. ( O \ E ) |-> ( ( S ` c ) " c ) )
22 10 cnveqi
 |-  `' R = `' ( c e. ( O \ E ) |-> ( ( S ` c ) " c ) )
23 21 22 10 3eqtr4i
 |-  `' R = R