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 𝑀 ∈ ℕ
ballotth.n 𝑁 ∈ ℕ
ballotth.o 𝑂 = { 𝑐 ∈ 𝒫 ( 1 ... ( 𝑀 + 𝑁 ) ) ∣ ( ♯ ‘ 𝑐 ) = 𝑀 }
ballotth.p 𝑃 = ( 𝑥 ∈ 𝒫 𝑂 ↦ ( ( ♯ ‘ 𝑥 ) / ( ♯ ‘ 𝑂 ) ) )
ballotth.f 𝐹 = ( 𝑐𝑂 ↦ ( 𝑖 ∈ ℤ ↦ ( ( ♯ ‘ ( ( 1 ... 𝑖 ) ∩ 𝑐 ) ) − ( ♯ ‘ ( ( 1 ... 𝑖 ) ∖ 𝑐 ) ) ) ) )
ballotth.e 𝐸 = { 𝑐𝑂 ∣ ∀ 𝑖 ∈ ( 1 ... ( 𝑀 + 𝑁 ) ) 0 < ( ( 𝐹𝑐 ) ‘ 𝑖 ) }
ballotth.mgtn 𝑁 < 𝑀
ballotth.i 𝐼 = ( 𝑐 ∈ ( 𝑂𝐸 ) ↦ inf ( { 𝑘 ∈ ( 1 ... ( 𝑀 + 𝑁 ) ) ∣ ( ( 𝐹𝑐 ) ‘ 𝑘 ) = 0 } , ℝ , < ) )
ballotth.s 𝑆 = ( 𝑐 ∈ ( 𝑂𝐸 ) ↦ ( 𝑖 ∈ ( 1 ... ( 𝑀 + 𝑁 ) ) ↦ if ( 𝑖 ≤ ( 𝐼𝑐 ) , ( ( ( 𝐼𝑐 ) + 1 ) − 𝑖 ) , 𝑖 ) ) )
ballotth.r 𝑅 = ( 𝑐 ∈ ( 𝑂𝐸 ) ↦ ( ( 𝑆𝑐 ) “ 𝑐 ) )
Assertion ballotlemrinv 𝑅 = 𝑅

Proof

Step Hyp Ref Expression
1 ballotth.m 𝑀 ∈ ℕ
2 ballotth.n 𝑁 ∈ ℕ
3 ballotth.o 𝑂 = { 𝑐 ∈ 𝒫 ( 1 ... ( 𝑀 + 𝑁 ) ) ∣ ( ♯ ‘ 𝑐 ) = 𝑀 }
4 ballotth.p 𝑃 = ( 𝑥 ∈ 𝒫 𝑂 ↦ ( ( ♯ ‘ 𝑥 ) / ( ♯ ‘ 𝑂 ) ) )
5 ballotth.f 𝐹 = ( 𝑐𝑂 ↦ ( 𝑖 ∈ ℤ ↦ ( ( ♯ ‘ ( ( 1 ... 𝑖 ) ∩ 𝑐 ) ) − ( ♯ ‘ ( ( 1 ... 𝑖 ) ∖ 𝑐 ) ) ) ) )
6 ballotth.e 𝐸 = { 𝑐𝑂 ∣ ∀ 𝑖 ∈ ( 1 ... ( 𝑀 + 𝑁 ) ) 0 < ( ( 𝐹𝑐 ) ‘ 𝑖 ) }
7 ballotth.mgtn 𝑁 < 𝑀
8 ballotth.i 𝐼 = ( 𝑐 ∈ ( 𝑂𝐸 ) ↦ inf ( { 𝑘 ∈ ( 1 ... ( 𝑀 + 𝑁 ) ) ∣ ( ( 𝐹𝑐 ) ‘ 𝑘 ) = 0 } , ℝ , < ) )
9 ballotth.s 𝑆 = ( 𝑐 ∈ ( 𝑂𝐸 ) ↦ ( 𝑖 ∈ ( 1 ... ( 𝑀 + 𝑁 ) ) ↦ if ( 𝑖 ≤ ( 𝐼𝑐 ) , ( ( ( 𝐼𝑐 ) + 1 ) − 𝑖 ) , 𝑖 ) ) )
10 ballotth.r 𝑅 = ( 𝑐 ∈ ( 𝑂𝐸 ) ↦ ( ( 𝑆𝑐 ) “ 𝑐 ) )
11 1 2 3 4 5 6 7 8 9 10 ballotlemrinv0 ( ( 𝑐 ∈ ( 𝑂𝐸 ) ∧ 𝑑 = ( ( 𝑆𝑐 ) “ 𝑐 ) ) → ( 𝑑 ∈ ( 𝑂𝐸 ) ∧ 𝑐 = ( ( 𝑆𝑑 ) “ 𝑑 ) ) )
12 1 2 3 4 5 6 7 8 9 10 ballotlemrinv0 ( ( 𝑑 ∈ ( 𝑂𝐸 ) ∧ 𝑐 = ( ( 𝑆𝑑 ) “ 𝑑 ) ) → ( 𝑐 ∈ ( 𝑂𝐸 ) ∧ 𝑑 = ( ( 𝑆𝑐 ) “ 𝑐 ) ) )
13 11 12 impbii ( ( 𝑐 ∈ ( 𝑂𝐸 ) ∧ 𝑑 = ( ( 𝑆𝑐 ) “ 𝑐 ) ) ↔ ( 𝑑 ∈ ( 𝑂𝐸 ) ∧ 𝑐 = ( ( 𝑆𝑑 ) “ 𝑑 ) ) )
14 13 a1i ( ⊤ → ( ( 𝑐 ∈ ( 𝑂𝐸 ) ∧ 𝑑 = ( ( 𝑆𝑐 ) “ 𝑐 ) ) ↔ ( 𝑑 ∈ ( 𝑂𝐸 ) ∧ 𝑐 = ( ( 𝑆𝑑 ) “ 𝑑 ) ) ) )
15 14 mptcnv ( ⊤ → ( 𝑐 ∈ ( 𝑂𝐸 ) ↦ ( ( 𝑆𝑐 ) “ 𝑐 ) ) = ( 𝑑 ∈ ( 𝑂𝐸 ) ↦ ( ( 𝑆𝑑 ) “ 𝑑 ) ) )
16 15 mptru ( 𝑐 ∈ ( 𝑂𝐸 ) ↦ ( ( 𝑆𝑐 ) “ 𝑐 ) ) = ( 𝑑 ∈ ( 𝑂𝐸 ) ↦ ( ( 𝑆𝑑 ) “ 𝑑 ) )
17 fveq2 ( 𝑑 = 𝑐 → ( 𝑆𝑑 ) = ( 𝑆𝑐 ) )
18 id ( 𝑑 = 𝑐𝑑 = 𝑐 )
19 17 18 imaeq12d ( 𝑑 = 𝑐 → ( ( 𝑆𝑑 ) “ 𝑑 ) = ( ( 𝑆𝑐 ) “ 𝑐 ) )
20 19 cbvmptv ( 𝑑 ∈ ( 𝑂𝐸 ) ↦ ( ( 𝑆𝑑 ) “ 𝑑 ) ) = ( 𝑐 ∈ ( 𝑂𝐸 ) ↦ ( ( 𝑆𝑐 ) “ 𝑐 ) )
21 16 20 eqtri ( 𝑐 ∈ ( 𝑂𝐸 ) ↦ ( ( 𝑆𝑐 ) “ 𝑐 ) ) = ( 𝑐 ∈ ( 𝑂𝐸 ) ↦ ( ( 𝑆𝑐 ) “ 𝑐 ) )
22 10 cnveqi 𝑅 = ( 𝑐 ∈ ( 𝑂𝐸 ) ↦ ( ( 𝑆𝑐 ) “ 𝑐 ) )
23 21 22 10 3eqtr4i 𝑅 = 𝑅