∀ {α : Type u_1} [inst : BEq α] [LawfulBEq α] {a b : α} {xs : Array α} {p : α → Bool},
  Array.countP p (xs.replace a b) =
    if xs.contains a = true then (Array.countP p xs + if p b = true then 1 else 0) - if p a = true then 1 else 0
    else Array.countP p xs