Skip to content

Commit

Permalink
chore(data/list/basic): Add pmap_map (#5081)
Browse files Browse the repository at this point in the history
Co-authored-by: zhangir-azerbayev <zazerbayev@gmail.com>
  • Loading branch information
eric-wieser and zhangir-azerbayev committed Nov 22, 2020
1 parent 7f4286c commit 2252c3a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/data/list/basic.lean
Expand Up @@ -2533,6 +2533,10 @@ theorem map_pmap {p : α → Prop} (g : β → γ) (f : Π a, p a → β)
(l H) : map g (pmap f l H) = pmap (λ a h, g (f a h)) l H :=
by induction l; [refl, simp only [*, pmap, map]]; split; refl

theorem pmap_map {p : β → Prop} (g : ∀ b, p b → γ) (f : α → β)
(l H) : pmap g (map f l) H = pmap (λ a h, g (f a) h) l (λ a h, H _ (mem_map_of_mem _ h)) :=
by induction l; [refl, simp only [*, pmap, map]]; split; refl

theorem pmap_eq_map_attach {p : α → Prop} (f : Π a, p a → β)
(l H) : pmap f l H = l.attach.map (λ x, f x.1 (H _ x.2)) :=
by rw [attach, map_pmap]; exact pmap_congr l (λ a h₁ h₂, rfl)
Expand Down

0 comments on commit 2252c3a

Please sign in to comment.