
theorem Lm88:
  for X be RealHilbertSpace, M be Subspace of X,
      N be Subset of X,
      x be Point of X, d be Real
  st N = the carrier of M & N is closed &
  ( ex Y be non empty Subset of REAL st
      Y = {||.x-y.|| where y is Point of X: y in M}
    & d = lower_bound Y >= 0) holds
   ex x0 be Point of X st d = ||.x-x0.|| & x0 in M
proof
  let X be RealHilbertSpace, M be Subspace of X,
      N be Subset of X,
      x be Point of X, d be Real;
  assume that
A1: N = the carrier of M & N is closed and
A2: ex Y be non empty Subset of REAL st
      Y = {||.x-y.|| where y is Point of X: y in M}
    & d = lower_bound Y >= 0;
  consider Y be non empty Subset of REAL such that
A3: Y = {||.x-y.|| where y is Point of X: y in M}
  & d = lower_bound Y >= 0 by A2;
  reconsider r0=0 as Real;
  for r be ExtReal st r in Y holds r0 <= r
  proof
    let r be ExtReal;
    assume r in Y; then
    ex y be Point of X st r = ||.x-y.|| & y in M by A3;
    hence r0 <= r by BHSP_1:28;
  end; then
  r0 is LowerBound of Y by XXREAL_2:def 2; then
A4:Y is bounded_below;
  defpred P[Nat,Real] means
    $2 in Y & $2 < d + (1/($1+1));
F1: for n being Element of NAT
      ex r being Element of REAL st P[n,r]
  proof
    let n be Element of NAT;
    reconsider n1=n as Nat;
    consider r1 be Real such that
F11:  r1 in Y & r1 < d + (1/(n1+1)) by A4,A3,SEQ_4:def 2;
    reconsider r=r1 as Element of REAL by XREAL_0:def 1;
    take r;
    thus thesis by F11;
  end;
  consider S being Function of NAT,REAL such that
B3: for n being Element of NAT holds P[n,S.n]
      from FUNCT_2:sch 3(F1);
B4: for n be Nat holds |. S.n - d .| <= 1/(n+1)
  proof
    let n be Nat;
C11: n in NAT by ORDINAL1:def 12; then
    S.n in Y & S.n < d + (1/(n+1)) by B3; then
C21: d <= S.n by A4,A3,SEQ_4:def 2;
    S.n - d < d + 1/(n+1) - d by C11,B3,XREAL_1:9;
    hence |. S.n - d .| <= 1/(n+1) by C21,ABSVALUE:def 1,XREAL_1:48;
  end;
B5: for p be Real st 0<p ex n be Nat
       st for m be Nat st n<=m holds |.S.m - d.| < p
  proof
    let p be Real;
    assume D0: 0 < p;
    reconsider r=1/p as Real;
    consider n be Nat such that
E1:  r < n by SEQ_4:3;
    r*p = 1 by D0,XCMPLX_1:106; then
E3: 1 < n*p by D0,E1,XREAL_1:68;
    n*p < (n+1)*p by D0,XREAL_1:68,NAT_1:16; then
E4: 1 < (n+1)*p by E3,XXREAL_0:2;
D1: 1/(n+1) < p by E4,XREAL_1:83;
    take n;
    let m be Nat;
    assume n <= m; then
D21: n+1 <= m+1 by XREAL_1:6;
    (m+1)" = 1/(m+1) & (n+1)" = 1/(n+1) by XCMPLX_1:215; then
    1/(m+1) <= 1/(n+1) by D21,XREAL_1:85; then
D3: 1/(m+1) < p by XXREAL_0:2,D1;
    |. S.m - d .| <= 1/(m+1)  by B4;
    hence |. S.m - d .| < p by D3,XXREAL_0:2;
  end; then
A5: S is convergent; then
A6: lim S = d by SEQ_2:def 7,B5;
  defpred P1[Nat,Point of X] means
      $2 in M & S.$1 = ||. x - $2 .||;
F2: for n being Element of NAT ex v being Point of X st P1[n,v]
  proof
    let n be Element of NAT;
    S.n in Y & S.n < d + (1/(n+1)) by B3; then
    consider y be Point of X such that
F21:  S.n = ||.x-y.|| & y in M by A3;
    take y;
    thus thesis by F21;
  end;
  consider z being Function of NAT,the carrier of X such that
A7: for n being Element of NAT holds P1[n,z.n]
    from FUNCT_2:sch 3(F2);
  for n be Nat holds z.n in M & S.n = ||.x - z.n.||
  proof
    let n be Nat;
    reconsider n1=n as Element of NAT by ORDINAL1:def 12;
    z.n1 in M & S.n1 = ||.x - z.n1.|| by A7;
    hence thesis;
  end; then
  consider z be sequence of X such that
A8: for n be Nat holds z.n in M & S.n = ||.x - z.n.||;
  reconsider S1=S(#)S, S2=S(#)S as Real_Sequence;
  reconsider SA=2(#)S1, SB=2(#)S2 as Real_Sequence;
C3: lim S1 = d*d by A6,A5,SEQ_2:15;
C4: lim S2 = d*d by A6,A5,SEQ_2:15;
C5: lim SA = 2*(d*d) by C3,A5,SEQ_2:8;
C6: lim SB = 2*(d*d) by C4,A5,SEQ_2:8;
A12: for e be Real st 0 < e holds
       ex k be Nat st for n,m be Nat st
         n >= k & m >= k holds |. (SA.m + SB.n) - 4*(d*d) .| < e
  proof
    let e be Real;
    assume B01: 0 < e; then
    consider k1 be Nat such that
B1:   for n be Nat st n >= k1 holds |.SA.n - 2*(d*d).| < e/2
        by A5,C5,SEQ_2:def 7;
    consider k2 be Nat such that
B2:   for m be Nat st m >= k2 holds |.SB.m - 2*(d*d).| < e/2
        by B01,A5,C6,SEQ_2:def 7;
    max(k1,k2) is natural; then
    reconsider k=max(k1,k2) as Nat;
B3: for n,m be Nat st
      n >= k & m >= k holds |.(SA.m + SB.n) - 4*(d*d).| < e
    proof
      let n,m be Nat;
      assume AS: n >= k & m >= k;
      k >= k1 & k >= k2 by XXREAL_0:25; then
C0:   n >= k1 & m >= k2 by AS,XXREAL_0:2; then
C1:   |.SA.n - 2*(d*d).| < e/2 by B1;
C2:   |.SB.m - 2*(d*d).| < e/2 by C0,B2;
C4:   |.(SA.n - 2*(d*d)) + (SB.m - 2*(d*d)).|
        <= |.SA.n - 2*(d*d).| + |.SB.m - 2*(d*d).| by COMPLEX1:56;
      |.SA.n - 2*(d*d).| + |.SB.m - 2*(d*d).| < e/2 + e/2
        by C1,C2,XREAL_1:8;
      hence thesis by C4,XXREAL_0:2;
    end;
    take k;
    thus thesis by B3;
  end;
  for p be Real st p > 0
    ex k be Nat st for n, m be Nat st
      n >= k & m >= k holds ||.z.n - z.m.|| < p
  proof
    let p be Real;
    assume AS1: p > 0; then
    consider k be Nat such that
D1:   for n,m be Nat st
        n >= k & m >= k holds |. (SA.m + SB.n) - 4*(d*d) .| < p*p by A12;
D2: for n, m be Nat st
      n >= k & m >= k holds ||.z.n - z.m.|| < p
    proof
      let n, m be Nat;
      assume n >= k & m >= k; then
B0:   |. (SA.m + SB.n) - 4*(d*d) .| < p*p by D1;
      set C=||.(x-z.n).||;
      set D=||.(x-z.m).||;
B2:   (x-z.n) + (x-z.m) = ((-z.n + x) + x) + -z.m by RLVECT_1:def 3
                       .= ((x + x) + -z.n) + -z.m by RLVECT_1:def 3
                       .= (x + x) +(-z.n + -z.m) by RLVECT_1:def 3
                       .= (x + x) + (-(z.n + z.m)) by RLVECT_1:31
                       .= (1*x + x) + (-(z.n + z.m)) by RLVECT_1:def 8
                       .= (1*x + 1*x) + (-(z.n + z.m)) by RLVECT_1:def 8
                       .= ((1+1)*x) + (-(z.n + z.m)) by RLVECT_1:def 6
                       .= 2*x - (z.n + z.m);
B3:   (x-z.n) - (x-z.m) = (x + -z.n) + (z.m + -x) by RLVECT_1:33
                       .= -x + ((x + -z.n) + z.m) by RLVECT_1:def 3
                       .= -x + (x + (-z.n + z.m)) by RLVECT_1:def 3
                       .= (-x + x) + (-z.n + z.m) by RLVECT_1:def 3
                       .= 0.X + (-z.n + z.m) by RLVECT_1:5
                       .= z.m - z.n;
      set E=||.2*x - (z.n + z.m).||;
      set F=||.z.m - z.n.||;
B6:   F*F = (E*E + F*F) + -E*E
         .= (2*(C*C) + 2*(D*D)) + -E*E by Lm88A,B2,B3;
      2*x - (z.n + z.m) = 2*x + (-1)*(z.n + z.m) by RLVECT_1:16
                       .= 2*x + 2*(1/2)*(-(z.n + z.m)) by RLVECT_1:24
                       .= 2*x + 2*((1/2)*(-(z.n + z.m))) by RLVECT_1:def 7
                       .= 2*(x + (1/2)*(-(z.n + z.m))) by RLVECT_1:def 5
                       .= 2*(x - (1/2)*(z.n + z.m)) by RLVECT_1:25; then
B7:   ||.2*x - (z.n + z.m).||
        = |.2.|*||.x - (1/2)*(z.n + z.m).|| by BHSP_1:27
       .= 2*||.x - (1/2)*(z.n + z.m).|| by ABSVALUE:def 1;
      reconsider znm=z.n+z.m as Point of X;
      reconsider p0=||.x - (1/2)*(z.n+z.m).|| as Real;
      z.n in M & z.m in M by A8; then
      znm in M by RUSUB_1:14; then
      (1/2)*znm in M by RUSUB_1:15; then
      p0 in Y by A3; then
      d <= p0 by A3,A4,SEQ_4:def 2; then
      2*d <= ||.2*x - (z.n + z.m).|| by B7,XREAL_1:64; then
      (2*d)*(2*d) <= ||.2*x - (z.n + z.m).||*||.2*x - (z.n + z.m).||
        by A3,XREAL_1:66; then
      -(E*E) <= -(4*(d*d)) by XREAL_1:24; then
B81:  F*F <= (2*(C*C) + 2*(D*D)) + -(4*(d*d)) by B6,XREAL_1:6;
E2:   SA.n = 2*S1.n by SEQ_1:9
          .= 2*((S.n)*(S.n)) by SEQ_1:8;
E3:   SB.m = 2*S2.m by SEQ_1:9
          .= 2*((S.m)*(S.m)) by SEQ_1:8;
B91:  C = S.n & D = S.m by A8;
      (SA.n + SB.m) - 4*(d*d) <= |.(SA.n + SB.m) - 4*(d*d).|
        by ABSVALUE:4; then
      F*F <= |.(SA.n + SB.m) - 4*(d*d).| by B91,B81,E2,E3,XXREAL_0:2; then
      F*F < p*p by B0,XXREAL_0:2; then
      F^2 < p*p by SQUARE_1:def 1; then
B10:  F^2 < p^2 by SQUARE_1:def 1;
      0 <= F*F by XREAL_1:63; then
      0 <= F^2 by SQUARE_1:def 1; then
B11:  sqrt F^2 < sqrt p^2 by B10,SQUARE_1:27;
B12:  F < sqrt p^2 by B11,SQUARE_1:22,BHSP_1:28;
      ||.z.n - z.m.|| = ||.-(z.m - z.n).|| by RLVECT_1:33
                     .= F by BHSP_1:31;
      hence thesis by B12,SQUARE_1:22,AS1;
    end;
    take k;
    thus thesis by D2;
  end; then
A13: z is convergent by BHSP_3:def 4,BHSP_3:2; then
  consider x0 be Point of X such that
A14: for r be Real st r > 0 ex m be Nat st
       for n be Nat st n >= m holds ||.z.n - x0.|| < r by BHSP_2:9;
  lim z = x0 by A13,A14,BHSP_2:19; then
A16: lim ||.z - x.|| = ||.x0-x.|| by A13,BHSP_2:34
                    .= ||.-(x0-x).|| by BHSP_1:31
                    .= ||.x-x0.|| by RLVECT_1:33;
  for y be object st y in rng z holds y in N
  proof
    let y be object;
    assume y in rng z; then
    ex n being object st n in NAT & z.n = y by FUNCT_2:11; then
    y in M by A8;
    hence thesis by A1;
  end; then
  rng z c= N; then
BX: lim z in N by A1,A13,LM1;
  ex k0 be Nat st for n be Nat st k0 <= n holds S.n = ||.z - x.||.n
  proof
    set k0 = the Nat;
B1: for n be Nat st k0 <= n holds S.n = ||.z - x.||.n
    proof
      let n be Nat;
      assume k0 <= n;
      thus S.n = ||.x - z.n.|| by A8
              .= ||.-(z.n - x).|| by RLVECT_1:33
              .= ||.z.n + -x.|| by BHSP_1:31
              .= ||.(z + -x).n.|| by BHSP_1:def 6
              .= ||.(z - x).n.|| by BHSP_1:56
              .= ||.z - x.||.n by BHSP_2:def 3;
    end;
    take k0;
    thus thesis by B1;
  end; then
BY: lim S = lim ||.z - x.|| by A5,SEQ_4:19;
  take x0;
  thus thesis by BX,A1,A13,A14,BHSP_2:19,BY,SEQ_2:def 7,B5,A16,A5;
end;
