According to the Mishna we need the second group of witnesses to deny the edim zomemin themselves, and not simply negate their testimony. Thus, if the second group of witnesses come to court and insist that the testimony of the first witnesses cannot be true because the accused was with them at that time, or because they saw the incident and it happened differently than the way it was described by the first group of witnesses, then we discount the testimony. Such witnesses are called edei hakḥashah – witnesses who refute testimony – and recognizing that there are different versions of the story we discount them both. Neither the accused nor the witnesses will be punished.
In order for witnesses to be considered edim zomemin who will receive the punishment that would have been given to the accused had he been convicted based on their testimony, the second group of witnesses must testify that they cannot be telling the truth because they were with them at the time of the alleged crime. This rule is not explained by the Mishna or the Gemara; it is a gezerat ha-katuv – a biblical ordinance.
Another unique rule in the laws of edim zomemin is that the punishment is only applied to the conspiring witnesses if it has not been carried out on the accused. If, however, he was already killed or already received lashes based on their testimony, then they will not receive that punishment. According to the Gemara the source for this is the passage in Sefer (19:20) that requires the court to give the edim zomemin the punishment that they wanted the accused to receive – not the punishment that he was actually given.
In his commentary on the Torah the Ramban explains this rule as stemming from the belief that God would not allow an innocent man to be punished in this way, so if he received the punishment it is an indication that he really did deserve the punishment. The Abravanel suggests that this law protects the court, and keeps the people from saying that the court cannot make up its mind and puts innocent people to death.