Skip to content

Commit

Permalink
feat(order/filter/basic): allow functions between different types in …
Browse files Browse the repository at this point in the history
…lemmas about [co]map by a constant function (#13542)
  • Loading branch information
ADedecker committed Apr 20, 2022
1 parent d79f6f3 commit 311ca72
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/order/filter/basic.lean
Original file line number Diff line number Diff line change
Expand Up @@ -1622,19 +1622,19 @@ theorem preimage_mem_comap (ht : t ∈ g) : m ⁻¹' t ∈ comap m g :=
lemma comap_id : comap id f = f :=
le_antisymm (λ s, preimage_mem_comap) (λ s ⟨t, ht, hst⟩, mem_of_superset ht hst)

lemma comap_const_of_not_mem {x : α} {f : filter α} {V : set α} (hV : Vf) (hx : x ∉ V) :
comap (λ y : α, x) f = ⊥ :=
lemma comap_const_of_not_mem {x : β} (ht : tg) (hx : x ∉ t) :
comap (λ y : α, x) g = ⊥ :=
begin
ext W,
suffices : ∃ t ∈ f, (λ (y : α), x) ⁻¹' t ⊆ W, by simpa,
use [V, hV],
suffices : ∃ t ∈ g, (λ (y : α), x) ⁻¹' t ⊆ W, by simpa,
use [t, ht],
simp [preimage_const_of_not_mem hx],
end

lemma comap_const_of_mem {x : α} {f : filter α} (h : ∀ Vf, x ∈ V) : comap (λ y : α, x) f = ⊤ :=
lemma comap_const_of_mem {x : β} (h : ∀ tg, x ∈ t) : comap (λ y : α, x) g = ⊤ :=
begin
ext W,
suffices : (∃ (t : set α), t ∈ f ∧ (λ (y : α), x) ⁻¹' t ⊆ W) ↔ W = univ,
suffices : (∃ (t : set β), t ∈ g ∧ (λ (y : α), x) ⁻¹' t ⊆ W) ↔ W = univ,
by simpa,
split,
{ rintro ⟨V, V_in, hW⟩,
Expand All @@ -1644,7 +1644,7 @@ begin
simp [univ_mem] },
end

lemma map_const [ne_bot f] {c : α} : f.map (λ x, c) = pure c :=
lemma map_const [ne_bot f] {c : β} : f.map (λ x, c) = pure c :=
by { ext s, by_cases h : c ∈ s; simp [h] }

lemma comap_comap {m : γ → β} {n : β → α} : comap m (comap n f) = comap (n ∘ m) f :=
Expand Down

0 comments on commit 311ca72

Please sign in to comment.