reserve r,x,x0,a,b for Real;
reserve n,m for Element of NAT;
reserve A for non empty closed_interval Subset of REAL;
reserve Z for open Subset of REAL;

theorem Th4:
  (-1/(n+1))(#)( #Z (n+1)*cos) is_differentiable_on REAL & for x
  holds (((-1/(n+1))(#)( #Z (n+1)*cos))`|REAL).x = ((cos.x) #Z n)*sin.x
proof
A1: [#]REAL = dom((-1/(n+1))(#)( #Z (n+1)*cos)) by FUNCT_2:def 1;
  #Z (n+1)*cos is_differentiable_in x0
  proof
    cos is_differentiable_in x0 by SIN_COS:63;
    hence thesis by TAYLOR_1:3;
  end;
  then
A2: for x0 st x0 in REAL holds #Z (n+1)*cos is_differentiable_in x0;
  [#]REAL = dom ( #Z (n+1)) & REAL = dom ( #Z (n+1)*cos) by FUNCT_2:def 1;
  then
A3: #Z (n+1)*cos is_differentiable_on REAL by A2,FDIFF_1:9;
 hence(-1/(n+1))(#)( #Z (n+1)*cos) is_differentiable_on REAL by A1,FDIFF_1:20;
A4: for x st x in REAL holds (( #Z (n+1)*cos)`|REAL).x=(-(n+1)) * ((cos.x)
  #Z n)*sin.x
  proof
    set m=n+1;
    let x;
    assume
A5:x in REAL;
    cos is_differentiable_in x by SIN_COS:63;
    then diff(( #Z m*cos),x) = m * (cos.x) #Z (m-1) *diff(cos,x) by TAYLOR_1:3
      .= m * (cos.x) #Z (m-1) *(-sin .x) by SIN_COS:63
      .= (-m) * (cos.x) #Z (m-1) *sin .x;
    hence thesis by A3,FDIFF_1:def 7,A5;
  end;
A6:
  for x st x in REAL holds (((-1/(n+1))(#)( #Z (n+1)*cos))`|REAL).x =(cos
  .x) #Z n *sin.x
  proof
    let x;
    assume
A7:x in REAL;
    (((-1/(n+1))(#)( #Z (n+1)*cos))`|REAL).x =(-1/(n+1))*diff( #Z (n+1)*
    cos,x) by A1,A3,FDIFF_1:20,A7
      .=(-1/(n+1))*((( #Z (n+1)*cos)`|REAL).x) by A3,FDIFF_1:def 7,A7
      .=(-1/(n+1))*((-(n+1)) * (cos.x) #Z n *sin.x) by A4,A7
      .=(1/(n+1))*(n+1) * (cos.x) #Z n *sin.x
      .=(n+1)/(n+1) * (cos.x) #Z n *sin.x by XCMPLX_1:99
      .=1*(cos.x) #Z n *sin.x by XCMPLX_1:60;
    hence thesis;
  end;
  let x;
   x in REAL by XREAL_0:def 1;
  hence thesis by A6;
end;
