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*((exp_R-f)/exp_R)) & (for x st x in Z holds f.x=1 & (
exp_R-f).x>0) implies ln*((exp_R-f)/exp_R) is_differentiable_on Z & for x st x
  in Z holds ((ln*((exp_R-f)/exp_R))`|Z).x = 1/(exp_R.x-1)
proof
  assume that
A1: Z c= dom (ln*((exp_R-f)/exp_R)) and
A2: for x st x in Z holds f.x=1 & (exp_R-f).x>0;
A3: for x st x in Z holds f.x=0*x+1 by A2;
  for y being object st y in Z holds y in dom ((exp_R-f)/exp_R)
     by A1,FUNCT_1:11;
  then Z c= dom ((exp_R-f)/exp_R) by TARSKI:def 3;
  then Z c= dom (exp_R-f) /\ (dom exp_R \ (exp_R)"{0}) by RFUNCT_1:def 1;
  then
A4: Z c= dom (exp_R-f) by XBOOLE_1:18;
  then Z c= dom exp_R /\ dom f by VALUED_1:12;
  then
A5: Z c= dom f by XBOOLE_1:18;
  then
A6: f is_differentiable_on Z by A3,FDIFF_1:23;
A7: exp_R is_differentiable_on Z by FDIFF_1:26,TAYLOR_1:16;
  then
A8: exp_R-f is_differentiable_on Z by A4,A6,FDIFF_1:19;
  for x st x in Z holds exp_R.x<>0 by SIN_COS:54;
  then
A9: (exp_R-f)/exp_R is_differentiable_on Z by A7,A8,FDIFF_2:21;
A10: for x st x in Z holds ((exp_R-f)`|Z).x =exp_R.x
  proof
    let x;
    assume
A11: x in Z;
    hence ((exp_R-f)`|Z).x = diff(exp_R,x) - diff(f,x) by A4,A6,A7,FDIFF_1:19
      .= exp_R.x- diff(f,x) by SIN_COS:65
      .= exp_R.x-(f`|Z).x by A6,A11,FDIFF_1:def 7
      .= exp_R.x-0 by A5,A3,A11,FDIFF_1:23
      .= exp_R.x;
  end;
A12: for x st x in Z holds (((exp_R-f)/exp_R)`|Z).x=1/exp_R.x
  proof
    let x;
A13: exp_R.x <>0 by SIN_COS:54;
    assume
A14: x in Z;
    then
A15: (exp_R-f).x=exp_R.x - f.x by A4,VALUED_1:13
      .=exp_R.x -1 by A2,A14;
    exp_R is_differentiable_in x & exp_R-f is_differentiable_in x by A8,A14,
FDIFF_1:9,SIN_COS:65;
    then diff((exp_R-f)/exp_R,x) =(diff((exp_R-f),x)*exp_R.x-diff(exp_R,x)*(
    exp_R-f).x)/(exp_R.x)^2 by A13,FDIFF_2:14
      .=(((exp_R-f)`|Z).x*exp_R.x-diff(exp_R,x)*(exp_R-f).x)/(exp_R.x)^2 by A8
,A14,FDIFF_1:def 7
      .=(exp_R.x*exp_R.x-diff(exp_R,x)*(exp_R-f).x)/(exp_R.x)^2 by A10,A14
      .=(exp_R.x*exp_R.x-exp_R.x*(exp_R.x-1))/(exp_R.x)^2 by A15,SIN_COS:65
      .=(exp_R.x)/(exp_R.x)/(exp_R.x) by XCMPLX_1:78
      .=1/exp_R.x by A13,XCMPLX_1:60;
    hence thesis by A9,A14,FDIFF_1:def 7;
  end;
A16: for x st x in Z holds ((exp_R-f)/exp_R).x >0
  proof
    let x;
A17: exp_R.x>0 by SIN_COS:54;
    assume
A18: x in Z;
    then x in dom ((exp_R-f)/exp_R) by A1,FUNCT_1:11;
    then
A19: ((exp_R-f)/exp_R).x=(exp_R-f).x*(exp_R.x)" by RFUNCT_1:def 1
      .=(exp_R-f).x*(1/exp_R.x) by XCMPLX_1:215
      .=(exp_R-f).x/exp_R.x by XCMPLX_1:99;
    (exp_R-f).x>0 by A2,A18;
    hence thesis by A19,A17,XREAL_1:139;
  end;
A20: for x st x in Z holds ln*((exp_R-f)/exp_R) is_differentiable_in x
  proof
    let x;
    assume x in Z;
    then (exp_R-f)/exp_R is_differentiable_in x & ((exp_R-f)/exp_R).x >0 by A9
,A16,FDIFF_1:9;
    hence thesis by TAYLOR_1:20;
  end;
  then
A21: ln*((exp_R-f)/exp_R) is_differentiable_on Z by A1,FDIFF_1:9;
  for x st x in Z holds ((ln*((exp_R-f)/exp_R))`|Z).x = 1/(exp_R.x-1)
  proof
    let x;
A22: exp_R.x>0 by SIN_COS:54;
    assume
A23: x in Z;
    then x in dom ((exp_R-f)/exp_R) by A1,FUNCT_1:11;
    then
A24: ((exp_R-f)/exp_R).x=(exp_R-f).x*(exp_R.x)" by RFUNCT_1:def 1
      .=(exp_R-f).x*(1/exp_R.x) by XCMPLX_1:215
      .=(exp_R-f).x/exp_R.x by XCMPLX_1:99
      .=(exp_R.x-f.x)/exp_R.x by A4,A23,VALUED_1:13
      .=(exp_R.x-1)/exp_R.x by A2,A23;
    ((exp_R-f)/exp_R) is_differentiable_in x & ((exp_R-f)/exp_R).x >0 by A9,A16
,A23,FDIFF_1:9;
    then diff(ln*((exp_R-f)/exp_R),x) =diff(((exp_R-f)/exp_R),x)/(((exp_R-f)/
    exp_R).x) by TAYLOR_1:20
      .=(((exp_R-f)/exp_R)`|Z).x/(((exp_R-f)/exp_R).x) by A9,A23,FDIFF_1:def 7
      .=(1/exp_R.x)/((exp_R.x-1)/exp_R.x) by A12,A23,A24
      .=1/(exp_R.x-1) by A22,XCMPLX_1:55;
    hence thesis by A21,A23,FDIFF_1:def 7;
  end;
  hence thesis by A1,A20,FDIFF_1:9;
end;
