File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -31,3 +31,8 @@ New modules
3131
3232Additions to existing modules
3333-----------------------------
34+
35+ * New lemma in ` Data.Vec.Properties ` :
36+ ``` agda
37+ map-concat : map f (concat xss) ≡ concat (map (map f) xss)
38+ ```
Original file line number Diff line number Diff line change @@ -439,6 +439,21 @@ map-⊛ : ∀ (f : A → B → C) (g : A → B) (xs : Vec A n) →
439439map-⊛ f g [] = refl
440440map-⊛ f g (x ∷ xs) = cong (f x (g x) ∷_) (map-⊛ f g xs)
441441
442+ map-concat : (f : A → B) (xss : Vec (Vec A m) n) →
443+ map f (concat xss) ≡ concat (map (map f) xss)
444+ map-concat f [] = refl
445+ map-concat f (xs ∷ xss) = begin
446+ map f (concat (xs ∷ xss))
447+ ≡⟨⟩
448+ map f (xs ++ concat xss)
449+ ≡⟨ map-++ f xs (concat xss) ⟩
450+ map f xs ++ map f (concat xss)
451+ ≡⟨ cong (map f xs ++_) (map-concat f xss) ⟩
452+ map f xs ++ concat (map (map f) xss)
453+ ≡⟨⟩
454+ concat (map (map f) (xs ∷ xss))
455+ ∎ where open ≡-Reasoning
456+
442457toList-map : ∀ (f : A → B) (xs : Vec A n) →
443458 toList (map f xs) ≡ List.map f (toList xs)
444459toList-map f [] = refl
You can’t perform that action at this time.
0 commit comments