reserve x,y,X,Y for set;
reserve C,D,E for non empty set;
reserve SC for Subset of C;
reserve SD for Subset of D;
reserve SE for Subset of E;
reserve c,c1,c2 for Element of C;
reserve d,d1,d2 for Element of D;
reserve e for Element of E;
reserve f,f1,g for PartFunc of C,D;
reserve t for PartFunc of D,C;
reserve s for PartFunc of D,E;
reserve h for PartFunc of C,E;
reserve F for PartFunc of D,D;

theorem
  X meets dom f implies (f|X is constant iff ex d st rng (f|X) = {d})
proof
  assume
A1: X /\ dom f <> {};
  thus f|X is constant implies ex d st rng (f|X) = {d}
  proof
    assume f|X is constant;
    then consider d such that
A2: for c st c in X /\ dom f holds f/.c = d by Th35;
    take d;
    thus rng (f|X) c= {d}
    proof
      let x be object;
      assume x in rng (f|X);
      then consider y being object such that
A3:   y in dom (f|X) and
A4:   ((f|X) qua Function).y = x by FUNCT_1:def 3;
      reconsider y as Element of C by A3;
      dom (f|X) = X /\ dom f by RELAT_1:61;
      then d = f/.y by A2,A3
        .= f|X/.y by A3,Th15
        .= x by A3,A4,PARTFUN1:def 6;
      hence thesis by TARSKI:def 1;
    end;
    thus {d} c= rng (f|X)
    proof
      set y = the Element of X /\ dom f;
      y in dom f by A1,XBOOLE_0:def 4;
      then reconsider y as Element of C;
      let x be object such that
A5:   x in {d};
A6:   dom (f|X) = X /\ dom f by RELAT_1:61;
      then f|X/.y = f/.y by A1,Th15
        .= d by A1,A2
        .= x by A5,TARSKI:def 1;
      hence thesis by A1,A6,Th2;
    end;
  end;
  given d such that
A7: rng (f|X) = {d};
  take d;
  let c;
  assume
A8: c in dom (f|X);
  then f|X/.c in {d} by A7,Th2;
  then (f|X).c in {d} by A8,PARTFUN1:def 6;
  hence thesis by TARSKI:def 1;
end;
