Halacha

הלכה א
שְׁנַּיִם שֶׁהֵעִידוּ וְאָמְרוּ בְּמִזְרַח הַבִּירָה הָרַג זֶה אֶת הַנֶּפֶשׁ בְּשָׁעָה פְּלוֹנִית וּבָאוּ שְׁנַיִם וְאָמְרוּ לָהֶן בְּמַעֲרַב הַבִּירָה הַזֹּאת הֱיִיתֶם עִמָּנוּ בָּעֵת הַזֹּאת. אִם יָכוֹל הָעוֹמֵד בְּמַעֲרָב לִרְאוֹת מַה שֶּׁבַּמִּזְרָח אֵינָן זוֹמְמִין. וְאִם אֵינוֹ יָכוֹל לִרְאוֹת הֲרֵי אֵלּוּ זוֹמְמִין וְאֵין אוֹמְרִין שֶׁמָּא מְאוֹר עֵינֵיהֶם שֶׁל רִאשׁוֹנִים רַב וְרוֹאִין מֵרָחוֹק יֶתֶר מִכָּל אָדָם. וְכֵן אִם הֵעִידוּ שְׁנַיִם וְאָמְרוּ בַּבֹּקֶר הָרַג זֶה אֶת הַנֶּפֶשׁ בִּירוּשָׁלַיִם וּבָאוּ שְׁנַיִם וְאָמְרוּ לָהֶן בְּיוֹם זֶה בָּעֶרֶב הֱיִיתֶם עִמָּנוּ בְּלוּד. אִם יָכוֹל אָדָם לְהַלֵּךְ אֲפִלּוּ עַל הַסּוּס מִירוּשָׁלַיִם לְלוּד מִבֹּקֶר עַד עֶרֶב אֵינָן זוֹמְמִין וְאִם לָאו הֲרֵי אֵלּוּ זוֹמְמִין וְאֵין אוֹמְרִין שֶׁמָּא כַּר קַל בְּיוֹתֵר נִזְדַּמֵּן לָהֶן וְקִפְּלוּ אֶת הַדֶּרֶךְ אֶלָּא בְּדָבָר הַמָּצוּי הַיָּדוּעַ לַכּל מְשַׁעֲרִין לְעוֹלָם וּמְזִימִין אוֹתָן:
כסף משנה
1.
The following rules apply when two witnesses testify, saying: "So-and-so murdered a person in the eastern portion of the hall at this-and-this time," two other witnesses came and said: "You were together with us in the western portion of the hall at that time." If a person standing in the western portion could see what transpires in the eastern portion, they are not disqualified through hazamah. If, however, it is impossible to see what transpires, they are disqualified through hazamah. We do not say perhaps the eyesight of the first pair is very powerful and they can see things which transpire at a greater distance than all other men.
Similar principles apply if two people testified saying: "In the morning, so-and-so committed murder in Jerusalem," and two others come and tell them: "On that day, in the evening, you were together with us in Lod." If it is possible for a person to travel, even on horseback, from Jerusalem to Lod from the morning to the evening, they are not disqualified through hazamah. If not, they are disqualified through hazamah. We do not say perhaps they found a speedy camel and were able to travel the route faster than usual. Instead, we always calculate the matter using according to the known standards and disqualify them through hazamah.

הלכה ב
שְׁנַיִם שֶׁאָמְרוּ בְּאֶחָד בְּשַׁבָּת הָרַג זֶה אֶת הַנֶּפֶשׁ בְּמָקוֹם פְּלוֹנִי וּבָאוּ שְׁנַיִם וְאָמְרוּ בְּיוֹם זֶה עִמָּנוּ הֱיִיתֶם בְּמָקוֹם אַחֵר רָחוֹק אֲבָל בַּיּוֹם שֶׁלְּאַחַר יוֹם זֶה הֲרָגוֹ בְּוַדַּאי אֲפִלּוּ הֵעִידוּ הָאַחֲרוֹנִים שֶׁקֹּדֶם כַּמָּה יָמִים הֲרָגוֹ הֲרֵי זֶה הַהוֹרֵג עִם עֵדָיו הָרִאשׁוֹנִים נֶהֱרָגִין שֶׁהֲרֵי הוּזְמוּ. שֶׁבְּעֵת שֶׁהֵעִידוּ שֶׁהָרַג עֲדַיִן לֹא נִגְמַר דִּינוֹ לֵהָרֵג. אֲבָל בָּאוּ שְׁנֵי עֵדִים בִּשְׁלִישִׁי בְּשַׁבָּת וְאָמְרוּ בְּאֶחָד בְּשַׁבָּת נִגְמַר דִּינוֹ שֶׁל פְּלוֹנִי לַהֲרִיגָה וּבָאוּ שְׁנַיִם וְאָמְרוּ בְּאֶחָד בְּשַׁבָּת עִמָּנוּ הֱיִיתֶם בְּמָקוֹם פְּלוֹנִי הָרָחוֹק אֶלָּא מֵעֶרֶב שַׁבָּת אוֹ בְּשֵׁנִי בְּשַׁבָּת נִגְמַר דִּינוֹ. אֵין עֵדִים אֵלּוּ שֶׁהוּזַמּוּ נֶהֱרָגִין שֶׁהֲרֵי מִכָּל מָקוֹם בְּעֵת שֶׁהֵעִידוּ עָלָיו כְּבָר נִגְמַר דִּינוֹ לַהֲרִיגָה. וְכֵן לְעִנְיַן תַּשְׁלוּמֵי קְנָס. כֵּיצַד. בָּאוּ שְׁנַיִם בִּשְׁלִישִׁי בְּשַׁבָּת וְאָמְרוּ בְּאֶחָד בְּשַׁבָּת גָּנַב וְטָבַח וְנִגְמַר דִּינוֹ וּבָאוּ שְׁנַיִם וְאָמְרוּ בְּאֶחָד בְּשַׁבָּת עִמָּנוּ הֱיִיתֶם בְּמָקוֹם רָחוֹק אֲבָל בְּעֶרֶב שַׁבָּת נִגְמַר דִּינוֹ. אֲפִלּוּ אָמְרוּ [בְּאֶחָד] בְּשַׁבָּת גָּנַב וְטָבַח וּמָכַר וּבְשֵׁנִי בְּשַׁבָּת נִגְמַר דִּינוֹ אֵין עֵדִים אֵלּוּ שֶׁהוּזַמּוּ מְשַׁלְּמִין שֶׁהֲרֵי מִכָּל מָקוֹם בְּעֵת שֶׁהֵעִידוּ עָלָיו חַיָּב הָיָה לְשַׁלֵּם. וְכֵן כָּל כַּיּוֹצֵא בָּזֶה:
כסף משנה
2.
The following rules apply when two witnesses state: "On Sunday, so-and-so murdered a person in this-and-this place," and two other witnesses came and said: "On that date, you were together with us in another far removed place, but so-and-so certainly murdered the victim on the following day," the murderer and the first pair of witnesses are executed. Even if the second pair of witnesses testify that he committed the murder several days previously,the above laws apply. The rationale is that at the time they delivered testimony, the murderer had not yet been sentenced to death.
If, however, two witnesses come on Tuesday, and say: "On Sunday, so-and-so was sentenced to death," and two others come on Tuesday and say: "On Sunday, you were together with us in this distant place, but so-and-so was sentenced to death on Friday or on Monday," these witnesses are not executed. The rationale is that at the time they testified, the person had already been sentenced to death.
Similar principles apply with regard to the payment of a fine. What is implied? Two people came on Tuesday and said: "On Sunday, so-and-so stole, slaughtered the animal he stole, and was sentenced to pay a fine of four or five times the animal's worth." Two other witnesses come and testify: "On Sunday, you were with us in a distant place, but he was sentenced on Friday" - or even if they said: "On Sunday, so-and-so stole, slaughtered the animal he stole, and was sentenced on Monday," the witnesses who were disqualified through hazamah are not required to make financial restitution. The rationale is that at the time they testified against him, the defendant was obligated to make financial restitution. Similar laws apply in all analogous situations.

הלכה ג
אֵין עֵדֵי הַשְּׁטָר נַעֲשִׂין זוֹמְמִין עַד שֶׁיֹּאמְרוּ בְּבֵית דִּין שְׁטָר זֶה בִּזְמַנּוֹ כְּתַבְנוּהוּ וְלֹא אִחַרְנוּהוּ. אֲבָל אִם לֹא אָמְרוּ כֵּן אַף עַל פִּי שֶׁזְּמַנּוֹ שֶׁל שְׁטָר בְּאֶחָד בְּנִיסָן בִּירוּשָׁלַיִם וּבָאוּ עֵדִים וְהֵעִידוּ שֶׁעֵדֵי הַשְּׁטָר הָיוּ עִמָּהֶם בְּבָבֶל בְּיוֹם זֶה. הַשְּׁטָר כָּשֵׁר וְהָעֵדִים כְּשֵׁרִים שֶׁאֶפְשָׁר שֶׁכְּתָבוּהוּ וְאִחֲרוּהוּ וּכְשֶׁהָיוּ בִּירוּשָׁלַיִם בְּאֶחָד בַּאֲדָר כָּתְבוּ שְׁטָר זֶה שָׁם וְאִחֲרוּ זְמַנּוֹ וְכָתְבוּ זְמַנּוֹ בְּנִיסָן. אָמְרוּ בִּזְמַנּוֹ כְּתַבְנוּהוּ וְהוּזַמּוּ אִם יֵשׁ שָׁם עֵדִים שֶׁיּוֹדְעִים הַיּוֹם שֶׁחָתְמוּ עַל הַשְּׁטָר אוֹ עֵדִים שֶׁרָאוּ זֶה הַשְּׁטָר וַחֲתִימַת יָדָם בּוֹ בְּיוֹם פְּלוֹנִי. כֵּיוָן שֶׁהוּזַמּוּ הֲרֵי נִפְסְלוּ לְמַפְרֵעַ מִיּוֹם שֶׁנּוֹדַע שֶׁחָתְמוּ עַל הַשְּׁטָר. שֶׁהָעֵדִים הַחֲתוּמִים עַל הַשְּׁטָר הֲרֵי הֵן כְּמִי שֶׁנֶּחְקְרָה עֵדוּתָן בְּבֵית דִּין בְּעֵת הַחֲתִימָה. אֲבָל אִם אֵין עֵדִים שֶׁרָאוּ עֵדוּתָן וְלֹא רָאוּ הַשְּׁטָר מִקֹּדֶם אֵין נִפְסָלִין אֶלָּא מֵעֵת שֶׁהֵעִידוּ בְּבֵית דִּין שֶׁזֶּה כְּתַב יָדָן וְאָמְרוּ בִּזְמַנּוֹ כְּתַבְנוּהוּ וְאֶפְשָׁר שֶׁבְּיוֹם זֶה שֶׁהֵעִידוּ בְּבֵית דִּין בּוֹ בַּיּוֹם חָתְמוּ עַל הַשְּׁטָר שֶׁיֵּשׁ לוֹ כַּמָּה שָׁנִים וְהֵם שִׁקְּרוּ וְאָמְרוּ בִּזְמַנּוֹ כָּתַבְנוּ:
כסף משנה
3.
The witnesses to a legal document may not be disqualified through hazamah unless they testify in court, saying: "We composed the legal document at the time stated. We did not delay the dating of it." If they did not say this, even though a document composed in Jerusalem is dated the first of Nisan and witnesses come and testify that the witnesses to the legal document were in Babylon on that date, the legal document is acceptable and the witnesses are acceptable. For it is possible that they composed the legal document and postdated it, i.e., they were in Jerusalem on the first of Adar and composed the legal document and postdated it, dating it the first of Nisan.
The following rules apply when, by contrast, they said: "We signed the document on the date stated," and they were disqualified through hazamah. If there are witnesses who know the day they signed the legal document or witnesses saw the legal document with their signatures on it on this-and-this date, once they are disqualified through hazamah, they are disqualified retroactively from the date on which it is known that they signed the legal document. The rationale is that witnesses who sign a legal document are considered as if their testimony was delivered in court from the time they signed.
If, however, there are no witnesses who saw them sign, giving testimony, nor did any see the signed document beforehand, the witnesses are disqualified only from the time they testified in court that the signature was theirs, saying: "We signed it on that date." The rationale is that it is possible that on the date that they testified in court, they signed a legal document that had existed for many years and they lied by saying: "We signed it on the day it was dated."

שופטים הלכות עדות פרק יט
Shoftim Edus Chapter 19