Metamath Proof Explorer


Theorem ballotlemsv

Description: Value of S evaluated at J for a given counting C . (Contributed by Thierry Arnoux, 12-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 ballotlemsv C O E J 1 M + N S C J = if J I C I C + 1 - J J

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 breq1 i = j i I C j I C
12 oveq2 i = j I C + 1 - i = I C + 1 - j
13 id i = j i = j
14 11 12 13 ifbieq12d i = j if i I C I C + 1 - i i = if j I C I C + 1 - j j
15 14 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
16 10 15 eqtrdi C O E S C = j 1 M + N if j I C I C + 1 - j j
17 16 adantr C O E J 1 M + N S C = j 1 M + N if j I C I C + 1 - j j
18 simpr C O E j = J j = J
19 18 breq1d C O E j = J j I C J I C
20 18 oveq2d C O E j = J I C + 1 - j = I C + 1 - J
21 19 20 18 ifbieq12d C O E j = J if j I C I C + 1 - j j = if J I C I C + 1 - J J
22 21 adantlr C O E J 1 M + N j = J if j I C I C + 1 - j j = if J I C I C + 1 - J J
23 simpr C O E J 1 M + N J 1 M + N
24 ovexd C O E J 1 M + N J I C I C + 1 - J V
25 elex J 1 M + N J V
26 25 ad2antlr C O E J 1 M + N ¬ J I C J V
27 24 26 ifclda C O E J 1 M + N if J I C I C + 1 - J J V
28 17 22 23 27 fvmptd C O E J 1 M + N S C J = if J I C I C + 1 - J J