reserve y for set,
  x,r,a,b for Real,
  n for Element of NAT,
  Z for open Subset of REAL,
  f,f1,f2,f3 for PartFunc of REAL,REAL;

theorem
  Z c= dom ((cos/sin)*f) & (for x st x in Z holds f.x=x/2 & sin.(f.x)<>0
) implies (cos/sin)*f is_differentiable_on Z & for x st x in Z holds (((cos/sin
  )*f)`|Z).x = -1/(1-cos.x)
proof
  assume that
A1: Z c= dom ((cos/sin)*f) and
A2: for x st x in Z holds f.x=x/2 & sin.(f.x)<>0;
A3: for x st x in Z holds f.x=(1/2)*x+0
  proof
    let x;
    assume x in Z;
    then f.x=x/2 by A2;
    hence thesis;
  end;
  for y being object st y in Z holds y in dom f by A1,FUNCT_1:11;
  then
A4: Z c= dom f by TARSKI:def 3;
  then
A5: f is_differentiable_on Z by A3,FDIFF_1:23;
A6: for x st x in Z holds (cos/sin)*f is_differentiable_in x
  proof
    let x;
    assume
A7: x in Z;
    then sin.(f.x)<>0 by A2;
    then
A8: cos/sin is_differentiable_in f.x by Th47;
    f is_differentiable_in x by A5,A7,FDIFF_1:9;
    hence thesis by A8,FDIFF_2:13;
  end;
  then
A9: (cos/sin)*f is_differentiable_on Z by A1,FDIFF_1:9;
  for x st x in Z holds (((cos/sin)*f)`|Z).x = -1/(1-cos.x)
  proof
    let x;
    assume
A10: x in Z;
    then
A11: f is_differentiable_in x by A5,FDIFF_1:9;
A12: sin.(f.x)<>0 by A2,A10;
    then cos/sin is_differentiable_in f.x by Th47;
    then diff((cos/sin)*f,x) = diff(cos/sin, f.x)*diff(f,x) by A11,FDIFF_2:13
      .=(-1/(sin.(f.x))^2) * diff(f,x) by A12,Th47
      .=-(1/(sin.(f.x))^2) * diff(f,x)
      .=-diff(f,x)/(sin.(f.x))^2 by XCMPLX_1:99
      .=-diff(f,x)/(sin.(x/2))^2 by A2,A10
      .=-(f`|Z).x/(sin.(x/2))^2 by A5,A10,FDIFF_1:def 7
      .=-1/2/(sin.(x/2))^2 by A3,A4,A10,FDIFF_1:23
      .=-1/(2*(sin.(x/2))^2) by XCMPLX_1:78
      .=-1/(1-cos.x) by Lm2;
    hence thesis by A9,A10,FDIFF_1:def 7;
  end;
  hence thesis by A1,A6,FDIFF_1:9;
end;
