reserve n,m for Nat,
  r,r1,r2,s,t for Real,
  x,y for set;

theorem
  for D be non empty set, f,g be FinSequence of PFuncs(D,REAL) st f,g
  are_fiberwise_equipotent holds Sum f = Sum g
proof
  let D be non empty set;
  defpred P[Nat] means for f,g be FinSequence of PFuncs(D,REAL) st
  f,g are_fiberwise_equipotent & len f = $1 holds Sum f = Sum g;
  let f,g be FinSequence of PFuncs(D,REAL);
  assume
A1: f,g are_fiberwise_equipotent;
A2: len f = len f;
A3: for n st P[n] holds P[n+1]
  proof
    let n;
    assume
A4: P[n];
    let f,g be FinSequence of PFuncs(D,REAL);
    assume that
A5: f,g are_fiberwise_equipotent and
A6: len f = n+1;
    0+1<=n+1 by NAT_1:13;
    then
A7: n+1 in dom f by A6,FINSEQ_3:25;
    then reconsider a=f.(n+1) as Element of PFuncs(D,REAL) by FINSEQ_2:11;
    rng f = rng g by A5,CLASSES1:75;
    then a in rng g by A7,FUNCT_1:def 3;
    then consider m being Nat such that
A8: m in dom g and
A9: g.m = a by FINSEQ_2:10;
A10: g = (g|m) ^ (g/^m) by RFINSEQ:8;
    set gg = g/^m, gm = g|m;
    m<=len g by A8,FINSEQ_3:25;
    then
A11: len gm = m by FINSEQ_1:59;
    set fn=f|n;
A12: f = fn ^ <*a*> by A6,RFINSEQ:7;
A13: 1<=m by A8,FINSEQ_3:25;
    then max(0,m-1)=m-1 by FINSEQ_2:4;
    then reconsider m1=m-1 as Element of NAT by FINSEQ_2:5;
A14: m=m1+1;
    then m1<=m by NAT_1:11;
    then
A15: Seg m1 c= Seg m by FINSEQ_1:5;
    m in Seg m by A13,FINSEQ_1:1;
    then gm.m = a by A8,A9,RFINSEQ:6;
    then
A16: gm = (gm|m1) ^ <*a*> by A11,A14,RFINSEQ:7;
A17: gm|m1 = gm|(Seg m1) by FINSEQ_1:def 16
      .= (g|(Seg m))|(Seg m1) by FINSEQ_1:def 16
      .= g|((Seg m)/\(Seg m1)) by RELAT_1:71
      .= g|(Seg m1) by A15,XBOOLE_1:28
      .= g|m1 by FINSEQ_1:def 16;
    now
      let x be object;
      card Coim(f,x) = card Coim(g,x) by A5,CLASSES1:def 10;
      then
      card(fn"{x}) + card(<*a*>"{x}) = card(((g|m1)^<*a*>^(g/^m))"{x}) by A10
,A16,A17,A12,FINSEQ_3:57
        .= card(((g|m1)^<*a*>)"{x}) + card((g/^m)"{x}) by FINSEQ_3:57
        .= card((g|m1)"{x})+ card(<*a*>"{x}) + card((g/^m)"{x}) by FINSEQ_3:57
        .= card((g|m1)"{x}) + card((g/^m)"{x})+ card(<*a*>"{x})
        .= card(((g|m1)^(g/^m))"{x})+ card(<*a*>"{x}) by FINSEQ_3:57;
      hence card Coim(fn,x) = card Coim((g|m1)^(g/^m),x);
    end;
    then
A18: fn, (g|m1)^(g/^m) are_fiberwise_equipotent by CLASSES1:def 10;
    len fn = n by A6,FINSEQ_1:59,NAT_1:11;
    then Sum fn = Sum((g|m1)^gg) by A4,A18;
    hence Sum f = Sum((g|m1)^gg) + Sum <*a*> by A12,Th21
      .= Sum(g|m1) + Sum gg+ Sum <*a*> by Th21
      .= Sum(g|m1)+ Sum <*a*> + Sum gg by RFUNCT_1:8
      .= Sum gm + Sum gg by A16,A17,Th21
      .= Sum g by A10,Th21;
  end;
A19: P[ 0 ]
  proof
    let f,g be FinSequence of PFuncs(D,REAL);
    assume f,g are_fiberwise_equipotent & len f = 0;
    then
A20:   len g = 0 & f =<*>PFuncs(D,REAL) by RFINSEQ:3;
     then g =<*>PFuncs(D,REAL);
    hence thesis by A20;
  end;
  for n holds P[n] from NAT_1:sch 2(A19,A3);
  hence thesis by A1,A2;
end;
