doc-next-gen

Mathlib.Order.Filter.Map

Module docstring

{"# Theorems about map and comap on filters. ","### Push-forwards, pull-backs, and the monad structure ","### Filter as a Monad

In this section we define Filter.monad, a Monad structure on Filters. This definition is not an instance because its Seq projection is not equal to the Filter.seq function we use in the Applicative instance on Filter. ","#### map and comap equations ","The variables in the following lemmas are used as in this diagram: φ α → β θ ↓ ↓ ψ γ → δ ρ ","#### bind equations "}

Filter.map_principal theorem
{s : Set α} {f : α → β} : map f (𝓟 s) = 𝓟 (Set.image f s)
Full source
@[simp]
theorem map_principal {s : Set α} {f : α → β} : map f (𝓟 s) = 𝓟 (Set.image f s) :=
  Filter.ext fun _ => image_subset_iff.symm
Image of Principal Filter Equals Principal Filter of Image
Informal description
For any set $s \subseteq \alpha$ and any function $f : \alpha \to \beta$, the image filter of the principal filter generated by $s$ under $f$ is equal to the principal filter generated by the image of $s$ under $f$. In symbols: \[ \text{map } f (\mathcal{P}(s)) = \mathcal{P}(f(s)). \]
Filter.eventually_map theorem
{P : β → Prop} : (∀ᶠ b in map m f, P b) ↔ ∀ᶠ a in f, P (m a)
Full source
@[simp]
theorem eventually_map {P : β → Prop} : (∀ᶠ b in map m f, P b) ↔ ∀ᶠ a in f, P (m a) :=
  Iff.rfl
Eventual Property Preservation under Filter Mapping
Informal description
For any predicate $P : \beta \to \text{Prop}$, the property $P$ holds eventually in the filter $\text{map } m f$ if and only if the composition $P \circ m$ holds eventually in the filter $f$. In other words, \[ \forallᶠ b \text{ in } \text{map } m f, P b \leftrightarrow \forallᶠ a \text{ in } f, P (m a). \]
Filter.frequently_map theorem
{P : β → Prop} : (∃ᶠ b in map m f, P b) ↔ ∃ᶠ a in f, P (m a)
Full source
@[simp]
theorem frequently_map {P : β → Prop} : (∃ᶠ b in map m f, P b) ↔ ∃ᶠ a in f, P (m a) :=
  Iff.rfl
Frequently Property Preservation under Filter Mapping
Informal description
For any predicate $P : \beta \to \text{Prop}$ and function $m : \alpha \to \beta$, the property $P$ holds frequently in the filter $\text{map } m f$ if and only if the composition $P \circ m$ holds frequently in the original filter $f$. In other words, $\existsᶠ b \text{ in } \text{map } m f, P b \leftrightarrow \existsᶠ a \text{ in } f, P (m a)$.
Filter.eventuallyEq_map theorem
{f₁ f₂ : β → γ} : f₁ =ᶠ[map m f] f₂ ↔ f₁ ∘ m =ᶠ[f] f₂ ∘ m
Full source
@[simp]
theorem eventuallyEq_map {f₁ f₂ : β → γ} : f₁ =ᶠ[map m f] f₂f₁ =ᶠ[map m f] f₂ ↔ f₁ ∘ m =ᶠ[f] f₂ ∘ m := .rfl
Equivalence of Eventual Equality under Filter Mapping
Informal description
For any two functions $f_1, f_2 : \beta \to \gamma$ and a function $m : \alpha \to \beta$, the functions $f_1$ and $f_2$ are eventually equal with respect to the filter $\text{map } m f$ if and only if the compositions $f_1 \circ m$ and $f_2 \circ m$ are eventually equal with respect to the filter $f$. In other words: $$ f_1 =_{\text{map } m f} f_2 \iff f_1 \circ m =_f f_2 \circ m $$
Filter.eventuallyLE_map theorem
[LE γ] {f₁ f₂ : β → γ} : f₁ ≤ᶠ[map m f] f₂ ↔ f₁ ∘ m ≤ᶠ[f] f₂ ∘ m
Full source
@[simp]
theorem eventuallyLE_map [LE γ] {f₁ f₂ : β → γ} : f₁ ≤ᶠ[map m f] f₂f₁ ≤ᶠ[map m f] f₂ ↔ f₁ ∘ m ≤ᶠ[f] f₂ ∘ m := .rfl
Image Filter Preserves Eventually Less-Than Relation
Informal description
Let $\gamma$ be a type with a less-than-or-equal relation $\leq$, $m : \alpha \to \beta$ a function, and $f$ a filter on $\alpha$. For any two functions $f_1, f_2 : \beta \to \gamma$, the following are equivalent: 1. The relation $f_1 \leq f_2$ holds eventually with respect to the image filter $\text{map } m f$ on $\beta$. 2. The relation $f_1 \circ m \leq f_2 \circ m$ holds eventually with respect to the original filter $f$ on $\alpha$.
Filter.mem_map theorem
: t ∈ map m f ↔ m ⁻¹' t ∈ f
Full source
@[simp]
theorem mem_map : t ∈ map m ft ∈ map m f ↔ m ⁻¹' t ∈ f :=
  Iff.rfl
Characterization of Image Filter Membership via Preimage
Informal description
For any function $m : \alpha \to \beta$, filter $f$ on $\alpha$, and subset $t \subseteq \beta$, the subset $t$ belongs to the image filter $\text{map } m f$ if and only if the preimage $m^{-1}(t)$ belongs to $f$.
Filter.mem_map' theorem
: t ∈ map m f ↔ {x | m x ∈ t} ∈ f
Full source
theorem mem_map' : t ∈ map m ft ∈ map m f ↔ { x | m x ∈ t } ∈ f :=
  Iff.rfl
Characterization of Membership in Image Filter via Preimage
Informal description
For any function $m : \alpha \to \beta$, filter $f$ on $\alpha$, and subset $t \subseteq \beta$, the subset $t$ belongs to the image filter $\text{map } m f$ if and only if the preimage $\{x \mid m x \in t\}$ belongs to $f$.
Filter.image_mem_map theorem
(hs : s ∈ f) : m '' s ∈ map m f
Full source
theorem image_mem_map (hs : s ∈ f) : m '' sm '' s ∈ map m f :=
  f.sets_of_superset hs <| subset_preimage_image m s
Image of a Filter Set Belongs to the Mapped Filter
Informal description
For any function $m : \alpha \to \beta$ and filter $f$ on $\alpha$, if a subset $s \in f$, then the image $m(s)$ belongs to the image filter $\text{map } m f$.
Filter.image_mem_map_iff theorem
(hf : Injective m) : m '' s ∈ map m f ↔ s ∈ f
Full source
@[simp 1100, nolint simpNF]
theorem image_mem_map_iff (hf : Injective m) : m '' sm '' s ∈ map m fm '' s ∈ map m f ↔ s ∈ f :=
  ⟨fun h => by rwa [← preimage_image_eq s hf], image_mem_map⟩
Image Membership in Mapped Filter for Injective Functions: $m(s) \in \text{map } m f \leftrightarrow s \in f$
Informal description
For an injective function $m : \alpha \to \beta$ and a filter $f$ on $\alpha$, the image $m(s)$ belongs to the image filter $\text{map } m f$ if and only if the subset $s$ belongs to $f$.
Filter.range_mem_map theorem
: range m ∈ map m f
Full source
theorem range_mem_map : rangerange m ∈ map m f := by
  rw [← image_univ]
  exact image_mem_map univ_mem
Range of Function Belongs to its Mapped Filter
Informal description
For any function $m : \alpha \to \beta$ and any filter $f$ on $\alpha$, the range of $m$ belongs to the image filter $\text{map } m f$.
Filter.mem_map_iff_exists_image theorem
: t ∈ map m f ↔ ∃ s ∈ f, m '' s ⊆ t
Full source
theorem mem_map_iff_exists_image : t ∈ map m ft ∈ map m f ↔ ∃ s ∈ f, m '' s ⊆ t :=
  ⟨fun ht => ⟨m ⁻¹' t, ht, image_preimage_subset _ _⟩, fun ⟨_, hs, ht⟩ =>
    mem_of_superset (image_mem_map hs) ht⟩
Characterization of Membership in Mapped Filter via Preimage Sets
Informal description
For any function $m \colon \alpha \to \beta$, filter $f$ on $\alpha$, and subset $t \subseteq \beta$, the subset $t$ belongs to the image filter $\text{map } m f$ if and only if there exists a subset $s \in f$ such that the image $m(s)$ is contained in $t$.
Filter.map_id theorem
: Filter.map id f = f
Full source
@[simp]
theorem map_id : Filter.map id f = f :=
  filter_eq <| rfl
Identity Function Preserves Filter under Map
Informal description
For any filter $f$ on a type $\alpha$, the image filter of $f$ under the identity function $\text{id} : \alpha \to \alpha$ is equal to $f$ itself, i.e., $\text{map}(\text{id}, f) = f$.
Filter.map_id' theorem
: Filter.map (fun x => x) f = f
Full source
@[simp]
theorem map_id' : Filter.map (fun x => x) f = f :=
  map_id
Identity Function Preserves Filter under Map (Lambda Form)
Informal description
For any filter $f$ on a type $\alpha$, the image filter of $f$ under the identity function $\lambda x, x$ is equal to $f$ itself, i.e., $\text{map}(\lambda x, x, f) = f$.
Filter.map_compose theorem
: Filter.map m' ∘ Filter.map m = Filter.map (m' ∘ m)
Full source
@[simp]
theorem map_compose : Filter.mapFilter.map m' ∘ Filter.map m = Filter.map (m' ∘ m) :=
  funext fun _ => filter_eq <| rfl
Composition of Filter Maps Equals Filter Map of Composition
Informal description
For any functions $m : \alpha \to \beta$ and $m' : \beta \to \gamma$, and any filter $f$ on $\alpha$, the composition of the filter maps satisfies: \[ \text{Filter.map } m' \circ \text{Filter.map } m = \text{Filter.map } (m' \circ m) \]
Filter.map_map theorem
: Filter.map m' (Filter.map m f) = Filter.map (m' ∘ m) f
Full source
@[simp]
theorem map_map : Filter.map m' (Filter.map m f) = Filter.map (m' ∘ m) f :=
  congr_fun Filter.map_compose f
Composition of Filter Maps via Function Composition
Informal description
For any functions $m \colon \alpha \to \beta$ and $m' \colon \beta \to \gamma$, and any filter $f$ on $\alpha$, the following equality holds: \[ \text{map}_{m'} (\text{map}_{m} f) = \text{map}_{m' \circ m} f \] where $\text{map}$ denotes the filter image operation.
Filter.map_congr theorem
{m₁ m₂ : α → β} {f : Filter α} (h : m₁ =ᶠ[f] m₂) : map m₁ f = map m₂ f
Full source
/-- If functions `m₁` and `m₂` are eventually equal at a filter `f`, then
they map this filter to the same filter. -/
theorem map_congr {m₁ m₂ : α → β} {f : Filter α} (h : m₁ =ᶠ[f] m₂) : map m₁ f = map m₂ f :=
  Filter.ext' fun _ => eventually_congr (h.mono fun _ hx => hx ▸ Iff.rfl)
Equality of Filter Images for Eventually Equal Functions
Informal description
Let $m_1, m_2 : \alpha \to \beta$ be functions and $f$ be a filter on $\alpha$. If $m_1$ and $m_2$ are eventually equal with respect to $f$ (i.e., $m_1(x) = m_2(x)$ for all $x$ in some set belonging to $f$), then the image filters $\text{map } m_1 f$ and $\text{map } m_2 f$ are equal.
Filter.mem_comap' theorem
: s ∈ comap f l ↔ {y | ∀ ⦃x⦄, f x = y → x ∈ s} ∈ l
Full source
theorem mem_comap' : s ∈ comap f ls ∈ comap f l ↔ { y | ∀ ⦃x⦄, f x = y → x ∈ s } ∈ l :=
  ⟨fun ⟨t, ht, hts⟩ => mem_of_superset ht fun y hy x hx => hts <| mem_preimage.2 <| by rwa [hx],
    fun h => ⟨_, h, fun _ hx => hx rfl⟩⟩
Characterization of Preimage Filter Membership via Kernel Image
Informal description
For a function $f \colon \alpha \to \beta$, a filter $l$ on $\beta$, and a subset $s \subseteq \alpha$, the following are equivalent: 1. $s$ belongs to the preimage filter $\text{comap } f l$; 2. The set $\{y \in \beta \mid \forall x \in \alpha, f(x) = y \implies x \in s\}$ belongs to $l$.
Filter.mem_comap'' theorem
: s ∈ comap f l ↔ kernImage f s ∈ l
Full source
theorem mem_comap'' : s ∈ comap f ls ∈ comap f l ↔ kernImage f s ∈ l :=
  mem_comap'
Characterization of Preimage Filter Membership via Kernel Image (Alternative Form)
Informal description
For a function $f \colon \alpha \to \beta$, a filter $l$ on $\beta$, and a subset $s \subseteq \alpha$, the following are equivalent: 1. $s$ belongs to the preimage filter $\text{comap } f l$; 2. The kernel image $\text{kernImage}(f, s)$ belongs to $l$, where $\text{kernImage}(f, s) = \{y \in \beta \mid \forall x \in \alpha, f(x) = y \implies x \in s\}$.
Filter.mem_comap_prodMk theorem
{x : α} {s : Set β} {F : Filter (α × β)} : s ∈ comap (Prod.mk x) F ↔ {p : α × β | p.fst = x → p.snd ∈ s} ∈ F
Full source
/-- RHS form is used, e.g., in the definition of `UniformSpace`. -/
lemma mem_comap_prodMk {x : α} {s : Set β} {F : Filter (α × β)} :
    s ∈ comap (Prod.mk x) Fs ∈ comap (Prod.mk x) F ↔ {p : α × β | p.fst = x → p.snd ∈ s} ∈ F := by
  simp_rw [mem_comap', Prod.ext_iff, and_imp, @forall_swap β (_ = _), forall_eq, eq_comm]
Membership in Preimage Filter via Projection: $\text{comap}(\text{Prod.mk } x, F)$
Informal description
For any element $x \in \alpha$, subset $s \subseteq \beta$, and filter $F$ on $\alpha \times \beta$, the set $s$ belongs to the preimage filter $\text{comap}(\text{Prod.mk } x, F)$ if and only if the set $\{p \in \alpha \times \beta \mid p.1 = x \to p.2 \in s\}$ belongs to $F$.
Filter.eventually_comap theorem
: (∀ᶠ a in comap f l, p a) ↔ ∀ᶠ b in l, ∀ a, f a = b → p a
Full source
@[simp]
theorem eventually_comap : (∀ᶠ a in comap f l, p a) ↔ ∀ᶠ b in l, ∀ a, f a = b → p a :=
  mem_comap'
Characterization of Eventually in Preimage Filter via Kernel Condition
Informal description
For a function $f \colon \alpha \to \beta$, a filter $l$ on $\beta$, and a predicate $p \colon \alpha \to \text{Prop}$, the following are equivalent: 1. The predicate $p$ holds eventually in the preimage filter $\text{comap } f l$; 2. The set $\{b \in \beta \mid \forall a \in \alpha, f(a) = b \to p(a)\}$ belongs to $l$. In other words: \[ (\forallᶠ a \text{ in } \text{comap } f l, p(a)) \leftrightarrow (\forallᶠ b \text{ in } l, \forall a, f(a) = b \to p(a)). \]
Filter.frequently_comap theorem
: (∃ᶠ a in comap f l, p a) ↔ ∃ᶠ b in l, ∃ a, f a = b ∧ p a
Full source
@[simp]
theorem frequently_comap : (∃ᶠ a in comap f l, p a) ↔ ∃ᶠ b in l, ∃ a, f a = b ∧ p a := by
  simp only [Filter.Frequently, eventually_comap, not_exists, _root_.not_and]
Frequently in Preimage Filter Characterization
Informal description
For a function $f : \alpha \to \beta$, a filter $l$ on $\beta$, and a predicate $p : \alpha \to \text{Prop}$, the property $p$ holds frequently in the preimage filter $\text{comap } f l$ if and only if there exists a point $b \in \beta$ such that $b$ is frequently in $l$ and there exists $a \in \alpha$ with $f(a) = b$ and $p(a)$ holds. In other words: \[ (\existsᶠ a \text{ in } \text{comap } f l, p(a)) \leftrightarrow (\existsᶠ b \text{ in } l, \exists a, f(a) = b \land p(a)). \]
Filter.mem_comap_iff_compl theorem
: s ∈ comap f l ↔ (f '' sᶜ)ᶜ ∈ l
Full source
theorem mem_comap_iff_compl : s ∈ comap f ls ∈ comap f l ↔ (f '' sᶜ)ᶜ ∈ l := by
  simp only [mem_comap'', kernImage_eq_compl]
Characterization of Preimage Filter Membership via Complement Image
Informal description
For a function $f : \alpha \to \beta$, a filter $l$ on $\beta$, and a subset $s \subseteq \alpha$, the set $s$ belongs to the preimage filter $\text{comap } f l$ if and only if the complement of the image of the complement of $s$ under $f$ belongs to $l$. That is, \[ s \in \text{comap } f l \leftrightarrow (f(s^c))^c \in l. \]
Filter.compl_mem_comap theorem
: sᶜ ∈ comap f l ↔ (f '' s)ᶜ ∈ l
Full source
theorem compl_mem_comap : sᶜsᶜ ∈ comap f lsᶜ ∈ comap f l ↔ (f '' s)ᶜ ∈ l := by rw [mem_comap_iff_compl, compl_compl]
Complement Membership in Preimage Filter via Complement Image
Informal description
For a function $f : \alpha \to \beta$, a filter $l$ on $\beta$, and a subset $s \subseteq \alpha$, the complement $s^c$ belongs to the preimage filter $\text{comap } f l$ if and only if the complement of the image of $s$ under $f$ belongs to $l$. That is, \[ s^c \in \text{comap } f l \leftrightarrow (f(s))^c \in l. \]
Filter.instLawfulFunctor instance
: LawfulFunctor (Filter : Type u → Type u)
Full source
instance : LawfulFunctor (Filter : Type u → Type u) where
  id_map _ := map_id
  comp_map _ _ _ := map_map.symm
  map_const := rfl
Filter is a Lawful Functor
Informal description
The `Filter` type constructor forms a lawful functor, meaning that it satisfies the functor laws: 1. Identity: For any filter $f$, $\text{map}(\text{id}, f) = f$. 2. Composition: For any functions $m \colon \alpha \to \beta$ and $m' \colon \beta \to \gamma$, and any filter $f$ on $\alpha$, $\text{map}(m', \text{map}(m, f)) = \text{map}(m' \circ m, f)$.
Filter.pure_sets theorem
(a : α) : (pure a : Filter α).sets = {s | a ∈ s}
Full source
theorem pure_sets (a : α) : (pure a : Filter α).sets = { s | a ∈ s } :=
  rfl
Characterization of Pure Filter Sets: $\text{pure } a = \{s \mid a \in s\}$
Informal description
For any element $a$ of type $\alpha$, the collection of sets in the filter `pure a` is exactly the collection of all sets $s$ that contain $a$, i.e., $\{s \mid a \in s\}$.
Filter.eventually_pure theorem
{a : α} {p : α → Prop} : (∀ᶠ x in pure a, p x) ↔ p a
Full source
@[simp]
theorem eventually_pure {a : α} {p : α → Prop} : (∀ᶠ x in pure a, p x) ↔ p a :=
  Iff.rfl
Eventual Truth in Pure Filter
Informal description
For any element $a$ of type $\alpha$ and any predicate $p : \alpha \to \text{Prop}$, the property $p$ holds eventually with respect to the pure filter $\text{pure } a$ if and only if $p(a)$ holds. In other words, $\forallᶠ x \text{ in } \text{pure } a, p x \leftrightarrow p a$.
Filter.principal_singleton theorem
(a : α) : 𝓟 { a } = pure a
Full source
@[simp]
theorem principal_singleton (a : α) : 𝓟 {a} = pure a :=
  Filter.ext fun s => by simp only [mem_pure, mem_principal, singleton_subset_iff]
Principal Filter of Singleton Equals Pure Filter
Informal description
For any element $a$ of a type $\alpha$, the principal filter generated by the singleton set $\{a\}$ is equal to the pure filter at $a$. That is, $\mathcal{P}\{a\} = \text{pure } a$.
Filter.map_pure theorem
(f : α → β) (a : α) : map f (pure a) = pure (f a)
Full source
@[simp]
theorem map_pure (f : α → β) (a : α) : map f (pure a) = pure (f a) :=
  rfl
Image of Pure Filter Under Function Equals Pure Filter of Image
Informal description
For any function $f : \alpha \to \beta$ and any element $a \in \alpha$, the image filter of the pure filter (principal filter generated by $\{a\}$) under $f$ is equal to the pure filter generated by $\{f(a)\}$. In symbols: $$\text{map } f (\text{pure } a) = \text{pure } (f a)$$
Filter.pure_le_principal theorem
{s : Set α} (a : α) : pure a ≤ 𝓟 s ↔ a ∈ s
Full source
theorem pure_le_principal {s : Set α} (a : α) : purepure a ≤ 𝓟 s ↔ a ∈ s := by
  simp
Principal Filter Containment and Membership: $\text{pure } a \leq \mathcal{P}s \leftrightarrow a \in s$
Informal description
For any set $s$ in a type $\alpha$ and any element $a \in \alpha$, the principal filter generated by the singleton $\{a\}$ is contained in the principal filter generated by $s$ if and only if $a$ is an element of $s$. In symbols, $\text{pure } a \leq \mathcal{P}s \leftrightarrow a \in s$.
Filter.join_pure theorem
(f : Filter α) : join (pure f) = f
Full source
@[simp] theorem join_pure (f : Filter α) : join (pure f) = f := rfl
Join of Pure Filter Equals Original Filter
Informal description
For any filter $f$ on a type $\alpha$, the join of the pure filter (principal filter) generated by $f$ is equal to $f$ itself, i.e., $\text{join}(\text{pure } f) = f$.
Filter.pure_bind theorem
(a : α) (m : α → Filter β) : bind (pure a) m = m a
Full source
@[simp]
theorem pure_bind (a : α) (m : α → Filter β) : bind (pure a) m = m a := by
  simp only [Bind.bind, bind, map_pure, join_pure]
Bind of Pure Filter Equals Function Application
Informal description
For any element $a$ of type $\alpha$ and any function $m : \alpha \to \text{Filter } \beta$, the bind operation applied to the pure filter of $a$ and $m$ is equal to $m(a)$. In other words, $\text{bind}(\text{pure } a, m) = m(a)$.
Filter.map_bind theorem
{α β} (m : β → γ) (f : Filter α) (g : α → Filter β) : map m (bind f g) = bind f (map m ∘ g)
Full source
theorem map_bind {α β} (m : β → γ) (f : Filter α) (g : α → Filter β) :
    map m (bind f g) = bind f (mapmap m ∘ g) :=
  rfl
Interchange Law for Map and Bind on Filters
Informal description
For any function $m \colon \beta \to \gamma$, any filter $f$ on a type $\alpha$, and any function $g \colon \alpha \to \text{Filter } \beta$, the image filter of the bind operation $\text{map } m (\text{bind } f g)$ is equal to the bind operation of $f$ with the composition $\text{map } m \circ g$. In other words, the following equality holds: \[ \text{map } m (\text{bind } f g) = \text{bind } f (\text{map } m \circ g). \]
Filter.bind_map theorem
{α β} (m : α → β) (f : Filter α) (g : β → Filter γ) : (bind (map m f) g) = bind f (g ∘ m)
Full source
theorem bind_map {α β} (m : α → β) (f : Filter α) (g : β → Filter γ) :
    (bind (map m f) g) = bind f (g ∘ m) :=
  rfl
Commutativity of bind and map for filters: $\text{bind}(\text{map}(m, f), g) = \text{bind}(f, g \circ m)$
Informal description
For any function $m : \alpha \to \beta$, any filter $f$ on $\alpha$, and any function $g : \beta \to \text{Filter } \gamma$, the filter obtained by first mapping $f$ through $m$ and then binding the result with $g$ is equal to the filter obtained by binding $f$ with the composition $g \circ m$. In symbols: $$\text{bind}(\text{map}(m, f), g) = \text{bind}(f, g \circ m)$$
Filter.monad definition
: Monad Filter
Full source
/-- The monad structure on filters. -/
protected def monad : Monad Filter where map := @Filter.map
Monad structure on filters
Informal description
The monad structure on filters, where: - The `map` operation takes a function $m : \alpha \to \beta$ and a filter $f$ on $\alpha$, and returns the filter on $\beta$ consisting of all subsets $s \subseteq \beta$ whose preimage $m^{-1}(s)$ belongs to $f$. - The `pure` operation constructs the principal filter generated by a singleton set. - The `bind` operation combines filters through a function $g : \alpha \to \text{Filter } \beta$. This structure satisfies the monad laws, making filters a lawful monad.
Filter.lawfulMonad theorem
: LawfulMonad Filter
Full source
protected theorem lawfulMonad : LawfulMonad Filter where
  map_const := rfl
  id_map _ := rfl
  seqLeft_eq _ _ := rfl
  seqRight_eq _ _ := rfl
  pure_seq _ _ := rfl
  bind_pure_comp _ _ := rfl
  bind_map _ _ := rfl
  pure_bind _ _ := rfl
  bind_assoc _ _ _ := rfl
Filter Monad Laws
Informal description
The `Filter` type constructor, equipped with the `map`, `pure`, and `bind` operations, satisfies the monad laws: 1. Left identity: $\text{bind}(\text{pure } a, f) = f a$ for any $a : \alpha$ and $f : \alpha \to \text{Filter } \beta$. 2. Right identity: $\text{bind}(m, \text{pure}) = m$ for any $m : \text{Filter } \alpha$. 3. Associativity: $\text{bind}(\text{bind}(m, f), g) = \text{bind}(m, \lambda a, \text{bind}(f a, g))$ for any $m : \text{Filter } \alpha$, $f : \alpha \to \text{Filter } \beta$, and $g : \beta \to \text{Filter } \gamma$.
Filter.instAlternative instance
: Alternative Filter
Full source
instance : Alternative Filter where
  seq := fun x y => x.seq (y ())
  failure := 
  orElse x y := x ⊔ y ()
Alternative Functor Structure on Filters
Informal description
The type of filters on any type $\alpha$ forms an alternative functor, which is a combination of an applicative functor and a monoid structure. This structure provides operations for combining filters with optionality and choice.
Filter.map_def theorem
{α β} (m : α → β) (f : Filter α) : m <$> f = map m f
Full source
@[simp]
theorem map_def {α β} (m : α → β) (f : Filter α) : m <$> f = map m f :=
  rfl
Functorial Map Equals Filter Map
Informal description
For any function $m : \alpha \to \beta$ and any filter $f$ on $\alpha$, the functorial map operation `<$>` applied to $m$ and $f$ is equal to the filter map operation $\text{map } m f$.
Filter.bind_def theorem
{α β} (f : Filter α) (m : α → Filter β) : f >>= m = bind f m
Full source
@[simp]
theorem bind_def {α β} (f : Filter α) (m : α → Filter β) : f >>= m = bind f m :=
  rfl
Monadic Bind Equals Filter Bind Operation
Informal description
For any filter $f$ on a type $\alpha$ and any function $m : \alpha \to \text{Filter } \beta$, the monadic bind operation `>>=` applied to $f$ and $m$ is equal to the filter bind operation $\text{bind } f m$.
Filter.mem_comap theorem
: s ∈ comap m g ↔ ∃ t ∈ g, m ⁻¹' t ⊆ s
Full source
@[simp] theorem mem_comap : s ∈ comap m gs ∈ comap m g ↔ ∃ t ∈ g, m ⁻¹' t ⊆ s := Iff.rfl
Characterization of Membership in Preimage Filter
Informal description
A subset $s$ of $\alpha$ belongs to the preimage filter $\text{comap } m g$ on $\alpha$ if and only if there exists a subset $t \in g$ such that the preimage $m^{-1}(t)$ is contained in $s$.
Filter.preimage_mem_comap theorem
(ht : t ∈ g) : m ⁻¹' t ∈ comap m g
Full source
theorem preimage_mem_comap (ht : t ∈ g) : m ⁻¹' tm ⁻¹' t ∈ comap m g :=
  ⟨t, ht, Subset.rfl⟩
Preimage of a Filter Element Belongs to Comap Filter
Informal description
For any function $m : \alpha \to \beta$ and any filter $g$ on $\beta$, if a subset $t$ belongs to $g$, then the preimage $m^{-1}(t)$ belongs to the comap filter $\text{comap } m g$.
Filter.Eventually.comap theorem
{p : β → Prop} (hf : ∀ᶠ b in g, p b) (f : α → β) : ∀ᶠ a in comap f g, p (f a)
Full source
theorem Eventually.comap {p : β → Prop} (hf : ∀ᶠ b in g, p b) (f : α → β) :
    ∀ᶠ a in comap f g, p (f a) :=
  preimage_mem_comap hf
Eventual Property Preservation under Filter Preimage
Informal description
Let $g$ be a filter on $\beta$ and $p : \beta \to \text{Prop}$ be a predicate. If $p$ holds eventually in $g$ (i.e., $\{b \mid p b\} \in g$), then for any function $f : \alpha \to \beta$, the predicate $p \circ f$ holds eventually in the comap filter $\text{comap } f g$ (i.e., $\{a \mid p(f a)\} \in \text{comap } f g$).
Filter.comap_id theorem
: comap id f = f
Full source
theorem comap_id : comap id f = f :=
  le_antisymm (fun _ => preimage_mem_comap) fun _ ⟨_, ht, hst⟩ => mem_of_superset ht hst
Comap Filter Identity Law: $\text{comap id } f = f$
Informal description
For any filter $f$ on a type $\alpha$, the comap filter of $f$ under the identity function $\text{id} : \alpha \to \alpha$ is equal to $f$ itself, i.e., $\text{comap id } f = f$.
Filter.comap_id' theorem
: comap (fun x => x) f = f
Full source
theorem comap_id' : comap (fun x => x) f = f := comap_id
Comap Filter Identity Law for Explicit Identity Function: $\text{comap } (\lambda x, x) f = f$
Informal description
For any filter $f$ on a type $\alpha$, the comap filter of $f$ under the identity function $\lambda x, x$ is equal to $f$ itself, i.e., $\text{comap } (\lambda x, x) f = f$.
Filter.comap_const_of_not_mem theorem
{x : β} (ht : t ∈ g) (hx : x ∉ t) : comap (fun _ : α => x) g = ⊥
Full source
theorem comap_const_of_not_mem {x : β} (ht : t ∈ g) (hx : x ∉ t) : comap (fun _ : α => x) g =  :=
  empty_mem_iff_bot.1 <| mem_comap'.2 <| mem_of_superset ht fun _ hx' _ h => hx <| h.symm ▸ hx'
Preimage Filter of Constant Function is Bottom When Point is Not in Some Set
Informal description
For any element $x \in \beta$ and any filter $g$ on $\beta$, if there exists a set $t \in g$ such that $x \notin t$, then the preimage filter of $g$ under the constant function $\lambda \_ \colon \alpha \to x$ is equal to the bottom filter on $\alpha$.
Filter.comap_const_of_mem theorem
{x : β} (h : ∀ t ∈ g, x ∈ t) : comap (fun _ : α => x) g = ⊤
Full source
theorem comap_const_of_mem {x : β} (h : ∀ t ∈ g, x ∈ t) : comap (fun _ : α => x) g =  :=
  top_unique fun _ hs => univ_mem' fun _ => h _ (mem_comap'.1 hs) rfl
Preimage Filter of Constant Function is Top When Point is in All Sets
Informal description
For any element $x \in \beta$ and any filter $g$ on $\beta$, if $x$ belongs to every set $t$ in $g$, then the preimage filter of $g$ under the constant function $\lambda \_ \colon \alpha \to x$ is equal to the top filter on $\alpha$.
Filter.map_const theorem
[NeBot f] {c : β} : (f.map fun _ => c) = pure c
Full source
theorem map_const [NeBot f] {c : β} : (f.map fun _ => c) = pure c := by
  ext s
  by_cases h : c ∈ s <;> simp [h]
Image Filter of a Constant Function is Principal Filter
Informal description
For any non-trivial filter $f$ on a type $\alpha$ and any constant function $\lambda \_ \mapsto c$ from $\alpha$ to $\beta$, the image filter of $f$ under this constant function is equal to the principal filter generated by $c$, i.e., $(\text{map } (\lambda \_ \mapsto c) f) = \text{pure } c$.
Filter.comap_comap theorem
{m : γ → β} {n : β → α} : comap m (comap n f) = comap (n ∘ m) f
Full source
theorem comap_comap {m : γ → β} {n : β → α} : comap m (comap n f) = comap (n ∘ m) f :=
  Filter.coext fun s => by simp only [compl_mem_comap, image_image, (· ∘ ·)]
Composition Law for Preimage Filters: $\text{comap}_m \circ \text{comap}_n = \text{comap}_{n \circ m}$
Informal description
For any functions $m \colon \gamma \to \beta$ and $n \colon \beta \to \alpha$, and any filter $f$ on $\alpha$, the preimage filter of the preimage filter of $f$ under $n$ under $m$ is equal to the preimage filter of $f$ under the composition $n \circ m$. In symbols: $$\text{comap}_m (\text{comap}_n f) = \text{comap}_{n \circ m} f.$$
Filter.map_comm theorem
(H : ψ ∘ φ = ρ ∘ θ) (F : Filter α) : map ψ (map φ F) = map ρ (map θ F)
Full source
theorem map_comm (H : ψ ∘ φ = ρ ∘ θ) (F : Filter α) :
    map ψ (map φ F) = map ρ (map θ F) := by
  rw [Filter.map_map, H, ← Filter.map_map]
Commutativity of Filter Maps under Function Composition
Informal description
Given functions $\varphi \colon \alpha \to \beta$, $\psi \colon \beta \to \delta$, $\theta \colon \gamma \to \delta$, and $\rho \colon \gamma \to \beta$ such that $\psi \circ \varphi = \rho \circ \theta$, and given a filter $F$ on $\alpha$, the following equality holds: \[ \text{map}_{\psi} (\text{map}_{\varphi} F) = \text{map}_{\rho} (\text{map}_{\theta} F) \] where $\text{map}$ denotes the filter image operation.
Filter.comap_comm theorem
(H : ψ ∘ φ = ρ ∘ θ) (G : Filter δ) : comap φ (comap ψ G) = comap θ (comap ρ G)
Full source
theorem comap_comm (H : ψ ∘ φ = ρ ∘ θ) (G : Filter δ) :
    comap φ (comap ψ G) = comap θ (comap ρ G) := by
  rw [Filter.comap_comap, H, ← Filter.comap_comap]
Commutativity of Preimage Filters under Function Composition
Informal description
Given functions $\varphi \colon \alpha \to \beta$, $\psi \colon \beta \to \delta$, $\theta \colon \gamma \to \delta$, and $\rho \colon \gamma \to \beta$ such that $\psi \circ \varphi = \rho \circ \theta$, and given a filter $G$ on $\delta$, the following equality holds: \[ \text{comap}_{\varphi} (\text{comap}_{\psi} G) = \text{comap}_{\theta} (\text{comap}_{\rho} G) \] where $\text{comap}$ denotes the preimage filter operation.
Function.Semiconj.filter_map theorem
{f : α → β} {ga : α → α} {gb : β → β} (h : Function.Semiconj f ga gb) : Function.Semiconj (map f) (map ga) (map gb)
Full source
theorem _root_.Function.Semiconj.filter_map {f : α → β} {ga : α → α} {gb : β → β}
    (h : Function.Semiconj f ga gb) : Function.Semiconj (map f) (map ga) (map gb) :=
  map_comm h.comp_eq
Semiconjugation of Filter Maps under Function Semiconjugation
Informal description
Let $f \colon \alpha \to \beta$ be a function that semiconjugates functions $g_a \colon \alpha \to \alpha$ and $g_b \colon \beta \to \beta$, meaning that $f \circ g_a = g_b \circ f$. Then the filter map operations induced by these functions also satisfy the semiconjugation relation: \[ \text{map}_f \circ \text{map}_{g_a} = \text{map}_{g_b} \circ \text{map}_f \] where $\text{map}_f$ denotes the filter image operation under $f$.
Function.Commute.filter_map theorem
{f g : α → α} (h : Function.Commute f g) : Function.Commute (map f) (map g)
Full source
theorem _root_.Function.Commute.filter_map {f g : α → α} (h : Function.Commute f g) :
    Function.Commute (map f) (map g) :=
  h.semiconj.filter_map
Commutation of Filter Maps under Commuting Functions
Informal description
Let $f, g \colon \alpha \to \alpha$ be commuting functions (i.e., $f \circ g = g \circ f$). Then the induced filter map operations $\text{map}_f$ and $\text{map}_g$ also commute, meaning that $\text{map}_f \circ \text{map}_g = \text{map}_g \circ \text{map}_f$.
Function.Semiconj.filter_comap theorem
{f : α → β} {ga : α → α} {gb : β → β} (h : Function.Semiconj f ga gb) : Function.Semiconj (comap f) (comap gb) (comap ga)
Full source
theorem _root_.Function.Semiconj.filter_comap {f : α → β} {ga : α → α} {gb : β → β}
    (h : Function.Semiconj f ga gb) : Function.Semiconj (comap f) (comap gb) (comap ga) :=
  comap_comm h.comp_eq.symm
Semiconjugation of Filter Preimages under Function Semiconjugation
Informal description
Let $f \colon \alpha \to \beta$ be a function that semiconjugates functions $g_a \colon \alpha \to \alpha$ and $g_b \colon \beta \to \beta$, meaning that $f \circ g_a = g_b \circ f$. Then the filter preimage operations induced by these functions satisfy the semiconjugation relation: \[ \text{comap}_f \circ \text{comap}_{g_b} = \text{comap}_{g_a} \circ \text{comap}_f \] where $\text{comap}_f$ denotes the filter preimage operation under $f$.
Function.Commute.filter_comap theorem
{f g : α → α} (h : Function.Commute f g) : Function.Commute (comap f) (comap g)
Full source
theorem _root_.Function.Commute.filter_comap {f g : α → α} (h : Function.Commute f g) :
    Function.Commute (comap f) (comap g) :=
  h.semiconj.filter_comap
Commutation of Filter Preimages under Commuting Functions
Informal description
Let $f, g \colon \alpha \to \alpha$ be commuting functions (i.e., $f \circ g = g \circ f$). Then the induced filter preimage operations $\text{comap}_f$ and $\text{comap}_g$ also commute, meaning that $\text{comap}_f \circ \text{comap}_g = \text{comap}_g \circ \text{comap}_f$.
Function.LeftInverse.filter_map theorem
{f : α → β} {g : β → α} (hfg : LeftInverse g f) : LeftInverse (map g) (map f)
Full source
theorem _root_.Function.LeftInverse.filter_map {f : α → β} {g : β → α} (hfg : LeftInverse g f) :
    LeftInverse (map g) (map f) := fun F ↦ by
  rw [map_map, hfg.comp_eq_id, map_id]
Filter Map Preserves Left Inverse Property
Informal description
Let $f \colon \alpha \to \beta$ and $g \colon \beta \to \alpha$ be functions such that $g$ is a left inverse of $f$, i.e., $g \circ f = \text{id}_\alpha$. Then the filter map operation satisfies the left inverse property: \[ \text{map}_g \circ \text{map}_f = \text{id} \] where $\text{map}_f$ denotes the filter image operation under $f$.
Function.LeftInverse.filter_comap theorem
{f : α → β} {g : β → α} (hfg : LeftInverse g f) : RightInverse (comap g) (comap f)
Full source
theorem _root_.Function.LeftInverse.filter_comap {f : α → β} {g : β → α} (hfg : LeftInverse g f) :
    RightInverse (comap g) (comap f) := fun F ↦ by
  rw [comap_comap, hfg.comp_eq_id, comap_id]
Preimage Filter Preserves Left Inverse Property: $\text{comap}_g \circ \text{comap}_f = \text{id}$
Informal description
Let $f \colon \alpha \to \beta$ and $g \colon \beta \to \alpha$ be functions such that $g$ is a left inverse of $f$, i.e., $g \circ f = \text{id}_\alpha$. Then the filter comap operation satisfies the right inverse property: \[ \text{comap}_g \circ \text{comap}_f = \text{id} \] where $\text{comap}_f$ denotes the preimage filter operation under $f$.
Function.RightInverse.filter_map theorem
{f : α → β} {g : β → α} (hfg : RightInverse g f) : RightInverse (map g) (map f)
Full source
nonrec theorem _root_.Function.RightInverse.filter_map {f : α → β} {g : β → α}
    (hfg : RightInverse g f) : RightInverse (map g) (map f) :=
  hfg.filter_map
Filter Map Preserves Right Inverse Property
Informal description
Let $f \colon \alpha \to \beta$ and $g \colon \beta \to \alpha$ be functions such that $g$ is a right inverse of $f$, i.e., $f \circ g = \text{id}_\beta$. Then the filter map operation satisfies the right inverse property: \[ \text{map}_f \circ \text{map}_g = \text{id} \] where $\text{map}_f$ denotes the filter image operation under $f$.
Function.RightInverse.filter_comap theorem
{f : α → β} {g : β → α} (hfg : RightInverse g f) : LeftInverse (comap g) (comap f)
Full source
nonrec theorem _root_.Function.RightInverse.filter_comap {f : α → β} {g : β → α}
    (hfg : RightInverse g f) : LeftInverse (comap g) (comap f) :=
  hfg.filter_comap
Preimage Filter Preserves Right Inverse Property: $\text{comap}_f \circ \text{comap}_g = \text{id}$
Informal description
Let $f \colon \alpha \to \beta$ and $g \colon \beta \to \alpha$ be functions such that $g$ is a right inverse of $f$, i.e., $f \circ g = \text{id}_\beta$. Then the filter comap operation satisfies the left inverse property: \[ \text{comap}_f \circ \text{comap}_g = \text{id} \] where $\text{comap}_f$ denotes the preimage filter operation under $f$.
Set.LeftInvOn.filter_map_Iic theorem
{f : α → β} {g : β → α} (hfg : LeftInvOn g f s) : LeftInvOn (map g) (map f) (Iic <| 𝓟 s)
Full source
theorem _root_.Set.LeftInvOn.filter_map_Iic {f : α → β} {g : β → α} (hfg : LeftInvOn g f s) :
    LeftInvOn (map g) (map f) (Iic <| 𝓟 s) := fun F (hF : F ≤ 𝓟 s) ↦ by
  have : (g ∘ f) =ᶠ[𝓟 s] id := by simpa only [eventuallyEq_principal] using hfg
  rw [map_map, map_congr (this.filter_mono hF), map_id]
Left Inverse Property of Filter Maps on Principal Filters
Informal description
Let $f \colon \alpha \to \beta$ and $g \colon \beta \to \alpha$ be functions such that $g$ is a left inverse of $f$ on a set $s \subseteq \alpha$, i.e., $g(f(x)) = x$ for all $x \in s$. Then, the filter map operations $\text{map}_g$ and $\text{map}_f$ satisfy the left inverse property on the principal filter generated by $s$ and all filters contained in it. Specifically, for any filter $l \leq \mathfrak{P}(s)$ (where $\mathfrak{P}(s)$ denotes the principal filter generated by $s$), we have $\text{map}_g \circ \text{map}_f$ acting as the identity on $l$.
Set.RightInvOn.filter_map_Iic theorem
{f : α → β} {g : β → α} (hfg : RightInvOn g f t) : RightInvOn (map g) (map f) (Iic <| 𝓟 t)
Full source
nonrec theorem _root_.Set.RightInvOn.filter_map_Iic {f : α → β} {g : β → α}
    (hfg : RightInvOn g f t) : RightInvOn (map g) (map f) (Iic <| 𝓟 t) :=
  hfg.filter_map_Iic
Right Inverse Property of Filter Maps on Principal Filters
Informal description
Let $f \colon \alpha \to \beta$ and $g \colon \beta \to \alpha$ be functions such that $g$ is a right inverse of $f$ on a set $t \subseteq \beta$, i.e., $f(g(y)) = y$ for all $y \in t$. Then, the filter map operations $\text{map}_g$ and $\text{map}_f$ satisfy the right inverse property on the principal filter generated by $t$ and all filters contained in it. Specifically, for any filter $l \leq \mathfrak{P}(t)$ (where $\mathfrak{P}(t)$ denotes the principal filter generated by $t$), we have $\text{map}_f \circ \text{map}_g$ acting as the identity on $l$.
Filter.kernMap definition
(m : α → β) (f : Filter α) : Filter β
Full source
/-- The analog of `kernImage` for filters. A set `s` belongs to `Filter.kernMap m f` if either of
the following equivalent conditions hold.

1. There exists a set `t ∈ f` such that `s = kernImage m t`. This is used as a definition.
2. There exists a set `t` such that `tᶜ ∈ f` and `sᶜ = m '' t`, see `Filter.mem_kernMap_iff_compl`
and `Filter.compl_mem_kernMap`.

This definition because it gives a right adjoint to `Filter.comap`, and because it has a nice
interpretation when working with `co-` filters (`Filter.cocompact`, `Filter.cofinite`, ...).
For example, `kernMap m (cocompact α)` is the filter generated by the complements of the sets
`m '' K` where `K` is a compact subset of `α`. -/
def kernMap (m : α → β) (f : Filter α) : Filter β where
  sets := (kernImage m) '' f.sets
  univ_sets := ⟨univ, f.univ_sets, by simp [kernImage_eq_compl]⟩
  sets_of_superset := by
    rintro _ t ⟨s, hs, rfl⟩ hst
    refine ⟨s ∪ m ⁻¹' t, mem_of_superset hs subset_union_left, ?_⟩
    rw [kernImage_union_preimage, union_eq_right.mpr hst]
  inter_sets := by
    rintro _ _ ⟨s₁, h₁, rfl⟩ ⟨s₂, h₂, rfl⟩
    exact ⟨s₁ ∩ s₂, f.inter_sets h₁ h₂, Set.preimage_kernImage.u_inf⟩
Kernel Map Filter
Informal description
Given a function $m : \alpha \to \beta$ and a filter $f$ on $\alpha$, the filter $\text{kernMap}(m, f)$ on $\beta$ is defined as the collection of all subsets $s \subseteq \beta$ such that there exists a subset $t \in f$ with $s = \text{kernImage}(m, t)$. Here, $\text{kernImage}(m, t)$ consists of all elements $y \in \beta$ for which the preimage $m^{-1}(\{y\})$ is entirely contained in $t$. Equivalently, a subset $s \subseteq \beta$ belongs to $\text{kernMap}(m, f)$ if and only if there exists a subset $t \subseteq \alpha$ such that the complement $t^c$ is in $f$ and the image $m(t)$ is equal to the complement $s^c$. This construction serves as a right adjoint to the `Filter.comap` operation and has useful interpretations when working with co-filters (such as the cocompact or cofinite filters). For example, $\text{kernMap}(m, \text{cocompact}(\alpha))$ is the filter generated by the complements of the images $m(K)$ where $K$ is a compact subset of $\alpha$.
Filter.mem_kernMap theorem
{s : Set β} : s ∈ kernMap m f ↔ ∃ t ∈ f, kernImage m t = s
Full source
theorem mem_kernMap {s : Set β} : s ∈ kernMap m fs ∈ kernMap m f ↔ ∃ t ∈ f, kernImage m t = s :=
  Iff.rfl
Characterization of Membership in Kernel Map Filter
Informal description
For any subset $s \subseteq \beta$, $s$ belongs to the kernel map filter $\text{kernMap}(m, f)$ if and only if there exists a subset $t \in f$ such that $s$ is the kernel image of $m$ with respect to $t$, i.e., $s = \{y \in \beta \mid m^{-1}(\{y\}) \subseteq t\}$.
Filter.mem_kernMap_iff_compl theorem
{s : Set β} : s ∈ kernMap m f ↔ ∃ t, tᶜ ∈ f ∧ m '' t = sᶜ
Full source
theorem mem_kernMap_iff_compl {s : Set β} : s ∈ kernMap m fs ∈ kernMap m f ↔ ∃ t, tᶜ ∈ f ∧ m '' t = sᶜ := by
  rw [mem_kernMap, compl_surjective.exists]
  refine exists_congr (fun x ↦ and_congr_right fun _ ↦ ?_)
  rw [kernImage_compl, compl_eq_comm, eq_comm]
Characterization of Kernel Map Membership via Complements: $s \in \text{kernMap}(m, f) \leftrightarrow \exists t, t^\complement \in f \land m(t) = s^\complement$
Informal description
For any subset $s \subseteq \beta$, $s$ belongs to the kernel map filter $\text{kernMap}(m, f)$ if and only if there exists a subset $t \subseteq \alpha$ such that the complement $t^\complement$ is in $f$ and the image $m(t)$ equals the complement $s^\complement$.
Filter.compl_mem_kernMap theorem
{s : Set β} : sᶜ ∈ kernMap m f ↔ ∃ t, tᶜ ∈ f ∧ m '' t = s
Full source
theorem compl_mem_kernMap {s : Set β} : sᶜsᶜ ∈ kernMap m fsᶜ ∈ kernMap m f ↔ ∃ t, tᶜ ∈ f ∧ m '' t = s := by
  simp_rw [mem_kernMap_iff_compl, compl_compl]
Complement Membership in Kernel Map Filter: $s^\complement \in \text{kernMap}(m, f) \leftrightarrow \exists t, t^\complement \in f \land m(t) = s$
Informal description
For any subset $s \subseteq \beta$, the complement $s^\complement$ belongs to the kernel map filter $\text{kernMap}(m, f)$ if and only if there exists a subset $t \subseteq \alpha$ such that the complement $t^\complement$ is in $f$ and the image $m(t)$ equals $s$.
Filter.comap_le_iff_le_kernMap theorem
: comap m g ≤ f ↔ g ≤ kernMap m f
Full source
theorem comap_le_iff_le_kernMap : comapcomap m g ≤ f ↔ g ≤ kernMap m f := by
  simp [Filter.le_def, mem_comap'', mem_kernMap, -mem_comap]
Galois Connection Between Preimage and Kernel Map Filters
Informal description
For any function $m : \alpha \to \beta$ and filters $f$ on $\alpha$ and $g$ on $\beta$, the preimage filter $\text{comap } m g$ is less than or equal to $f$ if and only if $g$ is less than or equal to the kernel map filter $\text{kernMap } m f$.
Filter.gc_comap_kernMap theorem
(m : α → β) : GaloisConnection (comap m) (kernMap m)
Full source
theorem gc_comap_kernMap (m : α → β) : GaloisConnection (comap m) (kernMap m) :=
  fun _ _ ↦ comap_le_iff_le_kernMap
Galois Connection Between Preimage and Kernel Map Filters
Informal description
For any function $m : \alpha \to \beta$, the operations $\text{comap } m$ and $\text{kernMap } m$ form a Galois connection between the filters on $\beta$ and the filters on $\alpha$. Specifically, for any filters $f$ on $\alpha$ and $g$ on $\beta$, we have $\text{comap } m g \leq f$ if and only if $g \leq \text{kernMap } m f$.
Filter.kernMap_principal theorem
{s : Set α} : kernMap m (𝓟 s) = 𝓟 (kernImage m s)
Full source
theorem kernMap_principal {s : Set α} : kernMap m (𝓟 s) = 𝓟 (kernImage m s) := by
  refine eq_of_forall_le_iff (fun g ↦ ?_)
  rw [← comap_le_iff_le_kernMap, le_principal_iff, le_principal_iff, mem_comap'']
Kernel Map of Principal Filter Equals Principal Filter of Kernel Image
Informal description
For any function $m : \alpha \to \beta$ and any subset $s \subseteq \alpha$, the kernel map filter of the principal filter generated by $s$ under $m$ is equal to the principal filter generated by the kernel image of $s$ under $m$. In symbols: $$\text{kernMap}(m, \mathcal{P}(s)) = \mathcal{P}(\text{kernImage}(m, s))$$ where $\text{kernImage}(m, s) = \{y \in \beta \mid \forall x \in \alpha, m(x) = y \implies x \in s\}$.
Filter.comap_principal theorem
{t : Set β} : comap m (𝓟 t) = 𝓟 (m ⁻¹' t)
Full source
@[simp]
theorem comap_principal {t : Set β} : comap m (𝓟 t) = 𝓟 (m ⁻¹' t) :=
  Filter.ext fun _ => ⟨fun ⟨_u, hu, b⟩ => (preimage_mono hu).trans b,
    fun h => ⟨t, Subset.rfl, h⟩⟩
Preimage of Principal Filter Equals Principal Filter of Preimage
Informal description
For any function $m : \alpha \to \beta$ and any subset $t \subseteq \beta$, the preimage filter of the principal filter generated by $t$ under $m$ is equal to the principal filter generated by the preimage $m^{-1}(t)$. In symbols: $$\text{comap } m (\mathcal{P}(t)) = \mathcal{P}(m^{-1}(t))$$
Filter.principal_subtype theorem
{α : Type*} (s : Set α) (t : Set s) : 𝓟 t = comap (↑) (𝓟 (((↑) : s → α) '' t))
Full source
theorem principal_subtype {α : Type*} (s : Set α) (t : Set s) :
    𝓟 t = comap (↑) (𝓟 (((↑) : s → α) '' t)) := by
  rw [comap_principal, preimage_image_eq _ Subtype.coe_injective]
Principal Filter Equality for Subtype: $\mathcal{P}(t) = \text{comap } (\uparrow) (\mathcal{P}(\uparrow(t)))$
Informal description
For any set $s$ in a type $\alpha$ and any subset $t$ of $s$, the principal filter generated by $t$ is equal to the preimage filter of the principal filter generated by the image of $t$ under the canonical inclusion map from $s$ to $\alpha$. In symbols: $$\mathcal{P}(t) = \text{comap } (\uparrow) (\mathcal{P}(\uparrow(t)))$$ where $\uparrow : s \to \alpha$ denotes the canonical inclusion map.
Filter.comap_pure theorem
{b : β} : comap m (pure b) = 𝓟 (m ⁻¹' { b })
Full source
@[simp]
theorem comap_pure {b : β} : comap m (pure b) = 𝓟 (m ⁻¹' {b}) := by
  rw [← principal_singleton, comap_principal]
Preimage of Pure Filter Equals Principal Filter of Preimage Singleton
Informal description
For any function $m : \alpha \to \beta$ and any element $b \in \beta$, the preimage filter of the pure filter at $b$ under $m$ is equal to the principal filter generated by the preimage $m^{-1}(\{b\})$. In symbols: $$\text{comap } m (\text{pure } b) = \mathcal{P}(m^{-1}(\{b\}))$$
Filter.map_le_iff_le_comap theorem
: map m f ≤ g ↔ f ≤ comap m g
Full source
theorem map_le_iff_le_comap : mapmap m f ≤ g ↔ f ≤ comap m g :=
  ⟨fun h _ ⟨_, ht, hts⟩ => mem_of_superset (h ht) hts, fun h _ ht => h ⟨_, ht, Subset.rfl⟩⟩
Image Filter vs Preimage Filter Inequality: $\text{map } m f \leq g \leftrightarrow f \leq \text{comap } m g$
Informal description
For any function $m : \alpha \to \beta$ and filters $f$ on $\alpha$, $g$ on $\beta$, the image filter $\text{map } m f$ is less than or equal to $g$ if and only if $f$ is less than or equal to the preimage filter $\text{comap } m g$.
Filter.gc_map_comap theorem
(m : α → β) : GaloisConnection (map m) (comap m)
Full source
theorem gc_map_comap (m : α → β) : GaloisConnection (map m) (comap m) :=
  fun _ _ => map_le_iff_le_comap
Galois Connection Between Image and Preimage Filters
Informal description
For any function $m : \alpha \to \beta$, the pair of functions $\text{map } m$ and $\text{comap } m$ forms a Galois connection between the partially ordered sets of filters on $\alpha$ and $\beta$. That is, for any filter $f$ on $\alpha$ and any filter $g$ on $\beta$, we have $\text{map } m f \leq g$ if and only if $f \leq \text{comap } m g$.
Filter.map_mono theorem
: Monotone (map m)
Full source
@[mono]
theorem map_mono : Monotone (map m) :=
  (gc_map_comap m).monotone_l
Monotonicity of Filter Mapping
Informal description
For any function $m : \alpha \to \beta$, the map operation on filters $\text{map } m$ is monotone. That is, for any two filters $F$ and $G$ on $\alpha$, if $F \leq G$, then $\text{map } m F \leq \text{map } m G$.
Filter.comap_mono theorem
: Monotone (comap m)
Full source
@[mono]
theorem comap_mono : Monotone (comap m) :=
  (gc_map_comap m).monotone_u
Monotonicity of Preimage Filter Operation
Informal description
For any function $m : \alpha \to \beta$, the preimage filter operation $\text{comap } m$ is monotone. That is, for any two filters $F$ and $G$ on $\beta$, if $F \leq G$ (meaning every set in $G$ is in $F$), then $\text{comap } m F \leq \text{comap } m G$.
GCongr.Filter.map_le_map theorem
{F G : Filter α} (h : F ≤ G) : map m F ≤ map m G
Full source
/-- Temporary lemma that we can tag with `gcongr` -/
@[gcongr] theorem _root_.GCongr.Filter.map_le_map {F G : Filter α} (h : F ≤ G) :
    map m F ≤ map m G := map_mono h
Monotonicity of Filter Mapping: $F \leq G \Rightarrow \text{map } m F \leq \text{map } m G$
Informal description
For any function $m : \alpha \to \beta$ and filters $F, G$ on $\alpha$, if $F \leq G$ (i.e., $G \subseteq F$), then the image filters satisfy $\text{map } m F \leq \text{map } m G$.
GCongr.Filter.comap_le_comap theorem
{F G : Filter β} (h : F ≤ G) : comap m F ≤ comap m G
Full source
/-- Temporary lemma that we can tag with `gcongr` -/
@[gcongr]
theorem _root_.GCongr.Filter.comap_le_comap {F G : Filter β} (h : F ≤ G) :
    comap m F ≤ comap m G := comap_mono h
Monotonicity of Filter Preimage Operation: $\text{comap } m F \leq \text{comap } m G$ when $F \leq G$
Informal description
For any function $m : \alpha \to \beta$ and filters $F, G$ on $\beta$, if $F \leq G$, then the preimage filter $\text{comap } m F$ is less than or equal to $\text{comap } m G$.
Filter.map_bot theorem
: map m ⊥ = ⊥
Full source
@[simp] theorem map_bot : map m  =  := (gc_map_comap m).l_bot
Image of Bottom Filter is Bottom
Informal description
For any function $m : \alpha \to \beta$, the image filter of the bottom filter $\bot$ under $m$ is equal to the bottom filter on $\beta$, i.e., $\text{map } m \bot = \bot$.
Filter.map_sup theorem
: map m (f₁ ⊔ f₂) = map m f₁ ⊔ map m f₂
Full source
@[simp] theorem map_sup : map m (f₁ ⊔ f₂) = mapmap m f₁ ⊔ map m f₂ := (gc_map_comap m).l_sup
Image Filter Preserves Suprema: $\text{map } m (f_1 \sqcup f_2) = \text{map } m f_1 \sqcup \text{map } m f_2$
Informal description
For any function $m : \alpha \to \beta$ and filters $f_1, f_2$ on $\alpha$, the image filter of the supremum $f_1 \sqcup f_2$ under $m$ is equal to the supremum of the image filters of $f_1$ and $f_2$ under $m$, i.e., $$\text{map } m (f_1 \sqcup f_2) = \text{map } m f_1 \sqcup \text{map } m f_2.$$
Filter.map_iSup theorem
{f : ι → Filter α} : map m (⨆ i, f i) = ⨆ i, map m (f i)
Full source
@[simp]
theorem map_iSup {f : ι → Filter α} : map m (⨆ i, f i) = ⨆ i, map m (f i) :=
  (gc_map_comap m).l_iSup
Image Filter Preserves Indexed Suprema
Informal description
For any function $m : \alpha \to \beta$ and any family of filters $\{f_i\}_{i \in \iota}$ on $\alpha$, the image filter of the supremum of the family under $m$ is equal to the supremum of the image filters: \[ \text{map } m \left( \bigsqcup_{i \in \iota} f_i \right) = \bigsqcup_{i \in \iota} \text{map } m (f_i). \]
Filter.map_top theorem
(f : α → β) : map f ⊤ = 𝓟 (range f)
Full source
@[simp]
theorem map_top (f : α → β) : map f  = 𝓟 (range f) := by
  rw [← principal_univ, map_principal, image_univ]
Image of Top Filter Equals Principal Filter of Range
Informal description
For any function $f : \alpha \to \beta$, the image filter of the top filter $\top$ on $\alpha$ under $f$ is equal to the principal filter generated by the range of $f$. In symbols: \[ \text{map } f \top = \mathcal{P}(\text{range}(f)). \]
Filter.comap_top theorem
: comap m ⊤ = ⊤
Full source
@[simp] theorem comap_top : comap m  =  := (gc_map_comap m).u_top
Preimage of Top Filter is Top Filter
Informal description
For any function $m : \alpha \to \beta$, the preimage filter of the top filter on $\beta$ under $m$ is equal to the top filter on $\alpha$, i.e., $\text{comap } m \top = \top$.
Filter.comap_inf theorem
: comap m (g₁ ⊓ g₂) = comap m g₁ ⊓ comap m g₂
Full source
@[simp] theorem comap_inf : comap m (g₁ ⊓ g₂) = comapcomap m g₁ ⊓ comap m g₂ := (gc_map_comap m).u_inf
Preimage Filter Preserves Infima: $\text{comap } m (g_1 \sqcap g_2) = \text{comap } m g_1 \sqcap \text{comap } m g_2$
Informal description
For any function $m : \alpha \to \beta$ and any two filters $g_1$ and $g_2$ on $\beta$, the preimage filter of their infimum equals the infimum of their preimage filters, i.e., \[ \text{comap } m (g_1 \sqcap g_2) = \text{comap } m g_1 \sqcap \text{comap } m g_2. \]
Filter.comap_iInf theorem
{f : ι → Filter β} : comap m (⨅ i, f i) = ⨅ i, comap m (f i)
Full source
@[simp]
theorem comap_iInf {f : ι → Filter β} : comap m (⨅ i, f i) = ⨅ i, comap m (f i) :=
  (gc_map_comap m).u_iInf
Preimage Filter Preserves Infima: $\text{comap } m (\bigsqcap_i f_i) = \bigsqcap_i \text{comap } m (f_i)$
Informal description
For any function $m : \alpha \to \beta$ and any family of filters $\{f_i\}_{i \in \iota}$ on $\beta$, the preimage filter of the infimum of the family equals the infimum of the preimage filters: \[ \text{comap } m \left(\bigsqcap_i f_i\right) = \bigsqcap_i \text{comap } m (f_i). \]
Filter.le_comap_top theorem
(f : α → β) (l : Filter α) : l ≤ comap f ⊤
Full source
theorem le_comap_top (f : α → β) (l : Filter α) : l ≤ comap f  := by
  rw [comap_top]
  exact le_top
Inclusion of Any Filter in Preimage of Top Filter
Informal description
For any function $f : \alpha \to \beta$ and any filter $l$ on $\alpha$, the filter $l$ is contained in the preimage filter of the top filter on $\beta$ under $f$, i.e., $l \leq \text{comap } f \top$.
Filter.map_comap_le theorem
: map m (comap m g) ≤ g
Full source
theorem map_comap_le : map m (comap m g) ≤ g :=
  (gc_map_comap m).l_u_le _
Image of Preimage Filter is Smaller Than Original Filter
Informal description
For any function $m : \alpha \to \beta$ and any filter $g$ on $\beta$, the image filter of the preimage filter satisfies $\text{map } m (\text{comap } m g) \leq g$.
Filter.le_comap_map theorem
: f ≤ comap m (map m f)
Full source
theorem le_comap_map : f ≤ comap m (map m f) :=
  (gc_map_comap m).le_u_l _
Inclusion of Filter in Preimage of its Image Filter
Informal description
For any filter $f$ on a type $\alpha$ and any function $m : \alpha \to \beta$, the filter $f$ is contained in the preimage filter $\text{comap } m (\text{map } m f)$. In other words, every set in $\text{map } m f$ has a preimage under $m$ that belongs to $f$.
Filter.neBot_of_comap theorem
(h : (comap m g).NeBot) : g.NeBot
Full source
theorem neBot_of_comap (h : (comap m g).NeBot) : g.NeBot := by
  rw [neBot_iff] at *
  contrapose! h
  rw [h]
  exact comap_bot
Non-triviality of filter preserved under preimage
Informal description
If the preimage filter $\text{comap } m g$ on $\alpha$ is non-trivial, then the filter $g$ on $\beta$ is also non-trivial.
Filter.comap_inf_principal_range theorem
: comap m (g ⊓ 𝓟 (range m)) = comap m g
Full source
theorem comap_inf_principal_range : comap m (g ⊓ 𝓟 (range m)) = comap m g := by
  simp
Preimage Filter of Infimum with Range Principal Filter Equals Preimage Filter
Informal description
For any function $m : \alpha \to \beta$ and any filter $g$ on $\beta$, the preimage filter of the infimum of $g$ with the principal filter generated by the range of $m$ is equal to the preimage filter of $g$ alone. In symbols: \[ \text{comap } m (g \sqcap \mathcal{P}(\text{range } m)) = \text{comap } m g \]
Filter.disjoint_comap theorem
(h : Disjoint g₁ g₂) : Disjoint (comap m g₁) (comap m g₂)
Full source
theorem disjoint_comap (h : Disjoint g₁ g₂) : Disjoint (comap m g₁) (comap m g₂) := by
  simp only [disjoint_iff, ← comap_inf, h.eq_bot, comap_bot]
Preimage Filter Preserves Disjointness: $\text{Disjoint } g_1 g_2 \to \text{Disjoint } (\text{comap } m g_1) (\text{comap } m g_2)$
Informal description
For any function $m : \alpha \to \beta$ and any two filters $g_1$ and $g_2$ on $\beta$, if $g_1$ and $g_2$ are disjoint, then their preimage filters $\text{comap } m g_1$ and $\text{comap } m g_2$ are also disjoint.
Filter.comap_iSup theorem
{ι} {f : ι → Filter β} {m : α → β} : comap m (iSup f) = ⨆ i, comap m (f i)
Full source
theorem comap_iSup {ι} {f : ι → Filter β} {m : α → β} : comap m (iSup f) = ⨆ i, comap m (f i) :=
  (gc_comap_kernMap m).l_iSup
Preimage Filter Preserves Suprema: $\text{comap } m (\bigsqcup_i f_i) = \bigsqcup_i \text{comap } m (f_i)$
Informal description
For any function $m : \alpha \to \beta$ and any family of filters $\{f_i\}_{i \in \iota}$ on $\beta$, the preimage filter of the supremum of the family equals the supremum of the preimage filters: \[ \text{comap } m \left( \bigsqcup_{i \in \iota} f_i \right) = \bigsqcup_{i \in \iota} \text{comap } m (f_i). \]
Filter.comap_sSup theorem
{s : Set (Filter β)} {m : α → β} : comap m (sSup s) = ⨆ f ∈ s, comap m f
Full source
theorem comap_sSup {s : Set (Filter β)} {m : α → β} : comap m (sSup s) = ⨆ f ∈ s, comap m f := by
  simp only [sSup_eq_iSup, comap_iSup, eq_self_iff_true]
Preimage Filter Preserves Suprema of Sets: $\text{comap } m (\bigvee s) = \bigsqcup_{f \in s} \text{comap } m f$
Informal description
For any set $s$ of filters on a type $\beta$ and any function $m : \alpha \to \beta$, the preimage filter of the supremum of $s$ is equal to the supremum of the preimage filters of all filters in $s$: \[ \text{comap } m \left( \bigvee s \right) = \bigsqcup_{f \in s} \text{comap } m f. \]
Filter.comap_sup theorem
: comap m (g₁ ⊔ g₂) = comap m g₁ ⊔ comap m g₂
Full source
theorem comap_sup : comap m (g₁ ⊔ g₂) = comapcomap m g₁ ⊔ comap m g₂ := by
  rw [sup_eq_iSup, comap_iSup, iSup_bool_eq, Bool.cond_true, Bool.cond_false]
Preimage Filter Preserves Suprema of Two Filters: $\text{comap } m (g_1 \sqcup g_2) = \text{comap } m g_1 \sqcup \text{comap } m g_2$
Informal description
For any function $m : \alpha \to \beta$ and any two filters $g_1$ and $g_2$ on $\beta$, the preimage filter of the supremum of $g_1$ and $g_2$ is equal to the supremum of their preimage filters: \[ \text{comap } m (g_1 \sqcup g_2) = \text{comap } m g_1 \sqcup \text{comap } m g_2. \]
Filter.map_comap theorem
(f : Filter β) (m : α → β) : (f.comap m).map m = f ⊓ 𝓟 (range m)
Full source
theorem map_comap (f : Filter β) (m : α → β) : (f.comap m).map m = f ⊓ 𝓟 (range m) := by
  refine le_antisymm (le_inf map_comap_le <| le_principal_iff.2 range_mem_map) ?_
  rintro t' ⟨t, ht, sub⟩
  refine mem_inf_principal.2 (mem_of_superset ht ?_)
  rintro _ hxt ⟨x, rfl⟩
  exact sub hxt
Image-Preimage Filter Composition Equals Intersection with Range Principal Filter
Informal description
For any filter $f$ on a type $\beta$ and any function $m : \alpha \to \beta$, the composition of the preimage filter followed by the image filter satisfies: \[ \text{map } m (\text{comap } m f) = f \sqcap \mathfrak{P}(\text{range } m) \] where $\mathfrak{P}(\text{range } m)$ denotes the principal filter generated by the range of $m$.
Filter.map_comap_setCoe_val theorem
(f : Filter β) (s : Set β) : (f.comap ((↑) : s → β)).map (↑) = f ⊓ 𝓟 s
Full source
theorem map_comap_setCoe_val (f : Filter β) (s : Set β) :
    (f.comap ((↑) : s → β)).map (↑) = f ⊓ 𝓟 s := by
  rw [map_comap, Subtype.range_val]
Image-Preimage Filter Composition for Subset Inclusion Equals Intersection with Principal Filter
Informal description
For any filter $f$ on a type $\beta$ and any subset $s \subseteq \beta$, the composition of the preimage filter under the canonical inclusion map $(↑) : s \to \beta$ followed by the image filter under the same map satisfies: \[ \text{map } (↑) (\text{comap } (↑) f) = f \sqcap \mathfrak{P}(s) \] where $\mathfrak{P}(s)$ denotes the principal filter generated by the subset $s$.
Filter.map_comap_of_mem theorem
{f : Filter β} {m : α → β} (hf : range m ∈ f) : (f.comap m).map m = f
Full source
theorem map_comap_of_mem {f : Filter β} {m : α → β} (hf : rangerange m ∈ f) : (f.comap m).map m = f := by
  rw [map_comap, inf_eq_left.2 (le_principal_iff.2 hf)]
Image-Preimage Filter Identity for Functions with Range in Filter
Informal description
For any filter $f$ on a type $\beta$ and any function $m : \alpha \to \beta$ such that the range of $m$ is in $f$, the composition of the preimage filter followed by the image filter equals $f$ itself, i.e., \[ \text{map } m (\text{comap } m f) = f. \]
Filter.canLift instance
(c) (p) [CanLift α β c p] : CanLift (Filter α) (Filter β) (map c) fun f => ∀ᶠ x : α in f, p x
Full source
instance canLift (c) (p) [CanLift α β c p] :
    CanLift (Filter α) (Filter β) (map c) fun f => ∀ᶠ x : α in f, p x where
  prf f hf := ⟨comap c f, map_comap_of_mem <| hf.mono CanLift.prf⟩
Lifting Filters via a Function with a Predicate Condition
Informal description
Given types $\alpha$ and $\beta$, a function $c : \beta \to \alpha$, and a predicate $p : \alpha \to \text{Prop}$ such that elements can be lifted from $\alpha$ to $\beta$ under $p$ via $c$, then filters on $\alpha$ can be lifted to filters on $\beta$ via the map operation $\text{map } c$, provided that for any filter $f$ on $\alpha$, the predicate $\forallᶠ x \text{ in } f, p x$ holds.
Filter.comap_le_comap_iff theorem
{f g : Filter β} {m : α → β} (hf : range m ∈ f) : comap m f ≤ comap m g ↔ f ≤ g
Full source
theorem comap_le_comap_iff {f g : Filter β} {m : α → β} (hf : rangerange m ∈ f) :
    comapcomap m f ≤ comap m g ↔ f ≤ g :=
  ⟨fun h => map_comap_of_mem hf ▸ (map_mono h).trans map_comap_le, fun h => comap_mono h⟩
Preimage Filter Order Comparison Criterion
Informal description
Let $m : \alpha \to \beta$ be a function and $f, g$ be filters on $\beta$ such that the range of $m$ is in $f$. Then the preimage filter $\text{comap } m f$ is less than or equal to $\text{comap } m g$ if and only if $f \leq g$.
Filter.map_comap_of_surjective theorem
{f : α → β} (hf : Surjective f) (l : Filter β) : map f (comap f l) = l
Full source
theorem map_comap_of_surjective {f : α → β} (hf : Surjective f) (l : Filter β) :
    map f (comap f l) = l :=
  map_comap_of_mem <| by simp only [hf.range_eq, univ_mem]
Image-Preimage Filter Identity for Surjective Functions
Informal description
For any surjective function $f : \alpha \to \beta$ and any filter $l$ on $\beta$, the image filter of the preimage filter of $l$ under $f$ equals $l$ itself, i.e., \[ \text{map } f (\text{comap } f l) = l. \]
Filter.comap_injective theorem
{f : α → β} (hf : Surjective f) : Injective (comap f)
Full source
theorem comap_injective {f : α → β} (hf : Surjective f) : Injective (comap f) :=
  LeftInverse.injective <| map_comap_of_surjective hf
Injectivity of Preimage Filter for Surjective Functions
Informal description
For any surjective function $f : \alpha \to \beta$, the preimage filter operation $\text{comap } f$ is injective. That is, for any two filters $g_1, g_2$ on $\beta$, if $\text{comap } f g_1 = \text{comap } f g_2$, then $g_1 = g_2$.
Function.Surjective.filter_map_top theorem
{f : α → β} (hf : Surjective f) : map f ⊤ = ⊤
Full source
theorem _root_.Function.Surjective.filter_map_top {f : α → β} (hf : Surjective f) : map f  =  :=
  (congr_arg _ comap_top).symm.trans <| map_comap_of_surjective hf 
Image of Top Filter under Surjective Function is Top Filter
Informal description
For any surjective function $f : \alpha \to \beta$, the image filter of the top filter on $\alpha$ under $f$ is equal to the top filter on $\beta$, i.e., \[ \text{map } f \top = \top. \]
Filter.subtype_coe_map_comap theorem
(s : Set α) (f : Filter α) : map ((↑) : s → α) (comap ((↑) : s → α) f) = f ⊓ 𝓟 s
Full source
theorem subtype_coe_map_comap (s : Set α) (f : Filter α) :
    map ((↑) : s → α) (comap ((↑) : s → α) f) = f ⊓ 𝓟 s := by rw [map_comap, Subtype.range_coe]
Image-Preimage Filter Composition for Subset Inclusion Equals Intersection with Principal Filter
Informal description
For any subset $s$ of a type $\alpha$ and any filter $f$ on $\alpha$, the image filter of the preimage filter under the canonical inclusion map $\uparrow : s \to \alpha$ is equal to the infimum of $f$ and the principal filter generated by $s$. In other words: \[ \text{map } \uparrow (\text{comap } \uparrow f) = f \sqcap \mathfrak{P}(s) \] where $\mathfrak{P}(s)$ denotes the principal filter generated by $s$.
Filter.image_mem_of_mem_comap theorem
{f : Filter α} {c : β → α} (h : range c ∈ f) {W : Set β} (W_in : W ∈ comap c f) : c '' W ∈ f
Full source
theorem image_mem_of_mem_comap {f : Filter α} {c : β → α} (h : rangerange c ∈ f) {W : Set β}
    (W_in : W ∈ comap c f) : c '' Wc '' W ∈ f := by
  rw [← map_comap_of_mem h]
  exact image_mem_map W_in
Image of a Set in Preimage Filter Belongs to Original Filter When Range is in Filter
Informal description
Let $f$ be a filter on a type $\alpha$, and let $c : \beta \to \alpha$ be a function such that the range of $c$ belongs to $f$. For any subset $W \subseteq \beta$ that is in the preimage filter $\text{comap } c f$, the image $c(W)$ belongs to $f$.
Filter.image_coe_mem_of_mem_comap theorem
{f : Filter α} {U : Set α} (h : U ∈ f) {W : Set U} (W_in : W ∈ comap ((↑) : U → α) f) : (↑) '' W ∈ f
Full source
theorem image_coe_mem_of_mem_comap {f : Filter α} {U : Set α} (h : U ∈ f) {W : Set U}
    (W_in : W ∈ comap ((↑) : U → α) f) : (↑) '' W(↑) '' W ∈ f :=
  image_mem_of_mem_comap (by simp [h]) W_in
Image of Subset in Preimage Filter Belongs to Original Filter for Inclusion Map
Informal description
Let $f$ be a filter on a type $\alpha$, and let $U \subseteq \alpha$ be a set such that $U \in f$. For any subset $W \subseteq U$ that belongs to the preimage filter $\text{comap } \uparrow f$ (where $\uparrow : U \to \alpha$ is the canonical inclusion map), the image $\uparrow(W)$ belongs to $f$.
Filter.comap_map theorem
{f : Filter α} {m : α → β} (h : Injective m) : comap m (map m f) = f
Full source
theorem comap_map {f : Filter α} {m : α → β} (h : Injective m) : comap m (map m f) = f :=
  le_antisymm
    (fun s hs =>
      mem_of_superset (preimage_mem_comap <| image_mem_map hs) <| by
        simp only [preimage_image_eq s h, Subset.rfl])
    le_comap_map
Equality of Preimage of Image Filter for Injective Functions: $\text{comap } m (\text{map } m f) = f$
Informal description
For any filter $f$ on a type $\alpha$ and any injective function $m : \alpha \to \beta$, the preimage filter of the image filter $\text{map } m f$ under $m$ equals $f$ itself, i.e., $\text{comap } m (\text{map } m f) = f$.
Filter.mem_comap_iff theorem
{f : Filter β} {m : α → β} (inj : Injective m) (large : Set.range m ∈ f) {S : Set α} : S ∈ comap m f ↔ m '' S ∈ f
Full source
theorem mem_comap_iff {f : Filter β} {m : α → β} (inj : Injective m) (large : Set.rangeSet.range m ∈ f)
    {S : Set α} : S ∈ comap m fS ∈ comap m f ↔ m '' S ∈ f := by
  rw [← image_mem_map_iff inj, map_comap_of_mem large]
Membership in Preimage Filter via Image for Injective Functions: $S \in \text{comap } m f \leftrightarrow m(S) \in f$
Informal description
Let $f$ be a filter on a type $\beta$, and let $m : \alpha \to \beta$ be an injective function such that the range of $m$ belongs to $f$. For any subset $S \subseteq \alpha$, $S$ belongs to the preimage filter $\text{comap } m f$ if and only if the image $m(S)$ belongs to $f$.
Filter.map_le_map_iff_of_injOn theorem
{l₁ l₂ : Filter α} {f : α → β} {s : Set α} (h₁ : s ∈ l₁) (h₂ : s ∈ l₂) (hinj : InjOn f s) : map f l₁ ≤ map f l₂ ↔ l₁ ≤ l₂
Full source
theorem map_le_map_iff_of_injOn {l₁ l₂ : Filter α} {f : α → β} {s : Set α} (h₁ : s ∈ l₁)
    (h₂ : s ∈ l₂) (hinj : InjOn f s) : mapmap f l₁ ≤ map f l₂ ↔ l₁ ≤ l₂ :=
  ⟨fun h _t ht =>
    mp_mem h₁ <|
      mem_of_superset (h <| image_mem_map (inter_mem h₂ ht)) fun _y ⟨_x, ⟨hxs, hxt⟩, hxy⟩ hys =>
        hinj hxs hys hxy ▸ hxt,
    fun h => map_mono h⟩
Comparison of Image Filters via Injectivity: $\text{map } f l_1 \leq \text{map } f l_2 \leftrightarrow l_1 \leq l_2$ under injectivity condition
Informal description
Let $l_1$ and $l_2$ be filters on a type $\alpha$, and let $f : \alpha \to \beta$ be a function. Suppose there exists a set $s \in l_1 \cap l_2$ such that $f$ is injective on $s$. Then the image filter $\text{map } f l_1$ is less than or equal to $\text{map } f l_2$ if and only if $l_1 \leq l_2$.
Filter.map_le_map_iff theorem
{f g : Filter α} {m : α → β} (hm : Injective m) : map m f ≤ map m g ↔ f ≤ g
Full source
theorem map_le_map_iff {f g : Filter α} {m : α → β} (hm : Injective m) :
    mapmap m f ≤ map m g ↔ f ≤ g := by rw [map_le_iff_le_comap, comap_map hm]
Comparison of Image Filters via Injectivity: $\text{map } m f \leq \text{map } m g \leftrightarrow f \leq g$
Informal description
For any filters $f$ and $g$ on a type $\alpha$ and any injective function $m : \alpha \to \beta$, the image filter $\text{map } m f$ is less than or equal to $\text{map } m g$ if and only if $f \leq g$.
Filter.map_eq_map_iff_of_injOn theorem
{f g : Filter α} {m : α → β} {s : Set α} (hsf : s ∈ f) (hsg : s ∈ g) (hm : InjOn m s) : map m f = map m g ↔ f = g
Full source
theorem map_eq_map_iff_of_injOn {f g : Filter α} {m : α → β} {s : Set α} (hsf : s ∈ f) (hsg : s ∈ g)
    (hm : InjOn m s) : mapmap m f = map m g ↔ f = g := by
  simp only [le_antisymm_iff, map_le_map_iff_of_injOn hsf hsg hm,
    map_le_map_iff_of_injOn hsg hsf hm]
Equality of Image Filters via Injectivity: $\text{map } m f = \text{map } m g \leftrightarrow f = g$ under injectivity condition
Informal description
Let $f$ and $g$ be filters on a type $\alpha$, and let $m : \alpha \to \beta$ be a function. Suppose there exists a set $s$ that belongs to both $f$ and $g$, and $m$ is injective on $s$. Then the image filters $\text{map } m f$ and $\text{map } m g$ are equal if and only if the original filters $f$ and $g$ are equal.
Filter.map_inj theorem
{f g : Filter α} {m : α → β} (hm : Injective m) : map m f = map m g ↔ f = g
Full source
theorem map_inj {f g : Filter α} {m : α → β} (hm : Injective m) : mapmap m f = map m g ↔ f = g :=
  map_eq_map_iff_of_injOn univ_mem univ_mem hm.injOn
Injectivity of Filter Mapping: $\text{map } m f = \text{map } m g \leftrightarrow f = g$ for injective $m$
Informal description
For any filters $f$ and $g$ on a type $\alpha$ and any injective function $m : \alpha \to \beta$, the image filters $\text{map } m f$ and $\text{map } m g$ are equal if and only if the original filters $f$ and $g$ are equal.
Filter.map_injective theorem
{m : α → β} (hm : Injective m) : Injective (map m)
Full source
theorem map_injective {m : α → β} (hm : Injective m) : Injective (map m) := fun _ _ =>
  (map_inj hm).1
Injectivity of Filter Mapping for Injective Functions
Informal description
For any injective function $m : \alpha \to \beta$, the map operation on filters $\text{map } m$ is injective. That is, for any filters $f$ and $g$ on $\alpha$, if $\text{map } m f = \text{map } m g$, then $f = g$.
Filter.comap_neBot_iff theorem
{f : Filter β} {m : α → β} : NeBot (comap m f) ↔ ∀ t ∈ f, ∃ a, m a ∈ t
Full source
theorem comap_neBot_iff {f : Filter β} {m : α → β} : NeBotNeBot (comap m f) ↔ ∀ t ∈ f, ∃ a, m a ∈ t := by
  simp only [← forall_mem_nonempty_iff_neBot, mem_comap, forall_exists_index, and_imp]
  exact ⟨fun h t t_in => h (m ⁻¹' t) t t_in Subset.rfl, fun h s t ht hst => (h t ht).imp hst⟩
Non-triviality of Preimage Filter via Nonempty Preimages
Informal description
For a filter $f$ on a type $\beta$ and a function $m : \alpha \to \beta$, the preimage filter $\text{comap } m f$ is non-trivial if and only if for every set $t \in f$, there exists an element $a \in \alpha$ such that $m(a) \in t$.
Filter.comap_neBot theorem
{f : Filter β} {m : α → β} (hm : ∀ t ∈ f, ∃ a, m a ∈ t) : NeBot (comap m f)
Full source
theorem comap_neBot {f : Filter β} {m : α → β} (hm : ∀ t ∈ f, ∃ a, m a ∈ t) : NeBot (comap m f) :=
  comap_neBot_iff.mpr hm
Non-triviality of Preimage Filter under Nonempty Preimages Condition
Informal description
For a filter $f$ on a type $\beta$ and a function $m : \alpha \to \beta$, if for every set $t \in f$ there exists an element $a \in \alpha$ such that $m(a) \in t$, then the preimage filter $\text{comap } m f$ is non-trivial.
Filter.comap_neBot_iff_frequently theorem
{f : Filter β} {m : α → β} : NeBot (comap m f) ↔ ∃ᶠ y in f, y ∈ range m
Full source
theorem comap_neBot_iff_frequently {f : Filter β} {m : α → β} :
    NeBotNeBot (comap m f) ↔ ∃ᶠ y in f, y ∈ range m := by
  simp only [comap_neBot_iff, frequently_iff, mem_range, @and_comm (_ ∈ _), exists_exists_eq_and]
Non-triviality of Preimage Filter via Frequent Range Membership
Informal description
For a filter $f$ on a type $\beta$ and a function $m : \alpha \to \beta$, the preimage filter $\text{comap } m f$ is non-trivial if and only if the set $\{y \mid y \in \text{range } m\}$ is frequently in $f$, i.e., the property $y \in \text{range } m$ holds frequently with respect to $f$.
Filter.comap_neBot_iff_compl_range theorem
{f : Filter β} {m : α → β} : NeBot (comap m f) ↔ (range m)ᶜ ∉ f
Full source
theorem comap_neBot_iff_compl_range {f : Filter β} {m : α → β} :
    NeBotNeBot (comap m f) ↔ (range m)ᶜ ∉ f :=
  comap_neBot_iff_frequently
Non-triviality of Preimage Filter via Complement of Range
Informal description
For a filter $f$ on a type $\beta$ and a function $m : \alpha \to \beta$, the preimage filter $\text{comap } m f$ is non-trivial if and only if the complement of the range of $m$ does not belong to $f$.
Filter.comap_eq_bot_iff_compl_range theorem
{f : Filter β} {m : α → β} : comap m f = ⊥ ↔ (range m)ᶜ ∈ f
Full source
theorem comap_eq_bot_iff_compl_range {f : Filter β} {m : α → β} : comapcomap m f = ⊥ ↔ (range m)ᶜ ∈ f :=
  not_iff_not.mp <| neBot_iff.symm.trans comap_neBot_iff_compl_range
Preimage Filter is Bottom if and only if Complement of Range is in Filter
Informal description
For a filter $f$ on a type $\beta$ and a function $m : \alpha \to \beta$, the preimage filter $\text{comap } m f$ is equal to the bottom filter $\bot$ if and only if the complement of the range of $m$ belongs to $f$.
Filter.comap_surjective_eq_bot theorem
{f : Filter β} {m : α → β} (hm : Surjective m) : comap m f = ⊥ ↔ f = ⊥
Full source
theorem comap_surjective_eq_bot {f : Filter β} {m : α → β} (hm : Surjective m) :
    comapcomap m f = ⊥ ↔ f = ⊥ := by
  rw [comap_eq_bot_iff_compl_range, hm.range_eq, compl_univ, empty_mem_iff_bot]
Preimage Filter is Bottom under Surjective Function if and only if Original Filter is Bottom
Informal description
For a filter $f$ on a type $\beta$ and a surjective function $m : \alpha \to \beta$, the preimage filter $\text{comap } m f$ is equal to the bottom filter $\bot$ if and only if $f$ itself is the bottom filter.
Filter.disjoint_comap_iff theorem
(h : Surjective m) : Disjoint (comap m g₁) (comap m g₂) ↔ Disjoint g₁ g₂
Full source
theorem disjoint_comap_iff (h : Surjective m) :
    DisjointDisjoint (comap m g₁) (comap m g₂) ↔ Disjoint g₁ g₂ := by
  rw [disjoint_iff, disjoint_iff, ← comap_inf, comap_surjective_eq_bot h]
Disjointness of Preimage Filters under Surjective Function: $\text{Disjoint}(\text{comap } m g_1, \text{comap } m g_2) \leftrightarrow \text{Disjoint}(g_1, g_2)$
Informal description
For a surjective function $m : \alpha \to \beta$ and two filters $g_1$ and $g_2$ on $\beta$, the preimage filters $\text{comap } m g_1$ and $\text{comap } m g_2$ are disjoint if and only if $g_1$ and $g_2$ are disjoint.
Filter.NeBot.comap_of_range_mem theorem
{f : Filter β} {m : α → β} (_ : NeBot f) (hm : range m ∈ f) : NeBot (comap m f)
Full source
theorem NeBot.comap_of_range_mem {f : Filter β} {m : α → β} (_ : NeBot f) (hm : rangerange m ∈ f) :
    NeBot (comap m f) :=
  comap_neBot_iff_frequently.2 <| Eventually.frequently hm
Non-triviality of Preimage Filter when Range is in Filter
Informal description
For a non-trivial filter $f$ on a type $\beta$ and a function $m : \alpha \to \beta$, if the range of $m$ belongs to $f$, then the preimage filter $\text{comap } m f$ is non-trivial.
Filter.comap_fst_neBot_iff theorem
{f : Filter α} : (f.comap (Prod.fst : α × β → α)).NeBot ↔ f.NeBot ∧ Nonempty β
Full source
@[simp]
theorem comap_fst_neBot_iff {f : Filter α} :
    (f.comap (Prod.fst : α × β → α)).NeBot ↔ f.NeBot ∧ Nonempty β := by
  cases isEmpty_or_nonempty β
  · rw [filter_eq_bot_of_isEmpty (f.comap _), ← not_iff_not]; simp [*]
  · simp [comap_neBot_iff_frequently, *]
Non-triviality of First Projection Preimage Filter: $(f.\text{comap}\, \text{fst}).\text{NeBot} \leftrightarrow f.\text{NeBot} \land \text{Nonempty}\, \beta$
Informal description
For any filter $f$ on a type $\alpha$, the preimage filter $f.\text{comap}\, \text{fst}$ on the product type $\alpha \times \beta$ (where $\text{fst} : \alpha \times \beta \to \alpha$ is the first projection) is non-trivial if and only if both $f$ is non-trivial and $\beta$ is nonempty.
Filter.comap_fst_neBot theorem
[Nonempty β] {f : Filter α} [NeBot f] : (f.comap (Prod.fst : α × β → α)).NeBot
Full source
@[instance]
theorem comap_fst_neBot [Nonempty β] {f : Filter α} [NeBot f] :
    (f.comap (Prod.fst : α × β → α)).NeBot :=
  comap_fst_neBot_iff.2 ⟨‹_›, ‹_›⟩
Non-triviality of First Projection Preimage Filter under Nonempty Condition
Informal description
Let $\alpha$ and $\beta$ be types with $\beta$ nonempty, and let $f$ be a non-trivial filter on $\alpha$. Then the preimage filter $f.\text{comap}\, \text{fst}$ on $\alpha \times \beta$ (where $\text{fst} : \alpha \times \beta \to \alpha$ is the first projection) is non-trivial.
Filter.comap_snd_neBot_iff theorem
{f : Filter β} : (f.comap (Prod.snd : α × β → β)).NeBot ↔ Nonempty α ∧ f.NeBot
Full source
@[simp]
theorem comap_snd_neBot_iff {f : Filter β} :
    (f.comap (Prod.snd : α × β → β)).NeBot ↔ Nonempty α ∧ f.NeBot := by
  rcases isEmpty_or_nonempty α with hα | hα
  · rw [filter_eq_bot_of_isEmpty (f.comap _), ← not_iff_not]; simp
  · simp [comap_neBot_iff_frequently, hα]
Non-triviality of Second Projection Preimage Filter: $\text{comap } \operatorname{snd} f \text{ is non-trivial} \leftrightarrow \alpha \text{ is nonempty and } f \text{ is non-trivial}$
Informal description
For any filter $f$ on a type $\beta$, the preimage filter under the second projection $\operatorname{snd} : \alpha \times \beta \to \beta$ is non-trivial if and only if $\alpha$ is nonempty and $f$ is non-trivial.
Filter.comap_snd_neBot theorem
[Nonempty α] {f : Filter β} [NeBot f] : (f.comap (Prod.snd : α × β → β)).NeBot
Full source
@[instance]
theorem comap_snd_neBot [Nonempty α] {f : Filter β} [NeBot f] :
    (f.comap (Prod.snd : α × β → β)).NeBot :=
  comap_snd_neBot_iff.2 ⟨‹_›, ‹_›⟩
Non-triviality of Second Projection Preimage Filter under Non-trivial Conditions
Informal description
Let $\alpha$ be a nonempty type and $f$ be a non-trivial filter on a type $\beta$. Then the preimage filter of $f$ under the second projection $\operatorname{snd} : \alpha \times \beta \to \beta$ is non-trivial.
Filter.comap_eval_neBot_iff' theorem
{ι : Type*} {α : ι → Type*} {i : ι} {f : Filter (α i)} : (comap (eval i) f).NeBot ↔ (∀ j, Nonempty (α j)) ∧ NeBot f
Full source
theorem comap_eval_neBot_iff' {ι : Type*} {α : ι → Type*} {i : ι} {f : Filter (α i)} :
    (comap (eval i) f).NeBot ↔ (∀ j, Nonempty (α j)) ∧ NeBot f := by
  rcases isEmpty_or_nonempty (∀ j, α j) with H | H
  · rw [filter_eq_bot_of_isEmpty (f.comap _), ← not_iff_not]
    simp [← Classical.nonempty_pi]
  · have : ∀ j, Nonempty (α j) := Classical.nonempty_pi.1 H
    simp [comap_neBot_iff_frequently, *]
Non-triviality Criterion for Preimage Filter under Evaluation Function
Informal description
Let $\iota$ be a type, $\alpha : \iota \to \text{Type}$ a family of types, and $i \in \iota$ an index. For a filter $f$ on $\alpha i$, the preimage filter $\text{comap}(\text{eval } i, f)$ is non-trivial if and only if: 1. For every $j \in \iota$, the type $\alpha j$ is nonempty, and 2. The filter $f$ is non-trivial.
Filter.comap_eval_neBot_iff theorem
{ι : Type*} {α : ι → Type*} [∀ j, Nonempty (α j)] {i : ι} {f : Filter (α i)} : (comap (eval i) f).NeBot ↔ NeBot f
Full source
@[simp]
theorem comap_eval_neBot_iff {ι : Type*} {α : ι → Type*} [∀ j, Nonempty (α j)] {i : ι}
    {f : Filter (α i)} : (comap (eval i) f).NeBot ↔ NeBot f := by simp [comap_eval_neBot_iff', *]
Non-triviality of Preimage Filter under Evaluation Function
Informal description
Let $\iota$ be a type, and let $\alpha : \iota \to \text{Type}$ be a family of types such that $\alpha j$ is nonempty for every $j \in \iota$. For a given index $i \in \iota$ and a filter $f$ on $\alpha i$, the preimage filter $\text{comap}(\text{eval } i, f)$ is non-trivial if and only if the filter $f$ itself is non-trivial.
Filter.comap_eval_neBot theorem
{ι : Type*} {α : ι → Type*} [∀ j, Nonempty (α j)] (i : ι) (f : Filter (α i)) [NeBot f] : (comap (eval i) f).NeBot
Full source
@[instance]
theorem comap_eval_neBot {ι : Type*} {α : ι → Type*} [∀ j, Nonempty (α j)] (i : ι)
    (f : Filter (α i)) [NeBot f] : (comap (eval i) f).NeBot :=
  comap_eval_neBot_iff.2 ‹_›
Non-triviality of Preimage Filter under Evaluation Function for Non-trivial Filters
Informal description
Let $\iota$ be a type, and let $\alpha : \iota \to \text{Type}$ be a family of nonempty types. For any index $i \in \iota$ and any non-trivial filter $f$ on $\alpha i$, the preimage filter $\text{comap}(\text{eval } i, f)$ is also non-trivial.
Filter.comap_coe_neBot_of_le_principal theorem
{s : Set γ} {l : Filter γ} [h : NeBot l] (h' : l ≤ 𝓟 s) : NeBot (comap ((↑) : s → γ) l)
Full source
theorem comap_coe_neBot_of_le_principal {s : Set γ} {l : Filter γ} [h : NeBot l] (h' : l ≤ 𝓟 s) :
    NeBot (comap ((↑) : s → γ) l) :=
  h.comap_of_range_mem <| (@Subtype.range_coe γ s).symm ▸ h' (mem_principal_self s)
Non-triviality of Preimage Filter under Inclusion for Filters Finer than Principal Filter
Informal description
Let $s$ be a subset of a type $\gamma$, and let $l$ be a non-trivial filter on $\gamma$ such that $l$ is finer than the principal filter generated by $s$ (i.e., $l \subseteq \mathfrak{P}(s)$). Then the preimage filter $\text{comap}(\uparrow, l)$ on $s$ (where $\uparrow : s \to \gamma$ is the canonical inclusion map) is non-trivial.
Filter.NeBot.comap_of_surj theorem
{f : Filter β} {m : α → β} (hf : NeBot f) (hm : Surjective m) : NeBot (comap m f)
Full source
theorem NeBot.comap_of_surj {f : Filter β} {m : α → β} (hf : NeBot f) (hm : Surjective m) :
    NeBot (comap m f) :=
  hf.comap_of_range_mem <| univ_mem' hm
Non-triviality of Preimage Filter under Surjective Function
Informal description
Let $f$ be a non-trivial filter on a type $\beta$ and let $m : \alpha \to \beta$ be a surjective function. Then the preimage filter $\text{comap } m f$ is non-trivial.
Filter.NeBot.comap_of_image_mem theorem
{f : Filter β} {m : α → β} (hf : NeBot f) {s : Set α} (hs : m '' s ∈ f) : NeBot (comap m f)
Full source
theorem NeBot.comap_of_image_mem {f : Filter β} {m : α → β} (hf : NeBot f) {s : Set α}
    (hs : m '' sm '' s ∈ f) : NeBot (comap m f) :=
  hf.comap_of_range_mem <| mem_of_superset hs (image_subset_range _ _)
Non-triviality of Preimage Filter when Image is in Filter
Informal description
Let $f$ be a non-trivial filter on a type $\beta$, and let $m : \alpha \to \beta$ be a function. If there exists a subset $s \subseteq \alpha$ such that the image $m(s)$ belongs to $f$, then the preimage filter $\text{comap } m f$ is non-trivial.
Filter.map_eq_bot_iff theorem
: map m f = ⊥ ↔ f = ⊥
Full source
@[simp]
theorem map_eq_bot_iff : mapmap m f = ⊥ ↔ f = ⊥ :=
  ⟨by
    rw [← empty_mem_iff_bot, ← empty_mem_iff_bot]
    exact id, fun h => by simp only [h, map_bot]⟩
Image Filter is Bottom iff Original Filter is Bottom
Informal description
For any function $m : \alpha \to \beta$ and any filter $f$ on $\alpha$, the image filter $\text{map } m f$ is equal to the bottom filter $\bot$ on $\beta$ if and only if $f$ is equal to the bottom filter $\bot$ on $\alpha$.
Filter.map_neBot_iff theorem
(f : α → β) {F : Filter α} : NeBot (map f F) ↔ NeBot F
Full source
theorem map_neBot_iff (f : α → β) {F : Filter α} : NeBotNeBot (map f F) ↔ NeBot F := by
  simp only [neBot_iff, Ne, map_eq_bot_iff]
Non-triviality of Image Filter $\text{map } f F$ iff $F$ is Non-trivial
Informal description
For any function $f : \alpha \to \beta$ and any filter $F$ on $\alpha$, the image filter $\text{map } f F$ is non-trivial if and only if $F$ is non-trivial.
Filter.NeBot.map theorem
(hf : NeBot f) (m : α → β) : NeBot (map m f)
Full source
theorem NeBot.map (hf : NeBot f) (m : α → β) : NeBot (map m f) :=
  (map_neBot_iff m).2 hf
Non-triviality of Image Filter under a Function
Informal description
If $f$ is a non-trivial filter on a type $\alpha$ and $m : \alpha \to \beta$ is a function, then the image filter $\text{map } m f$ on $\beta$ is also non-trivial.
Filter.NeBot.of_map theorem
: NeBot (f.map m) → NeBot f
Full source
theorem NeBot.of_map : NeBot (f.map m) → NeBot f :=
  (map_neBot_iff m).1
Non-triviality of Preimage Filter Implies Non-triviality of Original Filter
Informal description
For any function $m : \alpha \to \beta$ and any filter $f$ on $\alpha$, if the image filter $\text{map } m f$ is non-trivial, then $f$ is non-trivial.
Filter.map_neBot instance
[hf : NeBot f] : NeBot (f.map m)
Full source
instance map_neBot [hf : NeBot f] : NeBot (f.map m) :=
  hf.map m
Non-triviality Preservation under Filter Mapping
Informal description
For any non-trivial filter $f$ on a type $\alpha$ and any function $m : \alpha \to \beta$, the image filter $\text{map } m f$ on $\beta$ is also non-trivial.
Filter.sInter_comap_sets theorem
(f : α → β) (F : Filter β) : ⋂₀ (comap f F).sets = ⋂ U ∈ F, f ⁻¹' U
Full source
theorem sInter_comap_sets (f : α → β) (F : Filter β) : ⋂₀ (comap f F).sets = ⋂ U ∈ F, f ⁻¹' U := by
  ext x
  suffices (∀ (A : Set α) (B : Set β), B ∈ F → f ⁻¹' B ⊆ A → x ∈ A) ↔
      ∀ B : Set β, B ∈ F → f x ∈ B by
    simp only [mem_sInter, mem_iInter, Filter.mem_sets, mem_comap, this, and_imp, exists_prop,
      mem_preimage, exists_imp]
  constructor
  · intro h U U_in
    simpa only [Subset.rfl, forall_prop_of_true, mem_preimage] using h (f ⁻¹' U) U U_in
  · intro h V U U_in f_U_V
    exact f_U_V (h U U_in)
Intersection of Preimage Filter Sets Equals Intersection of Preimages
Informal description
For any function $f : \alpha \to \beta$ and any filter $F$ on $\beta$, the intersection of all sets in the preimage filter $\text{comap } f F$ is equal to the intersection of the preimages $f^{-1}(U)$ over all sets $U \in F$. In symbols: \[ \bigcap_{s \in \text{comap } f F} s = \bigcap_{U \in F} f^{-1}(U). \]
Filter.map_iInf_le theorem
{f : ι → Filter α} {m : α → β} : map m (iInf f) ≤ ⨅ i, map m (f i)
Full source
theorem map_iInf_le {f : ι → Filter α} {m : α → β} : map m (iInf f) ≤ ⨅ i, map m (f i) :=
  le_iInf fun _ => map_mono <| iInf_le _ _
Image Filter of Infimum is Contained in Infimum of Image Filters
Informal description
For any indexed family of filters $f : \iota \to \text{Filter } \alpha$ and any function $m : \alpha \to \beta$, the image filter of the infimum of $f$ under $m$ is contained in the infimum of the image filters of each $f(i)$ under $m$. In symbols: \[ \text{map } m \left(\bigsqcap_i f(i)\right) \leq \bigsqcap_i \text{map } m (f(i)). \]
Filter.map_iInf_eq theorem
{f : ι → Filter α} {m : α → β} (hf : Directed (· ≥ ·) f) [Nonempty ι] : map m (iInf f) = ⨅ i, map m (f i)
Full source
theorem map_iInf_eq {f : ι → Filter α} {m : α → β} (hf : Directed (· ≥ ·) f) [Nonempty ι] :
    map m (iInf f) = ⨅ i, map m (f i) :=
  map_iInf_le.antisymm fun s (hs : m ⁻¹' sm ⁻¹' s ∈ iInf f) =>
    let ⟨i, hi⟩ := (mem_iInf_of_directed hf _).1 hs
    have : ⨅ i, map m (f i)𝓟 s :=
      iInf_le_of_le i <| by simpa only [le_principal_iff, mem_map]
    Filter.le_principal_iff.1 this
Image Filter of Directed Infimum Equals Infimum of Image Filters
Informal description
For any directed family of filters $\{f_i\}_{i \in \iota}$ on a type $\alpha$ (with respect to the reverse inclusion order $\supseteq$) and a nonempty index set $\iota$, the image filter of the infimum of the family under a function $m : \alpha \to \beta$ is equal to the infimum of the image filters of each $f_i$ under $m$. In symbols: \[ \text{map } m \left(\bigsqcap_i f_i\right) = \bigsqcap_i \text{map } m (f_i). \]
Filter.map_biInf_eq theorem
{ι : Type w} {f : ι → Filter α} {m : α → β} {p : ι → Prop} (h : DirectedOn (f ⁻¹'o (· ≥ ·)) {x | p x}) (ne : ∃ i, p i) : map m (⨅ (i) (_ : p i), f i) = ⨅ (i) (_ : p i), map m (f i)
Full source
theorem map_biInf_eq {ι : Type w} {f : ι → Filter α} {m : α → β} {p : ι → Prop}
    (h : DirectedOn (f ⁻¹'o (· ≥ ·)) { x | p x }) (ne : ∃ i, p i) :
    map m (⨅ (i) (_ : p i), f i) = ⨅ (i) (_ : p i), map m (f i) := by
  haveI := nonempty_subtype.2 ne
  simp only [iInf_subtype']
  exact map_iInf_eq h.directed_val
Image Filter of Directed Infimum over Predicate Equals Infimum of Image Filters
Informal description
Let $\{f_i\}_{i \in \iota}$ be a family of filters on a type $\alpha$, indexed by a type $\iota$, and let $p : \iota \to \text{Prop}$ be a predicate on $\iota$. Suppose the family is directed with respect to the reverse inclusion order $\supseteq$ on the subset $\{x \mid p(x)\}$, and that there exists at least one index $i$ for which $p(i)$ holds. Then for any function $m : \alpha \to \beta$, the image filter of the infimum $\bigsqcap_{i \in \iota, p(i)} f_i$ under $m$ is equal to the infimum of the image filters $\bigsqcap_{i \in \iota, p(i)} \text{map } m (f_i)$. In symbols: \[ \text{map } m \left(\bigsqcap_{\substack{i \in \iota \\ p(i)}} f_i\right) = \bigsqcap_{\substack{i \in \iota \\ p(i)}} \text{map } m (f_i). \]
Filter.map_inf_le theorem
{f g : Filter α} {m : α → β} : map m (f ⊓ g) ≤ map m f ⊓ map m g
Full source
theorem map_inf_le {f g : Filter α} {m : α → β} : map m (f ⊓ g) ≤ mapmap m f ⊓ map m g :=
  (@map_mono _ _ m).map_inf_le f g
Image Filter of Infimum is Contained in Infimum of Image Filters
Informal description
For any filters $f$ and $g$ on a type $\alpha$ and any function $m : \alpha \to \beta$, the image filter of the infimum $f \sqcap g$ under $m$ is contained in the infimum of the image filters, i.e., $\text{map } m (f \sqcap g) \leq \text{map } m f \sqcap \text{map } m g$.
Filter.map_inf theorem
{f g : Filter α} {m : α → β} (h : Injective m) : map m (f ⊓ g) = map m f ⊓ map m g
Full source
theorem map_inf {f g : Filter α} {m : α → β} (h : Injective m) :
    map m (f ⊓ g) = mapmap m f ⊓ map m g := by
  refine map_inf_le.antisymm ?_
  rintro t ⟨s₁, hs₁, s₂, hs₂, ht : m ⁻¹' t = s₁ ∩ s₂⟩
  refine mem_inf_of_inter (image_mem_map hs₁) (image_mem_map hs₂) ?_
  rw [← image_inter h, image_subset_iff, ht]
Image Filter of Infimum Equals Infimum of Image Filters for Injective Functions
Informal description
For any filters $f$ and $g$ on a type $\alpha$ and any injective function $m : \alpha \to \beta$, the image filter of the infimum $f \sqcap g$ under $m$ equals the infimum of the image filters, i.e., $\text{map } m (f \sqcap g) = \text{map } m f \sqcap \text{map } m g$.
Filter.map_inf' theorem
{f g : Filter α} {m : α → β} {t : Set α} (htf : t ∈ f) (htg : t ∈ g) (h : InjOn m t) : map m (f ⊓ g) = map m f ⊓ map m g
Full source
theorem map_inf' {f g : Filter α} {m : α → β} {t : Set α} (htf : t ∈ f) (htg : t ∈ g)
    (h : InjOn m t) : map m (f ⊓ g) = mapmap m f ⊓ map m g := by
  lift f to Filter t using htf; lift g to Filter t using htg
  replace h : Injective (m ∘ ((↑) : t → α)) := h.injective
  simp only [map_map, ← map_inf Subtype.coe_injective, map_inf h]
Image Filter of Infimum Equals Infimum of Image Filters on Injective Subset
Informal description
For any filters $f$ and $g$ on a type $\alpha$, any function $m : \alpha \to \beta$, and any subset $t \subseteq \alpha$ such that: 1. $t$ belongs to both $f$ and $g$ (i.e., $t \in f$ and $t \in g$), 2. $m$ is injective on $t$, the image filter of the infimum $f \sqcap g$ under $m$ equals the infimum of the image filters, i.e., $\text{map}_m (f \sqcap g) = \text{map}_m f \sqcap \text{map}_m g$.
Filter.disjoint_of_map theorem
{α β : Type*} {F G : Filter α} {f : α → β} (h : Disjoint (map f F) (map f G)) : Disjoint F G
Full source
lemma disjoint_of_map {α β : Type*} {F G : Filter α} {f : α → β}
    (h : Disjoint (map f F) (map f G)) : Disjoint F G :=
  disjoint_iff.mpr <| map_eq_bot_iff.mp <| le_bot_iff.mp <| trans map_inf_le (disjoint_iff.mp h)
Disjointness of Original Filters from Disjointness of Image Filters
Informal description
For any filters $F$ and $G$ on a type $\alpha$ and any function $f : \alpha \to \beta$, if the image filters $\text{map } f F$ and $\text{map } f G$ are disjoint, then $F$ and $G$ are also disjoint.
Filter.disjoint_map theorem
{m : α → β} (hm : Injective m) {f₁ f₂ : Filter α} : Disjoint (map m f₁) (map m f₂) ↔ Disjoint f₁ f₂
Full source
theorem disjoint_map {m : α → β} (hm : Injective m) {f₁ f₂ : Filter α} :
    DisjointDisjoint (map m f₁) (map m f₂) ↔ Disjoint f₁ f₂ := by
  simp only [disjoint_iff, ← map_inf hm, map_eq_bot_iff]
Disjointness Preservation Under Injective Mapping of Filters
Informal description
For any injective function $m : \alpha \to \beta$ and any filters $f_1, f_2$ on $\alpha$, the image filters $\text{map } m f_1$ and $\text{map } m f_2$ are disjoint if and only if $f_1$ and $f_2$ are disjoint.
Filter.map_equiv_symm theorem
(e : α ≃ β) (f : Filter β) : map e.symm f = comap e f
Full source
theorem map_equiv_symm (e : α ≃ β) (f : Filter β) : map e.symm f = comap e f :=
  map_injective e.injective <| by
    rw [map_map, e.self_comp_symm, map_id, map_comap_of_surjective e.surjective]
Equivalence between Image and Preimage Filters under Equivalence Inverse
Informal description
For any equivalence $e : \alpha \simeq \beta$ and any filter $f$ on $\beta$, the image filter of $f$ under the inverse equivalence $e^{-1}$ is equal to the preimage filter of $f$ under $e$, i.e., \[ \text{map } e^{-1} f = \text{comap } e f. \]
Filter.map_eq_comap_of_inverse theorem
{f : Filter α} {m : α → β} {n : β → α} (h₁ : m ∘ n = id) (h₂ : n ∘ m = id) : map m f = comap n f
Full source
theorem map_eq_comap_of_inverse {f : Filter α} {m : α → β} {n : β → α} (h₁ : m ∘ n = id)
    (h₂ : n ∘ m = id) : map m f = comap n f :=
  map_equiv_symm ⟨n, m, congr_fun h₁, congr_fun h₂⟩ f
Equality of Image and Preimage Filters for Inverse Functions
Informal description
Let $f$ be a filter on a type $\alpha$, and let $m : \alpha \to \beta$ and $n : \beta \to \alpha$ be functions such that $m \circ n$ and $n \circ m$ are both the identity function. Then the image filter of $f$ under $m$ is equal to the preimage filter of $f$ under $n$, i.e., \[ \text{map } m f = \text{comap } n f. \]
Filter.comap_equiv_symm theorem
(e : α ≃ β) (f : Filter α) : comap e.symm f = map e f
Full source
theorem comap_equiv_symm (e : α ≃ β) (f : Filter α) : comap e.symm f = map e f :=
  (map_eq_comap_of_inverse e.self_comp_symm e.symm_comp_self).symm
Equality of Preimage and Image Filters under Equivalence Inverse
Informal description
For any equivalence $e : \alpha \simeq \beta$ and any filter $f$ on $\alpha$, the preimage filter of $f$ under the inverse equivalence $e^{-1}$ is equal to the image filter of $f$ under $e$, i.e., \[ \text{comap } e^{-1} f = \text{map } e f. \]
Filter.map_swap_eq_comap_swap theorem
{f : Filter (α × β)} : Prod.swap <$> f = comap Prod.swap f
Full source
theorem map_swap_eq_comap_swap {f : Filter (α × β)} : Prod.swapProd.swap <$> f = comap Prod.swap f :=
  map_eq_comap_of_inverse Prod.swap_swap_eq Prod.swap_swap_eq
Equality of Image and Preimage Filters under Swap Function
Informal description
For any filter $f$ on the product type $\alpha \times \beta$, the image filter of $f$ under the swap function $\text{swap} : \alpha \times \beta \to \beta \times \alpha$ is equal to the preimage filter of $f$ under the same swap function. That is, \[ \text{map swap } f = \text{comap swap } f. \]
Filter.map_swap4_eq_comap theorem
{f : Filter ((α × β) × γ × δ)} : map (fun p : (α × β) × γ × δ => ((p.1.1, p.2.1), (p.1.2, p.2.2))) f = comap (fun p : (α × γ) × β × δ => ((p.1.1, p.2.1), (p.1.2, p.2.2))) f
Full source
/-- A useful lemma when dealing with uniformities. -/
theorem map_swap4_eq_comap {f : Filter ((α × β) × γ × δ)} :
    map (fun p : (α × β) × γ × δ => ((p.1.1, p.2.1), (p.1.2, p.2.2))) f =
      comap (fun p : (α × γ) × β × δ => ((p.1.1, p.2.1), (p.1.2, p.2.2))) f :=
  map_eq_comap_of_inverse (funext fun ⟨⟨_, _⟩, ⟨_, _⟩⟩ => rfl) (funext fun ⟨⟨_, _⟩, ⟨_, _⟩⟩ => rfl)
Image-Preimage Filter Equality for Component-Swapping Function on Product Space
Informal description
For any filter $f$ on the product space $(\alpha \times \beta) \times (\gamma \times \delta)$, the image filter under the function that swaps the components as \[ p \mapsto ((p_{1,1}, p_{2,1}), (p_{1,2}, p_{2,2})) \] is equal to the preimage filter under the inverse function that swaps the components back as \[ p \mapsto ((p_{1,1}, p_{2,1}), (p_{1,2}, p_{2,2})). \]
Filter.le_map theorem
{f : Filter α} {m : α → β} {g : Filter β} (h : ∀ s ∈ f, m '' s ∈ g) : g ≤ f.map m
Full source
theorem le_map {f : Filter α} {m : α → β} {g : Filter β} (h : ∀ s ∈ f, m '' s ∈ g) : g ≤ f.map m :=
  fun _ hs => mem_of_superset (h _ hs) <| image_preimage_subset _ _
Image Filter Comparison: $g \leq \text{map } m f$ under Image Condition
Informal description
Let $f$ be a filter on a type $\alpha$, $m : \alpha \to \beta$ a function, and $g$ a filter on $\beta$. If for every set $s \in f$ the image $m(s)$ belongs to $g$, then $g$ is finer than the image filter $\text{map } m f$, i.e., $g \leq \text{map } m f$.
Filter.le_map_iff theorem
{f : Filter α} {m : α → β} {g : Filter β} : g ≤ f.map m ↔ ∀ s ∈ f, m '' s ∈ g
Full source
theorem le_map_iff {f : Filter α} {m : α → β} {g : Filter β} : g ≤ f.map m ↔ ∀ s ∈ f, m '' s ∈ g :=
  ⟨fun h _ hs => h (image_mem_map hs), le_map⟩
Characterization of Filter Comparison via Image Condition: $g \leq \text{map } m f$ $\leftrightarrow$ $\forall s \in f, m(s) \in g$
Informal description
For a filter $f$ on a type $\alpha$, a function $m : \alpha \to \beta$, and a filter $g$ on $\beta$, the following are equivalent: 1. The filter $g$ is finer than the image filter $\text{map } m f$, i.e., $g \leq \text{map } m f$. 2. For every subset $s \in f$, the image $m(s)$ belongs to $g$.
Filter.push_pull theorem
(f : α → β) (F : Filter α) (G : Filter β) : map f (F ⊓ comap f G) = map f F ⊓ G
Full source
protected theorem push_pull (f : α → β) (F : Filter α) (G : Filter β) :
    map f (F ⊓ comap f G) = mapmap f F ⊓ G := by
  apply le_antisymm
  · calc
      map f (F ⊓ comap f G) ≤ mapmap f F ⊓ (map f <| comap f G) := map_inf_le
      _ ≤ mapmap f F ⊓ G := inf_le_inf_left (map f F) map_comap_le

  · rintro U ⟨V, V_in, W, ⟨Z, Z_in, hZ⟩, h⟩
    apply mem_inf_of_inter (image_mem_map V_in) Z_in
    calc
      f '' V ∩ Z = f '' (V ∩ f ⁻¹' Z) := by rw [image_inter_preimage]
      _ ⊆ f '' (V ∩ W)calc
      f '' V ∩ Z = f '' (V ∩ f ⁻¹' Z) := by rw [image_inter_preimage]
      _ ⊆ f '' (V ∩ W) := image_subset _ (inter_subset_inter_right _ ‹_›)
      _ = f '' (f ⁻¹' U) := by rw [h]
      _ ⊆ U := image_preimage_subset f U
Push-Pull Identity for Filters: $f_*(F \sqcap f^{-1}(G)) = f_*(F) \sqcap G$
Informal description
For any function $f \colon \alpha \to \beta$ and filters $F$ on $\alpha$ and $G$ on $\beta$, the image filter of the infimum $F \sqcap f^{-1}(G)$ under $f$ equals the infimum of the image filter $f(F)$ and $G$, i.e., \[ f_*(F \sqcap f^{-1}(G)) = f_*(F) \sqcap G. \]
Filter.push_pull' theorem
(f : α → β) (F : Filter α) (G : Filter β) : map f (comap f G ⊓ F) = G ⊓ map f F
Full source
protected theorem push_pull' (f : α → β) (F : Filter α) (G : Filter β) :
    map f (comapcomap f G ⊓ F) = G ⊓ map f F := by simp only [Filter.push_pull, inf_comm]
Push-Pull Identity for Filters (Reversed Order): $f_*(f^{-1}(G) \sqcap F) = G \sqcap f_*(F)$
Informal description
For any function $f \colon \alpha \to \beta$ and filters $F$ on $\alpha$ and $G$ on $\beta$, the image filter of the infimum $f^{-1}(G) \sqcap F$ under $f$ equals the infimum of $G$ and the image filter $f(F)$, i.e., \[ f_*(f^{-1}(G) \sqcap F) = G \sqcap f_*(F). \]
Filter.disjoint_comap_iff_map theorem
{f : α → β} {F : Filter α} {G : Filter β} : Disjoint F (comap f G) ↔ Disjoint (map f F) G
Full source
theorem disjoint_comap_iff_map {f : α → β} {F : Filter α} {G : Filter β} :
    DisjointDisjoint F (comap f G) ↔ Disjoint (map f F) G := by
  simp only [disjoint_iff, ← Filter.push_pull, map_eq_bot_iff]
Disjointness of Preimage and Image Filters: $F \perp \text{comap } f G \leftrightarrow \text{map } f F \perp G$
Informal description
For any function $f : \alpha \to \beta$ and filters $F$ on $\alpha$ and $G$ on $\beta$, the filters $F$ and $\text{comap } f G$ are disjoint if and only if the filters $\text{map } f F$ and $G$ are disjoint.
Filter.disjoint_comap_iff_map' theorem
{f : α → β} {F : Filter α} {G : Filter β} : Disjoint (comap f G) F ↔ Disjoint G (map f F)
Full source
theorem disjoint_comap_iff_map' {f : α → β} {F : Filter α} {G : Filter β} :
    DisjointDisjoint (comap f G) F ↔ Disjoint G (map f F) := by
  simp only [disjoint_iff, ← Filter.push_pull', map_eq_bot_iff]
Disjointness of Preimage and Image Filters: $\text{comap}_f G \perp F \leftrightarrow G \perp \text{map}_f F$
Informal description
For any function $f : \alpha \to \beta$ and filters $F$ on $\alpha$ and $G$ on $\beta$, the filters $\text{comap}_f G$ and $F$ are disjoint if and only if the filters $G$ and $\text{map}_f F$ are disjoint.
Filter.neBot_inf_comap_iff_map theorem
{f : α → β} {F : Filter α} {G : Filter β} : NeBot (F ⊓ comap f G) ↔ NeBot (map f F ⊓ G)
Full source
theorem neBot_inf_comap_iff_map {f : α → β} {F : Filter α} {G : Filter β} :
    NeBotNeBot (F ⊓ comap f G) ↔ NeBot (map f F ⊓ G) := by
  rw [← map_neBot_iff, Filter.push_pull]
Non-triviality of $F \sqcap f^{-1}(G)$ iff $f(F) \sqcap G$ is non-trivial
Informal description
For any function $f \colon \alpha \to \beta$ and filters $F$ on $\alpha$ and $G$ on $\beta$, the infimum filter $F \sqcap f^{-1}(G)$ is non-trivial if and only if the infimum filter $f(F) \sqcap G$ is non-trivial.
Filter.neBot_inf_comap_iff_map' theorem
{f : α → β} {F : Filter α} {G : Filter β} : NeBot (comap f G ⊓ F) ↔ NeBot (G ⊓ map f F)
Full source
theorem neBot_inf_comap_iff_map' {f : α → β} {F : Filter α} {G : Filter β} :
    NeBotNeBot (comap f G ⊓ F) ↔ NeBot (G ⊓ map f F) := by
  rw [← map_neBot_iff, Filter.push_pull']
Non-triviality of $f^{-1}(G) \sqcap F$ iff $G \sqcap f(F)$ is non-trivial
Informal description
For any function $f \colon \alpha \to \beta$ and filters $F$ on $\alpha$ and $G$ on $\beta$, the infimum filter $\text{comap}_f G \sqcap F$ is non-trivial if and only if the infimum filter $G \sqcap \text{map}_f F$ is non-trivial.
Filter.comap_inf_principal_neBot_of_image_mem theorem
{f : Filter β} {m : α → β} (hf : NeBot f) {s : Set α} (hs : m '' s ∈ f) : NeBot (comap m f ⊓ 𝓟 s)
Full source
theorem comap_inf_principal_neBot_of_image_mem {f : Filter β} {m : α → β} (hf : NeBot f) {s : Set α}
    (hs : m '' sm '' s ∈ f) : NeBot (comapcomap m f ⊓ 𝓟 s) := by
  rw [neBot_inf_comap_iff_map', map_principal, ← frequently_mem_iff_neBot]
  exact Eventually.frequently hs
Non-triviality of $\text{comap}_m f \sqcap \mathcal{P}(s)$ when $m(s) \in f$
Informal description
Let $f$ be a non-trivial filter on a type $\beta$, $m : \alpha \to \beta$ a function, and $s \subseteq \alpha$ a subset such that the image $m(s)$ belongs to $f$. Then the infimum of the preimage filter $\text{comap}_m f$ and the principal filter generated by $s$ is non-trivial.
Filter.principal_eq_map_coe_top theorem
(s : Set α) : 𝓟 s = map ((↑) : s → α) ⊤
Full source
theorem principal_eq_map_coe_top (s : Set α) : 𝓟 s = map ((↑) : s → α)  := by simp
Principal Filter as Image of Top Filter under Inclusion
Informal description
For any subset $s$ of a type $\alpha$, the principal filter $\mathcal{P}(s)$ generated by $s$ is equal to the image filter of the top filter $\top$ under the canonical inclusion map $\uparrow : s \to \alpha$. In symbols: \[ \mathcal{P}(s) = \text{map } \uparrow \top. \]
Filter.inf_principal_eq_bot_iff_comap theorem
{F : Filter α} {s : Set α} : F ⊓ 𝓟 s = ⊥ ↔ comap ((↑) : s → α) F = ⊥
Full source
theorem inf_principal_eq_bot_iff_comap {F : Filter α} {s : Set α} :
    F ⊓ 𝓟 sF ⊓ 𝓟 s = ⊥ ↔ comap ((↑) : s → α) F = ⊥ := by
  rw [principal_eq_map_coe_top s, ← Filter.push_pull', inf_top_eq, map_eq_bot_iff]
Infimum with Principal Filter is Bottom iff Preimage Filter is Bottom
Informal description
For any filter $F$ on a type $\alpha$ and any subset $s \subseteq \alpha$, the infimum of $F$ with the principal filter generated by $s$ is equal to the bottom filter if and only if the preimage filter of $F$ under the canonical inclusion map $\uparrow : s \to \alpha$ is equal to the bottom filter. In symbols: \[ F \sqcap \mathcal{P}(s) = \bot \leftrightarrow \text{comap } \uparrow F = \bot. \]
Filter.map_generate_le_generate_preimage_preimage theorem
(U : Set (Set β)) (f : β → α) : map f (generate U) ≤ generate ((f ⁻¹' ·) ⁻¹' U)
Full source
lemma map_generate_le_generate_preimage_preimage (U : Set (Set β)) (f : β → α) :
    map f (generate U) ≤ generate ((f ⁻¹' ·) ⁻¹' U) := by
  rw [le_generate_iff]
  exact fun u hu ↦ mem_generate_of_mem hu
Image Filter of Generated Filter is Finer than Generated Preimage Filter
Informal description
For any collection of sets $U$ on a type $\beta$ and any function $f : \beta \to \alpha$, the image filter of the generated filter $\text{generate } U$ under $f$ is finer than the filter generated by the collection of preimages of sets in $U$ under $f$. In other words, $\text{map } f (\text{generate } U) \leq \text{generate } \{ f^{-1}(V) \mid V \in U \}$.
Filter.generate_image_preimage_le_comap theorem
(U : Set (Set α)) (f : β → α) : generate ((f ⁻¹' ·) '' U) ≤ comap f (generate U)
Full source
lemma generate_image_preimage_le_comap (U : Set (Set α)) (f : β → α) :
    generate ((f ⁻¹' ·) '' U) ≤ comap f (generate U) := by
  rw [← map_le_iff_le_comap, le_generate_iff]
  exact fun u hu ↦ mem_generate_of_mem ⟨u, hu, rfl⟩
Filter Generation and Preimage Inequality: $\text{generate } \{f^{-1}(s)\} \leq \text{comap } f (\text{generate } U)$
Informal description
For any collection of sets $U$ on a type $\alpha$ and any function $f : \beta \to \alpha$, the filter generated by the preimages of sets in $U$ under $f$ is finer than the preimage filter of the filter generated by $U$ under $f$. In other words, $\text{generate } \{f^{-1}(s) \mid s \in U\} \leq \text{comap } f (\text{generate } U)$.
Filter.singleton_mem_pure theorem
{a : α} : { a } ∈ (pure a : Filter α)
Full source
theorem singleton_mem_pure {a : α} : {a}{a} ∈ (pure a : Filter α) :=
  mem_singleton a
Singleton Set Belongs to Principal Filter
Informal description
For any element $a$ of type $\alpha$, the singleton set $\{a\}$ belongs to the principal filter generated by $a$, i.e., $\{a\} \in \text{pure } a$.
Filter.pure_injective theorem
: Injective (pure : α → Filter α)
Full source
theorem pure_injective : Injective (pure : α → Filter α) := fun a _ hab =>
  (Filter.ext_iff.1 hab { x | a = x }).1 rfl
Injectivity of the Principal Filter Construction
Informal description
The function `pure : α → Filter α`, which maps each element $a \in \alpha$ to the principal filter generated by $\{a\}$, is injective. That is, for any $a_1, a_2 \in \alpha$, if $\text{pure } a_1 = \text{pure } a_2$, then $a_1 = a_2$.
Filter.pure_neBot instance
{α : Type u} {a : α} : NeBot (pure a)
Full source
instance pure_neBot {α : Type u} {a : α} : NeBot (pure a) :=
  ⟨mt empty_mem_iff_bot.2 <| not_mem_empty a⟩
Principal Filters are Non-trivial
Informal description
For any type $\alpha$ and any element $a \in \alpha$, the principal filter $\text{pure } a$ is non-trivial (i.e., does not contain the empty set).
Filter.le_pure_iff theorem
{f : Filter α} {a : α} : f ≤ pure a ↔ { a } ∈ f
Full source
@[simp]
theorem le_pure_iff {f : Filter α} {a : α} : f ≤ pure a ↔ {a} ∈ f := by
  rw [← principal_singleton, le_principal_iff]
Characterization of Filter Inclusion in Pure Filter via Singleton Membership
Informal description
For any filter $f$ on a type $\alpha$ and any element $a \in \alpha$, the filter $f$ is less than or equal to the pure filter at $a$ if and only if the singleton set $\{a\}$ belongs to $f$.
Filter.mem_seq_def theorem
{f : Filter (α → β)} {g : Filter α} {s : Set β} : s ∈ f.seq g ↔ ∃ u ∈ f, ∃ t ∈ g, ∀ x ∈ u, ∀ y ∈ t, (x : α → β) y ∈ s
Full source
theorem mem_seq_def {f : Filter (α → β)} {g : Filter α} {s : Set β} :
    s ∈ f.seq gs ∈ f.seq g ↔ ∃ u ∈ f, ∃ t ∈ g, ∀ x ∈ u, ∀ y ∈ t, (x : α → β) y ∈ s :=
  Iff.rfl
Characterization of Membership in Sequential Composition of Filters
Informal description
For any filter $f$ on functions from $\alpha$ to $\beta$, any filter $g$ on $\alpha$, and any subset $s$ of $\beta$, the subset $s$ belongs to the sequential composition $f \mathbin{\text{seq}} g$ if and only if there exist sets $u \in f$ and $t \in g$ such that for every function $x \in u$ and every element $y \in t$, the application $x(y)$ belongs to $s$.
Filter.mem_seq_iff theorem
{f : Filter (α → β)} {g : Filter α} {s : Set β} : s ∈ f.seq g ↔ ∃ u ∈ f, ∃ t ∈ g, Set.seq u t ⊆ s
Full source
theorem mem_seq_iff {f : Filter (α → β)} {g : Filter α} {s : Set β} :
    s ∈ f.seq gs ∈ f.seq g ↔ ∃ u ∈ f, ∃ t ∈ g, Set.seq u t ⊆ s := by
  simp only [mem_seq_def, seq_subset, exists_prop]
Characterization of Sequential Composition of Filters via Monadic Sequence Operation
Informal description
For any filter $f$ of functions from $\alpha$ to $\beta$, any filter $g$ on $\alpha$, and any subset $s$ of $\beta$, the set $s$ belongs to the sequential composition $f.seq\ g$ if and only if there exist sets $u \in f$ and $t \in g$ such that the monadic sequence operation $\text{seq}(u, t)$ is contained in $s$.
Filter.mem_map_seq_iff theorem
{f : Filter α} {g : Filter β} {m : α → β → γ} {s : Set γ} : s ∈ (f.map m).seq g ↔ ∃ t u, t ∈ g ∧ u ∈ f ∧ ∀ x ∈ u, ∀ y ∈ t, m x y ∈ s
Full source
theorem mem_map_seq_iff {f : Filter α} {g : Filter β} {m : α → β → γ} {s : Set γ} :
    s ∈ (f.map m).seq gs ∈ (f.map m).seq g ↔ ∃ t u, t ∈ g ∧ u ∈ f ∧ ∀ x ∈ u, ∀ y ∈ t, m x y ∈ s :=
  Iff.intro (fun ⟨t, ht, s, hs, hts⟩ => ⟨s, m ⁻¹' t, hs, ht, fun _ => hts _⟩)
    fun ⟨t, s, ht, hs, hts⟩ =>
    ⟨m '' s, image_mem_map hs, t, ht, fun _ ⟨_, has, Eq⟩ => Eq ▸ hts _ has⟩
Characterization of Membership in Sequential Composition of Mapped Filter
Informal description
For any filter $f$ on $\alpha$, filter $g$ on $\beta$, function $m : \alpha \to \beta \to \gamma$, and subset $s \subseteq \gamma$, the following are equivalent: 1. $s$ belongs to the sequential composition of the mapped filter $\text{map } m f$ with $g$. 2. There exist sets $t \in g$ and $u \in f$ such that for all $x \in u$ and $y \in t$, the application $m(x)(y)$ belongs to $s$.
Filter.seq_mem_seq theorem
{f : Filter (α → β)} {g : Filter α} {s : Set (α → β)} {t : Set α} (hs : s ∈ f) (ht : t ∈ g) : s.seq t ∈ f.seq g
Full source
theorem seq_mem_seq {f : Filter (α → β)} {g : Filter α} {s : Set (α → β)} {t : Set α} (hs : s ∈ f)
    (ht : t ∈ g) : s.seq t ∈ f.seq g :=
  ⟨s, hs, t, ht, fun f hf a ha => ⟨f, hf, a, ha, rfl⟩⟩
Sequential Composition Preserves Membership in Filters
Informal description
Let $f$ be a filter on the set of functions from $\alpha$ to $\beta$, and let $g$ be a filter on $\alpha$. For any sets $s \in f$ and $t \in g$, the set $\text{seq}(s, t) = \{m(x) \mid m \in s, x \in t\}$ belongs to the sequential composition filter $f.\text{seq}\ g$.
Filter.le_seq theorem
{f : Filter (α → β)} {g : Filter α} {h : Filter β} (hh : ∀ t ∈ f, ∀ u ∈ g, Set.seq t u ∈ h) : h ≤ seq f g
Full source
theorem le_seq {f : Filter (α → β)} {g : Filter α} {h : Filter β}
    (hh : ∀ t ∈ f, ∀ u ∈ g, Set.seq t u ∈ h) : h ≤ seq f g := fun _ ⟨_, ht, _, hu, hs⟩ =>
  mem_of_superset (hh _ ht _ hu) fun _ ⟨_, hm, _, ha, eq⟩ => eq ▸ hs _ hm _ ha
Comparison of Filters under Sequential Composition
Informal description
Let $f$ be a filter of functions from $\alpha$ to $\beta$, $g$ a filter on $\alpha$, and $h$ a filter on $\beta$. If for every set $t \in f$ and every set $u \in g$, the sequential composition $t \mathbin{\text{seq}} u$ belongs to $h$, then $h$ is finer than the sequential composition of $f$ and $g$, i.e., $h \leq f \mathbin{\text{seq}} g$.
Filter.seq_mono theorem
{f₁ f₂ : Filter (α → β)} {g₁ g₂ : Filter α} (hf : f₁ ≤ f₂) (hg : g₁ ≤ g₂) : f₁.seq g₁ ≤ f₂.seq g₂
Full source
@[mono]
theorem seq_mono {f₁ f₂ : Filter (α → β)} {g₁ g₂ : Filter α} (hf : f₁ ≤ f₂) (hg : g₁ ≤ g₂) :
    f₁.seq g₁ ≤ f₂.seq g₂ :=
  le_seq fun _ hs _ ht => seq_mem_seq (hf hs) (hg ht)
Monotonicity of Sequential Composition of Filters
Informal description
For any two filters $f_1$ and $f_2$ on the set of functions from $\alpha$ to $\beta$, and any two filters $g_1$ and $g_2$ on $\alpha$, if $f_1 \leq f_2$ and $g_1 \leq g_2$, then the sequential composition $f_1.\text{seq}\ g_1$ is finer than $f_2.\text{seq}\ g_2$.
Filter.pure_seq_eq_map theorem
(g : α → β) (f : Filter α) : seq (pure g) f = f.map g
Full source
@[simp]
theorem pure_seq_eq_map (g : α → β) (f : Filter α) : seq (pure g) f = f.map g := by
  refine le_antisymm (le_map fun s hs => ?_) (le_seq fun s hs t ht => ?_)
  · rw [← singleton_seq]
    apply seq_mem_seq _ hs
    exact singleton_mem_pure
  · refine sets_of_superset (map g f) (image_mem_map ht) ?_
    rintro b ⟨a, ha, rfl⟩
    exact ⟨g, hs, a, ha, rfl⟩
Equality of Sequential Composition with Pure Function and Image Filter: $\text{seq } (\text{pure } g) f = \text{map } g f$
Informal description
For any function $g : \alpha \to \beta$ and any filter $f$ on $\alpha$, the sequential composition of the pure filter of $g$ with $f$ is equal to the image filter of $f$ under $g$, i.e., $$\text{seq } (\text{pure } g) f = \text{map } g f.$$
Filter.seq_pure theorem
(f : Filter (α → β)) (a : α) : seq f (pure a) = map (fun g : α → β => g a) f
Full source
@[simp]
theorem seq_pure (f : Filter (α → β)) (a : α) : seq f (pure a) = map (fun g : α → β => g a) f := by
  refine le_antisymm (le_map fun s hs => ?_) (le_seq fun s hs t ht => ?_)
  · rw [← seq_singleton]
    exact seq_mem_seq hs singleton_mem_pure
  · refine sets_of_superset (map (fun g : α → β => g a) f) (image_mem_map hs) ?_
    rintro b ⟨g, hg, rfl⟩
    exact ⟨g, hg, a, ht, rfl⟩
Sequential Composition with Principal Filter Equals Evaluation Map
Informal description
For any filter $f$ on the set of functions from $\alpha$ to $\beta$ and any element $a \in \alpha$, the sequential composition of $f$ with the principal filter $\text{pure } a$ is equal to the image filter of $f$ under the evaluation map at $a$, i.e., $$ f \mathbin{\text{seq}} \text{pure } a = \text{map } (\lambda g, g(a)) f. $$
Filter.seq_assoc theorem
(x : Filter α) (g : Filter (α → β)) (h : Filter (β → γ)) : seq h (seq g x) = seq (seq (map (· ∘ ·) h) g) x
Full source
@[simp]
theorem seq_assoc (x : Filter α) (g : Filter (α → β)) (h : Filter (β → γ)) :
    seq h (seq g x) = seq (seq (map (· ∘ ·) h) g) x := by
  refine le_antisymm (le_seq fun s hs t ht => ?_) (le_seq fun s hs t ht => ?_)
  · rcases mem_seq_iff.1 hs with ⟨u, hu, v, hv, hs⟩
    rcases mem_map_iff_exists_image.1 hu with ⟨w, hw, hu⟩
    refine mem_of_superset ?_ (Set.seq_mono ((Set.seq_mono hu Subset.rfl).trans hs) Subset.rfl)
    rw [← Set.seq_seq]
    exact seq_mem_seq hw (seq_mem_seq hv ht)
  · rcases mem_seq_iff.1 ht with ⟨u, hu, v, hv, ht⟩
    refine mem_of_superset ?_ (Set.seq_mono Subset.rfl ht)
    rw [Set.seq_seq]
    exact seq_mem_seq (seq_mem_seq (image_mem_map hs) hu) hv
Associativity of Sequential Composition of Filters
Informal description
For any filter $x$ on $\alpha$, any filter $g$ of functions from $\alpha$ to $\beta$, and any filter $h$ of functions from $\beta$ to $\gamma$, the sequential composition of $h$ with the sequential composition of $g$ and $x$ is equal to the sequential composition of the sequential composition of the mapped composition filter $\text{map } (\cdot \circ \cdot) h$ with $g$, and $x$. In symbols: $$ h \mathbin{\text{seq}} (g \mathbin{\text{seq}} x) = (\text{map } (\cdot \circ \cdot) h \mathbin{\text{seq}} g) \mathbin{\text{seq}} x $$
Filter.prod_map_seq_comm theorem
(f : Filter α) (g : Filter β) : (map Prod.mk f).seq g = seq (map (fun b a => (a, b)) g) f
Full source
theorem prod_map_seq_comm (f : Filter α) (g : Filter β) :
    (map Prod.mk f).seq g = seq (map (fun b a => (a, b)) g) f := by
  refine le_antisymm (le_seq fun s hs t ht => ?_) (le_seq fun s hs t ht => ?_)
  · rcases mem_map_iff_exists_image.1 hs with ⟨u, hu, hs⟩
    refine mem_of_superset ?_ (Set.seq_mono hs Subset.rfl)
    rw [← Set.prod_image_seq_comm]
    exact seq_mem_seq (image_mem_map ht) hu
  · rcases mem_map_iff_exists_image.1 hs with ⟨u, hu, hs⟩
    refine mem_of_superset ?_ (Set.seq_mono hs Subset.rfl)
    rw [Set.prod_image_seq_comm]
    exact seq_mem_seq (image_mem_map ht) hu
Commutativity of Sequential Composition with Mapped Pairing Functions
Informal description
For any filters $f$ on $\alpha$ and $g$ on $\beta$, the sequential composition of the mapped filter $\text{map } \text{Prod.mk } f$ with $g$ is equal to the sequential composition of the mapped filter $\text{map } (\lambda b a \mapsto (a, b)) g$ with $f$. In symbols: $$ \text{seq}(\text{map } \text{Prod.mk } f) \ g = \text{seq}(\text{map } (\lambda b a \mapsto (a, b)) g) \ f $$
Filter.seq_eq_filter_seq theorem
{α β : Type u} (f : Filter (α → β)) (g : Filter α) : f <*> g = seq f g
Full source
theorem seq_eq_filter_seq {α β : Type u} (f : Filter (α → β)) (g : Filter α) :
    f <*> g = seq f g :=
  rfl
Applicative Composition Equals Sequential Composition for Filters
Informal description
For any filters $f$ on functions from $\alpha$ to $\beta$ and $g$ on $\alpha$, the applicative composition $f \mathbin{<*>} g$ is equal to the sequential composition $\text{seq } f \ g$.
Filter.instLawfulApplicative instance
: LawfulApplicative (Filter : Type u → Type u)
Full source
instance : LawfulApplicative (Filter : Type u → Type u) where
  map_pure := map_pure
  seqLeft_eq _ _ := rfl
  seqRight_eq _ _ := rfl
  seq_pure := seq_pure
  pure_seq := pure_seq_eq_map
  seq_assoc := seq_assoc
Filters Form a Lawful Applicative Functor
Informal description
The `Filter` type constructor forms a lawful applicative functor, meaning it satisfies the applicative functor laws: 1. Identity: For any filter $f$, $\text{pure } \text{id} \mathbin{\text{seq}} f = f$. 2. Composition: For any filters $f$, $g$, and $h$, the composition law holds as described in `Filter.seq_assoc`. 3. Homomorphism: For any function $g$ and element $a$, $\text{pure } g \mathbin{\text{seq}} \text{pure } a = \text{pure } (g a)$. 4. Interchange: For any filter $f$ and element $a$, $f \mathbin{\text{seq}} \text{pure } a = \text{map } (\lambda g, g a) f$.
Filter.instCommApplicative instance
: CommApplicative (Filter : Type u → Type u)
Full source
instance : CommApplicative (Filter : Type u → Type u) :=
  ⟨fun f g => prod_map_seq_comm f g⟩
Commutative Applicative Structure on Filters
Informal description
The `Filter` type constructor forms a commutative applicative functor, meaning that for any filters $f$ on $\alpha$ and $g$ on $\beta$, the sequential composition of the mapped pairing functions commutes: $$ \text{seq}(\text{map } \text{Prod.mk } f) \ g = \text{seq}(\text{map } (\lambda b a \mapsto (a, b)) g) \ f $$
Filter.eventually_bind theorem
{f : Filter α} {m : α → Filter β} {p : β → Prop} : (∀ᶠ y in bind f m, p y) ↔ ∀ᶠ x in f, ∀ᶠ y in m x, p y
Full source
@[simp]
theorem eventually_bind {f : Filter α} {m : α → Filter β} {p : β → Prop} :
    (∀ᶠ y in bind f m, p y) ↔ ∀ᶠ x in f, ∀ᶠ y in m x, p y :=
  Iff.rfl
Equivalence for Eventually Property under Filter Bind
Informal description
For a filter $f$ on a type $\alpha$, a function $m : \alpha \to \text{Filter } \beta$, and a predicate $p : \beta \to \text{Prop}$, the following equivalence holds: \[ (\forallᶠ y \text{ in } \text{bind } f \, m, \, p y) \leftrightarrow (\forallᶠ x \text{ in } f, \, \forallᶠ y \text{ in } m x, \, p y). \] This means that $p$ holds eventually in the bind of $f$ and $m$ if and only if for almost all $x$ in $f$, $p$ holds eventually in $m x$.
Filter.eventuallyEq_bind theorem
{f : Filter α} {m : α → Filter β} {g₁ g₂ : β → γ} : g₁ =ᶠ[bind f m] g₂ ↔ ∀ᶠ x in f, g₁ =ᶠ[m x] g₂
Full source
@[simp]
theorem eventuallyEq_bind {f : Filter α} {m : α → Filter β} {g₁ g₂ : β → γ} :
    g₁ =ᶠ[bind f m] g₂g₁ =ᶠ[bind f m] g₂ ↔ ∀ᶠ x in f, g₁ =ᶠ[m x] g₂ :=
  Iff.rfl
Equivalence of Eventual Equality under Filter Bind
Informal description
For any filter $f$ on a type $\alpha$, any function $m : \alpha \to \text{Filter } \beta$, and any two functions $g_1, g_2 : \beta \to \gamma$, the functions $g_1$ and $g_2$ are eventually equal with respect to the filter $\text{bind } f m$ if and only if for almost all $x$ in $f$, the functions $g_1$ and $g_2$ are eventually equal with respect to the filter $m(x)$. In symbols: $$ g_1 =_{f \mathbin{>>=} m} g_2 \iff \forall^f x, g_1 =_{m(x)} g_2 $$
Filter.eventuallyLE_bind theorem
[LE γ] {f : Filter α} {m : α → Filter β} {g₁ g₂ : β → γ} : g₁ ≤ᶠ[bind f m] g₂ ↔ ∀ᶠ x in f, g₁ ≤ᶠ[m x] g₂
Full source
@[simp]
theorem eventuallyLE_bind [LE γ] {f : Filter α} {m : α → Filter β} {g₁ g₂ : β → γ} :
    g₁ ≤ᶠ[bind f m] g₂g₁ ≤ᶠ[bind f m] g₂ ↔ ∀ᶠ x in f, g₁ ≤ᶠ[m x] g₂ :=
  Iff.rfl
Eventually Less-Than-Or-Equal Relation under Filter Bind
Informal description
Let $\gamma$ be a type equipped with a less-than-or-equal relation $\leq$, and let $f$ be a filter on a type $\alpha$. Given functions $m : \alpha \to \text{Filter } \beta$ and $g_1, g_2 : \beta \to \gamma$, the relation $g_1 \leqᶠ[\text{bind } f \, m] g_2$ holds if and only if for all $x$ in some set belonging to $f$, the relation $g_1 \leqᶠ[m \, x] g_2$ holds. In other words, $g_1$ is eventually less than or equal to $g_2$ with respect to the bind of $f$ and $m$ if and only if for almost all $x$ (with respect to $f$), $g_1$ is eventually less than or equal to $g_2$ with respect to $m(x)$.
Filter.mem_bind' theorem
{s : Set β} {f : Filter α} {m : α → Filter β} : s ∈ bind f m ↔ {a | s ∈ m a} ∈ f
Full source
theorem mem_bind' {s : Set β} {f : Filter α} {m : α → Filter β} :
    s ∈ bind f ms ∈ bind f m ↔ { a | s ∈ m a } ∈ f :=
  Iff.rfl
Characterization of Membership in Filter Bind Operation
Informal description
For any set $s \subseteq \beta$, a filter $f$ on $\alpha$, and a function $m : \alpha \to \text{Filter } \beta$, the set $s$ belongs to the filter $\text{bind } f m$ if and only if the set $\{a \in \alpha \mid s \in m(a)\}$ belongs to $f$.
Filter.mem_bind theorem
{s : Set β} {f : Filter α} {m : α → Filter β} : s ∈ bind f m ↔ ∃ t ∈ f, ∀ x ∈ t, s ∈ m x
Full source
@[simp]
theorem mem_bind {s : Set β} {f : Filter α} {m : α → Filter β} :
    s ∈ bind f ms ∈ bind f m ↔ ∃ t ∈ f, ∀ x ∈ t, s ∈ m x :=
  calc
    s ∈ bind f m ↔ { a | s ∈ m a } ∈ f := Iff.rfl
    _ ↔ ∃ t ∈ f, t ⊆ { a | s ∈ m a }calc
    s ∈ bind f m ↔ { a | s ∈ m a } ∈ f := Iff.rfl
    _ ↔ ∃ t ∈ f, t ⊆ { a | s ∈ m a } := exists_mem_subset_iff.symm
    _ ↔ ∃ t ∈ f, ∀ x ∈ t, s ∈ m x := Iff.rfl
Characterization of Membership in Filter Bind Operation
Informal description
For any set $s \subseteq \beta$, a filter $f$ on $\alpha$, and a function $m : \alpha \to \text{Filter } \beta$, the set $s$ belongs to the filter $\text{bind } f m$ if and only if there exists a set $t \in f$ such that for every $x \in t$, the set $s$ belongs to the filter $m(x)$.
Filter.bind_le theorem
{f : Filter α} {g : α → Filter β} {l : Filter β} (h : ∀ᶠ x in f, g x ≤ l) : f.bind g ≤ l
Full source
theorem bind_le {f : Filter α} {g : α → Filter β} {l : Filter β} (h : ∀ᶠ x in f, g x ≤ l) :
    f.bind g ≤ l :=
  join_le <| eventually_map.2 h
Monotonicity of Filter Bind Operation with Respect to Pointwise Bounds
Informal description
For any filter $f$ on a type $\alpha$, any function $g : \alpha \to \text{Filter } \beta$, and any filter $l$ on $\beta$, if for eventually every $x$ in $f$ we have $g(x) \leq l$, then the bind operation $\text{bind } f g$ is less than or equal to $l$.
Filter.bind_mono theorem
{f₁ f₂ : Filter α} {g₁ g₂ : α → Filter β} (hf : f₁ ≤ f₂) (hg : g₁ ≤ᶠ[f₁] g₂) : bind f₁ g₁ ≤ bind f₂ g₂
Full source
@[mono]
theorem bind_mono {f₁ f₂ : Filter α} {g₁ g₂ : α → Filter β} (hf : f₁ ≤ f₂) (hg : g₁ ≤ᶠ[f₁] g₂) :
    bind f₁ g₁ ≤ bind f₂ g₂ := by
  refine le_trans (fun s hs => ?_) (join_mono <| map_mono hf)
  simp only [mem_join, mem_bind', mem_map] at hs ⊢
  filter_upwards [hg, hs] with _ hx hs using hx hs
Monotonicity of Filter Bind Operation with Respect to Filter and Function Ordering
Informal description
For any two filters $f_1$ and $f_2$ on a type $\alpha$ and any two functions $g_1, g_2 : \alpha \to \text{Filter } \beta$, if $f_1 \leq f_2$ and $g_1 \leq g_2$ eventually with respect to $f_1$ (i.e., $\{x \mid g_1(x) \leq g_2(x)\} \in f_1$), then the bind operation satisfies $\text{bind } f_1 g_1 \leq \text{bind } f_2 g_2$.
Filter.bind_inf_principal theorem
{f : Filter α} {g : α → Filter β} {s : Set β} : (f.bind fun x => g x ⊓ 𝓟 s) = f.bind g ⊓ 𝓟 s
Full source
theorem bind_inf_principal {f : Filter α} {g : α → Filter β} {s : Set β} :
    (f.bind fun x => g x ⊓ 𝓟 s) = f.bind g ⊓ 𝓟 s :=
  Filter.ext fun s => by simp only [mem_bind, mem_inf_principal]
Interaction between bind, infimum, and principal filter: $\text{bind } f (\lambda x, g(x) \sqcap \text{principal } s) = (\text{bind } f g) \sqcap \text{principal } s$
Informal description
For any filter $f$ on a type $\alpha$, any function $g : \alpha \to \text{Filter } \beta$, and any subset $s \subseteq \beta$, the bind operation of $f$ with the function $\lambda x, g(x) \sqcap \text{principal } s$ is equal to the infimum of the bind operation of $f$ with $g$ and the principal filter generated by $s$. In symbols: \[ \text{bind } f (\lambda x, g(x) \sqcap \text{principal } s) = (\text{bind } f g) \sqcap \text{principal } s \]
Filter.sup_bind theorem
{f g : Filter α} {h : α → Filter β} : bind (f ⊔ g) h = bind f h ⊔ bind g h
Full source
theorem sup_bind {f g : Filter α} {h : α → Filter β} : bind (f ⊔ g) h = bindbind f h ⊔ bind g h := rfl
Supremum Distributes Over Bind Operation on Filters
Informal description
For any two filters $f$ and $g$ on a type $\alpha$ and any function $h : \alpha \to \text{Filter } \beta$, the bind operation applied to the supremum of $f$ and $g$ with $h$ is equal to the supremum of the bind operations of $f$ with $h$ and $g$ with $h$. In symbols: \[ \text{bind } (f \sqcup g) h = (\text{bind } f h) \sqcup (\text{bind } g h) \]
Filter.principal_bind theorem
{s : Set α} {f : α → Filter β} : bind (𝓟 s) f = ⨆ x ∈ s, f x
Full source
theorem principal_bind {s : Set α} {f : α → Filter β} : bind (𝓟 s) f = ⨆ x ∈ s, f x :=
  show join (map f (𝓟 s)) = ⨆ x ∈ s, f x by
    simp only [sSup_image, join_principal_eq_sSup, map_principal, eq_self_iff_true]
Bind of Principal Filter Equals Supremum of Filters over Set
Informal description
For any set $s \subseteq \alpha$ and any function $f : \alpha \to \text{Filter } \beta$, the bind operation applied to the principal filter generated by $s$ and $f$ is equal to the supremum of $f(x)$ over all $x \in s$. In symbols: \[ \text{bind } (\mathcal{P}(s)) f = \bigsqcup_{x \in s} f(x). \]
Filter.map_surjOn_Iic_iff_le_map theorem
{m : α → β} : SurjOn (map m) (Iic F) (Iic G) ↔ G ≤ map m F
Full source
theorem Filter.map_surjOn_Iic_iff_le_map {m : α → β} :
    SurjOnSurjOn (map m) (Iic F) (Iic G) ↔ G ≤ map m F := by
  refine ⟨fun hm ↦ ?_, fun hm ↦ ?_⟩
  · rcases hm right_mem_Iic with ⟨H, (hHF : H ≤ F), rfl⟩
    exact map_mono hHF
  · have : RightInvOn (F ⊓ comap m ·) (map m) (Iic G) :=
      fun H (hHG : H ≤ G) ↦ by simpa [Filter.push_pull] using hHG.trans hm
    exact this.surjOn fun H _ ↦ mem_Iic.mpr inf_le_left
Surjectivity of Filter Map on Intervals vs. Filter Inequality: $\text{SurjOn } m_* (-\infty, F] \, (-\infty, G] \leftrightarrow G \leq m_*(F)$
Informal description
For any function $m : \alpha \to \beta$ and filters $F$ on $\alpha$ and $G$ on $\beta$, the map operation $\text{map } m$ is surjective from the set of filters contained in $F$ to the set of filters contained in $G$ if and only if $G$ is less than or equal to $\text{map } m F$. In symbols: \[ \text{SurjOn } (\text{map } m) \, (-\infty, F] \, (-\infty, G] \leftrightarrow G \leq \text{map } m F \]
Filter.map_surjOn_Iic_iff_surjOn theorem
{s : Set α} {t : Set β} {m : α → β} : SurjOn (map m) (Iic <| 𝓟 s) (Iic <| 𝓟 t) ↔ SurjOn m s t
Full source
theorem Filter.map_surjOn_Iic_iff_surjOn {s : Set α} {t : Set β} {m : α → β} :
    SurjOnSurjOn (map m) (Iic <| 𝓟 s) (Iic <| 𝓟 t) ↔ SurjOn m s t := by
  rw [map_surjOn_Iic_iff_le_map, map_principal, principal_mono, SurjOn]
Surjectivity of Filter Map on Principal Filters vs. Surjectivity on Sets
Informal description
For any sets $s \subseteq \alpha$ and $t \subseteq \beta$, and any function $m : \alpha \to \beta$, the map operation $\text{map } m$ is surjective from the set of filters contained in the principal filter generated by $s$ to the set of filters contained in the principal filter generated by $t$ if and only if $m$ is surjective from $s$ to $t$. In symbols: \[ \text{SurjOn } (\text{map } m) \, (-\infty, \mathcal{P}(s)] \, (-\infty, \mathcal{P}(t)] \leftrightarrow \text{SurjOn } m \, s \, t \]
Filter.filter_injOn_Iic_iff_injOn theorem
{s : Set α} {m : α → β} : InjOn (map m) (Iic <| 𝓟 s) ↔ InjOn m s
Full source
theorem Filter.filter_injOn_Iic_iff_injOn {s : Set α} {m : α → β} :
    InjOnInjOn (map m) (Iic <| 𝓟 s) ↔ InjOn m s := by
  refine ⟨fun hm x hx y hy hxy ↦ ?_, fun hm F hF G hG ↦ ?_⟩
  · rwa [← pure_injective.eq_iff, ← map_pure, ← map_pure, hm.eq_iff, pure_injective.eq_iff]
      at hxy <;> rwa [mem_Iic, pure_le_principal]
  · simp [map_eq_map_iff_of_injOn (le_principal_iff.mp hF) (le_principal_iff.mp hG) hm]
Injectivity of Filter Map on Principal Filters vs. Injectivity on Sets: $\text{InjOn } (\text{map } m) \, (-\infty, \mathcal{P}s] \leftrightarrow \text{InjOn } m \, s$
Informal description
For any set $s \subseteq \alpha$ and any function $m : \alpha \to \beta$, the function $\text{map } m$ is injective on the collection of filters contained in the principal filter generated by $s$ if and only if $m$ is injective on $s$. In symbols: $$\text{InjOn } (\text{map } m) \, (-\infty, \mathcal{P}s] \leftrightarrow \text{InjOn } m \, s$$