Makkot 15a begins by asking: Why did Rabbi Yohanan say something and then claim he did not say it? I don't understand the Gemara's answer to that question. Can anybody explain it to me?
Rabbi Yohanan originally made a statement that if anybody violates any negative commandment which is preceded by a positive commandment (לאו שקדמו עשה), everybody agrees that he would receive lashes as punishment.
Later on, he retracts this statement and the gemara asks why. The reason he retracts the statement is because of a difficulty. There is a beraisa that states that a non-kohein who divorces the woman he raped (the negative commandment is not to divorce her and the positive commandment that precedes it is the commandment to marry her) does not receive lashes. Rather, he is forced to re-marry the woman. This contradicts Rabbi Yohanan's original statement.
See Ritba who paraphrased the comment of Rashi in a very clear way.
אמרו לו אמרת פירש"י ז"ל אמרו לו לר׳ יוחנן אמרת להא דאמר תלמידך משמך? וא"ל ר׳ יוחנן לא ואמר רבה האלהים אמרה אלא שחוזר בו ולא היה צריך לחזור בו
They asked Rabbi Yochanan: "You said it?", regarding the rule that his student reported in his name. He answered: "No!". Rabba explained that when they asked him, it was after that Rabbi Yochanan changed his mind, i.e. he answered that he doesn't hold this rule is true. And Rabba explained that there was two steps in Rabbi Yochanan's opinion and they asked at the time of the second step. Further Rabba said that Rabbi Yochanan was not right when he changed his mind, because there are several proofs that his first mind was right. Rabbi Yochanan didn't say "I never said this".
The students when they asked Rabbi Yochanan, didn't know that there were two steps, so, their question was obviously of the type "Is it what you are teaching?". It was not an investigation.