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

theorem
  Z c= dom (g(#)ln) & g=#Z 2 & (for x st x in Z holds x>0) implies g(#)
ln is_differentiable_on Z & for x st x in Z holds ((g(#)ln)`|Z).x = x+2*x*ln.x
proof
  set f = ln;
  assume that
A1: Z c= dom (g(#)f) and
A2: g=#Z 2 and
A3: for x st x in Z holds x>0;
A4: for x st x in Z holds g is_differentiable_in x by A2,TAYLOR_1:2;
A5: Z c= dom (g) /\ dom (f) by A1,VALUED_1:def 4;
  then
A6: Z c= dom (f) by XBOOLE_1:18;
  then
A7: f is_differentiable_on Z by Th19;
  Z c= dom g by A5,XBOOLE_1:18;
  then
A8: g is_differentiable_on Z by A4,FDIFF_1:9;
A9: for x st x in Z holds (g`|Z).x = 2*x
  proof
    let x;
    assume
A10: x in Z;
    diff(g,x) = 2 * (x #Z (2-1)) by A2,TAYLOR_1:2
      .=2*x by PREPOWER:35;
    hence thesis by A8,A10,FDIFF_1:def 7;
  end;
  now
    let x;
    assume
A11: x in Z;
    then
A12: x<>0 by A3;
    ((g(#)f)`|Z).x =(g.x)*diff(f,x) + (f.x)*diff(g,x) by A1,A8,A7,A11,
FDIFF_1:21
      .=(g.x)*((f`|Z).x)+(f.x)*diff(g,x) by A7,A11,FDIFF_1:def 7
      .=(g.x)*(1/x) + (f.x)*diff(g,x) by A6,A11,Th19
      .=(x #Z 2)*(1/x) + (f.x)*diff(g,x) by A2,TAYLOR_1:def 1
      .=(x #Z 2)*(1/x) + (f.x)*((g`|Z).x) by A8,A11,FDIFF_1:def 7
      .=(x #Z (1+1))*(1/x) + 2*x*(ln.x) by A9,A11
      .=((x #Z 1)*(x #Z 1))*(1/x) + 2*x*(ln.x) by TAYLOR_1:1
      .=((x #Z 1)*x)*(1/x) + 2*x*(ln.x) by PREPOWER:35
      .=(x*x)*(1/x) + 2*x*(ln.x) by PREPOWER:35
      .=x*(x*(1/x)) + 2*x*(ln.x)
      .=x*1 + 2*x*(ln.x) by A12,XCMPLX_1:106
      .=x+2*x*(ln.x);
    hence ((g(#)f)`|Z).x = x+2*x*ln.x;
  end;
  hence thesis by A1,A8,A7,FDIFF_1:21;
end;
