
theorem
  for X be non empty set, S be SigmaField of X, f be PartFunc of X,
  ExtREAL, F be Finite_Sep_Sequence of S, a be FinSequence of ExtREAL, x be
  Element of X st F,a are_Re-presentation_of f & x in dom f holds ex ax be
FinSequence of ExtREAL st dom ax= dom a & (for n be Nat st n in dom ax holds ax
  .n=a.n*(chi(F.n,X)).x) & f.x=Sum(ax)
proof
  let X be non empty set;
  let S be SigmaField of X;
  let f be PartFunc of X,ExtREAL;
  let F be Finite_Sep_Sequence of S;
  let a be FinSequence of ExtREAL;
  let x be Element of X such that
A1: F,a are_Re-presentation_of f and
A2: x in dom f;
A3: dom F = dom a by A1;
  deffunc F(Nat) = a.$1*(chi(F.$1,X)).x;
  consider ax be FinSequence of ExtREAL such that
A4: len ax = len a & for j be Nat st j in dom ax holds ax.j = F(j) from
  FINSEQ_2:sch 1;
A5: dom ax = Seg len a by A4,FINSEQ_1:def 3;
A6: dom f = union rng F by A1;
A7: f.x = Sum(ax)
  proof
    consider Y be set such that
A8: x in Y and
A9: Y in rng F by A2,A6,TARSKI:def 4;
    consider k be object such that
A10: k in dom F and
A11: Y = F.k by A9,FUNCT_1:def 3;
    reconsider k as Element of NAT by A10;
A12: k in Seg len a by A3,A10,FINSEQ_1:def 3;
    then
A13: len ax >= k by A4,FINSEQ_1:1;
A14: for i be Nat st i in Seg len ax & i <> k holds ax.i = 0.
    proof
      let i be Nat;
      assume that
A15:  i in Seg len ax and
A16:  i <> k;
      F.i misses F.k by A16,PROB_2:def 2;
      then F.i /\ F.k = {};
      then not x in F.i by A8,A11,XBOOLE_0:def 4;
      then
A17:  chi(F.i,X).x = 0. by FUNCT_3:def 3;
      ax.i = a.i * (chi(F.i,X)).x by A4,A5,A15;
      hence thesis by A17;
    end;
    consider SA be sequence of ExtREAL such that
A18: Sum(ax) = SA.(len ax) and
A19: SA.0 = 0. and
A20: for i be Nat st i < len ax holds SA.(i+1)=SA.i + ax.(i
    +1 ) by EXTREAL1:def 2;
    defpred P[Nat] means $1 <= len ax implies ($1 < k implies SA.$1 = 0.) & (
    $1 >= k implies SA.$1 = f.x);
A21: for i be Nat st i in Seg len ax & i = k holds ax.i = f.x
    proof
      let i be Nat;
      assume that
A22:  i in Seg len ax and
A23:  i = k;
      chi(F.i,X).x = 1. by A8,A11,A23,FUNCT_3:def 3;
      then ax.i = a.i * 1. by A4,A5,A22
        .= a.i by XXREAL_3:81;
      hence thesis by A1,A8,A10,A11,A23;
    end;
A24: for i be Nat st P[i] holds P[i+1]
    proof
      let i be Nat;
      assume
A25:  P[i];
      assume
A26:  i+1 <= len ax;
      reconsider i as Element of NAT by ORDINAL1:def 12;
      now
        per cases;
        case
A27:      i+1 < k;
A28:      k <= len a by A12,FINSEQ_1:1;
A29:      i <= i+1 by NAT_1:11;
          then i < k by A27,XXREAL_0:2;
          then
A30:      i < len ax by A4,A28,XXREAL_0:2;
          then 1 <= i+1 & i+1 <= len ax by NAT_1:11,13;
          then
A31:      i+1 in Seg len ax by FINSEQ_1:1;
          SA.(i+1) = 0. + ax.(i+1) by A20,A25,A27,A29,A30,XXREAL_0:2
            .= ax.(i+1) by XXREAL_3:4
            .= 0. by A14,A27,A31;
          hence thesis by A27;
        end;
        case
A32:      i+1 >= k;
          now
            per cases;
            case
A33:          k = i+1;
A34:          k <= len a by A12,FINSEQ_1:1;
              then i < len ax by A4,A33,NAT_1:13;
              hence SA.(i+1) = SA.i + ax.(i+1) by A20
                .= ax.k by A4,A25,A33,A34,NAT_1:13,XXREAL_3:4
                .= f.x by A4,A12,A21;
            end;
            case
              k <> i+1;
              then
A35:          k < i+1 by A32,XXREAL_0:1;
              1 <= i+1 by NAT_1:11;
              then
A36:          i+1 in Seg len ax by A26,FINSEQ_1:1;
              i < len ax by A26,NAT_1:13;
              hence SA.(i+1) = SA.i + ax.(i+1) by A20
                .= f.x + 0. by A14,A25,A26,A35,A36,NAT_1:13
                .= f.x by XXREAL_3:4;
            end;
          end;
          hence thesis by A32;
        end;
      end;
      hence thesis;
    end;
A37: P[0] by A12,A19,FINSEQ_1:1;
    for i be Nat holds P[i] from NAT_1:sch 2(A37,A24);
    hence thesis by A18,A13;
  end;
  take ax;
  dom ax = Seg len a by A4,FINSEQ_1:def 3;
  hence thesis by A4,A7,FINSEQ_1:def 3;
end;
