All Exercises
#42 Map Respects Function Composition
live.lean-lang.org
Pure Lean 4 · No Mathlib
EasyLists

42. Map Respects Function Composition

Prove the functor composition law for `List.map`: mapping `g` and then mapping `f` produces the same list as mapping the composite function `fun x => f (g x)` in one pass.

Target Theorem
theorem list_map_comp {α β γ : Type} (f : β → γ) (g : α → β) (xs : List α) : (xs.map g).map f = xs.map (fun x => f (g x))
Hints (0/2)

Stuck? Reveal hints one step at a time without spoiling the full proof.

Symbols:
Initializing Lean 4 editor…
Infoview & Diagnosticsline 1idle
Write your proof above and click Submit Proof (or open in live.lean-lang.org).