(** This file is part of the Coquelicot formalization of real analysis in Coq: http://coquelicot.saclay.inria.fr/  Copyright (C) 2011-2015 Sylvie Boldo #<br /># Copyright (C) 2011-2015 Catherine Lelay #<br /># Copyright (C) 2011-2015 Guillaume Melquiond  This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the COPYING file for more details. *)
(** This file first describes [Filter]s that are predicates of type [(T -> Prop) -> Prop] used for limits and neighborhoods.  Then the algebraic hierarchy of the Coquelicot library is given: from the [AbelianGroup] to the [CompleteNormedModule]. Topologies on [R] and [R*R] are also given.  #<br/># More documentation details can be found in #<a href="Coquelicot.Coquelicot.html">Coquelicot.html</a>#. *)
Open Scope R_scope.
(** * Filters *)
(** ** Definitions *)
Class Filter {T : Type} (F : (T -> Prop) -> Prop) := {
filter_true : F (fun _ => True) ;
filter_and : forall P Q : T -> Prop, F P -> F Q -> F (fun x => P x /\ Q x) ;
filter_imp : forall P Q : T -> Prop, (forall x, P x -> Q x) -> F P -> F Q
}.
Global Hint Mode Filter + + : typeclass_instances.
Class ProperFilter' {T : Type} (F : (T -> Prop) -> Prop) := {
filter_not_empty : not (F (fun _ => False)) ;
filter_filter' :> Filter F
}.
Class ProperFilter {T : Type} (F : (T -> Prop) -> Prop) := {
filter_ex : forall P, F P -> exists x, P x ;
filter_filter :> Filter F
}.
Global Instance Proper_StrongProper :
forall {T : Type} (F : (T -> Prop) -> Prop),
ProperFilter F -> ProperFilter' F.

(* Specifications: *)
Lemma filter_forall :
forall {T : Type} {F} {FF: @Filter T F} (P : T -> Prop),
(forall x, P x) -> F P.
Lemma filter_const :
forall {T : Type} {F} {FF: @ProperFilter T F} (P : Prop),
F (fun _ => P) -> P.