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

theorem
  Z c= dom (id Z - a(#)f) & f = ln*f1 & (for x st x in Z holds f1.x=a+x
& f1.x>0) implies (id Z - a(#)f) is_differentiable_on Z & for x st x in Z holds
  ((id Z - a(#)f)`|Z).x = x/(a+x)
proof
  assume that
A1: Z c= dom (id Z - a(#)f) and
A2: f = ln*f1 and
A3: for x st x in Z holds f1.x=a+x & f1.x>0;
A4: Z c= dom id Z /\ dom (a(#)f) by A1,VALUED_1:12;
  then
A5: Z c= dom (a(#)f) by XBOOLE_1:18;
  then
A6: Z c= dom (ln*f1) by A2,VALUED_1:def 5;
  then
A7: f is_differentiable_on Z by A2,A3,Th1;
  then
A8: a(#)f is_differentiable_on Z by A5,FDIFF_1:20;
A9: for x st x in Z holds (id Z).x = 1*x+0 by FUNCT_1:18;
A10: Z c= dom id Z by A4,XBOOLE_1:18;
  then
A11: id Z is_differentiable_on Z by A9,FDIFF_1:23;
A12: for x st x in Z holds ((a(#)f)`|Z).x =a/(a+x)
  proof
    let x;
    assume
A13: x in Z;
    hence ((a(#)f)`|Z).x=a*diff(f,x) by A5,A7,FDIFF_1:20
      .=a*(f`|Z).x by A7,A13,FDIFF_1:def 7
      .=a*(1/(a+x)) by A2,A3,A6,A13,Th1
      .=a/(a+x) by XCMPLX_1:99;
  end;
  for x st x in Z holds ((id Z - a(#)f)`|Z).x = x/(a+x)
  proof
    let x;
    assume
A14: x in Z;
    then
A15: f1.x=a+x & f1.x>0 by A3;
    ((id Z - a(#)f)`|Z).x= diff(id Z,x) - diff(a(#)f,x) by A1,A11,A8,A14,
FDIFF_1:19
      .=((id Z)`|Z).x - diff(a(#)f,x) by A11,A14,FDIFF_1:def 7
      .=((id Z)`|Z).x - ((a(#)f)`|Z).x by A8,A14,FDIFF_1:def 7
      .=1 - ((a(#)f)`|Z).x by A10,A9,A14,FDIFF_1:23
      .=1 - a/(a+x) by A12,A14
      .=(1*(a+x) - a)/(a+x) by A15,XCMPLX_1:127
      .=x/(a+x);
    hence thesis;
  end;
  hence thesis by A1,A11,A8,FDIFF_1:19;
end;
