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

theorem Th77:
  for D be non empty set, F be PartFunc of D,REAL, X be set, r
    st dom(F|X) is finite holds Sum(r(#)F,X) = r * Sum(F,X)
proof
  let D be non empty set, F be PartFunc of D,REAL, X be set, r;
  set x = dom(F|X);
   reconsider rr = r as Real;
  assume
A1: dom(F|X) is finite;
  then reconsider FX = F|X as finite Function by FINSET_1:10;
  dom((r(#)F)|X) = dom(r(#)(F|X)) by RFUNCT_1:49
    .= dom(F|X) by VALUED_1:def 5;
  then reconsider rFX = (r(#)F)|X as finite Function by A1,FINSET_1:10;
  consider b be FinSequence such that
A2: F|x, b are_fiberwise_equipotent by A1,RFINSEQ:5;
  rng(F|x) = rng b by A2,CLASSES1:75;
  then reconsider b as FinSequence of REAL by FINSEQ_1:def 4;
  x = dom F /\ X by RELAT_1:61;
  then
A3: F|x = (F|dom F)|X by RELAT_1:71
    .=F|X by RELAT_1:68;
  then
A4: rng b = rng(F|X) by A2,CLASSES1:75;
A5: now
    let x be Element of REAL;
A6: len(r*b) = len b by FINSEQ_2:33;
    now
      per cases;
      case
A7:     not x in rng(r*b);
A8:     now
          assume x in rng((r(#)F)|X);
          then x in rng(r(#)(F|X)) by RFUNCT_1:49;
          then consider d be Element of D such that
A9:       d in dom(r(#)(F|X)) and
A10:      (r(#)(F|X)).d = x by PARTFUN1:3;
          d in dom(F|X) by A9,VALUED_1:def 5;
          then (F|X).d in rng(F|X) by FUNCT_1:def 3;
          then consider n be Nat such that
A11:      n in dom b and
A12:      b.n=(F|X).d by A4,FINSEQ_2:10;
          x=r*(F|X).d by A9,A10,VALUED_1:def 5;
          then
A13:      x=(r*b).n by A12,RVSUM_1:44;
          n in dom (r*b) by A6,A11,FINSEQ_3:29;
          hence contradiction by A7,A13,FUNCT_1:def 3;
        end;
        (r*b)"{x} = {} by A7,Lm2;
        hence card((r*b)"{x}) = card(rFX"{x}) by A8,Lm2;
      end;
      case
        x in rng(r*b);
        then consider n be Nat such that
        n in dom(r*b) and
A14:    (r*b).n = x by FINSEQ_2:10;
        reconsider p=b.n as Real;
A15:    x = r*p by A14,RVSUM_1:44;
        now
          per cases;
          case
A16:        r=0;
            then
A17:        (r*b)"{x} = dom b by A15,RFINSEQ:25;
            dom(FX) =(r(#)(F|X))"{x} by A15,A16,Th7
              .=((r(#)F)|X)"{x} by RFUNCT_1:49;
            hence card((r*b)"{x}) = card(rFX"{x}) by A2,A3,A17,CLASSES1:81;
          end;
          case
A18:        r<>0;
            then
A19:        Coim(rr*b,x) = Coim(b,x/rr) by RFINSEQ:24;
            Coim((r(#)F)|X,x) = (r(#)(F|X))"{x} by RFUNCT_1:49
              .= Coim(FX,x/r) by A18,Th6;
            hence card Coim(r*b,x) = card Coim(rFX,x) by A2,A3,A19,
CLASSES1:def 10;
          end;
        end;
        hence card((r*b)"{x}) = card(rFX"{x});
      end;
    end;
    hence card Coim(r*b,x) = card Coim(rFX,x);
  end;
  rng(r*b) c=REAL & rng((r(#)F)|X) c= REAL;
  then
A20: r*b, (r(#)F)|X are_fiberwise_equipotent by A5,CLASSES1:79;
  F|X, FinS(F,X) are_fiberwise_equipotent by A1,Def13;
  then
A21: Sum b = Sum(F,X) by A2,A3,CLASSES1:76,RFINSEQ:9;
  dom((r(#)F)|X) = dom(r(#)F) /\ X by RELAT_1:61
    .= dom F /\ X by VALUED_1:def 5
    .= dom(F|X) by RELAT_1:61;
  then (r(#)F)|X, FinS(r(#)F,X) are_fiberwise_equipotent by A1,Def13;
  hence Sum(r(#)F,X) = Sum(r*b) by A20,CLASSES1:76,RFINSEQ:9
    .= r* Sum(F,X) by A21,RVSUM_1:87;
end;
