
theorem Th8:
for a,b be Real, A be non empty closed_interval Subset of REAL
 st a < b & A = [.a,b.] holds
  for n be Nat st n > 0 ex D be Division of A st D divide_into_equal n
proof
    let a,b be Real, A be non empty closed_interval Subset of REAL;
    assume that
A1:  a < b and
A2:  A = [.a,b.];

A3: b-a > 0 by A1,XREAL_1:50;

    hereby let n be Nat;
     assume A4: n > 0;
     defpred P[Nat,Real] means $2 = a + (b-a) * $1 / n;

A5:  for k be Nat st k in Seg n ex r be Element of REAL st P[k,r]
     proof
      let k be Nat;
      assume k in Seg n;
      a + (b-a) * k / n is Element of REAL by XREAL_0:def 1;
      hence thesis;
     end;

     consider D be FinSequence of REAL such that
A6:   dom D = Seg n & for k be Nat st k in Seg n holds P[k,D.k]
        from FINSEQ_1:sch 5(A5);

     reconsider D as non empty FinSequence of REAL by A6,A4;

     for k be Nat st 1 <= k & k < len D holds D.k < D.(k+1)
     proof
      let k be Nat;
      assume A7: 1 <= k & k < len D; then
      1 <= k+1 & k+1 <= len D by NAT_1:13; then
A8:   D.k = a + (b-a)*k / n
    & D.(k+1) = a + (b-a)*(k+1) / n by A6,A7,FINSEQ_3:25;

      k < k+1 by NAT_1:13; then
      (b-a)*k < (b-a)*(k+1) by A3,XREAL_1:68; then
      (b-a)*k/ n < (b-a)*(k+1)/ n by A4,XREAL_1:74;
      hence D.k < D.(k+1) by A8,XREAL_1:8;
     end; then
     reconsider D as non empty increasing FinSequence of REAL
       by EUCLID_7:def 1;

     now let x be object;
      assume x in rng D; then
      consider k be Element of NAT such that
A9:   k in dom D & x = D.k by PARTFUN1:3;
A10:  D.k = a + (b-a)*k / n by A6,A9;

      1 <= k & k <= n by A6,A9,FINSEQ_1:1; then
      0 < k / n <= 1 by XREAL_1:139,183; then
      0 < (b-a) * (k / n) <= b-a by A3,XREAL_1:129,153; then
A11:  0 < (b-a) * k / n <= b-a by XCMPLX_1:74;
      a + (b-a) = b; then
      a < a + (b-a)*k / n <= b by A11,XREAL_1:29,6;
      hence x in A by A2,A9,A10,XXREAL_1:1;
     end; then
A12: rng D c= A;

     dom D = Seg len D by FINSEQ_1:def 3; then
A13: len D = n by A6,FINSEQ_1:6; then
     D.(len D) = a + (b-a) * n / n by A6,FINSEQ_1:3; then
A14: D.(len D) = a + (b-a) by A4,XCMPLX_1:89;
     A = [.lower_bound A,upper_bound A.] by INTEGRA1:4; then
     upper_bound A = b by A2,INTEGRA1:5; then
     reconsider D as Division of A by A12,A14,INTEGRA1:def 2;
     for k be Nat st k in dom D holds D.k = lower_bound A + vol(A)/(len D)*k
     proof
      let k be Nat;
      assume k in dom D; then
A15:   D.k = a + (b-a) * k / n by A6;
      A = [.lower_bound A,upper_bound A.] by INTEGRA1:4; then
A16:   lower_bound A = a & upper_bound A = b by A2,INTEGRA1:5; then
      vol A = b-a by INTEGRA1:def 5;
      hence D.k = lower_bound A + vol(A)/(len D)*k by A13,A15,A16,XCMPLX_1:74;
     end;
     hence ex D be Division of A st D divide_into_equal n
       by A13,INTEGRA4:def 1;
    end;
end;
