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 φN0
sticksstones16.2 φK
sticksstones16.3 A=g|g:1K0i=1Kgi=N
Assertion sticksstones16 φA=(N+K-1K1)

Proof

Step Hyp Ref Expression
1 sticksstones16.1 φN0
2 sticksstones16.2 φK
3 sticksstones16.3 A=g|g:1K0i=1Kgi=N
4 fveq2 i=jgi=gj
5 4 cbvsumv i=1Kgi=j=1Kgj
6 5 eqeq1i i=1Kgi=Nj=1Kgj=N
7 6 anbi2i g:1K0i=1Kgi=Ng:1K0j=1Kgj=N
8 7 abbii g|g:1K0i=1Kgi=N=g|g:1K0j=1Kgj=N
9 3 8 eqtri A=g|g:1K0j=1Kgj=N
10 9 a1i φA=g|g:1K0j=1Kgj=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 φ1K=1K-1+1
17 16 feq2d φg:1K0g:1K-1+10
18 16 sumeq1d φj=1Kgj=j=1K-1+1gj
19 18 eqeq1d φj=1Kgj=Nj=1K-1+1gj=N
20 17 19 anbi12d φg:1K0j=1Kgj=Ng:1K-1+10j=1K-1+1gj=N
21 11 20 abbid φg|g:1K0j=1Kgj=N=g|g:1K-1+10j=1K-1+1gj=N
22 10 21 eqtrd φA=g|g:1K-1+10j=1K-1+1gj=N
23 22 fveq2d φA=g|g:1K-1+10j=1K-1+1gj=N
24 nnm1nn0 KK10
25 2 24 syl φK10
26 fveq2 j=igj=gi
27 26 cbvsumv j=1K-1+1gj=i=1K-1+1gi
28 27 eqeq1i j=1K-1+1gj=Ni=1K-1+1gi=N
29 28 anbi2i g:1K-1+10j=1K-1+1gj=Ng:1K-1+10i=1K-1+1gi=N
30 29 abbii g|g:1K-1+10j=1K-1+1gj=N=g|g:1K-1+10i=1K-1+1gi=N
31 1 25 30 sticksstones15 φg|g:1K-1+10j=1K-1+1gj=N=(N+K-1K1)
32 23 31 eqtrd φA=(N+K-1K1)