law foldr_map

bend-mathlib@0.8.1.0 · list.bend:1302

import bend-mathlib@0.8.1.0/list.bend as List
import Base

1302# A right fold over a map folds with the mapped function: foldr g z (map f xs) = foldr (g . f) z xs.
1303law foldr_map:
1304  for ~A: Type
1305  for ~B: Type
1306  for ~C: Type
1307  for ~f: A -> B
1308  for ~g: B -> C -> C
1309  for xs: List<A>
1310  for -z: C
1311  {List.foldr(~&1, ~B, ~C, ~g, List.map(~A, ~B, ~f, xs), z) == List.foldr(~&1, ~A, ~C, ~(x => y => g(f(x), y)), xs, z) : C}

Uses (3)

Used by (1)