reserve X for set,
        n,m,k for Nat,
        K for Field,
        f for n-element real-valued FinSequence,
        M for Matrix of n,m,F_Real;

theorem Th5:
  for n be Nat,
      x be sequence of REAL-NS n
    st ex K be Real
       st for i be Nat holds ||. x.i .|| < K
  holds
    ex x0 be subsequence of x
    st x0 is convergent
  proof
    defpred P[Nat] means
    for x be sequence of REAL-NS $1
      st ex K be Real
         st for i be Nat holds ||. x.i .|| < K
    holds
      ex x0 be subsequence of x
      st x0 is convergent;

    A1: P[0]
    proof
      let x be sequence of REAL-NS 0;

      assume
      ex K be Real
      st for i be Nat holds ||. x.i .|| < K;
      A2: the carrier of (REAL-NS 0)
       = REAL 0 by REAL_NS1:def 4
      .= {<*>REAL} by FINSEQ_2:94;

      then reconsider z = <*>REAL as Element of (REAL-NS 0) by TARSKI:def 1;

      for i be Nat holds x.i = z by A2,TARSKI:def 1;
      then
      A3: x is constant by VALUED_0:def 18;
      A4: x is subsequence of x by VALUED_0:19;
      x is convergent by A3,NDIFF_1:18;
      hence thesis by A4;
    end;

    A5: for n be Nat st P[n] holds P[n+1]
    proof
      let n be Nat;
      assume A6: P[n];

      let x be sequence of REAL-NS(n+1);
      given K be Real such that
      A7: for i be Nat holds ||. x.i .|| < K;

      defpred P[object,object] means
      ex xi be Element of REAL(n+1)
      st xi = x.$1
       & $2 = xi | n;

      A8: for i be Element of NAT
          ex y be Element of the carrier of REAL-NS n
          st P[i,y]
      proof
        let i be Element of NAT;
        reconsider xi=x.i as Element of REAL(n+1) by REAL_NS1:def 4;

        A9: len xi = n+1 by CARD_1:def 7;
        set y = xi| n;
        A10: y is Element of (len y) -tuples_on REAL by FINSEQ_2:92;
        len y = n by A9,NAT_1:11,FINSEQ_1:59;
        then y in REAL n by A10;
        then reconsider y as Element of the carrier of REAL-NS n
          by REAL_NS1:def 4;
        take y;
        thus thesis;
      end;

      consider y be sequence of the carrier of REAL-NS n such that
      A11: for i be Element of NAT holds P[i,y.i] from FUNCT_2:sch 3(A8);

      reconsider y as sequence of REAL-NS n;

      for i be Nat holds ||. y.i .|| < K
      proof
        let i be Nat;
        i is Element of NAT by ORDINAL1:def 12;
        then consider xi be Element of REAL (n+1) such that
        A12: xi = x.i & y.i = xi | n by A11;

        reconsider yi=y.i as Element of REAL n by REAL_NS1:def 4;
        A13: |.yi.| <= |.xi.| by A12,Th1;
        ||. x.i .|| < K by A7;
        then |. xi .| < K by A12,REAL_NS1:1;
        then |. yi .| < K by A13,XXREAL_0:2;
        hence ||. y.i .|| < K by REAL_NS1:1;
      end;
      then consider y0 be subsequence of y such that
      A14: y0 is convergent by A6;

      consider N0 be increasing sequence of NAT such that
      A15: y0 = y * N0 by VALUED_0:def 17;

      defpred P1[object,object] means
      ex xi be Element of REAL(n+1)
      st xi = (x*N0).$1
       & $2 = xi.(n+1);

      A16: for i be Element of NAT
           ex y be Element of REAL st P1[i,y]
      proof
        let i be Element of NAT;
        reconsider xi = (x*N0).i as Element of REAL(n+1) by REAL_NS1:def 4;

        set y = xi.(n+1);
        take y;
        A17: len xi = n+1 by CARD_1:def 7;
        n+1 in Seg (n+1) by FINSEQ_1:4;
        then n+1 in dom xi by A17,FINSEQ_1:def 3;
        then xi.(n+1) in rng xi by FUNCT_1:3;
        hence thesis;
      end;

      consider w be sequence of REAL such that
      A18: for i be Element of NAT holds P1[i,w.i] from FUNCT_2:sch 3(A16);

      for i0 be set st i0 in dom w
      holds |. w.i0 .| < K
      proof
        let i0 be set;
        assume i0 in dom w; then
        reconsider i = i0 as Element of NAT;
        consider xi be Element of REAL (n+1) such that
        A19: xi = (x*N0).i & w.i = xi.(n+1) by A18;

        reconsider wi = w.i as Element of REAL;

        A20: |.wi.| <= |.xi.| by A19,Th2;
        dom N0 = NAT by FUNCT_2:def 1;
        then (x*N0).i =x.(N0.i) by FUNCT_1:13;
        then ||. (x*N0).i .|| < K by A7;
        then |. xi .| < K by A19,REAL_NS1:1;
        hence |. w.i0 .| < K by XXREAL_0:2,A20;
      end;

      then w is bounded by COMSEQ_2:def 3;
      then consider w0 be Real_Sequence such that
      A21: w0 is subsequence of w
         & w0 is convergent by SEQ_4:40;

      consider M0 be increasing sequence of NAT such that
      A22: w0 = w * M0 by A21,VALUED_0:def 17;

      reconsider N = N0*M0 as increasing sequence of NAT;
      reconsider x0 = x*N as subsequence of x;

      A23: for i be Nat holds
            ex xi be Element of REAL (n+1)
            st xi = x0.i
             & (y0*M0).i = xi | n
             & w0.i = xi.(n+1)
      proof
        let i be Nat;
        A24: dom N0 = NAT & dom M0 = NAT by FUNCT_2:def 1;

        A25: (y0*M0).i
         = y0.(M0.i) by A24,ORDINAL1:def 12,FUNCT_1:13
        .= y.(N0.(M0.i)) by A15,A24,FUNCT_1:13;

        consider z be Element of REAL(n+1) such that
        A26: z = x.(N0.(M0.i))
           & y.(N0.(M0.i)) = z | n by A11;

        take z;
        thus
        A27: x0.i
         = ((x*N0)*M0).i by RELAT_1:36
        .= (x*N0).(M0.i) by A24,ORDINAL1:def 12,FUNCT_1:13
        .= z by A24,A26,FUNCT_1:13;

        thus (y0*M0).i = z | n by A25,A26;

        consider f be Element of REAL(n+1) such that
        A28: f = (x*N0).(M0.i)
           & w.(M0.i) = f.(n+1) by A18;

        x0.i = ((x*N0)*M0).i by RELAT_1:36
        .= f by A24,A28,ORDINAL1:def 12,FUNCT_1:13;

        hence w0.i = z.(n+1) by A22,A24,A27,A28,ORDINAL1:def 12,FUNCT_1:13;
      end;

      A29: y0 * M0 is convergent by A14,LOPBAN_3:7;
      set lmy = lim(y0*M0);
      set lmw = lim w0;
      reconsider lmy0 = lmy as Element of REAL n by REAL_NS1:def 4;

      A30: len lmy0 = n by CARD_1:def 7;
      then
      A31: dom lmy0 = Seg n by FINSEQ_1:def 3;
      set lmx = lmy0 ^ <*lmw*>;
      A32: lmx is FinSequence of REAL by FINSEQ_1:75;

      len lmx = len lmy0 + len <*lmw*> by FINSEQ_1:22
      .= n + 1 by A30,FINSEQ_1:40;
      then lmx is Element of (n+1) -tuples_on REAL by A32,FINSEQ_2:92;
      then lmx in REAL(n+1);

      then reconsider lmx as Element of REAL-NS(n+1) by REAL_NS1:def 4;

      for r be Real st 0 < r
      holds
       ex m be Nat
       st for i be Nat st m <= i
          holds ||.(x0 . i) - lmx.|| < r
      proof
        let r be Real;
        assume 0 < r;
        then
        A33: 0 < r/2 by XREAL_1:215;
        then consider m1 be Nat such that
        A34: for i be Nat st m1 <= i holds
             ||.((y0*M0) . i) - lmy.|| < r/2 by A29,NORMSP_1:def 7;
        consider m2 be Nat such that
        A35: for i be Nat st m2 <= i holds |. w0.i - lmw.| < r/2
          by SEQ_2:def 7,A21,A33;

        set m = m1 + m2;
        take m;
        thus for i be Nat st m <= i holds ||.(x0 . i) - lmx.|| < r
        proof
          let i be Nat;
          assume
          A36: m <= i;
          m1 <= m by NAT_1:11;
          then m1 <= i by A36,XXREAL_0:2;
          then
          A37: ||.((y0*M0) . i) - lmy.|| < r/2 by A34;
          m2 <= m by NAT_1:11;
          then m2 <= i by A36,XXREAL_0:2;
          then
          A38: |. w0.i - lmw.| < r/2 by A35;

          reconsider lmx0 = lmx as Element of REAL (n+1) by REAL_NS1:def 4;
          reconsider xi =x0 . i as Element of REAL (n+1) by REAL_NS1:def 4;
          reconsider yi =(y0*M0) . i as Element of REAL n by REAL_NS1:def 4;

          consider z be Element of REAL (n+1) such that
          A39: z = x0.i
             & (y0*M0).i =z | n
             & w0.i = z.(n+1) by A23;

          lmx0 | n = lmy0 by FINSEQ_1:21,A31; then
          A41: (xi-lmx0) | n = yi -lmy0 by A39,Th4,NAT_1:11;
          A42: len <*lmw*> = 1 & <*lmw*> .1 = lmw by FINSEQ_1:40;
          A43: (xi-lmx0).(n+1)
           = xi.(n+1)- lmx0.(n+1) by RVSUM_1:27
          .= w0.i - lmw by A30,A39,A42,FINSEQ_1:65;

          A44: ||.(x0 . i) - lmx.|| = |.xi-lmx0.| by REAL_NS1:5,REAL_NS1:1;
          A45: ||.((y0*M0) . i) - lmy.|| = |.yi-lmy0.|
                by REAL_NS1:5,REAL_NS1:1;
          w0.i - lmw is Element of REAL by XREAL_0:def 1;
          then
          A46: |.xi-lmx0.| <= |.yi-lmy0.| + |.w0.i - lmw.| by A41,A43,Th3;
          |.yi-lmy0.| + |.w0.i - lmw.| < r/2 + r/2 by A38,A37,A45,XREAL_1:8;
          hence ||.(x0 . i) - lmx.|| < r by XXREAL_0:2,A46,A44;
        end;
      end;
      then x0 is convergent by NORMSP_1:def 6;
      hence thesis;
    end;
    thus for n be Nat holds P[n] from NAT_1:sch 2(A1,A5);
  end;
