The walls of a sukkah are a law given to Moses at Sinai like all partitions (Rashi, Sukkah 6b, s.v. "hilkhata"): two walls according to their law, and a third even of a tefakh. And they derived this from verses, as it is written: "basukkot," "basukkot," "basukkot" — twice deficient and once full, which makes four. Remove one for itself, as it is not for a derivation but for its literal meaning (ibid. s.v. "legufia") — three remain. And the law came and diminished the third, and established it at a tefakh (Gemara ibid.). That is to say: thus it was told to Moses at Sinai, that for the third, a tefakh is sufficient. And it is stated in the Gemara there that this tefakh must be a "loose" tefakh, that is to say: slightly more than a tefakh. And he places it within less than three [tefakhim] adjacent to the wall, and it becomes like a wall of four, which is the majority of a sukkah wall, whose measure is seven tefakhim, as will be explained. And Rava added to say that it also requires a tzorat hapetach, as will be explained. And from where do we have all these, since the law was stated only as a tefakh? And the Rosh wrote that Rava received this from his teachers, see there. And it still must be understood from where his teachers knew this? And if we say that this is only rabbinic, it is difficult to say so, for the tefakh is certainly from the Torah. And even though in the Yerushalmi at the beginning of Sukkah it says that the tefakh is from their words, and from the Torah there are only two partitions, see there — nevertheless, in our Shas in Niddah (26b) it is explicit that the tefakh is from the Torah, see there. And perforce it is so, according to what they said that the law came and diminished the third, and established it at a tefakh. And from the Torah there are three partitions, as is explained in the Gemara. (And so wrote the Tosafot 7b s.v. "sikhakh," that the tefakh is from the Torah, see there.)
דפנות סוכה – הלכה למשה מסיני ככל המחיצות (רש"י סוכה ו ב דיבור המתחיל "הלכתא"): שתי דפנות כהלכתן, ושלישית אפילו טפח. ודרשו מקראי, דכתיב: "בסוכת", "בסוכת", "בסוכות" – שני פעמים חסר, ואחד מלא, הרי כאן ארבעה. דל חד לגופיה, דאינו לדרשא אלא למשמעו (שם דיבור המתחיל "לגופיה") – פשו להו תלתא. ואתאי הלכתא וגרעתה לשלישית, ואוקמה אטפח (גמרא שם). כלומר: דכך נאמרה למשה בסיני, דהשלישית די בטפח. ואיתא בגמרא שם דטפח זה צריך להיות טפח שוחק, כלומר: מעט יותר מטפח. ומעמידו בפחות משלושה סמוך לדופן, והוה כדופן ארבעה, שזהו רוב דופן סוכה, דשיעורה שבעה טפחים, כמו שיתבאר. והוסיף רבא לומר דצריך גם צורת הפתח, כמו שיתבאר. ומאין לנו כל אלה, כיון דההלכה נאמרה רק טפח? והרא"ש כתב שרבא קבל כן מרבותיו, עיין שם. ועדיין יש להבין מנא לן לרבותיו כן? ואם נאמר שזהו רק מדרבנן, קשה לומר כן, דהטפח וודאי הוא מן התורה. ואף על גב דבירושלמי ריש סוכה אומר דהטפח הוא מדבריהם, ומדאורייתא הוה רק שתי מחיצות, עיין שם – מכל מקום בש"ס שלנו בנדה (כו ב) מפורש דהטפח הוא מן התורה, עיין שם. ובעל כרחך כן הוא, לפי מה שאמרו דאתאי הלכתא וגרעתה לשלישית, ואוקמה אטפח. ומן התורה יש שלוש מחיצות, כמבואר בגמרא. (וכן כתבו התוספות ז ב בדיבור המתחיל "סיכך", דהטפח הוי מן התורה, עיין שם.)