FDIFF_12

index · ← POLYALGX · NUMBER07 →
:: Differentiation on Interval
::  by Noboru Endou
::
:: Received March 31, 2023
:: Copyright (c) 2023-2026 Association of Mizar Users
::           (Stowarzyszenie Uzytkownikow Mizara, Bialystok, Poland).
:: This code can be distributed under the GNU General Public Licence
:: version 3.0 or later, or the Creative Commons Attribution-ShareAlike
:: License version 3.0 or later, subject to the binding interpretation
:: detailed in file COPYING.interpretation.
:: See COPYING.GPL and COPYING.CC-BY-SA for the full text of these
:: licenses, or see http://www.gnu.org/licenses/gpl.html and
:: http://creativecommons.org/licenses/by-sa/3.0/.

environ

 vocabularies NUMBERS, REAL_1, SUBSET_1, SEQ_1, FDIFF_1, XXREAL_0, CARD_1,
      COMPLEX1, FUNCT_1, RELAT_1, ARYTM_3, NAT_1, ARYTM_1, VALUED_1, SEQ_2,
      ORDINAL2, SQUARE_1, VALUED_0, XXREAL_2, FUNCT_2, TARSKI, RCOMP_1,
      XXREAL_1, PARTFUN1, XBOOLE_0, FCONT_1, FUNCT_7, INTEGRA5, ZFMISC_1,
      PROB_1, MEMBERED, SEQ_4, MEASURE5, FDIFF_3, SUPINF_1, LIMFUNC1, LIMFUNC2,
      LIMFUNC3, FDIFF_12;
 notations TARSKI, XBOOLE_0, ZFMISC_1, SUBSET_1, ORDINAL1, XXREAL_3, XCMPLX_0,
      XREAL_0, NUMBERS, XXREAL_0, COMPLEX1, XXREAL_1, MEMBERED, LIMFUNC1,
      XXREAL_2, RELSET_1, SUPINF_1, SUPINF_2, FUNCT_1, PARTFUN1, PARTFUN2,
      FUNCT_2, FCONT_1, NAT_1, VALUED_0, VALUED_1, SQUARE_1, PROB_1, RCOMP_1,
      MEASURE5, SEQ_1, RFUNCT_1, SEQ_2, SEQ_4, FDIFF_1, FDIFF_3, INTEGRA5,
      LIMFUNC2, LIMFUNC3;
 constructors FCONT_1, RELSET_1, SQUARE_1, COMPLEX1, COMSEQ_2, MEASURE6,
      MESFUNC5, INTEGRA5, LIMFUNC1, PARTFUN2, FDIFF_1, INTEGRA2, SEQ_4,
      FDIFF_3, LIMFUNC2, LIMFUNC3, REAL_1, RVSUM_1, RECDEF_1;
 registrations XREAL_0, RELSET_1, RCOMP_1, MEMBERED, XBOOLE_0, NUMBERS,
      VALUED_0, VALUED_1, FUNCT_2, XXREAL_2, FCONT_3, SQUARE_1, RELAT_1,
      ORDINAL1, XXREAL_0, NAT_1, FDIFF_1, MEASURE5, SUBSET_1, SEQ_2, SEQ_4;
 requirements NUMERALS, BOOLE, SUBSET, REAL, ARITHM;
 equalities XCMPLX_0;
 expansions FDIFF_1, TARSKI;
 theorems TARSKI, PARTFUN1, ZFMISC_1, INTEGRA1, RFUNCT_1, FUNCT_1, SEQ_1,
      SEQ_2, FDIFF_1, ABSVALUE, RCOMP_1, FCONT_1, FDIFF_2, RELAT_1, XREAL_0,
      XXREAL_0, FUNCT_2, XBOOLE_0, XBOOLE_1, SEQ_4, XREAL_1, COMPLEX1,
      INTEGRA5, VALUED_1, XXREAL_1, XXREAL_2, ORDINAL1, MEASURE5, NAT_1,
      SEQM_3, RFUNCT_2, FUNCT_3, NUMBERS, FDIFF_3, XXREAL_3, VALUED_0,
      SUBSET_1, MEASURE6, XCMPLX_0, PROB_1, LIMFUNC1, LIMFUNC2, LIMFUNC3,
      L_HOSPIT, PDIFFEQ1, SQUARE_1, XCMPLX_1;
 schemes FUNCT_2, SCHEME1, FDIFF_2;

begin  :: Preliminaries

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;

theorem Th2:
for I be Interval holds
 ].inf I,sup I.[ is open Subset of REAL & ].inf I,sup I.[ c= I
proof
    let I be Interval;
    now per cases;
    suppose inf I in REAL & sup I in REAL; then
     reconsider a = inf I, b = sup I as Real;
     ].inf I,sup I.[ = ].a,b.[;
     hence ].inf I,sup I.[ is open Subset of REAL;
    end;

    suppose A1: not inf I in REAL;
     per cases by A1,XXREAL_0:14;
     suppose A2: inf I = +infty;
      ].inf I,sup I.[ = {} by A2,XXREAL_0:3,XXREAL_1:28;
      hence ].inf I,sup I.[ is open Subset of REAL;
     end;
     suppose A3: inf I = -infty;
      per cases;
      suppose sup I in REAL; then
       reconsider b = sup I as Real;
       ].inf I,sup I.[ = halfline b by A3,PROB_1:def 10;
       hence ].inf I,sup I.[ is open Subset of REAL;
      end;
      suppose A4: not sup I in REAL;
       per cases by A4,XXREAL_0:14;
       suppose sup I = +infty; then
        ].inf I,sup I.[ = [#]REAL by A3,XXREAL_1:224,SUBSET_1:def 3;
        hence ].inf I,sup I.[ is open Subset of REAL;
       end;
       suppose sup I = -infty; then
        ].inf I,sup I.[ = {} by A3,XXREAL_1:20;
        hence ].inf I,sup I.[ is open Subset of REAL;
       end;
      end;
     end;
    end;
    suppose not sup I in REAL; then
     per cases by XXREAL_0:14;
     suppose A6: sup I = -infty;
      ].inf I,sup I.[ = {} by A6,XXREAL_0:5,XXREAL_1:28;
      hence ].inf I,sup I.[ is open Subset of REAL;
     end;
     suppose A7: sup I = +infty;
      per cases;
      suppose inf I in REAL; then
       reconsider a = inf I as Real;
       ].inf I,sup I.[ = right_open_halfline a by A7,LIMFUNC1:def 3;
       hence ].inf I,sup I.[ is open Subset of REAL;
      end;
      suppose A8: not inf I in REAL;
       per cases by A8,XXREAL_0:14;
       suppose inf I = -infty; then
        ].inf I,sup I.[ = [#]REAL by A7,XXREAL_1:224,SUBSET_1:def 3;
        hence ].inf I,sup I.[ is open Subset of REAL;
       end;
       suppose inf I = +infty; then
        ].inf I,sup I.[ = {} by A7,XXREAL_1:20;
        hence ].inf I,sup I.[ is open Subset of REAL;
       end;
      end;
     end;
    end;
    end;
    hence ].inf I,sup I.[ is open Subset of REAL;

    now let a be set;
     assume A9:a in ].inf I,sup I.[; then
     reconsider a1=a as Real;
     inf I < a1 < sup I by A9,XXREAL_1:4;
     hence a in I by XXREAL_2:83;
    end;
    hence ].inf I,sup I.[ c= I;
end;

theorem Th3:
for I be Interval, x be Real st x in I & x <> inf I & x <> sup I holds
 x in ].inf I,sup I.[
proof
    let I be Interval, x be Real;
    assume that
A1:  x in I and
A2:  x <> inf I and
A3:  x <> sup I;
    inf I <= x <= sup I by A1,XXREAL_2:61,62; then
    inf I < x < sup I by A2,A3,XXREAL_0:1;
    hence x in ].inf I,sup I.[ by XXREAL_1:4;
end;

Lm1:
for r be set, I be interval Subset of REAL st r in I & I is closed_interval
 holds (r = inf I & r = lower_bound I) or (r = sup I & r = upper_bound I) or
  r in ].inf I, sup I.[
proof
    let r be set, I be interval Subset of REAL;
    assume that
A1:  r in I and
A2:  I is closed_interval;

    consider a,b be Real such that
A3:  I = [.a,b.] by A2,MEASURE5:def 3;
A4: I = [.lower_bound I, upper_bound I.] by A1,A2,INTEGRA1:4;

    reconsider r1 = r as Real by A1;
A5: a <= r1 <= b by A1,A3,XXREAL_1:1;
    per cases;
    suppose r1 = a;
     hence (r = inf I & r = lower_bound I) or (r = sup I & r = upper_bound I)
      or r in ].inf I, sup I.[ by A1,A2,A3,A4,A5,INTEGRA1:5,XXREAL_2:25;
    end;
    suppose r1 = b;
     hence (r = inf I & r = lower_bound I) or (r = sup I & r = upper_bound I)
      or r in ].inf I, sup I.[ by A1,A2,A3,A4,A5,INTEGRA1:5,XXREAL_2:29;
    end;
    suppose A6: r1 <> a & r1 <> b;
     a = inf I & b = sup I by A3,A5,XXREAL_0:2,XXREAL_2:25,29; then
     inf I < r1 < sup I by A5,A6,XXREAL_0:1;
     hence (r = inf I & r = lower_bound I) or (r = sup I & r = upper_bound I)
      or r in ].inf I, sup I.[ by XXREAL_1:4;
    end;
end;

Lm2:
for r be set, I be interval Subset of REAL st r in I & I is right_open_interval
 holds (r = inf I & r = lower_bound I) or r in ].inf I,sup I.[
proof
    let r be set, I be interval Subset of REAL;
    assume that
A1:  r in I and
A2:  I is right_open_interval;

    consider a be Real, b be R_eal such that
A3:  I = [.a,b.[ by A2,MEASURE5:def 4;
    a is LowerBound of I by A3,XXREAL_2:19; then
    reconsider J = I as non empty bounded_below real-membered set
      by A1,XXREAL_2:def 9;
A4: inf J = lower_bound J;

    reconsider r1 = r as Real by A1;
A5: a <= r1 < b by A1,A3,XXREAL_1:3;
A6: a < b by A5,XXREAL_0:2;
    per cases;
    suppose r1 = a;
     hence (r = inf I & r = lower_bound I) or r in ].inf I,sup I.[
       by A3,A4,A5,XXREAL_2:26;
    end;
    suppose r1 <> a; then
     a < r1 < b by A5,XXREAL_0:1; then
     inf I < r1 < sup I by A3,A6,XXREAL_2:26,31;
     hence (r = inf I & r = lower_bound I) or r in ].inf I,sup I.[
       by XXREAL_1:4;
    end;
end;

Lm3:
for r be set, I be interval Subset of REAL st r in I & I is left_open_interval
 holds (r = sup I & r = upper_bound I) or r in ].inf I,sup I.[
proof
    let r be set, I be interval Subset of REAL;
    assume that
A1:  r in I and
A2:  I is left_open_interval;

    consider a be R_eal, b be Real such that
A3:  I = ].a,b.] by A2,MEASURE5:def 5;
    b is UpperBound of I by A3,XXREAL_2:22; then
    reconsider J = I as non empty bounded_above real-membered set
      by A1,XXREAL_2:def 10;
A4: sup J = upper_bound J;

    reconsider r1 = r as Real by A1;
A5: a < r1 <= b by A1,A3,XXREAL_1:2;
A6: a < b by A5,XXREAL_0:2;
    per cases;
    suppose r1 = b;
     hence (r = sup I & r = upper_bound I) or r in ].inf I,sup I.[
       by A3,A4,A5,XXREAL_2:30;
    end;
    suppose r1 <> b; then
     a < r1 < b by A5,XXREAL_0:1; then
     inf I < r1 < sup I by A3,A6,XXREAL_2:27,30;
     hence (r = sup I & r = upper_bound I) or r in ].inf I,sup I.[
       by XXREAL_1:4;
    end;
end;

Lm4:
for r be set, I be interval Subset of REAL st r in I & I is open_interval
 holds r in ].inf I,sup I.[
proof
    let r be set, I be interval Subset of REAL;
    assume that
A1:  r in I and
A2:  I is open_interval;

    consider a,b be R_eal such that
A3:  I = ].a,b.[ by A2,MEASURE5:def 2;

    reconsider r1 = r as Real by A1;
A4: a < r1 < b by A1,A3,XXREAL_1:4;
    a < b by A4,XXREAL_0:2; then
    inf I = a & sup I = b by A3,XXREAL_2:28,32;
    hence thesis by A1,A3;
end;

theorem Th4:
for f be PartFunc of REAL,REAL, I be Interval, x be Real st
 f is_right_differentiable_in x & x in I & x <> sup I holds
  f|I is_right_differentiable_in x
proof
    let f be PartFunc of REAL,REAL, I be Interval, x be Real;
    assume that
A1:  f is_right_differentiable_in x and
A2:  x in I and
A3:  x <> sup I;

    consider r be Real such that
A4:  r > 0 & [.x,x+r.] c= dom f by A1,FDIFF_3:def 3;
A5: x <= sup I by A2,XXREAL_2:4; then
A6: x < sup I by A3,XXREAL_0:1;
A7: x < +infty by XXREAL_0:9,XREAL_0:def 1;
    -infty < sup I by A5,A2,XXREAL_0:2,12; then
A8: sup I - x > 0 by A6,A7,XXREAL_3:51;
    set R0 = min(r,sup I-x);

A9: R0 > 0 by A4,A8,XXREAL_0:21;
A10:R0 <> -infty by A4,A8,XXREAL_0:21;
A11:R0 <= r & r < +infty by XREAL_0:def 1,XXREAL_0:17,9; then
    R0 in REAL by A10,XXREAL_0:14; then
    reconsider r0=R0 as Real;
    set R = r0/2;
    r0 > 0 by A4,A8,XXREAL_0:21; then
A12:R < r0 by XREAL_1:216; then
    R < r by A11,XXREAL_0:2; then
    x+R < x+r by XREAL_1:6; then
    [.x,x+R.] c= [.x,x+r.] by XXREAL_1:34; then
A13:[.x,x+R.] c= dom f by A4;

    reconsider x0=x as R_eal by XXREAL_0:def 1;
    reconsider S=R as R_eal by XXREAL_0:def 1;

A14: x in REAL by XREAL_0:def 1;

    r0 <= sup I - x by XXREAL_0:17; then
    R < sup I - x by A12,XXREAL_0:2; then
    S+x0 < sup I - x0 + x0 by A14,XXREAL_3:43; then
    S+x0 < sup I by XXREAL_3:22; then
A15:x+R < sup I by XXREAL_3:def 2;

A16: x < x+R by A9,XREAL_1:29,215; then
    x+R in I by A2,A15,XXREAL_2:81; then
    [.x,x+R.] c= I by A2,XXREAL_2:def 12; then
    [.x,x+R.] c= dom f /\ I by A13,XBOOLE_0:def 4; then
A17:[.x,x+R.] c= dom (f|I) by RELAT_1:61;

    for h be 0-convergent non-zero Real_Sequence,
     c be constant Real_Sequence st rng c = {x} & rng(h+c) c= dom(f|I) &
     (for n be Nat holds h.n > 0) holds
      h"(#)((f|I)/*(h+c) - (f|I)/*c) is convergent
    proof
     let h be 0-convergent non-zero Real_Sequence,
         c be constant Real_Sequence;
     assume that
A18:   rng c = {x} and
A19:   rng(h+c) c= dom(f|I) and
A20:   for n be Nat holds h.n > 0;
     dom(f|I) c= dom f by RELAT_1:60; then
     rng(h+c) c= dom f by A19; then
A21:  h"(#)(f/*(h+c) - f/*c) is convergent by A1,A18,A20,FDIFF_3:def 3;

A22:  (f|I)/*(h+c) = f/*(h+c) by A19,FUNCT_2:117;

     [.x,x+R.] = rng c \/ ].x,x+R.] by A16,A18,XXREAL_1:130; then
     rng c c= [.x,x+R.] by XBOOLE_1:7; then
     rng c c= dom(f|I) by A17;
     hence h"(#)((f|I)/*(h+c) - (f|I)/*c) is convergent by A22,A21,FUNCT_2:117;
    end;
    hence f|I is_right_differentiable_in x by A17,A9,XREAL_1:215,FDIFF_3:def 3;
end;

theorem Th5:
for f be PartFunc of REAL,REAL, I be Interval, x be Real st
 f is_left_differentiable_in x & x in I & x <> inf I holds
  f|I is_left_differentiable_in x
proof
    let f be PartFunc of REAL,REAL, I be Interval, x be Real;
    assume that
A1:  f is_left_differentiable_in x and
A2:  x in I and
A3:  x <> inf I;

    consider r be Real such that
A4:  r > 0 & [.x-r,x.] c= dom f by A1,FDIFF_3:def 4;
A5: inf I <= x by A2,XXREAL_2:3; then
A6: inf I < x by A3,XXREAL_0:1;
A7: x in REAL by XREAL_0:def 1;
A8: -infty < x by XREAL_0:def 1,XXREAL_0:12;
    inf I < +infty by A5,A7,XXREAL_0:2,9; then
A9: x - inf I > 0 by A6,A8,XXREAL_3:51;
    set R0 = min(r,x - inf I);

A10: R0 > 0 by A4,A9,XXREAL_0:21;
A11:R0 <> -infty by A4,A9,XXREAL_0:21;
A12:R0 <= r & r < +infty by XREAL_0:def 1,XXREAL_0:17,9; then
    R0 in REAL by A11,XXREAL_0:14; then
    reconsider r0=R0 as Real;
    set R = r0/2;

A13:R < r0 by A10,XREAL_1:216; then
    R < r by A12,XXREAL_0:2; then
    x-r < x-R by XREAL_1:10; then
    [.x-R,x.] c= [.x-r,x.] by XXREAL_1:34; then
A14:[.x-R,x.] c= dom f by A4;

    reconsider x0=x as R_eal by XXREAL_0:def 1;
    reconsider S=R as R_eal by XXREAL_0:def 1;

A15: -S = -R by XXREAL_3:def 3;

    r0 <= x - inf I by XXREAL_0:17; then
    R < x - inf I by A13,XXREAL_0:2; then
    S - x0 < x0 -inf I - x0 by A7,XXREAL_3:43; then
    S - x0 < -inf I + x0 - x0 by XXREAL_3:def 4; then
    S - x0 < -inf I by XXREAL_3:24; then
    -(S - x0) > --inf I by XXREAL_3:38; then
    x0 + -S > inf I by XXREAL_3:26; then
A16:x-R > inf I by A15,XXREAL_3:def 2;

A17: x-R < x by A10,XREAL_1:44,215; then
    x-R in I by A2,A16,XXREAL_2:82; then
    [.x-R,x.] c= I by A2,XXREAL_2:def 12; then
    [.x-R,x.] c= dom f /\ I by A14,XBOOLE_0:def 4; then
A18:[.x-R,x.] c= dom (f|I) by RELAT_1:61;

    for h be 0-convergent non-zero Real_Sequence,
     c be constant Real_Sequence st rng c = {x} & rng(h+c) c= dom(f|I) &
     (for n be Nat holds h.n < 0) holds
      h"(#)((f|I)/*(h+c) - (f|I)/*c) is convergent
    proof
     let h be 0-convergent non-zero Real_Sequence,
      c be constant Real_Sequence;
     assume that
A19:   rng c = {x} and
A20:   rng(h+c) c= dom(f|I) and
A21:   for n be Nat holds h.n < 0;
     dom(f|I) c= dom f by RELAT_1:60; then
     rng(h+c) c= dom f by A20; then
A22:  h"(#)(f/*(h+c) - f/*c) is convergent by A1,A19,A21,FDIFF_3:def 4;

A23:  (f|I)/*(h+c) = f/*(h+c) by A20,FUNCT_2:117;

     [.x-R,x.] = rng c \/ [.x-R,x.[ by A17,A19,XXREAL_1:129; then
     rng c c= [.x-R,x.] by XBOOLE_1:7; then
     rng c c= dom(f|I) by A18;
     hence h"(#)((f|I)/*(h+c) - (f|I)/*c) is convergent by A23,A22,FUNCT_2:117;
    end;
    hence f|I is_left_differentiable_in x by A18,A10,XREAL_1:215,FDIFF_3:def 4;
end;

theorem Th6:
for X be set, f1,f2 be PartFunc of X,REAL st dom f1 = dom f2 holds
 (f1 + f2) - f2 = f1 & (f1 - f2) + f2 = f1
proof
    let X be set, f1,f2 be PartFunc of X,REAL;
    assume A1: dom f1 = dom f2;
A2: dom(f1+f2) = dom f1 /\ dom f1 by A1,VALUED_1:def 1 .= dom f1; then
A3: dom((f1+f2)-f2) = dom f1 /\ dom f1 by A1,VALUED_1:12 .= dom f1;
A4: dom(f1-f2) = dom f1 /\ dom f1 by A1,VALUED_1:12 .= dom f1; then
A5: dom((f1-f2)+f2) = dom f1 /\ dom f1 by A1,VALUED_1:def 1 .= dom f1;

    for x be Element of X st x in dom f1 holds f1.x = ((f1+f2)-f2).x
    proof
     let x be Element of X;
     assume A6: x in dom f1; then
     ((f1+f2)-f2).x = (f1+f2).x - f2.x by A3,VALUED_1:13
      .= f1.x + f2.x - f2.x by A6,A2,VALUED_1:def 1;
     hence f1.x = ((f1+f2)-f2).x;
    end;
    hence (f1 + f2) - f2 = f1 by A3,PARTFUN1:5;

    for x be Element of X st x in dom f1 holds f1.x = ((f1-f2)+f2).x
    proof
     let x be Element of X;
     assume A7: x in dom f1; then
     ((f1-f2)+f2).x = (f1-f2).x + f2.x by A5,VALUED_1:def 1
      .= f1.x - f2.x + f2.x by A4,A7,VALUED_1:13;
     hence f1.x = ((f1-f2)+f2).x;
    end;
    hence (f1 - f2) + f2 = f1 by A5,PARTFUN1:5;
end;

begin :: Differentiation on Intervals

definition
  let f be PartFunc of REAL,REAL, I be non empty Interval;
  pred f is_differentiable_on_interval I means
  I c= dom f & inf I < sup I &
  (inf I in I implies f is_right_differentiable_in lower_bound I) &
  (sup I in I implies f is_left_differentiable_in upper_bound I) &
  f is_differentiable_on ].inf I,sup I.[;
end;

Lm5:
for I be interval Subset of REAL st inf I in I holds inf I = lower_bound I
proof
    let I be interval Subset of REAL;
    assume inf I in I; then
    reconsider J=I as non empty left_end real-membered set by XXREAL_2:def 5;
    inf J = lower_bound J;
    hence inf I = lower_bound I;
end;

Lm6:
for I be interval Subset of REAL st sup I in I holds sup I = upper_bound I
proof
    let I be interval Subset of REAL;
    assume sup I in I; then
    reconsider J=I as non empty right_end real-membered set by XXREAL_2:def 6;
    sup J = upper_bound J;
    hence sup I = upper_bound I;
end;

definition
  let f be PartFunc of REAL,REAL, I be interval non empty Subset of REAL;
  assume A1: f is_differentiable_on_interval I;
  func f`\I -> PartFunc of REAL,REAL means :Def2:
  dom it = I &
  for x be Real st x in I holds
   (x = inf I implies it.x = Rdiff(f,x)) &
   (x = sup I implies it.x = Ldiff(f,x)) &
   (x <> inf I & x <> sup I implies it.x = diff(f,x));
existence
proof
    defpred P[object] means $1 = inf I & $1 in I;
    defpred Q[object] means $1 = sup I & $1 in I;
    defpred R[object] means $1 in ].inf I,sup I.[;
    deffunc F(object) = In(Rdiff(f,In($1,REAL)),REAL);
    deffunc G(object) = In(Ldiff(f,In($1,REAL)),REAL);
    deffunc H(object) = In(diff(f,In($1,REAL)),REAL);

A2: for r be Element of REAL holds (P[r] implies not Q[r]) &
      (P[r] implies not R[r]) & (Q[r] implies not R[r]) by A1,XXREAL_1:4;
    consider IT being PartFunc of REAL,REAL such that
A3:  (for r be Element of REAL holds r in dom IT iff P[r] or Q[r] or R[r]) &
     for r be Element of REAL st r in dom IT holds (P[r] implies IT.r = F(r)) &
      (Q[r] implies IT.r = G(r)) & (R[r] implies IT.r = H(r))
        from SCHEME1:sch 9(A2);
    take IT;

    now let r be set;
     assume r in dom IT; then
     per cases by A3;
     suppose P[r] or Q[r];
      hence r in I;
     end;
     suppose A5: R[r]; then
      reconsider r1=r as Real;
      inf I < r1 < sup I by A5,XXREAL_1:4;
      hence r in I by XXREAL_2:83;
     end;
    end; then
A6: dom IT c= I;

    now let r be set;
     assume A7: r in I; then
     reconsider r1=r as Real;
     per cases by MEASURE5:1;
     suppose I is closed_interval; then
      P[r] or Q[r] or R[r] by A7,Lm1;
      hence r in dom IT by A3;
     end;
     suppose I is right_open_interval; then
      P[r] or R[r] by A7,Lm2;
      hence r in dom IT by A3;
     end;
     suppose I is left_open_interval; then
      Q[r] or R[r] by A7,Lm3;
      hence r in dom IT by A3;
     end;
     suppose I is open_interval;
      hence r in dom IT by A3,A7,Lm4;
     end;
    end; then
A8: I c= dom IT;
    hence dom IT = I by A6,XBOOLE_0:def 10;

    thus for x be Real st x in I holds
     (x = inf I implies IT.x = Rdiff(f,x)) &
     (x = sup I implies IT.x = Ldiff(f,x)) &
     (x <> inf I & x <> sup I implies IT.x = diff(f,x))
    proof
     let x be Real;
     assume
A9:   x in I;

     per cases;
     suppose
A10:   x = inf I; then

      IT.x = F(x) by A3,A8,A9;
      hence thesis by A10,A1;
     end;
     suppose
A11:   x = sup I; then

      IT.x = G(x) by A3,A8,A9;
      hence thesis by A11,A1;
     end;
     suppose A12: x <> inf I & x <> sup I;
A13:   x in ].inf I,sup I.[
      proof
A14:    I is closed_interval implies x in ].inf I,sup I.[ by A9,A12,Lm1;
A15:    I is right_open_interval implies x in ].inf I,sup I.[ by A9,A12,Lm2;
       I is left_open_interval implies x in ].inf I,sup I.[ by A9,A12,Lm3;
       hence thesis by A14,A15,A9,Lm4,MEASURE5:1;
      end; then
      inf I < x < sup I by XXREAL_1:4; then
      x in I by XXREAL_2:83; then
      IT.x = H(x) by A3,A8,A13;
      hence thesis by A12;
     end;
    end;
end;
uniqueness
proof
    let F1,F2 be PartFunc of REAL,REAL;
    assume that
A16:  dom F1 = I &
     for x be Real st x in I holds
      (x = inf I implies F1.x = Rdiff(f,x)) &
      (x = sup I implies F1.x = Ldiff(f,x)) &
      (x <> inf I & x <> sup I implies F1.x = diff(f,x)) and
A17:  dom F2 = I &
     for x be Real st x in I holds
      (x = inf I implies F2.x = Rdiff(f,x)) &
      (x = sup I implies F2.x = Ldiff(f,x)) &
      (x <> inf I & x <> sup I implies F2.x = diff(f,x));

    for x be Element of REAL st x in dom F1 holds F1.x = F2.x
    proof
     let x be Element of REAL;
     assume
A18:   x in dom F1;
     per cases;
     suppose x = inf I; then
      F1.x = Rdiff(f,x) & F2.x = Rdiff(f,x) by A16,A17,A18;
      hence F1.x = F2.x;
     end;
     suppose x = sup I; then
      F1.x = Ldiff(f,x) & F2.x = Ldiff(f,x) by A16,A17,A18;
      hence F1.x = F2.x;
     end;
     suppose x <> inf I & x <> sup I; then
      F1.x = diff(f,x) & F2.x = diff(f,x) by A16,A17,A18;
      hence F1.x = F2.x;
     end;
    end;
    hence F1 = F2 by A16,A17,PARTFUN1:5;
end;
end;

theorem
for f be PartFunc of REAL,REAL, a,b be Real st a < b &
 f is_differentiable_on_interval ['a,b'] holds
 f is_differentiable_on ].a,b.[
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  a < b and
A2:  f is_differentiable_on_interval ['a,b'];

A3: [.a,b.] = ['a,b'] by A1,INTEGRA5:def 3;

    a = inf [.a,b.] & b = sup [.a,b.] by A1,XXREAL_2:25,29;
    hence f is_differentiable_on ].a,b.[ by A2,A3;
end;

theorem
for f be PartFunc of REAL,REAL, a,b be Real st a <= b &
 f is_differentiable_on_interval ['a,b'] holds
 (f`\['a,b']).a = Rdiff(f,a) & (f`\['a,b']).b = Ldiff(f,b) &
 for x be Real st x in ].a,b.[ holds (f`\['a,b']).x = diff(f,x)
proof
    let f be PartFunc of REAL,REAL, a,b be Real;
    assume that
A1:  a <= b and
A2:  f is_differentiable_on_interval ['a,b'];

A3: a = inf [.a,b.] & b = sup [.a,b.] by A1,XXREAL_2:25,29; then
    reconsider I=[.a,b.] as non empty left_end right_end real-membered set
       by A1,XXREAL_1:1,XXREAL_2:def 5,def 6;
A4: I = ['a,b'] by A1,INTEGRA5:def 3;

A5: a in I & b in I by A1,XXREAL_1:1;
    hence (f`\['a,b']).a = Rdiff(f,a) by A3,A2,A4,Def2;
    thus (f`\['a,b']).b = Ldiff(f,b) by A2,A5,A4,A3,Def2;
    thus for x be Real st x in ].a,b.[ holds (f`\['a,b']).x = diff(f,x)
    proof
     let x be Real;
     assume A6: x in ].a,b.[; then
A7:  x <> a & x <> b by XXREAL_1:4;
     ].a,b.[ c= [.a,b.] by XXREAL_1:37;
     hence thesis by A2,A3,A7,A4,A6,Def2;
    end;
end;

Lm7:
for x,r be Real, h be 0-convergent non-zero Real_Sequence,
 c be constant Real_Sequence st r > 0 & rng c = {x} &
 (for n be Nat holds h.n > 0) holds
  ex N be Nat st rng(h^\N + c) c= ].x,x+r.[ &
   (for m be Nat holds (h^\N + c).m = (h+c).(N+m)) &
   for m be Nat st N <= m holds ( |. h.m .| < r & x < (h+c).m < x+r )
proof
    let x,r be Real, h be 0-convergent non-zero Real_Sequence,
    c be constant Real_Sequence;
    assume that
A1:  r > 0 and
A2:  rng c = {x} and
A3:  for n be Nat holds h.n > 0;

    h is convergent & lim h = 0; then
    consider N be Nat such that
A4:  for m be Nat st N <= m holds |. h.m - 0 .| < r by A1,SEQ_2:def 7;
    take N;

    set h1 = h^\N;

    now let p be Real;
     assume p in rng(h1 + c); then
     consider k be Element of NAT such that
A5:   p = (h1+c).k by FUNCT_2:113;
A6:  p = h1.k + c.k by A5,VALUED_1:1;
     c.k in rng c by FUNCT_2:112; then
A7:  c.k = x by A2,TARSKI:def 1;

A8:  h1.k = h.(N+k) by NAT_1:def 3; then
A9:  h1.k > 0 by A3;
     |. h1.k - 0 .| < r by A4,A8,NAT_1:11; then
     h1.k < r by A9,ABSVALUE:def 1; then
     x < p < x + r by A3,A8,A6,A7,XREAL_1:6,29;
     hence p in ].x,x+r.[ by XXREAL_1:4;
    end;
    hence
A10: rng(h^\N + c) c= ].x,x+r.[;
    thus
A11:  for m be Nat holds (h^\N + c).m = (h+c).(N+m)
    proof
     let m be Nat;
A12: dom(h1+c) = NAT & dom c = NAT & dom(h+c) = NAT by FUNCT_2:def 1; then
     m in dom(h1+c) & m in dom c & N+m in dom(h+c) & N+m in dom c
      by ORDINAL1:def 12; then
A13: c.m = c.(N+m) by FUNCT_1:def 10;

     (h1+c).m = h1.m + c.m by A12,ORDINAL1:def 12,VALUED_1:def 1
      .= h.(N+m) + c.(N+m) by A13,NAT_1:def 3;
     hence (h^\N + c).m = (h+c).(N+m) by A12,ORDINAL1:def 12,VALUED_1:def 1;
    end;

    thus for m be Nat st N <= m holds |. h.m .| < r & x < (h+c).m < x+r
    proof
     let m be Nat;
     assume
A14:  N <= m; then
     |. h.m - 0 .| < r by A4;
     hence |. h.m .| < r;

     consider m1 be Nat such that
A15:  m = N+m1 by A14,NAT_1:10;
     dom(h1+c) = NAT by FUNCT_2:def 1; then
     (h1+c).m1 in rng(h1+c) by FUNCT_1:3,ORDINAL1:def 12; then
     x < (h1+c).m1 < x+r by A10,XXREAL_1:4;
     hence x < (h+c).m < x+r by A15,A11;
    end;
end;

Lm8:
for x,r be Real, h be 0-convergent non-zero Real_Sequence,
 c be constant Real_Sequence st r > 0 & rng c = {x} &
 (for n be Nat holds h.n < 0) holds
  ex N be Nat st rng(h^\N + c) c= ].x-r,x.[ &
   (for m be Nat holds (h^\N + c).m = (h+c).(N+m)) &
   for m be Nat st N <= m holds ( |. h.m .| < r & x-r < (h+c).m < x )
proof
    let x,r be Real, h be 0-convergent non-zero Real_Sequence,
    c be constant Real_Sequence;
    assume that
A1:  r > 0 and
A2:  rng c = {x} and
A3:  for n be Nat holds h.n < 0;

    h is convergent & lim h = 0; then
    consider N be Nat such that
A4:  for m be Nat st N <= m holds |. h.m - 0 .| < r by A1,SEQ_2:def 7;
    take N;

    set h1 = h^\N;

    now let p be Real;
     assume p in rng(h1 + c); then
     consider k be Element of NAT such that
A5:   p = (h1+c).k by FUNCT_2:113;
A6:  p = h1.k + c.k by A5,VALUED_1:1;
     c.k in rng c by FUNCT_2:112; then
A7:  c.k = x by A2,TARSKI:def 1;

A8:  h1.k = h.(N+k) by NAT_1:def 3;

     |. h1.k - 0 .| < r by A4,A8,NAT_1:11; then
     -(h1.k) < r by A3,A8,ABSVALUE:def 1; then
     x-r < p < x by A3,A8,A6,A7,XREAL_1:6,25,30;
     hence p in ].x-r,x.[ by XXREAL_1:4;
    end;
    hence
A9: rng(h^\N + c) c= ].x-r,x.[;
    thus
A10:  for m be Nat holds (h^\N + c).m = (h+c).(N+m)
    proof
     let m be Nat;
A11: dom(h1+c) = NAT & dom c = NAT & dom(h+c) = NAT by FUNCT_2:def 1; then
     m in dom(h1+c) & m in dom c & N+m in dom(h+c) & N+m in dom c
      by ORDINAL1:def 12; then
A12: c.m = c.(N+m) by FUNCT_1:def 10;

     (h1+c).m = h1.m + c.m by A11,ORDINAL1:def 12,VALUED_1:def 1
      .= h.(N+m) + c.(N+m) by A12,NAT_1:def 3;
     hence (h^\N + c).m = (h+c).(N+m) by A11,ORDINAL1:def 12,VALUED_1:def 1;
    end;

    thus for m be Nat st N <= m holds |. h.m .| < r & x-r < (h+c).m < x
    proof
     let m be Nat;
     assume
A13:  N <= m; then
     |. h.m - 0 .| < r by A4;
     hence |. h.m .| < r;

     consider m1 be Nat such that
A14:  m = N+m1 by A13,NAT_1:10;
     dom(h1+c) = NAT by FUNCT_2:def 1; then
     (h1+c).m1 in rng(h1+c) by FUNCT_1:3,ORDINAL1:def 12; then
     x-r < (h1+c).m1 < x by A9,XXREAL_1:4;
     hence x-r < (h+c).m < x by A14,A10;
    end;
end;

theorem Th9:
for f be PartFunc of REAL,REAL, I be Interval, x be Real st
 f|I is_right_differentiable_in x holds
  f is_right_differentiable_in x & Rdiff(f|I,x) = Rdiff(f,x)
proof
    let f be PartFunc of REAL,REAL, I be Interval, x be Real;
    assume
A1:  f|I is_right_differentiable_in x; then
    consider r be Real such that
A2:  r > 0 & [.x,x+r.] c= dom(f|I) by FDIFF_3:def 3;

A3: dom(f|I) c= dom f by RELAT_1:60; then
A4: [.x,x+r.] c= dom f by A2;

    for h be 0-convergent non-zero Real_Sequence,
     c be constant Real_Sequence st rng c = {x} & rng(h+c) c= dom f &
     (for n be Nat holds h.n > 0) holds
      h"(#)(f/*(h+c)-f/*c) is convergent &
      lim(h"(#)(f/*(h+c)-f/*c)) = Rdiff(f|I,x)
    proof
     let h be 0-convergent non-zero Real_Sequence,
     c be constant Real_Sequence;
     assume that
A5:   rng c = {x} and
A6:   rng(h+c) c= dom f and
A7:   for n be Nat holds h.n > 0;

     consider N be Nat such that
A8:   rng(h^\N + c) c= ].x,x+r.[ &
      (for m be Nat holds (h^\N + c).m = (h+c).(N+m)) &
      for m be Nat st N <= m holds ( |. h.m .| < r & x < (h+c).m < x+r )
        by A2,A5,A7,Lm7;
     set h1 = h^\N;

     ].x,x+r.[ c= [.x,x+r.] by XXREAL_1:37; then
A9:  rng(h1+c) c= dom(f|I) by A2,A8; then
A10:  (f|I)/*(h1+c) = (f|I)*(h1+c) by FUNCT_2:def 11;

A11:  f/*(h+c) = f*(h+c) by A6,FUNCT_2:def 11;

A12:  for n be Nat holds h1.n > 0
     proof
      let n be Nat;
      h1.n = h.(N+n) by NAT_1:def 3;
      hence h1.n > 0 by A7;
     end; then
A13: h1"(#)((f|I)/*(h1+c) - (f|I)/*c) is convergent by A1,A5,A9,FDIFF_3:def 3;

     x < x+r by A2,XREAL_1:29; then
     [.x,x+r.] = rng c \/ ].x,x+r.] by A5,XXREAL_1:130; then
A14: rng c c= [.x,x+r.] by XBOOLE_1:7; then
A15: rng c c= dom(f|I) by A2;

A16:  rng c c= dom f by A2,A3,A14; then
A17:  f/*c = f*c by FUNCT_2:def 11;

     consider g be Real such that
A18:   for p be Real st 0 < p ex M be Nat st for l be Nat st M <= l holds
       |. (h1"(#)((f|I)/*(h1+c) - (f|I)/*c)).l - g .| < p
         by A13,SEQ_2:def 6;

     lim(h1"(#)((f|I)/*(h1+c) - (f|I)/*c)) = g by A13,A18,SEQ_2:def 7; then
A19:  Rdiff(f|I,x) = g by A1,A5,A9,A12,FDIFF_3:def 6;

A20:  now let p be Real;
      assume 0 < p; then
      consider M be Nat such that
A21:    for l be Nat st M <= l holds
        |. (h1"(#)((f|I)/*(h1+c) - (f|I)/*c)).l - g .| < p by A18;

      take K = N+M;
      hereby let l be Nat;
       assume K <= l; then
       reconsider i = l-(N+M) as Element of NAT by NAT_1:21;
       reconsider i1 = i+M as Element of NAT by ORDINAL1:def 12;

A22:   dom(h1+c) = NAT & dom c = NAT & dom(h+c) = NAT by FUNCT_2:def 1; then
       i1 in dom(h1+c) & i1 in dom c; then
       i1 in dom((f|I)*(h1+c)) & i1 in dom((f|I)*c) by A9,A15,RELAT_1:27; then
       i1 in dom((f|I)*(h1+c)) /\ dom((f|I)*c) by XBOOLE_0:def 4; then
A23:   i1 in dom( (f|I)*(h1+c) - (f|I)*c) by VALUED_1:12;

A24:   (h1+c).i1 in rng(h1+c) & c.i1 in rng c by A22,FUNCT_1:3;

A25:   l in dom(h+c) & l in dom c by A22,ORDINAL1:def 12; then
A26:   c.i1 = c.l by A22,FUNCT_1:def 10;

A27:   (h1").i1 = ((h")^\N).i1 by SEQM_3:18 .= (h").(N+i1) by NAT_1:def 3;

A28:   f.((h+c).l) = (f*(h+c)).l & f.(c.l) = (f*c).l
         by A22,ORDINAL1:def 12,FUNCT_1:13;

       l in dom(f*(h+c)) & l in dom(f*c) by A25,A6,A16,RELAT_1:27; then
       l in dom(f/*(h+c)) /\ dom(f/*c) by A11,A17,XBOOLE_0:def 4; then
A29:   l in dom( f/*(h+c) - f/*c ) by VALUED_1:12;

       (h1"(#)((f|I)/*(h1+c) - (f|I)/*c)).i1
         = (h1"(#)((f|I)*(h1+c) - (f|I)*c)).i1 by A10,A15,FUNCT_2:def 11
        .= (h1").i1 * ((f|I)*(h1+c)-(f|I)*c).i1 by VALUED_1:5
        .= (h1").i1 * ( ((f|I)*(h1+c)).i1 - ((f|I)*c).i1 ) by A23,VALUED_1:13
        .= (h1").i1 * ( (f|I).((h1+c).i1) - ((f|I)*c).i1 ) by A22,FUNCT_1:13
        .= (h1").i1 * ( (f|I).((h1+c).i1) - (f|I).(c.i1) ) by A22,FUNCT_1:13
        .= (h1").i1 * ( f.((h1+c).i1) - (f|I).(c.i1) ) by A24,A9,FUNCT_1:47
        .= (h1").i1 * ( f.((h1+c).i1) - f.(c.i1) ) by A2,A24,A14,FUNCT_1:47
        .= (h").l * ( (f*(h+c)).l - (f*c).l ) by A8,A26,A27,A28
        .= (h").l * (f/*(h+c)-f/*c).l by A11,A17,A29,VALUED_1:13
        .= (h"(#)(f/*(h+c)-f/*c)).l by VALUED_1:5;
       hence |. (h"(#)(f/*(h+c)-f/*c)).l - g .| < p by A21,NAT_1:11;
      end;
     end;
     hence h"(#)(f/*(h+c)-f/*c) is convergent by SEQ_2:def 6;
     hence lim(h"(#)(f/*(h+c)-f/*c)) = Rdiff(f|I,x) by A19,A20,SEQ_2:def 7;
    end;
    hence f is_right_differentiable_in x &
     Rdiff(f,x) = Rdiff(f|I,x) by A2,A4,FDIFF_3:15;
end;

theorem Th10:
for f be PartFunc of REAL,REAL, I be Interval, x be Real st
 f|I is_left_differentiable_in x holds
  f is_left_differentiable_in x & Ldiff(f|I,x) = Ldiff(f,x)
proof
    let f be PartFunc of REAL,REAL, I be Interval, x be Real;
    assume
A1:  f|I is_left_differentiable_in x; then
    consider r be Real such that
A2:  r > 0 & [.x-r,x.] c= dom(f|I) by FDIFF_3:def 4;

A3: dom(f|I) c= dom f by RELAT_1:60; then
A4: [.x-r,x.] c= dom f by A2;

    for h be 0-convergent non-zero Real_Sequence,
     c be constant Real_Sequence st rng c = {x} & rng(h+c) c= dom f &
     (for n be Nat holds h.n < 0) holds
      h"(#)(f/*(h+c)-f/*c) is convergent &
      lim(h"(#)(f/*(h+c)-f/*c)) = Ldiff(f|I,x)
    proof
     let h be 0-convergent non-zero Real_Sequence,
     c be constant Real_Sequence;
     assume that
A5:   rng c = {x} and
A6:   rng(h+c) c= dom f and
A7:   for n be Nat holds h.n < 0;

     consider N be Nat such that
A8:   rng(h^\N + c) c= ].x-r,x.[ &
      (for m be Nat holds (h^\N + c).m = (h+c).(N+m)) &
      for m be Nat st N <= m holds ( |. h.m .| < r & x-r < (h+c).m < x )
        by A2,A5,A7,Lm8;
     set h1 = h^\N;

     ].x-r,x.[ c= [.x-r,x.] by XXREAL_1:37; then
A9:  rng(h1+c) c= dom(f|I) by A2,A8; then
A10:  (f|I)/*(h1+c) = (f|I)*(h1+c) by FUNCT_2:def 11;

A11:  f/*(h+c) = f*(h+c) by A6,FUNCT_2:def 11;

A12:  for n be Nat holds h1.n < 0
     proof
      let n be Nat;
      h1.n = h.(N+n) by NAT_1:def 3;
      hence h1.n < 0 by A7;
     end; then
A13: h1"(#)((f|I)/*(h1+c) - (f|I)/*c) is convergent by A1,A5,A9,FDIFF_3:def 4;

     x-r < x by A2,XREAL_1:44; then
     [.x-r,x.] = rng c \/ [.x-r,x.[ by A5,XXREAL_1:129; then
A14: rng c c= [.x-r,x.] by XBOOLE_1:7; then
A15: rng c c= dom(f|I) by A2;

A16:  rng c c= dom f by A2,A3,A14; then
A17:  f/*c = f*c by FUNCT_2:def 11;

     consider g be Real such that
A18:   for p be Real st 0 < p ex M be Nat st for l be Nat st M <= l holds
       |. (h1"(#)((f|I)/*(h1+c) - (f|I)/*c)).l - g .| < p
         by A13,SEQ_2:def 6;

     lim(h1"(#)((f|I)/*(h1+c) - (f|I)/*c)) = g by A13,A18,SEQ_2:def 7; then
A19:  Ldiff(f|I,x) = g by A1,A5,A9,A12,FDIFF_3:def 5;

A20:  now let p be Real;
      assume 0 < p; then
      consider M be Nat such that
A21:    for l be Nat st M <= l holds
        |. (h1"(#)((f|I)/*(h1+c) - (f|I)/*c)).l - g .| < p by A18;

      take K = N+M;
      hereby let l be Nat;
       assume K <= l; then
       reconsider i = l-(N+M) as Element of NAT by NAT_1:21;
       reconsider i1 = i+M as Element of NAT by ORDINAL1:def 12;

A22:   dom(h1+c) = NAT & dom c = NAT & dom(h+c) = NAT by FUNCT_2:def 1; then
       i1 in dom(h1+c) & i1 in dom c; then
       i1 in dom((f|I)*(h1+c)) & i1 in dom((f|I)*c) by A9,A15,RELAT_1:27; then
       i1 in dom((f|I)*(h1+c)) /\ dom((f|I)*c) by XBOOLE_0:def 4; then
A23:   i1 in dom( (f|I)*(h1+c) - (f|I)*c) by VALUED_1:12;

A24:   (h1+c).i1 in rng(h1+c) & c.i1 in rng c by A22,FUNCT_1:3;

A25:   l in dom(h+c) & l in dom c by A22,ORDINAL1:def 12; then
A26:   c.i1 = c.l by A22,FUNCT_1:def 10;

A27:   (h1").i1 = ((h")^\N).i1 by SEQM_3:18 .= (h").(N+i1) by NAT_1:def 3;

A28:   f.((h+c).l) = (f*(h+c)).l & f.(c.l) = (f*c).l
         by A22,ORDINAL1:def 12,FUNCT_1:13;

       l in dom(f*(h+c)) & l in dom(f*c) by A25,A6,A16,RELAT_1:27; then
       l in dom(f/*(h+c)) /\ dom(f/*c) by A11,A17,XBOOLE_0:def 4; then
A29:   l in dom( f/*(h+c) - f/*c ) by VALUED_1:12;

       (h1"(#)((f|I)/*(h1+c) - (f|I)/*c)).i1
         = (h1"(#)((f|I)*(h1+c) - (f|I)*c)).i1 by A10,A15,FUNCT_2:def 11
        .= (h1").i1 * ((f|I)*(h1+c)-(f|I)*c).i1 by VALUED_1:5
        .= (h1").i1 * ( ((f|I)*(h1+c)).i1 - ((f|I)*c).i1 ) by A23,VALUED_1:13
        .= (h1").i1 * ( (f|I).((h1+c).i1) - ((f|I)*c).i1 ) by A22,FUNCT_1:13
        .= (h1").i1 * ( (f|I).((h1+c).i1) - (f|I).(c.i1) ) by A22,FUNCT_1:13
        .= (h1").i1 * ( f.((h1+c).i1) - (f|I).(c.i1) ) by A9,A24,FUNCT_1:47
        .= (h1").i1 * ( f.((h1+c).i1) - f.(c.i1) ) by A2,A14,A24,FUNCT_1:47
        .= (h").l * ( (f*(h+c)).l - (f*c).l ) by A8,A26,A27,A28
        .= (h").l * (f/*(h+c)-f/*c).l by A11,A17,A29,VALUED_1:13
        .= (h"(#)(f/*(h+c)-f/*c)).l by VALUED_1:5;
       hence |. (h"(#)(f/*(h+c)-f/*c)).l - g .| < p by A21,NAT_1:11;
      end;
     end;
     hence h"(#)(f/*(h+c)-f/*c) is convergent by SEQ_2:def 6;
     hence lim(h"(#)(f/*(h+c)-f/*c)) = Ldiff(f|I,x) by A19,A20,SEQ_2:def 7;
    end;
    hence f is_left_differentiable_in x &
     Ldiff(f,x) = Ldiff(f|I,x) by A2,A4,FDIFF_3:9;
end;

Lm9:
for I be non empty Interval, x be Real st inf I < x < sup I
 ex Z be open Subset of REAL st x in Z & Z c= ].inf I,sup I.[
proof
    let I be non empty Interval, x be Real;
    assume
A1:  inf I < x < sup I; then
A2: inf I < sup I by XXREAL_0:2;
    per cases;
    suppose A3: inf I = -infty;
     per cases;
     suppose A4: sup I = +infty;
      reconsider Z = ]. x-1,x+1 .[ as open Subset of REAL;
      take Z;
      x-1 < x < x+1 by XREAL_1:29,44;
      hence x in Z by XXREAL_1:4;
      now let r be Real;
       assume r in Z;
       inf I < r < sup I by A3,A4,XXREAL_0:4,6;
       hence r in ].inf I,sup I.[ by XXREAL_1:4;
      end;
      hence Z c= ].inf I,sup I.[;
     end;
     suppose sup I <> +infty; then
      reconsider s = sup I as Real by A1,A3,XREAL_0:def 1,XXREAL_0:14;
A5:   x-1 < x by XREAL_1:44;
      reconsider Z = ].x-1,s.[ as open Subset of REAL;
      take Z;
      thus x in Z by A5,A1,XXREAL_1:4;
      now let r be Real;
       assume r in Z; then
       inf I < r < sup I by A3,XXREAL_0:6,XXREAL_1:4;
       hence r in ].inf I,sup I.[ by XXREAL_1:4;
      end;
      hence Z c= ].inf I,sup I.[;
     end;
    end;
    suppose A6: inf I <> -infty; then
A7:  -infty < inf I by XXREAL_0:6;
     sup I <= +infty by XXREAL_0:3; then
     reconsider i = inf I as Real by A2,A6,XXREAL_0:14,XREAL_0:def 1;
     per cases;
     suppose A8: sup I = +infty;

      consider q be Real such that
A9:   x < q by XREAL_1:1;
      reconsider Z = ].i,q.[ as open Subset of REAL;
      take Z;
      thus x in Z by A1,A9,XXREAL_1:4;
      now let r be Real;
       assume r in Z; then
       inf I < r < sup I by A8,XXREAL_0:9,XXREAL_1:4;
       hence r in ].inf I,sup I.[ by XXREAL_1:4;
      end;
      hence Z c= ].inf I,sup I.[;
     end;
     suppose sup I <> +infty; then
      reconsider s = sup I as Real by A7,A2,XREAL_0:def 1,XXREAL_0:14;
      reconsider Z = ].i,s.[ as open Subset of REAL;
      take Z;
      thus x in Z by A1,XXREAL_1:4;
      thus Z c= ].inf I,sup I.[;
     end;
    end;
end;

theorem Th11:
for f be PartFunc of REAL,REAL, I be non empty Interval holds
 f is_differentiable_on_interval I iff
 (I c= dom f & for x be Real st x in I holds
  (x = inf I implies f|I is_right_differentiable_in x) &
  (x = sup I implies f|I is_left_differentiable_in x) &
  (x in ].inf I,sup I.[ implies f is_differentiable_in x))
proof
    let f be PartFunc of REAL,REAL, I be non empty Interval;
    hereby assume
A1:  f is_differentiable_on_interval I;
     hence I c= dom f;
     thus for x be Real st x in I holds
      (x = inf I implies f|I is_right_differentiable_in x) &
      (x = sup I implies f|I is_left_differentiable_in x) &
      (x in ].inf I,sup I.[ implies f is_differentiable_in x)
     proof
      let x be Real;
      assume
A2:    x in I;
      thus x = inf I implies f|I is_right_differentiable_in x
      proof
       assume A3: x = inf I; then
       f is_right_differentiable_in x by A1,A2,Lm5;
       hence f|I is_right_differentiable_in x by A1,A2,A3,Th4;
      end;
      thus x = sup I implies f|I is_left_differentiable_in x
      proof
       assume A4: x = sup I; then
       f is_left_differentiable_in x by A1,A2,Lm6;
       hence f|I is_left_differentiable_in x by A1,A2,A4,Th5;
      end;
      assume x in ].inf I,sup I.[; then
      inf I < x < sup I by XXREAL_1:4; then
      consider Z be open Subset of REAL such that
A5:    x in Z & Z c= ].inf I,sup I.[ by Lm9;

      f is_differentiable_on Z by A1,A5,FDIFF_1:26;
      hence f is_differentiable_in x by A5,FDIFF_1:9;
     end;
    end;

    assume that
A6:  I c= dom f and
A7:  for x be Real st x in I holds
      (x = inf I implies f|I is_right_differentiable_in x) &
      (x = sup I implies f|I is_left_differentiable_in x) &
      (x in ].inf I,sup I.[ implies f is_differentiable_in x);

A8: now assume inf I = sup I; then
A9:  I = {inf I} by XXREAL_2:70; then
A10:  inf I in I by ZFMISC_1:31; then
     reconsider x = inf I as Real;
     f|I is_right_differentiable_in x by A7,A10; then
     consider r be Real such that
A11:   r > 0 & [.x,x+r.] c= dom(f|I) by FDIFF_3:def 3;
     dom(f|I) c= I; then
A12:  [.x,x+r.] c= I by A11;
A13:  x < x+r by A11,XREAL_1:29; then
     x+r in {inf I} by A12,A9,XXREAL_1:1;
     hence contradiction by A13,TARSKI:def 1;
    end;

A14: inf I <= sup I by XXREAL_2:40;

A15: inf I in I implies f is_right_differentiable_in lower_bound I
    proof
     assume A16: inf I in I; then
     inf I = lower_bound I by Lm5; then
     f|I is_right_differentiable_in lower_bound I by A16,A7;
     hence f is_right_differentiable_in lower_bound I by Th9;
    end;

A17: sup I in I implies f is_left_differentiable_in upper_bound I
    proof
     assume A18: sup I in I; then
     sup I = upper_bound I by Lm6; then
     f|I is_left_differentiable_in upper_bound I by A18,A7;
     hence f is_left_differentiable_in upper_bound I by Th10;
    end;

A19: now let a be set;
     assume A20:a in ].inf I,sup I.[; then
     reconsider a1=a as Real;
     inf I < a1 < sup I by A20,XXREAL_1:4;
     hence a in I by XXREAL_2:83;
    end;
A21: ].inf I,sup I.[ c= I by Th2;

A22: ].inf I,sup I.[ c= dom f by A6,A19;

    set J = ].inf I,sup I.[;

    for x be Real st x in ].inf I,sup I.[ holds
     f|(].inf I,sup I.[) is_differentiable_in x
    proof
     let x be Real;
     assume A23: x in ].inf I,sup I.[; then
     f is_differentiable_in x by A7,A21; then
     consider N1 be Neighbourhood of x such that
A24:   N1 c= dom f &
      ex L be LinearFunc, R be RestFunc st
       for p be Real st p in N1 holds f.p - f.x = L.(p-x) + R.(p-x);

     ex r1 be Real st inf I < r1 < x
     proof
      per cases;
      suppose A25: inf I = -infty;
       consider r1 be Real such that
A26:     r1 < x by XREAL_1:2;
       take r1;
       thus inf I < r1 < x by A25,A26,XXREAL_0:12,XREAL_0:def 1;
      end;
      suppose A27:inf I <> -infty;
A28:    inf I < x by A23,XXREAL_1:4; then
       inf I <> +infty by XXREAL_0:3; then
       inf I in REAL by A27,XXREAL_0:14; then
       reconsider iI = inf I as Real;

       consider r1 be Real such that
A29:     iI < r1 < x by A28,XREAL_1:5;
       take r1;
       thus inf I < r1 < x by A29;
      end;
     end; then
     consider r1 be Real such that
A30:  inf I < r1 < x;

     ex r2 be Real st x < r2 < sup I
     proof
      per cases;
      suppose A31: sup I = +infty;
       consider r2 be Real such that
A32:     x < r2 by XREAL_1:1;
       take r2;
       thus x < r2 < sup I by A31,A32,XREAL_0:def 1,XXREAL_0:9;
      end;
      suppose A33: sup I <> +infty;
A34:    sup I > x by A23,XXREAL_1:4; then
       sup I <> -infty by XXREAL_0:5; then
       sup I in REAL by A33,XXREAL_0:14; then
       reconsider sI = sup I as Real;

       consider r2 be Real such that
A35:     x < r2 < sI by A34,XREAL_1:5;
       take r2;
       thus x < r2 < sup I by A35;
      end;
     end; then
     consider r2 be Real such that
A36:  x < r2 < sup I;

A37: x-r1 > 0 & r2-x > 0 by A30,A36,XREAL_1:50;
     set rr = min(x-r1,r2-x);
     reconsider N2 = ].x-rr,x+rr.[ as Neighbourhood of x
       by A37,XXREAL_0:21,RCOMP_1:def 6;

     r1 <= x-rr & x+rr <= r2 by XXREAL_0:17,XREAL_1:11,19; then
A38:  ].x-rr,x+rr.[ c= ].r1,r2.[ by XXREAL_1:46;
A39:  ].r1,r2.[ c= ].inf I,sup I.[ by A30,A36,XXREAL_1:46;

     consider N be Neighbourhood of x such that
A40:   N c= N1 & N c= N2 by RCOMP_1:17;
     N c= dom f & N c= J by A24,A38,A39,A40; then
     N c= dom f /\ J by XBOOLE_1:19; then
A41:  N c= dom(f|J) by RELAT_1:61;

     consider L be LinearFunc, R be RestFunc such that
A42:   for p be Real st p in N1 holds f.p - f.x = L.(p-x) + R.(p-x) by A24;

     for p be Real st p in N holds (f|J).p - (f|J).x = L.(p-x) + R.(p-x)
     proof
      let p be Real;
      assume
A43:    p in N;
      x in N by RCOMP_1:16; then
      (f|J).p = f.p & (f|J).x = f.x by A41,A43,FUNCT_1:47;
      hence thesis by A42,A43,A40;
     end;
     hence f|(].inf I,sup I.[) is_differentiable_in x by A41;
    end; then
    f is_differentiable_on ].inf I,sup I.[ by A22;
    hence f is_differentiable_on_interval I by A6,A14,A15,A17,A8,XXREAL_0:1;
end;

theorem
for f be PartFunc of REAL,REAL, I be non empty Interval st I is open_interval
 holds f is_differentiable_on I iff f is_differentiable_on_interval I
proof
    let f be PartFunc of REAL,REAL, I be non empty Interval;
    assume I is open_interval; then
    consider a,b be R_eal such that
A1:  I = ].a,b.[ by MEASURE5:def 2;

A2: a = inf I & b = sup I by A1,XXREAL_1:28,XXREAL_2:28,32;

    hence f is_differentiable_on I implies
     f is_differentiable_on_interval I by A1,XXREAL_1:4,28;
    assume f is_differentiable_on_interval I;
    hence f is_differentiable_on I by A1,A2;
end;

Lm10:
for X be set st X is Subset of REAL holds X is Subset of ExtREAL
proof
    let X be set;
    assume A1: X is Subset of REAL;
    bool REAL c= bool ExtREAL by NUMBERS:31,ZFMISC_1:67;
    hence thesis by A1;
end;

Lm11:
for I be non empty Interval st inf I in I holds
 I is closed_interval or I is right_open_interval
proof
    let I be non empty Interval;
    assume A1: inf I in I;
A2: now assume I is open_interval; then
     consider a,b be R_eal such that
A3:   I = ].a,b.[ by MEASURE5:def 2;
     inf I = a by A3,XXREAL_1:28,XXREAL_2:28;
     hence contradiction by A1,A3,XXREAL_1:4;
    end;
    now assume
     I is left_open_interval; then
     consider a be R_eal, b be Real such that
A4:   I = ].a,b.] by MEASURE5:def 5;
     inf I = a by A4,XXREAL_1:26,XXREAL_2:27;
     hence contradiction by A1,A4,XXREAL_1:2;
    end;
    hence thesis by A2,MEASURE5:1;
end;

Lm12:
for I be non empty Interval st sup I in I holds
 I is closed_interval or I is left_open_interval
proof
    let I be non empty Interval;
    assume A1: sup I in I;
A2: now assume I is open_interval; then
     consider a,b be R_eal such that
A3:   I = ].a,b.[ by MEASURE5:def 2;
     sup I = b by A3,XXREAL_1:28,XXREAL_2:32;
     hence contradiction by A1,A3,XXREAL_1:4;
    end;
    now assume
     I is right_open_interval; then
     consider a be Real, b be R_eal such that
A4:   I = [.a,b.[ by MEASURE5:def 4;
     sup I = b by A4,XXREAL_1:27,XXREAL_2:31;
     hence contradiction by A1,A4,XXREAL_1:3;
    end;
    hence thesis by A2,MEASURE5:1;
end;

Lm13:
for I be non empty Interval holds ].inf I,sup I.[ c= I by Th2;

Lm14:
for I be non empty Interval st inf I in I & inf I < sup I
 ex e be Real st e > 0 & [.lower_bound I,lower_bound I+e.] c= I
proof
    let I be non empty Interval;
    assume that
A1:  inf I in I and
A2:  inf I < sup I;

A3: inf I = lower_bound I by A1,Lm5;

    I is non empty Subset of ExtREAL by Lm10; then
    consider q be Element of ExtREAL such that
A4: q in I & inf I < q by A2,XXREAL_2:94;
    reconsider q as Real by A4;
    take e = q - lower_bound I;
    thus e > 0 by A3,A4,XREAL_1:50;
    thus [.lower_bound I, lower_bound I+e.] c= I
    proof
     per cases by A1,Lm11;
     suppose I is closed_interval; then
A5:  I = [.inf I,sup I.] by MEASURE6:17;
      q <= sup I by A4,A5,XXREAL_1:1;
      hence [.lower_bound I,lower_bound I+e.] c= I by A3,A5,XXREAL_1:34;
     end;
     suppose I is right_open_interval; then
A6:  I = [.inf I,sup I.[ by MEASURE6:18;
      q < sup I by A4,A6,XXREAL_1:3;
      hence [.lower_bound I,lower_bound I+e.] c= I by A3,A6,XXREAL_1:43;
     end;
    end;
end;

Lm15:
for I be non empty Interval st sup I in I & inf I < sup I
 ex e be Real st e > 0 & [.upper_bound I-e,upper_bound I.] c= I
proof
    let I be non empty Interval;
    assume that
A1:  sup I in I and
A2:  inf I < sup I;

A3: sup I = upper_bound I by A1,Lm6;

    I is non empty Subset of ExtREAL by Lm10; then
    consider q be Element of ExtREAL such that
A4: q in I & q < sup I by A2,XXREAL_2:95;

    reconsider q as Real by A4;
    take e = upper_bound I - q;
    thus e > 0 by A3,A4,XREAL_1:50;
    thus [.upper_bound I-e, upper_bound I.] c= I
    proof
     per cases by A1,Lm12;
     suppose I is closed_interval; then
A5:  I = [.inf I,sup I.] by MEASURE6:17;
      inf I <= q by A4,A5,XXREAL_1:1;
      hence [.upper_bound I-e,upper_bound I.] c= I by A3,A5,XXREAL_1:34;
     end;
     suppose I is left_open_interval; then
A6:  I = ].inf I,sup I.] by MEASURE6:19;
      inf I < q by A4,A6,XXREAL_1:2;
      hence [.upper_bound I-e,upper_bound I.] c= I by A3,A6,XXREAL_1:39;
     end;
    end;
end;

theorem
for f be PartFunc of REAL,REAL, x0,r be Real st
 f is_right_differentiable_in x0 & rng f = {r} holds Rdiff(f,x0) = 0
proof
    let f be PartFunc of REAL,REAL, x0,r be Real;
    assume that
A1:  f is_right_differentiable_in x0 and
A2:  rng f = {r};

A3: ex e be Real st e>0 & [.x0, x0+e.] c= dom f by A1,FDIFF_3:def 3;
    for h be non-zero 0-convergent Real_Sequence, c be constant Real_Sequence
     st rng c = {x0} & rng(h+c) c= dom f & (for n be Nat holds h.n>0) holds
     h"(#)(f/*(h+c) - f/*c) is convergent &
     lim (h"(#)(f/*(h+c) - f/*c)) = 0
    proof
     let h be non-zero 0-convergent Real_Sequence, c be constant Real_Sequence;
     assume that
A4:   rng c = {x0} and
A5:   rng(h+c) c= dom f and
A6:   for n be Nat holds h.n>0;
     thus
A7:   h"(#)(f/*(h+c) - f/*c) is convergent by A1,A4,A5,A6,FDIFF_3:def 3;

     consider e be Real such that
A8:   e > 0 & [.x0,x0+e.] c= dom f by A1,FDIFF_3:def 3;

     for p be Real st 0<p ex n be Nat st for m be Nat st n <= m holds
      |. (h"(#)(f/*(h+c) - f/*c)).m - 0 .| < p
     proof
      let p be Real;
      assume
A9:    0 < p;
      take n = 0;
      hereby let m be Nat;
       assume n <= m;
       x0 < x0+e by A8,XREAL_1:29; then
A10:    x0 in [.x0,x0+e.] by XXREAL_1:1; then
A11:    rng c c= dom f by A8,A4,ZFMISC_1:31;

A12:   f/*(h+c) = f*(h+c) & f/*c = f*c
         by A5,A8,A4,A10,ZFMISC_1:31,FUNCT_2:def 11;

A13:   dom(h+c) = NAT & dom c = NAT by FUNCT_2:def 1; then
       m in dom(h+c) & m in dom c by ORDINAL1:def 12; then
       m in dom(f*(h+c)) & m in dom(f*c)
         by A5,A10,A8,A4,ZFMISC_1:31,RELAT_1:27; then
       m in dom(f*(h+c)) /\ dom(f*c) by XBOOLE_0:def 4; then
A14:   m in dom( f*(h+c) - f*c ) by VALUED_1:12;

       (h+c).m in rng(h+c) & c.m in rng c
         by A13,ORDINAL1:def 12,FUNCT_1:3; then
       f.((h+c).m) in rng f & f.(c.m) in rng f by A5,A11,FUNCT_1:3; then
       f.((h+c).m) = r & f.(c.m) = r by A2,TARSKI:def 1; then
A15:   (f*(h+c)).m = r & (f*c).m = r by A13,ORDINAL1:def 12,FUNCT_1:13;

       (h"(#)(f/*(h+c) - f/*c)).m
        = (h").m * (f*(h+c) - f*c).m by A12,VALUED_1:5
       .= (h").m * ((f*(h+c)).m - (f*c).m) by A14,VALUED_1:13;
       hence |. (h"(#)(f/*(h+c) - f/*c)).m - 0 .| < p by A9,A15,COMPLEX1:44;
      end;
     end;
     hence lim (h"(#)(f/*(h+c) - f/*c)) = 0 by A7,SEQ_2:def 7;
    end;
    hence Rdiff(f,x0) = 0 by A3,FDIFF_3:15;
end;

theorem
for f be PartFunc of REAL,REAL, x0,r be Real st
 f is_left_differentiable_in x0 & rng f = {r} holds Ldiff(f,x0) = 0
proof
    let f be PartFunc of REAL,REAL, x0,r be Real;
    assume that
A1:  f is_left_differentiable_in x0 and
A2:  rng f = {r};

A3: ex e be Real st e>0 & [.x0-e, x0.] c= dom f by A1,FDIFF_3:def 4;
    for h be non-zero 0-convergent Real_Sequence, c be constant Real_Sequence
     st rng c = {x0} & rng(h+c) c= dom f & (for n be Nat holds h.n<0) holds
     h"(#)(f/*(h+c) - f/*c) is convergent &
     lim (h"(#)(f/*(h+c) - f/*c)) = 0
    proof
     let h be non-zero 0-convergent Real_Sequence, c be constant Real_Sequence;
     assume that
A4:   rng c = {x0} and
A5:   rng(h+c) c= dom f and
A6:   for n be Nat holds h.n<0;
     thus
A7:   h"(#)(f/*(h+c) - f/*c) is convergent by A1,A4,A5,A6,FDIFF_3:def 4;

     consider e be Real such that
A8:   e > 0 & [.x0-e,x0.] c= dom f by A1,FDIFF_3:def 4;

     for p be Real st 0<p ex n be Nat st for m be Nat st n <= m holds
      |. (h"(#)(f/*(h+c) - f/*c)).m - 0 .| < p
     proof
      let p be Real;
      assume
A9:    0 < p;
      take n = 0;
      hereby let m be Nat;
       assume n <= m;

       x0-e < x0 by A8,XREAL_1:44; then
A10:    x0 in [.x0-e,x0.] by XXREAL_1:1; then
A11:    rng c c= dom f by A8,A4,ZFMISC_1:31;

A12:   f/*(h+c) = f*(h+c) & f/*c = f*c
         by A5,A10,A8,A4,ZFMISC_1:31,FUNCT_2:def 11;

A13:   dom(h+c) = NAT & dom c = NAT by FUNCT_2:def 1; then
       m in dom(h+c) & m in dom c by ORDINAL1:def 12; then
       m in dom(f*(h+c)) & m in dom(f*c)
         by A5,A10,A8,A4,ZFMISC_1:31,RELAT_1:27; then
       m in dom(f*(h+c)) /\ dom(f*c) by XBOOLE_0:def 4; then
A14:   m in dom( f*(h+c) - f*c ) by VALUED_1:12;

       (h+c).m in rng(h+c) & c.m in rng c
         by A13,ORDINAL1:def 12,FUNCT_1:3; then
       f.((h+c).m) in rng f & f.(c.m) in rng f by A5,A11,FUNCT_1:3; then
       f.((h+c).m) = r & f.(c.m) = r by A2,TARSKI:def 1; then
A15:   (f*(h+c)).m = r & (f*c).m = r by A13,ORDINAL1:def 12,FUNCT_1:13;

       (h"(#)(f/*(h+c) - f/*c)).m
        = (h").m * (f*(h+c) - f*c).m by A12,VALUED_1:5
       .= (h").m * ((f*(h+c)).m - (f*c).m) by A14,VALUED_1:13;
       hence |. (h"(#)(f/*(h+c) - f/*c)).m - 0 .| < p by A9,A15,COMPLEX1:44;
      end;
     end;
     hence lim (h"(#)(f/*(h+c) - f/*c)) = 0 by A7,SEQ_2:def 7;
    end;
    hence Ldiff(f,x0) = 0 by A3,FDIFF_3:9;
end;

theorem Th15:
for f be PartFunc of REAL,REAL, I be non empty Interval st
 I c= dom f & inf I < sup I & (ex r be Real st rng f = {r}) holds
   f is_differentiable_on_interval I &
   for x be Real st x in I holds (f`\I).x = 0
proof
    let f be PartFunc of REAL,REAL, I be non empty Interval;
    assume that
A1:  I c= dom f and
A2:  inf I < sup I and
A3:  ex r be Real st rng f = {r};

    consider r be Real such that
A4:  rng f = {r} by A3;

A5: now assume
A6:  inf I in I; then
A7:  inf I = lower_bound I by Lm5;
     consider e be Real such that
A8:   e > 0 & [.lower_bound I,lower_bound I+e.] c= I by A6,A2,Lm14;
A9:  e > 0 & [.lower_bound I,lower_bound I+e.] c= dom f by A8,A1;

A10:  for h be non-zero 0-convergent Real_Sequence,
      c be constant Real_Sequence st
       rng c = {lower_bound I} & rng(h+c) c= dom f &
       (for n be Nat holds h.n > 0) holds
        h"(#)(f/*(h+c) - f/*c) is convergent
      & lim (h"(#)(f/*(h+c) - f/*c)) = 0
     proof
      let h be non-zero 0-convergent Real_Sequence,
       c be constant Real_Sequence;
      assume that
A11:   rng c = {lower_bound I} and
A12:   rng(h+c) c= dom f and
       for n be Nat holds h.n > 0;

A13:   for p be Real st 0 < p
       ex N be Nat st for k be Nat st N <= k holds
        |. (h"(#)(f/*(h+c) - f/*c)).k - 0 .| < p
      proof
       let p be Real;
       assume
A14:    0 < p;
       take N=0;
       hereby let k be Nat;
        assume N <= k;

A15:    rng c c= I by A6,A7,A11,ZFMISC_1:31;

A16:    f/*c = f*c by A1,A6,A7,A11,ZFMISC_1:31,FUNCT_2:def 11;
A17:    f/*(h+c) = f*(h+c) by A12,FUNCT_2:def 11;

A18:    dom(h+c) = NAT & dom c = NAT by FUNCT_2:def 1; then
        k in dom(h+c) & k in dom c by ORDINAL1:def 12; then
        k in dom(f*(h+c)) & k in dom(f*c)
         by A12,A1,A6,A7,A11,ZFMISC_1:31,RELAT_1:27; then
        k in dom(f*(h+c)) /\ dom(f*c) by XBOOLE_0:def 4; then
A19:    k in dom(f*(h+c) - f*c) by VALUED_1:12;

        (h+c).k in rng(h+c) & c.k in rng c
          by A18,ORDINAL1:def 12,FUNCT_1:3; then
        f.((h+c).k) in rng f & f.(c.k) in rng f by A1,A12,A15,FUNCT_1:3; then
A20:    f.((h+c).k) = r & f.(c.k) = r by A4,TARSKI:def 1;

        (h"(#)(f/*(h+c) - f/*c)).k
         = (h").k * (f*(h+c) - f*c).k by A16,A17,VALUED_1:5
        .= (h").k * ((f*(h+c)).k - (f*c).k) by A19,VALUED_1:13
        .= (h").k * (f.((h+c).k) - (f*c).k) by A18,ORDINAL1:def 12,FUNCT_1:13
        .= (h").k * (f.((h+c).k) - f.(c.k)) by A18,ORDINAL1:def 12,FUNCT_1:13;
        hence |. (h"(#)(f/*(h+c) - f/*c)).k - 0 .| < p
         by A20,A14,COMPLEX1:44;
       end;
      end;
      hence h"(#)(f/*(h+c) - f/*c) is convergent by SEQ_2:def 6;
      hence lim(h"(#)(f/*(h+c) - f/*c)) = 0 by A13,SEQ_2:def 7;
     end; then
     for h be non-zero 0-convergent Real_Sequence,
      c be constant Real_Sequence st
       rng c = {lower_bound I} & rng(h+c) c= dom f &
       (for n be Nat holds h.n > 0) holds
        h"(#)(f/*(h+c) - f/*c) is convergent;
     hence
A21:   f is_right_differentiable_in lower_bound I by A9,FDIFF_3:def 3;

     for h be non-zero 0-convergent Real_Sequence,
      c be constant Real_Sequence st
       rng c = {lower_bound I} & rng(h+c) c= dom f &
       (for n be Nat holds h.n > 0) holds
        lim (h"(#)(f/*(h+c) - f/*c)) = 0 by A10;
     hence Rdiff(f,lower_bound I) = 0 by A21,FDIFF_3:def 6;
    end;

A22: now assume
A23:  sup I in I; then
A24:  sup I = upper_bound I by Lm6;
     consider e be Real such that
A25:   e > 0 & [.upper_bound I-e,upper_bound I.] c= I by A23,A2,Lm15;
A26:  e > 0 & [.upper_bound I-e,upper_bound I.] c= dom f by A25,A1;

A27:  for h be non-zero 0-convergent Real_Sequence,
      c be constant Real_Sequence st
       rng c = {upper_bound I} & rng(h+c) c= dom f &
       (for n be Nat holds h.n < 0) holds
        h"(#)(f/*(h+c) - f/*c) is convergent
      & lim (h"(#)(f/*(h+c) - f/*c)) = 0
     proof
      let h be non-zero 0-convergent Real_Sequence,
       c be constant Real_Sequence;
      assume that
A28:   rng c = {upper_bound I} and
A29:   rng(h+c) c= dom f and
       for n be Nat holds h.n < 0;

A30:   for p be Real st 0 < p
       ex N be Nat st for k be Nat st N <= k holds
        |. (h"(#)(f/*(h+c) - f/*c)).k - 0 .| < p
      proof
       let p be Real;
       assume
A31:    0 < p;
       take N=0;
       hereby let k be Nat;
        assume N <= k;

A32:    rng c c= dom f by A1,A23,A24,A28,ZFMISC_1:31;

A33:    f/*c = f*c by A1,A23,A24,A28,ZFMISC_1:31,FUNCT_2:def 11;
A34:    f/*(h+c) = f*(h+c) by A29,FUNCT_2:def 11;

A35:    dom(h+c) = NAT & dom c = NAT by FUNCT_2:def 1; then
        k in dom(h+c) & k in dom c by ORDINAL1:def 12; then
        k in dom(f*(h+c)) & k in dom(f*c)
         by A29,A1,A23,A24,A28,ZFMISC_1:31,RELAT_1:27; then
        k in dom(f*(h+c)) /\ dom(f*c) by XBOOLE_0:def 4; then
A36:    k in dom(f*(h+c) - f*c) by VALUED_1:12;

        (h+c).k in rng(h+c) & c.k in rng c
          by A35,ORDINAL1:def 12,FUNCT_1:3; then
        f.((h+c).k) in rng f & f.(c.k) in rng f by A29,A32,FUNCT_1:3; then
A37:    f.((h+c).k) = r & f.(c.k) = r by A4,TARSKI:def 1;

        (h"(#)(f/*(h+c) - f/*c)).k
         = (h").k * (f*(h+c) - f*c).k by A33,A34,VALUED_1:5
        .= (h").k * ((f*(h+c)).k - (f*c).k) by A36,VALUED_1:13
        .= (h").k * (f.((h+c).k) - (f*c).k) by A35,ORDINAL1:def 12,FUNCT_1:13
        .= (h").k * (f.((h+c).k) - f.(c.k)) by A35,ORDINAL1:def 12,FUNCT_1:13;
        hence |. (h"(#)(f/*(h+c) - f/*c)).k - 0 .| < p
         by A37,A31,COMPLEX1:44;
       end;
      end;
      hence h"(#)(f/*(h+c) - f/*c) is convergent by SEQ_2:def 6;
      hence lim(h"(#)(f/*(h+c) - f/*c)) = 0 by A30,SEQ_2:def 7;
     end;
     then
     for h be non-zero 0-convergent Real_Sequence,
      c be constant Real_Sequence st
       rng c = {upper_bound I} & rng(h+c) c= dom f &
       (for n be Nat holds h.n < 0) holds
        h"(#)(f/*(h+c) - f/*c) is convergent;

     hence
A38:   f is_left_differentiable_in upper_bound I by A26,FDIFF_3:def 4;

     for h be non-zero 0-convergent Real_Sequence,
      c be constant Real_Sequence st
       rng c = {upper_bound I} & rng(h+c) c= dom f &
       (for n be Nat holds h.n < 0) holds
        lim (h"(#)(f/*(h+c) - f/*c)) = 0 by A27;
     hence Ldiff(f,upper_bound I) = 0 by A38,FDIFF_3:def 5;
    end;

    set J = ].inf I,sup I.[;

A39: J c= I by Lm13; then
A40: J c= dom f by A1; then
A41: dom(f|J) = J by RELAT_1:62;

    for x be Real st x in J holds f|J is_differentiable_in x
    proof
     let x be Real;
     assume
A42:   x in J; then
     inf I < x < sup I by XXREAL_1:4; then
     consider Z be open Subset of REAL such that
A43:   x in Z & Z c= J by Lm9;

     consider N be Neighbourhood of x such that
A44:   N c= Z by A43,RCOMP_1:18;
A45:  N c= dom(f|J) by A41,A43,A44;

     for h be non-zero 0-convergent Real_Sequence,
      c be constant Real_Sequence st
       rng c = {x} & rng(h+c) c= dom(f|J) holds
        h"(#)((f|J)/*(h+c)-(f|J)/*c) is convergent
     proof
      let h be non-zero 0-convergent Real_Sequence,
      c be constant Real_Sequence;
      assume that
A46:    rng c = {x} and
A47:    rng(h+c) c= dom(f|J);

      for p be Real st 0 < p
       ex N be Nat st for k be Nat st N <= k holds
        |. (h"(#)((f|J)/*(h+c) - (f|J)/*c)).k - 0 .| < p
      proof
       let p be Real;
       assume
A48:     0 < p;
       take N = 0;
       thus for k be Nat st N <= k holds
        |. (h"(#)((f|J)/*(h+c) - (f|J)/*c)).k - 0 .| < p
       proof
        let k be Nat;
        assume N <= k;

A49:    rng c c= dom(f|J) by A41,A42,A46,ZFMISC_1:31;

A50:    (f|J)/*(h+c) = (f|J)*(h+c) & (f|J)/*c = (f|J)*c
          by A47,A41,A42,A46,ZFMISC_1:31,FUNCT_2:def 11;

A51:    dom(h+c) = NAT & dom c = NAT by FUNCT_2:def 1; then
        k in dom(h+c) & k in dom c by ORDINAL1:def 12; then
        k in dom((f|J)*(h+c)) & k in dom((f|J)*c)
          by A47,A41,A42,A46,ZFMISC_1:31,RELAT_1:27; then
        k in dom((f|J)*(h+c)) /\ dom((f|J)*c) by XBOOLE_0:def 4; then
A52:    k in dom((f|J)*(h+c) - (f|J)*c) by VALUED_1:12;

A53:    (h+c).k in rng(h+c) & c.k in rng c
          by A51,ORDINAL1:def 12,FUNCT_1:3; then
A54:    (f|J).((h+c).k) = f.((h+c).k) & (f|J).(c.k) = f.(c.k)
          by A49,A47,FUNCT_1:47;

        dom(f|J) c= dom f by RELAT_1:60; then
        f.((h+c).k) in rng f & f.(c.k) in rng f by A53,A49,A47,FUNCT_1:3; then
A55:    f.((h+c).k) = r & f.(c.k) = r by A4,TARSKI:def 1;

        (h"(#)((f|J)/*(h+c) - (f|J)/*c)).k
         = (h").k * ((f|J)*(h+c) - (f|J)*c).k by A50,VALUED_1:5
        .= (h").k * (((f|J)*(h+c)).k - ((f|J)*c).k) by A52,VALUED_1:13
        .= (h").k * ((f|J).((h+c).k) - ((f|J)*c).k)
            by A51,ORDINAL1:def 12,FUNCT_1:13
        .= (h").k * ((f|J).((h+c).k) - (f|J).(c.k))
            by A51,ORDINAL1:def 12,FUNCT_1:13;
        hence |. (h"(#)((f|J)/*(h+c) - (f|J)/*c)).k - 0 .| < p
          by A48,A54,A55,COMPLEX1:44;
       end;
      end;
      hence h"(#)((f|J)/*(h+c)-(f|J)/*c) is convergent by SEQ_2:def 6;
     end;
     hence f|J is_differentiable_in x by A45,FDIFF_2:11;
    end; then
    f is_differentiable_on J by A40;
    hence
A56:  f is_differentiable_on_interval I by A1,A2,A5,A22;

    thus for x be Real st x in I holds (f`\I).x = 0
    proof
     let x be Real;
     assume A57: x in I;
     per cases;
     suppose A58: x = inf I; then
      x = lower_bound I by A57,Lm5;
      hence (f`\I).x = 0 by A56,A5,A57,A58,Def2;
     end;
     suppose A59: x = sup I; then
      x = upper_bound I by A57,Lm6;
      hence (f`\I).x = 0 by A56,A22,A57,A59,Def2;
     end;
     suppose A60: x <> inf I & x <> sup I; then
A61:   (f`\I).x = diff(f,x) by A56,A57,Def2;
      inf I <= x <= sup I by A57,XXREAL_2:61,62; then
      inf I < x < sup I by A60,XXREAL_0:1; then
      consider Z be open Subset of REAL such that
A62:    x in Z & Z c= ].inf I,sup I.[ by Lm9;
A63:   Z c= dom f by A1,A62,A39; then
A64:   f is_differentiable_on Z & for x be Real st x in Z holds (f`|Z).x = 0
        by A3,FDIFF_1:11;
      (f`|Z).x = 0 by A62,A63,A3,FDIFF_1:11;
      hence (f`\I).x = 0 by A61,A62,A64,FDIFF_1:def 7;
     end;
    end;
end;

theorem
for f be PartFunc of REAL,REAL, x0 be Real st
 dom f c= left_open_halfline x0 & f is_Lcontinuous_in x0
  holds f is_continuous_in x0
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume that
A1:  dom f c= left_open_halfline x0 and
A2:  f is_Lcontinuous_in x0;

    for s be Real_Sequence st rng s c= dom f & s is convergent & lim s = x0
     holds f/*s is convergent & f.x0 = lim(f/*s)
    proof
     let s be Real_Sequence;
     assume that
A3:   rng s c= dom f and
A4:   s is convergent and
A5:   lim s = x0;
     rng s c= left_open_halfline x0 by A1,A3; then
     rng s c= left_open_halfline x0 /\ dom f by A3,XBOOLE_1:19;
     hence f/*s is convergent & f.x0 = lim(f/*s) by A4,A5,A2,FDIFF_3:def 1;
    end;
    hence f is_continuous_in x0 by FCONT_1:def 1;
end;

theorem
for f be PartFunc of REAL,REAL, x0 be Real st
 dom f c= right_open_halfline x0 & f is_Rcontinuous_in x0
  holds f is_continuous_in x0
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume that
A1:  dom f c= right_open_halfline x0 and
A2:  f is_Rcontinuous_in x0;

    for s be Real_Sequence st rng s c= dom f & s is convergent & lim s = x0
     holds f/*s is convergent & f.x0 = lim(f/*s)
    proof
     let s be Real_Sequence;
     assume that
A3:   rng s c= dom f and
A4:   s is convergent and
A5:   lim s = x0;
     rng s c= right_open_halfline x0 by A1,A3; then
     rng s c= right_open_halfline x0 /\ dom f by A3,XBOOLE_1:19;
     hence f/*s is convergent & f.x0 = lim(f/*s) by A4,A5,A2,FDIFF_3:def 2;
    end;
    hence f is_continuous_in x0 by FCONT_1:def 1;
end;

begin :: Fundamental Properties

theorem
for f be PartFunc of REAL,REAL, I be non empty Interval st
 I c= dom f & inf I < sup I & f|I = id I holds
  f is_differentiable_on_interval I &
  for x be Real st x in I holds (f`\I).x = 1
proof
    let f be PartFunc of REAL,REAL, I be non empty Interval;
    assume that
A1:  I c= dom f and
A2:  inf I < sup I and
A3:  f|I = id I;

A4: for x be set st x in I holds f.x = x
    proof
     let x be set;
     assume A5: x in I; then
     (f|I).x = f.x by FUNCT_1:49;
     hence f.x = x by A3,A5,FUNCT_1:17;
    end;

A6: now assume
A7:  inf I in I; then
A8:  inf I = lower_bound I by Lm5;
     consider e be Real such that
A9:   e > 0 & [.lower_bound I,lower_bound I+e.] c= I by A7,A2,Lm14;
A10:  e > 0 & [.lower_bound I,lower_bound I+e.] c= dom f by A1,A9;

A11:  for h be non-zero 0-convergent Real_Sequence,
      c be constant Real_Sequence st
       rng c = {lower_bound I} & rng(h+c) c= dom f &
       (for n be Nat holds h.n > 0) holds
        h"(#)(f/*(h+c) - f/*c) is convergent
      & lim (h"(#)(f/*(h+c) - f/*c)) = 1
     proof
      let h be non-zero 0-convergent Real_Sequence,
       c be constant Real_Sequence;
      assume that
A12:   rng c = {lower_bound I} and
A13:   rng(h+c) c= dom f and
A14:    for n be Nat holds h.n > 0;

A15:   for p be Real st 0 < p
       ex N be Nat st for k be Nat st N <= k holds
        |. (h"(#)(f/*(h+c) - f/*c)).k - 1 .| < p
      proof
       let p be Real;
       assume
A16:    0 < p;
       h is convergent & lim h = 0; then
       consider N be Nat such that
A17:     for m be Nat st N <= m holds |. h.m - 0 .| < e by A9,SEQ_2:def 7;

       take N;
       hereby let k be Nat;
        assume A18: N <= k;
        h.k - 0 > 0 by A14; then
        |. h.k - 0 .| = h.k - 0 by COMPLEX1:43; then
A19:     0 < h.k < e by A17,A14,A18;

A20:    rng c c= I by A7,A8,A12,ZFMISC_1:31;

A21:    f/*c = f*c by A1,A7,A8,A12,ZFMISC_1:31,FUNCT_2:def 11;

A22:    f/*(h+c) = f*(h+c) by A13,FUNCT_2:def 11;

A23:     dom(h+c) = NAT & dom c = NAT by FUNCT_2:def 1; then
        k in dom(h+c) & k in dom c by ORDINAL1:def 12; then
        k in dom(f*(h+c)) & k in dom(f*c)
         by A13,A1,A7,A8,A12,ZFMISC_1:31,RELAT_1:27; then
        k in dom(f*(h+c)) /\ dom(f*c) by XBOOLE_0:def 4; then
A24:    k in dom(f*(h+c) - f*c) by VALUED_1:12;

A25:     dom h = NAT by FUNCT_2:def 1; then
A26:     h+c-c = h by A23,Th6;

A27:     h.k in rng h by A25,ORDINAL1:def 12,FUNCT_1:3;

A28:     (h+c).k in rng(h+c) & c.k in rng c by A23,ORDINAL1:def 12,FUNCT_1:3;

A29:     (h+c).k = h.k + c.k by A23,ORDINAL1:def 12,VALUED_1:def 1;
        c.k = lower_bound I by A28,A12,TARSKI:def 1; then
        lower_bound I < (h+c).k < lower_bound I + e by A19,A29
,XREAL_1:8,29; then
        (h+c).k in [.lower_bound I,lower_bound I+e.] by XXREAL_1:1; then
A30:    f.((h+c).k) = (h+c).k & f.(c.k) = c.k by A4,A28,A9,A20;

        (h"(#)(f/*(h+c) - f/*c)).k
         = (h").k * (f*(h+c) - f*c).k by A21,A22,VALUED_1:5
        .= (h").k * ((f*(h+c)).k - (f*c).k) by A24,VALUED_1:13
        .= (h").k * (f.((h+c).k) - (f*c).k) by A23,ORDINAL1:def 12,FUNCT_1:13
        .= (h").k * ((h+c).k - c.k) by A30,A23,ORDINAL1:def 12,FUNCT_1:13
        .= (h").k * (h.k) by A25,A26,ORDINAL1:def 12,VALUED_1:13
        .= (h.k)" * (h.k) by VALUED_1:10
        .= 1 by A27,XCMPLX_0:def 7;
        hence |. (h"(#)(f/*(h+c) - f/*c)).k - 1 .| < p
         by A16,COMPLEX1:44;
       end;
      end;
      hence h"(#)(f/*(h+c) - f/*c) is convergent by SEQ_2:def 6;
      hence lim(h"(#)(f/*(h+c) - f/*c)) = 1 by A15,SEQ_2:def 7;
     end;
     then
     for h be non-zero 0-convergent Real_Sequence,
      c be constant Real_Sequence st
       rng c = {lower_bound I} & rng(h+c) c= dom f &
       (for n be Nat holds h.n > 0) holds
        h"(#)(f/*(h+c) - f/*c) is convergent;
     hence
A31:   f is_right_differentiable_in lower_bound I by A10,FDIFF_3:def 3;

     for h be non-zero 0-convergent Real_Sequence,
      c be constant Real_Sequence st
       rng c = {lower_bound I} & rng(h+c) c= dom f &
       (for n be Nat holds h.n > 0) holds
        lim (h"(#)(f/*(h+c) - f/*c)) = 1 by A11;
     hence Rdiff(f,lower_bound I) = 1 by A31,FDIFF_3:def 6;
    end;

A32: now assume
A33:  sup I in I; then
A34:  sup I = upper_bound I by Lm6;
     consider e be Real such that
A35:   e > 0 & [.upper_bound I-e,upper_bound I.] c= I by A33,A2,Lm15;
A36:  e > 0 & [.upper_bound I-e,upper_bound I.] c= dom f by A1,A35;

A37:  for h be non-zero 0-convergent Real_Sequence,
      c be constant Real_Sequence st
       rng c = {upper_bound I} & rng(h+c) c= dom f &
       (for n be Nat holds h.n < 0) holds
        h"(#)(f/*(h+c) - f/*c) is convergent
      & lim (h"(#)(f/*(h+c) - f/*c)) = 1
     proof
      let h be non-zero 0-convergent Real_Sequence,
       c be constant Real_Sequence;
      assume that
A38:   rng c = {upper_bound I} and
A39:   rng(h+c) c= dom f and
A40:    for n be Nat holds h.n < 0;

A41:   for p be Real st 0 < p
       ex N be Nat st for k be Nat st N <= k holds
        |. (h"(#)(f/*(h+c) - f/*c)).k - 1 .| < p
      proof
       let p be Real;
       assume
A42:    0 < p;
       h is convergent & lim h = 0; then
       consider N be Nat such that
A43:     for m be Nat st N <= m holds |. h.m - 0 .| < e by A35,SEQ_2:def 7;

       take N;
       hereby let k be Nat;
        assume A44: N <= k;
        h.k - 0 < 0 by A40; then
        |. h.k - 0 .| = - (h.k-0) by ABSVALUE:30; then
        - h.k < e by A44,A43; then
A45:     -e < h.k < 0 by A40,XREAL_1:25;

A46:    rng c c= I by A33,A34,A38,ZFMISC_1:31;

A47:    f/*c = f*c by A1,A33,A34,A38,ZFMISC_1:31,FUNCT_2:def 11;
A48:    f/*(h+c) = f*(h+c) by A39,FUNCT_2:def 11;

A49:     dom(h+c) = NAT & dom c = NAT by FUNCT_2:def 1; then
        k in dom(h+c) & k in dom c by ORDINAL1:def 12; then
        k in dom(f*(h+c)) & k in dom(f*c)
         by A39,A1,A33,A34,A38,ZFMISC_1:31,RELAT_1:27; then
        k in dom(f*(h+c)) /\ dom(f*c) by XBOOLE_0:def 4; then
A50:    k in dom(f*(h+c) - f*c) by VALUED_1:12;

A51:     dom h = NAT by FUNCT_2:def 1; then
A52:     h+c-c = h by A49,Th6;

A53:     h.k in rng h by A51,ORDINAL1:def 12,FUNCT_1:3;

A54:     (h+c).k in rng(h+c) & c.k in rng c by A49,ORDINAL1:def 12,FUNCT_1:3;

A55:     (h+c).k = h.k + c.k by A49,ORDINAL1:def 12,VALUED_1:def 1;
        c.k = upper_bound I by A54,A38,TARSKI:def 1; then
        upper_bound I-e < (h+c).k < upper_bound I by A45,A55,XREAL_1:8,30; then
        (h+c).k in [.upper_bound I-e,upper_bound I.] by XXREAL_1:1; then
A56:    f.((h+c).k) = (h+c).k & f.(c.k) = c.k by A4,A54,A35,A46;

        (h"(#)(f/*(h+c) - f/*c)).k
         = (h").k * (f*(h+c) - f*c).k by A47,A48,VALUED_1:5
        .= (h").k * ((f*(h+c)).k - (f*c).k) by A50,VALUED_1:13
        .= (h").k * (f.((h+c).k) - (f*c).k) by A49,ORDINAL1:def 12,FUNCT_1:13
        .= (h").k * ((h+c).k - c.k) by A56,A49,ORDINAL1:def 12,FUNCT_1:13
        .= (h").k * (h.k) by A51,A52,ORDINAL1:def 12,VALUED_1:13
        .= (h.k)" * (h.k) by VALUED_1:10
        .= 1 by A53,XCMPLX_0:def 7;
        hence |. (h"(#)(f/*(h+c) - f/*c)).k - 1 .| < p
         by A42,COMPLEX1:44;
       end;
      end;
      hence h"(#)(f/*(h+c) - f/*c) is convergent by SEQ_2:def 6;
      hence lim(h"(#)(f/*(h+c) - f/*c)) = 1 by A41,SEQ_2:def 7;
     end;
     then
     for h be non-zero 0-convergent Real_Sequence,
      c be constant Real_Sequence st
       rng c = {upper_bound I} & rng(h+c) c= dom f &
       (for n be Nat holds h.n < 0) holds
        h"(#)(f/*(h+c) - f/*c) is convergent;
     hence
A57:   f is_left_differentiable_in upper_bound I by A36,FDIFF_3:def 4;

     for h be non-zero 0-convergent Real_Sequence,
      c be constant Real_Sequence st
       rng c = {upper_bound I} & rng(h+c) c= dom f &
       (for n be Nat holds h.n < 0) holds
        lim (h"(#)(f/*(h+c) - f/*c)) = 1 by A37;
     hence Ldiff(f,upper_bound I) = 1 by A57,FDIFF_3:def 5;
    end;
    set J = ].inf I,sup I.[;

A58: J c= I by Lm13; then
A59: J c= dom f by A1; then
A60: dom(f|J) = J by RELAT_1:62;

A61: for x be set st x in J holds (f|J).x = x
    proof
     let x be set;
     assume A62: x in J;
     (f|J).x = f.x by A62,FUNCT_1:49;
     hence (f|J).x = x by A4,A62,A58;
    end;

    for x be Real st x in J holds f|J is_differentiable_in x
    proof
     let x be Real;
     assume
A63:   x in J; then
     inf I < x < sup I by XXREAL_1:4; then
     consider Z be open Subset of REAL such that
A64:   x in Z & Z c= J by Lm9;
     consider N be Neighbourhood of x such that
A65:   N c= Z by A64,RCOMP_1:18;
A66:  N c= dom(f|J) by A60,A64,A65;

     for h be non-zero 0-convergent Real_Sequence,
      c be constant Real_Sequence st
       rng c = {x} & rng(h+c) c= dom(f|J) holds
        h"(#)((f|J)/*(h+c)-(f|J)/*c) is convergent
     proof
      let h be non-zero 0-convergent Real_Sequence,
      c be constant Real_Sequence;
      assume that
A67:    rng c = {x} and
A68:    rng(h+c) c= dom(f|J);

      for p be Real st 0 < p
       ex N be Nat st for k be Nat st N <= k holds
        |. (h"(#)((f|J)/*(h+c) - (f|J)/*c)).k - 1 .| < p
      proof
       let p be Real;
       assume
A69:     0 < p;
       take N = 0;
       thus for k be Nat st N <= k holds
        |. (h"(#)((f|J)/*(h+c) - (f|J)/*c)).k - 1 .| < p
       proof
        let k be Nat;
        assume N <= k;

A70:    rng c c= dom(f|J) by A60,A63,A67,ZFMISC_1:31;
A71:    (f|J)/*(h+c) = (f|J)*(h+c) & (f|J)/*c = (f|J)*c
          by A68,A60,A63,A67,ZFMISC_1:31,FUNCT_2:def 11;

A72:     dom(h+c) = NAT & dom c = NAT by FUNCT_2:def 1; then
        k in dom(h+c) & k in dom c by ORDINAL1:def 12; then
        k in dom((f|J)*(h+c)) & k in dom((f|J)*c)
          by A68,A60,A63,A67,ZFMISC_1:31,RELAT_1:27; then
        k in dom((f|J)*(h+c)) /\ dom((f|J)*c) by XBOOLE_0:def 4; then
A73:    k in dom((f|J)*(h+c) - (f|J)*c) by VALUED_1:12;

        (h+c).k in rng(h+c) & c.k in rng c
          by A72,ORDINAL1:def 12,FUNCT_1:3; then
A74:    (f|J).((h+c).k) = (h+c).k & (f|J).(c.k) = c.k by A60,A61,A70,A68;

A75:     dom h = NAT by FUNCT_2:def 1; then
A76:     h+c-c = h by A72,Th6;

A77:     h.k in rng h by A75,ORDINAL1:def 12,FUNCT_1:3;

        (h"(#)((f|J)/*(h+c) - (f|J)/*c)).k
         = (h").k * ((f|J)*(h+c) - (f|J)*c).k by A71,VALUED_1:5
        .= (h").k * (((f|J)*(h+c)).k - ((f|J)*c).k) by A73,VALUED_1:13
        .= (h").k * ((f|J).((h+c).k) - ((f|J)*c).k)
            by A72,ORDINAL1:def 12,FUNCT_1:13
        .= (h").k * ((h+c).k - c.k) by A74,A72,ORDINAL1:def 12,FUNCT_1:13
        .= (h").k * (h.k) by A75,A76,ORDINAL1:def 12,VALUED_1:13
        .= (h.k)" * (h.k) by VALUED_1:10
        .= 1 by A77,XCMPLX_0:def 7;
        hence |. (h"(#)((f|J)/*(h+c) - (f|J)/*c)).k - 1 .| < p
          by A69,COMPLEX1:44;
       end;
      end;
      hence h"(#)((f|J)/*(h+c)-(f|J)/*c) is convergent by SEQ_2:def 6;
     end;
     hence f|J is_differentiable_in x by A66,FDIFF_2:11;
    end; then
    f is_differentiable_on J by A59;
    hence
A78:  f is_differentiable_on_interval I by A1,A2,A6,A32;

    thus for x be Real st x in I holds (f`\I).x = 1
    proof
     let x be Real;
     assume A79: x in I;
     per cases;
     suppose A80: x = inf I; then
      x = lower_bound I by A79,Lm5;
      hence (f`\I).x = 1 by A6,A78,A79,A80,Def2;
     end;
     suppose A81: x = sup I; then
      x = upper_bound I by A79,Lm6;
      hence (f`\I).x = 1 by A78,A79,A81,A32,Def2;
     end;
     suppose A82: x <> inf I & x <> sup I; then
A83:   (f`\I).x = diff(f,x) by A78,A79,Def2;
      inf I <= x <= sup I by A79,XXREAL_2:61,62; then
      inf I < x < sup I by A82,XXREAL_0:1; then
      consider Z be open Subset of REAL such that
A84:    x in Z & Z c= ].inf I,sup I.[ by Lm9;
A85:   Z c= dom f by A1,A58,A84; then
A86:  dom(f|Z) = dom (id Z) by RELAT_1:62;
      for p be Element of REAL st p in dom(f|Z) holds (f|Z).p = (id Z).p
      proof
       let p be Element of REAL;
       assume
A87:     p in dom(f|Z); then
A88:    p in dom f & p in Z by RELAT_1:57;

       Z c= I by A84,A58; then
       (f|I)|Z = f|Z by RELAT_1:74; then
       (f|Z).p = (f|I).p by A87,FUNCT_1:49
         .= p by A3,A88,A84,A58,FUNCT_1:18;
       hence thesis by A87,FUNCT_1:18;
      end; then
A89:   f|Z = id Z by A86,PARTFUN1:5; then
A90:   f is_differentiable_on Z & for x be Real st x in Z holds (f`|Z).x = 1
        by A85,FDIFF_1:17;
      (f`|Z).x = 1 by A84,A89,A85,FDIFF_1:17;
      hence (f`\I).x = 1 by A83,A84,A90,FDIFF_1:def 7;
     end;
    end;
end;

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

    set J = ].inf I,sup I.[;

    J c= I by Lm13; then
A4: J c= dom (f1+f2) by A1;

A5: for x be Real st x in J holds (f1+f2)|J is_differentiable_in x
    proof
     let x be Real;
     assume x in J; then
     f1|J is_differentiable_in x & f2|J is_differentiable_in x
       by A2,A3,FDIFF_1:def 6; then
     f1|J + f2|J is_differentiable_in x by FDIFF_1:13;
     hence (f1+f2)|J is_differentiable_in x by RFUNCT_1:44;
    end;
    hence
A6:  f1+f2 is_differentiable_on_interval I
       by A1,A2,A3,A4,FDIFF_1:def 6,FDIFF_3:10,16; then

A7: dom((f1+f2)`\I) = I by Def2;
    dom(f1`\I) = I & dom(f2`\I) = I by A2,A3,Def2; then
A8: dom(f1`\I+f2`\I) = I /\ I by VALUED_1:def 1;

A9: for x be Element of REAL st x in dom((f1+f2)`\I) holds
      ((f1+f2)`\I).x = (f1`\I + f2`\I).x
    proof
     let x be Element of REAL;
     assume A10: x in dom((f1+f2)`\I); then
A11:  x in I by A6,Def2;
     per cases;
     suppose
A12:   x = inf I; then
A13:   inf I = lower_bound I by A11,Lm5;
      (f1`\I).x = Rdiff(f1,x) & (f2`\I).x = Rdiff(f2,x) &
      ((f1+f2)`\I).x = Rdiff(f1+f2,x) by A2,A3,A6,A11,A12,Def2; then
      ((f1+f2)`\I).x = (f1`\I).x + (f2`\I).x
        by A10,A6,Def2,A12,A13,A2,A3,FDIFF_3:16;
      hence ((f1+f2)`\I).x = (f1`\I + f2`\I).x by A7,A8,A10,VALUED_1:def 1;
     end;
     suppose
A14:   x = sup I; then
A15:   sup I = upper_bound I by A11,Lm6;
      (f1`\I).x = Ldiff(f1,x) & (f2`\I).x = Ldiff(f2,x) &
      ((f1+f2)`\I).x = Ldiff(f1+f2,x) by A2,A3,A6,A11,A14,Def2; then
      ((f1+f2)`\I).x = (f1`\I).x + (f2`\I).x
        by A10,A6,Def2,A14,A15,A2,A3,FDIFF_3:10;
      hence ((f1+f2)`\I).x = (f1`\I + f2`\I).x by A7,A8,A10,VALUED_1:def 1;
     end;
     suppose
A16:   x <> inf I & x <> sup I;
A17:   (f1`\I).x = diff(f1,x) & (f2`\I).x = diff(f2,x) &
      ((f1+f2)`\I).x = diff(f1+f2,x) by A16,A11,A2,A3,A6,Def2;

      inf I <= x <= sup I by A11,XXREAL_2:61,62; then
A18:   inf I < x < sup I by A16,XXREAL_0:1;
      consider Z be open Subset of REAL such that
A19:    x in Z & Z c= ].inf I,sup I.[ by A18,Lm9;

A20:   f1 is_differentiable_on Z & f2 is_differentiable_on Z &
      f1+f2 is_differentiable_on Z by A2,A3,A5,A19,A4,FDIFF_1:def 6,26; then
      ((f1+f2)`|Z).x = diff(f1,x) + diff(f2,x) by A19,FDIFF_1:18; then
      ((f1+f2)`\I).x = (f1`\I).x + (f2`\I).x by A17,A19,A20,FDIFF_1:def 7;
      hence ((f1+f2)`\I).x = (f1`\I + f2`\I).x by A7,A8,A10,VALUED_1:def 1;
     end;
    end;
    hence (f1+f2)`\I = f1`\I + f2`\I by A7,A8,PARTFUN1:5;
    hereby let x be Real;
     assume
A21:   x in I; then
     ((f1+f2)`\I).x = (f1`\I + f2`\I).x by A7,A9;
     hence ((f1+f2)`\I).x = (f1`\I).x + (f2`\I).x by A21,A8,VALUED_1:def 1;
    end;
end;

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

    reconsider J = ].inf I,sup I.[ as open Subset of REAL by Th2;

    J c= I by Th2; then
A4: J c= dom (f1-f2) by A1;

A5: for x be Real st x in J holds (f1-f2)|J is_differentiable_in x
    proof
     let x be Real;
     assume x in J; then
     f1|J is_differentiable_in x & f2|J is_differentiable_in x
       by A2,A3,FDIFF_1:def 6; then
     f1|J - f2|J is_differentiable_in x by FDIFF_1:14;
     hence (f1-f2)|J is_differentiable_in x by RFUNCT_1:47;
    end;
    hence
A6:  f1-f2 is_differentiable_on_interval I
       by A1,A4,A2,A3,FDIFF_3:11,17,FDIFF_1:def 6; then

A7: dom((f1-f2)`\I) = I by Def2;
    dom(f1`\I) = I & dom(f2`\I) = I by A2,A3,Def2; then
A8: dom(f1`\I-f2`\I) = I /\ I by VALUED_1:12;

A9: for x be Element of REAL st x in dom((f1-f2)`\I) holds
     ((f1-f2)`\I).x = (f1`\I - f2`\I).x
    proof
     let x be Element of REAL;
     assume A10: x in dom((f1-f2)`\I); then
A11:  x in I by A6,Def2;
     per cases;
     suppose
A12:   x = inf I; then
A13:   inf I = lower_bound I by A11,Lm5;
      (f1`\I).x = Rdiff(f1,x) & (f2`\I).x = Rdiff(f2,x) &
      ((f1-f2)`\I).x = Rdiff(f1-f2,x) by A2,A3,A6,A11,A12,Def2; then
      ((f1-f2)`\I).x = (f1`\I).x - (f2`\I).x
        by A10,A6,Def2,A12,A13,A2,A3,FDIFF_3:17;
      hence ((f1-f2)`\I).x = (f1`\I - f2`\I).x by A7,A8,A10,VALUED_1:13;
     end;
     suppose
A14:   x = sup I; then
A15:   sup I = upper_bound I by A11,Lm6;
      (f1`\I).x = Ldiff(f1,x) & (f2`\I).x = Ldiff(f2,x) &
      ((f1-f2)`\I).x = Ldiff(f1-f2,x) by A2,A3,A6,A11,A14,Def2; then
      ((f1-f2)`\I).x = (f1`\I).x - (f2`\I).x
        by A10,A6,Def2,A14,A15,A2,A3,FDIFF_3:11;
      hence ((f1-f2)`\I).x = (f1`\I - f2`\I).x by A7,A8,A10,VALUED_1:13;
     end;
     suppose
A16:   x <> inf I & x <> sup I;
A17:   (f1`\I).x = diff(f1,x) & (f2`\I).x = diff(f2,x) &
      ((f1-f2)`\I).x = diff(f1-f2,x) by A16,A11,A2,A3,A6,Def2;

      inf I <= x <= sup I by A11,XXREAL_2:61,62; then
A18:   inf I < x < sup I by A16,XXREAL_0:1; then
A19:   x in J by XXREAL_1:4;
A20:  ((f1-f2)`|J).x = diff(f1,x) - diff(f2,x)
        by A2,A3,A4,A18,FDIFF_1:19,XXREAL_1:4;
      f1 is_differentiable_on J & f2 is_differentiable_on J &
      f1-f2 is_differentiable_on J by A2,A3,A5,A4; then
      ((f1-f2)`\I).x = (f1`\I).x - (f2`\I).x by A17,A19,A20,FDIFF_1:def 7;
      hence ((f1-f2)`\I).x = (f1`\I - f2`\I).x by A7,A8,A10,VALUED_1:13;
     end;
    end;
    hence (f1-f2)`\I = f1`\I - f2`\I by A7,A8,PARTFUN1:5;
    hereby let x be Real;
     assume
A21:   x in I; then
     ((f1-f2)`\I).x = (f1`\I - f2`\I).x by A7,A9;
     hence ((f1-f2)`\I).x = (f1`\I).x - (f2`\I).x by A21,A8,VALUED_1:13;
    end;
end;

Lm16:
for f be PartFunc of REAL,REAL, x0 be Real st
 f is_right_differentiable_in x0 holds
  0(#)f is_right_differentiable_in x0 & Rdiff(0(#)f,x0) = 0
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume f is_right_differentiable_in x0; then
    consider e be Real such that
A1:  e > 0 & [.x0,x0+e.] c= dom f by FDIFF_3:def 3;
A2: x0 < x0+e by A1,XREAL_1:29; then
A3: x0 in [.x0,x0+e.] by XXREAL_1:1;
    reconsider I = [.x0,x0+e.] as non empty closed_interval Subset of REAL
     by A2,XXREAL_1:1,MEASURE5:def 3;
A4: inf I = x0 & sup I = x0+e by A2,XXREAL_2:25,29;
    now let r be Real;
     assume r in rng(0(#)f); then
     consider x be Element of REAL such that
A5:   x in dom(0(#)f) & r = (0(#)f).x by PARTFUN1:3;
     (0(#)f).x = 0 * f.x by A5,VALUED_1:def 5;
     hence r in {0} by A5,TARSKI:def 1;
    end; then
A6: rng(0(#)f) c= {0};
A7: I c= dom(0(#)f) by A1,VALUED_1:def 5; then
    dom(0(#)f) <> {}; then
A8: rng(0(#)f) = {0} by A6,RELAT_1:42,ZFMISC_1:33; then
A9: 0(#)f is_differentiable_on_interval I by A7,A2,A4,Th15;
    hence 0(#)f is_right_differentiable_in x0 by A4,XXREAL_1:1,Lm5;

A10: for x be Real st x in I holds ((0(#)f)`\I).x = 0 by A2,A4,A8,A7,Th15;
    ((0(#)f)`\I).x0 = Rdiff(0(#)f,x0) by A3,A4,A9,Def2;
    hence Rdiff(0(#)f,x0) = 0 by A10,A2,XXREAL_1:1;
end;

Lm17:
for f be PartFunc of REAL,REAL, x0 be Real st
 f is_left_differentiable_in x0 holds
  0(#)f is_left_differentiable_in x0 & Ldiff(0(#)f,x0) = 0
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume f is_left_differentiable_in x0; then
    consider e be Real such that
A1:  e > 0 & [.x0-e,x0.] c= dom f by FDIFF_3:def 4;
A2: x0-e < x0 by A1,XREAL_1:44; then
A3: x0 in [.x0-e,x0.] by XXREAL_1:1;
    reconsider I = [.x0-e,x0.] as non empty closed_interval Subset of REAL
     by A2,XXREAL_1:1,MEASURE5:def 3;
A4: inf I = x0-e & sup I = x0 by A2,XXREAL_2:25,29;
    now let r be Real;
     assume r in rng(0(#)f); then
     consider x be Element of REAL such that
A5:   x in dom(0(#)f) & r = (0(#)f).x by PARTFUN1:3;
     (0(#)f).x = 0 * f.x by A5,VALUED_1:def 5;
     hence r in {0} by A5,TARSKI:def 1;
    end; then
A6: rng(0(#)f) c= {0};
A7: I c= dom(0(#)f) by A1,VALUED_1:def 5; then
    dom(0(#)f) <> {}; then
A8: rng(0(#)f) = {0} by A6,ZFMISC_1:33,RELAT_1:42; then
A9: 0(#)f is_differentiable_on_interval I by A7,A2,A4,Th15;
    hence 0(#)f is_left_differentiable_in x0 by A4,XXREAL_1:1,Lm6;

A10: for x be Real st x in I holds ((0(#)f)`\I).x = 0 by A2,A4,A8,A7,Th15;
    ((0(#)f)`\I).x0 = Ldiff(0(#)f,x0) by A3,A4,A9,Def2;
    hence Ldiff(0(#)f,x0) = 0 by A10,A2,XXREAL_1:1;
end;

Lm18:
for f be PartFunc of REAL,REAL, x0,r be Real st
 r <> 0 & f is_right_differentiable_in x0 holds
  r(#)f is_right_differentiable_in x0 & Rdiff(r(#)f,x0) = r * Rdiff(f,x0)
proof
    let f be PartFunc of REAL,REAL, x0,r be Real;
    assume that
A1:  r <> 0 and
A2:  f is_right_differentiable_in x0;

    set v = |.r.|;
A3: v > 0 by A1,COMPLEX1:47;

A4: dom f = dom(r(#)f) by VALUED_1:def 5; then
A5: ex e be Real st e > 0 & [.x0,x0+e.] c= dom(r(#)f) by A2,FDIFF_3:def 3;
    consider e be Real such that
A6:  e > 0 & [.x0,x0+e.] c= dom f by A2,FDIFF_3:def 3;

A7: for h be non-zero 0-convergent Real_Sequence,
    c be constant Real_Sequence st
     rng c = {x0} & rng(h+c) c= dom(r(#)f) &
     (for n be Nat holds h.n > 0) holds
      h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c) is convergent
    & lim(h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c)) = r*Rdiff(f,x0)
    proof
     let h be non-zero 0-convergent Real_Sequence,
     c be constant Real_Sequence;
     assume that
A8:   rng c = {x0} and
A9:   rng(h+c) c= dom(r(#)f) and
A10:   for n be Nat holds h.n > 0;

A11:   h"(#)(f/*(h+c) - f/*c) is convergent by A2,A4,A8,A9,A10,FDIFF_3:def 3;
A12:   lim (h"(#)(f/*(h+c) - f/*c)) = Rdiff(f,x0)
        by A2,A4,A8,A9,A10,FDIFF_3:15;

A13:   for p be Real st 0 < p ex n be Nat st for m be Nat st n <= m holds
       |.(h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c)).m - r*Rdiff(f,x0).| < p
      proof
       let p be Real;
       assume 0 < p; then
       p/v > 0 by A3,XREAL_1:139; then

       consider n be Nat such that
A14:    for m be Nat st n <= m holds
         |.(h"(#)(f/*(h+c) - f/*c)).m - Rdiff(f,x0).| < p/v
           by A11,A12,SEQ_2:def 7;
       take n;
       thus for m be Nat st n <= m holds
        |.(h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c)).m - r*Rdiff(f,x0).| < p
       proof
        let m be Nat;
        assume n <= m; then
        |.(h"(#)(f/*(h+c) - f/*c)).m - Rdiff(f,x0).| < p/v by A14; then
A15:    v * |.(h"(#)(f/*(h+c)-f/*c)).m - Rdiff(f,x0).| < p
          by A1,COMPLEX1:47,XREAL_1:79;

A16:    v * |.(h"(#)(f/*(h+c)-f/*c)).m - Rdiff(f,x0).|
         = |. r*((h"(#)(f/*(h+c)-f/*c)).m - Rdiff(f,x0)) .| by COMPLEX1:65
        .= |. r*(h"(#)(f/*(h+c)-f/*c)).m - r*Rdiff(f,x0) .|;

A17:     dom(r(#)(h"(#)(f/*(h+c)-f/*c))) = NAT by FUNCT_2:def 1;

        x0 < x0+e by A6,XREAL_1:29; then
        x0 in [.x0,x0+e.] by XXREAL_1:1; then
        rng(h+c) c= dom f & rng c c= dom f
          by A8,A9,A6,VALUED_1:def 5,ZFMISC_1:31; then
A18:     r(#)(f/*(h+c)) = (r(#)f)/*(h+c) & r(#)(f/*c) = (r(#)f)/*c
          by RFUNCT_2:9;

        r(#)(h"(#)(f/*(h+c)-f/*c))
         = h"(#)(r(#)(f/*(h+c)-f/*c)) by RFUNCT_1:13
        .= h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c) by A18,RFUNCT_1:18;
        hence thesis by A15,A16,A17,ORDINAL1:def 12,VALUED_1:def 5;
       end;
      end;
      hence h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c) is convergent by SEQ_2:def 6;
      hence lim (h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c)) = r*Rdiff(f,x0)
        by A13,SEQ_2:def 7;
    end; then
    for h be non-zero 0-convergent Real_Sequence,
    c be constant Real_Sequence st
     rng c = {x0} & rng(h+c) c= dom(r(#)f) &
     (for n be Nat holds h.n > 0) holds
      h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c) is convergent;
    hence
A19:  r(#)f is_right_differentiable_in x0 by A5,FDIFF_3:def 3;

    for h be non-zero 0-convergent Real_Sequence,
    c be constant Real_Sequence st
     rng c = {x0} & rng(h+c) c= dom(r(#)f) &
     (for n be Nat holds h.n > 0) holds
      lim(h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c)) = r*Rdiff(f,x0) by A7;
    hence Rdiff(r(#)f,x0) = r * Rdiff(f,x0) by A19,FDIFF_3:def 6;
end;

Lm19:
for f be PartFunc of REAL,REAL, x0,r be Real st
 r <> 0 & f is_left_differentiable_in x0 holds
  r(#)f is_left_differentiable_in x0 & Ldiff(r(#)f,x0) = r * Ldiff(f,x0)
proof
    let f be PartFunc of REAL,REAL, x0,r be Real;
    assume that
A1:  r <> 0 and
A2:  f is_left_differentiable_in x0;

    set v = |.r.|;
A3: v > 0 by A1,COMPLEX1:47;

A4: dom f = dom(r(#)f) by VALUED_1:def 5; then
A5: ex e be Real st e > 0 & [.x0-e,x0.] c= dom(r(#)f) by A2,FDIFF_3:def 4;
    consider e be Real such that
A6:  e > 0 & [.x0-e,x0.] c= dom f by A2,FDIFF_3:def 4;

A7: for h be non-zero 0-convergent Real_Sequence,
    c be constant Real_Sequence st
     rng c = {x0} & rng(h+c) c= dom(r(#)f) &
     (for n be Nat holds h.n < 0) holds
      h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c) is convergent
    & lim(h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c)) = r*Ldiff(f,x0)
    proof
     let h be non-zero 0-convergent Real_Sequence,
     c be constant Real_Sequence;
     assume that
A8:   rng c = {x0} and
A9:   rng(h+c) c= dom(r(#)f) and
A10:   for n be Nat holds h.n < 0;

A11:   h"(#)(f/*(h+c) - f/*c) is convergent by A2,A4,A8,A9,A10,FDIFF_3:def 4;
A12:   lim (h"(#)(f/*(h+c) - f/*c)) = Ldiff(f,x0)
        by A2,A4,A8,A9,A10,FDIFF_3:9;

A13:   for p be Real st 0 < p ex n be Nat st for m be Nat st n <= m holds
       |.(h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c)).m - r*Ldiff(f,x0).| < p
      proof
       let p be Real;
       assume 0 < p; then
       p/v > 0 by A3,XREAL_1:139; then

       consider n be Nat such that
A14:    for m be Nat st n <= m holds
         |.(h"(#)(f/*(h+c) - f/*c)).m - Ldiff(f,x0).| < p/v
           by A11,A12,SEQ_2:def 7;
       take n;
       thus for m be Nat st n <= m holds
        |.(h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c)).m - r*Ldiff(f,x0).| < p
       proof
        let m be Nat;
        assume n <= m; then
        |.(h"(#)(f/*(h+c) - f/*c)).m - Ldiff(f,x0).| < p/v by A14; then
A15:    v * |.(h"(#)(f/*(h+c)-f/*c)).m - Ldiff(f,x0).| < p
          by A1,COMPLEX1:47,XREAL_1:79;

A16:    v * |.(h"(#)(f/*(h+c)-f/*c)).m - Ldiff(f,x0).|
         = |. r*((h"(#)(f/*(h+c)-f/*c)).m - Ldiff(f,x0)) .| by COMPLEX1:65
        .= |. r*(h"(#)(f/*(h+c)-f/*c)).m - r*Ldiff(f,x0) .|;

A17:     dom(r(#)(h"(#)(f/*(h+c)-f/*c))) = NAT by FUNCT_2:def 1;

        x0-e < x0 by A6,XREAL_1:44; then
        x0 in [.x0-e,x0.] by XXREAL_1:1; then
        rng(h+c) c= dom f & rng c c= dom f
          by A8,A9,A6,VALUED_1:def 5,ZFMISC_1:31; then
A18:     r(#)(f/*(h+c)) = (r(#)f)/*(h+c) & r(#)(f/*c) = (r(#)f)/*c
          by RFUNCT_2:9;
        r(#)(h"(#)(f/*(h+c)-f/*c))
         = h"(#)(r(#)(f/*(h+c)-f/*c)) by RFUNCT_1:13
        .= h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c) by A18,RFUNCT_1:18;
        hence thesis by A15,A16,A17,ORDINAL1:def 12,VALUED_1:def 5;
       end;
      end;
      hence h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c) is convergent by SEQ_2:def 6;
      hence lim (h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c)) = r*Ldiff(f,x0)
        by A13,SEQ_2:def 7;
    end; then
    for h be non-zero 0-convergent Real_Sequence,
    c be constant Real_Sequence st
     rng c = {x0} & rng(h+c) c= dom(r(#)f) &
     (for n be Nat holds h.n < 0) holds
      h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c) is convergent;
    hence
A19:  r(#)f is_left_differentiable_in x0 by A5,FDIFF_3:def 4;

    for h be non-zero 0-convergent Real_Sequence,
    c be constant Real_Sequence st
     rng c = {x0} & rng(h+c) c= dom(r(#)f) &
     (for n be Nat holds h.n < 0) holds
      lim(h"(#)((r(#)f)/*(h+c) - (r(#)f)/*c)) = r*Ldiff(f,x0) by A7;
    hence Ldiff(r(#)f,x0) = r * Ldiff(f,x0) by A19,FDIFF_3:def 5;
end;

theorem Th21:
for f be PartFunc of REAL,REAL, x0, r be Real st
 f is_right_differentiable_in x0 holds
  r(#)f is_right_differentiable_in x0 & Rdiff(r(#)f,x0) = r*Rdiff(f,x0)
proof
    let f be PartFunc of REAL,REAL, x0, r be Real;
    assume A1: f is_right_differentiable_in x0; then
    r = 0 implies
     r(#)f is_right_differentiable_in x0 &
      Rdiff(r(#)f,x0) = r*Rdiff(f,x0) by Lm16;
    hence thesis by A1,Lm18;
end;

theorem Th22:
for f be PartFunc of REAL,REAL, x0, r be Real st
 f is_left_differentiable_in x0 holds
  r(#)f is_left_differentiable_in x0 & Ldiff(r(#)f,x0) = r*Ldiff(f,x0)
proof
    let f be PartFunc of REAL,REAL, x0, r be Real;
    assume A1: f is_left_differentiable_in x0; then
    r = 0 implies
     r(#)f is_left_differentiable_in x0 &
      Ldiff(r(#)f,x0) = r*Ldiff(f,x0) by Lm17;
    hence thesis by A1,Lm19;
end;

theorem
for f be PartFunc of REAL,REAL, I be non empty Interval, r be Real st
 f is_differentiable_on_interval I holds
  r(#)f is_differentiable_on_interval I &
  (r(#)f)`\I = r(#)(f`\I) &
  for x be Real st x in I holds ((r(#)f)`\I).x = r*(f`\I).x
proof
    let f be PartFunc of REAL,REAL, I be non empty Interval, r be Real;
    assume
A1:  f is_differentiable_on_interval I; then
A2: I c= dom(r(#)f) by VALUED_1:def 5;
A3: f is_differentiable_on ].inf I,sup I.[ by A1;

    for x be Real st x in ].inf I,sup I.[ holds
     (r(#)f)|(].inf I,sup I.[) is_differentiable_in x
    proof
     let x be Real;
     assume x in ].inf I,sup I.[; then
     f|(].inf I,sup I.[) is_differentiable_in x by A3; then
     r(#)(f|(].inf I,sup I.[)) is_differentiable_in x by FDIFF_1:15;
     hence (r(#)f)|(].inf I,sup I.[) is_differentiable_in x by RFUNCT_1:49;
    end; then
    r(#)f is_differentiable_on ].inf I,sup I.[ by A3,VALUED_1:def 5;
    hence
A4:r(#)f is_differentiable_on_interval I
      by A1,Th21,Th22,VALUED_1:def 5; then
A5: dom((r(#)f)`\I) = I by Def2;
    dom(f`\I) = I by A1,Def2; then
A6: dom(r(#)(f`\I)) = I by VALUED_1:def 5;

A7: for x be Element of REAL st x in dom((r(#)f)`\I) holds
      ((r(#)f)`\I).x = (r(#)(f`\I)).x
    proof
     let x be Element of REAL;
     assume A8: x in dom((r(#)f)`\I); then
A9:  x in I by A4,Def2;
     per cases;
     suppose
A10:  x = inf I; then
A11:  inf I = lower_bound I by A9,Lm5;
A12:  (f`\I).x = Rdiff(f,x) by A1,A9,A10,Def2;

      ((r(#)f)`\I).x = Rdiff(r(#)f,x) by A4,A9,A10,Def2; then
      ((r(#)f)`\I).x = r*(f`\I).x by A1,A8,A4,Def2,A10,A11,A12,Th21;
      hence ((r(#)f)`\I).x = (r(#)(f`\I)).x by A5,A6,A8,VALUED_1:def 5;
     end;
     suppose
A13:  x = sup I; then
A14:  sup I = upper_bound I by A9,Lm6;
A15:  (f`\I).x = Ldiff(f,x) by A1,A9,A13,Def2;

      ((r(#)f)`\I).x = Ldiff(r(#)f,x) by A4,A9,A13,Def2; then
      ((r(#)f)`\I).x = r*(f`\I).x by A1,A8,A4,Def2,A13,A14,A15,Th22;
      hence ((r(#)f)`\I).x = (r(#)(f`\I)).x by A5,A6,A8,VALUED_1:def 5;
     end;

     suppose
A16:  x <> inf I & x <> sup I; then
A17:   (f`\I).x = diff(f,x) & ((r(#)f)`\I).x = diff(r(#)f,x)
        by A1,A4,A9,Def2;
      reconsider J = ].inf I,sup I.[ as open Subset of REAL by Th2;
      J c= I by Th2; then
A18:  J c= dom(r(#)f) by A2; then
A19:  r(#)f is_differentiable_on J by A1,FDIFF_1:20;

      inf I <= x <= sup I by A9,XXREAL_2:61,62; then
A20:   inf I < x < sup I by A16,XXREAL_0:1; then
      x in J by XXREAL_1:4; then
      (r(#)f`|J).x = diff(r(#)f,x) & (f`|J).x = diff(f,x)
        by A1,A19,FDIFF_1:def 7; then
      ((r(#)f)`\I).x = r*(f`\I).x by A17,A20,A18,A1,FDIFF_1:20,XXREAL_1:4;
      hence ((r(#)f)`\I).x = (r(#)(f`\I)).x by A5,A6,A8,VALUED_1:def 5;
     end;
    end;
    hence (r(#)f)`\I = r(#)(f`\I) by A5,A6,PARTFUN1:5;
    hereby let x be Real;
     assume
A21:   x in I; then
     ((r(#)f)`\I).x = (r(#)(f`\I)).x by A5,A7;
     hence ((r(#)f)`\I).x = r*(f`\I).x by A21,A6,VALUED_1:def 5;
    end;
end;

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

    reconsider J = ].inf I,sup I.[ as open Subset of REAL by Th2;
A3: J c= I by Th2;

A4: I c= dom f1 /\ dom f2 by A1,A2,XBOOLE_1:19; then
    I c= dom(f1(#)f2) by VALUED_1:def 4; then
    J c= dom(f1(#)f2) by A3;
    hence
A5:  f1(#)f2 is_differentiable_on_interval I
       by A4,A1,A2,FDIFF_1:21,FDIFF_3:18,12,VALUED_1:def 4; then
A6: dom((f1(#)f2)`\I) = I by Def2;
A7: dom(f1`\I) = I & dom(f2`\I) = I by A1,A2,Def2;
    dom f1 /\ dom(f2`\I) = I & dom f2 /\ dom(f1`\I) = I
      by A1,A2,A7,XBOOLE_1:28; then
A8: dom(f1(#)(f2`\I)) = I & dom(f2(#)(f1`\I)) = I by VALUED_1:def 4; then
A9: dom(f2(#)(f1`\I)+f1(#)(f2`\I)) = I /\ I by VALUED_1:def 1;

A10: for x be Element of REAL st x in dom((f1(#)f2)`\I) holds
     ((f1(#)f2)`\I).x = (f2(#)(f1`\I) + f1(#)(f2`\I)).x
    proof
     let x be Element of REAL;
     assume x in dom((f1(#)f2)`\I); then
A11:   x in I by A5,Def2;
     per cases;
     suppose
A12:  x = inf I; then
A13:  ((f1(#)f2)`\I).x = Rdiff(f1(#)f2,x) & (f1`\I).x = Rdiff(f1,x) &
      (f2`\I).x = Rdiff(f2,x) by A1,A2,A5,A11,Def2;

      f1 is_right_differentiable_in x &
      f2 is_right_differentiable_in x by A1,A2,A11,A12,Lm5; then
      ((f1(#)f2)`\I).x = (f2.x)*(f1`\I).x + (f1.x)*(f2`\I).x
        by A13,FDIFF_3:18; then
      ((f1(#)f2)`\I).x = (f2(#)(f1`\I)).x + (f1.x)*(f2`\I).x
        by A11,A8,VALUED_1:def 4; then
      ((f1(#)f2)`\I).x = (f2(#)(f1`\I)).x + (f1(#)(f2`\I)).x
        by A11,A8,VALUED_1:def 4;
      hence ((f1(#)f2)`\I).x = (f2(#)(f1`\I) + f1(#)(f2`\I)).x
        by A11,A9,VALUED_1:def 1;
     end;
     suppose
A14:  x = sup I; then
A15:  ((f1(#)f2)`\I).x = Ldiff(f1(#)f2,x) & (f1`\I).x = Ldiff(f1,x) &
      (f2`\I).x = Ldiff(f2,x) by A1,A2,A5,A11,Def2;

      f1 is_left_differentiable_in x &
      f2 is_left_differentiable_in x by A1,A2,A11,A14,Lm6; then
      ((f1(#)f2)`\I).x = (f2.x)*(f1`\I).x + (f1.x)*(f2`\I).x
        by A15,FDIFF_3:12; then
      ((f1(#)f2)`\I).x = (f2(#)(f1`\I)).x + (f1.x)*(f2`\I).x
        by A11,A8,VALUED_1:def 4; then
      ((f1(#)f2)`\I).x = (f2(#)(f1`\I)).x + (f1(#)(f2`\I)).x
        by A11,A8,VALUED_1:def 4;
      hence ((f1(#)f2)`\I).x = (f2(#)(f1`\I) + f1(#)(f2`\I)).x
        by A11,A9,VALUED_1:def 1;
     end;
     suppose A16: x <> inf I & x <> sup I; then
      x in J by A11,Th3; then
A17:  f1 is_differentiable_in x & f2 is_differentiable_in x
      by A1,A2,FDIFF_1:9;

      (f1`\I).x = diff(f1,x) & (f2`\I).x = diff(f2,x) &
      ((f1(#)f2)`\I).x = diff(f1(#)f2,x) by A1,A2,A5,A11,A16,Def2; then
      ((f1(#)f2)`\I).x = (f2.x)*(f1`\I).x + (f1.x)*(f2`\I).x
        by A17,FDIFF_1:16; then
      ((f1(#)f2)`\I).x = (f2(#)(f1`\I)).x + (f1.x)*(f2`\I).x
        by A11,A8,VALUED_1:def 4; then
      ((f1(#)f2)`\I).x = (f2(#)(f1`\I)).x + (f1(#)(f2`\I)).x
        by A11,A8,VALUED_1:def 4;
      hence ((f1(#)f2)`\I).x = (f2(#)(f1`\I) + f1(#)(f2`\I)).x
        by A11,A9,VALUED_1:def 1;
     end;
    end;
    hence (f1(#)f2)`\I = f2(#)(f1`\I) + f1(#)(f2`\I) by A6,A9,PARTFUN1:5;
    hereby let x be Real;
     assume
A18:   x in I; then
     ((f1(#)f2)`\I).x = (f2(#)(f1`\I) + f1(#)(f2`\I)).x by A6,A10; then
     ((f1(#)f2)`\I).x = (f2(#)(f1`\I)).x + (f1(#)(f2`\I)).x
       by A18,A9,VALUED_1:def 1; then
     ((f1(#)f2)`\I).x = f2.x * (f1`\I).x + (f1(#)(f2`\I)).x
       by A18,A8,VALUED_1:def 4;
     hence ((f1(#)f2)`\I).x = (f2.x)*(f1`\I).x + (f1.x)*(f2`\I).x
       by A18,A8,VALUED_1:def 4;
    end;
end;

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

    reconsider J = ].inf I,sup I.[ as open Subset of REAL by Th2;
A4: J c= I by Th2;

A5: dom(f1/f2) = dom f1 /\ (dom f2 \ f2"{0}) by RFUNCT_1:def 1;
A6: for x be set st x in I holds f2.x <> 0
    proof
     let x be set;
     assume x in I; then
     x in dom f2 \ f2"{0} by A1,A5,XBOOLE_0:def 4; then
     x in dom f2 & not x in f2"{0} by XBOOLE_0:def 5; then
     not f2.x in {0} by FUNCT_1:def 7;
     hence f2.x <> 0 by TARSKI:def 1;
    end;

A7: now assume
A8:  inf I in I; then
     inf I = lower_bound I by Lm5; then
     f2.(lower_bound I) <> 0 by A6,A8;
     hence f1/f2 is_right_differentiable_in lower_bound I
       by A2,A3,A8,FDIFF_3:19;
    end;
A9:now assume
A10: sup I in I; then
     sup I = upper_bound I by Lm6; then
     f2.(upper_bound I) <> 0 by A6,A10;
     hence f1/f2 is_left_differentiable_in upper_bound I
       by A2,A3,A10,FDIFF_3:13;
    end;
    for x be Real st x in J holds f2.x <> 0 by A4,A6;
    hence
A11:  f1/f2 is_differentiable_on_interval I by A1,A2,A3,A7,A9,FDIFF_2:21; then
A12: dom((f1/f2)`\I) = I by Def2;
    dom(f1`\I) = I & dom(f2`\I) = I by A2,A3,Def2; then
    I = dom(f1`\I) /\ dom f2 & I = dom f1 /\ dom(f2`\I)
      by A2,A3,XBOOLE_1:28; then
A13: I = dom((f1`\I)(#)f2) & I = dom(f1(#)(f2`\I)) by VALUED_1:def 4;
A14:dom(f2^2) = dom(f2(#)f2) by VALUED_1:def 8; then
A15: dom(f2^2) = dom f2 /\ dom f2 by VALUED_1:def 4;

    now let x be Real;
     assume
A16:   x in I;
     (f2^2).x = (f2.x)^2 by VALUED_1:11; then
A17:  (f2^2).x = f2.x * f2.x by SQUARE_1:def 1;
     f2.x <> 0 by A6,A16; then
     (f2^2).x <> 0 by A17,XCMPLX_1:6; then
     not (f2^2).x in {0} by TARSKI:def 1; then
     not x in (f2^2)"{0} by FUNCT_1:def 7;
     hence x in dom(f2^2) \ (f2^2)"{0} by A16,A3,A15,XBOOLE_0:def 5;
    end; then
A18: I c= dom(f2^2) \ (f2^2)"{0};
A19:dom((f1`\I)(#)f2 - (f2`\I)(#)f1) = I /\ I by A13,VALUED_1:12;

    dom(((f1`\I)(#)f2 - (f2`\I)(#)f1)/(f2^2))
     = dom(((f1`\I)(#)f2 - (f2`\I)(#)f1)) /\ (dom(f2^2) \ (f2^2)"{0})
       by RFUNCT_1:def 1; then
A20:dom(((f1`\I)(#)f2 - (f2`\I)(#)f1)/(f2^2)) = I by A18,A19,XBOOLE_1:28;

A21: for x be Element of REAL st x in dom((f1/f2)`\I) holds
     ((f1/f2)`\I).x = (((f1`\I)(#)f2 - (f2`\I)(#)f1)/(f2^2)).x
    proof
     let x be Element of REAL;
     assume A22: x in dom((f1/f2)`\I); then
A23:  f2.x <> 0 by A6,A12;

      per cases;
      suppose
A24:   x = inf I; then
A25:   ((f1/f2)`\I).x = Rdiff(f1/f2,x) & (f1`\I).x = Rdiff(f1,x) &
       (f2`\I).x = Rdiff(f2,x) by A2,A3,A11,A22,A12,Def2;

       f1 is_right_differentiable_in x &
       f2 is_right_differentiable_in x by A2,A3,A22,A12,A24,Lm5; then
       ((f1/f2)`\I).x = ((f1`\I).x * f2.x - (f2`\I).x * f1.x)/(f2.x)^2
        by A25,A23,FDIFF_3:19; then
       ((f1/f2)`\I).x = ((f1`\I).x * f2.x - (f2`\I).x * f1.x)/(f2.x*f2.x)
         by SQUARE_1:def 1; then
       ((f1/f2)`\I).x = ((f1`\I).x * f2.x - (f2`\I).x * f1.x)/((f2(#)f2).x)
         by A22,A12,A3,A15,A14,VALUED_1:def 4; then
       ((f1/f2)`\I).x = ((f1`\I).x * f2.x - ((f2`\I)(#)f1).x)/((f2(#)f2).x)
         by A22,A12,A13,VALUED_1:def 4; then
       ((f1/f2)`\I).x = ((f1`\I).x * f2.x - ((f2`\I)(#)f1).x)/((f2^2).x)
         by VALUED_1:def 8; then
       ((f1/f2)`\I).x = (((f1`\I)(#)f2).x - ((f2`\I)(#)f1).x)*((f2^2).x)"
         by A22,A12,A13,VALUED_1:def 4; then
       ((f1/f2)`\I).x = ( ((f1`\I)(#)f2) - ((f2`\I)(#)f1)).x * ((f2^2).x)"
         by A22,A12,A19,VALUED_1:13;
       hence ((f1/f2)`\I).x = (((f1`\I)(#)f2 - (f2`\I)(#)f1)/(f2^2)).x
         by A22,A12,A20,RFUNCT_1:def 1;
      end;

      suppose
A26:   x = sup I; then
A27:   ((f1/f2)`\I).x = Ldiff(f1/f2,x) & (f1`\I).x = Ldiff(f1,x) &
       (f2`\I).x = Ldiff(f2,x) by A2,A3,A11,A22,A12,Def2;

       f1 is_left_differentiable_in x &
       f2 is_left_differentiable_in x by A2,A3,A22,A12,A26,Lm6; then
       ((f1/f2)`\I).x = ((f1`\I).x * f2.x - (f2`\I).x * f1.x)/(f2.x)^2
         by A27,A23,FDIFF_3:13; then
       ((f1/f2)`\I).x = ((f1`\I).x * f2.x - (f2`\I).x * f1.x)/(f2.x*f2.x)
         by SQUARE_1:def 1; then
       ((f1/f2)`\I).x = ((f1`\I).x * f2.x - (f2`\I).x * f1.x)/((f2(#)f2).x)
         by A22,A12,A3,A15,A14,VALUED_1:def 4; then
       ((f1/f2)`\I).x = ((f1`\I).x * f2.x - ((f2`\I)(#)f1).x)/((f2(#)f2).x)
         by A22,A12,A13,VALUED_1:def 4; then
       ((f1/f2)`\I).x = ((f1`\I).x * f2.x - ((f2`\I)(#)f1).x)/((f2^2).x)
         by VALUED_1:def 8; then
       ((f1/f2)`\I).x = (((f1`\I)(#)f2).x - ((f2`\I)(#)f1).x)*((f2^2).x)"
         by A22,A12,A13,VALUED_1:def 4; then
       ((f1/f2)`\I).x = ( ((f1`\I)(#)f2) - ((f2`\I)(#)f1)).x * ((f2^2).x)"
         by A22,A12,A19,VALUED_1:13;
       hence ((f1/f2)`\I).x = (((f1`\I)(#)f2 - (f2`\I)(#)f1)/(f2^2)).x
         by A22,A12,A20,RFUNCT_1:def 1;
      end;
      suppose
A28:   x <> inf I & x <> sup I; then
       x in J by A22,A12,Th3; then
A29:   f1 is_differentiable_in x & f2 is_differentiable_in x
         by A2,A3,FDIFF_1:9;

       (f1`\I).x = diff(f1,x) & (f2`\I).x = diff(f2,x) &
       ((f1/f2)`\I).x = diff(f1/f2,x) by A2,A3,A11,A22,A12,A28,Def2; then
       ((f1/f2)`\I).x = ((f1`\I).x * f2.x - (f2`\I).x * f1.x)/(f2.x)^2
         by A29,A23,FDIFF_2:14; then
       ((f1/f2)`\I).x = ((f1`\I).x * f2.x - (f2`\I).x * f1.x)/(f2.x*f2.x)
         by SQUARE_1:def 1; then
       ((f1/f2)`\I).x = ((f1`\I).x * f2.x - (f2`\I).x * f1.x)/((f2(#)f2).x)
         by A22,A12,A3,A15,A14,VALUED_1:def 4; then
       ((f1/f2)`\I).x = ((f1`\I).x * f2.x - ((f2`\I)(#)f1).x)/((f2(#)f2).x)
         by A22,A12,A13,VALUED_1:def 4; then
       ((f1/f2)`\I).x = ((f1`\I).x * f2.x - ((f2`\I)(#)f1).x)/((f2^2).x)
         by VALUED_1:def 8; then
       ((f1/f2)`\I).x = (((f1`\I)(#)f2).x - ((f2`\I)(#)f1).x)*((f2^2).x)"
         by A22,A12,A13,VALUED_1:def 4; then
       ((f1/f2)`\I).x = ( ((f1`\I)(#)f2) - ((f2`\I)(#)f1)).x * ((f2^2).x)"
         by A22,A12,A19,VALUED_1:13;
       hence ((f1/f2)`\I).x = (((f1`\I)(#)f2 - (f2`\I)(#)f1)/(f2^2)).x
         by A22,A12,A20,RFUNCT_1:def 1;
      end;
    end;
    hence (f1/f2)`\I = ((f1`\I)(#)f2 - (f2`\I)(#)f1)/(f2^2)
      by A12,A20,PARTFUN1:5;
    hereby let x be Real;
     assume
A30:   x in I; then
     ((f1/f2)`\I).x = (((f1`\I)(#)f2 - (f2`\I)(#)f1)/(f2^2)).x by A12,A21; then
     ((f1/f2)`\I).x = ( ((f1`\I)(#)f2) - ((f2`\I)(#)f1)).x * ((f2^2).x)"
       by A30,A20,RFUNCT_1:def 1; then
     ((f1/f2)`\I).x = (((f1`\I)(#)f2).x - ((f2`\I)(#)f1).x)*((f2^2).x)"
       by A30,A19,VALUED_1:13; then
     ((f1/f2)`\I).x = ((f1`\I).x * f2.x - ((f2`\I)(#)f1).x)*((f2^2).x)"
       by A30,A13,VALUED_1:def 4; then
     ((f1/f2)`\I).x = ((f1`\I).x * f2.x - ((f2`\I)(#)f1).x)/((f2(#)f2).x)
       by VALUED_1:def 8; then
     ((f1/f2)`\I).x = ((f1`\I).x * f2.x - (f2`\I).x * f1.x)/((f2(#)f2).x)
       by A30,A13,VALUED_1:def 4; then
     ((f1/f2)`\I).x = ((f1`\I).x * f2.x - (f2`\I).x * f1.x)/(f2.x*f2.x)
       by A30,A3,A15,A14,VALUED_1:def 4;
     hence ((f1/f2)`\I).x = ((f1`\I).x * f2.x - (f2`\I).x * f1.x)/(f2.x)^2
       by SQUARE_1:def 1;
    end;
end;

begin :: One-Sided Continuity

theorem
for f be PartFunc of REAL,REAL, x0 be Real st
 x0 in dom f & f is_continuous_in x0 holds
  f is_Lcontinuous_in x0 & f is_Rcontinuous_in x0
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume that
A1:  x0 in dom f and
A2:  f is_continuous_in x0;

    for s be Real_Sequence st rng s c= left_open_halfline x0 /\ dom f &
     s is convergent & lim s = x0 holds f/*s is convergent & f.x0 = lim(f/*s)
    proof
     let s be Real_Sequence;
     assume that
A3:   rng s c= left_open_halfline x0 /\ dom f and
A4:   s is convergent and
A5:   lim s = x0;
     rng s c= dom f by A3,XBOOLE_1:18;
     hence f/*s is convergent & f.x0 = lim(f/*s) by A2,A4,A5,FCONT_1:def 1;
    end;
    hence f is_Lcontinuous_in x0 by A1,FDIFF_3:def 1;

    for s be Real_Sequence st rng s c= right_open_halfline x0 /\ dom f &
     s is convergent & lim s = x0 holds f/*s is convergent & f.x0 = lim(f/*s)
    proof
     let s be Real_Sequence;
     assume that
A6:   rng s c= right_open_halfline x0 /\ dom f and
A7:   s is convergent and
A8:   lim s = x0;
     rng s c= dom f by A6,XBOOLE_1:18;
     hence f/*s is convergent & f.x0 = lim(f/*s) by A2,A7,A8,FCONT_1:def 1;
    end;
    hence f is_Rcontinuous_in x0 by A1,FDIFF_3:def 2;
end;

theorem Th27:
for x0 be Real, f be PartFunc of REAL,REAL holds
 f is_Lcontinuous_in x0 iff
 x0 in dom f &
 for e be Real st 0<e ex d be Real st 0 < d &
  for x be Real st x in dom f & x0-d < x & x < x0 holds
    |. f.x - f.x0 .| < e
proof
    let x0 be Real, f be PartFunc of REAL,REAL;
    hereby assume
A1:  f is_Lcontinuous_in x0;
     hence x0 in dom f by FDIFF_3:def 1;
     given e be Real such that
A2:   0<e and
A3:   for d be Real holds
       not 0<d or
       ex x1 be Real st x1 in dom f & x0-d < x1 & x1 < x0
        & not |.f.x1-f.x0.|<e;

     defpred P[Element of NAT,Real] means
      $2 in dom f & x0-1/($1+1) < $2 & $2 < x0 & not |.f.$2-f.x0.|<e;


A4:  for n be Element of NAT ex p being Element of REAL st P[n,p]
     proof
      let n be Element of NAT;
      ex p be Real st
       p in dom f & x0-1/(n+1) < p & p < x0 & not |.f.p-f.x0.|<e by A3;
      hence thesis;
     end;
     consider s1 be Real_Sequence such that
A5:   for n be Element of NAT holds P[n,s1.n] from FUNCT_2:sch 3(A4);

     now let x be Real;
      assume x in rng s1; then
      consider n be Element of NAT such that
A6:    x=s1.n by FUNCT_2:113;
A7:   x in dom f by A5,A6;
      x in ].-infty,x0.[ by A5,A6,XXREAL_1:233; then
      x in left_open_halfline x0 by PROB_1:def 10;
      hence x in left_open_halfline x0 /\ dom f by A7,XBOOLE_0:def 4;
     end; then
A8:  rng s1 c= left_open_halfline x0 /\ dom f;
A9:  now
      let n be Nat;
A10:   n in NAT by ORDINAL1:def 12; then
A11:   n in dom s1 by FUNCT_2:def 1;
A12:   f/*s1 = f*s1 by A8,XBOOLE_1:18,FUNCT_2:def 11;
      not |.f.(s1.n)-f.x0.|<e by A5,A10;
      hence not |.(f/*s1).n-f.x0.|<e by FUNCT_1:13,A11,A12;
     end;
A13: now let d be Real;
      assume
A14:   0<d;
      consider n being Nat such that
A15:   d"<n by SEQ_4:3;
      d"+(0 qua Nat) <n+1 by A15,XREAL_1:8; then
A16:  1/(n+1)<1/d" by A14,XREAL_1:76;
       take k=n;
      let m be Nat;
A17:  m in NAT by ORDINAL1:def 12;
      assume k<=m;
      then k+1<=m+1 by XREAL_1:6;
      then 1/(m+1)<=1/(k+1) by XREAL_1:118;
      then
A18:   1/(m+1)<d by A16,XXREAL_0:2;
      x0-1/(m+1) < s1.m & s1.m < x0 by A5,A17; then
A19:   x0-s1.m < 1/(m+1) & 0 < x0-s1.m by XREAL_1:11,50; then
      |. x0-s1.m .| = x0-s1.m by ABSVALUE:def 1; then
      |. -(s1.m - x0) .| < d by A18,A19,XXREAL_0:2;
      hence |.s1.m-x0.|<d by COMPLEX1:52;
     end; then
A20: s1 is convergent by SEQ_2:def 6;
     then lim s1=x0 by A13,SEQ_2:def 7;
     then f/*s1 is convergent & f.x0=lim(f/*s1) by A1,A8,A20,FDIFF_3:def 1;
     then consider n being Nat such that
A21:  for m being Nat st n<=m holds |.(f/*s1).m-f.x0.|<e by A2,SEQ_2:def 7;
     |.(f/*s1).n-f.x0.|<e by A21;
     hence contradiction by A9;
    end;

    assume
A22: x0 in dom f &
     for e be Real st 0<e ex d be Real st 0 < d &
      for x be Real st x in dom f & x0-d < x & x < x0 holds
       |. f.x - f.x0 .| < e;
    now let s1 be Real_Sequence such that
A23:  rng s1 c= left_open_halfline x0 /\ dom f and
A24:  s1 is convergent & lim s1 = x0;
A25: now let p be Real;
      assume 0<p;
      then consider d be Real such that
A26:   0<d and
A27:   for x1 be Real st x1 in dom f & x0-d < x1 & x1 < x0 holds
         |.f.x1-f.x0.|<p by A22;
      consider n being Nat such that
A28:   for m being Nat  st n<=m holds |.s1.m-x0.|<d by A24,A26,SEQ_2:def 7;
      take k=n;
      let m be Nat;
A29:  m in NAT by ORDINAL1:def 12;
      assume
       k<=m; then
A30:   s1.m in rng s1 & |.s1.m-x0.|<d by A28,VALUED_0:28;
A31:   m in dom s1 by A29,FUNCT_2:def 1;
A32:   rng s1 c= left_open_halfline x0 & rng s1 c= dom f
         by A23,XBOOLE_1:18; then
      s1.m in left_open_halfline x0 by VALUED_0:28; then
A33:   s1.m in ].-infty,x0.[ by PROB_1:def 10; then
A34:   s1.m < x0 by XXREAL_1:233;
A35:   0 < x0-s1.m by A33,XREAL_1:50,XXREAL_1:233;
      f/*s1 = f*s1 by A23,XBOOLE_1:18,FUNCT_2:def 11; then
A36:  (f/*s1).m = f.(s1.m) by A31,FUNCT_1:13;
      |. -(x0-s1.m) .| < d by A30; then
      |. x0-s1.m .| < d by COMPLEX1:52; then
      x0-s1.m < d by A35,ABSVALUE:def 1; then
      x0-d < s1.m by XREAL_1:11;
      hence |.(f/*s1).m - f.x0.|<p by A36,A27,A30,A32,A34;
     end;
     then f/*s1 is convergent by SEQ_2:def 6;
     hence f/*s1 is convergent & f.x0 = lim (f/*s1) by A25,SEQ_2:def 7;
    end;
    hence f is_Lcontinuous_in x0 by A22,FDIFF_3:def 1;
end;

theorem Th28:
for x0 be Real, f be PartFunc of REAL,REAL holds
 f is_Rcontinuous_in x0 iff
 x0 in dom f &
 for e be Real st 0<e ex d be Real st 0 < d &
  for x be Real st x in dom f & x0 < x & x < x0+d holds
    |. f.x - f.x0 .| < e
proof
    let x0 be Real, f be PartFunc of REAL,REAL;
    hereby assume
A1:  f is_Rcontinuous_in x0;
     hence x0 in dom f by FDIFF_3:def 2;
     given e be Real such that
A2:   0<e and
A3:   for d be Real holds
       not 0<d or
       ex x1 be Real st x1 in dom f & x0 < x1 & x1 < x0+d
        & not |.f.x1-f.x0.|<e;

     defpred P[Element of NAT,Real] means
      $2 in dom f & x0 < $2 & $2 < x0+1/($1+1) & not |.f.$2-f.x0.|<e;

A4:  for n be Element of NAT ex p being Element of REAL st P[n,p]
     proof
      let n be Element of NAT;
      ex p be Real st
       p in dom f & x0 < p & p < x0+1/(n+1) & not |.f.p-f.x0.|<e by A3;
      hence thesis;
     end;
     consider s1 be Real_Sequence such that
A5:   for n be Element of NAT holds P[n,s1.n] from FUNCT_2:sch 3(A4);

     now let x be Real;
      assume x in rng s1; then
      consider n be Element of NAT such that
A6:    x=s1.n by FUNCT_2:113;
A7:   x in dom f by A5,A6;
      x in ].x0,+infty.[ by A5,A6,XXREAL_1:235; then
      x in right_open_halfline x0 by LIMFUNC1:def 3;
      hence x in right_open_halfline x0 /\ dom f by A7,XBOOLE_0:def 4;
     end; then
A8:  rng s1 c= right_open_halfline x0 /\ dom f;
A9:  now
      let n be Nat;
A10:   n in NAT by ORDINAL1:def 12;
then
A11:   n in dom s1 by FUNCT_2:def 1;
A12:   f/*s1 = f*s1 by A8,XBOOLE_1:18,FUNCT_2:def 11;
      not |.f.(s1.n)-f.x0.|<e by A5,A10;
      hence not |.(f/*s1).n-f.x0.|<e by FUNCT_1:13,A11,A12;
     end;
A13: now let d be Real;
      assume
A14:   0<d;
      consider n being Nat such that
A15:   d"<n by SEQ_4:3;
      d"+(0 qua Nat) <n+1 by A15,XREAL_1:8; then
A16:   1/(n+1)<1/d" by A14,XREAL_1:76;
      take k=n;
      let m be Nat;
A17:  m in NAT by ORDINAL1:def 12;
      assume k<=m;
      then k+1<=m+1 by XREAL_1:6;
      then 1/(m+1)<=1/(k+1) by XREAL_1:118;
      then
A18:   1/(m+1)<d by A16,XXREAL_0:2;
      x0 < s1.m & s1.m < x0+1/(m+1) by A5,A17; then
A19:   s1.m-x0 < 1/(m+1) & 0 < s1.m-x0 by XREAL_1:19,50; then
      |. s1.m-x0 .| = s1.m-x0 by ABSVALUE:def 1;
      hence |.s1.m-x0.|<d by A18,A19,XXREAL_0:2;
     end; then
A20: s1 is convergent by SEQ_2:def 6;
     then lim s1=x0 by A13,SEQ_2:def 7;
     then f/*s1 is convergent & f.x0=lim(f/*s1) by A1,A8,A20,FDIFF_3:def 2;
     then consider n being Nat such that
A21:  for m being Nat st n<=m holds |.(f/*s1).m-f.x0.|<e by A2,SEQ_2:def 7;
     |.(f/*s1).n-f.x0.|<e by A21;
     hence contradiction by A9;
    end;

    assume
A22: x0 in dom f &
     for e be Real st 0<e ex d be Real st 0 < d &
      for x be Real st x in dom f & x0 < x & x < x0+d holds
       |. f.x - f.x0 .| < e;
    now let s1 be Real_Sequence such that
A23:  rng s1 c= right_open_halfline x0 /\ dom f and
A24:  s1 is convergent & lim s1 = x0;
A25: now let p be Real;
      assume 0<p;
      then consider d be Real such that
A26:   0<d and
A27:   for x1 be Real st x1 in dom f & x0 < x1 & x1 < x0+d holds
         |.f.x1-f.x0.|<p by A22;
      consider n being Nat such that
A28:   for m being Nat  st n<=m holds |.s1.m-x0.|<d by A24,A26,SEQ_2:def 7;
      take k=n;
      let m be Nat;
A29:  m in NAT by ORDINAL1:def 12;
      assume k<=m; then
A30:   s1.m in rng s1 & |.s1.m-x0.|<d by A28,VALUED_0:28;

A31:   m in dom s1 by A29,FUNCT_2:def 1;

A32:   rng s1 c= right_open_halfline x0 & rng s1 c= dom f
         by A23,XBOOLE_1:18; then
      s1.m in right_open_halfline x0 by VALUED_0:28; then
A33:   s1.m in ].x0,+infty.[ by LIMFUNC1:def 3; then
A34:   x0 < s1.m by XXREAL_1:235;
A35:   0 < s1.m-x0 by A33,XREAL_1:50,XXREAL_1:235;

      f/*s1 = f*s1 by A23,XBOOLE_1:18,FUNCT_2:def 11; then
A36:  (f/*s1).m = f.(s1.m) by A31,FUNCT_1:13;

      s1.m-x0 < d by A30,A35,ABSVALUE:def 1; then
      s1.m < x0+d by XREAL_1:19;
      hence |.(f/*s1).m - f.x0.|<p by A36,A27,A30,A32,A34;
     end;
     then f/*s1 is convergent by SEQ_2:def 6;
     hence f/*s1 is convergent & f.x0 = lim (f/*s1) by A25,SEQ_2:def 7;
    end;
    hence f is_Rcontinuous_in x0 by A22,FDIFF_3:def 2;
end;

theorem
for f be PartFunc of REAL,REAL, x0 be Real st
 f is_Lcontinuous_in x0 & f is_Rcontinuous_in x0
 holds f is_continuous_in x0
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume that
A1:  f is_Lcontinuous_in x0 and
A2:  f is_Rcontinuous_in x0;

    for e be Real st 0<e ex d be Real st 0 < d &
     for x be Real st x in dom f & |. x-x0 .| < d holds |. f.x - f.x0 .| < e
    proof
     let e be Real;
     assume
A3:   0 < e;
     consider d1 be Real such that
A4:   0 < d1 &
      for x be Real st x in dom f & x0-d1 < x & x < x0 holds
      |. f.x - f.x0 .| < e by A3,A1,Th27;
     consider d2 be Real such that
A5:   0 < d2 &
      for x be Real st x in dom f & x0 < x & x < x0+d2 holds
      |. f.x - f.x0 .| < e by A3,A2,Th28;
     take d = min(d1,d2);
     thus 0 < d by A4,A5,XXREAL_0:21;
     thus for x be Real st x in dom f & |. x-x0 .| < d
      holds |. f.x - f.x0 .| < e
     proof
      let x be Real;
      assume that
A6:   x in dom f and
A7:   |. x-x0 .| < d;
A8:  -d < -|. x-x0 .| by A7,XREAL_1:24;
      -|. x-x0 .| <= x-x0 & x-x0 <= |. x-x0 .| by ABSVALUE:4; then
A9:  -d < x-x0 & x-x0 < d by A7,A8,XXREAL_0:2;
      per cases by XXREAL_0:1;
      suppose x = x0;
       hence |. f.x - f.x0 .| < e by A3,COMPLEX1:44;
      end;
      suppose
A10:   x < x0;
A11:   x0-d < x by A9,XREAL_1:20;
       x0-d1 <= x0-d by XXREAL_0:17,XREAL_1:10; then
       x0-d1 < x by A11,XXREAL_0:2;
       hence |. f.x - f.x0 .| < e by A4,A6,A10;
      end;
      suppose
A12:   x0 < x;
A13:   x < x0+d by A9,XREAL_1:19;
       x0+d <= x0+d2 by XXREAL_0:17,XREAL_1:6; then
       x < x0+d2 by A13,XXREAL_0:2;
       hence |. f.x - f.x0 .| < e by A5,A6,A12;
      end;
     end;
    end;
    hence f is_continuous_in x0 by FCONT_1:3;
end;

theorem
for x0 be Real, f be PartFunc of REAL,REAL st f is_Lcontinuous_in x0 &
 (for r be Real st r<x0 ex g be Real st r<g & g<x0 & g in dom f)
 holds f is_left_convergent_in x0 & lim_left(f,x0) = f.x0
proof
    let x0 be Real, f be PartFunc of REAL,REAL;
    assume that
A1: f is_Lcontinuous_in x0 and
A2: for r be Real st r<x0 ex g be Real st r<g & g<x0 & g in dom f;

A3: for seq be Real_Sequence st seq is convergent & lim seq=x0 &
      rng seq c= dom f /\ left_open_halfline(x0) holds
        f/*seq is convergent & lim(f/*seq)=f.x0 by A1,FDIFF_3:def 1;
    hence f is_left_convergent_in x0 by A2,LIMFUNC2:def 1;
    hence lim_left(f,x0) = f.x0 by A3,LIMFUNC2:def 7;
end;

theorem
for x0 be Real, f be PartFunc of REAL,REAL st f is_Rcontinuous_in x0 &
 (for r be Real st x0<r ex g be Real st g<r & x0<g & g in dom f)
 holds f is_right_convergent_in x0 & lim_right(f,x0) = f.x0
proof
    let x0 be Real, f be PartFunc of REAL,REAL;
    assume that
A1: f is_Rcontinuous_in x0 and
A2: for r be Real st x0<r ex g be Real st g<r & x0<g & g in dom f;

A3: for seq be Real_Sequence st seq is convergent & lim seq=x0 &
      rng seq c= dom f /\ right_open_halfline(x0) holds
        f/*seq is convergent & lim(f/*seq)=f.x0 by A1,FDIFF_3:def 2;
    hence f is_right_convergent_in x0 by A2,LIMFUNC2:def 4;
    hence lim_right(f,x0) = f.x0 by A3,LIMFUNC2:def 8;
end;

theorem
for f be PartFunc of REAL,REAL, x0 be Real st
 x0 in dom f & f is_right_convergent_in x0 & lim_right(f,x0) = f.x0
  holds f is_Rcontinuous_in x0
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume that
A1:  x0 in dom f and
A2:  f is_right_convergent_in x0 and
A3:  lim_right(f,x0) = f.x0;

    for a be Real_Sequence st rng a c= right_open_halfline x0 /\ dom f &
      a is convergent & lim a = x0 holds
       f/*a is convergent & f.x0 = lim(f/*a) by A2,A3,LIMFUNC2:def 8;
    hence f is_Rcontinuous_in x0 by A1,FDIFF_3:def 2;
end;

theorem
for x0 be Real, f be PartFunc of REAL,REAL st
 x0 in dom f & f is_left_convergent_in x0 & lim_left(f,x0) = f.x0
  holds f is_Lcontinuous_in x0
proof
    let x0 be Real, f be PartFunc of REAL,REAL;
    assume that
A1:  x0 in dom f and
A2:  f is_left_convergent_in x0 and
A3: lim_left(f,x0) = f.x0;

    for seq be Real_Sequence st rng seq c= left_open_halfline(x0) /\ dom f &
     seq is convergent & lim seq = x0
     holds f/*seq is convergent & f.x0 = lim(f/*seq) by A2,A3,L_HOSPIT:3;
    hence f is_Lcontinuous_in x0 by A1,FDIFF_3:def 1;
end;

theorem
for f be PartFunc of REAL,REAL, x0 be Real st
 f is_convergent_in x0 & lim(f,x0) = f.x0 holds f is_continuous_in x0
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume that
A1:  f is_convergent_in x0 and
A2:  lim(f,x0) = f.x0;

    for e be Real st 0 < e ex d be Real st 0 < d &
     for x be Real st x in dom f & |. x-x0 .| < d holds |. f.x-f.x0 .|< e
    proof
     let e be Real;
     assume
A3:   0 < e; then
     consider d be Real such that
A4:   0 < d &
      for x be Real st 0 < |. x0-x .| & |. x0-x .| < d & x in dom f
        holds |. f.x-f.x0 .| < e by A1,A2,LIMFUNC3:28;
     take d;
     thus 0 < d by A4;
     thus for x be Real st x in dom f & |. x-x0 .| < d holds |. f.x-f.x0 .|< e
     proof
      let x be Real;
      assume that
A5:    x in dom f and
A6:    |. x-x0 .| < d;
A7:   |. -(x-x0) .| = |. x-x0 .| by COMPLEX1:52;
      per cases;
      suppose x=x0;
       hence |. f.x-f.x0 .|< e by A3,COMPLEX1:44;
      end;
      suppose x<>x0; then
       x0-x <> 0;
       hence |. f.x-f.x0 .|< e by A4,A5,A6,A7,COMPLEX1:47;
      end;
     end;
    end;
    hence f is_continuous_in x0 by FCONT_1:3;
end;

reserve h for non-zero 0-convergent Real_Sequence;
reserve c for constant Real_Sequence;

theorem Th35:
for f be PartFunc of REAL,REAL, x0 be Real st f is_Rcontinuous_in x0 holds
 f|(right_closed_halfline x0) is_continuous_in x0
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume A1: f is_Rcontinuous_in x0; then
A2: x0 in dom f &
    for e be Real st 0<e ex d be Real st 0 < d &
     for x be Real st x in dom f & x0 < x & x < x0+d holds
      |. f.x - f.x0 .| < e by Th28;

    set f1=f|(right_closed_halfline x0);
    for e be Real st 0<e ex d be Real st 0<d & for x be Real st
     x in dom f1 & |. x-x0 .| < d holds |. f1.x - f1.x0 .| < e
    proof
     let e be Real;
     assume
A3:   0<e; then
     consider d be Real such that
A4:   0 < d and
A5:   for x be Real st x in dom f & x0 < x & x < x0+d holds
       |. f.x - f.x0 .| < e by A1,Th28;
     take d;
     thus 0 < d by A4;
     thus for x be Real st x in dom f1 & |. x-x0 .| < d
      holds |. f1.x - f1.x0 .| < e
     proof
      let x be Real;
      assume that
A6:    x in dom f1 and
A7:    |. x-x0 .| < d;
      dom f1 = dom f /\ right_closed_halfline x0 by RELAT_1:61; then
A8:   x in dom f & x in right_closed_halfline x0 by A6,XBOOLE_0:def 4; then
      x in [.x0,+infty.[ by LIMFUNC1:def 2; then
A9:   x0 <= x by XXREAL_1:236;
      per cases;
      suppose x = x0;
       hence |. f1.x - f1.x0 .| < e by A3,COMPLEX1:44;
      end;
      suppose x <> x0; then
A10:    x0 < x by A9,XXREAL_0:1; then
       x-x0 >0 by XREAL_1:50; then
       x-x0 < d by A7,ABSVALUE:def 1; then
A11:    x < x0+d by XREAL_1:19;
       x0 in [.x0,+infty.[ by XXREAL_1:236; then
       x0 in right_closed_halfline x0 by LIMFUNC1:def 2; then
       f1.x = f.x & f1.x0 = f.x0 by A6,A2,RELAT_1:57,FUNCT_1:47;
       hence |. f1.x - f1.x0 .| < e by A5,A8,A10,A11;
      end;
     end;
    end;
    hence thesis by FCONT_1:3;
end;

theorem Th36:
for f be PartFunc of REAL,REAL, x0 be Real st f is_Lcontinuous_in x0 holds
 f|(left_closed_halfline x0) is_continuous_in x0
proof
    let f be PartFunc of REAL,REAL, x0 be Real;
    assume A1: f is_Lcontinuous_in x0; then
A2: x0 in dom f &
    for e be Real st 0<e ex d be Real st 0 < d &
     for x be Real st x in dom f & x0-d < x & x < x0 holds
      |. f.x - f.x0 .| < e by Th27;

    set f1=f|(left_closed_halfline x0);
    for e be Real st 0<e ex d be Real st 0<d & for x be Real st
     x in dom f1 & |. x-x0 .| < d holds |. f1.x - f1.x0 .| < e
    proof
     let e be Real;
     assume
A3:   0<e;
     consider d be Real such that
A4:   0 < d and
A5:   for x be Real st x in dom f & x0-d < x & x < x0 holds
       |. f.x - f.x0 .| < e by A1,A3,Th27;
     take d;
     thus 0 < d by A4;
     thus for x be Real st x in dom f1 & |. x-x0 .| < d
      holds |. f1.x - f1.x0 .| < e
     proof
      let x be Real;
      assume that
A6:    x in dom f1 and
A7:    |. x-x0 .| < d;
      dom f1 = dom f /\ left_closed_halfline x0 by RELAT_1:61; then
A8:   x in dom f & x in left_closed_halfline x0 by A6,XBOOLE_0:def 4; then
      x in ].-infty,x0.] by LIMFUNC1:def 1; then
A9:   x <= x0 by XXREAL_1:234;
      per cases;
      suppose x = x0;
       hence |. f1.x - f1.x0 .| < e by A3,COMPLEX1:44;
      end;
      suppose x <> x0; then
A10:    x < x0 by A9,XXREAL_0:1; then
       -(x-x0) < d by A7,ABSVALUE:def 1,XREAL_1:49; then
       x0 -x < d; then
       x0 < x + d by XREAL_1:19; then
A11:    x > x0-d by XREAL_1:19;
       x0 in ].-infty,x0.] by XXREAL_1:234; then
       x0 in left_closed_halfline x0 by LIMFUNC1:def 1; then
       f1.x = f.x & f1.x0 = f.x0 by A6,A2,RELAT_1:57,FUNCT_1:47;
       hence |. f1.x - f1.x0 .| < e by A5,A8,A10,A11;
      end;
     end;
    end;
    hence thesis by FCONT_1:3;
end;

theorem
for f be PartFunc of REAL,REAL, I be non empty Interval st
 f is_differentiable_on_interval I holds f|I is continuous
proof
    let f be PartFunc of REAL,REAL, I be non empty Interval;
    assume
A1:  f is_differentiable_on_interval I;

    for x be Real st x in dom(f|I) holds f|I is_continuous_in x
    proof
     let x be Real;
     assume
A2:   x in dom(f|I);
     per cases;
     suppose
A3:   x = inf I; then
      f|I is_right_differentiable_in x by A1,A2,Th11; then
A4:   (f|I)|(right_closed_halfline x) is_continuous_in x
        by Th35,FDIFF_3:7;
      now let y be Real;
       assume y in I; then
       x <= y by A3,XXREAL_2:3; then
       y in [.x,+infty.[ by XXREAL_1:236;
       hence y in right_closed_halfline x by LIMFUNC1:def 2;
      end; then
      I c= right_closed_halfline x;
      hence f|I is_continuous_in x by A4,RELAT_1:73;
     end;
     suppose
A5:   x = sup I; then
      f|I is_left_differentiable_in x by A1,A2,Th11; then
A6:   (f|I)|(left_closed_halfline x) is_continuous_in x
        by Th36,FDIFF_3:5;
      now let y be Real;
       assume y in I; then
       y <= x by A5,XXREAL_2:4; then
       y in ].-infty,x.] by XXREAL_1:234;
       hence y in left_closed_halfline x by LIMFUNC1:def 1;
      end; then
      I c= left_closed_halfline x;
      hence f|I is_continuous_in x by A6,RELAT_1:73;
     end;
     suppose x <> inf I & x <> sup I; then
      x in ].inf I,sup I.[ by A2,Th3; then
      f is_differentiable_in x by A1,A2,Th11;
      hence f|I is_continuous_in x by A2,FDIFF_1:24,FCONT_1:1;
     end;
    end;
    hence f|I is continuous by FCONT_1:def 2;
end;

theorem
for f be PartFunc of REAL,REAL, I,J be non empty Interval st
 f is_differentiable_on_interval I & J c= I & inf J < sup J holds
  f is_differentiable_on_interval J &
  for x be Real st x in J holds (f`\I).x = (f`\J).x
proof
    let f be PartFunc of REAL,REAL, I,J be non empty Interval;
    assume that
A1:  f is_differentiable_on_interval I and
A2:  J c= I and
A3: inf J < sup J;
    I c= dom f by A1; then
A4: J c= dom f by A2;
A5: inf I <= inf J & sup J <= sup I by A2,XXREAL_2:59,60;

    for x be Real st x in J holds
     (x = inf J implies f|J is_right_differentiable_in x) &
     (x = sup J implies f|J is_left_differentiable_in x) &
     (x in ].inf J,sup J.[ implies f is_differentiable_in x)
    proof
     let x be Real;
     assume
A6:   x in J;

     hereby assume
A7:   x = inf J;
      per cases;
      suppose x = inf I; then
       f|I is_right_differentiable_in x by A1,A2,A6,Th11; then
       (f|I)|J is_right_differentiable_in x by A6,A7,A3,Th4;
       hence f|J is_right_differentiable_in x by A2,RELAT_1:74;
      end;
      suppose x <> inf I; then
       x in ].inf I,sup I.[ by A2,A7,A6,A5,A3,Th3; then
       f is_differentiable_in x by A1,A2,A6,Th11; then
       f is_right_differentiable_in x by FDIFF_3:22;
       hence f|J is_right_differentiable_in x by A6,A7,A3,Th4;
      end;
     end;

     hereby assume
A8:   x = sup J;
      per cases;
      suppose x = sup I; then
       f|I is_left_differentiable_in x by A1,A2,A6,Th11; then
       (f|I)|J is_left_differentiable_in x by A6,A8,A3,Th5;
       hence f|J is_left_differentiable_in x by A2,RELAT_1:74;
      end;
      suppose x <> sup I; then
       x in ].inf I,sup I.[ by A3,A5,A2,A8,A6,Th3; then
       f is_differentiable_in x by A1,A2,A6,Th11; then
       f is_left_differentiable_in x by FDIFF_3:22;
       hence f|J is_left_differentiable_in x by A6,A8,A3,Th5;
      end;
     end;

     hereby assume x in ].inf J,sup J.[; then
      inf J < x & x < sup J by XXREAL_1:4; then
      inf I < x & x < sup I by A5,XXREAL_0:2; then
      x in ].inf I,sup I.[ by XXREAL_1:4;
      hence f is_differentiable_in x by A1,A2,A6,Th11;
     end;
    end;
    hence
A9:  f is_differentiable_on_interval J by A4,Th11;
    thus for x be Real st x in J holds (f`\I).x = (f`\J).x
    proof
     let x be Real;
     assume A10: x in J; then
A11:  inf J <= x & x <= sup J by XXREAL_2:3,4;
     per cases;
     suppose
A12:   x = inf J;
      per cases;
      suppose x = inf I; then
       (f`\I).x = Rdiff(f,x) & (f`\J).x = Rdiff(f,x) by A1,A2,A10,A9,A12,Def2;
       hence (f`\I).x = (f`\J).x;
      end;
      suppose
A13:    x <> inf I; then
       x in ].inf I,sup I.[ by A2,A10,A12,A3,A5,Th3; then
       f is_differentiable_in x by A1,A2,A10,Th11; then
       diff(f,x) = Rdiff(f,x) by FDIFF_3:22; then
       (f`\I).x = Rdiff(f,x) & (f`\J).x = Rdiff(f,x)
         by A1,A2,A10,A9,A12,A13,Def2,A5;
       hence (f`\I).x = (f`\J).x;
      end;
     end;
     suppose
A14:   x = sup J;
      per cases;
      suppose x = sup I; then
       (f`\I).x = Ldiff(f,x) & (f`\J).x = Ldiff(f,x) by A1,A2,A9,A10,A14,Def2;
       hence (f`\I).x = (f`\J).x;
      end;
      suppose
A15:    x <> sup I; then
       x in ].inf I,sup I.[ by A2,A10,A14,A3,A5,Th3; then
       f is_differentiable_in x by A1,A2,A10,Th11; then
       diff(f,x) = Ldiff(f,x) by FDIFF_3:22; then
       (f`\I).x = Ldiff(f,x) & (f`\J).x = Ldiff(f,x)
         by A1,A2,A10,A9,A14,A15,Def2,A5;
       hence (f`\I).x = (f`\J).x;
      end;
     end;
     suppose x <> inf J & x <> sup J; then
      inf J < x & x < sup J by A11,XXREAL_0:1; then
      (f`\I).x = diff(f,x) & (f`\J).x = diff(f,x) by A1,A2,A10,A9,Def2,A5;
      hence (f`\I).x = (f`\J).x;
     end;
    end;
end;

theorem
for f be PartFunc of REAL,REAL, Z be open Subset of REAL,
 I be non empty Interval st I c= Z & inf I < sup I &
 f is_differentiable_on Z holds f is_differentiable_on_interval I
proof
    let f be PartFunc of REAL,REAL, Z be open Subset of REAL,
    I be non empty Interval;
    assume that
A1:  I c= Z and
A2:  inf I < sup I and
A3:  f is_differentiable_on Z;
    Z c= dom f by A3; then
A4: I c= dom f by A1;
    for x be Real st x in I holds
     (x = inf I implies f|I is_right_differentiable_in x) &
     (x = sup I implies f|I is_left_differentiable_in x) &
     (x in ].inf I,sup I.[ implies f is_differentiable_in x)
    proof
     let x be Real;
     assume
A5:  x in I; then
     f is_differentiable_in x by A1,A3,FDIFF_1:9; then
A6:  f is_right_differentiable_in x & f is_left_differentiable_in x
       by FDIFF_3:22;
     hence x = inf I implies f|I is_right_differentiable_in x
      by A5,A2,Th4;
     thus x = sup I implies f|I is_left_differentiable_in x
       by A5,A6,A2,Th5;
     assume x in ].inf I,sup I.[;
     thus f is_differentiable_in x by A5,A1,A3,FDIFF_1:9;
    end;
    hence f is_differentiable_on_interval I by A4,Th11;
end;

begin :: Chain Rule

reserve R,R1,R2 for RestFunc;
reserve L,L1,L2 for LinearFunc;

Lm20:
for x0 be Real, f1,f2 be PartFunc of REAL,REAL st
 f1 is_right_differentiable_in x0 & f2 is_differentiable_in f1.x0 holds
   (ex r be Real st r>0 & [.x0,x0+r.] c= dom(f2*f1))
proof
    let x0 be Real, f1,f2 be PartFunc of REAL,REAL;
    assume that
A1:  f1 is_right_differentiable_in x0 and
A2:  f2 is_differentiable_in f1.x0;

    consider r1 be Real such that
A3:  r1 > 0 & [.x0,x0+r1.] c= dom f1 by A1,FDIFF_3:def 3;
    consider N2 be Neighbourhood of f1.x0 such that
A4:  N2 c= dom f2 by A2;

    x0 in [.x0,+infty.[ by XXREAL_1:236; then
A5: x0 in right_closed_halfline x0 by LIMFUNC1:def 2;
    set ff1 = f1|(right_closed_halfline x0);

    reconsider N2 as Neighbourhood of ff1.x0 by A5,FUNCT_1:49;

    ff1 is_continuous_in x0 by A1,FDIFF_3:7,Th35; then
    consider N3 be Neighbourhood of x0 such that
A6:  ff1.:N3 c= N2 by FCONT_1:5;
    consider r2 be Real such that
A7:  r2 > 0 & N3 = ].x0-r2,x0+r2.[ by RCOMP_1:def 6;

    set r3 = min(r1,r2);
A8: r3 > 0 by A3,A7,XXREAL_0:21;
A9: x0+r3 <= x0+r1 & x0+r3 <= x0+r2 by XREAL_1:6,XXREAL_0:17;

    consider x1 be Real such that
A10:  x0 < x1 & x1 < x0+r3 by A8,XREAL_1:5,29;
    take r = x1-x0;
    thus r > 0 by A10,XREAL_1:50;

A11: x0-r2 < x0 by A7,XREAL_1:44;
A12: x0+r < x0+r1 & x0+r < x0+r2 by A9,A10,XXREAL_0:2; then
A13: [. x0,x0+r .] c= N3 by A7,A11,XXREAL_1:47;

    [. x0,x0+r .] c= [. x0,x0+r1 .] by A12,XXREAL_1:34; then
A14: [. x0,x0+r .] c= dom f1 by A3;

    now let x be Real;
     assume
A15:  x in [.x0,x0+r.];

     x0 <= x by A15,XXREAL_1:1; then
     x in [.x0,+infty.[ by XXREAL_1:236; then
A16: x in right_closed_halfline x0 by LIMFUNC1:def 2; then
A17: ff1.x = f1.x by FUNCT_1:49;

A18: x in dom ff1 by A15,A14,A16,RELAT_1:57;
     ff1.x in ff1.:N3 by A13,A15,A18,FUNCT_1:def 6; then
     f1.x in dom f2 by A6,A4,A17;
     hence x in dom(f2*f1) by A15,A14,FUNCT_1:11;
    end;
    hence [.x0,x0+r.] c= dom(f2*f1);
end;

theorem Th40:
for x0 be Real, f1,f2 be PartFunc of REAL,REAL st
 f1 is_right_differentiable_in x0 & f2 is_differentiable_in f1.x0 holds
 f2*f1 is_right_differentiable_in x0 &
 Rdiff(f2*f1,x0) = diff(f2,f1.x0)*Rdiff(f1,x0)
proof
    let x0 be Real, f1,f2 be PartFunc of REAL,REAL;
    assume that
A1:  f1 is_right_differentiable_in x0 and
A2:  f2 is_differentiable_in f1.x0;

    consider r be Real such that
A3:  r > 0 & [.x0,x0+r.] c= dom(f2*f1) by A1,A2,Lm20;

A4: f1 is_Rcontinuous_in x0 by A1,FDIFF_3:7;

    x0 < x0+r by A3,XREAL_1:29; then
A5: x0 in dom(f2*f1) by A3,XXREAL_1:1; then
A6: f1.x0 in dom f2 by FUNCT_1:11;

    for h,c st rng c = {x0} & rng (h + c) c= dom (f2*f1) &
     (for n be Nat holds h.n > 0) holds
     h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
   & lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = diff(f2,f1.x0)*Rdiff(f1,x0)
    proof
     let h,c;
     assume that
A7:   rng c = {x0} and
A8:   rng (h + c) c= dom (f2*f1) and
A9:   for n be Nat holds h.n > 0;

A10:  for n be Nat holds c.n = x0
     proof
      let n be Nat;
      c.n in rng c by VALUED_0:28;
      hence c.n = x0 by A7,TARSKI:def 1;
     end;

A11:  now let x be Real;
      assume
A12:    x in rng(h+c); then
      consider n be Element of NAT such that
A13:    x = (h+c).n by FUNCT_2:113;
      x = h.n + c.n by A13,SEQ_1:7; then
      x = h.n + x0 by A10; then
      x > x0 by A9,XREAL_1:29; then
      x in ].x0,+infty.[ by XXREAL_1:235; then
A14:   x in right_open_halfline x0 by LIMFUNC1:def 3;
      x in dom f1 by A12,A8,FUNCT_1:11;
      hence x in right_open_halfline x0 /\ dom f1 by A14,XBOOLE_0:def 4;
     end; then
A15:  rng (h + c) c= right_open_halfline x0 /\ dom f1; then
A16:  rng (h+c) c= dom f1 by XBOOLE_1:18;
A17: rng c c= dom f1 by A7,A4,FDIFF_3:def 2,ZFMISC_1:31;

     set a = f1/*c;
     set d = f1/*(h+c) - f1/*c;

A18: lim h = 0;

     lim c = c.0 by SEQ_4:25; then
     lim c = x0 by A10; then
A19: lim (h + c) = 0 + x0 by A18,SEQ_2:6 .= x0;

A20: f1 is_Rcontinuous_in x0 by A1,FDIFF_3:7; then
A21: f1/*(h+c) is convergent by A15,A19,FDIFF_3:def 2;

A22: f1.x0 = lim (f1/*(h+c)) by A15,A19,A20,FDIFF_3:def 2;
A23: rng (f1/*(h+c)) c= dom f2 by A8,FDIFF_2:9;
     now let x be Real;
      assume x in rng a; then
      consider n be Element of NAT such that
A24:   a.n = x by FUNCT_2:113;
      c.n = x0 by A10;
      then x = f1.x0 by A17,A24,FUNCT_2:108;
      hence x in {f1.x0} by TARSKI:def 1;
     end; then
A25: rng a c= {f1.x0};

     now let x be Real;
A26:  a.0 in rng a by VALUED_0:28;
      assume x in {f1.x0}; then
A27:  x = f1.x0 by TARSKI:def 1;
      c.0 = x0 by A10;
      hence x in rng a by A17,A27,A26,FUNCT_2:108;
     end; then
     {f1.x0} c= rng a; then
A28: rng a = { f1.x0 } by A25,XBOOLE_0:def 10;

A29: now
      let n be Nat;
      a.n in rng a by VALUED_0:28;
      then
A30:  a.n = f1.x0 by A25,TARSKI:def 1;
      a.(n+1) in rng a by VALUED_0:28;
      hence a.n = a.(n+1) by A25,A30,TARSKI:def 1;
     end; then
A31:  a is constant by VALUED_0:25;

     reconsider a as constant Real_Sequence by A29,VALUED_0:25;
     a.0 in rng a by VALUED_0:28;
     then a.0 = f1.x0 by A25,TARSKI:def 1;
     then lim a = f1.x0 by SEQ_4:25;
     then
A32: lim d = f1.x0 - f1.x0 by A21,A22,SEQ_2:12 .= 0;

     h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent &
     lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = diff(f2,f1.x0)*Rdiff(f1,x0)
     proof
      per cases;
      suppose
       ex k be Element of NAT st for n be Element of NAT
        st k <= n holds (f1/*(h+c)).n <> f1.x0;
       then consider k be Element of NAT such that
A33:    for n be Element of NAT st k <= n holds (f1/*(h+c)).n <> f1.x0;
A34:    now
        given n being Nat such that
A35:     (d^\k).n = 0;

        0 = d.(n + k) by A35,NAT_1:def 3
         .= (f1/*(h+c)).(n+k) - (f1/*c).(n+k) by RFUNCT_2:1
         .= (f1/*(h+c)).(n+k) - f1.(c.(n+k)) by A17,FUNCT_2:108
         .= (f1/*(h+c)).(n+k) - f1.x0 by A10;
        hence contradiction by A33,NAT_1:12;
       end;

       set c1 = c^\k;
       set h1 = h^\k;
       set a1 = a^\k;
       set s = h1"(#)(f1/*(h1 + c1) - f1/*c1);

A36:   now
        let n be Element of NAT;
        thus (d + a).n = d.n + a.n by SEQ_1:7
           .= (f1/*(h+c)).n - a.n + a.n by RFUNCT_2:1
           .= (f1/*(h+c)).n;
       end;

       lim (d^\k) = 0 by A31,A21,A32,SEQ_4:20;
       then reconsider d1 = d^\k as 0-convergent non-zero Real_Sequence
          by A31,A21,A34,SEQ_1:5,FDIFF_1:def 1;

       set t = d1"(#)(f2/*(d1 + a1) - f2/*a1);

       d1 + a1 = (d + a)^\k by SEQM_3:15; then
A37:   d1 + a1 = (f1/*(h+c))^\k by A36,FUNCT_2:63;

       rng ((f1/*(h+c))^\k) c= rng (f1/*(h+c)) by VALUED_0:21;
       then
A38:   rng (d1 + a1) c= dom f2 by A23,A37;
A39:   rng a1 = {f1.x0} by A28,VALUED_0:26;
       then
A40:   lim t = diff(f2,f1.x0) by A2,A38,FDIFF_2:12;
       diff(f2,f1.x0) = diff(f2,f1.x0);
       then
A41:   t is convergent by A2,A39,A38,FDIFF_2:12;
       rng ((h + c)^\k) c= rng (h + c) by VALUED_0:21;
       then rng ((h + c)^\k) c= right_open_halfline x0 /\ dom f1 by A11;
       then
A42:   rng (h1 + c1) c= right_open_halfline x0 /\ dom f1 by SEQM_3:15;
       right_open_halfline x0 /\ dom f1 c= dom f1 by XBOOLE_1:17; then
A43:   rng (h1+c1) c= dom f1 by A42;
A44:   rng c1 = {x0} by A7,VALUED_0:26;
A45:   for n be Nat holds h1.n > 0
       proof
        let n be Nat;
        h1.n = h.(k+n) by NAT_1:def 3;
        hence h1.n > 0 by A9;
       end;
       Rdiff(f1,x0) = Rdiff(f1,x0);
       then
A46:   s is convergent by A1,A44,A45,A43,FDIFF_3:15;

A47:   t(#)s = d1"(#)(f2/*(d1+a1) - f2/*a1) (#) ((f1/*((h+c)^\k) - f1/*
        c1) (#)h1") by SEQM_3:15
          .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#) (((f1/*(h+c))^\k - f1/*c1)(#)
        h1") by A15,XBOOLE_1:18,VALUED_0:27
          .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#) (((f1/*(h+c))^\k - (f1/*c)^\k)
        (#)h1") by A17,VALUED_0:27
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (((f1/*(h+c))^\k - (f1/*c)^\k)
        (#)h1") by VALUED_1:def 10
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (d1(#)h1") by SEQM_3:17
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) d1(#)h1" by SEQ_1:14
          .= (f2/*(d1+a1) - f2/*a1) (#) h1" by SEQ_1:37
          .= ((f2/*(f1/*(h+c)))^\k - f2/*a1) (#) h1" by A23,A37,VALUED_0:27
          .= (((f2*f1)/*(h+c))^\k - f2/*a1) (#) h1" by A8,VALUED_0:31
          .= (((f2*f1)/*(h+c))^\k - ((f2/*a)^\k)) (#) h1"
              by A6,A28,ZFMISC_1:31,VALUED_0:27
          .= (((f2*f1)/*(h+c))^\k - (((f2*f1)/*c)^\k)) (#) h1"
              by A7,A5,ZFMISC_1:31,VALUED_0:31
          .= (((f2*f1)/*(h+c) - (f2*f1)/*c)^\k) (#) h1" by SEQM_3:17
          .= (((f2*f1)/*(h+c) - (f2*f1)/*c)^\k) (#) ((h")^\k) by SEQM_3:18
          .= (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\k by SEQM_3:19;
       hence h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
         by A46,A41,SEQ_4:21;

       lim s = Rdiff(f1,x0) by A1,A44,A45,A43,FDIFF_3:15;
       then lim ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\k) = diff(f2,f1.x0) *
       Rdiff(f1,x0 ) by A47,A46,A41,A40,SEQ_2:15;
       hence thesis by A47,A46,A41,SEQ_4:22;
      end;
      suppose
A48:   for k be Element of NAT
        ex n be Element of NAT st k <= n & (f1/*(h+c)).n = f1.x0;

       defpred P[object] means $1 = f1.x0;

A49:   for k be Element of NAT ex n be Element of NAT
          st k <= n & P[(f1/*(h+c)).n] by A48;
       consider I1 be increasing sequence of NAT such that
A50:    for n being Nat holds P[(f1/*(h+c)*I1).n] and
        for n be Element of NAT st for r be Real st r = (f1/*(h+c)).n holds
          P[r] ex m be Element of NAT st n = I1.m
        from FDIFF_2:sch 1(A49);

       reconsider h1 = h*I1 as 0-convergent non-zero Real_Sequence
          by FDIFF_2:6;

       set c1 = c*I1;
A51:   c1 = c by VALUED_0:26;
A52:   rng c1 = {x0} by A7,VALUED_0:26;

A53:    rng h1 c= rng h by VALUED_0:21;

A54:   for n be Nat holds h1.n > 0
       proof
        let n be Nat;
        dom h1 = NAT by FUNCT_2:def 1; then
        n in dom h1 by ORDINAL1:def 12; then
        h1.n in rng h by A53,FUNCT_1:3; then
        ex m be Element of NAT st h1.n = h.m by FUNCT_2:113;
        hence h1.n > 0 by A9;
       end;

       reconsider c1 as constant Real_Sequence;
A55:   now
        let g be Real such that
A56:    0 < g;
        reconsider n = 0 as Nat;
        take n;
        let m be Nat such that n <= m;
A57:    m in NAT by ORDINAL1:def 12;
        |.(h1"(#)(f1/*(h1+c1) - f1/*c1)).m - 0 .| = |.(h1").m *(f1/*(
          h1+c1) - f1/*c1).m.| by SEQ_1:8
         .= |.(h1").m *((f1/*(h1+c1)).m - (f1/*c1).m).| by RFUNCT_2:1
         .= |.(h1").m *((f1/*(h1+c1)).m - f1.(c.m)).|
             by A17,A51,A57,FUNCT_2:108
         .= |.(h1").m *((f1/*(h1+c1)).m - f1.x0).| by A10
         .= |.(h1").m *((f1/*((h+c)*I1)).m - f1.x0).| by RFUNCT_2:2
         .= |.(h1").m *((f1/*(h+c)*I1).m - f1.x0).|
             by A15,XBOOLE_1:18,FUNCT_2:110
         .= |.(h1").m *(f1.x0 - f1.x0).| by A50
         .= 0 by ABSVALUE:2;
        hence |.(h1"(#)(f1/*(h1+c1) - f1/*c1)).m - 0 .| < g by A56;
       end;

       rng ((h + c)*I1) c= rng (h + c) by VALUED_0:21;
       then rng ((h + c)*I1) c= dom f1 by A16;
       then
A58:   rng (h1 + c1) c= dom f1 by RFUNCT_2:2;
       then
A59:   lim (h1"(#)(f1/*(h1+c1) - f1/*c1)) = Rdiff(f1,x0)
          by A1,A52,A54,FDIFF_3:15;

       Rdiff(f1,x0) = Rdiff(f1,x0);
       then h1"(#)(f1/*(h1+c1) - f1/*c1) is convergent
          by A1,A52,A58,A54,FDIFF_3:15;
       then
A60:   Rdiff(f1,x0) = 0 by A59,A55,SEQ_2:def 7;

       now per cases;
        suppose
         ex k be Element of NAT st
          for n be Element of NAT st k <= n holds (f1/*(h+c)).n = f1.x0;
         then consider k be Element of NAT such that
A61:      for n be Element of NAT st k <= n holds (f1/*(h+c)).n = f1.x0;

A62:     now let g be Real such that
A63:       0 < g;
          reconsider n = k as Nat;
          take n;
          let m be Nat;
A64:      m in NAT by ORDINAL1:def 12;
          assume n <= m;
          then
A65:      (f1/*(h+c)).m = f1.x0 by A61,A64;

          |.(h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)).m
              - diff(f2,f1.x0)*Rdiff(f1, x0 ) .|
            = |.(h").m * ((f2*f1)/*(h+c) - (f2*f1)/*c).m.| by A60,SEQ_1:8
           .= |.(h").m * (((f2*f1)/*(h+c)).m - ((f2*f1)/*c).m).|
               by RFUNCT_2:1
           .= |.(h").m * ((f2/*(f1/*(h+c))).m - ((f2*f1)/*c).m).|
               by A8,VALUED_0:31
           .= |.(h").m * (f2.((f1/*(h+c)).m) - ((f2*f1)/*c).m).|
               by A23,FUNCT_2:108,A64
           .= |.(h").m * (f2.(f1.x0) - (f2/*(f1/*c)).m).|
               by A7,A5,ZFMISC_1:31,A65,VALUED_0:31
           .= |.(h").m * (f2.(f1.x0) - f2.((f1/*c).m)).|
               by A6,A28,ZFMISC_1:31,FUNCT_2:108,A64
           .= |.(h").m * (f2.(f1.x0) - f2.(f1.(c.m))).| by A17,FUNCT_2:108,A64
           .= |.(h").m * (f2.(f1.x0) - f2.(f1.x0)).| by A10
           .= 0 by ABSVALUE:2;
          hence
              |.(h"(#) ((f2*f1)/*(h+c) - (f2*f1)/*c)).m - diff(f2,f1.x0
              )*Rdiff(f1,x0).|<g by A63;
         end;
         hence h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent by SEQ_2:def 6;
         hence lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = diff(f2,f1.x0)*
            Rdiff(f1,x0) by A62,SEQ_2:def 7;
        end;
        suppose
A66:     for k be Element of NAT
          ex n be Element of NAT st k <= n & (f1/*(h+c)).n <> f1.x0;

         defpred P[object] means $1 <> f1.x0;

A67:     for k be Element of NAT
          ex n be Element of NAT st k <= n & P[(f1/*(h+c)).n] by A66;

         consider I2 be increasing sequence of NAT such that
A68:      for n being Nat holds P[(f1/*(h+c)*I2).n] and
A69:      for n be Element of NAT st
           for r be Real st r = (f1/*(h+c)).n holds P[r]
             ex m be Element of NAT st n
            = I2.m from FDIFF_2:sch 1(A67);

A70:      now
          given n being Nat such that
A71:       (d*I2).n = 0;
          0 = d.(I2.n) by A71,ORDINAL1:def 12,FUNCT_2:15
           .= (f1/*(h+c)).(I2.n) - (f1/*c).(I2.n) by RFUNCT_2:1
           .= (f1/*(h+c)).(I2.n) - f1.(c.(I2.n)) by A17,FUNCT_2:108
           .= (f1/*(h+c)).(I2.n) - f1.x0 by A10
           .= (f1/*(h+c)*I2).n - f1.x0 by FUNCT_2:15,ORDINAL1:def 12;
          hence contradiction by A68;
         end;

         reconsider h2 = h*I2 as 0-convergent non-zero
              Real_Sequence by FDIFF_2:6;
         reconsider a1 = a*I2 as constant Real_Sequence;
         reconsider c2 = c*I2 as constant Real_Sequence;
         set s = h2"(#)(f1/*(h2+c2) - f1/*c2);

         lim (d*I2) = 0 by A31,A21,A32,SEQ_4:17;
         then reconsider d1 = d*I2 as 0-convergent non-zero Real_Sequence
           by A31,A21,SEQ_4:16,A70,SEQ_1:5,FDIFF_1:def 1;

         set t = d1"(#)(f2/*(d1+a1) - f2/*a1);

A72:     rng a1 = {f1.x0} by A28,VALUED_0:26;
A73:     now
          let n be Element of NAT;
          thus (d + a).n = d.n + a.n by SEQ_1:7
             .= (f1/*(h+c)).n - a.n + a.n by RFUNCT_2:1
             .= (f1/*(h+c)).n;
         end;

         d1 + a1 = (d + a)*I2 by RFUNCT_2:2; then
A74:     d1 + a1 = f1/*(h+c)*I2 by A73,FUNCT_2:63;

A75:     t(#)s = d1"(#)(f2/*(d1+a1) - f2/*a1) (#) ((f1/*((h + c)*I2)
            - f1/*c2)(#)h2") by RFUNCT_2:2
              .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#) ((f1/*(h+c)*I2 - f1/*c2)
            (#)h2") by A15,XBOOLE_1:18,FUNCT_2:110
              .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#) ((f1/*(h+c)*I2 - f1/*c*I2)
            (#)h2") by A17,FUNCT_2:110
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) ((f1/*(h+c)*I2 - f1/*c*I2)
            (#)h2") by VALUED_1:def 10
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (d1(#)h2") by RFUNCT_2:2
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) d1(#)h2" by SEQ_1:14
              .= (f2/*(d1+a1) - f2/*a1) (#) h2" by SEQ_1:37
              .= (f2/*(f1/*(h+c))*I2 - f2/*a1) (#) h2" by A23,A74,FUNCT_2:110
              .= ((f2*f1)/*(h+c)*I2 - f2/*a1) (#) h2" by A8,VALUED_0:31
              .= (((f2*f1)/*(h+c))*I2 - (f2/*a*I2)) (#) h2"
                  by A6,A28,ZFMISC_1:31,FUNCT_2:110
              .= (((f2*f1)/*(h+c))*I2 - (((f2*f1)/*c)*I2)) (#) h2"
                  by A7,A5,ZFMISC_1:31,VALUED_0:31
              .= (((f2*f1)/*(h+c) - (f2*f1)/*c)*I2) (#) h2" by RFUNCT_2:2
              .= (((f2*f1)/*(h+c) - (f2*f1)/*c)*I2) (#) ((h")*I2) by RFUNCT_2:5
              .= (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))*I2 by RFUNCT_2:2;

         rng (f1/*(h+c)*I2) c= rng (f1/*(h+c)) by VALUED_0:21; then
A76:     rng (d1 + a1) c= dom f2 by A23,A74;

         rng ((h + c)*I2) c= rng (h + c) by VALUED_0:21; then
         rng ((h + c)*I2) c= dom f1 by A16; then
A77:     rng (h2 + c2) c= dom f1 by RFUNCT_2:2;

A78:    rng h2 c= rng h by VALUED_0:21;

A79:     for n be Nat holds h2.n > 0
         proof
          let n be Nat;
          dom h2 = NAT by FUNCT_2:def 1; then
          h2.n in rng h2 by FUNCT_1:3,ORDINAL1:def 12; then
          ex m be Element of NAT st h2.n = h.m by A78,FUNCT_2:113;
          hence h2.n > 0 by A9;
         end;

A80:     rng c2 = {x0} by A7,VALUED_0:26; then
A81:     lim s = Rdiff(f1,x0) by A1,A77,A79,FDIFF_3:15;

         Rdiff(f1,x0) = Rdiff(f1,x0); then
A82:     s is convergent by A1,A80,A77,A79,FDIFF_3:15;
         diff(f2,f1.x0) = diff(f2,f1.x0); then
A83:     t is convergent by A2,A72,A76,FDIFF_2:12;

         lim t = diff(f2,f1.x0) by A2,A72,A76,FDIFF_2:12; then
A84:     lim ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))*I2)
          = diff(f2,f1.x0) * Rdiff(f1,x0) by A75,A82,A81,A83,SEQ_2:15;
A85:     now
          set DF = diff(f2,f1.x0) * Rdiff(f1,x0);
          let g be Real;
          assume
A86:       0 < g; then
          consider k being Nat such that
A87:       for m being Nat st k <= m holds |.((h"(#)((f2*f1)/*(h+c)-(f2*
              f1)/*c))*I2).m - DF.|<g by A75,A82,A83,A84,SEQ_2:def 7;
A88:      k in NAT by ORDINAL1:def 12;
          reconsider n = I2.k as Nat;
          take n;
          let m be Nat such that
A89:       n <= m;
A90:      m in NAT by ORDINAL1:def 12;
          now per cases;
           suppose
A91:         (f1/*(h+c)).m = f1.x0;
            |.(h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)).m - DF.|
              = |.(h").m * (((f2*f1)/*(h+c) - (f2*f1)/*c).m).| by A60,SEQ_1:8
             .= |.(h").m * (((f2*f1)/*(h+c)).m - ((f2*f1)/*c).m).|
                   by RFUNCT_2:1
             .= |.(h").m*(((f2*f1)/*(h+c)).m -(f2/*(f1/*c)).m).|
                   by A7,A5,ZFMISC_1:31,VALUED_0:31
             .= |.(h").m*(((f2*f1)/*(h+c)).m -f2.((f1/*c).m)).|
                   by A6,A28,ZFMISC_1:31,FUNCT_2:108,A90
             .= |.(h").m*(((f2*f1)/*(h+c)).m -f2.(f1.(c.m))).|
                   by A17,FUNCT_2:108,A90
             .= |.(h").m * (((f2*f1)/*(h+c)).m - f2.(f1.x0)).| by A10
             .= |.(h").m *((f2/*(f1/*(h+c))).m - f2.(f1.x0)).|
                   by A8,VALUED_0:31
             .= |.(h").m*(f2.(f1.x0) - f2.(f1.x0)).|
                   by A23,A91,FUNCT_2:108,A90
             .= 0 by ABSVALUE:2;
            hence |.(h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)).m
                    - diff(f2,f1.x0)*Rdiff(f1,x0) .| < g by A86;
           end;
           suppose
            (f1/*(h+c)).m <> f1.x0;
            then for r1 be Real holds (f1/*(h+c)).m=r1 implies r1<>f1.x0;
            then consider l be Element of NAT such that
A92:         m = I2.l by A69,A90;
            dom I2 = NAT by FUNCT_2:def 1;
            then l >= k by A89,A92,VALUED_0:def 13,A88;
            then |.((h"(#)((f2*f1)/*(h+c)-(f2*f1)/*c))*I2).l - DF.| < g by A87;
            hence |.(h"(#)((f2*f1)/*(h+c)-(f2*f1)/*c)).m - DF.| < g
               by A92,FUNCT_2:15;
           end;
          end;
          hence |.(h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)).m
                    - diff(f2,f1.x0)*Rdiff(f1,x0) .| < g;
         end;
         hence h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
           by SEQ_2:def 6;
         hence lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))
                = diff(f2,f1.x0) * Rdiff(f1,x0) by A85,SEQ_2:def 7;
        end;
       end;
       hence thesis;
      end;
     end;
     hence thesis;
    end;
    hence thesis by A3,FDIFF_3:15;
end;

Lm21:
for x0 be Real, f1,f2 be PartFunc of REAL,REAL st
 f1 is_left_differentiable_in x0 & f2 is_differentiable_in f1.x0 holds
   (ex r be Real st r>0 & [.x0-r,x0.] c= dom(f2*f1))
proof
    let x0 be Real, f1,f2 be PartFunc of REAL,REAL;
    assume that
A1:  f1 is_left_differentiable_in x0 and
A2:  f2 is_differentiable_in f1.x0;

    consider r1 be Real such that
A3:  r1 > 0 & [.x0-r1,x0.] c= dom f1 by A1,FDIFF_3:def 4;
    consider N2 be Neighbourhood of f1.x0 such that
A4:  N2 c= dom f2 by A2;

    x0 in ].-infty,x0.] by XXREAL_1:234; then
A5: x0 in left_closed_halfline x0 by LIMFUNC1:def 1;
    set ff1 = f1|(left_closed_halfline x0);

    reconsider N2 as Neighbourhood of ff1.x0 by A5,FUNCT_1:49;

    ff1 is_continuous_in x0 by A1,FDIFF_3:5,Th36; then

    consider N3 be Neighbourhood of x0 such that
A6:  ff1.:N3 c= N2 by FCONT_1:5;
    consider r2 be Real such that
A7:  r2 > 0 & N3 = ].x0-r2,x0+r2.[ by RCOMP_1:def 6;

    set r3 = min(r1,r2);
A8: r3 > 0 by A3,A7,XXREAL_0:21;
A9: x0-r1 <= x0-r3 & x0-r2 <= x0-r3 by XREAL_1:10,XXREAL_0:17;

    consider x1 be Real such that
A10:  x0-r3 < x1 & x1 < x0 by A8,XREAL_1:5,44;
    take r = x0-x1;
    thus r > 0 by A10,XREAL_1:50;

A11: x0 < x0+r2 by A7,XREAL_1:29;
A12: x0-r1 < x0-r & x0-r2 < x0-r by A9,A10,XXREAL_0:2; then
A13: [. x0-r,x0 .] c= N3 by A7,A11,XXREAL_1:47;

    [. x0-r,x0 .] c= [. x0-r1,x0 .] by A12,XXREAL_1:34; then
A14: [. x0-r,x0 .] c= dom f1 by A3;

    now let x be Real;
     assume
A15:  x in [.x0-r,x0.];

     x <= x0 by A15,XXREAL_1:1; then
     x in ].-infty,x0.] by XXREAL_1:234; then
A16: x in left_closed_halfline x0 by LIMFUNC1:def 1; then
A17: ff1.x = f1.x by FUNCT_1:49;

A18: x in dom ff1 by A15,A14,A16,RELAT_1:57;
     ff1.x in ff1.:N3 by A13,A15,A18,FUNCT_1:def 6; then
     f1.x in dom f2 by A6,A4,A17;
     hence x in dom(f2*f1) by A15,A14,FUNCT_1:11;
    end;
    hence [.x0-r,x0.] c= dom(f2*f1);
end;

theorem Th41:
for x0 be Real, f1,f2 be PartFunc of REAL,REAL st
 f1 is_left_differentiable_in x0 & f2 is_differentiable_in f1.x0 holds
 f2*f1 is_left_differentiable_in x0 &
 Ldiff(f2*f1,x0) = diff(f2,f1.x0)*Ldiff(f1,x0)
proof
    let x0 be Real, f1,f2 be PartFunc of REAL,REAL;
    assume that
A1:  f1 is_left_differentiable_in x0 and
A2:  f2 is_differentiable_in f1.x0;

    consider r be Real such that
A3:  r > 0 & [.x0-r,x0.] c= dom(f2*f1) by A1,A2,Lm21;

A4: f1 is_Lcontinuous_in x0 by A1,FDIFF_3:5;

    x0-r < x0 by A3,XREAL_1:44; then
A5: x0 in dom(f2*f1) by A3,XXREAL_1:1; then
A6: f1.x0 in dom f2 by FUNCT_1:11;

    for h,c st rng c = {x0} & rng (h + c) c= dom (f2*f1) &
     (for n be Nat holds h.n < 0) holds
     h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
   & lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = diff(f2,f1.x0)*Ldiff(f1,x0)
    proof
     let h,c;
     assume that
A7:   rng c = {x0} and
A8:   rng (h + c) c= dom (f2*f1) and
A9:   for n be Nat holds h.n < 0;

A10:  for n be Nat holds c.n = x0
     proof
      let n be Nat;
      c.n in rng c by VALUED_0:28;
      hence c.n = x0 by A7,TARSKI:def 1;
     end;

A11:  now let x be Real;
      assume
A12:    x in rng(h+c); then
      consider n be Element of NAT such that
A13:    x = (h+c).n by FUNCT_2:113;
      x = h.n + c.n by A13,SEQ_1:7; then
      x = h.n + x0 by A10; then
      x < x0 by A9,XREAL_1:30; then
      x in ].-infty,x0.[ by XXREAL_1:233; then
A14:   x in left_open_halfline x0 by PROB_1:def 10;
      x in dom f1 by A12,A8,FUNCT_1:11;
      hence x in left_open_halfline x0 /\ dom f1 by A14,XBOOLE_0:def 4;
     end; then
A15:  rng (h + c) c= left_open_halfline x0 /\ dom f1; then
A16:  rng (h+c) c= dom f1 by XBOOLE_1:18;
A17: rng c c= dom f1 by A7,A4,FDIFF_3:def 1,ZFMISC_1:31;

     set a = f1/*c;
     set d = f1/*(h+c) - f1/*c;

A18: lim h = 0;

     lim c = c.0 by SEQ_4:25; then
     lim c = x0 by A10; then
A19: lim (h + c) = 0 + x0 by A18,SEQ_2:6 .= x0;

A20: f1 is_Lcontinuous_in x0 by A1,FDIFF_3:5; then
A21: f1/*(h+c) is convergent by A15,A19,FDIFF_3:def 1;

A22: f1.x0 = lim (f1/*(h+c)) by A15,A19,A20,FDIFF_3:def 1;
A23: rng (f1/*(h+c)) c= dom f2 by A8,FDIFF_2:9;
     now let x be Real;
      assume x in rng a; then
      consider n be Element of NAT such that
A24:   a.n = x by FUNCT_2:113;
      c.n = x0 by A10;
      then x = f1.x0 by A17,A24,FUNCT_2:108;
      hence x in {f1.x0} by TARSKI:def 1;
     end; then
A25: rng a c= {f1.x0};

     now let x be Real;
A26:  a.0 in rng a by VALUED_0:28;
      assume x in {f1.x0}; then
A27:  x = f1.x0 by TARSKI:def 1;
      c.0 = x0 by A10;
      hence x in rng a by A17,A27,A26,FUNCT_2:108;
     end; then
     {f1.x0} c= rng a; then
A28: rng a = { f1.x0 } by A25,XBOOLE_0:def 10;

A29: now
      let n be Nat;
      a.n in rng a by VALUED_0:28;
      then
A30:  a.n = f1.x0 by A25,TARSKI:def 1;
      a.(n+1) in rng a by VALUED_0:28;
      hence a.n = a.(n+1) by A25,A30,TARSKI:def 1;
     end; then
A31:  a is constant by VALUED_0:25;

     reconsider a as constant Real_Sequence by A29,VALUED_0:25;
     a.0 in rng a by VALUED_0:28;
     then a.0 = f1.x0 by A25,TARSKI:def 1;
     then lim a = f1.x0 by SEQ_4:25;
     then
A32: lim d = f1.x0 - f1.x0 by A21,A22,SEQ_2:12 .= 0;

     h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent &
     lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = diff(f2,f1.x0)*Ldiff(f1,x0)
     proof
      per cases;
      suppose
       ex k be Element of NAT st for n be Element of NAT
        st k <= n holds (f1/*(h+c)).n <> f1.x0;
       then consider k be Element of NAT such that
A33:    for n be Element of NAT st k <= n holds (f1/*(h+c)).n <> f1.x0;
A34:    now
        given n being Nat such that
A35:     (d^\k).n = 0;

        0 = d.(n + k) by A35,NAT_1:def 3
         .= (f1/*(h+c)).(n+k) - (f1/*c).(n+k) by RFUNCT_2:1
         .= (f1/*(h+c)).(n+k) - f1.(c.(n+k)) by A17,FUNCT_2:108
         .= (f1/*(h+c)).(n+k) - f1.x0 by A10;
        hence contradiction by A33,NAT_1:12;
       end;

       set c1 = c^\k;
       set h1 = h^\k;
       set a1 = a^\k;
       set s = h1"(#)(f1/*(h1 + c1) - f1/*c1);

A36:   now
        let n be Element of NAT;
        thus (d + a).n = d.n + a.n by SEQ_1:7
           .= (f1/*(h+c)).n - a.n + a.n by RFUNCT_2:1
           .= (f1/*(h+c)).n;
       end;

       lim (d^\k) = 0 by A31,A21,A32,SEQ_4:20;
       then reconsider d1 = d^\k as 0-convergent non-zero Real_Sequence
          by A31,A21,A34,SEQ_1:5,FDIFF_1:def 1;

       set t = d1"(#)(f2/*(d1 + a1) - f2/*a1);

       d1 + a1 = (d + a)^\k by SEQM_3:15;
       then
A37:   d1 + a1 = (f1/*(h+c))^\k by A36,FUNCT_2:63;

       rng ((f1/*(h+c))^\k) c= rng (f1/*(h+c)) by VALUED_0:21;
       then
A38:   rng (d1 + a1) c= dom f2 by A23,A37;
A39:   rng a1 = {f1.x0} by A28,VALUED_0:26;
       then
A40:   lim t = diff(f2,f1.x0) by A2,A38,FDIFF_2:12;
       diff(f2,f1.x0) = diff(f2,f1.x0);
       then
A41:   t is convergent by A2,A39,A38,FDIFF_2:12;
       rng ((h + c)^\k) c= rng (h + c) by VALUED_0:21;
       then rng ((h + c)^\k) c= left_open_halfline x0 /\ dom f1 by A11;
       then
A42:   rng (h1 + c1) c= left_open_halfline x0 /\ dom f1 by SEQM_3:15;
       left_open_halfline x0 /\ dom f1 c= dom f1 by XBOOLE_1:17; then
A43:   rng (h1+c1) c= dom f1 by A42;
A44:   rng c1 = {x0} by A7,VALUED_0:26;
A45:   for n be Nat holds h1.n < 0
       proof
        let n be Nat;
        h1.n = h.(k+n) by NAT_1:def 3;
        hence h1.n < 0 by A9;
       end;
       Ldiff(f1,x0) = Ldiff(f1,x0);
       then
A46:   s is convergent by A1,A44,A45,A43,FDIFF_3:9;

A47:   t(#)s = d1"(#)(f2/*(d1+a1) - f2/*a1) (#) ((f1/*((h+c)^\k) - f1/*
        c1) (#)h1") by SEQM_3:15
          .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#) (((f1/*(h+c))^\k - f1/*c1)(#)
        h1") by A15,XBOOLE_1:18,VALUED_0:27
          .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#) (((f1/*(h+c))^\k - (f1/*c)^\k)
        (#)h1") by A17,VALUED_0:27
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (((f1/*(h+c))^\k - (f1/*c)^\k)
        (#)h1") by VALUED_1:def 10
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (d1(#)h1") by SEQM_3:17
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) d1(#)h1" by SEQ_1:14
          .= (f2/*(d1+a1) - f2/*a1) (#) h1" by SEQ_1:37
          .= ((f2/*(f1/*(h+c)))^\k - f2/*a1) (#) h1" by A23,A37,VALUED_0:27
          .= (((f2*f1)/*(h+c))^\k - f2/*a1) (#) h1" by A8,VALUED_0:31
          .= (((f2*f1)/*(h+c))^\k - ((f2/*a)^\k)) (#) h1"
              by A6,A28,ZFMISC_1:31,VALUED_0:27
          .= (((f2*f1)/*(h+c))^\k - (((f2*f1)/*c)^\k)) (#) h1"
              by A7,A5,ZFMISC_1:31,VALUED_0:31
          .= (((f2*f1)/*(h+c) - (f2*f1)/*c)^\k) (#) h1" by SEQM_3:17
          .= (((f2*f1)/*(h+c) - (f2*f1)/*c)^\k) (#) ((h")^\k) by SEQM_3:18
          .= (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\k by SEQM_3:19;
       hence h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
         by A46,A41,SEQ_4:21;

       lim s = Ldiff(f1,x0) by A1,A44,A45,A43,FDIFF_3:9;
       then lim ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\k) = diff(f2,f1.x0) *
       Ldiff(f1,x0 ) by A47,A46,A41,A40,SEQ_2:15;
       hence thesis by A47,A46,A41,SEQ_4:22;
      end;
      suppose
A48:   for k be Element of NAT
        ex n be Element of NAT st k <= n & (f1/*(h+c)).n = f1.x0;

       defpred P[object] means $1 = f1.x0;

A49:   for k be Element of NAT ex n be Element of NAT
          st k <= n & P[(f1/*(h+c)).n] by A48;
       consider I1 be increasing sequence of NAT such that
A50:    for n being Nat holds P[(f1/*(h+c)*I1).n] and
        for n be Element of NAT st for r be Real st r = (f1/*(h+c)).n holds
          P[r] ex m be Element of NAT st n = I1.m
        from FDIFF_2:sch 1(A49);

       reconsider h1 = h*I1 as 0-convergent non-zero Real_Sequence
          by FDIFF_2:6;

       set c1 = c*I1;
A51:   c1 = c by VALUED_0:26;
A52:   rng c1 = {x0} by A7,VALUED_0:26;

A53:    rng h1 c= rng h by VALUED_0:21;

A54:   for n be Nat holds h1.n < 0
       proof
        let n be Nat;
        dom h1 = NAT by FUNCT_2:def 1; then
        n in dom h1 by ORDINAL1:def 12; then
        h1.n in rng h by A53,FUNCT_1:3; then
        ex m be Element of NAT st h1.n = h.m by FUNCT_2:113;
        hence h1.n < 0 by A9;
       end;

       reconsider c1 as constant Real_Sequence;
A55:   now
        let g be Real such that
A56:    0 < g;
        reconsider n = 0 as Nat;
        take n;
        let m be Nat such that n <= m;
A57:    m in NAT by ORDINAL1:def 12;
        |.(h1"(#)(f1/*(h1+c1) - f1/*c1)).m - 0 .| = |.(h1").m *(f1/*(
          h1+c1) - f1/*c1).m.| by SEQ_1:8
         .= |.(h1").m *((f1/*(h1+c1)).m - (f1/*c1).m).| by RFUNCT_2:1
         .= |.(h1").m *((f1/*(h1+c1)).m - f1.(c.m)).| by A17,A51,A57,
FUNCT_2:108
         .= |.(h1").m *((f1/*(h1+c1)).m - f1.x0).| by A10
         .= |.(h1").m *((f1/*((h+c)*I1)).m - f1.x0).| by RFUNCT_2:2
         .= |.(h1").m *((f1/*(h+c)*I1).m - f1.x0).|
             by A15,XBOOLE_1:18,FUNCT_2:110
         .= |.(h1").m *(f1.x0 - f1.x0).| by A50
         .= 0 by ABSVALUE:2;
        hence |.(h1"(#)(f1/*(h1+c1) - f1/*c1)).m - 0 .| < g by A56;
       end;

       rng ((h + c)*I1) c= rng (h + c) by VALUED_0:21;
       then rng ((h + c)*I1) c= dom f1 by A16;
       then
A58:   rng (h1 + c1) c= dom f1 by RFUNCT_2:2;
       then
A59:   lim (h1"(#)(f1/*(h1+c1) - f1/*c1)) = Ldiff(f1,x0)
          by A1,A52,A54,FDIFF_3:9;

       Ldiff(f1,x0) = Ldiff(f1,x0);
       then h1"(#)(f1/*(h1+c1) - f1/*c1) is convergent
          by A1,A52,A58,A54,FDIFF_3:9;
       then
A60:   Ldiff(f1,x0) = 0 by A59,A55,SEQ_2:def 7;

       now per cases;
        suppose
         ex k be Element of NAT st
          for n be Element of NAT st k <= n holds (f1/*(h+c)).n = f1.x0;
         then consider k be Element of NAT such that
A61:      for n be Element of NAT st k <= n holds (f1/*(h+c)).n = f1.x0;

A62:     now let g be Real such that
A63:       0 < g;
          reconsider n = k as Nat;
          take n;
          let m be Nat;
A64:      m in NAT by ORDINAL1:def 12;
          assume n <= m;
          then
A65:      (f1/*(h+c)).m = f1.x0 by A61,A64;

          |.(h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)).m - diff(f2,f1.x0
)*Ldiff(f1, x0 ) .| = |.(h").m * ((f2*f1)/*(h+c) - (f2*f1)/*c).m.| by A60,
SEQ_1:8
           .= |.(h").m * (((f2*f1)/*(h+c)).m - ((f2*f1)/*c).m).| by
RFUNCT_2:1
           .= |.(h").m * ((f2/*(f1/*(h+c))).m - ((f2*f1)/*c).m).| by A8,
VALUED_0:31
           .= |.(h").m * (f2.((f1/*(h+c)).m) - ((f2*f1)/*c).m).| by A23,
FUNCT_2:108,A64
           .= |.(h").m * (f2.(f1.x0) - (f2/*(f1/*c)).m).|
               by A7,A5,ZFMISC_1:31,A65,VALUED_0:31
           .= |.(h").m * (f2.(f1.x0) - f2.((f1/*c).m)).|
               by A6,A28,ZFMISC_1:31,FUNCT_2:108,A64
           .= |.(h").m * (f2.(f1.x0) - f2.(f1.(c.m))).| by A17,
FUNCT_2:108,A64
           .= |.(h").m * (f2.(f1.x0) - f2.(f1.x0)).| by A10
           .= 0 by ABSVALUE:2;
          hence
              |.(h"(#) ((f2*f1)/*(h+c) - (f2*f1)/*c)).m - diff(f2,f1.x0
              )*Ldiff(f1,x0).|<g by A63;
         end;
         hence h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent by
SEQ_2:def 6;
         hence lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = diff(f2,f1.x0)*
            Ldiff(f1,x0) by A62,SEQ_2:def 7;
        end;
        suppose
A66:     for k be Element of NAT
          ex n be Element of NAT st k <= n & (f1/*(h+c)).n <> f1.x0;

         defpred P[object] means $1 <> f1.x0;

A67:     for k be Element of NAT
          ex n be Element of NAT st k <= n & P[(f1/*(h+c)).n] by A66;

         consider I2 be increasing sequence of NAT such that
A68:      for n being Nat holds P[(f1/*(h+c)*I2).n] and
A69:      for n be Element of NAT st
           for r be Real st r = (f1/*(h+c)).n holds P[r]
             ex m be Element of NAT st n
            = I2.m from FDIFF_2:sch 1(A67);

A70:      now
          given n being Nat such that
A71:       (d*I2).n = 0;
          0 = d.(I2.n) by A71,ORDINAL1:def 12,FUNCT_2:15
                .= (f1/*(h+c)).(I2.n) - (f1/*c).(I2.n) by RFUNCT_2:1
                .= (f1/*(h+c)).(I2.n) - f1.(c.(I2.n)) by A17,FUNCT_2:108
                .= (f1/*(h+c)).(I2.n) - f1.x0 by A10
                .= (f1/*(h+c)*I2).n - f1.x0 by FUNCT_2:15,ORDINAL1:def 12;
          hence contradiction by A68;
         end;

         reconsider h2 = h*I2 as 0-convergent non-zero
              Real_Sequence by FDIFF_2:6;
         reconsider a1 = a*I2 as constant Real_Sequence;
         reconsider c2 = c*I2 as constant Real_Sequence;
         set s = h2"(#)(f1/*(h2+c2) - f1/*c2);

         lim (d*I2) = 0 by A31,A21,A32,SEQ_4:17;
         then reconsider d1 = d*I2 as 0-convergent non-zero Real_Sequence
           by A31,A21,SEQ_4:16,A70,SEQ_1:5,FDIFF_1:def 1;

         set t = d1"(#)(f2/*(d1+a1) - f2/*a1);

A72:     rng a1 = {f1.x0} by A28,VALUED_0:26;
A73:     now
          let n be Element of NAT;
          thus (d + a).n = d.n + a.n by SEQ_1:7
             .= (f1/*(h+c)).n - a.n + a.n by RFUNCT_2:1
             .= (f1/*(h+c)).n;
         end;

         d1 + a1 = (d + a)*I2 by RFUNCT_2:2;
         then
A74:     d1 + a1 = f1/*(h+c)*I2 by A73,FUNCT_2:63;

A75:     t(#)s = d1"(#)(f2/*(d1+a1) - f2/*a1) (#) ((f1/*((h + c)*I2)
            - f1/*c2)(#)h2") by RFUNCT_2:2
              .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#) ((f1/*(h+c)*I2 - f1/*c2)
            (#)h2") by A15,XBOOLE_1:18,FUNCT_2:110
              .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#) ((f1/*(h+c)*I2 - f1/*c*I2)
            (#)h2") by A17,FUNCT_2:110
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) ((f1/*(h+c)*I2 - f1/*c*I2)
            (#)h2") by VALUED_1:def 10
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (d1(#)h2") by RFUNCT_2:2
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) d1(#)h2" by SEQ_1:14
              .= (f2/*(d1+a1) - f2/*a1) (#) h2" by SEQ_1:37
              .= (f2/*(f1/*(h+c))*I2 - f2/*a1) (#) h2" by A23,A74,FUNCT_2:110
              .= ((f2*f1)/*(h+c)*I2 - f2/*a1) (#) h2" by A8,VALUED_0:31
              .= (((f2*f1)/*(h+c))*I2 - (f2/*a*I2)) (#) h2"
                  by A6,A28,ZFMISC_1:31,FUNCT_2:110
              .= (((f2*f1)/*(h+c))*I2 - (((f2*f1)/*c)*I2)) (#) h2"
                  by A7,A5,ZFMISC_1:31,VALUED_0:31
              .= (((f2*f1)/*(h+c) - (f2*f1)/*c)*I2) (#) h2" by RFUNCT_2:2
              .= (((f2*f1)/*(h+c) - (f2*f1)/*c)*I2) (#) ((h")*I2) by RFUNCT_2:5
              .= (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))*I2 by RFUNCT_2:2;

         rng (f1/*(h+c)*I2) c= rng (f1/*(h+c)) by VALUED_0:21;
         then
A76:     rng (d1 + a1) c= dom f2 by A23,A74;

         rng ((h + c)*I2) c= rng (h + c) by VALUED_0:21;
         then rng ((h + c)*I2) c= dom f1 by A16;
         then
A77:     rng (h2 + c2) c= dom f1 by RFUNCT_2:2;
A78:    rng h2 c= rng h by VALUED_0:21;
A79:     for n be Nat holds h2.n < 0
         proof
          let n be Nat;
          dom h2 = NAT by FUNCT_2:def 1; then
          h2.n in rng h2 by FUNCT_1:3,ORDINAL1:def 12; then
          ex m be Element of NAT st h2.n = h.m by A78,FUNCT_2:113;
          hence h2.n < 0 by A9;
         end;

A80:     rng c2 = {x0} by A7,VALUED_0:26; then
A81:     lim s = Ldiff(f1,x0) by A1,A77,A79,FDIFF_3:9;

         Ldiff(f1,x0) = Ldiff(f1,x0); then
A82:     s is convergent by A1,A80,A77,A79,FDIFF_3:9;
         diff(f2,f1.x0) = diff(f2,f1.x0);
         then
A83:     t is convergent by A2,A72,A76,FDIFF_2:12;

         lim t = diff(f2,f1.x0) by A2,A72,A76,FDIFF_2:12;
         then
A84:     lim ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))*I2) = diff(f2,f1.
            x0) * Ldiff(f1,x0) by A75,A82,A81,A83,SEQ_2:15;
A85:     now
          set DF = diff(f2,f1.x0) * Ldiff(f1,x0);
          let g be Real such that
A86:       0 < g;
          consider k being Nat such that
A87:       for m being Nat st k <= m holds |.((h"(#)((f2*f1)/*(h+c)-(f2*
              f1)/*c))*I2).m - DF.|<g by A75,A82,A83,A84,A86,SEQ_2:def 7;
A88:      k in NAT by ORDINAL1:def 12;
          reconsider n = I2.k as Nat;
          take n;
          let m be Nat such that
A89:       n <= m;
A90:      m in NAT by ORDINAL1:def 12;
          now per cases;
           suppose
A91:         (f1/*(h+c)).m = f1.x0;
            |.(h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)).m - DF.|
              = |.(h").m * (((f2*f1)/*(h+c) - (f2*f1)/*c).m).| by A60,SEQ_1:8
             .= |.(h").m * (((f2*f1)/*(h+c)).m - ((f2*f1)/*c).m).|
                   by RFUNCT_2:1
             .= |.(h").m*(((f2*f1)/*(h+c)).m -(f2/*(f1/*c)).m).|
                   by A7,A5,ZFMISC_1:31,VALUED_0:31
             .= |.(h").m*(((f2*f1)/*(h+c)).m -f2.((f1/*c).m)).|
                   by A6,A28,ZFMISC_1:31,FUNCT_2:108,A90
             .= |.(h").m*(((f2*f1)/*(h+c)).m -f2.(f1.(c.m))).|
                   by A17,FUNCT_2:108,A90
             .= |.(h").m * (((f2*f1)/*(h+c)).m - f2.(f1.x0)).| by A10
             .= |.(h").m *((f2/*(f1/*(h+c))).m - f2.(f1.x0)).|
                   by A8,VALUED_0:31
             .= |.(h").m*(f2.(f1.x0) - f2.(f1.x0)).|
                   by A23,A91,FUNCT_2:108,A90
             .= 0 by ABSVALUE:2;
            hence |.(h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)).m
                    - diff(f2,f1.x0)*Ldiff(f1,x0) .| < g by A86;
           end;
           suppose
            (f1/*(h+c)).m <> f1.x0;
            then for r1 be Real holds (f1/*(h+c)).m=r1 implies r1<>f1.x0;
            then consider l be Element of NAT such that
A92:         m = I2.l by A69,A90;
            dom I2 = NAT by FUNCT_2:def 1;
            then l >= k by A89,A92,VALUED_0:def 13,A88;
            then |.((h"(#)((f2*f1)/*(h+c)-(f2*f1)/*c))*I2).l - DF.| < g by A87;
            hence |.(h"(#)((f2*f1)/*(h+c)-(f2*f1)/*c)).m - DF.| < g
               by A92,FUNCT_2:15;
           end;
          end;
          hence |.(h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)).m
                    - diff(f2,f1.x0)*Ldiff(f1,x0) .| < g;
         end;
         hence h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
           by SEQ_2:def 6;
         hence lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))
                = diff(f2,f1.x0) * Ldiff(f1,x0) by A85,SEQ_2:def 7;
        end;
       end;
       hence thesis;
      end;
     end;
     hence thesis;
    end;
    hence thesis by A3,FDIFF_3:9;
end;

theorem Th42:
for x0 be Real, f1,f2 be PartFunc of REAL,REAL st
 f1 is_right_differentiable_in x0 & f2 is_right_differentiable_in f1.x0 &
 (for r1 be Real st r1 > 0 ex r0 be Real st r0>0 &
   [.x0,x0+r0.] c= dom([.f1.x0,f1.x0+r1.]|`f1)) holds
  f2*f1 is_right_differentiable_in x0 &
  Rdiff(f2*f1,x0) = Rdiff(f2,f1.x0)*Rdiff(f1,x0)
proof
    let x0 be Real, f1,f2 be PartFunc of REAL,REAL;
    assume that
A1:  f1 is_right_differentiable_in x0 and
A2:  f2 is_right_differentiable_in f1.x0 and
A3: for r1 be Real st r1 > 0 ex r0 be Real st r0>0 &
      [.x0,x0+r0.] c= dom([.f1.x0,f1.x0+r1.]|`f1);

    consider r1 be Real such that
A4: r1 > 0 & [. f1.x0,f1.x0+r1 .] c= dom f2 by A2,FDIFF_3:def 3;

    consider r0 be Real such that
A5: r0>0 &
     [.x0,x0+r0.] c= dom([.f1.x0,f1.x0+r1.]|`f1) by A3,A4;

    set r = min(r0,r1);
A6: r > 0 by A4,A5,XXREAL_0:21;
    x0+r <= x0+r0 & f1.x0 + r <= f1.x0 + r1 by XREAL_1:6,XXREAL_0:17; then
    [.x0,x0+r.] c= [.x0,x0+r0.] & [.f1.x0,f1.x0+r.] c= [.f1.x0,f1.x0+r1.]
      by XXREAL_1:34; then
A7:[.x0,x0+r.] c= dom([.f1.x0,f1.x0+r1.]|`f1) by A5;

A8:now let x be Real;
     assume x in [.x0,x0+r.]; then
     x in dom f1 & f1.x in [.f1.x0,f1.x0+r1.] by A7,FUNCT_1:54;
     hence x in dom(f2*f1) by A4,FUNCT_1:11;
    end; then
A9:[.x0,x0+r.] c= dom(f2*f1);

    x0 < x0+r by A6,XREAL_1:29; then
A10: x0 in dom(f2*f1) by A8,XXREAL_1:1; then
A11: f1.x0 in dom f2 by FUNCT_1:11;

    for h,c st rng c = {x0} & rng (h + c) c= dom (f2*f1) &
     (for n be Nat holds h.n > 0) holds
     h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
   & lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = Rdiff(f2,f1.x0)*Rdiff(f1,x0)
    proof
     let h,c;
     assume that
A12:   rng c = {x0} and
A13:   rng (h + c) c= dom (f2*f1) and
A14:   for n be Nat holds h.n > 0;

A15: dom(f2*f1) c= dom f1 by RELAT_1:25;

A16:  for n be Nat holds c.n = x0
     proof
      let n be Nat;
      c.n in rng c by VALUED_0:28;
      hence c.n = x0 by A12,TARSKI:def 1;
     end;

A17: now let x be Real;
      assume A18: x in rng(h+c); then
      consider n be Element of NAT such that
A19:    x = (h+c).n by FUNCT_2:113;
      dom(h+c) = NAT by FUNCT_2:def 1; then
      x = h.n + c.n by A19,VALUED_1:def 1; then
      x = h.n + x0 by A16; then
      x > x0 by A14,XREAL_1:29; then
      x in ].x0,+infty.[ by XXREAL_1:235; then
A20:   x in right_open_halfline x0 by LIMFUNC1:def 3;
      x in dom f1 by A18,A13,FUNCT_1:11;
      hence x in right_open_halfline x0 /\ dom f1 by A20,XBOOLE_0:def 4;
     end; then
A21:  rng (h + c) c= right_open_halfline x0 /\ dom f1;

     set a = f1/*c;

A22:  rng c c= dom (f2*f1) by A12,A10,ZFMISC_1:31;

     set d = f1/*(h+c) - f1/*c;

A23: lim h = 0;

     lim c = c.0 by SEQ_4:25; then
     lim c = x0 by A16; then
A24: lim (h + c) = 0 + x0 by A23,SEQ_2:6 .= x0;
A25: f1 is_Rcontinuous_in x0 by A1,FDIFF_3:7; then
A26: f1/*(h+c) is convergent by A21,A24,FDIFF_3:def 2;

A27: f1.x0 = lim (f1/*(h+c)) by A21,A24,A25,FDIFF_3:def 2;
A28: rng (f1/*(h+c)) c= dom f2 by A13,FDIFF_2:9;

     now let x be Real;
      assume x in rng a; then
      consider n be Element of NAT such that
A29:   a.n = x by FUNCT_2:113;
      c.n = x0 by A16;
      then x = f1.x0 by A15,A29,A12,A10,ZFMISC_1:31,FUNCT_2:108;
      hence x in {f1.x0} by TARSKI:def 1;
     end; then
A30: rng a c= {f1.x0};

     now let x be Real;
A31:  a.0 in rng a by VALUED_0:28;
      assume x in {f1.x0}; then
A32:  x = f1.x0 by TARSKI:def 1;
      c.0 = x0 by A16;
      hence x in rng a by A15,A32,A31,A12,A10,ZFMISC_1:31,FUNCT_2:108;
     end; then
     {f1.x0} c= rng a; then
A33: rng a = { f1.x0 } by A30,XBOOLE_0:def 10; then
A34: rng a c= dom f2 by A11,ZFMISC_1:31;

A35: now
      let n be Nat;
      a.n in rng a by VALUED_0:28;
      then
A36:  a.n = f1.x0 by A30,TARSKI:def 1;
      a.(n+1) in rng a by VALUED_0:28;
      hence a.n = a.(n+1) by A30,A36,TARSKI:def 1;
     end;
     then
A37: a is constant by VALUED_0:25;

     consider N be Nat such that
A38:   for m be Nat st N <= m holds |. (h+c).m - lim (h+c) .| < r
       by A6,SEQ_2:def 7;

A39:  rng((h+c)^\N) c= rng(h+c) & rng(c^\N) c= rng c by NAT_1:55; then
A40:  rng((h+c)^\N) c= dom(f2*f1) & rng(c^\N) c= dom(f2*f1) by A13,A22; then
A41:  rng(f1/*((h+c)^\N)) c= dom f2 & rng(f1/*(c^\N)) c= dom f2 by FDIFF_2:9;

     dom(f2*f1) c= dom f1 by RELAT_1:25; then
A42:  rng((h+c)^\N) c= dom f1 & rng(c^\N) c= dom f1 by A39,A13,A22;

     reconsider a as constant Real_Sequence by A35,VALUED_0:25;
     a.0 in rng a by VALUED_0:28;
     then a.0 = f1.x0 by A30,TARSKI:def 1;
     then lim a = f1.x0 by SEQ_4:25;
     then
A43: lim d = f1.x0 - f1.x0 by A26,A27,SEQ_2:12 .= 0;

     h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent &
     lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = Rdiff(f2,f1.x0)*Rdiff(f1,x0)
     proof
      per cases;
      suppose
       ex k be Element of NAT st for n be Element of NAT
        st k <= n holds (f1/*(h+c)).n <> f1.x0; then
       consider k1 be Element of NAT such that
A44:    for n be Element of NAT st k1 <= n holds (f1/*(h+c)).n <> f1.x0;
       reconsider k = max(k1,N) as Element of NAT by ORDINAL1:def 12;
A45:    k1 <= k & N <= k by XXREAL_0:25;
A46:    now
        given n being Nat such that
A47:     (d^\k).n = 0;
A48:    k+n is Element of NAT by ORDINAL1:def 12;
        0 = d.(k+n) by A47,NAT_1:def 3
         .= (f1/*(h+c)).(k+n) - (f1/*c).(k+n) by RFUNCT_2:1
         .= (f1/*(h+c)).(k+n) - f1.(c.(k+n))
           by A15,A48,A12,A10,ZFMISC_1:31,FUNCT_2:108
         .= (f1/*(h+c)).(n+k) - f1.x0 by A16;
        hence contradiction by A44,A45,NAT_1:12;
       end;

       set c1 = c^\k;
       set h1 = h^\k;
       set a1 = a^\k;
       set s = h1"(#)(f1/*(h1 + c1) - f1/*c1);
A49:   now
        let n be Element of NAT;
        thus (d + a).n = d.n + a.n by SEQ_1:7
           .= (f1/*(h+c)).n - a.n + a.n by RFUNCT_2:1
           .= (f1/*(h+c)).n;
       end;

       lim (d^\k) = 0 by A37,A26,A43,SEQ_4:20;
       then reconsider d1 = d^\k as 0-convergent non-zero Real_Sequence
          by A37,A26,A46,SEQ_1:5,FDIFF_1:def 1;

A50:    for n being Nat holds d1.n > 0
       proof
        let n be Nat;
A51:    dom(h+c) = NAT by FUNCT_2:def 1;

A52:    d1.n = d.(k+n) by NAT_1:def 3
         .= (f1/*(h+c)).(n+k) - (f1/*c).(n+k) by RFUNCT_2:1
         .= (f1/*(h+c)).(n+k) - f1.(c.(n+k))
           by A15,A12,A10,ZFMISC_1:31,FUNCT_2:108
         .= (f1/*(h+c)).(n+k) - f1.x0 by A16
         .= f1.((h+c).(n+k)) - f1.x0 by A21,XBOOLE_1:18,FUNCT_2:108;

        (h+c).(k+n) = h.(k+n)+c.(k+n)
          by A51,ORDINAL1:def 12,VALUED_1:def 1; then
A53:    (h+c).(k+n) = h.(k+n)+x0 by A16;

        |. (h+c).(k+n) - lim(h+c) .| < r by A38,A45,NAT_1:12; then
        |. h.(k+n) + c.(k+n) - x0 .| < r
          by A24,A51,ORDINAL1:def 12,VALUED_1:def 1; then
A54:    |. h.(k+n) + x0 - x0 .| < r by A16;

        h.(k+n) > 0 by A14; then
        h.(k+n) < r by A54,ABSVALUE:def 1; then
        x0 < (h+c).(k+n) & (h+c).(k+n) < x0+r by A53,A14,XREAL_1:8,29; then
        (h+c).(k+n) in [.x0,x0+r.] by XXREAL_1:1; then
        f1.((h+c).(k+n)) in [.f1.x0,f1.x0+r1.] by A7,FUNCT_1:54; then
A55:    f1.x0 <= f1.((h+c).(k+n)) by XXREAL_1:1;
        0 <> d1.n by A46;
        hence d1.n > 0 by A55,A52,XREAL_1:48;
       end;

       set t = d1"(#)(f2/*(d1 + a1) - f2/*a1);

       d1 + a1 = (d + a)^\k by SEQM_3:15; then
A56:   d1 + a1 = (f1/*(h+c))^\k by A49,FUNCT_2:63;

       rng ((f1/*(h+c))^\k) c= rng (f1/*(h+c)) by VALUED_0:21; then
A57:   rng (d1 + a1) c= dom f2 by A28,A56;
A58:   rng a1 = {f1.x0} by A33,VALUED_0:26; then
A59:   lim t = Rdiff(f2,f1.x0) by A2,A50,A57,FDIFF_3:15;

       Rdiff(f2,f1.x0) = Rdiff(f2,f1.x0); then
A60:   t is convergent by A2,A58,A57,A50,FDIFF_3:15;
       rng ((h + c)^\k) c= rng (h + c) by VALUED_0:21;
       then rng ((h + c)^\k) c= right_open_halfline x0 /\ dom f1 by A17; then
A61:   rng (h1 + c1) c= right_open_halfline x0 /\ dom f1 by SEQM_3:15;
       right_open_halfline x0 /\ dom f1 c= dom f1 by XBOOLE_1:17; then
A62:   rng (h1+c1) c= dom f1 by A61;
A63:   rng c1 = {x0} by A12,VALUED_0:26;
A64:   for n be Nat holds h1.n > 0
       proof
        let n be Nat;
        h1.n = h.(k+n) by NAT_1:def 3;
        hence h1.n > 0 by A14;
       end;
       Rdiff(f1,x0) = Rdiff(f1,x0);
       then
A65:   s is convergent by A1,A63,A64,A62,FDIFF_3:15;

A66:   t(#)s = d1"(#)(f2/*(d1+a1) - f2/*a1) (#) ((f1/*((h+c)^\k) - f1/*
        c1) (#)h1") by SEQM_3:15
          .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#) (((f1/*(h+c))^\k - f1/*c1)(#)
        h1") by A21,XBOOLE_1:18,VALUED_0:27
          .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#) (((f1/*(h+c))^\k - (f1/*c)^\k)
        (#)h1") by A15,A12,A10,ZFMISC_1:31,VALUED_0:27
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (((f1/*(h+c))^\k - (f1/*c)^\k)
        (#)h1") by VALUED_1:def 10
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (d1(#)h1") by SEQM_3:17
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) d1(#)h1" by SEQ_1:14
          .= (f2/*(d1+a1) - f2/*a1) (#) h1" by SEQ_1:37
          .= ((f2/*(f1/*(h+c)))^\k - f2/*a1) (#) h1" by A28,A56,VALUED_0:27
          .= (((f2*f1)/*(h+c))^\k - f2/*a1) (#) h1" by A13,VALUED_0:31
          .= (((f2*f1)/*(h+c))^\k - ((f2/*a)^\k)) (#) h1"
              by A33,A11,ZFMISC_1:31,VALUED_0:27
          .= (((f2*f1)/*(h+c))^\k - (((f2*f1)/*c)^\k)) (#) h1"
              by A12,A10,ZFMISC_1:31,VALUED_0:31
          .= (((f2*f1)/*(h+c) - (f2*f1)/*c)^\k) (#) h1" by SEQM_3:17
          .= (((f2*f1)/*(h+c) - (f2*f1)/*c)^\k) (#) ((h")^\k) by SEQM_3:18
          .= (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\k by SEQM_3:19;
       hence h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
         by A65,A60,SEQ_4:21;

       lim s = Rdiff(f1,x0) by A1,A63,A64,A62,FDIFF_3:15;
       then lim ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\k) = Rdiff(f2,f1.x0) *
       Rdiff(f1,x0 ) by A66,A65,A60,A59,SEQ_2:15;
       hence thesis by A65,A60,A66,SEQ_4:22;
      end;

      suppose
A67:   for k be Element of NAT
        ex n be Element of NAT st k <= n & (f1/*(h+c)).n = f1.x0;

       defpred P[object] means $1 = f1.x0;

A68:   for k be Element of NAT ex n be Element of NAT
          st k <= n & P[(f1/*(h+c)).n] by A67;
       consider I1 be increasing sequence of NAT such that
A69:    for n being Nat holds P[(f1/*(h+c)*I1).n] and
        for n be Element of NAT st for r be Real st r = (f1/*(h+c)).n holds
          P[r] ex m be Element of NAT st n = I1.m
        from FDIFF_2:sch 1(A68);
       reconsider h1 = h*I1 as 0-convergent non-zero Real_Sequence
          by FDIFF_2:6;

       set c1 = c*I1;
A70:   c1 = c by VALUED_0:26;
A71:   rng c1 = {x0} by A12,VALUED_0:26;
A72:    rng h1 c= rng h by VALUED_0:21;

A73:   for n be Nat holds h1.n > 0
       proof
        let n be Nat;
        dom h1 = NAT by FUNCT_2:def 1; then
        h1.n in rng h1 by FUNCT_1:3,ORDINAL1:def 12; then
        ex m be Element of NAT st h1.n = h.m by A72,FUNCT_2:113;
        hence h1.n > 0 by A14;
       end;

       reconsider c1 as constant Real_Sequence;
A74:   now
        let g be Real such that
A75:    0 < g;
        reconsider n = 0 as Nat;
        take n;
        let m be Nat such that n <= m;
A76:    m in NAT by ORDINAL1:def 12;
        |.(h1"(#)(f1/*(h1+c1) - f1/*c1)).m - 0 .| = |.(h1").m *(f1/*(
          h1+c1) - f1/*c1).m.| by SEQ_1:8
         .= |.(h1").m *((f1/*(h1+c1)).m - (f1/*c1).m).| by RFUNCT_2:1
         .= |.(h1").m *((f1/*(h1+c1)).m - f1.(c.m)).| by A15,A70,A76,
A12,A10,ZFMISC_1:31,FUNCT_2:108
         .= |.(h1").m *((f1/*(h1+c1)).m - f1.x0).| by A16
         .= |.(h1").m *((f1/*((h+c)*I1)).m - f1.x0).| by RFUNCT_2:2
         .= |.(h1").m *((f1/*(h+c)*I1).m - f1.x0).|
             by A21,XBOOLE_1:18,FUNCT_2:110
         .= |.(h1").m *(f1.x0 - f1.x0).| by A69
         .= 0 by ABSVALUE:2;
        hence |.(h1"(#)(f1/*(h1+c1) - f1/*c1)).m - 0 .| < g by A75;
       end;

       rng ((h + c)*I1) c= rng (h + c) by VALUED_0:21;
       then rng ((h + c)*I1) c= dom f1 by A13,A15;
       then
A77:   rng (h1 + c1) c= dom f1 by RFUNCT_2:2;
       then
A78:   lim (h1"(#)(f1/*(h1+c1) - f1/*c1)) = Rdiff(f1,x0)
          by A1,A71,A73,FDIFF_3:15;

       Rdiff(f1,x0) = Rdiff(f1,x0);
       then h1"(#)(f1/*(h1+c1) - f1/*c1) is convergent
          by A1,A71,A77,A73,FDIFF_3:15;
       then
A79:   Rdiff(f1,x0) = 0 by A78,A74,SEQ_2:def 7;

       now per cases;
        suppose
         ex k be Element of NAT st
          for n be Element of NAT st k <= n holds (f1/*((h+c)^\N)).n = f1.x0;
         then consider k be Element of NAT such that
A80:      for n be Element of NAT st k <= n holds (f1/*((h+c)^\N)).n = f1.x0;
A81:     now let g be Real such that
A82:       0 < g;
          reconsider n = k as Nat;
          take n;
          let m be Nat;
A83:      m in NAT by ORDINAL1:def 12;
          assume
A84:        n <= m;
          |. ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m
               - Rdiff(f2,f1.x0)*Rdiff(f1, x0 ) .|
            = |.( ((h")^\N) (#) (((f2*f1)/*(h+c) - (f2*f1)/*c)^\N) ).m .|
                  by A79,SEQM_3:19
           .= |.(((h")^\N) (#) ( ((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N )).m.|
                  by SEQM_3:17
           .= |. ((h")^\N).m * ( ((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ).m .|
                  by SEQ_1:8
           .= |. ((h")^\N).m *((((f2*f1)/*(h+c))^\N).m - (((f2*f1)/*c)^\N).m).|
                  by RFUNCT_2:1
           .= |. ((h")^\N).m *(((f2*f1)/*((h+c)^\N)).m - (((f2*f1)/*c)^\N).m).|
                  by A13,VALUED_0:27
           .= |. ((h")^\N).m *(((f2*f1)/*((h+c)^\N)).m - ((f2*f1)/*(c^\N)).m).|
                  by A12,A10,ZFMISC_1:31,VALUED_0:27
       .= |. ((h")^\N).m * ((f2/*(f1/*((h+c)^\N))).m - ((f2*f1)/*(c^\N)).m).|
                  by A40,VALUED_0:31
       .= |. ((h")^\N).m * ((f2/*(f1/*((h+c)^\N))).m - (f2/*(f1/*(c^\N))).m).|
                  by A40,VALUED_0:31
       .= |. ((h")^\N).m * ( f2.((f1/*((h+c)^\N)).m) - (f2/*(f1/*(c^\N))).m).|
        by A41,FUNCT_2:108,A83
       .= |. ((h")^\N).m * ( f2.(f1.x0) - (f2/*(f1/*(c^\N))).m).|
           by A84,A80,A83
       .= |. ((h")^\N).m * ( f2.(f1.x0) - f2.((f1/*(c^\N)).m)).| by
A83,A41,FUNCT_2:108
       .= |. ((h")^\N).m * ( f2.(f1.x0) - f2.( f1.( (c^\N).m) )).| by
       A42,FUNCT_2:108,A83
       .= |. ((h")^\N).m * ( f2.(f1.x0) - f2.( f1.( c.(N+m) ))).| by
       NAT_1:def 3
       .= |. ((h")^\N).m * ( f2.(f1.x0) - f2.(f1.x0)).| by A16
           .= 0 by ABSVALUE:2;
          hence |. ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m
                   - Rdiff(f2,f1.x0)*Rdiff(f1,x0).|<g by A82;
         end; then
A85:      (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N is convergent
            by SEQ_2:def 6; then
A86:      lim ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N)
           = Rdiff(f2,f1.x0)*Rdiff(f1,x0) by A81,SEQ_2:def 7;
         thus h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
           by A85,SEQ_4:21;
         thus lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = Rdiff(f2,f1.x0)*
            Rdiff(f1,x0) by A85,A86,SEQ_4:22;
        end;

        suppose
A87:     for k be Element of NAT
          ex n be Element of NAT st k <= n & (f1/*((h+c)^\N)).n <> f1.x0;

         defpred P[object] means $1 <> f1.x0;
A88:     for k be Element of NAT
          ex n be Element of NAT st k <= n & P[(f1/*((h+c)^\N)).n]
            by A87;

         consider I2 be increasing sequence of NAT such that
A89:      for n being Nat holds P[(f1/*((h+c)^\N)*I2).n] and
A90:      for n be Element of NAT st for r be Real st
            r = (f1/*((h+c)^\N)).n holds P[r]
             ex m be Element of NAT st n
            = I2.m from FDIFF_2:sch 1(A88);

A91:      d^\N = (f1/*(h+c))^\N - (f1/*c)^\N by SEQM_3:17
          .= f1/*((h+c)^\N) - (f1/*c)^\N by A21,XBOOLE_1:18,VALUED_0:27
          .= f1/*((h+c)^\N) - f1/*(c^\N) by A15,A12,A10
,ZFMISC_1:31,VALUED_0:27;

         rng(c^\N) c= rng c & rng((h+c)^\N) c= rng(h+c) by VALUED_0:21; then
A92:      rng(c^\N) c= dom f1 & rng((h+c)^\N) c= dom f1 by A22,A13,A15;

A93:      a^\N = f1/*(c^\N) by A15,A12,A10,ZFMISC_1:31,VALUED_0:27;

A94:      now
          given n being Nat such that
A95:       ((d^\N)*I2).n = 0;
          0 = (d^\N).(I2.n) by A95,FUNCT_2:15,ORDINAL1:def 12
           .= (f1/*((h+c)^\N)).(I2.n) - (f1/*(c^\N)).(I2.n) by A91,RFUNCT_2:1
           .= (f1/*((h+c)^\N)).(I2.n) - f1.((c^\N).(I2.n)) by A92,FUNCT_2:108
           .= (f1/*((h+c)^\N)).(I2.n) - f1.(c.(N + I2.n)) by NAT_1:def 3
           .= (f1/*((h+c)^\N)).(I2.n) - f1.x0 by A16
           .= (f1/*((h+c)^\N)*I2).n - f1.x0 by FUNCT_2:15,ORDINAL1:def 12;
          hence contradiction by A89;
         end;

         reconsider h2 = h^\N*I2 as 0-convergent non-zero Real_Sequence
           by FDIFF_2:6;
         reconsider a1 = a^\N*I2 as constant Real_Sequence;
         reconsider c2 = c^\N*I2 as constant Real_Sequence;
         set s = h2"(#)(f1/*(h2+c2) - f1/*c2);

         d^\N*I2 is subsequence of d by VALUED_0:20; then
         lim (d^\N*I2) = 0 by A37,A26,A43,SEQ_4:17;
         then reconsider d1 = d^\N*I2 as 0-convergent non-zero
         Real_Sequence by A37,A26,SEQ_4:16,A94,SEQ_1:5,FDIFF_1:def 1;

         set t = d1"(#)(f2/*(d1+a1) - f2/*a1);
         a1 is subsequence of a by VALUED_0:20; then
A96:     rng a1 = {f1.x0} by A33,VALUED_0:26;
A97:     now
          let n be Element of NAT;
          thus (d^\N + a^\N).n = (d^\N).n + (a^\N).n by SEQ_1:7
             .= (f1/*((h+c)^\N)).n - (a^\N).n + (a^\N).n by A91,A93,RFUNCT_2:1
             .= (f1/*((h+c)^\N)).n;
         end;

A98:     rng((f1/*(h+c))^\N) c= rng(f1/*(h+c)) by VALUED_0:21; then
A99:    rng((f1/*(h+c))^\N) c= dom f2 by A28;

         rng(a^\N) c= rng a by VALUED_0:21; then
A100:    rng(a^\N) c= dom f2 by A34;

         d1 + a1 = (d^\N + a^\N)*I2 by RFUNCT_2:2;
         then
A101:     d1 + a1 = f1/*((h+c)^\N)*I2 by A97,FUNCT_2:63
           .= ((f1/*(h+c))^\N)*I2 by A21,XBOOLE_1:18,VALUED_0:27;

A102:      h2+c2 = (h^\N + c^\N)*I2 by RFUNCT_2:2
          .= (h+c)^\N * I2 by SEQM_3:15;

A103:     t(#)s = d1"(#)(f2/*(d1+a1) - f2/*a1) (#)
                  ( ( (f1/*((h+c)^\N))*I2 - f1/*c2 )(#)h2" )
                     by A92,A102,FUNCT_2:110
              .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#)
                  ( ( (f1/*((h+c)^\N))*I2 - (f1/*(c^\N)) *I2)(#)h2" )
                    by A92,FUNCT_2:110
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#)
                  ( ( (f1/*((h+c)^\N))*I2 - (f1/*(c^\N)) *I2)(#)h2" )
                    by VALUED_1:def 10
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#)
                  ( ( (f1/*(h+c))^\N*I2 - (f1/*(c^\N)) *I2)(#)h2" )
                    by A21,XBOOLE_1:18,VALUED_0:27
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#)
                  ( ( (f1/*(h+c))^\N*I2 - (f1/*c)^\N *I2)(#)h2" )
                    by A15,A12,A10,ZFMISC_1:31,VALUED_0:27
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#)
                  ( ( ((f1/*(h+c))^\N - (f1/*c)^\N)*I2)(#)h2" )
                    by RFUNCT_2:2
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (d1(#)h2") by SEQM_3:17
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) d1(#)h2" by SEQ_1:14
              .= (f2/*(((f1/*(h+c))^\N)*I2) - f2/*a1) (#) h2" by A101,SEQ_1:37
              .= ((f2 /* ((f1/*(h+c))^\N)) * I2 - f2/*a1  ) (#) h2"
                   by A99,FUNCT_2:110
              .= ((f2/*(f1/*(h+c)))^\N * I2 - f2/*a1  ) (#) h2"
                   by A28,VALUED_0:27
              .= (((f2*f1)/*(h+c))^\N*I2 - f2/*a1) (#) h2" by A13,VALUED_0:31
              .= (((f2*f1)/*(h+c))^\N*I2 - (f2/*(a^\N))*I2) (#) h2"
                     by A100,FUNCT_2:110
              .= (((f2*f1)/*(h+c))^\N*I2 - ( (f2/*a)^\N )*I2) (#) h2"
                       by A33,A11,ZFMISC_1:31,VALUED_0:27
              .= (((f2*f1)/*(h+c))^\N*I2 - ( ((f2*f1)/*c)^\N )*I2) (#) h2"
                       by A12,A10,ZFMISC_1:31,VALUED_0:31
              .= (( ((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ) *I2) (#) h2"
                       by RFUNCT_2:2
              .= (( ((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ) *I2) (#)
                   (((h^\N)")*I2)
                       by RFUNCT_2:5
              .= ((h^\N)"(#)(((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ))*I2
                       by RFUNCT_2:2;

         rng (((f1/*(h+c))^\N)*I2) c= rng ((f1/*(h+c))^\N) by VALUED_0:21;
         then
A104:     rng (d1 + a1) c= dom f2 by A98,A28,A101;
         ((h+c)^\N)*I2 is subsequence of (h+c) by VALUED_0:20; then


         rng (((h + c)^\N)*I2) c= rng (h + c) by VALUED_0:21;
         then
         rng (((h + c)^\N)*I2) c= dom f1 by A13,A15;
         then rng ((h^\N + c^\N)*I2) c= dom f1 by SEQM_3:15;
         then
A105:     rng (h2 + c2) c= dom f1 by RFUNCT_2:2;

         h2 is subsequence of h by VALUED_0:20; then
A106:    rng h2 c= rng h by VALUED_0:21;

A107:     for n be Nat holds h2.n > 0
         proof
          let n be Nat;
          dom h2 = NAT by FUNCT_2:def 1; then
          h2.n in rng h2 by FUNCT_1:3,ORDINAL1:def 12; then
          ex m be Element of NAT st h2.n = h.m by A106,FUNCT_2:113;
          hence h2.n > 0 by A14;
         end;

         c2 is subsequence of c by VALUED_0:20; then
A108:     rng c2 = {x0} by A12,VALUED_0:26;
         then
A109:     lim s = Rdiff(f1,x0) by A1,A105,A107,FDIFF_3:15;

A110:     for n be Nat holds d1.n > 0
         proof
          let n be Nat;

          n in NAT by ORDINAL1:def 12; then
A111:      n in dom I2 by FUNCT_2:def 1; then
A112:      (f1/*((h+c)^\N)*I2).n
            = (f1/*((h+c)^\N)).(I2.n) by FUNCT_1:13
           .= f1.(((h+c)^\N).(I2.n)) by A42,FUNCT_2:108;

A113:      d1.n = (f1/*((h+c)^\N) - f1/*(c^\N)).(I2.n) by A91,A111,FUNCT_1:13
           .= (f1/*((h+c)^\N)).(I2.n) - (f1/*(c^\N)).(I2.n) by RFUNCT_2:1
           .= (f1/*((h+c)^\N)).(I2.n) - f1.((c^\N).(I2.n)) by A42,FUNCT_2:108
           .= (f1/*((h+c)^\N)).(I2.n) - f1.(c.(N+I2.n)) by NAT_1:def 3
           .= (f1/*((h+c)^\N)).(I2.n) - f1.x0 by A16
           .= f1.(((h+c)^\N).(I2.n)) - f1.x0 by A42,FUNCT_2:108;

A114:      ((h+c)^\N).(I2.n) = (h+c).(N+I2.n) by NAT_1:def 3; then
A115:      ((h+c)^\N).(I2.n) = h.(N+I2.n) + c.(N+I2.n) by SEQ_1:7
           .= h.(N+I2.n) + x0 by A16;

A116:      |. ((h+c)^\N).(I2.n) - x0 .| < r by A114,A24,A38,NAT_1:12;

          h.(N+I2.n) > 0 by A14; then
          h.(N+I2.n) < r by A116,A115,ABSVALUE:def 1; then
          x0 < ((h+c)^\N).(I2.n) & ((h+c)^\N).(I2.n) < x0+r
            by A115,A14,XREAL_1:8,29; then
          ((h+c)^\N).(I2.n) in [. x0,x0+r .] by XXREAL_1:1; then
          f1.(((h+c)^\N).(I2.n)) in [. f1.x0, f1.x0+r1 .]
            by A7,FUNCT_1:54; then
          f1.x0 <= f1.(((h+c)^\N).(I2.n)) by XXREAL_1:1; then
          f1.x0 < f1.(((h+c)^\N).(I2.n)) by A89,A112,XXREAL_0:1;
          hence d1.n > 0 by A113,XREAL_1:50;
         end;

         Rdiff(f1,x0) = Rdiff(f1,x0); then
A117:     s is convergent by A1,A108,A105,A107,FDIFF_3:15;
         Rdiff(f2,f1.x0) = Rdiff(f2,f1.x0);
         then
A118:     t is convergent by A2,A96,A104,A110,FDIFF_3:15;

         lim t = Rdiff(f2,f1.x0) by A2,A96,A104,A110,FDIFF_3:15;
         then
A119:     lim (((h^\N)"(#)(((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ))*I2)
           = Rdiff(f2,f1.x0) * Rdiff(f1,x0) by A103,A117,A109,A118,SEQ_2:15;

A120:     now
          set DF = Rdiff(f2,f1.x0) * Rdiff(f1,x0);
          let g be Real such that
A121:       0 < g;
          consider k being Nat such that
A122:       for m being Nat st k <= m holds
            |.(((h^\N)"(#)(((f2*f1)/*(h+c))^\N
              - ((f2*f1)/*c)^\N ))*I2).m - DF.|<g
              by A103,A117,A118,A119,A121,SEQ_2:def 7;
A123:      k in NAT by ORDINAL1:def 12;
          reconsider n = I2.k as Nat;
          take n;
          let m be Nat such that
A124:        n <= m;
A125:      m in NAT by ORDINAL1:def 12;
A126:       ( h"(#)( (f2*f1)/*(h+c) - (f2*f1)/*c ) )^\N
           = ((h")^\N)(#)(( (f2*f1)/*(h+c) - (f2*f1)/*c )^\N) by SEQM_3:19
          .= (h^\N)"(#)(( (f2*f1)/*(h+c) - (f2*f1)/*c )^\N) by SEQM_3:18

          .= (h^\N)"(#)(((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N) by SEQM_3:17;

          now per cases;
           suppose
A127:        (f1/*((h+c)^\N)).m = f1.x0;

A128:        ((h^\N)"(#)(((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N)).m
             = ((h^\N)").m * (((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N).m
             by SEQ_1:8;

A129:        (((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N).m
             = (((f2*f1)/*(h+c))^\N).m - (((f2*f1)/*c)^\N).m by RFUNCT_2:1;

            dom((h+c)^\N) = NAT by FUNCT_2:def 1; then
            dom(f1*((h+c)^\N)) = NAT by A92,RELAT_1:27; then
            dom(f1/*((h+c)^\N)) = NAT by A92,FUNCT_2:def 11; then
A130:        dom(f2*(f1/*((h+c)^\N))) = NAT by A41,RELAT_1:27;

            ((f2*f1)/*(h+c))^\N
              = (f2*f1)/*((h+c)^\N) by A13,VALUED_0:27
             .= f2/*(f1/*((h+c)^\N)) by A40,VALUED_0:31
             .= f2*(f1/*((h+c)^\N)) by A41,FUNCT_2:def 11; then
A131:        (((f2*f1)/*(h+c))^\N).m = f2.(f1.x0)
              by A127,A130,FUNCT_1:12,ORDINAL1:def 12;

            dom(c^\N) = NAT by FUNCT_2:def 1; then
            dom(f1*(c^\N)) = NAT by A92,RELAT_1:27; then
            dom(f1/*(c^\N)) = NAT by A92,FUNCT_2:def 11; then
A132:        dom(f2*(f1/*(c^\N))) = NAT by A41,RELAT_1:27;

            ((f2*f1)/*c)^\N = (f2*f1)/*(c^\N) by A12,A10
,ZFMISC_1:31,VALUED_0:27
             .= f2/*(f1/*(c^\N)) by A40,VALUED_0:31
             .= f2*(f1/*(c^\N)) by A41,FUNCT_2:def 11; then
            (((f2*f1)/*c)^\N).m = f2.((f1/*(c^\N)).m)
              by ORDINAL1:def 12,A132,FUNCT_1:12
             .= f2.(f1.((c^\N).m)) by A125,A92,FUNCT_2:108
             .= f2.(f1.(c.(N+m))) by NAT_1:def 3
             .= f2.(f1.x0) by A16;
            hence |.((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m - DF.| < g
              by A126,A121,A79,A128,A131,A129,ABSVALUE:2;
           end;
           suppose
            (f1/*((h+c)^\N)).m <> f1.x0; then
            for r1 be Real holds (f1/*((h+c)^\N)).m = r1 implies r1<>f1.x0;
            then
            consider l be Element of NAT such that
A133:         m = I2.l by A90,A125;

            dom I2 = NAT by FUNCT_2:def 1;
            then l >= k by A124,A133,VALUED_0:def 13,A123; then
            |.(((h^\N)"(#)(((f2*f1)/*(h+c))^\N
              - ((f2*f1)/*c)^\N ))*I2).l - DF.| < g by A122;
            hence |.((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m - DF.| < g
              by A126,A133,FUNCT_2:15;
           end;
          end;
          hence
              |.((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m
                - Rdiff(f2,f1.x0) *Rdiff(f1,x0).|<g;
         end; then
A134:     (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N is convergent by
           SEQ_2:def 6; then
A135:     lim ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N)
            = Rdiff(f2,f1.x0)*Rdiff(f1,x0) by A120,SEQ_2:def 7;

         thus h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
                by A134,SEQ_4:21;
         thus lim (h"(#) ((f2*f1)/*(h+c) - (f2*f1)/*c)) = Rdiff(f2,f1.x0)*
            Rdiff(f1,x0) by A134,A135,SEQ_4:22;
        end;
       end;
       hence thesis;
      end;
     end;
     hence thesis;
    end;
    hence thesis by A6,A9,FDIFF_3:15;
end;

theorem Th43:
for x0 be Real, f1,f2 be PartFunc of REAL,REAL st
 f1 is_left_differentiable_in x0 & f2 is_right_differentiable_in f1.x0 &
  (for r1 be Real st r1 > 0 ex r0 be Real st r0 > 0 &
    [.x0-r0,x0.] c= dom([.f1.x0,f1.x0+r1.]|`f1)) holds
  f2*f1 is_left_differentiable_in x0 &
  Ldiff(f2*f1,x0) = Rdiff(f2,f1.x0)*Ldiff(f1,x0)
proof
    let x0 be Real, f1,f2 be PartFunc of REAL,REAL;
    assume that
A1:  f1 is_left_differentiable_in x0 and
A2:  f2 is_right_differentiable_in f1.x0 and
A3: for r1 be Real st r1 > 0 ex r0 be Real st r0>0 &
      [.x0-r0,x0.] c= dom([.f1.x0,f1.x0+r1.]|`f1);

    consider r1 be Real such that
A4: r1 > 0 & [. f1.x0,f1.x0+r1 .] c= dom f2 by A2,FDIFF_3:def 3;

    consider r0 be Real such that
A5: r0>0 &
     [.x0-r0,x0.] c= dom([.f1.x0,f1.x0+r1.]|`f1) by A3,A4;

    set r = min(r0,r1);
A6: r > 0 by A4,A5,XXREAL_0:21;
    x0-r0 <= x0-r & f1.x0 + r <= f1.x0 + r1 by XREAL_1:6,10,XXREAL_0:17; then
    [.x0-r,x0.] c= [.x0-r0,x0.] & [.f1.x0,f1.x0+r.] c= [.f1.x0,f1.x0+r1.]
      by XXREAL_1:34; then
A7:[.x0-r,x0.] c= dom([.f1.x0,f1.x0+r1.]|`f1) by A5;

A8:now let x be Real;
     assume x in [.x0-r,x0.]; then
     x in dom f1 & f1.x in [.f1.x0,f1.x0+r1.] by A7,FUNCT_1:54;
     hence x in dom(f2*f1) by A4,FUNCT_1:11;
    end; then
A9:[.x0-r,x0.] c= dom(f2*f1);

    x0-r < x0 by A6,XREAL_1:44; then
A10: x0 in dom(f2*f1) by A8,XXREAL_1:1; then
A11: f1.x0 in dom f2 by FUNCT_1:11;

A12:dom(f2*f1) c= dom f1 by RELAT_1:25;

    for h,c st rng c = {x0} & rng (h + c) c= dom (f2*f1) &
     (for n be Nat holds h.n < 0) holds
     h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
   & lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = Rdiff(f2,f1.x0)*Ldiff(f1,x0)
    proof
     let h,c;
     assume that
A13:   rng c = {x0} and
A14:   rng (h + c) c= dom (f2*f1) and
A15:   for n be Nat holds h.n < 0;

A16:  for n be Nat holds c.n = x0
     proof
      let n be Nat;
      c.n in rng c by VALUED_0:28;
      hence c.n = x0 by A13,TARSKI:def 1;
     end;

A17: now let x be Real;
      assume A18: x in rng(h+c); then
      consider n be Element of NAT such that
A19:    x = (h+c).n by FUNCT_2:113;
      dom(h+c) = NAT by FUNCT_2:def 1; then
      x = h.n + c.n by A19,VALUED_1:def 1; then
      x = h.n + x0 by A16; then
      x < x0 by A15,XREAL_1:30; then
      x in ].-infty,x0.[ by XXREAL_1:233; then
A20:   x in left_open_halfline x0 by PROB_1:def 10;
      x in dom f1 by A18,A14,FUNCT_1:11;
      hence x in left_open_halfline x0 /\ dom f1 by A20,XBOOLE_0:def 4;
     end; then
A21:  rng (h + c) c= left_open_halfline x0 /\ dom f1;

     set a = f1/*c;

A22:  rng c c= dom (f2*f1) by A13,A10,ZFMISC_1:31;

     set d = f1/*(h+c) - f1/*c;

A23: lim h = 0;

     lim c = c.0 by SEQ_4:25; then
     lim c = x0 by A16; then
A24: lim (h + c) = 0 + x0 by A23,SEQ_2:6 .= x0;
A25: f1 is_Lcontinuous_in x0 by A1,FDIFF_3:5; then
A26: f1/*(h+c) is convergent by A21,A24,FDIFF_3:def 1;

A27: f1.x0 = lim (f1/*(h+c)) by A21,A24,A25,FDIFF_3:def 1;
A28: rng (f1/*(h+c)) c= dom f2 by A14,FDIFF_2:9;

     now let x be Real;
      assume x in rng a; then
      consider n be Element of NAT such that
A29:   a.n = x by FUNCT_2:113;
      c.n = x0 by A16;
      then x = f1.x0 by A29,A12,A13,A10,ZFMISC_1:31,FUNCT_2:108;
      hence x in {f1.x0} by TARSKI:def 1;
     end; then
A30: rng a c= {f1.x0};

     now let x be Real;
A31:  a.0 in rng a by VALUED_0:28;
      assume x in {f1.x0}; then
A32:  x = f1.x0 by TARSKI:def 1;
      c.0 = x0 by A16;
      hence x in rng a by A32,A31,A12,A13,A10,ZFMISC_1:31,FUNCT_2:108;
     end; then
     {f1.x0} c= rng a; then
A33: rng a = { f1.x0 } by A30,XBOOLE_0:def 10; then
A34: rng a c= dom f2 by A11,ZFMISC_1:31;

A35: now
      let n be Nat;
      a.n in rng a by VALUED_0:28;
      then
A36:  a.n = f1.x0 by A30,TARSKI:def 1;
      a.(n+1) in rng a by VALUED_0:28;
      hence a.n = a.(n+1) by A30,A36,TARSKI:def 1;
     end;
     then
A37: a is constant by VALUED_0:25;

     consider N be Nat such that
A38:   for m be Nat st N <= m holds |. (h+c).m - lim (h+c) .| < r
       by A6,SEQ_2:def 7;

A39:  rng((h+c)^\N) c= rng(h+c) & rng(c^\N) c= rng c by NAT_1:55; then
A40:  rng((h+c)^\N) c= dom(f2*f1) & rng(c^\N) c= dom(f2*f1) by A14,A22; then
A41:  rng(f1/*((h+c)^\N)) c= dom f2 & rng(f1/*(c^\N)) c= dom f2 by FDIFF_2:9;

     dom(f2*f1) c= dom f1 by RELAT_1:25; then
A42:  rng((h+c)^\N) c= dom f1 & rng(c^\N) c= dom f1 by A39,A14,A22;

     reconsider a as constant Real_Sequence by A35,VALUED_0:25;
     a.0 in rng a by VALUED_0:28;
     then a.0 = f1.x0 by A30,TARSKI:def 1;
     then lim a = f1.x0 by SEQ_4:25;
     then
A43: lim d = f1.x0 - f1.x0 by A26,A27,SEQ_2:12 .= 0;

     h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent &
     lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = Rdiff(f2,f1.x0)*Ldiff(f1,x0)
     proof
      per cases;
      suppose
       ex k be Element of NAT st for n be Element of NAT
        st k <= n holds (f1/*(h+c)).n <> f1.x0; then
       consider k1 be Element of NAT such that
A44:    for n be Element of NAT st k1 <= n holds (f1/*(h+c)).n <> f1.x0;
       reconsider k = max(k1,N) as Element of NAT by ORDINAL1:def 12;
A45:    k1 <= k & N <= k by XXREAL_0:25;
A46:    now
        given n being Nat such that
A47:     (d^\k).n = 0;
A48:    k+n is Element of NAT by ORDINAL1:def 12;
        0 = d.(k+n) by A47,NAT_1:def 3
         .= (f1/*(h+c)).(k+n) - (f1/*c).(k+n) by RFUNCT_2:1
         .= (f1/*(h+c)).(k+n) - f1.(c.(k+n))
           by A48,A12,A13,A10,ZFMISC_1:31,FUNCT_2:108
         .= (f1/*(h+c)).(n+k) - f1.x0 by A16;
        hence contradiction by A44,A45,NAT_1:12;
       end;

       set c1 = c^\k;
       set h1 = h^\k;
       set a1 = a^\k;
       set s = h1"(#)(f1/*(h1 + c1) - f1/*c1);
A49:   now
        let n be Element of NAT;
        thus (d + a).n = d.n + a.n by SEQ_1:7
           .= (f1/*(h+c)).n - a.n + a.n by RFUNCT_2:1
           .= (f1/*(h+c)).n;
       end;

       lim (d^\k) = 0 by A37,A26,A43,SEQ_4:20;
       then reconsider d1 = d^\k as 0-convergent non-zero Real_Sequence
          by A37,A26,A46,SEQ_1:5,FDIFF_1:def 1;

A50:    for n being Nat holds d1.n > 0
       proof
        let n be Nat;
A51:    dom(h+c) = NAT by FUNCT_2:def 1;

A52:    d1.n = d.(k+n) by NAT_1:def 3
         .= (f1/*(h+c)).(n+k) - (f1/*c).(n+k) by RFUNCT_2:1
         .= (f1/*(h+c)).(n+k) - f1.(c.(n+k))
           by A12,A13,A10,ZFMISC_1:31,FUNCT_2:108
         .= (f1/*(h+c)).(n+k) - f1.x0 by A16
         .= f1.((h+c).(n+k)) - f1.x0 by A21,XBOOLE_1:18,FUNCT_2:108;

        (h+c).(k+n) = h.(k+n)+c.(k+n)
          by A51,ORDINAL1:def 12,VALUED_1:def 1; then
A53:    (h+c).(k+n) = h.(k+n)+x0 by A16;

        |. (h+c).(k+n) - lim(h+c) .| < r by A38,A45,NAT_1:12; then
        |. h.(k+n) + c.(k+n) - x0 .| < r
          by A24,A51,ORDINAL1:def 12,VALUED_1:def 1; then
        |. h.(k+n) + x0 - x0 .| < r by A16; then
        -h.(k+n) < r by A15,ABSVALUE:def 1; then
        -(-h.(k+n)) > -r by XREAL_1:24; then
        x0 > (h+c).(k+n) & (h+c).(k+n) > x0-r by A53,A15,XREAL_1:8,30; then
        (h+c).(k+n) in [.x0-r,x0.] by XXREAL_1:1; then
        f1.((h+c).(k+n)) in [.f1.x0,f1.x0+r1.] by A7,FUNCT_1:54; then
A54:    f1.x0 <= f1.((h+c).(k+n)) by XXREAL_1:1;
        0 <> d1.n by A46;
        hence d1.n > 0 by A54,A52,XREAL_1:48;
       end;

       set t = d1"(#)(f2/*(d1 + a1) - f2/*a1);

       d1 + a1 = (d + a)^\k by SEQM_3:15;
       then
A55:   d1 + a1 = (f1/*(h+c))^\k by A49,FUNCT_2:63;

       rng ((f1/*(h+c))^\k) c= rng (f1/*(h+c)) by VALUED_0:21;
       then
A56:   rng (d1 + a1) c= dom f2 by A28,A55;
A57:   rng a1 = {f1.x0} by A33,VALUED_0:26;
       then
A58:   lim t = Rdiff(f2,f1.x0) by A2,A50,A56,FDIFF_3:15;

       Rdiff(f2,f1.x0) = Rdiff(f2,f1.x0);
       then
A59:   t is convergent by A2,A57,A56,A50,FDIFF_3:15;
       rng ((h + c)^\k) c= rng (h + c) by VALUED_0:21;
       then rng ((h + c)^\k) c= left_open_halfline x0 /\ dom f1 by A17;
       then
A60:   rng (h1 + c1) c= left_open_halfline x0 /\ dom f1 by SEQM_3:15;
       left_open_halfline x0 /\ dom f1 c= dom f1 by XBOOLE_1:17; then
A61:   rng (h1+c1) c= dom f1 by A60;
A62:   rng c1 = {x0} by A13,VALUED_0:26;
A63:   for n be Nat holds h1.n < 0
       proof
        let n be Nat;
        h1.n = h.(k+n) by NAT_1:def 3;
        hence h1.n < 0 by A15;
       end;
       Ldiff(f1,x0) = Ldiff(f1,x0); then
A64:   s is convergent by A1,A62,A63,A61,FDIFF_3:9;

A65:   t(#)s = d1"(#)(f2/*(d1+a1) - f2/*a1) (#) ((f1/*((h+c)^\k) - f1/*
        c1) (#)h1") by SEQM_3:15
          .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#) (((f1/*(h+c))^\k - f1/*c1)(#)
        h1") by A21,XBOOLE_1:18,VALUED_0:27
          .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#) (((f1/*(h+c))^\k - (f1/*c)^\k)
        (#)h1") by A12,A13,A10,ZFMISC_1:31,VALUED_0:27
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (((f1/*(h+c))^\k - (f1/*c)^\k)
        (#)h1") by VALUED_1:def 10
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (d1(#)h1") by SEQM_3:17
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) d1(#)h1" by SEQ_1:14
          .= (f2/*(d1+a1) - f2/*a1) (#) h1" by SEQ_1:37
          .= ((f2/*(f1/*(h+c)))^\k - f2/*a1) (#) h1" by A28,A55,VALUED_0:27
          .= (((f2*f1)/*(h+c))^\k - f2/*a1) (#) h1" by A14,VALUED_0:31
          .= (((f2*f1)/*(h+c))^\k - ((f2/*a)^\k)) (#) h1"
              by A33,A11,ZFMISC_1:31,VALUED_0:27
          .= (((f2*f1)/*(h+c))^\k - (((f2*f1)/*c)^\k)) (#) h1"
              by A13,A10,ZFMISC_1:31,VALUED_0:31
          .= (((f2*f1)/*(h+c) - (f2*f1)/*c)^\k) (#) h1" by SEQM_3:17
          .= (((f2*f1)/*(h+c) - (f2*f1)/*c)^\k) (#) ((h")^\k) by SEQM_3:18
          .= (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\k by SEQM_3:19;
       hence h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
         by A64,A59,SEQ_4:21;

       lim s = Ldiff(f1,x0) by A1,A62,A63,A61,FDIFF_3:9;
       then lim ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\k) = Rdiff(f2,f1.x0) *
       Ldiff(f1,x0 ) by A65,A64,A59,A58,SEQ_2:15;
       hence thesis by A64,A59,A65,SEQ_4:22;
      end;

      suppose
A66:   for k be Element of NAT
        ex n be Element of NAT st k <= n & (f1/*(h+c)).n = f1.x0;

       defpred P[object] means $1 = f1.x0;

A67:   for k be Element of NAT ex n be Element of NAT
          st k <= n & P[(f1/*(h+c)).n] by A66;
       consider I1 be increasing sequence of NAT such that
A68:    for n being Nat holds P[(f1/*(h+c)*I1).n] and
        for n be Element of NAT st for r be Real st r = (f1/*(h+c)).n holds
          P[r] ex m be Element of NAT st n = I1.m
        from FDIFF_2:sch 1(A67);
       reconsider h1 = h*I1 as 0-convergent non-zero Real_Sequence
          by FDIFF_2:6;

       set c1 = c*I1;
A69:   c1 = c by VALUED_0:26;
A70:   rng c1 = {x0} by A13,VALUED_0:26;

A71:    rng h1 c= rng h by VALUED_0:21;

A72:   for n be Nat holds h1.n < 0
       proof
        let n be Nat;
        dom h1 = NAT by FUNCT_2:def 1; then
        h1.n in rng h1 by FUNCT_1:3,ORDINAL1:def 12; then
        ex m be Element of NAT st h1.n = h.m by A71,FUNCT_2:113;
        hence h1.n < 0 by A15;
       end;

       reconsider c1 as constant Real_Sequence;
A73:   now
        let g be Real such that
A74:     0 < g;
        reconsider n = 0 as Nat;
        take n;
        let m be Nat such that n <= m;
A75:    m in NAT by ORDINAL1:def 12;
        |.(h1"(#)(f1/*(h1+c1) - f1/*c1)).m - 0 .| = |.(h1").m *(f1/*(
          h1+c1) - f1/*c1).m.| by SEQ_1:8
         .= |.(h1").m *((f1/*(h1+c1)).m - (f1/*c1).m).| by RFUNCT_2:1
         .= |.(h1").m *((f1/*(h1+c1)).m - f1.(c.m)).|
           by A69,A75,A12,A13,A10,ZFMISC_1:31,FUNCT_2:108
         .= |.(h1").m *((f1/*(h1+c1)).m - f1.x0).| by A16
         .= |.(h1").m *((f1/*((h+c)*I1)).m - f1.x0).| by RFUNCT_2:2
         .= |.(h1").m *((f1/*(h+c)*I1).m - f1.x0).|
             by A21,XBOOLE_1:18,FUNCT_2:110
         .= |.(h1").m *(f1.x0 - f1.x0).| by A68
         .= 0 by ABSVALUE:2;
        hence |.(h1"(#)(f1/*(h1+c1) - f1/*c1)).m - 0 .| < g by A74;
       end;

       rng ((h + c)*I1) c= rng (h + c) by VALUED_0:21; then
       rng ((h + c)*I1) c= dom f1 by A12,A14; then
A76:   rng (h1 + c1) c= dom f1 by RFUNCT_2:2; then
A77:   lim (h1"(#)(f1/*(h1+c1) - f1/*c1)) = Ldiff(f1,x0)
          by A1,A70,A72,FDIFF_3:9;

       Ldiff(f1,x0) = Ldiff(f1,x0); then
       h1"(#)(f1/*(h1+c1) - f1/*c1) is convergent
          by A1,A70,A76,A72,FDIFF_3:9; then
A78:   Ldiff(f1,x0) = 0 by A77,A73,SEQ_2:def 7;

       now per cases;
        suppose
         ex k be Element of NAT st
          for n be Element of NAT st k <= n holds (f1/*((h+c)^\N)).n = f1.x0;
         then consider k be Element of NAT such that
A79:      for n be Element of NAT st k <= n holds (f1/*((h+c)^\N)).n = f1.x0;

A80:     now let g be Real such that
A81:       0 < g;
          reconsider n = k as Nat;
          take n;
          let m be Nat;
A82:      m in NAT by ORDINAL1:def 12;
          assume
A83:        n <= m;

          |. ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m
               - Rdiff(f2,f1.x0)*Ldiff(f1, x0 ) .|
            = |.( ((h")^\N) (#) (((f2*f1)/*(h+c) - (f2*f1)/*c)^\N) ).m .|
                  by A78,SEQM_3:19
           .= |.(((h")^\N) (#) ( ((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N )).m.|
                  by SEQM_3:17
           .= |. ((h")^\N).m * ( ((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ).m .|
                  by SEQ_1:8
           .= |. ((h")^\N).m *((((f2*f1)/*(h+c))^\N).m - (((f2*f1)/*c)^\N).m).|
                  by RFUNCT_2:1
           .= |. ((h")^\N).m *(((f2*f1)/*((h+c)^\N)).m - (((f2*f1)/*c)^\N).m).|
                  by A14,VALUED_0:27
           .= |. ((h")^\N).m *(((f2*f1)/*((h+c)^\N)).m - ((f2*f1)/*(c^\N)).m).|
                  by A13,A10,ZFMISC_1:31,VALUED_0:27
       .= |. ((h")^\N).m * ((f2/*(f1/*((h+c)^\N))).m - ((f2*f1)/*(c^\N)).m).|
                  by A40,VALUED_0:31
       .= |. ((h")^\N).m * ((f2/*(f1/*((h+c)^\N))).m - (f2/*(f1/*(c^\N))).m).|
                  by A40,VALUED_0:31
       .= |. ((h")^\N).m * ( f2.((f1/*((h+c)^\N)).m) - (f2/*(f1/*(c^\N))).m).|
        by A41,FUNCT_2:108,A82
       .= |. ((h")^\N).m * ( f2.(f1.x0) - (f2/*(f1/*(c^\N))).m).|
           by A83,A79,A82
       .= |. ((h")^\N).m * ( f2.(f1.x0) - f2.((f1/*(c^\N)).m)).| by
A82,A41,FUNCT_2:108
       .= |. ((h")^\N).m * ( f2.(f1.x0) - f2.( f1.( (c^\N).m) )).| by
       A42,FUNCT_2:108,A82
       .= |. ((h")^\N).m * ( f2.(f1.x0) - f2.( f1.( c.(N+m) ))).| by
       NAT_1:def 3
       .= |. ((h")^\N).m * ( f2.(f1.x0) - f2.(f1.x0)).| by A16
           .= 0 by ABSVALUE:2;
          hence
              |. ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m
                   - Rdiff(f2,f1.x0)*Ldiff(f1,x0).|<g by A81;
         end; then
A84:      (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N is convergent
            by SEQ_2:def 6; then
A85:      lim ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N)
           = Rdiff(f2,f1.x0)*Ldiff(f1,x0) by A80,SEQ_2:def 7;
         thus h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
           by A84,SEQ_4:21;
         thus lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = Rdiff(f2,f1.x0)*
            Ldiff(f1,x0) by A84,A85,SEQ_4:22;
        end;

        suppose
A86:     for k be Element of NAT
          ex n be Element of NAT st k <= n & (f1/*((h+c)^\N)).n <> f1.x0;

         defpred P[object] means $1 <> f1.x0;
A87:     for k be Element of NAT
          ex n be Element of NAT st k <= n & P[(f1/*((h+c)^\N)).n]
            by A86;

         consider I2 be increasing sequence of NAT such that
A88:      for n being Nat holds P[(f1/*((h+c)^\N)*I2).n] and
A89:      for n be Element of NAT st for r be Real st
            r = (f1/*((h+c)^\N)).n holds P[r]
             ex m be Element of NAT st n
            = I2.m from FDIFF_2:sch 1(A87);

A90:      d^\N = (f1/*(h+c))^\N - (f1/*c)^\N by SEQM_3:17
          .= f1/*((h+c)^\N) - (f1/*c)^\N by A21,XBOOLE_1:18,VALUED_0:27
          .= f1/*((h+c)^\N) - f1/*(c^\N) by A12,A13,A10
,ZFMISC_1:31,VALUED_0:27;

         rng(c^\N) c= rng c & rng((h+c)^\N) c= rng(h+c) by VALUED_0:21; then
A91:      rng(c^\N) c= dom f1 & rng((h+c)^\N) c= dom f1 by A22,A12,A14;

A92:      a^\N = f1/*(c^\N) by A12,A13,A10,ZFMISC_1:31,VALUED_0:27;

A93:      now
          given n being Nat such that
A94:       ((d^\N)*I2).n = 0;

          0 = (d^\N).(I2.n) by A94,FUNCT_2:15,ORDINAL1:def 12
           .= (f1/*((h+c)^\N)).(I2.n) - (f1/*(c^\N)).(I2.n) by A90,RFUNCT_2:1
           .= (f1/*((h+c)^\N)).(I2.n) - f1.((c^\N).(I2.n)) by A91,FUNCT_2:108
           .= (f1/*((h+c)^\N)).(I2.n) - f1.(c.(N + I2.n)) by NAT_1:def 3
           .= (f1/*((h+c)^\N)).(I2.n) - f1.x0 by A16
           .= (f1/*((h+c)^\N)*I2).n - f1.x0 by FUNCT_2:15,ORDINAL1:def 12;
          hence contradiction by A88;
         end;

         reconsider h2 = h^\N*I2 as 0-convergent non-zero
              Real_Sequence by FDIFF_2:6;
         reconsider a1 = a^\N*I2 as constant Real_Sequence;
         reconsider c2 = c^\N*I2 as constant Real_Sequence;
         set s = h2"(#)(f1/*(h2+c2) - f1/*c2);

         d^\N*I2 is subsequence of d by VALUED_0:20; then
         lim (d^\N*I2) = 0 by A37,A26,A43,SEQ_4:17;
         then reconsider d1 = d^\N*I2 as 0-convergent non-zero
         Real_Sequence by A37,A26,SEQ_4:16,A93,SEQ_1:5,FDIFF_1:def 1;

         set t = d1"(#)(f2/*(d1+a1) - f2/*a1);
         a1 is subsequence of a by VALUED_0:20; then
A95:     rng a1 = {f1.x0} by A33,VALUED_0:26;
A96:     now
          let n be Element of NAT;
          thus (d^\N + a^\N).n = (d^\N).n + (a^\N).n by SEQ_1:7
             .= (f1/*((h+c)^\N)).n - (a^\N).n + (a^\N).n by A90,A92,RFUNCT_2:1
             .= (f1/*((h+c)^\N)).n;
         end;

A97:     rng((f1/*(h+c))^\N) c= rng(f1/*(h+c)) by VALUED_0:21; then
A98:    rng((f1/*(h+c))^\N) c= dom f2 by A28;

         rng(a^\N) c= rng a by VALUED_0:21; then
A99:    rng(a^\N) c= dom f2 by A34;

         d1 + a1 = (d^\N + a^\N)*I2 by RFUNCT_2:2; then
A100:     d1 + a1 = f1/*((h+c)^\N)*I2 by A96,FUNCT_2:63
           .= ((f1/*(h+c))^\N)*I2 by A21,XBOOLE_1:18,VALUED_0:27;

A101:      h2+c2 = (h^\N + c^\N)*I2 by RFUNCT_2:2
          .= (h+c)^\N * I2 by SEQM_3:15;

A102:     t(#)s = d1"(#)(f2/*(d1+a1) - f2/*a1) (#)
                  ( ( (f1/*((h+c)^\N))*I2 - f1/*c2 )(#)h2" )
                     by A91,A101,FUNCT_2:110
          .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#)
                  ( ( (f1/*((h+c)^\N))*I2 - (f1/*(c^\N)) *I2)(#)h2" )
                    by A91,FUNCT_2:110
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#)
                  ( ( (f1/*((h+c)^\N))*I2 - (f1/*(c^\N)) *I2)(#)h2" )
                    by VALUED_1:def 10
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#)
                  ( ( (f1/*(h+c))^\N*I2 - (f1/*(c^\N)) *I2)(#)h2" )
                    by A21,XBOOLE_1:18,VALUED_0:27
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#)
                  ( ( (f1/*(h+c))^\N*I2 - (f1/*c)^\N *I2)(#)h2" )
                    by A12,A13,A10,ZFMISC_1:31,VALUED_0:27
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#)
                  ( ( ((f1/*(h+c))^\N - (f1/*c)^\N)*I2)(#)h2" )
                    by RFUNCT_2:2
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (d1(#)h2") by SEQM_3:17
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) d1(#)h2" by SEQ_1:14
          .= (f2/*(((f1/*(h+c))^\N)*I2) - f2/*a1) (#) h2" by A100,SEQ_1:37
          .= (   (f2 /* ((f1/*(h+c))^\N)) * I2 - f2/*a1  ) (#) h2"
            by A98,FUNCT_2:110
          .= (   (f2/*(f1/*(h+c)))^\N * I2 - f2/*a1  ) (#) h2"
            by A28,VALUED_0:27
          .= (((f2*f1)/*(h+c))^\N*I2 - f2/*a1) (#) h2" by A14,VALUED_0:31
          .= (((f2*f1)/*(h+c))^\N*I2 - (f2/*(a^\N))*I2) (#) h2"
            by A99,FUNCT_2:110
          .= (((f2*f1)/*(h+c))^\N*I2 - ( (f2/*a)^\N )*I2) (#) h2"
            by A33,A11,ZFMISC_1:31,VALUED_0:27
          .= (((f2*f1)/*(h+c))^\N*I2 - ( ((f2*f1)/*c)^\N )*I2) (#) h2"
            by A13,A10,ZFMISC_1:31,VALUED_0:31
          .= (( ((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ) *I2) (#) h2"
            by RFUNCT_2:2
          .= (( ((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ) *I2) (#) (((h^\N)")*I2)
            by RFUNCT_2:5
          .= ((h^\N)"(#)(((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ))*I2
            by RFUNCT_2:2;

         rng (((f1/*(h+c))^\N)*I2) c= rng ((f1/*(h+c))^\N) by VALUED_0:21; then
A103:     rng (d1 + a1) c= dom f2 by A97,A28,A100;

         ((h+c)^\N)*I2 is subsequence of (h+c) by VALUED_0:20; then
         rng (((h + c)^\N)*I2) c= rng (h + c) by VALUED_0:21; then
         rng (((h + c)^\N)*I2) c= dom f1 by A12,A14; then
         rng ((h^\N + c^\N)*I2) c= dom f1 by SEQM_3:15; then
A104:     rng (h2 + c2) c= dom f1 by RFUNCT_2:2;

         h2 is subsequence of h by VALUED_0:20; then
A105:    rng h2 c= rng h by VALUED_0:21;

A106:     for n be Nat holds h2.n < 0
         proof
          let n be Nat;
          dom h2 = NAT by FUNCT_2:def 1; then
          h2.n in rng h2 by FUNCT_1:3,ORDINAL1:def 12; then
          ex m be Element of NAT st h2.n = h.m by A105,FUNCT_2:113;
          hence h2.n < 0 by A15;
         end;

         c2 is subsequence of c by VALUED_0:20; then
A107:     rng c2 = {x0} by A13,VALUED_0:26; then
A108:     lim s = Ldiff(f1,x0) by A1,A104,A106,FDIFF_3:9;

A109:     for n be Nat holds d1.n > 0
         proof
          let n be Nat;

          n in NAT by ORDINAL1:def 12; then
A110:      n in dom I2 by FUNCT_2:def 1; then
A111:      (f1/*((h+c)^\N)*I2).n
            = (f1/*((h+c)^\N)).(I2.n) by FUNCT_1:13
           .= f1.(((h+c)^\N).(I2.n)) by A42,FUNCT_2:108;

A112:      d1.n = (f1/*((h+c)^\N) - f1/*(c^\N)).(I2.n) by A90,A110,FUNCT_1:13
           .= (f1/*((h+c)^\N)).(I2.n) - (f1/*(c^\N)).(I2.n) by RFUNCT_2:1
           .= (f1/*((h+c)^\N)).(I2.n) - f1.((c^\N).(I2.n)) by A42,FUNCT_2:108
           .= (f1/*((h+c)^\N)).(I2.n) - f1.(c.(N+I2.n)) by NAT_1:def 3
           .= (f1/*((h+c)^\N)).(I2.n) - f1.x0 by A16
           .= f1.(((h+c)^\N).(I2.n)) - f1.x0 by A42,FUNCT_2:108;

A113:      ((h+c)^\N).(I2.n) = (h+c).(N+I2.n) by NAT_1:def 3; then
A114:      ((h+c)^\N).(I2.n) = h.(N+I2.n) + c.(N+I2.n) by SEQ_1:7
           .= h.(N+I2.n) + x0 by A16;

          |. ((h+c)^\N).(I2.n) - x0 .| < r by A113,A24,A38,NAT_1:12; then
          -h.(N+I2.n) < r by A15,A114,ABSVALUE:def 1; then
          -(-h.(N+I2.n)) > -r by XREAL_1:24; then
          x0-r < ((h+c)^\N).(I2.n) & ((h+c)^\N).(I2.n) < x0
            by A114,A15,XREAL_1:8,30; then
          ((h+c)^\N).(I2.n) in [. x0-r,x0 .] by XXREAL_1:1; then
          f1.(((h+c)^\N).(I2.n)) in [. f1.x0, f1.x0+r1 .]
            by A7,FUNCT_1:54; then
          f1.x0 <= f1.(((h+c)^\N).(I2.n)) by XXREAL_1:1; then
          f1.x0 < f1.(((h+c)^\N).(I2.n)) by A88,A111,XXREAL_0:1;
          hence d1.n > 0 by A112,XREAL_1:50;
         end;

         Ldiff(f1,x0) = Ldiff(f1,x0); then
A115:     s is convergent by A1,A107,A104,A106,FDIFF_3:9;
         Rdiff(f2,f1.x0) = Rdiff(f2,f1.x0); then
A116:     t is convergent by A2,A95,A103,A109,FDIFF_3:15;

         lim t = Rdiff(f2,f1.x0) by A2,A95,A103,A109,FDIFF_3:15; then
A117:     lim (((h^\N)"(#)(((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ))*I2)
           = Rdiff(f2,f1.x0) * Ldiff(f1,x0) by A102,A115,A108,A116,SEQ_2:15;

A118:     now
          set DF = Rdiff(f2,f1.x0) * Ldiff(f1,x0);
          let g be Real such that
A119:       0 < g;
          consider k being Nat such that
A120:       for m being Nat st k <= m holds
            |.(((h^\N)"(#)(((f2*f1)/*(h+c))^\N
              - ((f2*f1)/*c)^\N ))*I2).m - DF.|<g
              by A102,A115,A116,A117,A119,SEQ_2:def 7;
A121:      k in NAT by ORDINAL1:def 12;
          reconsider n = I2.k as Nat;
          take n;
          let m be Nat such that
A122:       n <= m;
A123:      m in NAT by ORDINAL1:def 12;

A124:       ( h"(#)( (f2*f1)/*(h+c) - (f2*f1)/*c ) )^\N
           = ((h")^\N)(#)(( (f2*f1)/*(h+c) - (f2*f1)/*c )^\N) by SEQM_3:19
          .= (h^\N)"(#)(( (f2*f1)/*(h+c) - (f2*f1)/*c )^\N) by SEQM_3:18
          .= (h^\N)"(#)(((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N) by SEQM_3:17;

          now per cases;
           suppose
A125:        (f1/*((h+c)^\N)).m = f1.x0;

A126:        ((h^\N)"(#)(((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N)).m
             = ((h^\N)").m * (((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N).m
             by SEQ_1:8;

A127:        (((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N).m
             = (((f2*f1)/*(h+c))^\N).m - (((f2*f1)/*c)^\N).m by RFUNCT_2:1;

            dom((h+c)^\N) = NAT by FUNCT_2:def 1; then
            dom(f1*((h+c)^\N)) = NAT by A91,RELAT_1:27; then
            dom(f1/*((h+c)^\N)) = NAT by A91,FUNCT_2:def 11; then
A128:        dom(f2*(f1/*((h+c)^\N))) = NAT by A41,RELAT_1:27;

            ((f2*f1)/*(h+c))^\N
              = (f2*f1)/*((h+c)^\N) by A14,VALUED_0:27
             .= f2/*(f1/*((h+c)^\N)) by A40,VALUED_0:31
             .= f2*(f1/*((h+c)^\N)) by A41,FUNCT_2:def 11; then
A129:        (((f2*f1)/*(h+c))^\N).m
             = f2.(f1.x0) by A125,A128,FUNCT_1:12,ORDINAL1:def 12;

            dom(c^\N) = NAT by FUNCT_2:def 1; then
            dom(f1*(c^\N)) = NAT by A91,RELAT_1:27; then
            dom(f1/*(c^\N)) = NAT by A91,FUNCT_2:def 11; then
A130:        dom(f2*(f1/*(c^\N))) = NAT by A41,RELAT_1:27;

            ((f2*f1)/*c)^\N = (f2*f1)/*(c^\N) by A13,A10
,ZFMISC_1:31,VALUED_0:27
             .= f2/*(f1/*(c^\N)) by A40,VALUED_0:31
             .= f2*(f1/*(c^\N)) by A41,FUNCT_2:def 11; then
            (((f2*f1)/*c)^\N).m = f2.((f1/*(c^\N)).m)
              by ORDINAL1:def 12,A130,FUNCT_1:12
             .= f2.(f1.((c^\N).m)) by A123,A91,FUNCT_2:108
             .= f2.(f1.(c.(N+m))) by NAT_1:def 3
             .= f2.(f1.x0) by A16;
            hence
              |.((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m - DF.| < g by
                 A124,A119,A78,A126,A129,A127,ABSVALUE:2;
           end;
           suppose
            (f1/*((h+c)^\N)).m <> f1.x0; then
            for r1 be Real holds (f1/*((h+c)^\N)).m = r1 implies r1<>f1.x0;
            then
            consider l be Element of NAT such that
A131:         m = I2.l by A89,A123;

            dom I2 = NAT by FUNCT_2:def 1;
            then l >= k by A122,A131,VALUED_0:def 13,A121; then
            |.(((h^\N)"(#)(((f2*f1)/*(h+c))^\N
              - ((f2*f1)/*c)^\N ))*I2).l - DF.| < g by A120;
            hence |.((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m - DF.| < g
              by A124,A131,FUNCT_2:15;
           end;
          end;
          hence
              |.((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m
                - Rdiff(f2,f1.x0) *Ldiff(f1,x0).|<g;
         end; then
A132:     (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N is convergent by
           SEQ_2:def 6;
         hence h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent by SEQ_4:21;
         lim ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N)
            = Rdiff(f2,f1.x0)*Ldiff(f1,x0) by A118,A132,SEQ_2:def 7;
         hence lim (h"(#) ((f2*f1)/*(h+c) - (f2*f1)/*c)) = Rdiff(f2,f1.x0)*
            Ldiff(f1,x0) by A132,SEQ_4:22;
        end;
       end;
       hence thesis;
      end;
     end;
     hence thesis;
    end;
    hence thesis by A6,A9,FDIFF_3:9;
end;

theorem Th44:
for x0 be Real, f1,f2 be PartFunc of REAL,REAL st
 f1 is_differentiable_in x0 & f2 is_right_differentiable_in f1.x0 &
   (for r1 be Real st r1 > 0 ex r0 be Real st r0 > 0 &
    [.x0-r0,x0+r0.] c= dom([.f1.x0,f1.x0+r1.]|`f1)) holds
  f2*f1 is_differentiable_in x0 &
  diff(f2*f1,x0) = Rdiff(f2,f1.x0)*diff(f1,x0)
proof
    let x0 be Real, f1,f2 be PartFunc of REAL,REAL;
    assume that
A1:  f1 is_differentiable_in x0 and
A2:  f2 is_right_differentiable_in f1.x0 and
A3: for r1 be Real st r1 > 0 ex r0 be Real st r0>0 &
      [.x0-r0,x0+r0.] c= dom([.f1.x0,f1.x0+r1.]|`f1);

A4: f1 is_right_differentiable_in x0 & f1 is_left_differentiable_in x0 &
    diff(f1,x0) = Rdiff(f1,x0) & diff(f1,x0) = Ldiff(f1,x0)
      by A1,FDIFF_3:22;
    for r1 be Real st r1 > 0 ex r0 be Real st r0>0 &
      [.x0,x0+r0.] c= dom([.f1.x0,f1.x0+r1.]|`f1)
    proof
     let r1 be Real;
     assume r1 > 0; then
     consider r0 be Real such that
A5:  r0>0 &
      [.x0-r0,x0+r0.] c= dom([.f1.x0,f1.x0+r1.]|`f1) by A3;
     take r0;
     x0-r0 < x0 by A5,XREAL_1:44; then
     [.x0,x0+r0.] c= [.x0-r0,x0+r0.] by XXREAL_1:34;
     hence thesis by A5;

    end; then
A6: f2*f1 is_right_differentiable_in x0 &
    Rdiff(f2*f1,x0) = Rdiff(f2,f1.x0)*Rdiff(f1,x0) by A4,A2,Th42;

    for r1 be Real st r1 > 0 ex r0 be Real st r0 > 0 &
      [.x0-r0,x0.] c= dom([.f1.x0,f1.x0+r1.]|`f1)
    proof
     let r1 be Real;
     assume r1 > 0; then
     consider r0 be Real such that
A7:  r0>0 &
      [.x0-r0,x0+r0.] c= dom([.f1.x0,f1.x0+r1.]|`f1) by A3;
     take r0;
     x0 < x0+r0 by A7,XREAL_1:29; then
     [.x0-r0,x0.] c= [.x0-r0,x0+r0.] by XXREAL_1:34;
     hence thesis by A7;
    end; then
    f2*f1 is_left_differentiable_in x0 &
    Ldiff(f2*f1,x0) = Rdiff(f2,f1.x0)*Ldiff(f1,x0) by A4,A2,Th43;
    hence thesis by A4,A6,FDIFF_3:21;
end;

theorem Th45:
for x0 be Real, f1,f2 be PartFunc of REAL,REAL st
 f1 is_right_differentiable_in x0 & f2 is_left_differentiable_in f1.x0 &
  (for r1 be Real st r1 > 0 ex r0 be Real st r0 > 0 &
    [.x0,x0+r0.] c= dom([.f1.x0-r1,f1.x0.]|`f1)) holds
  f2*f1 is_right_differentiable_in x0 &
  Rdiff(f2*f1,x0) = Ldiff(f2,f1.x0)*Rdiff(f1,x0)
proof
    let x0 be Real, f1,f2 be PartFunc of REAL,REAL;
    assume that
A1:  f1 is_right_differentiable_in x0 and
A2:  f2 is_left_differentiable_in f1.x0 and
A3: for r1 be Real st r1 > 0 ex r0 be Real st r0>0 &
      [.x0,x0+r0.] c= dom([.f1.x0-r1,f1.x0.]|`f1);

    consider r1 be Real such that
A4: r1 > 0 & [. f1.x0-r1,f1.x0 .] c= dom f2 by A2,FDIFF_3:def 4;

    consider r0 be Real such that
A5: r0>0 &
     [.x0,x0+r0.] c= dom([.f1.x0-r1,f1.x0.]|`f1) by A3,A4;

    set r = min(r0,r1);
A6: r > 0 by A4,A5,XXREAL_0:21;
    x0+r <= x0+r0 & f1.x0 - r1 <= f1.x0 - r by XREAL_1:6,10,XXREAL_0:17; then
    [.x0,x0+r.] c= [.x0,x0+r0.] & [.f1.x0-r,f1.x0.] c= [.f1.x0-r1,f1.x0.]
      by XXREAL_1:34; then
A7:[.x0,x0+r.] c= dom([.f1.x0-r1,f1.x0.]|`f1) by A5;

A8:now let x be Real;
     assume x in [.x0,x0+r.]; then
     x in dom f1 & f1.x in [.f1.x0-r1,f1.x0.] by A7,FUNCT_1:54;
     hence x in dom(f2*f1) by A4,FUNCT_1:11;
    end; then
A9:[.x0,x0+r.] c= dom(f2*f1);

A10: dom(f2*f1) c= dom f1 by RELAT_1:25;

    x0 < x0+r by A6,XREAL_1:29; then
A11: x0 in dom(f2*f1) by A8,XXREAL_1:1; then
A12: f1.x0 in dom f2 by FUNCT_1:11;

    for h,c st rng c = {x0} & rng (h + c) c= dom (f2*f1) &
     (for n be Nat holds h.n > 0) holds
     h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
   & lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = Ldiff(f2,f1.x0)*Rdiff(f1,x0)
    proof
     let h,c;
     assume that
A13:   rng c = {x0} and
A14:   rng (h + c) c= dom (f2*f1) and
A15:   for n be Nat holds h.n > 0;

A16:  for n be Nat holds c.n = x0
     proof
      let n be Nat;
      c.n in rng c by VALUED_0:28;
      hence c.n = x0 by A13,TARSKI:def 1;
     end;

A17: now let x be Real;
      assume A18: x in rng(h+c); then
      consider n be Element of NAT such that
A19:    x = (h+c).n by FUNCT_2:113;
      dom(h+c) = NAT by FUNCT_2:def 1; then
      x = h.n + c.n by A19,VALUED_1:def 1; then
      x = h.n + x0 by A16; then
      x > x0 by A15,XREAL_1:29; then
      x in ].x0,+infty.[ by XXREAL_1:235; then
A20:   x in right_open_halfline x0 by LIMFUNC1:def 3;
      x in dom f1 by A18,A14,FUNCT_1:11;
      hence x in right_open_halfline x0 /\ dom f1 by A20,XBOOLE_0:def 4;
     end; then
A21:  rng (h + c) c= right_open_halfline x0 /\ dom f1;

     set a = f1/*c;

A22:  rng c c= dom (f2*f1) by A13,A11,ZFMISC_1:31;

     set d = f1/*(h+c) - f1/*c;

A23: lim h = 0;

     lim c = c.0 by SEQ_4:25; then
     lim c = x0 by A16; then
A24: lim (h + c) = 0 + x0 by A23,SEQ_2:6 .= x0;
A25: f1 is_Rcontinuous_in x0 by A1,FDIFF_3:7; then
A26: f1/*(h+c) is convergent by A21,A24,FDIFF_3:def 2;

A27: f1.x0 = lim (f1/*(h+c)) by A21,A24,A25,FDIFF_3:def 2;
A28: rng (f1/*(h+c)) c= dom f2 by A14,FDIFF_2:9;

     now let x be Real;
      assume x in rng a; then
      consider n be Element of NAT such that
A29:   a.n = x by FUNCT_2:113;
      c.n = x0 by A16;
      then x = f1.x0 by A29,A10,A13,A11,ZFMISC_1:31,FUNCT_2:108;
      hence x in {f1.x0} by TARSKI:def 1;
     end; then
A30: rng a c= {f1.x0};

     now let x be Real;
A31:  a.0 in rng a by VALUED_0:28;
      assume x in {f1.x0}; then
A32:  x = f1.x0 by TARSKI:def 1;
      c.0 = x0 by A16;
      hence x in rng a by A32,A31,A10,A13,A11,ZFMISC_1:31,FUNCT_2:108;
     end; then
     {f1.x0} c= rng a; then
A33: rng a = { f1.x0 } by A30,XBOOLE_0:def 10; then
A34: rng a c= dom f2 by A12,ZFMISC_1:31;

A35: now
      let n be Nat;
      a.n in rng a by VALUED_0:28;
      then
A36:  a.n = f1.x0 by A30,TARSKI:def 1;
      a.(n+1) in rng a by VALUED_0:28;
      hence a.n = a.(n+1) by A30,A36,TARSKI:def 1;
     end;
     then
A37: a is constant by VALUED_0:25;

     consider N be Nat such that
A38:   for m be Nat st N <= m holds |. (h+c).m - lim (h+c) .| < r
       by A6,SEQ_2:def 7;

A39:  rng((h+c)^\N) c= rng(h+c) & rng(c^\N) c= rng c by NAT_1:55; then
A40:  rng((h+c)^\N) c= dom(f2*f1) & rng(c^\N) c= dom(f2*f1) by A14,A22; then
A41:  rng(f1/*((h+c)^\N)) c= dom f2 & rng(f1/*(c^\N)) c= dom f2 by FDIFF_2:9;

     dom(f2*f1) c= dom f1 by RELAT_1:25; then
A42:  rng((h+c)^\N) c= dom f1 & rng(c^\N) c= dom f1 by A39,A14,A22;

     reconsider a as constant Real_Sequence by A35,VALUED_0:25;
     a.0 in rng a by VALUED_0:28;
     then a.0 = f1.x0 by A30,TARSKI:def 1;
     then lim a = f1.x0 by SEQ_4:25;
     then
A43: lim d = f1.x0 - f1.x0 by A26,A27,SEQ_2:12 .= 0;

     h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent &
     lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = Ldiff(f2,f1.x0)*Rdiff(f1,x0)
     proof
      per cases;
      suppose
       ex k be Element of NAT st for n be Element of NAT
        st k <= n holds (f1/*(h+c)).n <> f1.x0; then
       consider k1 be Element of NAT such that
A44:    for n be Element of NAT st k1 <= n holds (f1/*(h+c)).n <> f1.x0;
       reconsider k = max(k1,N) as Element of NAT by ORDINAL1:def 12;
A45:    k1 <= k & N <= k by XXREAL_0:25;
A46:    now
        given n being Nat such that
A47:     (d^\k).n = 0;
A48:    k+n is Element of NAT by ORDINAL1:def 12;
        0 = d.(k+n) by A47,NAT_1:def 3
         .= (f1/*(h+c)).(k+n) - (f1/*c).(k+n) by RFUNCT_2:1
         .= (f1/*(h+c)).(k+n) - f1.(c.(k+n))
           by A48,A10,A13,A11,ZFMISC_1:31,FUNCT_2:108
         .= (f1/*(h+c)).(n+k) - f1.x0 by A16;
        hence contradiction by A44,A45,NAT_1:12;
       end;

       set c1 = c^\k;
       set h1 = h^\k;
       set a1 = a^\k;
       set s = h1"(#)(f1/*(h1 + c1) - f1/*c1);
A49:   now
        let n be Element of NAT;
        thus (d + a).n = d.n + a.n by SEQ_1:7
           .= (f1/*(h+c)).n - a.n + a.n by RFUNCT_2:1
           .= (f1/*(h+c)).n;
       end;

       lim (d^\k) = 0 by A37,A26,A43,SEQ_4:20;
       then reconsider d1 = d^\k as 0-convergent non-zero Real_Sequence
          by A37,A26,A46,SEQ_1:5,FDIFF_1:def 1;

A50:    for n being Nat holds d1.n < 0
       proof
        let n be Nat;
A51:    dom(h+c) = NAT by FUNCT_2:def 1;

A52:    d1.n = d.(k+n) by NAT_1:def 3
         .= (f1/*(h+c)).(n+k) - (f1/*c).(n+k) by RFUNCT_2:1
         .= (f1/*(h+c)).(n+k) - f1.(c.(n+k))
           by A10,A13,A11,ZFMISC_1:31,FUNCT_2:108
         .= (f1/*(h+c)).(n+k) - f1.x0 by A16
         .= f1.((h+c).(n+k)) - f1.x0 by A21,XBOOLE_1:18,FUNCT_2:108;

        (h+c).(k+n) = h.(k+n)+c.(k+n)
          by A51,ORDINAL1:def 12,VALUED_1:def 1; then
A53:    (h+c).(k+n) = h.(k+n)+x0 by A16;

        |. (h+c).(k+n) - lim(h+c) .| < r by A38,A45,NAT_1:12; then
        |. h.(k+n) + c.(k+n) - x0 .| < r
          by A24,A51,ORDINAL1:def 12,VALUED_1:def 1; then
A54:    |. h.(k+n) + x0 - x0 .| < r by A16;

        h.(k+n) > 0 by A15; then
        h.(k+n) < r by A54,ABSVALUE:def 1; then
        x0 < (h+c).(k+n) & (h+c).(k+n) < x0+r by A53,A15,XREAL_1:8,29; then
        (h+c).(k+n) in [.x0,x0+r.] by XXREAL_1:1; then
        f1.((h+c).(k+n)) in [.f1.x0-r1,f1.x0.] by A7,FUNCT_1:54; then
A55:    f1.x0 >= f1.((h+c).(k+n)) by XXREAL_1:1;
        0 <> d1.n by A46;
        hence d1.n < 0 by A55,A52,XREAL_1:47;
       end;

       set t = d1"(#)(f2/*(d1 + a1) - f2/*a1);

       d1 + a1 = (d + a)^\k by SEQM_3:15;
       then
A56:   d1 + a1 = (f1/*(h+c))^\k by A49,FUNCT_2:63;

       rng ((f1/*(h+c))^\k) c= rng (f1/*(h+c)) by VALUED_0:21;
       then
A57:   rng (d1 + a1) c= dom f2 by A28,A56;
A58:   rng a1 = {f1.x0} by A33,VALUED_0:26;
       then
A59:   lim t = Ldiff(f2,f1.x0) by A2,A50,A57,FDIFF_3:9;

       Ldiff(f2,f1.x0) = Ldiff(f2,f1.x0);
       then
A60:   t is convergent by A2,A58,A57,A50,FDIFF_3:9;
       rng ((h + c)^\k) c= rng (h + c) by VALUED_0:21; then
       rng ((h + c)^\k) c= right_open_halfline x0 /\ dom f1 by A17; then
A61:   rng (h1 + c1) c= right_open_halfline x0 /\ dom f1 by SEQM_3:15;
       right_open_halfline x0 /\ dom f1 c= dom f1 by XBOOLE_1:17; then
A62:   rng (h1+c1) c= dom f1 by A61;
A63:   rng c1 = {x0} by A13,VALUED_0:26;
A64:   for n be Nat holds h1.n > 0
       proof
        let n be Nat;
        h1.n = h.(k+n) by NAT_1:def 3;
        hence h1.n > 0 by A15;
       end;

       Rdiff(f1,x0) = Rdiff(f1,x0); then
A65:   s is convergent by A1,A63,A64,A62,FDIFF_3:15;

A66:   t(#)s = d1"(#)(f2/*(d1+a1) - f2/*a1) (#) ((f1/*((h+c)^\k) - f1/*
        c1) (#)h1") by SEQM_3:15
          .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#) (((f1/*(h+c))^\k - f1/*c1)(#)
        h1") by A21,XBOOLE_1:18,VALUED_0:27
          .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#) (((f1/*(h+c))^\k - (f1/*c)^\k)
        (#)h1") by A10,A13,A11,ZFMISC_1:31,VALUED_0:27
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (((f1/*(h+c))^\k - (f1/*c)^\k)
        (#)h1") by VALUED_1:def 10
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (d1(#)h1") by SEQM_3:17
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) d1(#)h1" by SEQ_1:14
          .= (f2/*(d1+a1) - f2/*a1) (#) h1" by SEQ_1:37
          .= ((f2/*(f1/*(h+c)))^\k - f2/*a1) (#) h1" by A28,A56,VALUED_0:27
          .= (((f2*f1)/*(h+c))^\k - f2/*a1) (#) h1" by A14,VALUED_0:31
          .= (((f2*f1)/*(h+c))^\k - ((f2/*a)^\k)) (#) h1"
              by A33,A12,ZFMISC_1:31,VALUED_0:27
          .= (((f2*f1)/*(h+c))^\k - (((f2*f1)/*c)^\k)) (#) h1"
              by A13,A11,ZFMISC_1:31,VALUED_0:31
          .= (((f2*f1)/*(h+c) - (f2*f1)/*c)^\k) (#) h1" by SEQM_3:17
          .= (((f2*f1)/*(h+c) - (f2*f1)/*c)^\k) (#) ((h")^\k) by SEQM_3:18
          .= (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\k by SEQM_3:19;
       hence h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
         by A65,A60,SEQ_4:21;

       lim s = Rdiff(f1,x0) by A1,A63,A64,A62,FDIFF_3:15;
       then lim ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\k) = Ldiff(f2,f1.x0) *
       Rdiff(f1,x0 ) by A66,A65,A60,A59,SEQ_2:15;
       hence thesis by A65,A60,A66,SEQ_4:22;
      end;

      suppose
A67:   for k be Element of NAT
        ex n be Element of NAT st k <= n & (f1/*(h+c)).n = f1.x0;

       defpred P[object] means $1 = f1.x0;

A68:   for k be Element of NAT ex n be Element of NAT
          st k <= n & P[(f1/*(h+c)).n] by A67;
       consider I1 be increasing sequence of NAT such that
A69:    for n being Nat holds P[(f1/*(h+c)*I1).n] and
        for n be Element of NAT st for r be Real st r = (f1/*(h+c)).n holds
          P[r] ex m be Element of NAT st n = I1.m
        from FDIFF_2:sch 1(A68);
       reconsider h1 = h*I1 as 0-convergent non-zero Real_Sequence
          by FDIFF_2:6;

       set c1 = c*I1;
A70:   c1 = c by VALUED_0:26;
A71:   rng c1 = {x0} by A13,VALUED_0:26;

A72:    rng h1 c= rng h by VALUED_0:21;

A73:   for n be Nat holds h1.n > 0
       proof
        let n be Nat;
        dom h1 = NAT by FUNCT_2:def 1; then
        h1.n in rng h1 by FUNCT_1:3,ORDINAL1:def 12; then
        ex m be Element of NAT st h1.n = h.m by A72,FUNCT_2:113;
        hence h1.n > 0 by A15;
       end;

       reconsider c1 as constant Real_Sequence;
A74:   now
        let g be Real such that
A75:    0 < g;
        reconsider n = 0 as Nat;
        take n;
        let m be Nat such that n <= m;
A76:    m in NAT by ORDINAL1:def 12;
        |.(h1"(#)(f1/*(h1+c1) - f1/*c1)).m - 0 .|
          = |.(h1").m *(f1/*(h1+c1) - f1/*c1).m.| by SEQ_1:8
         .= |.(h1").m *((f1/*(h1+c1)).m - (f1/*c1).m).| by RFUNCT_2:1
         .= |.(h1").m *((f1/*(h1+c1)).m - f1.(c.m)).|
           by A70,A76,A10,A13,A11,ZFMISC_1:31,FUNCT_2:108
         .= |.(h1").m *((f1/*(h1+c1)).m - f1.x0).| by A16
         .= |.(h1").m *((f1/*((h+c)*I1)).m - f1.x0).| by RFUNCT_2:2
         .= |.(h1").m *((f1/*(h+c)*I1).m - f1.x0).|
             by A21,XBOOLE_1:18,FUNCT_2:110
         .= |.(h1").m *(f1.x0 - f1.x0).| by A69;
        hence |.(h1"(#)(f1/*(h1+c1) - f1/*c1)).m - 0 .| < g by A75,ABSVALUE:2;
       end;

       rng ((h + c)*I1) c= rng (h + c) by VALUED_0:21;
       then rng ((h + c)*I1) c= dom f1 by A14,A10; then
A77:   rng (h1 + c1) c= dom f1 by RFUNCT_2:2; then
A78:   lim (h1"(#)(f1/*(h1+c1) - f1/*c1)) = Rdiff(f1,x0)
          by A1,A71,A73,FDIFF_3:15;

       Rdiff(f1,x0) = Rdiff(f1,x0); then
       h1"(#)(f1/*(h1+c1) - f1/*c1) is convergent
          by A1,A71,A77,A73,FDIFF_3:15; then
A79:   Rdiff(f1,x0) = 0 by A78,A74,SEQ_2:def 7;

       now per cases;
        suppose
         ex k be Element of NAT st
          for n be Element of NAT st k <= n holds (f1/*((h+c)^\N)).n = f1.x0;
         then consider k be Element of NAT such that
A80:      for n be Element of NAT st k <= n holds (f1/*((h+c)^\N)).n = f1.x0;

A81:     now let g be Real such that
A82:       0 < g;
          reconsider n = k as Nat;
          take n;
          let m be Nat;
A83:      m in NAT by ORDINAL1:def 12;
          assume
A84:        n <= m;

          |. ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m
               - Ldiff(f2,f1.x0)*Rdiff(f1, x0 ) .|
            = |.( ((h")^\N) (#) (((f2*f1)/*(h+c) - (f2*f1)/*c)^\N) ).m .|
                  by A79,SEQM_3:19
           .= |.(((h")^\N) (#) ( ((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N )).m.|
                  by SEQM_3:17
           .= |. ((h")^\N).m * ( ((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ).m .|
                  by SEQ_1:8
           .= |. ((h")^\N).m *((((f2*f1)/*(h+c))^\N).m - (((f2*f1)/*c)^\N).m).|
                  by RFUNCT_2:1
           .= |. ((h")^\N).m *(((f2*f1)/*((h+c)^\N)).m - (((f2*f1)/*c)^\N).m).|
                  by A14,VALUED_0:27
           .= |. ((h")^\N).m *(((f2*f1)/*((h+c)^\N)).m - ((f2*f1)/*(c^\N)).m).|
                  by A13,A11,ZFMISC_1:31,VALUED_0:27
       .= |. ((h")^\N).m * ((f2/*(f1/*((h+c)^\N))).m - ((f2*f1)/*(c^\N)).m).|
                  by A40,VALUED_0:31
       .= |. ((h")^\N).m * ((f2/*(f1/*((h+c)^\N))).m - (f2/*(f1/*(c^\N))).m).|
                  by A40,VALUED_0:31
       .= |. ((h")^\N).m * ( f2.((f1/*((h+c)^\N)).m) - (f2/*(f1/*(c^\N))).m).|
        by A41,FUNCT_2:108,A83
       .= |. ((h")^\N).m * ( f2.(f1.x0) - (f2/*(f1/*(c^\N))).m).|
           by A84,A80,A83
       .= |. ((h")^\N).m * ( f2.(f1.x0) - f2.((f1/*(c^\N)).m)).| by
A83,A41,FUNCT_2:108
       .= |. ((h")^\N).m * ( f2.(f1.x0) - f2.( f1.( (c^\N).m) )).| by
       A42,FUNCT_2:108,A83
       .= |. ((h")^\N).m * ( f2.(f1.x0) - f2.( f1.( c.(N+m) ))).| by
       NAT_1:def 3
       .= |. ((h")^\N).m * ( f2.(f1.x0) - f2.(f1.x0)).| by A16;
          hence
              |. ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m
                   - Ldiff(f2,f1.x0)*Rdiff(f1,x0).|<g by A82,ABSVALUE:2;
         end; then
A85:      (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N is convergent
            by SEQ_2:def 6;
         hence h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
           by SEQ_4:21;
         lim ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N)
           = Ldiff(f2,f1.x0)*Rdiff(f1,x0) by A85,A81,SEQ_2:def 7;
         hence lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = Ldiff(f2,f1.x0)*
            Rdiff(f1,x0) by A85,SEQ_4:22;
        end;

        suppose
A86:     for k be Element of NAT
          ex n be Element of NAT st k <= n & (f1/*((h+c)^\N)).n <> f1.x0;
         defpred P[object] means $1 <> f1.x0;
A87:     for k be Element of NAT
          ex n be Element of NAT st k <= n & P[(f1/*((h+c)^\N)).n] by A86;

         consider I2 be increasing sequence of NAT such that
A88:      for n being Nat holds P[(f1/*((h+c)^\N)*I2).n] and
A89:      for n be Element of NAT st for r be Real st
            r = (f1/*((h+c)^\N)).n holds P[r]
             ex m be Element of NAT st n
            = I2.m from FDIFF_2:sch 1(A87);

A90:      d^\N = (f1/*(h+c))^\N - (f1/*c)^\N by SEQM_3:17
          .= f1/*((h+c)^\N) - (f1/*c)^\N by A21,XBOOLE_1:18,VALUED_0:27
          .= f1/*((h+c)^\N) - f1/*(c^\N) by A10,A13,A11
,ZFMISC_1:31,VALUED_0:27;

         rng(c^\N) c= rng c & rng((h+c)^\N) c= rng(h+c) by VALUED_0:21; then
A91:      rng(c^\N) c= dom f1 & rng((h+c)^\N) c= dom f1 by A22,A10,A14;

A92:      a^\N = f1/*(c^\N) by A10,A13,A11,ZFMISC_1:31,VALUED_0:27;

A93:      now
          given n being Nat such that
A94:       ((d^\N)*I2).n = 0;

          0 = (d^\N).(I2.n) by A94,FUNCT_2:15,ORDINAL1:def 12
           .= (f1/*((h+c)^\N)).(I2.n) - (f1/*(c^\N)).(I2.n) by A90,RFUNCT_2:1
           .= (f1/*((h+c)^\N)).(I2.n) - f1.((c^\N).(I2.n)) by A91,FUNCT_2:108
           .= (f1/*((h+c)^\N)).(I2.n) - f1.(c.(N + I2.n)) by NAT_1:def 3
           .= (f1/*((h+c)^\N)).(I2.n) - f1.x0 by A16
           .= (f1/*((h+c)^\N)*I2).n - f1.x0 by FUNCT_2:15,ORDINAL1:def 12;
          hence contradiction by A88;
         end;

         reconsider h2 = h^\N*I2 as 0-convergent non-zero
              Real_Sequence by FDIFF_2:6;
         reconsider a1 = a^\N*I2 as constant Real_Sequence;
         reconsider c2 = c^\N*I2 as constant Real_Sequence;
         set s = h2"(#)(f1/*(h2+c2) - f1/*c2);

         d^\N*I2 is subsequence of d by VALUED_0:20; then
         lim (d^\N*I2) = 0 by A37,A26,A43,SEQ_4:17;
         then reconsider d1 = d^\N*I2 as 0-convergent non-zero
         Real_Sequence by A37,A26,SEQ_4:16,A93,SEQ_1:5,FDIFF_1:def 1;

         set t = d1"(#)(f2/*(d1+a1) - f2/*a1);
         a1 is subsequence of a by VALUED_0:20; then
A95:     rng a1 = {f1.x0} by A33,VALUED_0:26;
A96:     now
          let n be Element of NAT;
          thus (d^\N + a^\N).n = (d^\N).n + (a^\N).n by SEQ_1:7
             .= (f1/*((h+c)^\N)).n - (a^\N).n + (a^\N).n by A90,A92,RFUNCT_2:1
             .= (f1/*((h+c)^\N)).n;
         end;

A97:     rng((f1/*(h+c))^\N) c= rng(f1/*(h+c)) by VALUED_0:21; then
A98:    rng((f1/*(h+c))^\N) c= dom f2 by A28;

         rng(a^\N) c= rng a by VALUED_0:21; then
A99:    rng(a^\N) c= dom f2 by A34;

         d1 + a1 = (d^\N + a^\N)*I2 by RFUNCT_2:2; then
A100:     d1 + a1 = f1/*((h+c)^\N)*I2 by A96,FUNCT_2:63
           .= ((f1/*(h+c))^\N)*I2 by A21,XBOOLE_1:18,VALUED_0:27;

         h2+c2 = (h^\N + c^\N)*I2 by RFUNCT_2:2
          .= (h+c)^\N * I2 by SEQM_3:15; then
A101:     t(#)s = d1"(#)(f2/*(d1+a1) - f2/*a1) (#)
                  ( ( (f1/*((h+c)^\N))*I2 - f1/*c2 )(#)h2" )
                     by A91,FUNCT_2:110
          .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#)
                  ( ( (f1/*((h+c)^\N))*I2 - (f1/*(c^\N)) *I2)(#)h2" )
                    by A91,FUNCT_2:110
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#)
                  ( ( (f1/*((h+c)^\N))*I2 - (f1/*(c^\N)) *I2)(#)h2" )
                    by VALUED_1:def 10
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#)
                  ( ( (f1/*(h+c))^\N*I2 - (f1/*(c^\N)) *I2)(#)h2" )
                    by A21,XBOOLE_1:18,VALUED_0:27
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#)
                  ( ( (f1/*(h+c))^\N*I2 - (f1/*c)^\N *I2)(#)h2" )
                    by A10,A13,A11,ZFMISC_1:31,VALUED_0:27
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#)
                  ( ( ((f1/*(h+c))^\N - (f1/*c)^\N)*I2)(#)h2" )
                    by RFUNCT_2:2
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (d1(#)h2") by SEQM_3:17
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) d1(#)h2" by SEQ_1:14
          .= (f2/*(((f1/*(h+c))^\N)*I2) - f2/*a1) (#) h2" by A100,SEQ_1:37
          .= ((f2 /* ((f1/*(h+c))^\N)) * I2 - f2/*a1  ) (#) h2"
                   by A98,FUNCT_2:110
          .= (f2/*(f1/*(h+c))^\N*I2 - f2/*a1) (#) h2"  by A28,VALUED_0:27
          .= (((f2*f1)/*(h+c))^\N*I2 - f2/*a1) (#) h2" by A14,VALUED_0:31
          .= (((f2*f1)/*(h+c))^\N*I2 - (f2/*(a^\N))*I2) (#) h2"
                     by A99,FUNCT_2:110
          .= (((f2*f1)/*(h+c))^\N*I2 - ( (f2/*a)^\N )*I2) (#) h2"
                       by A33,A12,ZFMISC_1:31,VALUED_0:27
          .= (((f2*f1)/*(h+c))^\N*I2 - ( ((f2*f1)/*c)^\N )*I2) (#) h2"
                       by A13,A11,ZFMISC_1:31,VALUED_0:31
          .= (( ((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ) *I2) (#) h2"
                       by RFUNCT_2:2
          .= (( ((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ) *I2) (#)
                   (((h^\N)")*I2) by RFUNCT_2:5
          .= ((h^\N)"(#)(((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ))*I2
                       by RFUNCT_2:2;

         rng (((f1/*(h+c))^\N)*I2) c= rng ((f1/*(h+c))^\N) by VALUED_0:21;
         then
A102:     rng (d1 + a1) c= dom f2 by A97,A28,A100;
         ((h+c)^\N)*I2 is subsequence of (h+c) by VALUED_0:20; then
         rng (((h + c)^\N)*I2) c= rng (h + c) by VALUED_0:21; then
         rng (((h + c)^\N)*I2) c= dom f1 by A14,A10; then
         rng ((h^\N + c^\N)*I2) c= dom f1 by SEQM_3:15; then
A103:     rng (h2 + c2) c= dom f1 by RFUNCT_2:2;

         h2 is subsequence of h by VALUED_0:20; then
A104:    rng h2 c= rng h by VALUED_0:21;

A105:     for n be Nat holds h2.n > 0
         proof
          let n be Nat;
          dom h2 = NAT by FUNCT_2:def 1; then
          h2.n in rng h2 by FUNCT_1:3,ORDINAL1:def 12; then
          ex m be Element of NAT st h2.n = h.m by A104,FUNCT_2:113;
          hence h2.n > 0 by A15;
         end;

         c2 is subsequence of c by VALUED_0:20; then
A106:     rng c2 = {x0} by A13,VALUED_0:26; then
A107:     lim s = Rdiff(f1,x0) by A1,A103,A105,FDIFF_3:15;

A108:     for n be Nat holds d1.n < 0
         proof
          let n be Nat;

          n in NAT by ORDINAL1:def 12; then
A109:      n in dom I2 by FUNCT_2:def 1; then
A110:      (f1/*((h+c)^\N)*I2).n
            = (f1/*((h+c)^\N)).(I2.n) by FUNCT_1:13
           .= f1.(((h+c)^\N).(I2.n)) by A42,FUNCT_2:108;

A111:      d1.n = (f1/*((h+c)^\N) - f1/*(c^\N)).(I2.n) by A90,A109,FUNCT_1:13
           .= (f1/*((h+c)^\N)).(I2.n) - (f1/*(c^\N)).(I2.n) by RFUNCT_2:1
           .= (f1/*((h+c)^\N)).(I2.n) - f1.((c^\N).(I2.n)) by A42,FUNCT_2:108
           .= (f1/*((h+c)^\N)).(I2.n) - f1.(c.(N+I2.n)) by NAT_1:def 3
           .= (f1/*((h+c)^\N)).(I2.n) - f1.x0 by A16
           .= f1.(((h+c)^\N).(I2.n)) - f1.x0 by A42,FUNCT_2:108;

A112:      ((h+c)^\N).(I2.n) = (h+c).(N+I2.n) by NAT_1:def 3; then
A113:      ((h+c)^\N).(I2.n) = h.(N+I2.n) + c.(N+I2.n) by SEQ_1:7
           .= h.(N+I2.n) + x0 by A16;

A114:      |. ((h+c)^\N).(I2.n) - x0 .| < r by A112,A24,A38,NAT_1:12;

          h.(N+I2.n) > 0 by A15; then
          h.(N+I2.n) < r by A114,A113,ABSVALUE:def 1; then
          x0 < ((h+c)^\N).(I2.n) & ((h+c)^\N).(I2.n) < x0+r
            by A113,A15,XREAL_1:8,29; then
          ((h+c)^\N).(I2.n) in [. x0,x0+r .] by XXREAL_1:1; then
          f1.(((h+c)^\N).(I2.n)) in [. f1.x0-r1, f1.x0 .]
            by A7,FUNCT_1:54; then
          f1.x0 >= f1.(((h+c)^\N).(I2.n)) by XXREAL_1:1; then
          f1.x0 > f1.(((h+c)^\N).(I2.n)) by A88,A110,XXREAL_0:1;
          hence d1.n < 0 by A111,XREAL_1:49;
         end;

         Rdiff(f1,x0) = Rdiff(f1,x0); then
A115:     s is convergent by A1,A106,A103,A105,FDIFF_3:15;
         Ldiff(f2,f1.x0) = Ldiff(f2,f1.x0); then
A116:     t is convergent by A2,A95,A102,A108,FDIFF_3:9;

         lim t = Ldiff(f2,f1.x0) by A2,A95,A102,A108,FDIFF_3:9; then
A117:     lim (((h^\N)"(#)(((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ))*I2)
           = Ldiff(f2,f1.x0) * Rdiff(f1,x0) by A101,A115,A107,A116,SEQ_2:15;

A118:     now
          set DF = Ldiff(f2,f1.x0) * Rdiff(f1,x0);
          let g be Real such that
A119:       0 < g;
          consider k being Nat such that
A120:       for m being Nat st k <= m holds
            |.(((h^\N)"(#)(((f2*f1)/*(h+c))^\N
              - ((f2*f1)/*c)^\N ))*I2).m - DF.|<g
              by A101,A115,A116,A117,A119,SEQ_2:def 7;
A121:      k in NAT by ORDINAL1:def 12;
          reconsider n = I2.k as Nat;
          take n;
          let m be Nat such that
A122:       n <= m;
A123:      m in NAT by ORDINAL1:def 12;

A124:       ( h"(#)( (f2*f1)/*(h+c) - (f2*f1)/*c ) )^\N
           = ((h")^\N)(#)(( (f2*f1)/*(h+c) - (f2*f1)/*c )^\N) by SEQM_3:19
          .= (h^\N)"(#)(( (f2*f1)/*(h+c) - (f2*f1)/*c )^\N) by SEQM_3:18
          .= (h^\N)"(#)(((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N) by SEQM_3:17;

          now per cases;
           suppose
A125:        (f1/*((h+c)^\N)).m = f1.x0;

A126:        ((h^\N)"(#)(((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N)).m
             = ((h^\N)").m * (((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N).m
             by SEQ_1:8;

A127:        (((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N).m
             = (((f2*f1)/*(h+c))^\N).m - (((f2*f1)/*c)^\N).m by RFUNCT_2:1;

            dom((h+c)^\N) = NAT by FUNCT_2:def 1; then
            dom(f1*((h+c)^\N)) = NAT by A91,RELAT_1:27; then
            dom(f1/*((h+c)^\N)) = NAT by A91,FUNCT_2:def 11; then
A128:        dom(f2*(f1/*((h+c)^\N))) = NAT by A41,RELAT_1:27;

            ((f2*f1)/*(h+c))^\N
              = (f2*f1)/*((h+c)^\N) by A14,VALUED_0:27
             .= f2/*(f1/*((h+c)^\N)) by A40,VALUED_0:31
             .= f2*(f1/*((h+c)^\N)) by A41,FUNCT_2:def 11; then
A129:        (((f2*f1)/*(h+c))^\N).m
             = f2.(f1.x0) by A125,A128,FUNCT_1:12,ORDINAL1:def 12;

            dom(c^\N) = NAT by FUNCT_2:def 1; then
            dom(f1*(c^\N)) = NAT by A91,RELAT_1:27; then
            dom(f1/*(c^\N)) = NAT by A91,FUNCT_2:def 11; then
A130:        dom(f2*(f1/*(c^\N))) = NAT by A41,RELAT_1:27;

            ((f2*f1)/*c)^\N = (f2*f1)/*(c^\N) by A13,A11
,ZFMISC_1:31,VALUED_0:27
             .= f2/*(f1/*(c^\N)) by A40,VALUED_0:31
             .= f2*(f1/*(c^\N)) by A41,FUNCT_2:def 11; then
            (((f2*f1)/*c)^\N).m = f2.((f1/*(c^\N)).m)
              by ORDINAL1:def 12,A130,FUNCT_1:12
             .= f2.(f1.((c^\N).m)) by A123,A91,FUNCT_2:108
             .= f2.(f1.(c.(N+m))) by NAT_1:def 3
             .= f2.(f1.x0) by A16;
            hence
              |.((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m - DF.| < g by
                 A124,A119,A79,A126,A129,A127,ABSVALUE:2;
           end;
           suppose
            (f1/*((h+c)^\N)).m <> f1.x0; then
            for r1 be Real holds (f1/*((h+c)^\N)).m = r1 implies r1<>f1.x0;
            then
            consider l be Element of NAT such that
A131:         m = I2.l by A89,A123;

            dom I2 = NAT by FUNCT_2:def 1;
            then l >= k by A122,A131,VALUED_0:def 13,A121; then
            |.(((h^\N)"(#)(((f2*f1)/*(h+c))^\N
              - ((f2*f1)/*c)^\N ))*I2).l - DF.| < g by A120;
            hence |.((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m - DF.| < g
              by A124,A131,FUNCT_2:15;
           end;
          end;
          hence
              |.((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m
                - Ldiff(f2,f1.x0) *Rdiff(f1,x0).|<g;
         end; then
A132:     (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N is convergent by
           SEQ_2:def 6;
         hence h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent by SEQ_4:21;
         lim ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N)
            = Ldiff(f2,f1.x0)*Rdiff(f1,x0) by A118,A132,SEQ_2:def 7;
         hence lim (h"(#) ((f2*f1)/*(h+c) - (f2*f1)/*c)) = Ldiff(f2,f1.x0)*
            Rdiff(f1,x0) by A132,SEQ_4:22;
        end;
       end;
       hence thesis;
      end;
     end;
     hence thesis;
    end;
    hence thesis by A6,A9,FDIFF_3:15;
end;

theorem Th46:
for x0 be Real, f1,f2 be PartFunc of REAL,REAL st
 f1 is_left_differentiable_in x0 & f2 is_left_differentiable_in f1.x0 &
   (for r1 be Real st r1 > 0 ex r0 be Real st r0 > 0 &
    [.x0-r0,x0.] c= dom([.f1.x0-r1,f1.x0.]|`f1)) holds
  f2*f1 is_left_differentiable_in x0 &
  Ldiff(f2*f1,x0) = Ldiff(f2,f1.x0)*Ldiff(f1,x0)
proof
    let x0 be Real, f1,f2 be PartFunc of REAL,REAL;
    assume that
A1:  f1 is_left_differentiable_in x0 and
A2:  f2 is_left_differentiable_in f1.x0 and
A3: for r1 be Real st r1 > 0 ex r0 be Real st r0>0 &
      [.x0-r0,x0.] c= dom([.f1.x0-r1,f1.x0.]|`f1);

    consider r1 be Real such that
A4: r1 > 0 & [. f1.x0-r1,f1.x0 .] c= dom f2 by A2,FDIFF_3:def 4;

    consider r0 be Real such that
A5: r0>0 &
     [.x0-r0,x0.] c= dom([.f1.x0-r1,f1.x0.]|`f1) by A3,A4;

    set r = min(r0,r1);
A6: r > 0 by A4,A5,XXREAL_0:21;
    x0-r0 <= x0-r & f1.x0 - r1 <= f1.x0 - r by XREAL_1:10,XXREAL_0:17; then
    [.x0-r,x0.] c= [.x0-r0,x0.] & [.f1.x0-r,f1.x0.] c= [.f1.x0-r1,f1.x0.]
      by XXREAL_1:34; then
A7:[.x0-r,x0.] c= dom([.f1.x0-r1,f1.x0.]|`f1) by A5;

A8:now let x be Real;
     assume x in [.x0-r,x0.]; then
     x in dom f1 & f1.x in [.f1.x0-r1,f1.x0.] by A7,FUNCT_1:54;
     hence x in dom(f2*f1) by A4,FUNCT_1:11;
    end; then
A9:[.x0-r,x0.] c= dom(f2*f1);

A10: dom(f2*f1) c= dom f1 by RELAT_1:25;

    x0-r < x0 by A6,XREAL_1:44; then
A11: x0 in dom(f2*f1) by A8,XXREAL_1:1; then
A12: f1.x0 in dom f2 by FUNCT_1:11;

    for h,c st rng c = {x0} & rng (h + c) c= dom (f2*f1) &
     (for n be Nat holds h.n < 0) holds
     h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
   & lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = Ldiff(f2,f1.x0)*Ldiff(f1,x0)
    proof
     let h,c;
     assume that
A13:   rng c = {x0} and
A14:   rng (h + c) c= dom (f2*f1) and
A15:   for n be Nat holds h.n < 0;

A16:  for n be Nat holds c.n = x0
     proof
      let n be Nat;
      c.n in rng c by VALUED_0:28;
      hence c.n = x0 by A13,TARSKI:def 1;
     end;

A17: now let x be Real;
      assume A18: x in rng(h+c); then
      consider n be Element of NAT such that
A19:    x = (h+c).n by FUNCT_2:113;
      dom(h+c) = NAT by FUNCT_2:def 1; then
      x = h.n + c.n by A19,VALUED_1:def 1; then
      x = h.n + x0 by A16; then
      x < x0 by A15,XREAL_1:30; then
      x in ].-infty,x0.[ by XXREAL_1:233; then
A20:   x in left_open_halfline x0 by PROB_1:def 10;
      x in dom f1 by A18,A14,FUNCT_1:11;
      hence x in left_open_halfline x0 /\ dom f1 by A20,XBOOLE_0:def 4;
     end; then
A21:  rng (h + c) c= left_open_halfline x0 /\ dom f1;

     set a = f1/*c;

A22:  rng c c= dom (f2*f1) by A13,A11,ZFMISC_1:31;

     set d = f1/*(h+c) - f1/*c;

A23: lim h = 0;

     lim c = c.0 by SEQ_4:25; then
     lim c = x0 by A16; then
A24: lim (h + c) = 0 + x0 by A23,SEQ_2:6 .= x0;
A25: f1 is_Lcontinuous_in x0 by A1,FDIFF_3:5; then
A26: f1/*(h+c) is convergent by A21,A24,FDIFF_3:def 1;

A27: f1.x0 = lim (f1/*(h+c)) by A21,A24,A25,FDIFF_3:def 1;
A28: rng (f1/*(h+c)) c= dom f2 by A14,FDIFF_2:9;

     now let x be Real;
      assume x in rng a; then
      consider n be Element of NAT such that
A29:   a.n = x by FUNCT_2:113;
      c.n = x0 by A16;
      then x = f1.x0 by A29,A10,A13,A11,ZFMISC_1:31,FUNCT_2:108;
      hence x in {f1.x0} by TARSKI:def 1;
     end; then
A30: rng a c= {f1.x0};

     now let x be Real;
A31:  a.0 in rng a by VALUED_0:28;
      assume x in {f1.x0}; then
A32:  x = f1.x0 by TARSKI:def 1;
      c.0 = x0 by A16;
      hence x in rng a by A32,A31,A10,A13,A11,ZFMISC_1:31,FUNCT_2:108;
     end; then
     {f1.x0} c= rng a; then
A33: rng a = { f1.x0 } by A30,XBOOLE_0:def 10; then
A34: rng a c= dom f2 by A12,ZFMISC_1:31;

A35: now
      let n be Nat;
      a.n in rng a by VALUED_0:28;
      then
A36:  a.n = f1.x0 by A30,TARSKI:def 1;
      a.(n+1) in rng a by VALUED_0:28;
      hence a.n = a.(n+1) by A30,A36,TARSKI:def 1;
     end;
     then
A37: a is constant by VALUED_0:25;

     consider N be Nat such that
A38:   for m be Nat st N <= m holds |. (h+c).m - lim (h+c) .| < r
       by A6,SEQ_2:def 7;

A39:  rng((h+c)^\N) c= rng(h+c) & rng(c^\N) c= rng c by NAT_1:55; then
A40:  rng((h+c)^\N) c= dom(f2*f1) & rng(c^\N) c= dom(f2*f1) by A14,A22; then
A41:  rng(f1/*((h+c)^\N)) c= dom f2 & rng(f1/*(c^\N)) c= dom f2 by FDIFF_2:9;

     dom(f2*f1) c= dom f1 by RELAT_1:25; then
A42:  rng((h+c)^\N) c= dom f1 & rng(c^\N) c= dom f1 by A39,A14,A22;

     reconsider a as constant Real_Sequence by A35,VALUED_0:25;
     a.0 in rng a by VALUED_0:28; then
     a.0 = f1.x0 by A30,TARSKI:def 1; then
     lim a = f1.x0 by SEQ_4:25; then
A43: lim d = f1.x0 - f1.x0 by A26,A27,SEQ_2:12 .= 0;

     h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent &
     lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = Ldiff(f2,f1.x0)*Ldiff(f1,x0)
     proof
      per cases;
      suppose
       ex k be Element of NAT st for n be Element of NAT
        st k <= n holds (f1/*(h+c)).n <> f1.x0; then
       consider k1 be Element of NAT such that
A44:    for n be Element of NAT st k1 <= n holds (f1/*(h+c)).n <> f1.x0;
       reconsider k = max(k1,N) as Element of NAT by ORDINAL1:def 12;
A45:    k1 <= k & N <= k by XXREAL_0:25;
A46:    now
        given n being Nat such that
A47:     (d^\k).n = 0;
A48:    k+n is Element of NAT by ORDINAL1:def 12;
        0 = d.(k+n) by A47,NAT_1:def 3
         .= (f1/*(h+c)).(k+n) - (f1/*c).(k+n) by RFUNCT_2:1
         .= (f1/*(h+c)).(k+n) - f1.(c.(k+n))
           by A48,A10,A13,A11,ZFMISC_1:31,FUNCT_2:108
         .= (f1/*(h+c)).(n+k) - f1.x0 by A16;
        hence contradiction by A44,A45,NAT_1:12;
       end;

       set c1 = c^\k;
       set h1 = h^\k;
       set a1 = a^\k;
       set s = h1"(#)(f1/*(h1 + c1) - f1/*c1);
A49:   now
        let n be Element of NAT;
        (d + a).n = d.n + a.n by SEQ_1:7; then
        (d + a).n = (f1/*(h+c)).n - a.n + a.n by RFUNCT_2:1;
        hence (d + a).n = (f1/*(h+c)).n;
       end;

       lim (d^\k) = 0 by A37,A26,A43,SEQ_4:20; then
       reconsider d1 = d^\k as 0-convergent non-zero Real_Sequence
          by A37,A26,A46,SEQ_1:5,FDIFF_1:def 1;

A50:    for n being Nat holds d1.n < 0
       proof
        let n be Nat;
A51:    dom(h+c) = NAT by FUNCT_2:def 1;

A52:    d1.n = d.(k+n) by NAT_1:def 3
         .= (f1/*(h+c)).(n+k) - (f1/*c).(n+k) by RFUNCT_2:1
         .= (f1/*(h+c)).(n+k) - f1.(c.(n+k))
           by A10,A13,A11,ZFMISC_1:31,FUNCT_2:108
         .= (f1/*(h+c)).(n+k) - f1.x0 by A16
         .= f1.((h+c).(n+k)) - f1.x0 by A21,XBOOLE_1:18,FUNCT_2:108;

        (h+c).(k+n) = h.(k+n)+c.(k+n)
          by A51,ORDINAL1:def 12,VALUED_1:def 1; then
A53:    (h+c).(k+n) = h.(k+n)+x0 by A16;

        |. (h+c).(k+n) - lim(h+c) .| < r by A38,A45,NAT_1:12; then
        |. h.(k+n) + c.(k+n) - x0 .| < r
          by A24,A51,ORDINAL1:def 12,VALUED_1:def 1; then
        |. h.(k+n) + x0 - x0 .| < r by A16; then
        -h.(k+n) < r by A15,ABSVALUE:def 1; then
        --h.(k+n) > -r by XREAL_1:24; then
        x0-r < (h+c).(k+n) & (h+c).(k+n) < x0 by A53,A15,XREAL_1:8,30; then
        (h+c).(k+n) in [.x0-r,x0.] by XXREAL_1:1; then
        f1.((h+c).(k+n)) in [.f1.x0-r1,f1.x0.] by A7,FUNCT_1:54; then
A54:    f1.x0 >= f1.((h+c).(k+n)) by XXREAL_1:1;
        0 <> d1.n by A46;
        hence d1.n < 0 by A54,A52,XREAL_1:47;
       end;

       set t = d1"(#)(f2/*(d1 + a1) - f2/*a1);

       d1 + a1 = (d + a)^\k by SEQM_3:15; then
A55:   d1 + a1 = (f1/*(h+c))^\k by A49,FUNCT_2:63;

       rng ((f1/*(h+c))^\k) c= rng (f1/*(h+c)) by VALUED_0:21; then
A56:   rng (d1 + a1) c= dom f2 by A28,A55;

A57:   rng a1 = {f1.x0} by A33,VALUED_0:26; then
A58:   lim t = Ldiff(f2,f1.x0) by A2,A50,A56,FDIFF_3:9;

       Ldiff(f2,f1.x0) = Ldiff(f2,f1.x0); then
A59:   t is convergent by A2,A57,A56,A50,FDIFF_3:9;
       rng ((h + c)^\k) c= rng (h + c) by VALUED_0:21; then
       rng ((h + c)^\k) c= left_open_halfline x0 /\ dom f1 by A17; then
A60:   rng (h1 + c1) c= left_open_halfline x0 /\ dom f1 by SEQM_3:15;

       left_open_halfline x0 /\ dom f1 c= dom f1 by XBOOLE_1:17; then
A61:   rng (h1+c1) c= dom f1 by A60;
A62:   rng c1 = {x0} by A13,VALUED_0:26;

A63:   for n be Nat holds h1.n < 0
       proof
        let n be Nat;
        h1.n = h.(k+n) by NAT_1:def 3;
        hence h1.n < 0 by A15;
       end;

       Ldiff(f1,x0) = Ldiff(f1,x0); then
A64:   s is convergent by A1,A62,A63,A61,FDIFF_3:9;

A65:   t(#)s = d1"(#)(f2/*(d1+a1) - f2/*a1) (#) ((f1/*((h+c)^\k) - f1/*
        c1) (#)h1") by SEQM_3:15
          .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#) (((f1/*(h+c))^\k - f1/*c1)(#)
        h1") by A21,XBOOLE_1:18,VALUED_0:27
          .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#) (((f1/*(h+c))^\k - (f1/*c)^\k)
        (#)h1") by A10,A13,A11,ZFMISC_1:31,VALUED_0:27
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (((f1/*(h+c))^\k - (f1/*c)^\k)
        (#)h1") by VALUED_1:def 10
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (d1(#)h1") by SEQM_3:17
          .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) d1(#)h1" by SEQ_1:14
          .= (f2/*(d1+a1) - f2/*a1) (#) h1" by SEQ_1:37
          .= ((f2/*(f1/*(h+c)))^\k - f2/*a1) (#) h1" by A28,A55,VALUED_0:27
          .= (((f2*f1)/*(h+c))^\k - f2/*a1) (#) h1" by A14,VALUED_0:31
          .= (((f2*f1)/*(h+c))^\k - ((f2/*a)^\k)) (#) h1"
              by A33,A12,ZFMISC_1:31,VALUED_0:27
          .= (((f2*f1)/*(h+c))^\k - (((f2*f1)/*c)^\k)) (#) h1"
              by A13,A11,ZFMISC_1:31,VALUED_0:31
          .= (((f2*f1)/*(h+c) - (f2*f1)/*c)^\k) (#) h1" by SEQM_3:17
          .= (((f2*f1)/*(h+c) - (f2*f1)/*c)^\k) (#) ((h")^\k) by SEQM_3:18
          .= (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\k by SEQM_3:19;
       hence h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
         by A64,A59,SEQ_4:21;

       lim s = Ldiff(f1,x0) by A1,A62,A63,A61,FDIFF_3:9;
       then lim ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\k) = Ldiff(f2,f1.x0) *
       Ldiff(f1,x0 ) by A65,A64,A59,A58,SEQ_2:15;
       hence thesis by A64,A59,A65,SEQ_4:22;
      end;

      suppose
A66:   for k be Element of NAT
        ex n be Element of NAT st k <= n & (f1/*(h+c)).n = f1.x0;

       defpred P[object] means $1 = f1.x0;

A67:   for k be Element of NAT ex n be Element of NAT
          st k <= n & P[(f1/*(h+c)).n] by A66;
       consider I1 be increasing sequence of NAT such that
A68:    for n being Nat holds P[(f1/*(h+c)*I1).n] and
        for n be Element of NAT st for r be Real st r = (f1/*(h+c)).n holds
          P[r] ex m be Element of NAT st n = I1.m
        from FDIFF_2:sch 1(A67);
       reconsider h1 = h*I1 as 0-convergent non-zero Real_Sequence
          by FDIFF_2:6;

       set c1 = c*I1;
A69:   c1 = c by VALUED_0:26;
A70:   rng c1 = {x0} by A13,VALUED_0:26;

A71:    rng h1 c= rng h by VALUED_0:21;

A72:   for n be Nat holds h1.n < 0
       proof
        let n be Nat;
        dom h1 = NAT by FUNCT_2:def 1; then
        h1.n in rng h1 by FUNCT_1:3,ORDINAL1:def 12; then
        ex m be Element of NAT st h1.n = h.m by A71,FUNCT_2:113;
        hence h1.n < 0 by A15;
       end;

       reconsider c1 as constant Real_Sequence;
A73:   now
        let g be Real such that
A74:    0 < g;
        reconsider n = 0 as Nat;
        take n;
        let m be Nat such that n <= m;
A75:    m in NAT by ORDINAL1:def 12;
        |.(h1"(#)(f1/*(h1+c1) - f1/*c1)).m - 0 .|
          = |.(h1").m *(f1/*(h1+c1) - f1/*c1).m.| by SEQ_1:8
         .= |.(h1").m *((f1/*(h1+c1)).m - (f1/*c1).m).| by RFUNCT_2:1
         .= |.(h1").m *((f1/*(h1+c1)).m - f1.(c.m)).|
           by A69,A75,A10,A13,A11,ZFMISC_1:31,FUNCT_2:108
         .= |.(h1").m *((f1/*(h1+c1)).m - f1.x0).| by A16
         .= |.(h1").m *((f1/*((h+c)*I1)).m - f1.x0).| by RFUNCT_2:2
         .= |.(h1").m *((f1/*(h+c)*I1).m - f1.x0).|
             by A21,XBOOLE_1:18,FUNCT_2:110
         .= |.(h1").m *(f1.x0 - f1.x0).| by A68;
        hence |.(h1"(#)(f1/*(h1+c1) - f1/*c1)).m - 0 .| < g by A74,ABSVALUE:2;
       end;

       rng ((h + c)*I1) c= rng (h + c) by VALUED_0:21; then
       rng ((h + c)*I1) c= dom f1 by A14,A10; then
A76:   rng (h1 + c1) c= dom f1 by RFUNCT_2:2; then
A77:   lim (h1"(#)(f1/*(h1+c1) - f1/*c1)) = Ldiff(f1,x0)
          by A1,A70,A72,FDIFF_3:9;

       Ldiff(f1,x0) = Ldiff(f1,x0); then
       h1"(#)(f1/*(h1+c1) - f1/*c1) is convergent
          by A1,A70,A76,A72,FDIFF_3:9; then
A78:   Ldiff(f1,x0) = 0 by A77,A73,SEQ_2:def 7;

       now per cases;
        suppose
         ex k be Element of NAT st
          for n be Element of NAT st k <= n holds (f1/*((h+c)^\N)).n = f1.x0;
         then consider k be Element of NAT such that
A79:      for n be Element of NAT st k <= n holds (f1/*((h+c)^\N)).n = f1.x0;

A80:     now let g be Real such that
A81:       0 < g;
          reconsider n = k as Nat;
          take n;
          let m be Nat;
A82:      m in NAT by ORDINAL1:def 12;
          assume
A83:        n <= m;

          |. ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m
               - Ldiff(f2,f1.x0)*Ldiff(f1, x0 ) .|
            = |.( ((h")^\N) (#) (((f2*f1)/*(h+c) - (f2*f1)/*c)^\N) ).m .|
                  by A78,SEQM_3:19
           .= |.(((h")^\N) (#) ( ((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N )).m.|
                  by SEQM_3:17
           .= |. ((h")^\N).m * ( ((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ).m .|
                  by SEQ_1:8
           .= |. ((h")^\N).m *((((f2*f1)/*(h+c))^\N).m - (((f2*f1)/*c)^\N).m).|
                  by RFUNCT_2:1
           .= |. ((h")^\N).m *(((f2*f1)/*((h+c)^\N)).m - (((f2*f1)/*c)^\N).m).|
                  by A14,VALUED_0:27
           .= |. ((h")^\N).m *(((f2*f1)/*((h+c)^\N)).m - ((f2*f1)/*(c^\N)).m).|
                  by A13,A11,ZFMISC_1:31,VALUED_0:27
       .= |. ((h")^\N).m * ((f2/*(f1/*((h+c)^\N))).m - ((f2*f1)/*(c^\N)).m).|
                  by A40,VALUED_0:31
       .= |. ((h")^\N).m * ((f2/*(f1/*((h+c)^\N))).m - (f2/*(f1/*(c^\N))).m).|
                  by A40,VALUED_0:31
       .= |. ((h")^\N).m * ( f2.((f1/*((h+c)^\N)).m) - (f2/*(f1/*(c^\N))).m).|
        by A41,FUNCT_2:108,A82
       .= |. ((h")^\N).m * ( f2.(f1.x0) - (f2/*(f1/*(c^\N))).m).|
           by A83,A79,A82
       .= |. ((h")^\N).m * ( f2.(f1.x0) - f2.((f1/*(c^\N)).m)).| by
A82,A41,FUNCT_2:108
       .= |. ((h")^\N).m * ( f2.(f1.x0) - f2.( f1.( (c^\N).m) )).| by
       A42,FUNCT_2:108,A82
       .= |. ((h")^\N).m * ( f2.(f1.x0) - f2.( f1.( c.(N+m) ))).| by
       NAT_1:def 3
       .= |. ((h")^\N).m * ( f2.(f1.x0) - f2.(f1.x0)).| by A16;
          hence
              |. ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m
                   - Ldiff(f2,f1.x0)*Ldiff(f1,x0).|<g by A81,ABSVALUE:2;
         end; then
A84:      (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N is convergent
            by SEQ_2:def 6;
         hence h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent
           by SEQ_4:21;
         lim ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N)
           = Ldiff(f2,f1.x0)*Ldiff(f1,x0) by A80,A84,SEQ_2:def 7;
         hence lim (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c)) = Ldiff(f2,f1.x0)*
            Ldiff(f1,x0) by A84,SEQ_4:22;
        end;

        suppose
A85:     for k be Element of NAT
          ex n be Element of NAT st k <= n & (f1/*((h+c)^\N)).n <> f1.x0;

         defpred P[object] means $1 <> f1.x0;
A86:     for k be Element of NAT
          ex n be Element of NAT st k <= n & P[(f1/*((h+c)^\N)).n]
            by A85;

         consider I2 be increasing sequence of NAT such that
A87:      for n being Nat holds P[(f1/*((h+c)^\N)*I2).n] and
A88:      for n be Element of NAT st for r be Real st
            r = (f1/*((h+c)^\N)).n holds P[r]
             ex m be Element of NAT st n
            = I2.m from FDIFF_2:sch 1(A86);

A89:      d^\N = (f1/*(h+c))^\N - (f1/*c)^\N by SEQM_3:17
          .= f1/*((h+c)^\N) - (f1/*c)^\N by A21,XBOOLE_1:18,VALUED_0:27
          .= f1/*((h+c)^\N) - f1/*(c^\N) by A10,A13,A11
,ZFMISC_1:31,VALUED_0:27;

         rng(c^\N) c= rng c & rng((h+c)^\N) c= rng(h+c) by VALUED_0:21; then
A90:      rng(c^\N) c= dom f1 & rng((h+c)^\N) c= dom f1 by A22,A10,A14;

A91:      a^\N = f1/*(c^\N) by A10,A13,A11,ZFMISC_1:31,VALUED_0:27;

A92:      now
          given n being Nat such that
A93:       ((d^\N)*I2).n = 0;

          0 = (d^\N).(I2.n) by A93,FUNCT_2:15,ORDINAL1:def 12
           .= (f1/*((h+c)^\N)).(I2.n) - (f1/*(c^\N)).(I2.n) by A89,RFUNCT_2:1
           .= (f1/*((h+c)^\N)).(I2.n) - f1.((c^\N).(I2.n)) by A90,FUNCT_2:108
           .= (f1/*((h+c)^\N)).(I2.n) - f1.(c.(N + I2.n)) by NAT_1:def 3
           .= (f1/*((h+c)^\N)).(I2.n) - f1.x0 by A16
           .= (f1/*((h+c)^\N)*I2).n - f1.x0 by FUNCT_2:15,ORDINAL1:def 12;
          hence contradiction by A87;
         end;

         reconsider h2 = h^\N*I2 as 0-convergent non-zero
              Real_Sequence by FDIFF_2:6;
         reconsider a1 = a^\N*I2 as constant Real_Sequence;
         reconsider c2 = c^\N*I2 as constant Real_Sequence;
         set s = h2"(#)(f1/*(h2+c2) - f1/*c2);

         d^\N*I2 is subsequence of d by VALUED_0:20; then
         lim (d^\N*I2) = 0 by A37,A26,A43,SEQ_4:17; then
         reconsider d1 = d^\N*I2 as 0-convergent non-zero Real_Sequence
           by A37,A26,SEQ_4:16,A92,SEQ_1:5,FDIFF_1:def 1;

         set t = d1"(#)(f2/*(d1+a1) - f2/*a1);
         a1 is subsequence of a by VALUED_0:20; then
A94:     rng a1 = {f1.x0} by A33,VALUED_0:26;
A95:     now
          let n be Element of NAT;
          (d^\N + a^\N).n = (d^\N).n + (a^\N).n by SEQ_1:7
             .= (f1/*((h+c)^\N)).n - (a^\N).n + (a^\N).n by A89,A91,RFUNCT_2:1;
          hence (d^\N + a^\N).n = (f1/*((h+c)^\N)).n;
         end;

A96:     rng((f1/*(h+c))^\N) c= rng(f1/*(h+c)) by VALUED_0:21; then
A97:    rng((f1/*(h+c))^\N) c= dom f2 by A28;

         rng(a^\N) c= rng a by VALUED_0:21; then
A98:    rng(a^\N) c= dom f2 by A34;

         d1 + a1 = (d^\N + a^\N)*I2 by RFUNCT_2:2; then
A99:     d1 + a1 = f1/*((h+c)^\N)*I2 by A95,FUNCT_2:63
           .= ((f1/*(h+c))^\N)*I2 by A21,XBOOLE_1:18,VALUED_0:27;

A100:      h2+c2 = (h^\N + c^\N)*I2 by RFUNCT_2:2
          .= (h+c)^\N * I2 by SEQM_3:15;

A101:     t(#)s = d1"(#)(f2/*(d1+a1) - f2/*a1) (#)
                  ( ( (f1/*((h+c)^\N))*I2 - f1/*c2 )(#)h2" )
                     by A90,A100,FUNCT_2:110
              .= d1"(#)(f2/*(d1+a1) - f2/*a1) (#)
                  ( ( (f1/*((h+c)^\N))*I2 - (f1/*(c^\N)) *I2)(#)h2" )
                    by A90,FUNCT_2:110
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#)
                  ( ( (f1/*((h+c)^\N))*I2 - (f1/*(c^\N)) *I2)(#)h2" )
                    by VALUED_1:def 10
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#)
                  ( ( (f1/*(h+c))^\N*I2 - (f1/*(c^\N)) *I2)(#)h2" )
                    by A21,XBOOLE_1:18,VALUED_0:27
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#)
                  ( ( (f1/*(h+c))^\N*I2 - (f1/*c)^\N *I2)(#)h2" )
                    by A10,A13,A11,ZFMISC_1:31,VALUED_0:27
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#)
                  ( ( ((f1/*(h+c))^\N - (f1/*c)^\N)*I2)(#)h2" )
                    by RFUNCT_2:2
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) (d1(#)h2") by SEQM_3:17
              .= ((f2/*(d1+a1) - f2/*a1)/"d1) (#) d1(#)h2" by SEQ_1:14
              .= (f2/*(((f1/*(h+c))^\N)*I2) - f2/*a1) (#) h2" by A99,SEQ_1:37
              .= (   (f2 /* ((f1/*(h+c))^\N)) * I2 - f2/*a1  ) (#) h2"
                   by A97,FUNCT_2:110
              .= (   (f2/*(f1/*(h+c)))^\N * I2 - f2/*a1  ) (#) h2"
                   by A28,VALUED_0:27
              .= (((f2*f1)/*(h+c))^\N*I2 - f2/*a1) (#) h2" by A14,VALUED_0:31
              .= (((f2*f1)/*(h+c))^\N*I2 - (f2/*(a^\N))*I2) (#) h2"
                     by A98,FUNCT_2:110
              .= (((f2*f1)/*(h+c))^\N*I2 - ( (f2/*a)^\N )*I2) (#) h2"
                       by A33,A12,ZFMISC_1:31,VALUED_0:27
              .= (((f2*f1)/*(h+c))^\N*I2 - ( ((f2*f1)/*c)^\N )*I2) (#) h2"
                       by A13,A11,ZFMISC_1:31,VALUED_0:31
              .= (( ((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ) *I2) (#) h2"
                       by RFUNCT_2:2
              .= (( ((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ) *I2) (#)
                   (((h^\N)")*I2)
                       by RFUNCT_2:5
              .= ((h^\N)"(#)(((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ))*I2
                       by RFUNCT_2:2;

         rng (((f1/*(h+c))^\N)*I2) c= rng ((f1/*(h+c))^\N) by VALUED_0:21; then
A102:     rng (d1 + a1) c= dom f2 by A96,A28,A99;
         ((h+c)^\N)*I2 is subsequence of (h+c) by VALUED_0:20; then
         rng (((h + c)^\N)*I2) c= rng (h + c) by VALUED_0:21; then
         rng (((h + c)^\N)*I2) c= dom f1 by A14,A10; then
         rng ((h^\N + c^\N)*I2) c= dom f1 by SEQM_3:15; then
A103:     rng (h2 + c2) c= dom f1 by RFUNCT_2:2;

         h2 is subsequence of h by VALUED_0:20; then
A104:    rng h2 c= rng h by VALUED_0:21;

A105:     for n be Nat holds h2.n < 0
         proof
          let n be Nat;
          dom h2 = NAT by FUNCT_2:def 1; then
          h2.n in rng h2 by FUNCT_1:3,ORDINAL1:def 12; then
          ex m be Element of NAT st h2.n = h.m by A104,FUNCT_2:113;
          hence h2.n < 0 by A15;
         end;

         c2 is subsequence of c by VALUED_0:20; then
A106:     rng c2 = {x0} by A13,VALUED_0:26; then
A107:     lim s = Ldiff(f1,x0) by A1,A103,A105,FDIFF_3:9;

A108:     for n be Nat holds d1.n < 0
         proof
          let n be Nat;

          n in NAT by ORDINAL1:def 12; then
A109:      n in dom I2 by FUNCT_2:def 1; then
A110:      (f1/*((h+c)^\N)*I2).n
            = (f1/*((h+c)^\N)).(I2.n) by FUNCT_1:13
           .= f1.(((h+c)^\N).(I2.n)) by A42,FUNCT_2:108;

A111:      d1.n = (f1/*((h+c)^\N) - f1/*(c^\N)).(I2.n) by A89,A109,FUNCT_1:13
           .= (f1/*((h+c)^\N)).(I2.n) - (f1/*(c^\N)).(I2.n) by RFUNCT_2:1
           .= (f1/*((h+c)^\N)).(I2.n) - f1.((c^\N).(I2.n)) by A42,FUNCT_2:108
           .= (f1/*((h+c)^\N)).(I2.n) - f1.(c.(N+I2.n)) by NAT_1:def 3
           .= (f1/*((h+c)^\N)).(I2.n) - f1.x0 by A16
           .= f1.(((h+c)^\N).(I2.n)) - f1.x0 by A42,FUNCT_2:108;

A112:      ((h+c)^\N).(I2.n) = (h+c).(N+I2.n) by NAT_1:def 3; then
A113:      ((h+c)^\N).(I2.n) = h.(N+I2.n) + c.(N+I2.n) by SEQ_1:7
           .= h.(N+I2.n) + x0 by A16;

          |. ((h+c)^\N).(I2.n) - x0 .| < r by A112,A24,A38,NAT_1:12; then
          -h.(N+I2.n) < r by A15,A113,ABSVALUE:def 1; then
          --h.(N+I2.n) > -r by XREAL_1:24; then
          x0-r < ((h+c)^\N).(I2.n) & ((h+c)^\N).(I2.n) < x0
            by A113,A15,XREAL_1:8,30; then
          ((h+c)^\N).(I2.n) in [. x0-r,x0 .] by XXREAL_1:1; then
          f1.(((h+c)^\N).(I2.n)) in [. f1.x0-r1, f1.x0 .]
            by A7,FUNCT_1:54; then
          f1.x0 >= f1.(((h+c)^\N).(I2.n)) by XXREAL_1:1; then
          f1.x0 > f1.(((h+c)^\N).(I2.n)) by A87,A110,XXREAL_0:1;
          hence d1.n < 0 by A111,XREAL_1:49;
         end;

         Ldiff(f1,x0) = Ldiff(f1,x0);
         then
A114:     s is convergent by A1,A106,A103,A105,FDIFF_3:9;
         Ldiff(f2,f1.x0) = Ldiff(f2,f1.x0);
         then
A115:     t is convergent by A2,A94,A102,A108,FDIFF_3:9;

         lim t = Ldiff(f2,f1.x0) by A2,A94,A102,A108,FDIFF_3:9;
         then
A116:     lim (((h^\N)"(#)(((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N ))*I2)
           = Ldiff(f2,f1.x0) * Ldiff(f1,x0) by A101,A114,A107,A115,SEQ_2:15;

A117:     now
          set DF = Ldiff(f2,f1.x0) * Ldiff(f1,x0);
          let g be Real such that
A118:       0 < g;
          consider k being Nat such that
A119:       for m being Nat st k <= m holds
            |.(((h^\N)"(#)(((f2*f1)/*(h+c))^\N
              - ((f2*f1)/*c)^\N ))*I2).m - DF.|<g
              by A101,A114,A115,A116,A118,SEQ_2:def 7;
A120:      k in NAT by ORDINAL1:def 12;
          reconsider n = I2.k as Nat;
          take n;
          let m be Nat such that
A121:        n <= m;
A122:      m in NAT by ORDINAL1:def 12;

A123:       ( h"(#)( (f2*f1)/*(h+c) - (f2*f1)/*c ) )^\N
           = ((h")^\N)(#)(( (f2*f1)/*(h+c) - (f2*f1)/*c )^\N) by SEQM_3:19
          .= (h^\N)"(#)(( (f2*f1)/*(h+c) - (f2*f1)/*c )^\N) by SEQM_3:18
          .= (h^\N)"(#)(((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N) by SEQM_3:17;

          now per cases;
           suppose
A124:        (f1/*((h+c)^\N)).m = f1.x0;

A125:        ((h^\N)"(#)(((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N)).m
             = ((h^\N)").m * (((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N).m
             by SEQ_1:8;

A126:        (((f2*f1)/*(h+c))^\N - ((f2*f1)/*c)^\N).m
             = (((f2*f1)/*(h+c))^\N).m - (((f2*f1)/*c)^\N).m by RFUNCT_2:1;

            dom((h+c)^\N) = NAT by FUNCT_2:def 1; then
            dom(f1*((h+c)^\N)) = NAT by A90,RELAT_1:27; then
            dom(f1/*((h+c)^\N)) = NAT by A90,FUNCT_2:def 11; then
A127:        dom(f2*(f1/*((h+c)^\N))) = NAT by A41,RELAT_1:27;

            ((f2*f1)/*(h+c))^\N
              = (f2*f1)/*((h+c)^\N) by A14,VALUED_0:27
             .= f2/*(f1/*((h+c)^\N)) by A40,VALUED_0:31
             .= f2*(f1/*((h+c)^\N)) by A41,FUNCT_2:def 11; then
A128:        (((f2*f1)/*(h+c))^\N).m
              = f2.(f1.x0) by A124,A127,FUNCT_1:12,ORDINAL1:def 12;

            dom(c^\N) = NAT by FUNCT_2:def 1; then
            dom(f1*(c^\N)) = NAT by A90,RELAT_1:27; then
            dom(f1/*(c^\N)) = NAT by A90,FUNCT_2:def 11; then
A129:        dom(f2*(f1/*(c^\N))) = NAT by A41,RELAT_1:27;

            ((f2*f1)/*c)^\N = (f2*f1)/*(c^\N) by A13,A11
,ZFMISC_1:31,VALUED_0:27
             .= f2/*(f1/*(c^\N)) by A40,VALUED_0:31
             .= f2*(f1/*(c^\N)) by A41,FUNCT_2:def 11; then
            (((f2*f1)/*c)^\N).m = f2.((f1/*(c^\N)).m)
              by ORDINAL1:def 12,A129,FUNCT_1:12
             .= f2.(f1.((c^\N).m)) by A122,A90,FUNCT_2:108
             .= f2.(f1.(c.(N+m))) by NAT_1:def 3
             .= f2.(f1.x0) by A16;
            hence
              |.((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m - DF.| < g by
                 A123,A118,A78,A125,A128,A126,ABSVALUE:2;
           end;
           suppose
            (f1/*((h+c)^\N)).m <> f1.x0; then
            for r1 be Real holds (f1/*((h+c)^\N)).m = r1 implies r1<>f1.x0;
            then
            consider l be Element of NAT such that
A130:         m = I2.l by A88,A122;

            dom I2 = NAT by FUNCT_2:def 1;
            then l >= k by A121,A130,VALUED_0:def 13,A120; then
            |.(((h^\N)"(#)(((f2*f1)/*(h+c))^\N
              - ((f2*f1)/*c)^\N ))*I2).l - DF.| < g by A119;
            hence |.((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m - DF.| < g
              by A123,A130,FUNCT_2:15;
           end;
          end;
          hence
              |.((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N).m
                - Ldiff(f2,f1.x0) *Ldiff(f1,x0).|<g;
         end; then
A131:     (h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N is convergent by
           SEQ_2:def 6;
         hence h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c) is convergent by SEQ_4:21;
         lim ((h"(#)((f2*f1)/*(h+c) - (f2*f1)/*c))^\N)
            = Ldiff(f2,f1.x0)*Ldiff(f1,x0) by A117,A131,SEQ_2:def 7;
         hence lim (h"(#) ((f2*f1)/*(h+c) - (f2*f1)/*c)) = Ldiff(f2,f1.x0)*
            Ldiff(f1,x0) by A131,SEQ_4:22;
        end;
       end;
       hence thesis;
      end;
     end;
     hence thesis;
    end;
    hence thesis by A6,A9,FDIFF_3:9;
end;

theorem Th47:
for x0 be Real, f1,f2 be PartFunc of REAL,REAL st
 f1 is_differentiable_in x0 & f2 is_left_differentiable_in f1.x0 &
   (for r1 be Real st r1 > 0 ex r0 be Real st r0 > 0 &
    [.x0-r0,x0+r0.] c= dom([.f1.x0-r1,f1.x0.]|`f1)) holds
  f2*f1 is_differentiable_in x0 &
  diff(f2*f1,x0) = Ldiff(f2,f1.x0)*diff(f1,x0)
proof
    let x0 be Real, f1,f2 be PartFunc of REAL,REAL;
    assume that
A1:  f1 is_differentiable_in x0 and
A2:  f2 is_left_differentiable_in f1.x0 and
A3: for r1 be Real st r1 > 0 ex r0 be Real st r0>0 &
      [.x0-r0,x0+r0.] c= dom([.f1.x0-r1,f1.x0.]|`f1);

A4: f1 is_right_differentiable_in x0 & f1 is_left_differentiable_in x0 &
    diff(f1,x0) = Rdiff(f1,x0) & diff(f1,x0) = Ldiff(f1,x0)
      by A1,FDIFF_3:22;
    for r1 be Real st r1 > 0 ex r0 be Real st r0>0 &
      [.x0,x0+r0.] c= dom([.f1.x0-r1,f1.x0.]|`f1)
    proof
     let r1 be Real;
     assume r1 > 0; then
     consider r0 be Real such that
A5:  r0>0 &
      [.x0-r0,x0+r0.] c= dom([.f1.x0-r1,f1.x0.]|`f1) by A3;
     take r0;
     x0-r0 < x0 by A5,XREAL_1:44; then
     [.x0,x0+r0.] c= [.x0-r0,x0+r0.] by XXREAL_1:34;
     hence thesis by A5;

    end; then
A6: f2*f1 is_right_differentiable_in x0 &
    Rdiff(f2*f1,x0) = Ldiff(f2,f1.x0)*Rdiff(f1,x0) by A4,A2,Th45;

    for r1 be Real st r1 > 0 ex r0 be Real st r0 > 0 &
      [.x0-r0,x0.] c= dom([.f1.x0-r1,f1.x0.]|`f1)
    proof
     let r1 be Real;
     assume r1 > 0; then
     consider r0 be Real such that
A7:  r0>0 &
      [.x0-r0,x0+r0.] c= dom([.f1.x0-r1,f1.x0.]|`f1) by A3;
     take r0;
     x0 < x0+r0 by A7,XREAL_1:29; then
     [.x0-r0,x0.] c= [.x0-r0,x0+r0.] by XXREAL_1:34;
     hence thesis by A7;
    end; then
    f2*f1 is_left_differentiable_in x0 &
    Ldiff(f2*f1,x0) = Ldiff(f2,f1.x0)*Ldiff(f1,x0) by A4,A2,Th46;
    hence thesis by A4,A6,FDIFF_3:21;
end;

theorem
for x0 be Real, f1,f2 be PartFunc of REAL,REAL st
 f1 is_right_differentiable_in x0 & f2 is_right_differentiable_in f1.x0 &
 (ex r be Real st r > 0 & f1|([.x0,x0+r.]) is non-decreasing) holds
  f2*f1 is_right_differentiable_in x0 &
  Rdiff(f2*f1,x0) = Rdiff(f2,f1.x0)*Rdiff(f1,x0)
proof
    let x0 be Real, f1,f2 be PartFunc of REAL,REAL;
    assume that
A1:  f1 is_right_differentiable_in x0 and
A2:  f2 is_right_differentiable_in f1.x0 and
A3:  ex r be Real st r > 0 & f1|([.x0,x0+r.]) is non-decreasing;

    consider R be Real such that
A4:  R > 0 & f1|([.x0,x0+R.]) is non-decreasing by A3;

A5: f1 is_Rcontinuous_in x0 by A1,FDIFF_3:7; then
A6: x0 in dom f1 by Th28;

    for r1 be Real st r1 > 0 ex r0 be Real st r0>0 &
     [.x0,x0+r0.] c= dom([.f1.x0,f1.x0+r1.]|`f1)
    proof
     let r1 be Real;
     assume
A7:   r1 > 0; then
     consider d be Real such that
A8:   0 < d &
      for x be Real st x in dom f1 & x0 < x & x < x0+d holds
       |. f1.x - f1.x0 .| < r1 by A5,Th28;
A9:  0 < d/2 & d/2 < d by A8,XREAL_1:215,216;
     consider s0 be Real such that
A10:   s0 > 0 & [.x0,x0+s0.] c= dom f1 by A1,FDIFF_3:def 3;
     set e = min(d/2,s0);
     take r0 = min(e,R);

A11: e > 0 by A9,A10,XXREAL_0:21;
     e <= d/2 & e <= s0 & r0 <= e & r0 <= R by XXREAL_0:17; then
A12: r0 <= d/2 & r0 <= s0 & r0 <= R by XXREAL_0:2; then
A13:  r0 < d by A9,XXREAL_0:2;

     now let x be Real;
      assume x in [.x0,x0+r0.]; then
A14:  x0 <= x & x <= x0+r0 by XXREAL_1:1;

      x0+r0 <= x0+s0 by A12,XREAL_1:6; then
      x <= x0+s0 by A14,XXREAL_0:2; then
A15:  x in dom f1 by A10,A14,XXREAL_1:1;

A16:  x0+r0 < x0+d by A13,XREAL_1:8;
      per cases;
      suppose x <> x0; then
A17:   x0 < x & x < x0+d by A14,A16,XXREAL_0:1,2; then
A18:   |. f1.x - f1.x0 .| < r1 by A8,A15;

       x0+r0 <= x0+R by XXREAL_0:17,XREAL_1:6; then
A19:    x0 < x0+R & x <= x0+R by A4,A14,XREAL_1:29,XXREAL_0:2; then
       x0 in dom(f1|([.x0,x0+R.])) & x in dom(f1|([.x0,x0+R.]))
         by A6,A15,A14,XXREAL_1:1,RELAT_1:57; then

       (f1|([.x0,x0+R.])).x0 <= (f1|([.x0,x0+R.])).x
         by A4,A17,RFUNCT_2:def 3; then
       f1.x0 <= (f1|([.x0,x0+R.])).x by A19,XXREAL_1:1,FUNCT_1:49; then
A20:   f1.x0 <= f1.x by A19,A14,XXREAL_1:1,FUNCT_1:49; then
       f1.x - f1.x0 < r1 by A18,ABSVALUE:def 1,XREAL_1:48; then
       f1.x < f1.x0+r1 by XREAL_1:19;
       hence x in dom([.f1.x0,f1.x0+r1.]|`f1) by A15,A20,FUNCT_1:54,XXREAL_1:1;
      end;
      suppose x = x0; then
       f1.x0 <= f1.x & f1.x < f1.x0+r1 by A7,XREAL_1:29;
       hence x in dom([.f1.x0,f1.x0+r1.]|`f1) by A15,FUNCT_1:54,XXREAL_1:1;
      end;
     end;
     hence thesis by A11,A4,XXREAL_0:21;
    end;
    hence thesis by A1,A2,Th42;
end;

theorem
for x0 be Real, f1,f2 be PartFunc of REAL,REAL st
 f1 is_left_differentiable_in x0 & f2 is_right_differentiable_in f1.x0 &
 (ex r be Real st r > 0 & f1|([.x0-r,x0.]) is non-increasing) holds
  f2*f1 is_left_differentiable_in x0 &
  Ldiff(f2*f1,x0) = Rdiff(f2,f1.x0)*Ldiff(f1,x0)
proof
    let x0 be Real, f1,f2 be PartFunc of REAL,REAL;
    assume that
A1:  f1 is_left_differentiable_in x0 and
A2:  f2 is_right_differentiable_in f1.x0 and
A3:  ex r be Real st r > 0 & f1|([.x0-r,x0.]) is non-increasing;

    consider R be Real such that
A4:  R > 0 & f1|([.x0-R,x0.]) is non-increasing by A3;

A5: f1 is_Lcontinuous_in x0 by A1,FDIFF_3:5; then
A6: x0 in dom f1 by Th27;

    for r1 be Real st r1 > 0 ex r0 be Real st r0>0 &
     [.x0-r0,x0.] c= dom([.f1.x0,f1.x0+r1.]|`f1)
    proof
     let r1 be Real;
     assume
A7:   r1 > 0; then
     consider d be Real such that
A8:   0 < d &
      for x be Real st x in dom f1 & x0-d < x & x < x0 holds
       |. f1.x - f1.x0 .| < r1 by A5,Th27;
A9:  0 < d/2 & d/2 < d by A8,XREAL_1:215,216;
     consider s0 be Real such that
A10:   s0 > 0 & [.x0-s0,x0.] c= dom f1 by A1,FDIFF_3:def 4;
     set e = min(d/2,s0);
     take r0 = min(e,R);

A11: e > 0 by A9,A10,XXREAL_0:21;
     e <= d/2 & e <= s0 & r0 <= e & r0 <= R by XXREAL_0:17; then
A12: r0 <= d/2 & r0 <= s0 & r0 <= R by XXREAL_0:2; then
A13:  r0 < d by A9,XXREAL_0:2;

     now let x be Real;
      assume x in [.x0-r0,x0.]; then
A14:  x0-r0 <= x & x <= x0 by XXREAL_1:1;

      x0-s0 <= x0-r0 by A12,XREAL_1:10; then
      x0-s0 <= x by A14,XXREAL_0:2; then
A15:  x in dom f1 by A10,A14,XXREAL_1:1;

A16:  x0-d < x0-r0 by A13,XREAL_1:15;
      per cases;
      suppose x <> x0; then
A17:   x0-d < x & x < x0 by A14,A16,XXREAL_0:1,2; then
A18:   |. f1.x - f1.x0 .| < r1 by A8,A15;

       x0-R <= x0-r0 by XXREAL_0:17,XREAL_1:10; then
A19:    x0-R < x0 & x0-R <= x by A4,A14,XREAL_1:44,XXREAL_0:2; then
       x0 in dom(f1|([.x0-R,x0.])) & x in dom(f1|([.x0-R,x0.]))
         by A6,A15,A14,XXREAL_1:1,RELAT_1:57; then

       (f1|([.x0-R,x0.])).x0 <= (f1|([.x0-R,x0.])).x
         by A4,A17,RFUNCT_2:def 4; then
       f1.x0 <= (f1|([.x0-R,x0.])).x by A19,XXREAL_1:1,FUNCT_1:49; then
A20:   f1.x0 <= f1.x by A19,A14,XXREAL_1:1,FUNCT_1:49; then
       f1.x - f1.x0 < r1 by A18,ABSVALUE:def 1,XREAL_1:48; then
       f1.x < f1.x0+r1 by XREAL_1:19;
       hence x in dom([.f1.x0,f1.x0+r1.]|`f1) by A15,A20,XXREAL_1:1,FUNCT_1:54;
      end;
      suppose x = x0; then
       f1.x0 <= f1.x & f1.x < f1.x0+r1 by A7,XREAL_1:29;
       hence x in dom([.f1.x0,f1.x0+r1.]|`f1) by A15,FUNCT_1:54,XXREAL_1:1;
      end;
     end;
     hence thesis by A11,A4,XXREAL_0:21;
    end;
    hence thesis by A1,A2,Th43;
end;

theorem
for x0 be Real, f1,f2 be PartFunc of REAL,REAL st
 f1 is_right_differentiable_in x0 & f2 is_left_differentiable_in f1.x0 &
 (ex r be Real st r > 0 & f1|([.x0,x0+r.]) is non-increasing) holds
  f2*f1 is_right_differentiable_in x0 &
  Rdiff(f2*f1,x0) = Ldiff(f2,f1.x0)*Rdiff(f1,x0)
proof
    let x0 be Real, f1,f2 be PartFunc of REAL,REAL;
    assume that
A1:  f1 is_right_differentiable_in x0 and
A2:  f2 is_left_differentiable_in f1.x0 and
A3:  ex r be Real st r > 0 & f1|([.x0,x0+r.]) is non-increasing;

    consider R be Real such that
A4:  R > 0 & f1|([.x0,x0+R.]) is non-increasing by A3;

A5: f1 is_Rcontinuous_in x0 by A1,FDIFF_3:7; then
A6: x0 in dom f1 by Th28;

    for r1 be Real st r1 > 0 ex r0 be Real st r0>0 &
     [.x0,x0+r0.] c= dom([.f1.x0-r1,f1.x0.]|`f1)
    proof
     let r1 be Real;
     assume
A7:   r1 > 0; then
     consider d be Real such that
A8:   0 < d &
      for x be Real st x in dom f1 & x0 < x & x < x0+d holds
       |. f1.x - f1.x0 .| < r1 by A5,Th28;
A9:  0 < d/2 & d/2 < d by A8,XREAL_1:215,216;
     consider s0 be Real such that
A10:   s0 > 0 & [.x0,x0+s0.] c= dom f1 by A1,FDIFF_3:def 3;
     set e = min(d/2,s0);
     take r0 = min(e,R);

A11: e > 0 by A9,A10,XXREAL_0:21;
     e <= d/2 & e <= s0 & r0 <= e & r0 <= R by XXREAL_0:17; then
A12: r0 <= d/2 & r0 <= s0 & r0 <= R by XXREAL_0:2; then
A13:  r0 < d by A9,XXREAL_0:2;

     now let x be Real;
      assume x in [.x0,x0+r0.]; then
A14:  x0 <= x & x <= x0+r0 by XXREAL_1:1;

      x0+r0 <= x0+s0 by A12,XREAL_1:6; then
      x <= x0+s0 by A14,XXREAL_0:2; then
A15:  x in dom f1 by A10,A14,XXREAL_1:1;

A16:  x0+r0 < x0+d by A13,XREAL_1:8;
      per cases;
      suppose x <> x0; then
A17:   x0 < x & x < x0+d by A14,A16,XXREAL_0:1,2; then
A18:   |. f1.x - f1.x0 .| < r1 by A8,A15;

       x0+r0 <= x0+R by XXREAL_0:17,XREAL_1:6; then
A19:    x0 < x0+R & x <= x0+R by A4,A14,XREAL_1:29,XXREAL_0:2; then
       x0 in dom(f1|([.x0,x0+R.])) & x in dom(f1|([.x0,x0+R.]))
         by A6,A15,A14,XXREAL_1:1,RELAT_1:57; then
       (f1|([.x0,x0+R.])).x0 >= (f1|([.x0,x0+R.])).x
         by A4,A17,RFUNCT_2:def 4; then
       f1.x0 >= (f1|([.x0,x0+R.])).x by A19,XXREAL_1:1,FUNCT_1:49; then
A20:   f1.x0 >= f1.x by A19,A14,XXREAL_1:1,FUNCT_1:49; then
       -(f1.x - f1.x0) < r1 by A18,XREAL_1:47,ABSVALUE:30; then
       f1.x0 - f1.x < r1; then
       f1.x0 < f1.x + r1 by XREAL_1:19; then
       f1.x0 - r1 < f1.x by XREAL_1:19;
       hence x in dom([.f1.x0-r1,f1.x0.]|`f1) by A15,A20,XXREAL_1:1,FUNCT_1:54;
      end;
      suppose x = x0; then
       f1.x <= f1.x0 & f1.x0-r1 < f1.x by A7,XREAL_1:44;
       hence x in dom([.f1.x0-r1,f1.x0.]|`f1) by A15,FUNCT_1:54,XXREAL_1:1;
      end;
     end;
     hence thesis by A11,A4,XXREAL_0:21;
    end;
    hence thesis by A1,A2,Th45;
end;

theorem
for x0 be Real, f1,f2 be PartFunc of REAL,REAL st
 f1 is_left_differentiable_in x0 & f2 is_left_differentiable_in f1.x0 &
 (ex r be Real st r > 0 & f1|([.x0-r,x0.]) is non-decreasing) holds
  f2*f1 is_left_differentiable_in x0 &
  Ldiff(f2*f1,x0) = Ldiff(f2,f1.x0)*Ldiff(f1,x0)
proof
    let x0 be Real, f1,f2 be PartFunc of REAL,REAL;
    assume that
A1:  f1 is_left_differentiable_in x0 and
A2:  f2 is_left_differentiable_in f1.x0 and
A3:  ex r be Real st r > 0 & f1|([.x0-r,x0.]) is non-decreasing;

    consider R be Real such that
A4:  R > 0 & f1|([.x0-R,x0.]) is non-decreasing by A3;

A5: f1 is_Lcontinuous_in x0 by A1,FDIFF_3:5; then
A6: x0 in dom f1 by Th27;

    for r1 be Real st r1 > 0 ex r0 be Real st r0>0 &
     [.x0-r0,x0.] c= dom([.f1.x0-r1,f1.x0.]|`f1)
    proof
     let r1 be Real;
     assume
A7:   r1 > 0; then
     consider d be Real such that
A8:   0 < d &
      for x be Real st x in dom f1 & x0-d < x & x < x0 holds
       |. f1.x - f1.x0 .| < r1 by A5,Th27;
A9:  0 < d/2 & d/2 < d by A8,XREAL_1:215,216;
     consider s0 be Real such that
A10:   s0 > 0 & [.x0-s0,x0.] c= dom f1 by A1,FDIFF_3:def 4;
     set e = min(d/2,s0);
     take r0 = min(e,R);

A11: e > 0 by A9,A10,XXREAL_0:21;
     e <= d/2 & e <= s0 & r0 <= e & r0 <= R by XXREAL_0:17; then
A12: r0 <= d/2 & r0 <= s0 & r0 <= R by XXREAL_0:2; then
A13:  r0 < d by A9,XXREAL_0:2;

     now let x be Real;
      assume x in [.x0-r0,x0.]; then
A14:  x0-r0 <= x & x <= x0 by XXREAL_1:1;

      x0-s0 <= x0-r0 by A12,XREAL_1:10; then
      x0-s0 <= x by A14,XXREAL_0:2; then
A15:  x in dom f1 by A10,A14,XXREAL_1:1;

A16:  x0-d < x0-r0 by A13,XREAL_1:15;
      per cases;
      suppose x <> x0; then
A17:   x0-d < x & x < x0 by A14,A16,XXREAL_0:1,2; then
A18:   |. f1.x - f1.x0 .| < r1 by A8,A15;

       x0-R <= x0-r0 by XXREAL_0:17,XREAL_1:10; then
A19:    x0-R < x0 & x0-R <= x by A4,A14,XREAL_1:44,XXREAL_0:2; then
       x0 in dom(f1|([.x0-R,x0.])) & x in dom(f1|([.x0-R,x0.]))
         by A6,A15,A14,XXREAL_1:1,RELAT_1:57; then

       (f1|([.x0-R,x0.])).x0 >= (f1|([.x0-R,x0.])).x
         by A4,A17,RFUNCT_2:def 3; then
       f1.x0 >= (f1|([.x0-R,x0.])).x by A19,XXREAL_1:1,FUNCT_1:49; then
A20:   f1.x0 >= f1.x by A19,A14,XXREAL_1:1,FUNCT_1:49; then
       -(f1.x - f1.x0) < r1 by A18,XREAL_1:47,ABSVALUE:30; then
       f1.x0 - f1.x < r1; then
       f1.x0 < f1.x + r1 by XREAL_1:19; then
       f1.x0 - r1 < f1.x by XREAL_1:19;
       hence x in dom([.f1.x0-r1,f1.x0.]|`f1) by A15,A20,XXREAL_1:1,FUNCT_1:54;
      end;
      suppose x = x0; then
       f1.x <= f1.x0 & f1.x0-r1 < f1.x by A7,XREAL_1:44;
       hence x in dom([.f1.x0-r1,f1.x0.]|`f1) by A15,FUNCT_1:54,XXREAL_1:1;
      end;
     end;
     hence thesis by A11,A4,XXREAL_0:21;
    end;
    hence thesis by A1,A2,Th46;
end;

Lm22:
for I be non empty Interval holds
 I = [.inf I,sup I.] or I = ].inf I,sup I.] or I = [.inf I,sup I.[ or
 I = ].inf I,sup I.[
proof
    let I be non empty Interval;
    I is open_interval or I is closed_interval or
    I is right_open_interval or I is left_open_interval by MEASURE5:1;
    hence thesis by MEASURE6:16,17,18,19;
end;

Lm23:
for I be non empty Interval st inf I in I holds
 I = [.inf I,sup I.] or I = [.inf I,sup I.[
proof
    let I be non empty Interval;

    assume inf I in I; then
    not (I = ].inf I,sup I.] or I = ].inf I,sup I.[) by XXREAL_1:2,4;
    hence thesis by Lm22;
end;

Lm24:
for I be non empty Interval st sup I in I holds
 I = [.inf I,sup I.] or I = ].inf I,sup I.]
proof
    let I be non empty Interval;
    assume sup I in I; then
    not (I = ].inf I,sup I.[ or I = [.inf I,sup I.[) by XXREAL_1:3,4;
    hence thesis by Lm22;
end;

Lm25:
for I be non empty Interval st not sup I in I & not inf I in I holds
 I = ].inf I,sup I.[
proof
    let I be non empty Interval;
    assume
A1:  not sup I in I & not inf I in I;
A2: inf I <= sup I by XXREAL_2:40;
A3: I = [.inf I,sup I.] or I = ].inf I,sup I.] or I = [.inf I,sup I.[ or
    I = ].inf I,sup I.[ by Lm22;
    inf I <> sup I by A3,A1,XXREAL_1:1,XXREAL_1:18,19,20; then
    inf I < sup I by A2,XXREAL_0:1; then
    sup I in ].inf I,sup I.] & sup I in [.inf I,sup I.] &
    inf I in [.inf I,sup I.[ by XXREAL_1:1,2,3;
    hence thesis by A1,Lm22;
end;

Lm26:
for x0 be Real, 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 & x0 = inf I & x0 in I holds
  (f2*f1) is_right_differentiable_in x0 &
  Rdiff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0
proof
    let x0 be Real, 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 and
A4:  x0 = inf I and
A5:  x0 in I;

A6:  inf I = lower_bound I by A4,A5,Lm5; then
A7:  f1|I is_right_differentiable_in lower_bound I by A4,A5,A1,Th11;

A8:  f1.x0 = (f1|I).x0 by A5,FUNCT_1:49;

A9: f1.x0 in f1.:I by A5,A1,FUNCT_1:def 6; then
     f1.x0 in J by A3; then
A10:  (f1|I).x0 in J by A5,FUNCT_1:49;

     consider R1 be Real such that
A11:   R1 > 0 & [. x0,x0+R1 .] c= dom(f1|I) by A7,A4,A6,FDIFF_3:def 3;

     set F1 = (f1|I)|(right_closed_halfline x0);

     x0 in [.x0,+infty.[ by XXREAL_1:236; then
A12:  x0 in right_closed_halfline x0 by LIMFUNC1:def 2; then
A13: F1.x0 = (f1|I).x0 by FUNCT_1:49;

     per cases;
     suppose
A14:   (f1|I).x0 = inf J; then
A15:   f2|J is_right_differentiable_in (f1|I).x0 by A10,A2,Th11; then
A16:   f2 is_right_differentiable_in f1.x0 by A8,Th9;

      consider R2 be Real such that
A17:    R2 > 0 & [. (f1|I).x0,(f1|I).x0+R2 .] c= dom(f2|J) by A15
,FDIFF_3:def 3;

      set F2 = (f2|J)|(right_closed_halfline (f1|I).x0);

      f1|I is_Rcontinuous_in x0 by A7,A4,A6,FDIFF_3:7; then
A18:   for e be Real st 0 < e ex d be Real st 0 < d &
       for x be Real st x in dom F1 & |. x-x0 .| < d holds
        |. F1.x - F1.x0 .| < e by Th35,FCONT_1:3;

A19:   for r1 be Real st r1 > 0 ex r0 be Real st r0 > 0 &
       [.x0,x0+r0.] c= dom([. f1.x0,f1.x0+r1 .]|`f1)
      proof
       let r1 be Real;
       set s = min(r1/2,R2);

       assume r1 > 0; then
A20:    0 < r1/2 & r1/2 < r1 by XREAL_1:215,216; then
       consider d2 be Real such that
A21:     0 < d2 &
        for x be Real st x in dom F1 & |. x-x0 .| < d2 holds
         |. F1.x - F1.x0 .| < s by A18,A17,XXREAL_0:21;

       set r0 = min(d2/2,R1);

A22:    0 < s & s <= r1/2 & s <= R2 by A20,A17,XXREAL_0:17,21;

A23:    0 < d2/2 & d2/2 < d2 by A21,XREAL_1:215,216; then
A24:    0 < r0 & r0 <= d2/2 & r0 <= R1 by A11,XXREAL_0:17,21;

       x0+r0 <= x0+R1 by XXREAL_0:17,XREAL_1:6; then
A25:    [.x0,x0+r0.] c= [.x0,x0+R1.] by XXREAL_1:34;

       take r0;

       thus r0 > 0 by A11,A23,XXREAL_0:21;
       now let x be Real;
        assume
A26:     x in [.x0,x0+r0.]; then
A27:    x in dom(f1|I) by A25,A11; then
A28:     x in dom f1 & x in I by RELAT_1:57; then
A29:     f1.x in f1.:I by FUNCT_1:def 6;

        J = [.inf J,sup J.[ or J = [.inf J,sup J.] by A10,A14,Lm23; then
A30:     (f1|I).x0 <= f1.x by A3,A14,A29,XXREAL_1:1,3;

A31:    x0 <= x & x <= x0+r0 by A26,XXREAL_1:1; then
A32:    0 <= x-x0 & x-x0 <= r0 by XREAL_1:48,20;

        x in [.x0,+infty.[ by A31,XXREAL_1:236; then
A33:    x in right_closed_halfline x0 by LIMFUNC1:def 2;

        |. x-x0 .| = x-x0 by A31,XREAL_1:48,ABSVALUE:def 1; then
        |. x-x0 .| <= d2/2 by A24,A32,XXREAL_0:2; then
        |. x-x0 .| < d2 by A23,XXREAL_0:2; then
        |. F1.x - F1.x0 .| < s by A21,A33,A27,RELAT_1:57; then
        |. F1.x - F1.x0 .| < r1/2 by A22,XXREAL_0:2; then
A34:    |. F1.x - F1.x0 .| < r1 by A20,XXREAL_0:2;

        x in dom F1 by A33,A27,RELAT_1:57; then
A35:    F1.x = (f1|I).x & (f1|I).x = f1.x by A25,A11,A26,FUNCT_1:47; then
        |. F1.x - F1.x0 .| = F1.x - F1.x0
          by A30,A13,XREAL_1:48,ABSVALUE:def 1; then
        F1.x < F1.x0 + r1 by A34,XREAL_1:19;
        hence x in dom([. f1.x0,f1.x0+r1 .]|`f1)
          by A28,A8,A13,A30,A35,XXREAL_1:1,FUNCT_1:54;
       end;
       hence [.x0,x0+r0.] c= dom([. f1.x0,f1.x0+r1 .]|`f1);
      end;
      hence (f2*f1) is_right_differentiable_in x0 by A4,A6,A5,A1,A16,Th42;

      Rdiff(f2*f1,x0)
       = Rdiff(f2,f1.x0)*Rdiff(f1,x0) by A4,A6,A5,A1,A16,A19,Th42
      .= Rdiff(f2,f1.x0)*((f1`\I).x0) by A4,A5,A1,Def2
      .= ((f2`\J).(f1.x0))*((f1`\I).x0) by A8,A2,A3,A9,A14,Def2
      .= (((f2`\J)*f1).x0)*((f1`\I).x0) by A5,A1,FUNCT_1:13;
      hence Rdiff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0 by VALUED_1:5;
     end;
     suppose
A36:   (f1|I).x0 = sup J; then
A37:   f2|J is_left_differentiable_in (f1|I).x0 by A10,A2,Th11; then
A38:   f2 is_left_differentiable_in f1.x0 by A8,Th10;

      consider R2 be Real such that
A39:    R2 > 0 & [. (f1|I).x0-R2,(f1|I).x0 .] c= dom(f2|J) by A37
,FDIFF_3:def 4;

      set F2 = (f2|J)|(left_closed_halfline (f1|I).x0);

A40:   F1 is_continuous_in x0 by A4,A6,A7,FDIFF_3:7,Th35;

A41:   for r1 be Real st r1 > 0 ex r0 be Real st r0 > 0 &
       [.x0,x0+r0.] c= dom([. f1.x0-r1,f1.x0 .]|`f1)
      proof
       let r1 be Real;
       set s = min(r1/2,R2);
       assume r1 > 0; then
A42:    0 < r1/2 & r1/2 < r1 by XREAL_1:215,216; then
A43:    0 < s & s <= r1/2 & s <= R2 by A39,XXREAL_0:17,21;

       consider d2 be Real such that
A44:     0 < d2 &
        for x be Real st x in dom F1 & |. x-x0 .| < d2 holds
         |. F1.x - F1.x0 .| < s by A40,A42,A39,XXREAL_0:21,FCONT_1:3;

       set r0 = min(d2/2,R1);

A45:    0 < d2/2 & d2/2 < d2 by A44,XREAL_1:215,216; then
A46:    0 < r0 & r0 <= d2/2 & r0 <= R1 by A11,XXREAL_0:17,21;

       x0+r0 <= x0+R1 by XXREAL_0:17,XREAL_1:6; then
A47:    [.x0,x0+r0.] c= [.x0,x0+R1.] by XXREAL_1:34;

       take r0;

       thus r0 > 0 by A11,A45,XXREAL_0:21;
       now let x be Real;
        assume
A48:     x in [.x0,x0+r0.]; then
A49:    x in dom(f1|I) by A11,A47; then
A50:     x in dom f1 & x in I by RELAT_1:57; then
A51:     f1.x in f1.:I by FUNCT_1:def 6;

        J = [.inf J,sup J.] or J = ].inf J,sup J.] by A10,A36,Lm24; then
A52:     f1.x <= (f1|I).x0 by A3,A36,A51,XXREAL_1:1,2;

A53:    x0 <= x & x <= x0+r0 by A48,XXREAL_1:1; then
A54:    0 <= x-x0 & x-x0 <= r0 by XREAL_1:48,20;

        |. x-x0 .| = x-x0 by A53,XREAL_1:48,ABSVALUE:def 1; then
        |. x-x0 .| <= d2/2 by A46,A54,XXREAL_0:2; then
A55:    |. x-x0 .| < d2 by A45,XXREAL_0:2;

        x in [.x0,+infty.[ by A53,XXREAL_1:236; then
A56:    x in right_closed_halfline x0 by LIMFUNC1:def 2; then
        |. F1.x - F1.x0 .| < s by A44,A55,A49,RELAT_1:57; then
A57:    |. F1.x - F1.x0 .| < r1/2 by A43,XXREAL_0:2;

        x in dom F1 by A49,A56,RELAT_1:57; then
A58:    F1.x = (f1|I).x & (f1|I).x = f1.x by A48,A11,A47,FUNCT_1:47; then
        F1.x0 >= F1.x by A52,A12,FUNCT_1:49; then
        |. F1.x - F1.x0 .| = -(F1.x - F1.x0) by XREAL_1:47,ABSVALUE:30; then
        F1.x0 - F1.x < r1 by A57,A42,XXREAL_0:2; then
        F1.x0 < F1.x + r1 by XREAL_1:19; then
        F1.x0 - r1 < F1.x by XREAL_1:19;
        hence x in dom([. f1.x0-r1,f1.x0 .]|`f1)
          by A50,A8,A58,A13,A52,FUNCT_1:54,XXREAL_1:1;
       end;
       hence [.x0,x0+r0.] c= dom([. f1.x0-r1,f1.x0 .]|`f1);
      end;
      hence (f2*f1) is_right_differentiable_in x0 by A4,A6,A5,A1,A38,Th45;

      Rdiff(f2*f1,x0)
       = Ldiff(f2,f1.x0)*Rdiff(f1,x0) by A4,A6,A5,A1,A38,A41,Th45
      .= Ldiff(f2,f1.x0)*((f1`\I).x0) by A4,A5,A1,Def2
      .= ((f2`\J).(f1.x0))*((f1`\I).x0) by A8,A2,A3,A9,A36,Def2
      .= (((f2`\J)*f1).x0)*((f1`\I).x0) by A5,A1,FUNCT_1:13;
      hence Rdiff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0 by VALUED_1:5;
     end;
     suppose A59: (f1|I).x0 <> inf J & (f1|I).x0 <> sup J; then
      (f1|I).x0 in ].inf J,sup J.[ by A10,Th3; then
A60:   f2 is_differentiable_in (f1|I).x0 by A10,A2,Th11;

A61:   (f1|I).x0 = f1.x0 by A5,FUNCT_1:49;
      hence (f2*f1) is_right_differentiable_in x0 by A60,A6,A4,A5,A1,Th40;

      Rdiff(f2*f1,x0)
       = diff(f2,f1.x0)*Rdiff(f1,x0) by A4,A6,A5,A1,A60,A61,Th40
      .= diff(f2,f1.x0)*((f1`\I).x0) by A4,A5,A1,Def2
      .= ((f2`\J).(f1.x0))*((f1`\I).x0) by A2,A3,A9,A59,A61,Def2
      .= (((f2`\J)*f1).x0)*((f1`\I).x0) by A5,A1,FUNCT_1:13;
      hence Rdiff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0 by VALUED_1:5;
     end;
end;

Lm27:
for x0 be Real, 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 & x0 = sup I & x0 in I holds
  (f2*f1) is_left_differentiable_in x0 &
  Ldiff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0
proof
    let x0 be Real, 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 and
A4:  x0 = sup I and
A5:  x0 in I;

A6:  x0 = upper_bound I by A4,A5,Lm6;

     sup I = upper_bound I by A4,A5,Lm6; then
A7:  f1|I is_left_differentiable_in upper_bound I by A1,A4,A5,Th11; then
     consider R1 be Real such that
A8:  R1 > 0 & [. x0-R1,x0 .] c= dom(f1|I) by A6,FDIFF_3:def 4;

A9:  f1.x0 = (f1|I).x0 by A5,FUNCT_1:49;

A10: f1.x0 in f1.:I by A5,A1,FUNCT_1:def 6; then
     f1.x0 in J by A3; then
A11: (f1|I).x0 in J by A5,FUNCT_1:49;

     set F1 = (f1|I)|(left_closed_halfline x0);

     x0 in ].-infty,x0.] by XXREAL_1:234; then
A12: x0 in left_closed_halfline x0 by LIMFUNC1:def 1; then
A13: F1.x0 = (f1|I).x0 by FUNCT_1:49;

     per cases;
     suppose
A14:   (f1|I).x0 = inf J; then
A15:   f2|J is_right_differentiable_in (f1|I).x0 by A11,A2,Th11; then
A16:   f2 is_right_differentiable_in f1.x0 by A9,Th9;

      consider R2 be Real such that
A17:    R2 > 0 & [. (f1|I).x0,(f1|I).x0+R2 .] c= dom(f2|J)
          by A15,FDIFF_3:def 3;

      set F2 = (f2|J)|(right_closed_halfline (f1|I).x0);

      f1|I is_Lcontinuous_in x0 by A7,A6,FDIFF_3:5; then
A18:   for e be Real st 0 < e ex d be Real st 0 < d &
       for x be Real st x in dom F1 & |. x-x0 .| < d holds
        |. F1.x - F1.x0 .| < e by Th36,FCONT_1:3;

A19:   for r1 be Real st r1 > 0 ex r0 be Real st r0 > 0 &
       [.x0-r0,x0.] c= dom([. f1.x0,f1.x0+r1 .]|`f1)
      proof
       let r1 be Real;
       set s = min(r1/2,R2);
       assume
A20:     r1 > 0;

A21:    0 < r1/2 & r1/2 < r1 by A20,XREAL_1:215,216; then
A22:    0 < s & s <= r1/2 & s <= R2 by A17,XXREAL_0:17,21;

       consider d2 be Real such that
A23:     0 < d2 &
        for x be Real st x in dom F1 & |. x-x0 .| < d2 holds
         |. F1.x - F1.x0 .| < s by A18,A21,A17,XXREAL_0:21;

       set r0 = min(d2/2,R1);

A24:    0 < d2/2 & d2/2 < d2 by A23,XREAL_1:215,216; then
A25:    0 < r0 & r0 <= d2/2 & r0 <= R1 by A8,XXREAL_0:17,21;

       x0-R1 <= x0-r0 by XXREAL_0:17,XREAL_1:10; then
A26:    [.x0-r0,x0.] c= [.x0-R1,x0.] by XXREAL_1:34;

       take r0;

       thus r0 > 0 by A8,A24,XXREAL_0:21;
       now let x be Real;
        assume
A27:     x in [.x0-r0,x0.]; then
A28:    x in dom(f1|I) by A26,A8; then
A29:     x in dom f1 & x in I by RELAT_1:57; then
A30:     f1.x in f1.:I by FUNCT_1:def 6;

        J = [.inf J,sup J.[ or J = [.inf J,sup J.] by A11,A14,Lm23; then
A31:     (f1|I).x0 <= f1.x by A3,A14,A30,XXREAL_1:1,3;

A32:    x0-r0 <= x & x <= x0 by A27,XXREAL_1:1; then
        |. x-x0 .| = -(x-x0) by ABSVALUE:30,XREAL_1:47; then
        |. x-x0 .| <= --r0 by A32,XREAL_1:19,24; then
        |. x-x0 .| <= d2/2 by A25,XXREAL_0:2; then
A33:    |. x-x0 .| < d2 by A24,XXREAL_0:2;

        x in ].-infty,x0.] by A32,XXREAL_1:234; then
A34:    x in left_closed_halfline x0 by LIMFUNC1:def 1; then

        |. F1.x - F1.x0 .| < s by A23,A33,A28,RELAT_1:57; then
        |. F1.x - F1.x0 .| < r1/2 by A22,XXREAL_0:2; then
A35:    |. F1.x - F1.x0 .| < r1 by A21,XXREAL_0:2;

        x in dom F1 by A28,A34,RELAT_1:57; then
A36:    F1.x = (f1|I).x & (f1|I).x = f1.x by A26,A8,A27,FUNCT_1:47; then
        F1.x0 <= F1.x by A31,A12,FUNCT_1:49; then
        |. F1.x - F1.x0 .| = F1.x - F1.x0 by XREAL_1:48,ABSVALUE:def 1; then
        F1.x < F1.x0 + r1 by A35,XREAL_1:19;
        hence x in dom([. f1.x0,f1.x0+r1 .]|`f1)
          by A29,A9,A13,A31,A36,FUNCT_1:54,XXREAL_1:1;
       end;
       hence [.x0-r0,x0.] c= dom([. f1.x0,f1.x0+r1 .]|`f1);
      end;
      hence (f2*f1) is_left_differentiable_in x0 by A6,A4,A5,A1,A16,Th43;

      Ldiff(f2*f1,x0)
       = Rdiff(f2,f1.x0)*Ldiff(f1,x0) by A6,A4,A5,A1,A16,A19,Th43
      .= Rdiff(f2,f1.x0)*((f1`\I).x0) by A4,A5,A1,Def2
      .= ((f2`\J).(f1.x0))*((f1`\I).x0) by A9,A2,A3,A10,A14,Def2
      .= (((f2`\J)*f1).x0)*((f1`\I).x0) by A5,A1,FUNCT_1:13;
      hence Ldiff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0 by VALUED_1:5;
     end;
     suppose
A37:   (f1|I).x0 = sup J; then
A38:   f2|J is_left_differentiable_in (f1|I).x0 by A11,A2,Th11;

A39:   f2 is_left_differentiable_in f1.x0 by A38,A9,Th10;

      consider R2 be Real such that
A40:    R2 > 0 & [. (f1|I).x0-R2,(f1|I).x0 .] c= dom(f2|J)
          by A38,FDIFF_3:def 4;

      set F2 = (f2|J)|(left_closed_halfline (f1|I).x0);

      f1|I is_Lcontinuous_in x0 by A6,A7,FDIFF_3:5; then
A41:   for e be Real st 0 < e ex d be Real st 0 < d &
       for x be Real st x in dom F1 & |. x-x0 .| < d holds
        |. F1.x - F1.x0 .| < e by Th36,FCONT_1:3;

A42:   for r1 be Real st r1 > 0 ex r0 be Real st r0 > 0 &
       [.x0-r0,x0.] c= dom([. f1.x0-r1,f1.x0 .]|`f1)
      proof
       let r1 be Real;
       set s = min(r1/2,R2);
       assume
     r1 > 0; then

A44:    0 < r1/2 & r1/2 < r1 by XREAL_1:215,216; then
A45:    0 < s & s <= r1/2 & s <= R2 by A40,XXREAL_0:17,21;

       consider d2 be Real such that
A46:     0 < d2 &
        for x be Real st x in dom F1 & |. x-x0 .| < d2 holds
         |. F1.x - F1.x0 .| < s by A41,A44,A40,XXREAL_0:21;

       set r0 = min(d2/2,R1);

A47:    0 < d2/2 & d2/2 < d2 by A46,XREAL_1:215,216; then
A48:    0 < r0 & r0 <= d2/2 & r0 <= R1 by A8,XXREAL_0:17,21;

       x0-R1 <= x0-r0 by XXREAL_0:17,XREAL_1:10; then
A49:    [.x0-r0,x0.] c= [.x0-R1,x0.] by XXREAL_1:34;

       take r0;

       thus r0 > 0 by A8,A47,XXREAL_0:21;
       now let x be Real;
        assume
A50:    x in [.x0-r0,x0.]; then
A51:    x in dom(f1|I) by A8,A49; then
A52:    x in dom f1 & x in I by RELAT_1:57; then
A53:    f1.x in f1.:I by FUNCT_1:def 6;

        J = [.inf J,sup J.] or J = ].inf J,sup J.] by A11,A37,Lm24; then
A54:    f1.x <= (f1|I).x0 by A3,A37,A53,XXREAL_1:1,2;

A55:    x0-r0 <= x & x <= x0 by A50,XXREAL_1:1; then
        |. x-x0 .| = -(x-x0) by ABSVALUE:30,XREAL_1:47; then
        |. x-x0 .| <= --r0 by A55,XREAL_1:19,XREAL_1:24; then
        |. x-x0 .| <= d2/2 by A48,XXREAL_0:2; then
A56:    |. x-x0 .| < d2 by A47,XXREAL_0:2;

        x in ].-infty,x0.] by A55,XXREAL_1:234; then
A57:    x in left_closed_halfline x0 by LIMFUNC1:def 1; then
        |. F1.x - F1.x0 .| < s by A46,A56,A51,RELAT_1:57; then
A58:    |. F1.x - F1.x0 .| < r1/2 by A45,XXREAL_0:2;

        x in dom F1 by A51,A57,RELAT_1:57; then
A59:    F1.x = (f1|I).x & (f1|I).x = f1.x by A50,A8,A49,FUNCT_1:47; then
        F1.x0 >= F1.x by A54,A12,FUNCT_1:49; then
        |. F1.x - F1.x0 .| = -(F1.x - F1.x0) by ABSVALUE:30,XREAL_1:47; then
        F1.x0 - F1.x < r1 by A58,A44,XXREAL_0:2; then
        F1.x0 < F1.x + r1 by XREAL_1:19; then
        F1.x0 - r1 < F1.x by XREAL_1:19;
        hence x in dom([. f1.x0-r1,f1.x0 .]|`f1)
          by A52,A9,A13,A54,A59,FUNCT_1:54,XXREAL_1:1;
       end;
       hence [.x0-r0,x0.] c= dom([. f1.x0-r1,f1.x0 .]|`f1);
      end;
      hence (f2*f1) is_left_differentiable_in x0 by A6,A4,A5,A1,A39,Th46;
      Ldiff(f2*f1,x0)
       = Ldiff(f2,f1.x0)*Ldiff(f1,x0) by A6,A4,A5,A1,A39,A42,Th46
      .= Ldiff(f2,f1.x0)*((f1`\I).x0) by A4,A5,A1,Def2
      .= ((f2`\J).(f1.x0))*((f1`\I).x0) by A9,A2,A3,A10,A37,Def2
      .= (((f2`\J)*f1).x0)*((f1`\I).x0) by A5,A1,FUNCT_1:13;
      hence Ldiff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0 by VALUED_1:5;
     end;
     suppose A60: (f1|I).x0 <> inf J & (f1|I).x0 <> sup J; then
      (f1|I).x0 in ].inf J,sup J.[ by A11,Th3; then
A61:   f2 is_differentiable_in (f1|I).x0 by A11,A2,Th11;
      hence (f2*f1) is_left_differentiable_in x0 by A6,A4,A5,A9,A1,Th41;

      Ldiff(f2*f1,x0)
       = diff(f2,f1.x0)*Ldiff(f1,x0) by A61,A9,A6,A4,A5,A1,Th41
      .= diff(f2,f1.x0)*((f1`\I).x0) by A4,A5,A1,Def2
      .= ((f2`\J).(f1.x0))*((f1`\I).x0) by A2,A3,A10,A60,A9,Def2
      .= (((f2`\J)*f1).x0)*((f1`\I).x0) by A5,A1,FUNCT_1:13;
      hence Ldiff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0 by VALUED_1:5;
     end;
end;

Lm28:
for x0 be Real, 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 & x0 in ].inf I,sup I.[ & x0 in I holds
  (f2*f1) is_differentiable_in x0 &
  diff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0
proof
    let x0 be Real, 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 and
A4:  x0 in ].inf I,sup I.[ and
A5:  x0 in I;

A6: inf I < x0 & x0 < sup I by A4,XXREAL_1:4;

    reconsider A = ].inf I,sup I.[ as open Subset of REAL by Th2;
A7: f1 is_differentiable_on A by A1;

A8: f1.x0 in f1.:I by A1,A5,FUNCT_1:def 6;

A9: f1|A is_differentiable_in x0 by A4,A7; then
A10: f1 is_differentiable_in x0 by A4,PDIFFEQ1:2; then
A11: f1 is_continuous_in x0 by FDIFF_1:24;

    consider R1 be Real such that
A12:  0 < R1 & ].x0-R1,x0+R1.[ c= A by A4,RCOMP_1:19;
A13:0 < R1/2 & R1/2 < R1 by A12,XREAL_1:215,216;

A14: A c= I by Th2; then
    x0 in I by A4; then
    f1.x0 in f1.:I by A1,FUNCT_1:def 6; then
A15: f1.x0 in J by A3;

    per cases;
    suppose A16: inf J in J & sup J in J;

     per cases;
     suppose
A17:   f1.x0 = inf J; then
A18:   f2 is_right_differentiable_in f1.x0 by A2,A16,Lm5; then
      consider R2 be Real such that
A19:    R2 > 0 & [.f1.x0,f1.x0+R2.] c= dom f2 by FDIFF_3:def 3;

A20:   for r1 be Real st r1 > 0 ex r0 be Real st r0 > 0 &
       [.x0-r0,x0+r0.] c= dom([.f1.x0,f1.x0+r1.]|`f1)
      proof
       let r1 be Real;
       set s = min(r1/2,R2);
       assume r1 > 0; then
A21:    0 < r1/2 & r1/2 < r1 by XREAL_1:215,216; then
A22:    0 < s & s <= r1/2 & s <= R2 by A19,XXREAL_0:17,21;

       consider d2 be Real such that
A23:     0 < d2 &
        for x be Real st x in dom f1 & |. x-x0 .| < d2 holds
         |. f1.x - f1.x0 .| < s by A11,A21,A19,XXREAL_0:21,FCONT_1:3;

       set r0 = min(d2/2,R1/2);

A24:    0 < d2/2 & d2/2 < d2 by A23,XREAL_1:215,216; then
A25:    0 < r0 & r0 <= d2/2 & r0 <= R1/2 by A13,XXREAL_0:17,21; then
       r0 < R1 by A13,XXREAL_0:2; then
       x0-R1 < x0-r0 & x0+r0 < x0+R1 by XREAL_1:8,15; then
A26:    [.x0-r0,x0+r0.] c= ].x0-R1,x0+R1.[ by XXREAL_1:47;

       take r0;

       thus r0 > 0 by A13,A24,XXREAL_0:21;
       now let x be Real;
        assume
A27:     x in [.x0-r0,x0+r0.]; then
A28:     x in I by A26,A12,A14; then
A29:     f1.x in f1.:I by A1,FUNCT_1:def 6; then
A30:     f1.x0 <= f1.x by A3,A17,XXREAL_2:3;

A31:     f1.x - f1.x0 >= 0 by A3,A29,A17,XXREAL_2:3,XREAL_1:48;

        x0-r0 <= x & x <= x0+r0 by A27,XXREAL_1:1; then
        -r0 <= x-x0 & x-x0 <= r0 by XREAL_1:19,20; then
        |. x-x0 .| <= r0 by ABSVALUE:5; then
        |. x-x0 .| <= d2/2 by A25,XXREAL_0:2; then
        |. x-x0 .| < d2 by A24,XXREAL_0:2; then
        |. f1.x - f1.x0 .| < s by A23,A28,A1; then
        f1.x - f1.x0 < s by A31,ABSVALUE:def 1; then
        f1.x - f1.x0 < r1/2 by A22,XXREAL_0:2; then
        f1.x - f1.x0 < r1 by A21,XXREAL_0:2; then
        f1.x < f1.x0 + r1 by XREAL_1:19;
        hence x in dom([.f1.x0,f1.x0+r1.]|`f1)
          by A28,A30,A1,XXREAL_1:1,FUNCT_1:54;
       end;
       hence [.x0-r0,x0+r0.] c= dom([.f1.x0,f1.x0+r1.]|`f1);
      end;
      hence (f2*f1) is_differentiable_in x0 by A10,A18,Th44;
      diff(f2*f1,x0)
       = Rdiff(f2,f1.x0)*diff(f1,x0) by A20,A18,A10,Th44
      .= Rdiff(f2,f1.x0)*((f1`\I).x0) by A5,A6,A1,Def2
      .= ((f2`\J).(f1.x0))*((f1`\I).x0) by A17,A8,A3,A2,Def2
      .= (((f2`\J)*f1).x0)*((f1`\I).x0) by A5,A1,FUNCT_1:13;
      hence diff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0 by VALUED_1:5;
     end;
     suppose
A32:   f1.x0 = sup J; then
A33:   f2 is_left_differentiable_in f1.x0 by A2,A16,Lm6; then
      consider R2 be Real such that
A34:    R2 > 0 & [.f1.x0-R2,f1.x0.] c= dom f2 by FDIFF_3:def 4;

A35:   for r1 be Real st r1 > 0 ex r0 be Real st r0 > 0 &
       [.x0-r0,x0+r0.] c= dom([.f1.x0-r1,f1.x0.]|`f1)
      proof
       let r1 be Real;
       set s = min(r1/2,R2);
       assume r1 > 0; then
A36:    0 < r1/2 & r1/2 < r1 by XREAL_1:215,216; then
A37:    0 < s & s <= r1/2 & s <= R2 by A34,XXREAL_0:17,21;

       consider d2 be Real such that
A38:     0 < d2 &
        for x be Real st x in dom f1 & |. x-x0 .| < d2 holds
         |. f1.x - f1.x0 .| < s by A11,A36,A34,XXREAL_0:21,FCONT_1:3;

       set r0 = min(d2/2,R1/2);
A39:    0 < d2/2 & d2/2 < d2 by A38,XREAL_1:215,216; then
A40:    0 < r0 & r0 <= d2/2 & r0 <= R1/2 by A13,XXREAL_0:17,21; then
       r0 < R1 by A13,XXREAL_0:2; then
       x0-R1 < x0-r0 & x0+r0 < x0+R1 by XREAL_1:8,15; then
A41:    [.x0-r0,x0+r0.] c= ].x0-R1,x0+R1.[ by XXREAL_1:47;

       take r0;

       thus r0 > 0 by A13,A39,XXREAL_0:21;
       now let x be Real;
        assume
A42:     x in [.x0-r0,x0+r0.]; then
A43:     x in I by A12,A14,A41; then
        f1.x in f1.:I by A1,FUNCT_1:def 6; then
A44:     f1.x0 >= f1.x by A3,A32,XXREAL_2:4;

        x0-r0 <= x & x <= x0+r0 by A42,XXREAL_1:1; then
        -r0 <= x-x0 & x-x0 <= r0 by XREAL_1:19,20; then
        |. x-x0 .| <= r0 by ABSVALUE:5; then
        |. x-x0 .| <= d2/2 by A40,XXREAL_0:2; then
        |. x-x0 .| < d2 by A39,XXREAL_0:2; then
        |. f1.x - f1.x0 .| < s by A38,A43,A1; then
        -(f1.x - f1.x0) < s by A44,XREAL_1:47,ABSVALUE:30; then
        -f1.x + f1.x0 < r1/2 by A37,XXREAL_0:2; then
        f1.x0 - f1.x < r1 by A36,XXREAL_0:2; then
        f1.x0 < f1.x + r1 by XREAL_1:19; then
        f1.x0-r1 < f1.x by XREAL_1:19;
        hence x in dom([.f1.x0-r1,f1.x0.]|`f1)
          by A1,A43,A44,XXREAL_1:1,FUNCT_1:54;
       end;
       hence [.x0-r0,x0+r0.] c= dom([.f1.x0-r1,f1.x0.]|`f1);
      end;
      hence (f2*f1) is_differentiable_in x0 by A10,A33,Th47;

      diff(f2*f1,x0)
       = Ldiff(f2,f1.x0)*diff(f1,x0) by A35,A33,A10,Th47
      .= Ldiff(f2,f1.x0)*((f1`\I).x0) by A5,A6,A1,Def2
      .= ((f2`\J).(f1.x0))*((f1`\I).x0) by A32,A8,A3,A2,Def2
      .= (((f2`\J)*f1).x0)*((f1`\I).x0) by A5,A1,FUNCT_1:13;
      hence diff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0 by VALUED_1:5;
     end;

     suppose A45: f1.x0 <> inf J & f1.x0 <> sup J; then
      f1.x0 in ].inf J,sup J.[ by A8,A3,Th3; then
A46:   f2 is_differentiable_in f1.x0 by A2,A8,A3,Th11;
      hence (f2*f1) is_differentiable_in x0 by A10,FDIFF_2:13;
      diff(f2*f1,x0)
       = diff(f2,f1.x0)*diff(f1,x0) by A46,A10,FDIFF_2:13
      .= diff(f2,f1.x0)*((f1`\I).x0) by A5,A6,A1,Def2
      .= ((f2`\J).(f1.x0))*((f1`\I).x0) by A45,A8,A3,A2,Def2
      .= (((f2`\J)*f1).x0)*((f1`\I).x0) by A5,A1,FUNCT_1:13;
      hence diff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0 by VALUED_1:5;
     end;
    end;

    suppose
A47:   not inf J in J & sup J in J;

     per cases;
     suppose
A48:   f1.x0 = sup J; then
A49:   f2 is_left_differentiable_in f1.x0 by A2,A47,Lm6; then
      consider R2 be Real such that
A50:    R2 > 0 & [.f1.x0-R2,f1.x0.] c= dom f2 by FDIFF_3:def 4;

A51:   for r1 be Real st r1 > 0 ex r0 be Real st r0 > 0 &
       [.x0-r0,x0+r0.] c= dom([.f1.x0-r1,f1.x0.]|`f1)
      proof
       let r1 be Real;
       set s = min(r1/2,R2);
       assume r1 > 0; then
A52:    0 < r1/2 & r1/2 < r1 by XREAL_1:215,216; then
A53:    0 < s & s <= r1/2 & s <= R2 by A50,XXREAL_0:17,21;

       consider d2 be Real such that
A54:     0 < d2 &
        for x be Real st x in dom f1 & |. x-x0 .| < d2 holds
         |. f1.x - f1.x0 .| < s by A11,A52,A50,XXREAL_0:21,FCONT_1:3;

       set r0 = min(d2/2,R1/2);
A55:    0 < d2/2 & d2/2 < d2 by A54,XREAL_1:215,216; then
A56:    0 < r0 & r0 <= d2/2 & r0 <= R1/2 by A13,XXREAL_0:17,21; then
       r0 < R1 by A13,XXREAL_0:2; then
       x0-R1 < x0-r0 & x0+r0 < x0+R1 by XREAL_1:8,15; then
A57:    [.x0-r0,x0+r0.] c= ].x0-R1,x0+R1.[ by XXREAL_1:47;

       take r0;

       thus r0 > 0 by A13,A55,XXREAL_0:21;
       now let x be Real;
        assume
A58:     x in [.x0-r0,x0+r0.]; then
A59:     x in I by A57,A14,A12; then
        f1.x in f1.:I by A1,FUNCT_1:def 6; then
A60:     f1.x0 >= f1.x by A3,A48,XXREAL_2:4;

        x0-r0 <= x & x <= x0+r0 by A58,XXREAL_1:1; then
        -r0 <= x-x0 & x-x0 <= r0 by XREAL_1:19,20; then
        |. x-x0 .| <= r0 by ABSVALUE:5; then
        |. x-x0 .| <= d2/2 by A56,XXREAL_0:2; then
        |. x-x0 .| < d2 by A55,XXREAL_0:2; then
        |. f1.x - f1.x0 .| < s by A1,A59,A54; then
        -(f1.x - f1.x0) < s by A60,XREAL_1:47,ABSVALUE:30; then
        -f1.x + f1.x0 < r1/2 by A53,XXREAL_0:2; then
        f1.x0 - f1.x < r1 by A52,XXREAL_0:2; then
        f1.x0 < f1.x + r1 by XREAL_1:19; then
        f1.x0-r1 < f1.x by XREAL_1:19;
        hence x in dom([.f1.x0-r1,f1.x0.]|`f1)
          by A1,A59,A60,XXREAL_1:1,FUNCT_1:54;
       end;
       hence [.x0-r0,x0+r0.] c= dom([.f1.x0-r1,f1.x0.]|`f1);
      end;
      hence (f2*f1) is_differentiable_in x0 by A10,A49,Th47;

      diff(f2*f1,x0)
       = Ldiff(f2,f1.x0)*diff(f1,x0) by A51,A49,A10,Th47
      .= Ldiff(f2,f1.x0)*((f1`\I).x0) by A5,A6,A1,Def2
      .= ((f2`\J).(f1.x0))*((f1`\I).x0) by A48,A8,A3,A2,Def2
      .= (((f2`\J)*f1).x0)*((f1`\I).x0) by A5,A1,FUNCT_1:13;
      hence diff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0 by VALUED_1:5;
     end;
     suppose A61: f1.x0 <> sup J; then
A62:   f1.x0 in ].inf J,sup J.[ by A47,A15,Th3; then
A63:   f2 is_differentiable_in f1.x0 by A2,A8,A3,Th11;
      hence (f2*f1) is_differentiable_in x0 by A10,FDIFF_2:13;
A64:  inf J < f1.x0 by A62,XXREAL_1:4;
      diff(f2*f1,x0)
       = diff(f2,f1.x0)*diff(f1,x0) by A63,A10,FDIFF_2:13
      .= diff(f2,f1.x0)*((f1`\I).x0) by A5,A6,A1,Def2
      .= ((f2`\J).(f1.x0))*((f1`\I).x0) by A61,A8,A3,A64,A2,Def2
      .= (((f2`\J)*f1).x0)*((f1`\I).x0) by A5,A1,FUNCT_1:13;
      hence diff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0 by VALUED_1:5;
     end;
    end;

    suppose
A65:   inf J in J & not sup J in J;

     per cases;
     suppose
A66:    f1.x0 = inf J; then
A67:   f2 is_right_differentiable_in f1.x0 by A2,A65,Lm5;

      consider R2 be Real such that
A68:    R2 > 0 & [.f1.x0,f1.x0+R2.] c= dom f2 by A67,FDIFF_3:def 3;

A69:   for r1 be Real st r1 > 0 ex r0 be Real st r0 > 0 &
       [.x0-r0,x0+r0.] c= dom([.f1.x0,f1.x0+r1.]|`f1)
      proof
       let r1 be Real;
       set s = min(r1/2,R2);
       assume r1 > 0; then
A70:    0 < r1/2 & r1/2 < r1 by XREAL_1:215,216; then
A71:    0 < s & s <= r1/2 & s <= R2 by A68,XXREAL_0:17,21; then
       consider d2 be Real such that
A72:     0 < d2 &
        for x be Real st x in dom f1 & |. x-x0 .| < d2 holds
         |. f1.x - f1.x0 .| < s by A10,FDIFF_1:24,FCONT_1:3;

       set r0 = min(d2/2,R1/2);

A73:    0 < d2/2 & d2/2 < d2 by A72,XREAL_1:215,216; then
A74:    0 < r0 & r0 <= d2/2 & r0 <= R1/2 by A13,XXREAL_0:17,21; then
       r0 < R1 by A13,XXREAL_0:2; then
       x0-R1 < x0-r0 & x0+r0 < x0+R1 by XREAL_1:8,15; then
A75:    [.x0-r0,x0+r0.] c= ].x0-R1,x0+R1.[ by XXREAL_1:47;

       take r0;

       thus r0 > 0 by A13,A73,XXREAL_0:21;
       now let x be Real;
        assume
A76:     x in [.x0-r0,x0+r0.]; then
A77:     x in I by A75,A12,A14; then
        f1.x in f1.:I by A1,FUNCT_1:def 6; then
A78:     f1.x0 <= f1.x by A3,A66,XXREAL_2:3;

        x0-r0 <= x & x <= x0+r0 by A76,XXREAL_1:1; then
        -r0 <= x-x0 & x-x0 <= r0 by XREAL_1:19,20; then
        |. x-x0 .| <= r0 by ABSVALUE:5; then
        |. x-x0 .| <= d2/2 by A74,XXREAL_0:2; then
        |. x-x0 .| < d2 by A73,XXREAL_0:2; then
        |. f1.x - f1.x0 .| < s by A72,A1,A77; then
        f1.x - f1.x0 < s by A78,XREAL_1:48,ABSVALUE:def 1; then
        f1.x - f1.x0 < r1/2 by A71,XXREAL_0:2; then
        f1.x - f1.x0 < r1 by A70,XXREAL_0:2; then
        f1.x < f1.x0 + r1 by XREAL_1:19;
        hence x in dom([.f1.x0,f1.x0+r1.]|`f1)
          by A1,A77,A78,XXREAL_1:1,FUNCT_1:54;
       end;
       hence [.x0-r0,x0+r0.] c= dom([.f1.x0,f1.x0+r1.]|`f1);
      end;
      hence (f2*f1) is_differentiable_in x0 by A10,A67,Th44;

      diff(f2*f1,x0)
       = Rdiff(f2,f1.x0)*diff(f1,x0) by A69,A67,A10,Th44
      .= Rdiff(f2,f1.x0)*((f1`\I).x0) by A5,A6,A1,Def2
      .= ((f2`\J).(f1.x0))*((f1`\I).x0) by A66,A8,A3,A2,Def2
      .= (((f2`\J)*f1).x0)*((f1`\I).x0) by A5,A1,FUNCT_1:13;
      hence diff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0 by VALUED_1:5;
     end;
     suppose
A79:   f1.x0 <> inf J; then
A80:   f1.x0 in ].inf J,sup J.[ by A65,A15,Th3; then
A81:   f2 is_differentiable_in f1.x0 by A2,A8,A3,Th11;
      hence (f2*f1) is_differentiable_in x0 by A10,FDIFF_2:13;
A82:  f1.x0 < sup J by A80,XXREAL_1:4;
      diff(f2*f1,x0)
       = diff(f2,f1.x0)*diff(f1,x0) by A81,A10,FDIFF_2:13
      .= diff(f2,f1.x0)*((f1`\I).x0) by A5,A6,A1,Def2
      .= ((f2`\J).(f1.x0))*((f1`\I).x0) by A79,A8,A3,A82,A2,Def2
      .= (((f2`\J)*f1).x0)*((f1`\I).x0) by A5,A1,FUNCT_1:13;
      hence diff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0 by VALUED_1:5;
     end;
    end;

    suppose A83: not inf J in J & not sup J in J; then
A84:  J = ].inf J,sup J.[ by Lm25;
     reconsider B = ].inf J,sup J.[ as open Subset of REAL by Th2;
     f2 is_differentiable_on B by A2; then
     f2|B is_differentiable_in f1.x0 by A8,A3,A84; then
A85:  f1 is_differentiable_in x0 &
     f2 is_differentiable_in f1.x0 by A9,A8,A3,A84,A4,PDIFFEQ1:2;
A86:  inf J < f1.x0 & f1.x0 < sup J by A84,A8,A3,XXREAL_1:4;
     rng(f1|A) = f1.:A by RELAT_1:115; then
     rng(f1|A) c= f1.:I by Th2,RELAT_1:123; then
     rng(f1|A) c= J by A3; then
     rng(f1|A) c= B by A83,Lm25; then
     f2*f1 is_differentiable_on A by A1,A2,Th1; then
     (f2*f1)|A is_differentiable_in x0 by A4;
     hence (f2*f1) is_differentiable_in x0 by A4,PDIFFEQ1:2;
     diff(f2*f1,x0)
       = diff(f2,f1.x0)*diff(f1,x0) by A85,FDIFF_2:13
      .= diff(f2,f1.x0)*((f1`\I).x0) by A5,A6,A1,Def2
      .= ((f2`\J).(f1.x0))*((f1`\I).x0) by A8,A3,A86,A2,Def2
      .= (((f2`\J)*f1).x0)*((f1`\I).x0) by A5,A1,FUNCT_1:13;
      hence diff(f2*f1,x0) = (((f2`\J)*f1)(#)(f1`\I)).x0 by VALUED_1:5;
    end;
end;

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;