reserve h for non-zero 0-convergent Real_Sequence;
reserve c for constant Real_Sequence;
reserve R,R1,R2 for RestFunc;
reserve L,L1,L2 for LinearFunc;

theorem
for f1,f2 be PartFunc of REAL,REAL, I,J be non empty Interval st
 f1 is_differentiable_on_interval I & f2 is_differentiable_on_interval J &
 f1.:I c= J holds
  f2*f1 is_differentiable_on_interval I
  & (f2*f1)`\I = ((f2`\J)*f1)(#)(f1`\I)
proof
    let f1,f2 be PartFunc of REAL,REAL, I,J be non empty Interval;
    assume that
A1:  f1 is_differentiable_on_interval I and
A2:  f2 is_differentiable_on_interval J and
A3:  f1.:I c= J;

    J c= dom f2 by A2; then
    f1.:I c= dom f2 by A3; then
A4: I c= dom(f2*f1) by A1,FUNCT_1:101;

    for x be Real st x in I holds
     (x = inf I implies (f2*f1)|I is_right_differentiable_in x) &
     (x = sup I implies (f2*f1)|I is_left_differentiable_in x) &
     (x in ].inf I,sup I.[ implies f2*f1 is_differentiable_in x)
     by A1,A2,A3,Th4,Lm26,Th5,Lm27,Lm28;
    hence
A5: (f2*f1) is_differentiable_on_interval I by A4,Th11;

A6: dom(f1`\I) = I & dom(f2`\J) = J by A1,A2,Def2; then
    f1"J = dom((f2`\J)*f1) by RELAT_1:147; then
A7: f1"(f1.:I) c= dom((f2`\J)*f1) by A3,RELAT_1:143;
    I c= f1"(f1.:I) by A1,FUNCT_1:76; then
    I c= dom((f2`\J)*f1) by A7; then
    dom((f2`\J)*f1) /\ dom(f1`\I) = I by A6,XBOOLE_1:28; then
A8: dom( ((f2`\J)*f1)(#)(f1`\I) )= I by VALUED_1:def 4;
    now let x be Real;
     assume A9: x in I;
     hence x = inf I implies (((f2`\J)*f1)(#)(f1`\I)).x = Rdiff(f2*f1,x)
       by A1,A2,A3,Lm26;
     thus x = sup I implies (((f2`\J)*f1)(#)(f1`\I)).x = Ldiff(f2*f1,x)
       by A1,A2,A3,A9,Lm27;
     thus x <> inf I & x <> sup I implies
       (((f2`\J)*f1)(#)(f1`\I)).x = diff(f2*f1,x)
     proof
      assume x <> inf I & x <> sup I; then
      x in ].inf I,sup I.[ by A9,Th3;
      hence thesis by A1,A2,A3,A9,Lm28;
     end;
    end;
    hence (f2*f1)`\I = ((f2`\J)*f1)(#)(f1`\I) by A5,A8,Def2;
end;
