Bava Basra, Chapter 3, Mishnah 4. This Mishnah deals with the laws of eidim zomemim (conspiring witnesses), and to understand it, some background is required.
Who are Eidim Zomemim:
Eidim zomemim are witnesses who are discovered to have conspired, and it is proven that they were dishonest in their testimony - in a very specific way. Let us assume that two witnesses, we will call them Ernie and Bert, come to give testimony against a defendant, whom we will call Johnny. They might claim that Johnny owes one hundred dollars for something he stole or broke, or even more severe testimony, such as that Johnny is liable for the death penalty for having desecrated Shabbos.
Now another pair of witnesses arrives - let us call them the 'Justice League', as they are fighting for the truth. They do not come to contradict the content of the testimony, which would merely be a contradiction, but rather they address the witnesses themselves and say: "You cannot give this testimony, and it cannot possibly be true, because at the time of the incident you were with us somewhere else, in Honolulu". This type of claim, stating that the witnesses could not possibly have testified because they were not there, is called hazamah, and those who testify in this way are called eidim zomemim.
The Law of "Va'asisem Lo Ka'asher Zamam":
If the court has already accepted their testimony and finalized the verdict based upon it, but it has not yet been carried out - the verse teaches: "Va'asisem lo ka'asher zamam la'asos le'achiv" - you shall do to him as he conspired to do to his brother: we do to Ernie and Bert what they conspired to do to their fellow Jew, innocent Johnny. If they sought to obligate him to pay one hundred dollars, they themselves will each pay Johnny fifty dollars, one hundred dollars in total. This is the general concept of eidim zomemim.
Two 'All or Nothing' Principles:
In the law of hazamah: In addition to the conditions listed, the law of eidim zomemim is an all or nothing matter: the entire testimony must be proven false through hazamah. The 'Justice League' cannot say "Ernie was with us in Honolulu, but regarding Bert we do not know", rather they must refute both of them. If only Ernie was refuted, Bert's testimony is left alone, and the testimony of one witness is not enough to obligate the defendant; nevertheless, Ernie pays nothing, because the law of 'as he conspired' applies only when the entire testimony is refuted. This principle is derived from the verse.
In the general law of testimony: It is stated, "By the mouth of two witnesses... shall a matter be established" - halachic facts are established in court by two witnesses, and whatever they say is accepted as reality. The Sages expounded: "A matter - and not half a matter". Testimony must describe a complete and full halachic phenomenon; it cannot be partial, and we do not combine two half-testimonies into one complete testimony.
However, our Mishnah teaches that the parameter of 'all or nothing' in the law of hazamah is different from its parameter in the law of "by the mouth of two witnesses shall a matter be established", which requires testimony on a complete fact. The bar for the general law of testimony is lower.
Application in the Three-Year Chazakah:
As we have learned, establishing a chazakah for houses and establishing a chazakah of ownership requires the possessor to be present in the property and benefit from it for three years - that he consumes its produce, its grain, or its income. Therefore, testimony is required regarding three years of consuming the produce, and combined with the fact that the original owner (mara kama) did not protest until now, we say that the current possessor is the rightful owner.
It turns out, according to the Mishnah, that if three pairs of witnesses came - one pair for the first year, one pair for the second, and one pair for the third - even though the three testimonies must be combined to reach the conclusion that the possessor has a chazakah by virtue of his presence for three years, the testimony for each year stands on its own and is a complete halachic 'matter' that can be testified upon. Therefore, the testimony of three pairs of witnesses regarding three separate years is acceptable.
However, regarding hazamah (proving witnesses to be conspiring), the rule is all or nothing: either all three sets of witnesses are proven false, or none are. If only some of them are proven false - the testimony is indeed disqualified and the chazakah will not be established, but the condition to obligate the conspirators with the law of "as he conspired" (ka'asher zamam) and impose a financial penalty on them has not been met. This asymmetry, between the "all or nothing" of a complete "matter" and the "all or nothing" of the condition for hazamah, leads to surprising results, and these are what the Mishnah comes to highlight.
"Hayu shenayim me'idin oto she'achlah shalosh shanim, venimtse'u zomemin - meshalmin lo et hakol" - If two witnesses testified about him that he consumed its produce for three years, and they were found to be zomemim, they pay him everything. One pair of witnesses, Ernie and Bert, testified that the current possessor consumed the produce for three consecutive years, and the "Justice League" came and proved them false, since at the time of the alleged event they were with them in Honolulu. In this case, the two pay the full damage they sought to cause. Suppose the field is worth six million dollars: according to their testimony, the possessor would have acquired the field, and the mara kamma (original owner) would have lost his field. Therefore, each of the two will pay three million dollars to the mara kamma as a penalty - six million in total - and this is in addition to the mara kamma receiving his field back.
"Shenayim barishonah, shenayim bashniyah, shenayim bashlishit - meshalshin beineihem" - Two [witnesses testified] about the first [year], two about the second, and two about the third - they divide [the payment] into thirds among themselves. If three pairs of conspiring witnesses came, each pair testifying about a different year, and they were all proven false (whether by one group of the "Justice League" or by three groups, each refuting a different pair, testifying that those witnesses were with them elsewhere during the entire harvest season and could not have testified about him) - the payment is divided into thirds among them: the six million dollars are divided among the six witnesses, and each of them pays one million dollars to the mara kamma, in addition to the return of the six-million-dollar field to his hands.
Three brothers and one joining them:
A separate rule is that relatives are invalid for testimony, and two brothers cannot join together for a single testimony. However, since each of the three years is an independent "matter", three brothers can testify about three separate years. How so? Reuven, Shimon, and Levi are three brothers, and in addition to them is Moshe, who is not their relative. Moshe testifies with Reuven about the first year, with Shimon about the second year, and with Levi about the third year - and thus we have testimony for three years. The novel point here is that even though they are brothers, their testimony is valid in this case, for they are not testifying about one "matter" but rather about three separate and distinct matters.
"Sheloshah achim ve'echad mitstaref imahem - harei elu shalosh eduyot, vehen edut achat lehazamah" - Three brothers and one who joins with them - these are three testimonies, but they are one testimony regarding hazamah. The testimony of Moshe and Reuven regarding the first year, of Moshe and Shimon regarding the second, and of Moshe and Levi regarding the third are considered three separate testimonies, and they are all accepted. However, regarding hazamah, they are one testimony, and its law is all or nothing. If the "Justice League" testifies that Moshe alone was with them elsewhere during all those years, none of them will be liable for payment; but if they prove that all four of them were elsewhere and could not have testified, they all pay: Reuven one million, Shimon one million, and Levi one million, while Moshe - who was a partner in three separate testimonies - pays three million. In total, six million dollars to the mara kamma, in addition to the return of his field to his hands.
In summary: In this Mishnah, we learned the definition of zomemim witnesses - witnesses who were proven false through the claim that they were not at the scene of the event at all - and the law of "you shall do to him as he conspired to do" (ka'asher zamam). We discussed two principles of "all or nothing": regarding hazamah, the entire testimony must be proven false, and regarding the law of testimony, a complete "matter and not half a matter" is required. From this arose the asymmetry in the chazakah of three years: each year is an independent "matter", and therefore three separate testimonies are valid, and even the testimony of three brothers with whom another joins; however, regarding hazamah they are all one testimony, and there is no obligation to pay unless they are all proven false.