∀ {α : Type u} {β : Type v} {x : BEq α} {x_1 : Hashable α} {m : Std.HashMap α β} [EquivBEq α] [LawfulHashable α] {k : α}
  {f : Option β → Option β},
  (m.alter k f).size =
    if k ∈ m ∧ (f m[k]?).isNone = true then m.size - 1
    else if k ∉ m ∧ (f m[k]?).isSome = true then m.size + 1 else m.size