reserve k, m, n, p, K, N for Nat;
reserve i for Integer;
reserve x, y, eps for Real;
reserve seq, seq1, seq2 for Real_Sequence;
reserve sq for FinSequence of REAL;

theorem Th26:
  (for eps st eps>0 holds ex N st for n st n>=N holds seq.n>x-eps)
& (ex N st for n st n>=N holds seq.n<=x) implies seq is convergent & lim(seq)=x
proof
  assume that
A1: for eps st eps>0 holds ex N st for n st n>=N holds seq.n>x-eps and
A2: ex N st for n st n>=N holds seq.n<=x;
A3: for eps be Real st eps>0 ex N st for n st n>=N holds |.seq.n-x.|
  <eps
  proof
    let eps be Real;
    assume
A4: eps>0;
    then
A5: x+eps>x+0 by XREAL_1:6;
    consider N2 being Nat such that
A6: for n st n>=N2 holds seq.n<=x by A2;
    consider N1 being Nat such that
A7: for n st n>=N1 holds seq.n>x-eps by A1,A4;
    reconsider N = max(N1,N2) as Nat by TARSKI:1;
    take N;
    let n;
    assume
A8: n>=N;
    then n>=N1 by XXREAL_0:30;
    then seq.n>x-eps by A7;
    then
A9: seq.n-x>(x-eps)-x by XREAL_1:9;
    seq.n<=x by A6,A8,XXREAL_0:30;
    then seq.n<x+eps by A5,XXREAL_0:2;
    then seq.n-x<eps by XREAL_1:19;
    hence thesis by A9,SEQ_2:1;
  end;
  hence seq is convergent;
  hence thesis by A3,SEQ_2:def 7;
end;
