reserve a,b,e,r,x,y for Real,
  i,j,k,n,m for Element of NAT,
  x1 for set,
  p,q for FinSequence of REAL,
  A for non empty closed_interval Subset of REAL,
  D,D1,D2 for Division of A,
  f,g for Function of A,REAL,
  T for DivSequence of A;

theorem Th3:
  x in A implies ex j st j in dom D & x in divset(D,j)
proof
  assume
A1: x in A;
  then
A2: lower_bound A <= x by INTEGRA2:1;
A3: x <= upper_bound A by A1,INTEGRA2:1;
A4: rng D <> {};
  then
A5: 1 in dom D by FINSEQ_3:32;
  per cases;
  suppose
    x in rng D;
    then consider j such that
A6: j in dom D and
A7: D.j = x by PARTFUN1:3;
    x in divset(D,j)
    proof
      per cases;
      suppose
A8:     j=1;
A9:     ex a,b st a <= b & a=lower_bound divset(D,j) & b= upper_bound
        divset(D,j) by SEQ_4:11;
        upper_bound divset(D,j)=D.j by A6,A8,INTEGRA1:def 4;
        hence thesis by A7,A9,INTEGRA2:1;
      end;
      suppose
A10:    j<>1;
A11:    ex a,b st a <= b & a=lower_bound divset(D,j) & b= upper_bound
        divset(D,j) by SEQ_4:11;
        upper_bound divset(D,j)=D.j by A6,A10,INTEGRA1:def 4;
        hence thesis by A7,A11,INTEGRA2:1;
      end;
    end;
    hence thesis by A6;
  end;
  suppose
A12: not x in rng D;
    defpred MIN[Nat] means x < upper_bound divset(D,$1) & $1 in dom D;
A13: len D in dom D by FINSEQ_5:6;
    upper_bound divset(D,len D)=D.(len D)
    proof
      per cases;
      suppose
        len D=1;
        hence thesis by A13,INTEGRA1:def 4;
      end;
      suppose
        len D<>1;
        hence thesis by A13,INTEGRA1:def 4;
      end;
    end;
    then
A14: upper_bound divset(D,len D) = upper_bound A by INTEGRA1:def 2;
    x <> upper_bound A
    proof
      assume x = upper_bound A;
      then x = D.(len D) by INTEGRA1:def 2;
      hence contradiction by A12,A13,FUNCT_1:def 3;
    end;
    then x < upper_bound divset(D,len D) by A3,A14,XXREAL_0:1;
    then
A15: ex k be Nat st MIN[k] by A13;
    consider k be Nat such that
A16: MIN[k] & for n be Nat st MIN[n] holds k <= n from NAT_1:sch 5(A15
    );
    defpred MAX[Nat] means x >= lower_bound divset(D,$1) & $1 in dom D;
    lower_bound divset(D,1)=lower_bound A by A5,INTEGRA1:def 4;
    then
A17: ex k be Nat st MAX[k] by A2,A4,FINSEQ_3:32;
A18: for k be Nat holds MAX[k] implies k <= len D by FINSEQ_3:25;
    consider j be Nat such that
A19: MAX[j] & for n be Nat st MAX[n] holds n <= j from NAT_1:sch 6(A18
    ,A17);
    k=j
    proof
      assume
A20:  k<>j;
      per cases by A20,XXREAL_0:1;
      suppose
A21:    k < j;
A22:    upper_bound divset(D,k)=D.k
        proof
          per cases;
          suppose
            k=1;
            hence thesis by A16,INTEGRA1:def 4;
          end;
          suppose
            k<>1;
            hence thesis by A16,INTEGRA1:def 4;
          end;
        end;
A23:    1 <= k by A16,FINSEQ_3:25;
        then D.(j-1) <= x by A19,A21,INTEGRA1:def 4;
        then
A24:    D.(j-1) < D.k by A16,A22,XXREAL_0:2;
        j-1 in dom D by A19,A21,A23,INTEGRA1:7;
        then j-1 < k by A16,A24,SEQ_4:137;
        then j < k+1 by XREAL_1:19;
        hence contradiction by A21,NAT_1:13;
      end;
      suppose
A25:    k > j;
        x < upper_bound divset(D,j)
        proof
A26:      upper_bound divset(D,j)=D.j
          proof
            per cases;
            suppose
              j=1;
              hence thesis by A19,INTEGRA1:def 4;
            end;
            suppose
              j<>1;
              hence thesis by A19,INTEGRA1:def 4;
            end;
          end;
          assume
A27:      x >= upper_bound divset(D,j);
A28:      j+1 <= k by A25,NAT_1:13;
A29:      1 <= j by A19,FINSEQ_3:25;
          then
A30:      1 <= j+1 by NAT_1:13;
          k <= len D by A16,FINSEQ_3:25;
          then j+1 <= len D by A28,XXREAL_0:2;
          then
A31:      j+1 in dom D by A30,FINSEQ_3:25;
          j+1 > 1 by A29,NAT_1:13;
          then lower_bound divset(D,j+1) = D.(j+1-1) by A31,INTEGRA1:def 4
            .=D.j;
          then j+1 <= j by A19,A27,A26,A31;
          hence contradiction by NAT_1:13;
        end;
        hence contradiction by A16,A19,A25;
      end;
    end;
    then x in divset(D,k) by A16,A19,INTEGRA2:1;
    hence thesis by A16;
  end;
end;
