
theorem Th87A:
  for X be RealHilbertSpace, M be Subspace of X,
      N be Subset of X, x be Point of X
  st N = the carrier of M & N is closed holds
   ex y,z be Point of X st
     y in M & z in Ort_Comp M & x = y + z
proof
  let X be RealHilbertSpace, M be Subspace of X,
      N be Subset of X, x be Point of X;
  assume AS: N = the carrier of M & N is closed;
  set Y = {||.x-y.|| where y is Point of X: y in M};
  Y c= REAL
  proof
    let z be object;
    assume z in Y; then
    consider y be Point of X such that
B1:   z = ||.x-y.|| & y in M;
    thus z in REAL by B1,XREAL_0:def 1;
  end; then
  reconsider Y as Subset of REAL;
  0.X in M by RUSUB_1:11;
  then ||.x-0.X.|| in Y;
  then reconsider Y as non empty Subset of REAL;
  set d = lower_bound Y;
A11: for r be Real st r in Y holds 0 <= r
  proof
    let r be Real;
    assume r in Y; then
    consider y be Point of X such that
B2:   r = ||.x-y.|| & y in M;
    thus 0 <= r by B2,BHSP_1:28;
  end;
  then
A1: 0 <= d by SEQ_4:43;
  consider x0 be Point of X such that
A2: d = ||.x-x0.|| & x0 in M by AS,Lm88,A11,SEQ_4:43;
     reconsider y=x0 as Point of X;
     reconsider z=x-x0 as Point of X;
     for w be Point of X st w in M holds w, x-x0 are_orthogonal
       by A1,A2,Lm87A; then
B21: x-x0 in {v where v is VECTOR of X : for w be Point of X st w in M
               holds w, v are_orthogonal};
B3:  y + z = (x0 + -x0) + x by RLVECT_1:def 3
          .= x + 0.X by RLVECT_1:5
          .= x;
     take y,z;
     thus thesis by A2,B21,RUSUB_5:def 3,B3;
end;
