(** Restriction of a filter to a domain *)

Definition within {T : Type} D (F : (T -> Prop) -> Prop) (P : T -> Prop) :=
  F (fun x => D x -> P x).Global Instance within_filter :
  forall T D F, Filter F -> Filter (@within T D F).

(* Specifications: *)
Lemma filter_le_within : forall {T} {F : (T -> Prop) -> Prop} {FF : Filter F} D, filter_le (within D F) F.
Lemma filterlim_within_ext : forall {T U F G} {FF : Filter F} D (f g : T -> U), (forall x, D x -> f x = g x) -> filterlim f (within D F) G -> filterlim g (within D F) G.