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.

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.