reserve Y for RealNormSpace;

theorem FTh42:
for I be Function of REAL,REAL-NS 1,
    x0 be Point of REAL-NS 1, y0 be Element of REAL,
    g be PartFunc of REAL,Y, f be PartFunc of REAL-NS 1,Y
  st I=proj(1,1) qua Function" & x0 in dom f & y0 in dom g
   & x0=<*y0*> & f*I = g & f is_differentiable_in x0 holds
  g is_differentiable_in y0 & diff(g,y0)=diff(f,x0).<*1*> &
    for r be Element of REAL holds diff(f,x0).<*r*> = r*diff(g,y0)
proof
   let I be Function of REAL,REAL-NS 1,
       x0 be Point of REAL-NS 1, y0 be Element of REAL,
       g be PartFunc of REAL,Y, f be PartFunc of REAL-NS 1,Y;
   assume that
A1: I=proj(1,1) qua Function" and
A2: x0 in dom f and
A3: y0 in dom g and
A4: x0=<*y0*> and
A5: f*I = g and
A6: f is_differentiable_in x0;
   reconsider J= proj(1,1) as Function of REAL-NS 1, REAL by Lm1;
   consider NN being Neighbourhood of x0 such that
A7: NN c= dom f and
A8: ex L be Point of R_NormSpace_of_BoundedLinearOperators(REAL-NS 1,Y),
                     R be RestFunc of REAL-NS 1,Y
      st for x be Point of REAL-NS 1 st x in NN
     holds f/.x - f/.x0 = L.(x-x0) + R/.(x-x0) by A6;
A9:I*J = id REAL-NS 1 by Lm1,A1,Lm2,FUNCT_1:39;
A10:
   g*J = f*(id REAL-NS 1) by A9,A5,RELAT_1:36
      .= f by FUNCT_2:17;
   consider e be Real such that
A11:0 < e and
A12:{z where z is Point of REAL-NS 1 : ||.z-x0.|| < e} c= NN by NFCONT_1:def 1;
   consider L be Point of R_NormSpace_of_BoundedLinearOperators(REAL-NS 1,Y),
                R being RestFunc of REAL-NS 1,Y such that
A13:for x9 be Point of REAL-NS 1 st x9 in NN holds
        f/.x9 - f/.x0 = L.(x9-x0) + R/.(x9-x0) by A8;
   reconsider R0=R*I as RestFunc of Y by A1,FTh40;
   L is LinearOperator of REAL-NS 1,Y by LOPBAN_1:def 9;
   then reconsider L0=L*I as LinearFunc of Y by A1,FTh40;
   set N={z where z is Point of REAL-NS 1 : ||.z-x0.|| < e};
A14:N c= the carrier of REAL-NS 1
   proof
    let y be object;
    assume y in N;
    then ex z be Point of REAL-NS 1 st y=z & ||.z-x0.|| < e;
    hence thesis;
   end;
   then reconsider N as Neighbourhood of x0 by A11,NFCONT_1:def 1;
   set N0={z where z is Element of REAL: |.z-y0.| < e};
   now let z be object;
    hereby assume z in N0;
     then consider y9 be Element of REAL such that
A16:  z=y9 and
A17:  |.y9-y0.| < e;
     reconsider w=I.y9 as Point of REAL-NS 1;
     x0=I.y0 by A1,A4,Lm2;
     then w-x0=I.(y9-y0) by A1,Lm1,PDIFF_1:3;
     then ||.w-x0.||=|.y9-y0.| by A1,Lm1,PDIFF_1:3;
     then
A18: w in {z0 where z0 is Point of REAL-NS 1 : ||.z0 - x0.|| < e} by A17;
     J.(I.y9) = y9 by A1,Lm2,FUNCT_1:35;
     hence z in J.:N by A18,A16,FUNCT_2:35;
    end;
    assume z in J.:N;
    then consider ww be object such that
A19: ww in REAL 1 & ww in N & z=J.ww by FUNCT_2:64;
    consider w be Point of REAL-NS 1 such that
A21: ww=w & ||.w-x0.|| < e by A19;
    reconsider y9=J.w as Element of REAL;
    J.x0=y0 by A4,Lm2;
    then J.(w-x0) =y9-y0 by PDIFF_1:4;
    then |.y9-y0.| < e by A21,PDIFF_1:4;
    hence z in N0 by A19,A21;
   end;
   then
A23: N0=J.:N by TARSKI:2;
   J.:(dom f) = J.:(J"(dom g)) by A10,RELAT_1:147;
  then
A24: J.:(dom f) = dom(f*I) by A5,Lm2,FUNCT_1:77;
A25: I*J =id (REAL 1) by A1,Lm2,FUNCT_1:39;
A261: N c= dom f by A7,A12; then
A26: N0 c= dom(f*I) by A24,A23,RELAT_1:123;
A27: ].y0-e,y0+e.[ c= N0
   proof
    now let d be object;
     assume A28: d in ].y0-e,y0+e.[; then
     reconsider y1=d as Element of REAL;
     |.y1-y0.| < e by A28,RCOMP_1:1;
     hence d in N0;
    end;
    hence thesis;
   end;
   N0 c= ].y0-e,y0+e.[
   proof
    let d be object;
    assume d in N0;
    then ex r be Element of REAL st d=r & |.r-y0.| < e;
    hence thesis by RCOMP_1:1;
   end; then
   N0 = ].y0-e,y0+e.[ by A27,XBOOLE_0:def 10; then
A29: N0 is Neighbourhood of y0 by A11,RCOMP_1:def 6;
   N c= REAL 1 by A14,REAL_NS1:def 4;
   then (I*J).:N = N by A25,FRECHET:13;
   then
A30: I.:N0 = N by A23,RELAT_1:126;
A31:for y1 be Real st y1 in N0 holds
       (f*I)/.y1 - (f*I)/.y0 = L0/.(y1-y0) + R0/.(y1-y0)
   proof
    let y1 be Real;
    reconsider yy=y1 as Element of REAL by XREAL_0:def 1;
    reconsider y9 = I.yy as Point of REAL-NS 1;
    R is total by NDIFF_1:def 5; then
A32:dom R = the carrier of REAL-NS 1 by PARTFUN1:def 2;
    R0 is total by NDIFF_3:def 1; then
A33: dom(R*I) = REAL by PARTFUN1:def 2;
    reconsider dy1y0 = y1 - y0 as Element of REAL by XREAL_0:def 1;
    I.(dy1y0) in dom R by A32;
    then R/.(I.(y1-y0)) =R.(I.(y1-y0)) by PARTFUN1:def 6;
    then R/.(I.(dy1y0)) =R0.(dy1y0) by A33,FUNCT_1:12;
    then
A34:R/.(I.(y1-y0)) =R0/.(dy1y0) by A33,PARTFUN1:def 6;
    L0 is total; then
A35:dom(L*I) = REAL by PARTFUN1:def 2;
    assume
A36: y1 in N0; then
A37:I.yy in N by A30,FUNCT_2:35; then
    f/.(I.y1) =f.(I.y1) by A7,A12,PARTFUN1:def 6; then
    f/.(I.y1) =(f*I).y1 by A26,A36,FUNCT_1:12; then
A39:f/.(I.y1) =(f*I)/.y1 by A26,A36,PARTFUN1:def 6;
A40:x0=I.y0 by A4,A1,Lm2;
    then f/.(I.y0) =f.(I.y0) by A2,PARTFUN1:def 6;
    then f/.(I.y0) =(f*I).y0 by A3,A5,FUNCT_1:12;
    then
A41:f/.(I.y0) =(f*I)/.y0 by A3,A5,PARTFUN1:def 6;
    reconsider d = y1 - y0 as Element of REAL by XREAL_0:def 1;
    f/.y9 - f/.x0=L.(y9-x0) + R/.(y9-x0) by A13,A12,A37;
    then
A42:f/.(I.y1) - f/.(I.y0)=L.(I.d) + R/.(y9-x0) by A1,A40,Lm1,PDIFF_1:3;
    L.(I.d) =L0/.(dy1y0) by A35,FUNCT_1:12;
    hence thesis by A40,A42,A34,A39,A41,A1,Lm1,PDIFF_1:3;
   end;
   hence g is_differentiable_in y0 by A5,A29,A261,A24,A23,RELAT_1:123;
   then diff(f*I,y0)=L0/.jj by A5,A31,A29,A26,NDIFF_3:def 4;
   hence
A45:diff(g,y0)=(diff(f,x0)*I).1 by A5,A6,A13,A7,NDIFF_1:def 7
          .=diff(f,x0).(I.jj) by A1,FUNCT_1:13,PDIFF_1:2
          .=diff(f,x0).<*1*> by A1,Lm2;
   let r be Element of REAL;
A46:  <*jj*> is Element of REAL 1 by FINSEQ_2:98;
   then reconsider x = <*1*> as Point of REAL-NS 1 by REAL_NS1:def 4;
A47:  diff(f,x0) is LinearOperator of REAL-NS 1,Y by LOPBAN_1:def 9;
   thus diff(f,x0).<*r*> = diff(f,x0).<*r*1*>
     .= diff(f,x0).(r*<*1*>) by RVSUM_1:47
     .= diff(f,x0).(r*x) by A46,REAL_NS1:3
     .= r*diff(g,y0) by A45,A47,LOPBAN_1:def 5;
end;
