∀ {α : Type u} {β : α → Type v} [inst : BEq α] [inst_1 : LawfulBEq α] {k : α} {f : Option (β k) → Option (β k)}
  {l : List ((a : α) × β a)},
  (Std.Internal.List.alterKey k f l).length =
    if h : Std.Internal.List.containsKey k l = true then
      if (f (some (Std.Internal.List.getValueCast k l h))).isSome = true then l.length else l.length - 1
    else if (f none).isSome = true then l.length + 1 else l.length