reserve x,X,Y for set;
reserve g,r,r1,r2,p,p1,p2 for Real;
reserve R for Subset of REAL;
reserve seq,seq1,seq2,seq3 for Real_Sequence;
reserve Ns for increasing sequence of NAT;
reserve n for Nat;
reserve W for non empty set;
reserve h,h1,h2 for PartFunc of W,REAL;
reserve e1,e2 for ExtReal;
reserve h,h1,h2 for PartFunc of REAL,REAL;

theorem
  h|Y is non-decreasing & h|X is non-increasing implies h|(Y /\ X) is constant
proof
  assume
A1: h|Y is non-decreasing & h|X is non-increasing;
    per cases;
    suppose
      Y /\ X /\ dom h = {};
      then Y /\ X misses dom h;
      hence thesis by PARTFUN2:39;
    end;
    suppose
A2:   Y /\ X /\ dom h <> {};
      set x = the Element of Y /\ X /\ dom h;
      x in dom h by A2,XBOOLE_0:def 4;
      then reconsider x as Element of REAL;
      now
         reconsider r1 = h.x as Element of REAL by XREAL_0:def 1;
        take r1;
        now
          let p be Element of REAL;
          assume
A3:       p in Y /\ X /\ dom h;
          then
A4:       p in Y /\ X by XBOOLE_0:def 4;
A5:       p in dom h by A3,XBOOLE_0:def 4;
          p in X by A4,XBOOLE_0:def 4;
          then
A6:       p in (X /\ dom h) by A5,XBOOLE_0:def 4;
A7:       x in dom h by A2,XBOOLE_0:def 4;
A8:       x in Y /\ X by A2,XBOOLE_0:def 4;
          then x in Y by XBOOLE_0:def 4;
          then
A9:       x in (Y /\ dom h) by A7,XBOOLE_0:def 4;
          x in X by A8,XBOOLE_0:def 4;
          then
A10:      x in (X /\ dom h) by A7,XBOOLE_0:def 4;
          p in Y by A4,XBOOLE_0:def 4;
          then
A11:      p in (Y /\ dom h) by A5,XBOOLE_0:def 4;
            per cases;
            suppose
              x <= p;
              then h.x <= h.p & h.p <= h.x by A1,A11,A6,A9,A10,Th24,Th25;
              hence h.p = h.x by XXREAL_0:1;
            end;
            suppose
              p <= x;
              then h.p <= h.x & h.x <= h.p by A1,A11,A6,A9,A10,Th24,Th25;
              hence h.p = h.x by XXREAL_0:1;
            end;
        end;
       hence for p being Element of REAL
       st p in Y /\ X /\ dom h holds h.p = r1;
      end;
      hence thesis by PARTFUN2:57;
    end;
end;
