reserve x for object;
reserve x0,r,r1,r2,g,g1,g2,p,y0 for Real;
reserve n,m,k,l for Element of NAT;
reserve a,b,d for Real_Sequence;
reserve h,h1,h2 for non-zero 0-convergent Real_Sequence;
reserve c,c1 for constant Real_Sequence;
reserve A for open Subset of REAL;
reserve f,f1,f2 for PartFunc of REAL,REAL;
reserve L for LinearFunc;
reserve R for RestFunc;

theorem
  f1 is_differentiable_on A & (f1.:A) is open Subset of REAL &
  f2 is_differentiable_on (f1.:A) implies
  f2*f1 is_differentiable_on A & (f2*f1)`|A = ((f2`|(f1.:A))*f1) (#) (f1`|A)
proof
  assume that
A1: f1 is_differentiable_on A and
A2: (f1.:A) is open Subset of REAL and
A3: f2 is_differentiable_on (f1.:A);
A4: A c= dom f1 by A1;
A5: now
    let x0;
    assume
A6: x0 in A;
    hence
A7: f1 is_differentiable_in x0 by A1,FDIFF_1:9;
    thus x0 in dom f1 by A4,A6;
    thus f1.x0 in f1.:A by A4,A6,FUNCT_1:def 6;
    hence f2 is_differentiable_in f1.x0 by A2,A3,FDIFF_1:9;
    hence f2*f1 is_differentiable_in x0 by A7,Th13;
  end;
  f1.:A c= dom f2 by A3;
  then
A8: A c= dom (f2*f1) by A4,FUNCT_3:3;
  for x0 holds x0 in A implies f2*f1 is_differentiable_in x0 by A5;
  hence
A9: f2*f1 is_differentiable_on A by A8,FDIFF_1:9;
  then
A10: dom ((f2*f1)`|A) = A by FDIFF_1:def 7;
A11: now
    let x0 be Element of REAL;
    assume
A12: x0 in dom ((f2*f1)`|A);
    then
A13: f1 is_differentiable_in x0 by A5,A10;
A14: x0 in dom f1 by A5,A10,A12;
A15: f1.x0 in f1.:A by A5,A10,A12;
A16: f2 is_differentiable_in f1.x0 by A5,A10,A12;
    thus ((f2*f1)`|A).x0 = diff(f2*f1,x0) by A9,A10,A12,FDIFF_1:def 7
      .= diff(f2,f1.x0) * diff(f1,x0) by A13,A16,Th13
      .= diff(f2,f1.x0) * (f1`|A).x0 by A1,A10,A12,FDIFF_1:def 7
      .= (f2`|(f1.:A)).(f1.x0) * (f1`|A).x0 by A3,A15,FDIFF_1:def 7
      .= ((f2`|(f1.:A))*f1).x0 * (f1`|A).x0 by A14,FUNCT_1:13
      .= (((f2`|(f1.:A))*f1) (#) (f1`|A)).x0 by VALUED_1:5;
  end;
  dom (f2`|(f1.:A)) = f1.:A by A3,FDIFF_1:def 7;
  then A c= dom ((f2`|(f1.:A))*f1) by A4,FUNCT_1:101;
  then dom ((f2*f1)`|A) = dom ((f2`|(f1.:A))*f1) /\ A by A10,XBOOLE_1:28
    .= dom ((f2`|(f1.:A))*f1) /\ dom (f1`|A) by A1,FDIFF_1:def 7
    .= dom (((f2`|(f1.:A))*f1) (#) (f1`|A)) by VALUED_1:def 4;
  hence thesis by A11,PARTFUN1:5;
end;
