(********************************************************)
(** *            Proof of Heine's theorem               *)
(********************************************************)
Definition uniform_continuity (f:R -> R) (X:R -> Prop) : Prop :=
forall eps:posreal,
exists delta : posreal,
(forall x y:R,
X x -> X y -> Rabs (x - y) < delta -> Rabs (f x - f y) < eps).

Theorem Heine :
forall (f:R -> R) (X:R -> Prop),
compact X ->
(forall x:R, X x -> continuity_pt f x) -> uniform_continuity f X.