reserve n   for Nat,
        r,s for Real,
        x,y for Element of REAL n,
        p,q for Point of TOP-REAL n,
        e   for Point of Euclid n;
reserve n for non zero Nat;
reserve n for non zero Nat;
reserve n for Nat,
        X for set,
        S for Subset-Family of X;
reserve n for Nat,
        S for Subset-Family of REAL;
reserve n       for Nat,
        a,b,c,d for Element of REAL n;
reserve n for non zero Nat;
reserve n     for non zero Nat,
        x,y,z for Element of REAL n;
reserve p for Element of EMINFTY n;

theorem Th69:
  for t being object holds t in cl_Ball(p,r) iff
  ex f being Function st t = f & dom f = Seg n &
  for i being Nat st i in Seg n holds f.i in [.(@p).i-r,(@p).i+r.]
  proof
    reconsider x = @p as Element of REAL n;
    per cases;
    suppose
A1:   r < 0;
      for t being object st ex f being Function st t = f & dom f = Seg n &
       for i being Nat st i in Seg n holds f.i in [.x.i-r,x.i+r.] holds
       t in cl_Ball(p,r)
      proof
        let t be object;
        given f be Function such that
        t = f and
        dom f = Seg n and
A2:     for i being Nat st i in Seg n holds f.i in [.x.i-r,x.i+r.];
        x.1 + r < x.1 & x.1 < x.1 - r by A1,XREAL_1:30,XREAL_1:46;
        then x.1 + r < x.1 - r by XXREAL_0:2; then
A3:     [.x.1 - r , x.1 + r .] is empty by XXREAL_1:29;
        0+1 < n+1 by XREAL_1:6;
        then 1 <= n by NAT_1:13;
        then 1 in Seg n;
        hence thesis by A3,A2;
      end;
      hence thesis by A1;
    end;
    suppose
A4:   0 <= r;
A5:   for t be object st t in cl_Ball(p,r) holds ex f be Function st
        t = f & dom f = Seg n & for i be Nat st i in Seg n holds
        f.i in [.x.i-r,x.i+r.]
      proof
        let t be object;
        assume
A6:     t in cl_Ball(p,r);
        reconsider f = t as Function by A6;
        take f;
        thus t = f;
        f is Tuple of n,REAL by A6,FINSEQ_2:131;
        hence dom f = Seg n by FINSEQ_2:124;
        hereby
          let i be Nat;
          assume
A7:       i in Seg n;
          reconsider fx = t as Element of EMINFTY n by A6;
A8:       dist(fx,p) <= r by A6,METRIC_1:12;
          reconsider rfx = fx, rp = p as Element of REAL n;
          consider S being ext-real-membered set such that
A9:       S = the set of all |. rfx.i - rp.i .| where i is Element of Seg n and
A10:      (Infty_dist n).(rfx,rp) = sup S by Th57;
          |. rfx.i - rp.i .| in S by A9,A7;
          then |. rfx.i - rp.i .| <= sup S by XXREAL_2:4; then
A11:      |. rfx.i - rp.i .| <= r by A10,A8,XXREAL_0:2;
          set rfp = rfx.i - rp.i;
          x.i - r <= rfx.i & rfx.i <= x.i + r
          proof
            per cases;
            suppose
A12:          0 <= rfp;
              then rfx.i - rp.i <= r by A11,COMPLEX1:43; then
A13:          rfx.i - rp.i + rp.i <= r + rp.i by XREAL_1:7;
              0 + rp.i <= rfx.i - rp.i + rp.i by A12,XREAL_1:7;
              then rp.i - r <= rfx.i - r & rfx.i - r <= rfx.i
                by A4,XREAL_1:13,XREAL_1:43;
              hence thesis by A13,XXREAL_0:2;
            end;
            suppose
A14:          rfp < 0;
              then -rfp <= r by A11,COMPLEX1:70;
              then rp.i - rfx.i + rfx. i <= r + rfx.i by XREAL_1:7;
              then rp.i - r <= r + rfx.i - r by XREAL_1:13;
              hence x.i -r <= rfx.i;
              rfx.i - rp.i + rp.i < 0 + rp.i by A14,XREAL_1:8;
              hence thesis by A4,XREAL_1:38;
            end;
          end;
          hence f.i in [.x.i-r,x.i+r.] by XXREAL_1:1;
        end;
      end;
      for t be object st ex f be Function st t = f & dom f = Seg n &
      for i be Nat st i in Seg n holds f.i in [.x.i-r,x.i+r.] holds
        t in cl_Ball(p,r)
      proof
        let t be object;
        assume
A15:    ex f be Function st t = f & dom f = Seg n & for i be Nat st
          i in Seg n holds f.i in [.x.i-r,x.i+r.];
        then consider f be Function such that
A16:    t = f and
A17:    dom f = Seg n and
A18:    for i be Nat st i in Seg n holds f.i in [.x.i-r,x.i+r.];
        rng f c= REAL
        proof
          let u be object;
          assume u in rng f;
          then consider v be object such that
A19:      v in dom f and
A20:      u = f.v by FUNCT_1:def 3;
          f.v in [.x.v-r,x.v+r.] by A19,A17,A18;
          hence u in REAL by A20;
        end;
        then f in Funcs(Seg n,REAL) by A17,FUNCT_2:def 2;
        then reconsider q = f as Element of EMINFTY n by FINSEQ_2:93;
        dist(p,q) <= r
        proof
          reconsider rp = p,rq = q as Element of REAL n;
          consider S being ext-real-membered set such that
A21:      S = the set of all |. rp.i - rq.i .| where i is Element of Seg n and
A22:      (Infty_dist n).(rp,rq) = sup S by Th57;
          for e be ExtReal st e in S holds e <= r
          proof
            let e be ExtReal;
            assume e in S;
            then consider i be Element of Seg n such that
A23:        e = |.rp.i - rq.i.| by A21;
            |.rp.i - rq.i.| <= r
            proof
              rq.i in [.rp.i-r,rp.i+r.] by A16,A15; then
A24:          rp.i - r <= rq.i & rq.i <= rp.i + r by XXREAL_1:1;
              set rpq = rp.i - rq.i;
              per cases;
              suppose
A25:            0 <= rpq;
                rpq <= r
                proof
                  rp.i - r + r <= rq.i + r by A24,XREAL_1:7;
                  then rp.i - rq.i <= rq.i + r - rq.i by XREAL_1:13;
                  hence thesis;
                end;
                hence thesis by A25,COMPLEX1:43;
              end;
              suppose
A26:            rpq < 0;
                -rpq <= r
                proof
                  rq.i - rp.i <= rp.i + r - rp.i by A24,XREAL_1:13;
                  hence thesis;
                end;
                hence thesis by A26,COMPLEX1:70;
              end;
            end;
            hence e <= r by A23;
          end;
          then r is UpperBound of S by XXREAL_2:def 1;
          hence thesis by A22,XXREAL_2:def 3;
        end;
        hence t in cl_Ball(p,r) by A16,METRIC_1:12;
      end;
      hence thesis by A5;
    end;
  end;
