
theorem Th1: :: relaxation of FDIFF_2:23
for A,B be open Subset of REAL, f1,f2 be PartFunc of REAL,REAL st
  f1 is_differentiable_on A & rng(f1|A) c= B &
  f2 is_differentiable_on B holds
  f2*f1 is_differentiable_on A & (f2*f1)`|A = ((f2`|B)*f1) (#) (f1`|A)
proof
    let A,B be open Subset of REAL, f1,f2 be PartFunc of REAL,REAL;
    assume that
A1:  f1 is_differentiable_on A and
A2:  rng(f1|A) c= B and
A3:  f2 is_differentiable_on B;

A4: now
     let x0 be Real;
     assume
A5:   x0 in A;
     hence
A6:   f1 is_differentiable_in x0 by A1,FDIFF_1:9;
     thus x0 in dom f1 by A1,A5;
     thus f1.x0 in f1.:A by A1,A5,FUNCT_1:def 6;
     x0 in dom(f1|A) by A1,A5,RELAT_1:57; then
     (f1|A).x0 in B by A2,FUNCT_1:3; then
     f1.x0 in B by A5,FUNCT_1:49;
     hence f2 is_differentiable_in f1.x0 by A3,FDIFF_1:9;
     hence f2*f1 is_differentiable_in x0 by A6,FDIFF_2:13;
    end;

A7: now let y be Real;
     assume y in f1.:A; then
     consider x be object such that
A8:   x in dom f1 & x in A & y = f1.x by FUNCT_1:def 6;
     x in dom(f1|A) by A8,RELAT_1:57; then
     (f1|A).x in rng(f1|A) by FUNCT_1:3; then
     f1.x in rng(f1|A) by A8,FUNCT_1:49;
     hence y in B by A2,A8;
    end; then
A9: f1.:A c= B;

    B c= dom f2 by A3; then
    f1.:A c= dom f2 by A7; then
A10: A c= dom (f2*f1) by A1,FUNCT_3:3;
    for x0 be Real holds x0 in A implies f2*f1 is_differentiable_in x0 by A4;
    hence
A11:  f2*f1 is_differentiable_on A by A10,FDIFF_1:9;
    then
A12:dom ((f2*f1)`|A) = A by FDIFF_1:def 7;
A13:now
     let x0 be Element of REAL;
     assume
A14:  x0 in dom ((f2*f1)`|A);
     then
A15: f1 is_differentiable_in x0 by A4,A12;
A16: x0 in dom f1 by A4,A12,A14;
     f1.x0 in f1.:A by A4,A12,A14; then
A17: f1.x0 in B by A7;

A18: f2 is_differentiable_in f1.x0 by A4,A12,A14;
     thus ((f2*f1)`|A).x0 = diff(f2*f1,x0) by A11,A12,A14,FDIFF_1:def 7
      .= diff(f2,f1.x0) * diff(f1,x0) by A15,A18,FDIFF_2:13
      .= diff(f2,f1.x0) * (f1`|A).x0 by A1,A12,A14,FDIFF_1:def 7
      .= (f2`|B).(f1.x0) * (f1`|A).x0 by A3,A17,FDIFF_1:def 7
      .= ((f2`|B)*f1).x0 * (f1`|A).x0 by A16,FUNCT_1:13
      .= (((f2`|B)*f1) (#) (f1`|A)).x0 by VALUED_1:5;
    end;
    dom (f2`|B) = B by A3,FDIFF_1:def 7; then
    dom ((f2*f1)`|A)
       = dom ((f2`|B)*f1) /\ A by A12,A1,A9,FUNCT_1:101,XBOOLE_1:28
      .= dom ((f2`|B)*f1) /\ dom (f1`|A) by A1,FDIFF_1:def 7
      .= dom (((f2`|B)*f1) (#) (f1`|A)) by VALUED_1:def 4;
    hence thesis by A13,PARTFUN1:5;
end;
