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 & f2 is_differentiable_on A implies
  f1 (#) f2 is_differentiable_on A & (f1(#)f2)`|A = (f1`|A)(#)f2 + f1(#)(f2`|A)
proof
  assume that
A1: f1 is_differentiable_on A and
A2: f2 is_differentiable_on A;
A3: A c= dom f1 by A1;
A4: A c= dom f2 by A2;
  then A c= dom f1 /\ dom f2 by A3,XBOOLE_1:19;
  then
A5: A c= dom (f1(#)f2) by VALUED_1:def 4;
  then f1(#)f2 is_differentiable_on A by A1,A2,FDIFF_1:21;
  then
A6: dom ((f1(#)f2)`|A) = A by FDIFF_1:def 7;
  dom (f2`|A) = A by A2,FDIFF_1:def 7;
  then dom f1 /\ dom (f2`|A) = A by A3,XBOOLE_1:28;
  then
A7: dom (f1(#)(f2`|A)) = A by VALUED_1:def 4;
  dom (f1`|A) = A by A1,FDIFF_1:def 7;
  then dom (f1`|A) /\ dom f2 = A by A4,XBOOLE_1:28;
  then dom ((f1`|A)(#)f2) = A by VALUED_1:def 4;
  then dom ((f1`|A)(#)f2) /\ dom (f1(#)(f2`|A)) = A by A7;
  then
A8: dom (((f1`|A)(#)f2) + (f1(#)(f2`|A))) = A by VALUED_1:def 1;
  now
    let x0 be Element of REAL;
    assume
A9: x0 in A;
    hence
    ((f1(#) f2)`|A).x0 = diff(f1,x0)*(f2.x0) + (f1.x0)*diff(f2,x0) by A1,A2,A5,
FDIFF_1:21
      .= (f1`|A).x0*f2.x0 + (f1.x0)*diff(f2,x0) by A1,A9,FDIFF_1:def 7
      .= (f1`|A).x0*f2.x0 + (f1.x0)*(f2`|A).x0 by A2,A9,FDIFF_1:def 7
      .= ((f1`|A)(#)f2).x0 + (f1.x0)*(f2`|A).x0 by VALUED_1:5
      .= ((f1`|A)(#)f2).x0 + (f1(#)(f2`|A)).x0 by VALUED_1:5
      .= (((f1`|A)(#)f2) + (f1(#)(f2`|A))).x0 by A8,A9,VALUED_1:def 1;
  end;
  hence thesis by A1,A2,A5,A6,A8,FDIFF_1:21,PARTFUN1:5;
end;
