
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;
