Metamath Proof Explorer


Theorem sticksstones13

Description: Establish bijective mapping between strictly monotone functions and functions that sum to a fixed non-negative integer. (Contributed by metakunt, 6-Oct-2024)

Ref Expression
Hypotheses sticksstones13.1 ( 𝜑𝑁 ∈ ℕ0 )
sticksstones13.2 ( 𝜑𝐾 ∈ ℕ0 )
sticksstones13.3 𝐹 = ( 𝑎𝐴 ↦ ( 𝑗 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑗 + Σ 𝑙 ∈ ( 1 ... 𝑗 ) ( 𝑎𝑙 ) ) ) )
sticksstones13.4 𝐺 = ( 𝑏𝐵 ↦ if ( 𝐾 = 0 , { ⟨ 1 , 𝑁 ⟩ } , ( 𝑘 ∈ ( 1 ... ( 𝐾 + 1 ) ) ↦ if ( 𝑘 = ( 𝐾 + 1 ) , ( ( 𝑁 + 𝐾 ) − ( 𝑏𝐾 ) ) , if ( 𝑘 = 1 , ( ( 𝑏 ‘ 1 ) − 1 ) , ( ( ( 𝑏𝑘 ) − ( 𝑏 ‘ ( 𝑘 − 1 ) ) ) − 1 ) ) ) ) ) )
sticksstones13.5 𝐴 = { 𝑔 ∣ ( 𝑔 : ( 1 ... ( 𝐾 + 1 ) ) ⟶ ℕ0 ∧ Σ 𝑖 ∈ ( 1 ... ( 𝐾 + 1 ) ) ( 𝑔𝑖 ) = 𝑁 ) }
sticksstones13.6 𝐵 = { 𝑓 ∣ ( 𝑓 : ( 1 ... 𝐾 ) ⟶ ( 1 ... ( 𝑁 + 𝐾 ) ) ∧ ∀ 𝑥 ∈ ( 1 ... 𝐾 ) ∀ 𝑦 ∈ ( 1 ... 𝐾 ) ( 𝑥 < 𝑦 → ( 𝑓𝑥 ) < ( 𝑓𝑦 ) ) ) }
Assertion sticksstones13 ( 𝜑𝐹 : 𝐴1-1-onto𝐵 )

Proof

Step Hyp Ref Expression
1 sticksstones13.1 ( 𝜑𝑁 ∈ ℕ0 )
2 sticksstones13.2 ( 𝜑𝐾 ∈ ℕ0 )
3 sticksstones13.3 𝐹 = ( 𝑎𝐴 ↦ ( 𝑗 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑗 + Σ 𝑙 ∈ ( 1 ... 𝑗 ) ( 𝑎𝑙 ) ) ) )
4 sticksstones13.4 𝐺 = ( 𝑏𝐵 ↦ if ( 𝐾 = 0 , { ⟨ 1 , 𝑁 ⟩ } , ( 𝑘 ∈ ( 1 ... ( 𝐾 + 1 ) ) ↦ if ( 𝑘 = ( 𝐾 + 1 ) , ( ( 𝑁 + 𝐾 ) − ( 𝑏𝐾 ) ) , if ( 𝑘 = 1 , ( ( 𝑏 ‘ 1 ) − 1 ) , ( ( ( 𝑏𝑘 ) − ( 𝑏 ‘ ( 𝑘 − 1 ) ) ) − 1 ) ) ) ) ) )
5 sticksstones13.5 𝐴 = { 𝑔 ∣ ( 𝑔 : ( 1 ... ( 𝐾 + 1 ) ) ⟶ ℕ0 ∧ Σ 𝑖 ∈ ( 1 ... ( 𝐾 + 1 ) ) ( 𝑔𝑖 ) = 𝑁 ) }
6 sticksstones13.6 𝐵 = { 𝑓 ∣ ( 𝑓 : ( 1 ... 𝐾 ) ⟶ ( 1 ... ( 𝑁 + 𝐾 ) ) ∧ ∀ 𝑥 ∈ ( 1 ... 𝐾 ) ∀ 𝑦 ∈ ( 1 ... 𝐾 ) ( 𝑥 < 𝑦 → ( 𝑓𝑥 ) < ( 𝑓𝑦 ) ) ) }
7 1 adantr ( ( 𝜑𝐾 = 0 ) → 𝑁 ∈ ℕ0 )
8 simpr ( ( 𝜑𝐾 = 0 ) → 𝐾 = 0 )
9 7 8 3 4 5 6 sticksstones11 ( ( 𝜑𝐾 = 0 ) → 𝐹 : 𝐴1-1-onto𝐵 )
10 1 adantr ( ( 𝜑𝐾 ∈ ℕ ) → 𝑁 ∈ ℕ0 )
11 simpr ( ( 𝜑𝐾 ∈ ℕ ) → 𝐾 ∈ ℕ )
12 10 11 3 4 5 6 sticksstones12 ( ( 𝜑𝐾 ∈ ℕ ) → 𝐹 : 𝐴1-1-onto𝐵 )
13 elnn0 ( 𝐾 ∈ ℕ0 ↔ ( 𝐾 ∈ ℕ ∨ 𝐾 = 0 ) )
14 13 biimpi ( 𝐾 ∈ ℕ0 → ( 𝐾 ∈ ℕ ∨ 𝐾 = 0 ) )
15 14 orcomd ( 𝐾 ∈ ℕ0 → ( 𝐾 = 0 ∨ 𝐾 ∈ ℕ ) )
16 2 15 syl ( 𝜑 → ( 𝐾 = 0 ∨ 𝐾 ∈ ℕ ) )
17 9 12 16 mpjaodan ( 𝜑𝐹 : 𝐴1-1-onto𝐵 )