Pure Lean 4 · No Mathlib
MediumData Structures
58. Functorial Composition of Tree Map
Prove the functor composition law for binary trees: mapping `g` over a tree and then mapping `f` over the result equals mapping the composite function `fun x => f (g x)` in one pass. Keep `BinTree` and `treeMap` unchanged.
Target Theorem
theorem tree_map_comp {α β γ : Type} (f : β → γ) (g : α → β) (t : BinTree α) : treeMap f (treeMap g t) = treeMap (fun x => f (g x)) tHints (0/3)
Stuck? Reveal hints one step at a time without spoiling the full proof.
Symbols:
Infoview & Diagnosticsline 1idle
Write your proof above and click Submit Proof (or open in live.lean-lang.org).