Metamath Proof Explorer


Theorem sticksstones18

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

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

Proof

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