Definition filtermap {T U : Type} (f : T -> U) (F : (T -> Prop) -> Prop) :=
  fun P => F (fun x => P (f x)).Global Instance filtermap_filter :
  forall T U (f : T -> U) (F : (T -> Prop) -> Prop),
  Filter F -> Filter (filtermap f F).Global Instance filtermap_proper_filter' :
  forall T U (f : T -> U) (F : (T -> Prop) -> Prop),
  ProperFilter' F -> ProperFilter' (filtermap f F).Global Instance filtermap_proper_filter :
  forall T U (f : T -> U) (F : (T -> Prop) -> Prop),
  ProperFilter F -> ProperFilter (filtermap f F).Definition filtermapi {T U : Type} (f : T -> U -> Prop) (F : (T -> Prop) -> Prop) :=
  fun P : U -> Prop => F (fun x => exists y, f x y /\ P y).Global Instance filtermapi_filter :
  forall T U (f : T -> U -> Prop) (F : (T -> Prop) -> Prop),
  F (fun x => (exists y, f x y) /\ forall y1 y2, f x y1 -> f x y2 -> y1 = y2) ->
  Filter F -> Filter (filtermapi f F).Global Instance filtermapi_proper_filter' :
  forall T U (f : T -> U -> Prop) (F : (T -> Prop) -> Prop),
  F (fun x => (exists y, f x y) /\ forall y1 y2, f x y1 -> f x y2 -> y1 = y2) ->
  ProperFilter' F -> ProperFilter' (filtermapi f F).Global Instance filtermapi_proper_filter :
  forall T U (f : T -> U -> Prop) (F : (T -> Prop) -> Prop),
  F (fun x => (exists y, f x y) /\ forall y1 y2, f x y1 -> f x y2 -> y1 = y2) ->
  ProperFilter F -> ProperFilter (filtermapi f F).Definition filterlim {T U : Type} (f : T -> U) F G :=
  filter_le (filtermap f F) G.

(* Specifications: *)
Lemma filterlim_id : forall T (F : (T -> Prop) -> Prop), filterlim (fun x => x) F F.
Lemma filterlim_comp : forall T U V (f : T -> U) (g : U -> V) F G H, filterlim f F G -> filterlim g G H -> filterlim (fun x => g (f x)) F H.
Lemma filterlim_ext_loc : forall {T U F G} {FF : Filter F} (f g : T -> U), F (fun x => f x = g x) -> filterlim f F G -> filterlim g F G.
Lemma filterlim_ext : forall {T U F G} {FF : Filter F} (f g : T -> U), (forall x, f x = g x) -> filterlim f F G -> filterlim g F G.
Lemma filterlim_filter_le_1 : forall {T U F G H} (f : T -> U), filter_le G F -> filterlim f F H -> filterlim f G H.
Lemma filterlim_filter_le_2 : forall {T U F G H} (f : T -> U), filter_le G H -> filterlim f F G -> filterlim f F H.