reserve i,n,m for Nat,
        r,s for Real,
        A for non empty closed_interval Subset of REAL;

theorem Th13:
  0 <= r <= 1 implies arctan.r = Sum (Leibniz_Series_of r)
proof
  set rL=Leibniz_Series_of r,P=Partial_Sums rL,A=arctan.r;
  deffunc I(Nat)=#Z (2*($1))/ ( #Z 0 + #Z 2);
  assume
A1: 0<=r<=1;
  then r in [.-1,1.] by XXREAL_1:1;
  then
A2: P is convergent by Th11,SERIES_1:def 2;
  for s st 0 <s ex n st for m st n <=m holds |.P.m - A .|<s
  proof
    let s;
    assume
A3:   0 <s;
    consider n such that
A4:   1/s < n by SEQ_4:3;
    take n;
    let m such that
A5:   n<=m;set m1=m+1;
    reconsider R=[.0,r.] as non empty
      closed_interval Subset of REAL by MEASURE5:def 3,A1,XXREAL_1:1;
A6: I(m1) is continuous & dom I(m1)=REAL by Th4;
    then I(m1) |R is continuous;
    then
A7:   I(m1) is_integrable_on R & I(m1) |R is bounded
      by A6,INTEGRA5:11,10;
A8: A = P.m+integral( (-1)|^m1 (#) I(m1),R) by A1,Th12;
    integral( (-1)|^m1 (#) I(m1),R) =
       (-1)|^m1 * integral( I(m1),R) by A7,A6,INTEGRA6:9;
    then
A9:  |.- integral( (-1)|^(m+1) (#) I(m1),R).|
      =|.(-1)|^(m+1) * integral( I(m1),R) .| by COMPLEX1:52
     .= |.(-1)|^(m+1).| * |.integral( I(m1),R) .| by COMPLEX1:65
     .= 1 * |.integral( I(m1),R) .| by SERIES_2:1;
A10: |. P.m -A.| <= 1/(2*m1+1)*( r |^ (2*m1+1)) by A1,Th7,A8,A9;
    0|^ (2*m1+1) = 0 & 1|^(2*m1+1) =1 & (r=0 or r>0)
      by NAT_1:11,A1,NEWTON:11;
    then r |^ (2*m1+1) <= 1 by PREPOWER:9,A1;
    then 1/(2*m1+1)*( r |^ (2*m1+1)) <= 1/(2*m1+1) * 1 by XREAL_1:64;
    then A11: |. P.m -A.| <= 1/(2*m1+1) by A10,XXREAL_0:2;
    m1 <= 1+m1+m1 by NAT_1:11;
    then m < (2*m1+1) by NAT_1:13;
    then n < (2*m1+1) by A5,XXREAL_0:2;
    then 1/s < (2*m1+1) by A4,XXREAL_0:2;
    then 1/s*s < (2*m1+1)*s & 1/s*s = 1 by XREAL_1:68,A3,XCMPLX_1:87;
    then s > 1/ (2*m1+1) by XREAL_1:83;
    hence thesis by A11,XXREAL_0:2;
  end;
  then A = lim P by A2,SEQ_2:def 7;
  hence thesis by SERIES_1:def 3;
end;
