Metamath Proof Explorer


Theorem ballotlemsf1o

Description: The defined S is a bijection, and an involution. (Contributed by Thierry Arnoux, 14-Apr-2017)

Ref Expression
Hypotheses ballotth.m M
ballotth.n N
ballotth.o O = c 𝒫 1 M + N | c = M
ballotth.p P = x 𝒫 O x O
ballotth.f F = c O i 1 i c 1 i c
ballotth.e E = c O | i 1 M + N 0 < F c i
ballotth.mgtn N < M
ballotth.i I = c O E sup k 1 M + N | F c k = 0 <
ballotth.s S = c O E i 1 M + N if i I c I c + 1 - i i
Assertion ballotlemsf1o C O E S C : 1 M + N 1-1 onto 1 M + N S C -1 = S C

Proof

Step Hyp Ref Expression
1 ballotth.m M
2 ballotth.n N
3 ballotth.o O = c 𝒫 1 M + N | c = M
4 ballotth.p P = x 𝒫 O x O
5 ballotth.f F = c O i 1 i c 1 i c
6 ballotth.e E = c O | i 1 M + N 0 < F c i
7 ballotth.mgtn N < M
8 ballotth.i I = c O E sup k 1 M + N | F c k = 0 <
9 ballotth.s S = c O E i 1 M + N if i I c I c + 1 - i i
10 1 2 3 4 5 6 7 8 9 ballotlemsval C O E S C = i 1 M + N if i I C I C + 1 - i i
11 1 2 3 4 5 6 7 8 9 ballotlemsv C O E i 1 M + N S C i = if i I C I C + 1 - i i
12 1 2 3 4 5 6 7 8 9 ballotlemsdom C O E i 1 M + N S C i 1 M + N
13 11 12 eqeltrrd C O E i 1 M + N if i I C I C + 1 - i i 1 M + N
14 1 2 3 4 5 6 7 8 9 ballotlemsv C O E j 1 M + N S C j = if j I C I C + 1 - j j
15 1 2 3 4 5 6 7 8 9 ballotlemsdom C O E j 1 M + N S C j 1 M + N
16 14 15 eqeltrrd C O E j 1 M + N if j I C I C + 1 - j j 1 M + N
17 oveq2 i = I C + 1 - j I C + 1 - i = I C + 1 - I C + 1 - j
18 id i = j i = j
19 breq1 i = I C + 1 - j i I C I C + 1 - j I C
20 breq1 i = j i I C j I C
21 1 2 3 4 5 6 7 8 ballotlemiex C O E I C 1 M + N F C I C = 0
22 21 simpld C O E I C 1 M + N
23 elfzelz I C 1 M + N I C
24 23 peano2zd I C 1 M + N I C + 1
25 22 24 syl C O E I C + 1
26 25 zcnd C O E I C + 1
27 26 adantr C O E i 1 M + N j 1 M + N I C + 1
28 elfzelz j 1 M + N j
29 28 zcnd j 1 M + N j
30 29 ad2antll C O E i 1 M + N j 1 M + N j
31 27 30 nncand C O E i 1 M + N j 1 M + N I C + 1 - I C + 1 - j = j
32 31 eqcomd C O E i 1 M + N j 1 M + N j = I C + 1 - I C + 1 - j
33 22 23 syl C O E I C
34 33 adantr C O E i 1 M + N j 1 M + N I C
35 elfznn j 1 M + N j
36 35 ad2antll C O E i 1 M + N j 1 M + N j
37 34 36 ltesubnnd C O E i 1 M + N j 1 M + N I C + 1 - j I C
38 37 adantr C O E i 1 M + N j 1 M + N j I C I C + 1 - j I C
39 vex j V
40 39 a1i C O E i 1 M + N j 1 M + N j V
41 ovexd C O E i 1 M + N j 1 M + N I C + 1 - j V
42 17 18 19 20 32 38 40 41 ifeqeqx C O E i 1 M + N j 1 M + N i = if j I C I C + 1 - j j j = if i I C I C + 1 - i i
43 oveq2 j = I C + 1 - i I C + 1 - j = I C + 1 - I C + 1 - i
44 id j = i j = i
45 breq1 j = I C + 1 - i j I C I C + 1 - i I C
46 breq1 j = i j I C i I C
47 elfzelz i 1 M + N i
48 47 zcnd i 1 M + N i
49 48 ad2antrl C O E i 1 M + N j 1 M + N i
50 27 49 nncand C O E i 1 M + N j 1 M + N I C + 1 - I C + 1 - i = i
51 50 eqcomd C O E i 1 M + N j 1 M + N i = I C + 1 - I C + 1 - i
52 34 adantr C O E i 1 M + N j 1 M + N i I C I C
53 simplrl C O E i 1 M + N j 1 M + N i I C i 1 M + N
54 elfznn i 1 M + N i
55 53 54 syl C O E i 1 M + N j 1 M + N i I C i
56 52 55 ltesubnnd C O E i 1 M + N j 1 M + N i I C I C + 1 - i I C
57 vex i V
58 57 a1i C O E i 1 M + N j 1 M + N i V
59 ovexd C O E i 1 M + N j 1 M + N I C + 1 - i V
60 43 44 45 46 51 56 58 59 ifeqeqx C O E i 1 M + N j 1 M + N j = if i I C I C + 1 - i i i = if j I C I C + 1 - j j
61 42 60 impbida C O E i 1 M + N j 1 M + N i = if j I C I C + 1 - j j j = if i I C I C + 1 - i i
62 10 13 16 61 f1o3d C O E S C : 1 M + N 1-1 onto 1 M + N S C -1 = j 1 M + N if j I C I C + 1 - j j
63 62 simpld C O E S C : 1 M + N 1-1 onto 1 M + N
64 oveq2 i = j I C + 1 - i = I C + 1 - j
65 20 64 18 ifbieq12d i = j if i I C I C + 1 - i i = if j I C I C + 1 - j j
66 65 cbvmptv i 1 M + N if i I C I C + 1 - i i = j 1 M + N if j I C I C + 1 - j j
67 66 a1i C O E i 1 M + N if i I C I C + 1 - i i = j 1 M + N if j I C I C + 1 - j j
68 62 simprd C O E S C -1 = j 1 M + N if j I C I C + 1 - j j
69 67 10 68 3eqtr4rd C O E S C -1 = S C
70 63 69 jca C O E S C : 1 M + N 1-1 onto 1 M + N S C -1 = S C