reserve A, B, X, Y for set;
reserve R, S, T for non empty TopSpace;

theorem Th45:
  for T being Hausdorff non empty TopSpace for f, g being
continuous Function of S, T holds (for X being Subset of S st X = {p where p is
  Point of S: f.p <> g.p} holds X is open) & for X being Subset of S st X = {p
  where p is Point of S: f.p = g.p} holds X is closed
proof
  let T be Hausdorff non empty TopSpace, f, g be continuous Function of S, T;
  {p where p is Point of S: f.p <> g.p} c= the carrier of S
  proof
    let x be object;
    assume x in {p where p is Point of S: f.p <> g.p};
    then ex a being Point of S st x = a & f.a <> g.a;
    hence thesis;
  end;
  then reconsider A = {p where p is Point of S: f.p <> g.p} as Subset of S;
A1: [#]T <> {};
  thus for X being Subset of S st X = {p where p is Point of S: f.p <> g.p
  } holds X is open
  proof
    let X be Subset of S such that
A2: X = {p where p is Point of S: f.p <> g.p};
    for x being set holds x in X iff ex Q being Subset of S st Q is open &
    Q c= X & x in Q
    proof
      let x be set;
      hereby
        assume x in X;
        then consider p being Point of S such that
A3:     x = p and
A4:     f.p <> g.p by A2;
        consider W, V being Subset of T such that
A5:     W is open & V is open and
A6:     f.p in W and
A7:     g.p in V and
A8:     W misses V by A4,PRE_TOPC:def 10;
        dom g = the carrier of S by FUNCT_2:def 1;
        then [x,g.p] in g by A3,FUNCT_1:def 2;
        then
A9:     x in g"V by A7,RELAT_1:def 14;
        take Q = (f"W) /\ (g"V);
        f"W is open & g"V is open by A1,A5,TOPS_2:43;
        hence Q is open;
        thus Q c= X
        proof
          let q be object;
          assume
A10:      q in Q;
          then q in f"W by XBOOLE_0:def 4;
          then consider yf being object such that
A11:      [q,yf] in f and
A12:      yf in W by RELAT_1:def 14;
          q in g"V by A10,XBOOLE_0:def 4;
          then consider yg being object such that
A13:      [q,yg] in g & yg in V by RELAT_1:def 14;
A14:      yg = g.q & not yg in W by A8,A13,FUNCT_1:1,XBOOLE_0:3;
          yf = f.q by A11,FUNCT_1:1;
          hence thesis by A2,A10,A12,A14;
        end;
        dom f = the carrier of S by FUNCT_2:def 1;
        then [x,f.p] in f by A3,FUNCT_1:def 2;
        then x in f"W by A6,RELAT_1:def 14;
        hence x in Q by A9,XBOOLE_0:def 4;
      end;
      given Q being Subset of S such that
      Q is open and
A15:  Q c= X & x in Q;
      thus thesis by A15;
    end;
    hence thesis by TOPS_1:25;
  end;
  then
A16: A is open;
  let X be Subset of S such that
A17: X = {p where p is Point of S: f.p = g.p};
  X` = A
  proof
    hereby
      let x be object;
      assume
A18:  x in X`;
      then not x in X by XBOOLE_0:def 5;
      then f.x <> g.x by A17,A18;
      hence x in A by A18;
    end;
    let x be object;
    assume x in A;
    then consider p being Point of S such that
A19: x = p and
A20: f.p <> g.p;
    now
      assume p in {t where t is Point of S: f.t = g.t};
      then ex t being Point of S st p = t & f.t = g.t;
      hence contradiction by A20;
    end;
    hence thesis by A17,A19,XBOOLE_0:def 5;
  end;
  hence thesis by A16;
end;
