Metamath Proof Explorer


Theorem sticksstones16

Description: Sticks and stones with collapsed definitions for positive integers. (Contributed by metakunt, 20-Oct-2024)

Ref Expression
Hypotheses sticksstones16.1 φ N 0
sticksstones16.2 φ K
sticksstones16.3 A = g | g : 1 K 0 i = 1 K g i = N
Assertion sticksstones16 φ A = ( N + K - 1 K 1 )

Proof

Step Hyp Ref Expression
1 sticksstones16.1 φ N 0
2 sticksstones16.2 φ K
3 sticksstones16.3 A = g | g : 1 K 0 i = 1 K g i = N
4 fveq2 i = j g i = g j
5 4 cbvsumv i = 1 K g i = j = 1 K g j
6 5 eqeq1i i = 1 K g i = N j = 1 K g j = N
7 6 anbi2i g : 1 K 0 i = 1 K g i = N g : 1 K 0 j = 1 K g j = N
8 7 abbii g | g : 1 K 0 i = 1 K g i = N = g | g : 1 K 0 j = 1 K g j = N
9 3 8 eqtri A = g | g : 1 K 0 j = 1 K g j = N
10 9 a1i φ A = g | g : 1 K 0 j = 1 K g j = N
11 nfv g φ
12 2 nncnd φ K
13 1cnd φ 1
14 12 13 npcand φ K - 1 + 1 = K
15 14 eqcomd φ K = K - 1 + 1
16 15 oveq2d φ 1 K = 1 K - 1 + 1
17 16 feq2d φ g : 1 K 0 g : 1 K - 1 + 1 0
18 16 sumeq1d φ j = 1 K g j = j = 1 K - 1 + 1 g j
19 18 eqeq1d φ j = 1 K g j = N j = 1 K - 1 + 1 g j = N
20 17 19 anbi12d φ g : 1 K 0 j = 1 K g j = N g : 1 K - 1 + 1 0 j = 1 K - 1 + 1 g j = N
21 11 20 abbid φ g | g : 1 K 0 j = 1 K g j = N = g | g : 1 K - 1 + 1 0 j = 1 K - 1 + 1 g j = N
22 10 21 eqtrd φ A = g | g : 1 K - 1 + 1 0 j = 1 K - 1 + 1 g j = N
23 22 fveq2d φ A = g | g : 1 K - 1 + 1 0 j = 1 K - 1 + 1 g j = N
24 nnm1nn0 K K 1 0
25 2 24 syl φ K 1 0
26 fveq2 j = i g j = g i
27 26 cbvsumv j = 1 K - 1 + 1 g j = i = 1 K - 1 + 1 g i
28 27 eqeq1i j = 1 K - 1 + 1 g j = N i = 1 K - 1 + 1 g i = N
29 28 anbi2i g : 1 K - 1 + 1 0 j = 1 K - 1 + 1 g j = N g : 1 K - 1 + 1 0 i = 1 K - 1 + 1 g i = N
30 29 abbii g | g : 1 K - 1 + 1 0 j = 1 K - 1 + 1 g j = N = g | g : 1 K - 1 + 1 0 i = 1 K - 1 + 1 g i = N
31 1 25 30 sticksstones15 φ g | g : 1 K - 1 + 1 0 j = 1 K - 1 + 1 g j = N = ( N + K - 1 K 1 )
32 23 31 eqtrd φ A = ( N + K - 1 K 1 )