reserve x for object;
reserve x0,r,r1,r2,g,g1,g2,p,y0 for Real;
reserve n,m,k,l for Element of NAT;
reserve a,b,d for Real_Sequence;
reserve h,h1,h2 for non-zero 0-convergent Real_Sequence;
reserve c,c1 for constant Real_Sequence;
reserve A for open Subset of REAL;
reserve f,f1,f2 for PartFunc of REAL,REAL;
reserve L for LinearFunc;
reserve R for RestFunc;

theorem Th41:
  ].p,g.[ c= dom f & f is_differentiable_on ].p,g.[ & ((for x0 st
x0 in ].p,g.[ holds 0 < diff(f,x0)) or for x0 st x0 in ].p,g.[ holds diff(f,x0)
  < 0) implies rng (f|].p,g.[) is open
proof
  assume
A1: ].p,g.[ c= dom f;
  assume that
A2: f is_differentiable_on ].p,g.[ and
A3: (for x0 st x0 in ].p,g.[ holds 0 < diff(f,x0)) or for x0 st x0 in ].
  p,g.[ holds diff(f,x0) < 0;
A4: f|].p,g.[ is continuous by A2,FDIFF_1:25;
  now
    per cases by A3;
    suppose
   for x0 st x0 in ].p,g.[ holds 0 < diff(f,x0);
       then f|].p,g.[ is increasing by A2,ROLLE:9;
      hence thesis by A1,A4,FCONT_3:23;
    end;
    suppose
   for x0 st x0 in ].p,g.[ holds diff(f,x0) < 0;
       then f|].p,g.[ is decreasing by A2,ROLLE:10;
      hence thesis by A1,A4,FCONT_3:23;
    end;
  end;
  hence thesis;
end;
