From Gospel Beyond Belief:
My proposal is that Jesus was only trying to teach Peter that his bravado was unwarranted and that Peter was not ready for the reality of the disappointment that the Kingdom of God was about suffering and not political onslaught. However, Jesus’ prediction was most likely not meant to be foretelling but was a strategic challenge to help Peter when the moment of the disappointment arrived. The importance of the prediction is not to show off Jesus’ predictive powers but for the nurturing of Peter. The open theist Greg Boyd has made the point that Jesus in the Gospel of John (chapter 21) alludes to Peter’s denials in order to teach him the real values of the Kingdom and that he predicted that Peter would follow him on the road of suffering and death. This episode helps tie together Jesus’ motive for saying what he did to Peter and what actually happened.
There is no reason why Jesus cannot use language in such a way as to challenge and there is no reason why Jesus cannot use language that is hyperbolic or figurative or whatever. It is my conjecture that Jesus’ prediction used an idiom and the purpose of the idiom was to communicate Jesus’ assurance that Peter would deny him. Jesus was only saying that he was sure Peter would deny him. Jesus was sure that Peter’s bravado was misplaced (because Peter believed in a political messiah?) and he was sure that there would be opportunity for Peter to deny him. At the same time, Jesus was sure Peter would try try to follow (albeit at a distance) because he knew Peter had deep feelings for Jesus. So, Jesus uttered his statement to Peter to warn him that his confidence was misplaced.