reserve i, j, m, n for Nat,
  z, B0 for set,
  f, x0 for real-valued FinSequence;

theorem Th26:
  1<=i & i<=n implies Sum Base_FinSeq(n,i) = 1
proof
  assume that
A1: 1<=i and
A2: i<=n;
  defpred P[object,object] means (not ($1 in i) implies $2=1)&
   ($1 in i implies $2=0);
:: !!! ??? funckja charakterystyczna
  set F=Base_FinSeq(n,i);
A3: for x being object st x in NAT ex y being object st y in REAL & P[x,y]
  proof
    let x be object;
    assume x in NAT;
    then reconsider nx=x as Element of NAT;
    per cases;
    suppose
      nx>=i;
      then
A4: not nx in Segm i by NAT_1:44;
      take y = 1;
      thus y in REAL by XREAL_0:def 1;
      thus P[x,y] by A4;
    end;
    suppose
      nx<i;
      then nx in Segm i by NAT_1:44;
      hence ex y being object st y in REAL & P[x,y] by Lm3;
    end;
  end;
  consider f0 being sequence of REAL such that
A5: for x being object st x in NAT holds P[x,f0.x] from FUNCT_2:sch 1(A3);
A6: len Base_FinSeq(n,i) = n by MATRIXR2:74;
A7: for n2 being Nat st 0 <> n2 & n2 < len F holds f0.(n2 + 1) =
  addreal.(f0.n2,F.(n2 + 1))
  proof
    let n2 be Nat;
    assume that
    0 <> n2 and
A8: n2 < len F;
A9: n2+1<=n by A6,A8,NAT_1:13;
A10:  n2 in NAT by ORDINAL1:def 12;
    per cases;
    suppose
A11:   n2+1<i;
      then n2<i by NAT_1:13;
      then n2 in Segm i by NAT_1:44;
      then
A12:  f0.n2=0 by A5,A10;
A13:  1<=n2+1 by NAT_1:11;
A14:  (n2+1) in Segm i by A11,NAT_1:44;
      n2+1<=len F by A8,NAT_1:13;
      then addreal.(f0.n2,F.(n2+1))=addreal.(0,0) by A6,A11,A12,A13,MATRIXR2:76
        .= 0+0 by BINOP_2:def 9;
      hence f0.(n2 + 1) = addreal.(f0.n2,F.(n2 + 1)) by A5,A14;
    end;
    suppose
A15:  i<=n2+1;
      per cases by A15,XXREAL_0:1;
      suppose
A16:    i<n2+1;
        then i<=n2 by NAT_1:13;
        then
A17:    not n2 in Segm i by NAT_1:44;
A18:    not n2+1 in Segm i by A16,NAT_1:44;
        1<=n2+1 by A1,A16,XXREAL_0:2;
        then F.(n2 + 1)=0 by A9,A16,MATRIXR2:76;
        then addreal.(f0.n2,F.(n2 + 1))=addreal.(1,0) by A5,A17,A10
          .= 1+0 by BINOP_2:def 9;
        hence f0.(n2 + 1) = addreal.(f0.n2,F.(n2 + 1)) by A5,A18;
      end;
      suppose
A19:    i=n2+1;
        n2<n2+1 by XREAL_1:29;
        then n2 in Segm i by A19,NAT_1:44;
        then f0.n2=0 by A5,A10;
        then
A20:    addreal.(f0.n2,F.(n2 + 1))=addreal.(0,1) by A1,A2,A19,MATRIXR2:75
          .=0+1 by BINOP_2:def 9;
        not n2+1 in i by A19;
        hence f0.(n2 + 1) = addreal.(f0.n2,F.(n2 + 1)) by A5,A20;
      end;
    end;
  end;
A21: f0.1=F.1
  proof
    per cases;
    suppose
A22:  1<i;
      then 1 in Segm i by NAT_1:44;
      then
A23:  f0.1=0 by A5;
      1<=n by A1,A2,XXREAL_0:2;
      hence f0.1=F.1 by A22,A23,MATRIXR2:76;
    end;
    suppose
A24:  1>=i;
      then not 1 in Segm i by NAT_1:44;
      then
A25:  f0.1=1 by A5;
      1=i by A1,A24,XXREAL_0:1;
      hence f0.1=F.1 by A2,A25,MATRIXR2:75;
    end;
  end;
A26: f0.(len F)=1
  proof
    per cases;
    suppose
      len F<i;
      hence f0.(len F)=1 by A2,MATRIXR2:74;
    end;
    suppose
      len F >=i;
      then not len F in Segm i by NAT_1:44;
      hence f0.(len F)=1 by A5;
    end;
  end;
  len (Base_FinSeq(n,i)) >=1 by A1,A2,A6,XXREAL_0:2;
  hence thesis by A21,A26,A7,FINSOP_1:def 1;
end;
