If he did not hollow out the ground across the entire sukkah, but rather hollowed out according to the minimum measurement of seven by seven, if there are three tefachim between the hollow and the wall—it is invalid, because the walls are distant from the valid area of the sukkah. And we do not say in this case "dofen akuma," for the halachah was only stated for complete walls, but whose invalidity is due to the distance from the sechach—we say "dofen akuma." However, one cannot create a wall through "dofen akuma" for that which is not a wall at all. But less than three—it is valid, as anything less than three is considered "lavud." And the Tur wrote that the validity is only beneath the hollow, and not outside of it. And it is not similar to a bench, where we treat the remainder like protruding reeds, since here it is not fit for use at all. And it is not similar to the end of siman 631 regarding a sukkah with a slope, where it is permitted to sleep even in the place of the slope that does not have ten; for there the wall is a complete wall, but through the slope it is shortened in one place, and it is all one wall. This is not the case here, where in the place that it stands it does not have the status of a wall at all, and how could we validate it? (And the difficulty of the Magen Avraham, subsection 8, is settled, and so wrote the Chemed Moshe.)
And it is simple that just as hollowing in the ground to complete the measurement is effective, so too if the sechach is very thick, and he removes from the sechach from below until he completes ten tefachim—it is effective like hollowing (ibid.). (See Pri Megadim, subsection 9, who is in doubt regarding a pit ten deep, where he fixed four high poles on its edge and placed sechach upon them: do we say "gud asik," since the partitions are recognizable from the inside? Or do we require that they be recognizable from the outside? See there. And according to my humble opinion: it is obviously invalid. For in such a case on the edge of a roof, many also invalidate, as I wrote in siman 630. And even according to those who validate—they only validated with walls that are on the ground. And the proof: for in the middle of a roof—according to everyone it is invalid. And yet in a house there are recognizable partitions. Rather, it is certain that we require them to be recognizable on the outside, revealed to all. Examine this and you will find it easy.)
אם לא חקק בקרקע על פני כל הסוכה, אלא חקק כפי שיעור ההכשר שבעה על שבעה, אם יש בין החקק להכותל שלושה טפחים – פסולה, מפני שהדפנות רחוקות מהכשר הסוכה. ולא אמרינן בזה דופן עקומה, דלא נאמרה ההלכה אלא לדפנות גמורים, אלא שפסולם הוא מפני הריחוק מהסכך – אמרינן דופן עקומה. אבל לא לעשות על ידי דופן עקימה דופן, מה שאינו דופן כלל. אבל פחות משלושה – כשרה, דכל פחות משלושה כלבוד דמי. וכתב הטור דאין ההכשר רק תחת החקק, ולא חוצה לה. ואינו דומה לאיצטבא, דשוינן להמותר כקנים היוצאים, כיון דבכאן אין ראוי כלל לתשמיש. ואינו דומה לסוף סימן תרלא בסוכה בשיפוע, שמותר לישן אפילו במקום השיפוע שאין שם עשרה; דהתם הדופן הוא דופן גמורה, אלא שעל ידי השיפוע מתקצרת במקום אחד, וכולה חד דופן היא. מה שאין כן הכא, שבמקום שעומדת אין עליה שם דופן כלל, ואיך נכשירנה. (ומיושב קושית המגן אברהם סעיף קטן ח, וכן כתב החמד משה.)ופשוט הוא דכשם שחקיקה בקרקע להשלים השיעור – מהני, כמו כן אם הסכך עב הרבה, ונוטל מהסכך מלמטה עד כדי להשלים עשרה טפחים – מהני כמו חקק (שם). (עיין פרי מגדים סעיף קטן ט, שמסתפק בבור עמוק עשרה, ונעץ על שפתו ארבעה קונדיסין גבוהים, וסיכך עליהם: מי אמרינן גוד אסיק, כיון שהמחיצות ניכרים מבפנים? או בעינן שיוכרו מבחוץ? עיין שם. ולפי עניות דעתי: פשיטא דפסול. דהא בכי האי גוונא בשפת הגג גם כן הרבה פוסלין, כמו שכתבתי בסימן תרל. ואפילו להיש מכשירין – לא הכשירו רק בכותלים שעל הקרקע. וראיה: דהא באמצע הגג – לדברי הכל פסול. והרי בבית יש מחיצות הניכרות. אלא וודאי דבעינן ניכרות בחוץ, גלוי לכל. ודייק ותמצא קל.)