Metamath Proof Explorer


Theorem sticksstones17

Description: Extend sticks and stones to finite sets, bijective builder. (Contributed by metakunt, 23-Oct-2024)

Ref Expression
Hypotheses sticksstones17.1 ( 𝜑𝑁 ∈ ℕ0 )
sticksstones17.2 ( 𝜑𝐾 ∈ ℕ0 )
sticksstones17.3 𝐴 = { 𝑔 ∣ ( 𝑔 : ( 1 ... 𝐾 ) ⟶ ℕ0 ∧ Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( 𝑔𝑖 ) = 𝑁 ) }
sticksstones17.4 𝐵 = { ∣ ( : 𝑆 ⟶ ℕ0 ∧ Σ 𝑖𝑆 ( 𝑖 ) = 𝑁 ) }
sticksstones17.5 ( 𝜑𝑍 : ( 1 ... 𝐾 ) –1-1-onto𝑆 )
sticksstones17.6 𝐺 = ( 𝑏𝐵 ↦ ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) )
Assertion sticksstones17 ( 𝜑𝐺 : 𝐵𝐴 )

Proof

Step Hyp Ref Expression
1 sticksstones17.1 ( 𝜑𝑁 ∈ ℕ0 )
2 sticksstones17.2 ( 𝜑𝐾 ∈ ℕ0 )
3 sticksstones17.3 𝐴 = { 𝑔 ∣ ( 𝑔 : ( 1 ... 𝐾 ) ⟶ ℕ0 ∧ Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( 𝑔𝑖 ) = 𝑁 ) }
4 sticksstones17.4 𝐵 = { ∣ ( : 𝑆 ⟶ ℕ0 ∧ Σ 𝑖𝑆 ( 𝑖 ) = 𝑁 ) }
5 sticksstones17.5 ( 𝜑𝑍 : ( 1 ... 𝐾 ) –1-1-onto𝑆 )
6 sticksstones17.6 𝐺 = ( 𝑏𝐵 ↦ ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) )
7 4 eqimssi 𝐵 ⊆ { ∣ ( : 𝑆 ⟶ ℕ0 ∧ Σ 𝑖𝑆 ( 𝑖 ) = 𝑁 ) }
8 7 a1i ( 𝜑𝐵 ⊆ { ∣ ( : 𝑆 ⟶ ℕ0 ∧ Σ 𝑖𝑆 ( 𝑖 ) = 𝑁 ) } )
9 8 sseld ( 𝜑 → ( 𝑏𝐵𝑏 ∈ { ∣ ( : 𝑆 ⟶ ℕ0 ∧ Σ 𝑖𝑆 ( 𝑖 ) = 𝑁 ) } ) )
10 9 imp ( ( 𝜑𝑏𝐵 ) → 𝑏 ∈ { ∣ ( : 𝑆 ⟶ ℕ0 ∧ Σ 𝑖𝑆 ( 𝑖 ) = 𝑁 ) } )
11 vex 𝑏 ∈ V
12 feq1 ( = 𝑏 → ( : 𝑆 ⟶ ℕ0𝑏 : 𝑆 ⟶ ℕ0 ) )
13 simpl ( ( = 𝑏𝑖𝑆 ) → = 𝑏 )
14 13 fveq1d ( ( = 𝑏𝑖𝑆 ) → ( 𝑖 ) = ( 𝑏𝑖 ) )
15 14 sumeq2dv ( = 𝑏 → Σ 𝑖𝑆 ( 𝑖 ) = Σ 𝑖𝑆 ( 𝑏𝑖 ) )
16 15 eqeq1d ( = 𝑏 → ( Σ 𝑖𝑆 ( 𝑖 ) = 𝑁 ↔ Σ 𝑖𝑆 ( 𝑏𝑖 ) = 𝑁 ) )
17 12 16 anbi12d ( = 𝑏 → ( ( : 𝑆 ⟶ ℕ0 ∧ Σ 𝑖𝑆 ( 𝑖 ) = 𝑁 ) ↔ ( 𝑏 : 𝑆 ⟶ ℕ0 ∧ Σ 𝑖𝑆 ( 𝑏𝑖 ) = 𝑁 ) ) )
18 11 17 elab ( 𝑏 ∈ { ∣ ( : 𝑆 ⟶ ℕ0 ∧ Σ 𝑖𝑆 ( 𝑖 ) = 𝑁 ) } ↔ ( 𝑏 : 𝑆 ⟶ ℕ0 ∧ Σ 𝑖𝑆 ( 𝑏𝑖 ) = 𝑁 ) )
19 10 18 sylib ( ( 𝜑𝑏𝐵 ) → ( 𝑏 : 𝑆 ⟶ ℕ0 ∧ Σ 𝑖𝑆 ( 𝑏𝑖 ) = 𝑁 ) )
20 19 simpld ( ( 𝜑𝑏𝐵 ) → 𝑏 : 𝑆 ⟶ ℕ0 )
21 20 adantr ( ( ( 𝜑𝑏𝐵 ) ∧ 𝑦 ∈ ( 1 ... 𝐾 ) ) → 𝑏 : 𝑆 ⟶ ℕ0 )
22 21 3impa ( ( 𝜑𝑏𝐵𝑦 ∈ ( 1 ... 𝐾 ) ) → 𝑏 : 𝑆 ⟶ ℕ0 )
23 f1of ( 𝑍 : ( 1 ... 𝐾 ) –1-1-onto𝑆𝑍 : ( 1 ... 𝐾 ) ⟶ 𝑆 )
24 5 23 syl ( 𝜑𝑍 : ( 1 ... 𝐾 ) ⟶ 𝑆 )
25 24 adantr ( ( 𝜑𝑏𝐵 ) → 𝑍 : ( 1 ... 𝐾 ) ⟶ 𝑆 )
26 25 adantr ( ( ( 𝜑𝑏𝐵 ) ∧ 𝑦 ∈ ( 1 ... 𝐾 ) ) → 𝑍 : ( 1 ... 𝐾 ) ⟶ 𝑆 )
27 26 3impa ( ( 𝜑𝑏𝐵𝑦 ∈ ( 1 ... 𝐾 ) ) → 𝑍 : ( 1 ... 𝐾 ) ⟶ 𝑆 )
28 simp3 ( ( 𝜑𝑏𝐵𝑦 ∈ ( 1 ... 𝐾 ) ) → 𝑦 ∈ ( 1 ... 𝐾 ) )
29 27 28 ffvelrnd ( ( 𝜑𝑏𝐵𝑦 ∈ ( 1 ... 𝐾 ) ) → ( 𝑍𝑦 ) ∈ 𝑆 )
30 22 29 ffvelrnd ( ( 𝜑𝑏𝐵𝑦 ∈ ( 1 ... 𝐾 ) ) → ( 𝑏 ‘ ( 𝑍𝑦 ) ) ∈ ℕ0 )
31 30 3expa ( ( ( 𝜑𝑏𝐵 ) ∧ 𝑦 ∈ ( 1 ... 𝐾 ) ) → ( 𝑏 ‘ ( 𝑍𝑦 ) ) ∈ ℕ0 )
32 31 fmpttd ( ( 𝜑𝑏𝐵 ) → ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) : ( 1 ... 𝐾 ) ⟶ ℕ0 )
33 eqidd ( ( ( 𝜑𝑏𝐵 ) ∧ 𝑖 ∈ ( 1 ... 𝐾 ) ) → ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) = ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) )
34 simpr ( ( ( ( 𝜑𝑏𝐵 ) ∧ 𝑖 ∈ ( 1 ... 𝐾 ) ) ∧ 𝑦 = 𝑖 ) → 𝑦 = 𝑖 )
35 34 fveq2d ( ( ( ( 𝜑𝑏𝐵 ) ∧ 𝑖 ∈ ( 1 ... 𝐾 ) ) ∧ 𝑦 = 𝑖 ) → ( 𝑍𝑦 ) = ( 𝑍𝑖 ) )
36 35 fveq2d ( ( ( ( 𝜑𝑏𝐵 ) ∧ 𝑖 ∈ ( 1 ... 𝐾 ) ) ∧ 𝑦 = 𝑖 ) → ( 𝑏 ‘ ( 𝑍𝑦 ) ) = ( 𝑏 ‘ ( 𝑍𝑖 ) ) )
37 simpr ( ( ( 𝜑𝑏𝐵 ) ∧ 𝑖 ∈ ( 1 ... 𝐾 ) ) → 𝑖 ∈ ( 1 ... 𝐾 ) )
38 fvexd ( ( ( 𝜑𝑏𝐵 ) ∧ 𝑖 ∈ ( 1 ... 𝐾 ) ) → ( 𝑏 ‘ ( 𝑍𝑖 ) ) ∈ V )
39 33 36 37 38 fvmptd ( ( ( 𝜑𝑏𝐵 ) ∧ 𝑖 ∈ ( 1 ... 𝐾 ) ) → ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ‘ 𝑖 ) = ( 𝑏 ‘ ( 𝑍𝑖 ) ) )
40 39 sumeq2dv ( ( 𝜑𝑏𝐵 ) → Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ‘ 𝑖 ) = Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( 𝑏 ‘ ( 𝑍𝑖 ) ) )
41 fveq2 ( 𝑠 = ( 𝑍𝑖 ) → ( 𝑏𝑠 ) = ( 𝑏 ‘ ( 𝑍𝑖 ) ) )
42 fzfi ( 1 ... 𝐾 ) ∈ Fin
43 42 a1i ( ( 𝜑𝑏𝐵 ) → ( 1 ... 𝐾 ) ∈ Fin )
44 5 adantr ( ( 𝜑𝑏𝐵 ) → 𝑍 : ( 1 ... 𝐾 ) –1-1-onto𝑆 )
45 eqidd ( ( ( 𝜑𝑏𝐵 ) ∧ 𝑖 ∈ ( 1 ... 𝐾 ) ) → ( 𝑍𝑖 ) = ( 𝑍𝑖 ) )
46 nn0sscn 0 ⊆ ℂ
47 46 a1i ( ( 𝜑𝑏𝐵 ) → ℕ0 ⊆ ℂ )
48 fss ( ( 𝑏 : 𝑆 ⟶ ℕ0 ∧ ℕ0 ⊆ ℂ ) → 𝑏 : 𝑆 ⟶ ℂ )
49 20 47 48 syl2anc ( ( 𝜑𝑏𝐵 ) → 𝑏 : 𝑆 ⟶ ℂ )
50 49 ffvelrnda ( ( ( 𝜑𝑏𝐵 ) ∧ 𝑠𝑆 ) → ( 𝑏𝑠 ) ∈ ℂ )
51 41 43 44 45 50 fsumf1o ( ( 𝜑𝑏𝐵 ) → Σ 𝑠𝑆 ( 𝑏𝑠 ) = Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( 𝑏 ‘ ( 𝑍𝑖 ) ) )
52 51 eqcomd ( ( 𝜑𝑏𝐵 ) → Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( 𝑏 ‘ ( 𝑍𝑖 ) ) = Σ 𝑠𝑆 ( 𝑏𝑠 ) )
53 fveq2 ( 𝑠 = 𝑖 → ( 𝑏𝑠 ) = ( 𝑏𝑖 ) )
54 53 cbvsumv Σ 𝑠𝑆 ( 𝑏𝑠 ) = Σ 𝑖𝑆 ( 𝑏𝑖 )
55 54 a1i ( ( 𝜑𝑏𝐵 ) → Σ 𝑠𝑆 ( 𝑏𝑠 ) = Σ 𝑖𝑆 ( 𝑏𝑖 ) )
56 19 simprd ( ( 𝜑𝑏𝐵 ) → Σ 𝑖𝑆 ( 𝑏𝑖 ) = 𝑁 )
57 55 56 eqtrd ( ( 𝜑𝑏𝐵 ) → Σ 𝑠𝑆 ( 𝑏𝑠 ) = 𝑁 )
58 52 57 eqtrd ( ( 𝜑𝑏𝐵 ) → Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( 𝑏 ‘ ( 𝑍𝑖 ) ) = 𝑁 )
59 40 58 eqtrd ( ( 𝜑𝑏𝐵 ) → Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ‘ 𝑖 ) = 𝑁 )
60 32 59 jca ( ( 𝜑𝑏𝐵 ) → ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) : ( 1 ... 𝐾 ) ⟶ ℕ0 ∧ Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ‘ 𝑖 ) = 𝑁 ) )
61 fzfid ( ( 𝜑𝑏𝐵 ) → ( 1 ... 𝐾 ) ∈ Fin )
62 61 mptexd ( ( 𝜑𝑏𝐵 ) → ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ∈ V )
63 feq1 ( 𝑔 = ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) → ( 𝑔 : ( 1 ... 𝐾 ) ⟶ ℕ0 ↔ ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) : ( 1 ... 𝐾 ) ⟶ ℕ0 ) )
64 simpl ( ( 𝑔 = ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ∧ 𝑖 ∈ ( 1 ... 𝐾 ) ) → 𝑔 = ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) )
65 64 fveq1d ( ( 𝑔 = ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ∧ 𝑖 ∈ ( 1 ... 𝐾 ) ) → ( 𝑔𝑖 ) = ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ‘ 𝑖 ) )
66 65 sumeq2dv ( 𝑔 = ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) → Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( 𝑔𝑖 ) = Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ‘ 𝑖 ) )
67 66 eqeq1d ( 𝑔 = ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) → ( Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( 𝑔𝑖 ) = 𝑁 ↔ Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ‘ 𝑖 ) = 𝑁 ) )
68 63 67 anbi12d ( 𝑔 = ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) → ( ( 𝑔 : ( 1 ... 𝐾 ) ⟶ ℕ0 ∧ Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( 𝑔𝑖 ) = 𝑁 ) ↔ ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) : ( 1 ... 𝐾 ) ⟶ ℕ0 ∧ Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ‘ 𝑖 ) = 𝑁 ) ) )
69 68 elabg ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ∈ V → ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ∈ { 𝑔 ∣ ( 𝑔 : ( 1 ... 𝐾 ) ⟶ ℕ0 ∧ Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( 𝑔𝑖 ) = 𝑁 ) } ↔ ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) : ( 1 ... 𝐾 ) ⟶ ℕ0 ∧ Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ‘ 𝑖 ) = 𝑁 ) ) )
70 62 69 syl ( ( 𝜑𝑏𝐵 ) → ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ∈ { 𝑔 ∣ ( 𝑔 : ( 1 ... 𝐾 ) ⟶ ℕ0 ∧ Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( 𝑔𝑖 ) = 𝑁 ) } ↔ ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) : ( 1 ... 𝐾 ) ⟶ ℕ0 ∧ Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ‘ 𝑖 ) = 𝑁 ) ) )
71 60 70 mpbird ( ( 𝜑𝑏𝐵 ) → ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ∈ { 𝑔 ∣ ( 𝑔 : ( 1 ... 𝐾 ) ⟶ ℕ0 ∧ Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( 𝑔𝑖 ) = 𝑁 ) } )
72 3 a1i ( ( 𝜑𝑏𝐵 ) → 𝐴 = { 𝑔 ∣ ( 𝑔 : ( 1 ... 𝐾 ) ⟶ ℕ0 ∧ Σ 𝑖 ∈ ( 1 ... 𝐾 ) ( 𝑔𝑖 ) = 𝑁 ) } )
73 71 72 eleqtrrd ( ( 𝜑𝑏𝐵 ) → ( 𝑦 ∈ ( 1 ... 𝐾 ) ↦ ( 𝑏 ‘ ( 𝑍𝑦 ) ) ) ∈ 𝐴 )
74 73 6 fmptd ( 𝜑𝐺 : 𝐵𝐴 )