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

theorem ::: generalized ROLLE:10
  for p,q be R_eal, f be PartFunc of REAL,REAL st
    f is_differentiable_on ].p,q.[
   & (for x be Real st x in ].p,q.[ holds diff(f,x)<0) holds
    f|(].p,q.[) is decreasing
proof
    let p,q be R_eal, f be PartFunc of REAL,REAL;
    assume that
A1:  f is_differentiable_on ].p,q.[ and
A2:  for x be Real st x in ].p,q.[ holds diff(f,x)<0;
    now let x1,x2 be Real;
     assume that
A3:   x1 in ].p,q.[ /\ dom f & x2 in ].p,q.[ /\ dom f and
A4:   x1 < x2;
A5:  0 < x2-x1 by A4,XREAL_1:50;
     reconsider Z=].x1,x2.[ as open Subset of REAL;
     x1 in ].p,q.[ & x2 in ].p,q.[ by A3,XBOOLE_0:def 4; then
A6:  [.x1,x2.] c= ].p,q.[ by XXREAL_2:def 12; then
A7:  f|[.x1,x2.] is continuous by A1,FDIFF_1:25,FCONT_1:16;
A8:  Z c= [.x1,x2.] by XXREAL_1:25; then
     f is_differentiable_on Z by A1,A6,FDIFF_1:26,XBOOLE_1:1; then
     ex x0 be Real st x0 in ].x1,x2.[ & diff(f,x0) = (f.x2-f.x1)/(x2- x1)
       by A1,A4,A6,A7,ROLLE:3,XBOOLE_1:1; then
     f.x2-f.x1<0 by A2,A5,A6,A8; then
     f.x2<f.x1+0 by XREAL_1:19;
     hence f.x2<f.x1;
    end;
    hence thesis by RFUNCT_2:21;
end;
