File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -31,3 +31,8 @@ New modules
31
31
32
32
Additions to existing modules
33
33
-----------------------------
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) →
439
439
map-⊛ f g [] = refl
440
440
map-⊛ f g (x ∷ xs) = cong (f x (g x) ∷_) (map-⊛ f g xs)
441
441
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
+
442
457
toList-map : ∀ (f : A → B) (xs : Vec A n) →
443
458
toList (map f xs) ≡ List.map f (toList xs)
444
459
toList-map f [] = refl
You can’t perform that action at this time.
0 commit comments