Wouldn’t that imply P != NP since otherwise there would be a counterexample?
No. It could be that there is an algorithm that solves some NP-complete problem in polynomial time, yet there is no proof that it does so. We could even find ourselves in the position of having discovered an algorithm that runs remarkably fast on all instances it’s applied to, practically enough to trash public-key cryptography, yet although it is in P we cannot prove it is, or even that it works.
No. It could be that there is an algorithm that solves some NP-complete problem in polynomial time, yet there is no proof that it does so. We could even find ourselves in the position of having discovered an algorithm that runs remarkably fast on all instances it’s applied to, practically enough to trash public-key cryptography, yet although it is in P we cannot prove it is, or even that it works.