Bava Batra 2:4
משנה: מִי שֶׁהָיָה כּוֹתְלוֹ סָמוּךְ לְכוֹתֶל חֲבֵירוֹ לֹא יִסְמוֹךְ לוֹ כוֹתֶל אַחֵר אֶלָּא אִם כֵּן הִרְחִיק מִמֶּנּוּ אַרְבַּע אַמּוֹת.
Mishnah: One whose wall was adjacent to his fellow's wall: he may not build another wall next to it unless he distances four cubits from it.
וּבַחֲלוֹנוֹת מִלְּמַעֲלָן וּמִלְּמַטָּן וּמִכְּנֶגְדָּן אַרְבַּע אַמּוֹת.
And for windows: from above them, from below them, and opposite them - four cubits.
הלכה: מִי שֶׁהָיָה כּוֹתְלוֹ כול׳.
Halachah: "One whose wall was" - etc.
דְּבֵי רִבִּי יַנַּאי אָמְרֵי.
The school of Rabbi Yanai says:
בְּבָאִין לְיַישֵּׁב עִיר בַּתְּחִילָּה הִיא מַתְנִיתָא.
The Mishnah refers to settlers who come to found a city at the outset.
אָמַר רִבִּי לָא.
Rabbi La said:
בְּכוֹתֶל אָטוּם הִיא מַתְנִיתָא.
The Mishnah refers to a sealed wall.
אָמַר רִבִּי יוֹסֵי.
Rabbi Yosei said:
בְּכוֹתֶל סוֹדְמִין הִיא מַתְנִיתָא.
The Mishnah refers to a wall of sodmin.
אָמַר רִבִּי יוֹסֵי בֵּירִבִּי בּוּן.
Rabbi Yosei son of Rabbi Bun said:
מַתְנִיתָא אָמְרָה כֵן.
The Mishnah itself says so:
וּבַחֲלוֹנוֹת בֵּין מִלְּמַעֲלָן בֵּין מִלְּמַטָּן בֵּין מִכְּנֶגְדָּן אַרְבַּע אַמּוֹת.
"And for windows: whether from above them, whether from below them, whether opposite them - four cubits."
מִלְּמַעֲלָן ד̇ אַמּוֹת שֶׁלֹּא יְהֵא עוֹמֵד וְרוֹאֶה.
From above: four cubits - so that he does not stand and look.
מִלְּמַטָּן ד̇ אַמּוֹת שֶׁלֹּא יְהֵא עוֹמֵד וְרוֹאֶה.
From below: four cubits - so that he does not stand and look.
מִכְּנֶגְדָּן שֶׁלֹּא יַאֲפִיל אֶת הַצְּדָדָין.
Opposite them: so that he does not darken the sides.
וְתַנֵּי כֵן.
And it is taught likewise:
מַרְחִיקִין הַכּוֹתֶל מִן הַחֲלוֹן כִּמְלֹא חֲלוֹן.
They distance the wall from the window by the full width of the window.