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;
reserve f, f1, f2, f3 for PartFunc of REAL, REAL;

theorem Th55:
  (Z c= dom (id Z-tan-sec) & for x st x in Z holds (1+sin.x)<>0 &
  (1-sin.x)<>0) implies id Z-tan-sec is_differentiable_on Z & for x st x in Z
  holds ((id Z-tan-sec)`|Z).x = sin.x/(sin.x-1)
proof
  assume that
A1: Z c= dom (id Z-tan-sec) and
A2: for x st x in Z holds 1+sin.x<>0 & 1-sin.x<>0;
A3: Z c= dom (id Z-tan) /\ dom sec by A1,VALUED_1:12;
  then
A4: Z c= dom (id Z-tan) by XBOOLE_1:18;
  then
 Z c= dom id Z /\ dom tan by VALUED_1:12;
  then
A5: Z c= dom tan by XBOOLE_1:18;
A6: for x st x in Z holds (id Z).x = 1*x+0 by FUNCT_1:18;
A7: Z c= dom id Z;
  then
A8: (id Z) is_differentiable_on Z by A6,FDIFF_1:23;
  for x st x in Z holds tan is_differentiable_in x
  proof
    let x;
    assume x in Z;
    then cos.x<>0 by A5,FDIFF_8:1;
    hence thesis by FDIFF_7:46;
  end;
  then
A9: tan is_differentiable_on Z by A5,FDIFF_1:9;
  then
A10: id Z-tan is_differentiable_on Z by A4,A8,FDIFF_1:19;
A11: Z c= dom sec by A3,XBOOLE_1:18;
  then
A12: sec is_differentiable_on Z by FDIFF_9:4;
A13: for x st x in Z holds ((id Z-tan)`|Z).x = -(sin.x)^2/(cos.x)^2
  proof
    let x;
    assume
A14: x in Z;
    then
A15: cos.x<>0 by A5,FDIFF_8:1;
    then
A16: (cos.x)^2 >0 by SQUARE_1:12;
    ((id Z - tan)`|Z).x = diff(id Z,x) - diff(tan,x) by A4,A9,A8,A14,FDIFF_1:19
      .=((id Z)`|Z).x - diff(tan,x) by A8,A14,FDIFF_1:def 7
      .=1-diff(tan,x) by A7,A6,A14,FDIFF_1:23
      .=1-1/(cos.x)^2 by A15,FDIFF_7:46
      .=1-((cos.x)^2+(sin.x)^2)/(cos.x)^2 by SIN_COS:28
      .=1-((cos.x)^2/(cos.x)^2+(sin.x)^2/(cos.x)^2) by XCMPLX_1:62
      .=1-(1+(sin.x)^2/(cos.x)^2) by A16,XCMPLX_1:60
      .=-(sin.x)^2/(cos.x)^2;
    hence thesis;
  end;
  for x st x in Z holds ((id Z-tan-sec)`|Z).x = sin.x/(sin.x-1)
  proof
    let x;
    assume
A17: x in Z;
    then
A18: 1+sin.x<>0 by A2;
    ((id Z-tan-sec)`|Z).x=diff((id Z-tan),x) -diff(sec,x) by A1,A12,A10,A17,
FDIFF_1:19
      .=((id Z-tan)`|Z).x-diff(sec,x) by A10,A17,FDIFF_1:def 7
      .=-(sin.x)^2/(cos.x)^2-diff(sec,x) by A13,A17
      .=-(sin.x)^2/(cos.x)^2-((sec)`|Z).x by A12,A17,FDIFF_1:def 7
      .=-(sin.x)^2/(cos.x)^2-sin.x/(cos.x)^2 by A11,A17,FDIFF_9:4
      .=-(sin.x/(cos.x)^2+(sin.x)^2/(cos.x)^2)
      .=-((sin.x+(sin.x)^2)/(cos.x)^2) by XCMPLX_1:62
      .=-(sin.x)*(1+sin.x)/((cos.x)^2+(sin.x)^2-(sin.x)^2)
      .=-(sin.x)*(1+sin.x)/(1-(sin.x)^2) by SIN_COS:28
      .=-(sin.x)*(1+sin.x)/((1+sin.x)*(1-sin.x))
      .=-(sin.x)*(1+sin.x)/(1+sin.x)/(1-sin.x) by XCMPLX_1:78
      .=-(sin.x)*((1+sin.x)/(1+sin.x))/(1-sin.x) by XCMPLX_1:74
      .=-(sin.x)*1/(1-sin.x) by A18,XCMPLX_1:60
      .=sin.x/(-(1-sin.x)) by XCMPLX_1:188
      .=sin.x/(sin.x-1);
    hence thesis;
  end;
  hence thesis by A1,A12,A10,FDIFF_1:19;
end;
