Tous les labs

Map identity over a list

2/4 ~25 minlean

Prove that mapping the identity function does not change a list.

3 lines · Lean 4
Vérifier dans Lean Web
Objectifs
  • Prove that mapping the identity function does not change a list.
Indices
Voir la solution
theorem map_id_local (xs : List α) :
    xs.map (fun x => x) = xs := by
  induction xs with
  | nil => rfl
  | cons x xs ih => simp [ih]