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 (-(ln*f)) & (for x st x in Z holds f.x =a-x & f.x >0) implies
- (ln*f) is_differentiable_on Z & for x st x in Z holds ((-(ln*f))`|Z).x = 1/(a
  -x)
proof
  assume that
A1: Z c= dom (-(ln*f)) and
A2: for x st x in Z holds f.x =a-x & f.x > 0;
  now
    let y be object;
    assume y in Z;
    then y in dom ( (-1)(#)(ln*f)) by A1;
    hence y in dom (ln*f) by VALUED_1:def 5;
  end;
  then
A3: Z c=dom (ln*f) by TARSKI:def 3;
  then for y being object st y in Z holds y in dom f by FUNCT_1:11;
  then
A4: Z c= dom f by TARSKI:def 3;
A5: for x st x in Z holds f.x =(-1)*x+a
  proof
    let x;
    assume x in Z;
    then f.x =a-x by A2;
    hence thesis;
  end;
  then
A6: f is_differentiable_on Z by A4,FDIFF_1:23;
  now
    let x;
    assume x in Z;
    then f is_differentiable_in x & f.x >0 by A2,A6,FDIFF_1:9;
    hence ln*f is_differentiable_in x by TAYLOR_1:20;
  end;
  then
A7: ln*f is_differentiable_on Z by A3,FDIFF_1:9;
A8: for x st x in Z holds ((-(ln*f))`|Z).x =1/(a-x)
  proof
    let x;
    assume
A9: x in Z;
    then
A10: f.x =a-x by A2;
    f.x >0 & f is_differentiable_in x by A2,A6,A9,FDIFF_1:9;
    then diff(ln*f,x) =diff(f,x)/( f.x) by TAYLOR_1:20
      .=(f`|Z).x/( f.x) by A6,A9,FDIFF_1:def 7
      .=(-1)/(a-x) by A4,A5,A9,A10,FDIFF_1:23;
    then (((-1)(#)(ln*f))`|Z).x =(-1)*((-1)/(a-x)) by A1,A7,A9,FDIFF_1:20
      .=(-1)*(-1)/(a-x) by XCMPLX_1:74
      .=1/(a-x);
    hence thesis;
  end;
  Z c= dom ((-1)(#)(ln*f)) by A1;
  hence thesis by A7,A8,FDIFF_1:20;
end;
