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

theorem Th19: ::: generalized ROLLE:7
  for p,q be R_eal for 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 constant
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 Element of REAL;
     assume x1 in ].p,q.[ /\ dom f & x2 in ].p,q.[ /\ dom f; then
A3:  x1 in ].p,q.[ & x2 in ].p,q.[ by XBOOLE_0:def 4;
     now per cases by XXREAL_0:1;
      suppose x1=x2;
       hence f.x1=f.x2;
      end;
      suppose
A4:    x1<x2; then
       0<>x2-x1; then
A5:    0<>(x2-x1)" by XCMPLX_1:202;
       reconsider Z=].x1,x2.[ as open Subset of REAL;

A6:    [.x1,x2.] c= ].p,q.[ by A3,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

A9:   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;
       Z c= ].p,q.[ by A6,A8; then
       0 = (f.x2-f.x1) by A2,A5,A9,XCMPLX_1:6;
       hence f.x1=f.x2;
      end;
      suppose
A10:   x2<x1; then
       0<>x1-x2; then
A11:   0<>(x1-x2)" by XCMPLX_1:202;
       reconsider Z=].x2,x1.[ as open Subset of REAL;
A12:   [.x2,x1.] c= ].p,q.[ by A3,XXREAL_2:def 12; then
A13:   f|[.x2,x1.] is continuous by A1,FDIFF_1:25,FCONT_1:16;
A14:   Z c= [.x2,x1.] by XXREAL_1:25; then
       f is_differentiable_on Z by A1,A12,FDIFF_1:26,XBOOLE_1:1; then
A15:   ex x0 be Real st x0 in ].x2,x1.[ & diff(f,x0) = (f.x1-f.x2)/(x1- x2)
         by A1,A10,A12,A13,ROLLE:3,XBOOLE_1:1;
       Z c= ].p,q.[ by A12,A14; then
       0 = (f.x1-f.x2) by A2,A11,A15,XCMPLX_1:6;
       hence f.x1=f.x2;
      end;
     end;
     hence f.x1=f.x2;
    end;
    hence thesis by PARTFUN2:58;
end;
