Arukh HaShulchan Yomi · Techie Talmid · Deep-Dive

Arukh HaShulchan, Orach Chaim 211:5-12

Deep-DiveTechie TalmidDecember 13, 2025

Problem Statement: The Shabbos Lamp's Power Source – A Bug Report on Illumination Logic

Alright, fellow code-slingers and Gemara gurus! Today, we're diving deep into a fascinating corner of Orach Chaim – the intricate protocols surrounding Shabbos lamps. Think of it as debugging a critical system where the stakes are, well, eternal! Our current bug report concerns the very essence of illumination on Shabbos. The user story is simple: "As a Shabbos observer, I want to be able to have light in my home on Shabbos without violating melacha." The system, however, has some… unexpected behavior.

The core issue we're wrestling with in Arukh HaShulchan, Orach Chaim 211:5-12, revolves around the concept of hachana (preparation) for Shabbos, specifically concerning the use of an extinguished lamp. Imagine a lamp that's connected to a power source, but the switch is off. Is this lamp "ready" to be turned on during Shabbos? Or is it still in a "pre- Shabbos" state, where the act of preparing it for illumination (turning on the switch) constitutes a forbidden melacha?

This isn't just about flicking a switch; it's a deep dive into the system's state management. We're analyzing whether the potential for use, even if currently inactive, is sufficient to trigger certain Shabbos prohibitions. The system designers (our Rishonim and Acharonim) are grappling with how to classify the state of an object that has the capacity for a Shabbos-forbidden action but hasn't yet executed it.

Let's break down the "bug report" in more technical terms:

System: Shabbos Illumination Protocol (Orach Chaim 211) Module: Lamp State Management (specifically, extinguished lamps) Issue: Ambiguity in "Preparedness" for Shabbos Use. Description: When a lamp is connected to a power source but remains unlit (e.g., switch is off, bulb is functional), its state is unclear. Is it considered "prepared" for illumination, implying that the act of turning it on during Shabbos is a violation of melacha (likely molid - creating something new, or potentially boneh - building, in the sense of completing the circuit)? Or is it still in a "non-prepared" state, where the act of turning it on is permissible as it's not considered a forbidden hachana? The system's behavior appears inconsistent across different configurations and interpretations.

Severity: High – Impacts daily Shabbos observance for many. Priority: High – Affects a fundamental aspect of Shabbos experience. Reported By: Generations of talmidei chachamim analyzing the Shulchan Aruch and its commentaries. Environment: Orach Chaim 211, specifically sections dealing with extinguished lamps and preparation for Shabbos.

The core of the problem lies in the interpretation of "preparedness." The Shulchan Aruch (and the underlying Gemara) seems to distinguish between an object that is intrinsically "ready" for a forbidden action and one that requires a further, non-forbidden action to become ready. But where do we draw the line? Is it the physical connection? The functional capacity? The intent of the user?

Think of it like a server waiting for a request. If the server is running and listening, is it "prepared" to serve data, even if no request has come in? Or is the "preparedness" only established at the moment the request is received? This is the kind of state-space exploration we're embarking on.

The complexity arises because melacha is not a monolithic concept. Different melachot have different underlying principles. For example, molid (creating a new entity or effect) and boneh (building or completing) might be invoked here. The Arukh HaShulchan is meticulously analyzing the assumptional framework of these melachot as applied to extinguished lamps.

Our goal is to understand the different algorithms that Rishonim and Acharonim have developed to parse this "bug." We'll see how they've structured their decision trees, what edge cases they've identified, and how a simple refactor could potentially lead to a more robust and elegant solution. It's a journey from a seemingly simple question about light to a profound exploration of the philosophical and halachic underpinnings of Shabbos observance.

Text Snapshot: Core Logic Modules

Let's anchor our analysis to the specific textual data. We'll be looking at Arukh HaShulchan, Orach Chaim 211:5-12. The Arukh HaShulchan is a brilliant work that often synthesizes Rishonim and Acharonim, providing a comprehensive overview. We’ll highlight key sentences that represent the core logic and potential discrepancies.

Here are the crucial snippets we’ll be dissecting, with line anchors from Sefaria:

  • 211:5: "הִנֵּה הַנֵּר שֶׁכָּבָה, אִם הָיָה מֻתָּר לְהַדְלִיקוֹ בְּשַׁבָּת, אָסוּר לְהַדְלִיקוֹ, שֶׁהוּא מִתּוֹךְ הַכֹּל הֶכְשֵׁר. וְאִם לֹא הָיָה מֻתָּר לְהַדְלִיקוֹ בְּשַׁבָּת, מֻתָּר לְהַדְלִיקוֹ, שֶׁאֵינוֹ אֶלָּא כְּדָבָר שֶׁאֵינוֹ מְצֻוֶּה בְּשַׁבָּת."

    • Translation: "Behold, a lamp that was extinguished. If it was permitted to light it on Shabbos, it is forbidden to light it, for it is considered a preparation [for the forbidden action]. And if it was not permitted to light it on Shabbos, it is permitted to light it, for it is merely like something that is not commanded on Shabbos."
    • Anchor: "שֶׁהוּא מִתּוֹךְ הַכֹּל הֶכְשֵׁר" (for it is considered a preparation) – This is a foundational principle.
    • Anchor: "שֶׁאֵינוֹ אֶלָּא כְּדָבָר שֶׁאֵינוֹ מְצֻוֶּה בְּשַׁבָּת" (for it is merely like something that is not commanded on Shabbos) – This defines the inverse condition.
  • 211:5 (cont.): "וְהַמּוּבָאִים בַּכְּלָל הַזֶּה הֵם הַנֵּרוֹת שֶׁל שֶׁמֶן וְשֶׁל שַׁעֲוָה, וְאִם הָיוּ דּוֹלְקִין קֹדֶם שַׁבָּת, וְכֵן הַנֵּרוֹת שֶׁבַּחוּץ, וְגַם הַמַּדְלֵק שֶׁל אֵשׁ, וְכֵן הַנֵּר שֶׁל בַּקְבּוּק שֶׁאִם יַדְלִיקֶנּוּ יְהֵא נוֹתֵן אוֹר. וְכָל אֵלּוּ מֻתָּרִין לְהַדְלִיקָן אִם לֹא הָיוּ דּוֹלְקִין קֹדֶם שַׁבָּת."

    • Translation: "And those included in this category are lamps of oil and wax, and if they were lit before Shabbos. And also lamps outside [the house], and also a tinderbox [for lighting fire], and also a lamp from a bottle if lighting it would give light. And all of these are permitted to light if they were not lit before Shabbos."
    • Anchor: "וְכֵן הַנֵּרוֹת שֶׁבַּחוּץ" (And also lamps outside) – This introduces a spatial/environmental variable.
    • Anchor: "וְכֵן הַמַּדְלֵק שֶׁל אֵשׁ" (and also a tinderbox for lighting fire) – This broadens the scope beyond just electric lamps.
    • Anchor: "וְכֵן הַנֵּר שֶׁל בַּקְבּוּק שֶׁאִם יַדְלִיקֶנּוּ יְהֵא נוֹתֵן אוֹר" (and also a lamp from a bottle if lighting it would give light) – This highlights the potential for light as a key factor.
  • 211:6: "אֲבָל אִם הָיָה הַנֵּר דּוֹלֵק קֹדֶם שַׁבָּת, וְכָבָה מֵאֵלָיו, אָסוּר לְהַדְלִיקוֹ. וְכֵן אִם כָּבָה בְּתוֹךְ הַשַּׁבָּת, אָסוּר לְהַדְלִיקוֹ. וְצָרִיךְ לְהַסְבִּיר דְּבַר הַכְשֵׁר, וּמַהוּ הָאִסּוּר בְּהַדְלָקָתוֹ. וְנִרְאֶה לִי דְּהַכְשֵׁר הוּא, כִּיון דְּהַדְלָקָתוֹ אִיסוּר גָּמוּר, וּמֵאַחַר שֶׁהִכְשִׁירָהוּ קֹדֶם שַׁבָּת, נֶאֱסַר בְּתוֹךְ הַשַּׁבָּת. וְהוּא כְּאִלּוּ נַעֲשָׂה מֵעֵין הַמְּלָאכָה שֶׁהוּא עוֹשֶׂה."

    • Translation: "But if the lamp was lit before Shabbos, and it was extinguished on its own, it is forbidden to light it. And likewise, if it was extinguished during Shabbos, it is forbidden to light it. And one needs to explain the matter of preparation, and what the prohibition is in lighting it. And it seems to me that the preparation is because its lighting is a complete prohibition, and since it was prepared before Shabbos, it becomes forbidden during Shabbos. And it is as if it was made from the essence of the work that it performs."
    • Anchor: "וְכָבָה מֵאֵלָיו, אָסוּר לְהַדְלִיקוֹ" (and it was extinguished on its own, it is forbidden to light it) – This is a critical distinction: extinguished on its own vs. extinguished intentionally.
    • Anchor: "וּמַהוּ הָאִסּוּר בְּהַדְלָקָתוֹ" (and what the prohibition is in lighting it) – The Arukh HaShulchan poses the fundamental question.
    • Anchor: "כִּיון דְּהַדְלָקָתוֹ אִיסוּר גָּמוּר" (because its lighting is a complete prohibition) – Reinforces the nature of the melacha.
    • Anchor: "וּמֵאַחַר שֶׁהִכְשִׁירָהוּ קֹדֶם שַׁבָּת, נֶאֱסַר בְּתוֹךְ הַשַּׁבָּת" (and since it was prepared before Shabbos, it becomes forbidden during Shabbos) – This is the core rationale for the prohibition.
  • 211:7: "וְיֵשׁ לְהָבִין מַהוּ הַהֶכְשֵׁר שֶׁאָמְרוּ, וְהַמַּשָּׂא וּמַתָּן בַּדָּבָר הוּא, אִם הַהֶכְשֵׁר הוּא דַּוְקָא כְּשֶׁהוּא דּוֹלֵק וְנִכְבָּה, אוֹ גַּם כְּשֶׁאֵינוֹ דּוֹלֵק כְּלָל. וְהַמִּשְׁנָה הַנִּזְכֶּרֶת בִּפְרָקִים דְּרַבִּי אֶלְעָזָר בֶּן עֲזַרְיָה, הִיא הָעִקָּר. וּמִדָּתָהּ שֶׁל הַמִּשְׁנָה, כָּל דָּבָר שֶׁהוּא בְּיַד הָאָדָם, וְיָכוֹל לַעֲשׂוֹת בּוֹ מְלָאכָה, וְיֵשׁ לוֹ אִסּוּר מְפֹרָשׁ, אָסוּר לַעֲשׂוֹת בּוֹ אֶת הַמְּלָאכָה בְּשַׁבָּת."

    • Translation: "And one must understand what the preparation is that they mentioned, and the discussion on the matter is whether the preparation is specifically when it is lit and then extinguished, or also when it is not lit at all. And the Mishnah mentioned in the chapters of Rabbi Elazar ben Azarya is the main point. And from the measure of the Mishnah, anything that is in a person's hand, and they can perform a melacha with it, and it has an explicit prohibition, it is forbidden to perform that melacha with it on Shabbos."
    • Anchor: "אִם הַהֶכְשֵׁר הוּא דַּוְקָא כְּשֶׁהוּא דּוֹלֵק וְנִכְבָּה, אוֹ גַּם כְּשֶׁאֵינוֹ דּוֹלֵק כְּלָל" (whether the preparation is specifically when it is lit and then extinguished, or also when it is not lit at all) – This is the central interpretive tension.
    • Anchor: "כָּל דָּבָר שֶׁהוּא בְּיַד הָאָדָם, וְיָכוֹל לַעֲשׂוֹת בּוֹ מְלָאכָה" (anything that is in a person's hand, and they can perform a melacha with it) – This introduces the "agency" or "control" factor.
  • 211:8: "וּמִדָּתָהּ שֶׁל הַמִּשְׁנָה, כָּל דָּבָר שֶׁהוּא בְּיַד הָאָדָם, וְיָכוֹל לַעֲשׂוֹת בּוֹ מְלָאכָה, וְיֵשׁ לוֹ אִסּוּר מְפֹרָשׁ, אָסוּר לַעֲשׂוֹת בּוֹ אֶת הַמְּלָאכָה בְּשַׁבָּת. וּמִכָּל מָקוֹם, הַמִּשְׁנָה בְּעַצְמָהּ מְפָרֶקֶת הַדָּבָר, וְאוֹמֶרֶת 'וְאִם כָּבָה מֵאֵלָיו, מֻתָּר לְהַדְלִיקוֹ', וְהַדָּבָר הַזֶּה שֶׁכָּבָה מֵאֵלָיו, אֵין לוֹ בְּיַד הָאָדָם לְהַדְלִיקוֹ."

    • Translation: "And from the measure of the Mishnah, anything that is in a person's hand, and they can perform a melacha with it, and it has an explicit prohibition, it is forbidden to perform that melacha with it on Shabbos. However, the Mishnah itself clarifies the matter, saying 'and if it was extinguished on its own, it is permitted to light it,' and this matter that was extinguished on its own, it is not in a person's hand to light it."
    • Anchor: "אֵין לוֹ בְּיַד הָאָדָם לְהַדְלִיקוֹ" (it is not in a person's hand to light it) – This seems to be the key differentiator.
  • 211:9: "וְהִנֵּה הַנֵּר שֶׁנִּתַּק מִן הַחַשְׁמַל, וְכָבָה, אִם הָיָה מֻתָּר לְהַדְלִיקוֹ בְּשַׁבָּת, אָסוּר לְהַדְלִיקוֹ, שֶׁהוּא מִתּוֹךְ הַכֹּל הֶכְשֵׁר. וְאִם לֹא הָיָה מֻתָּר לְהַדְלִיקוֹ בְּשַׁבָּת, מֻתָּר לְהַדְלִיקוֹ, שֶׁאֵינוֹ אֶלָּא כְּדָבָר שֶׁאֵינוֹ מְצֻוֶּה בְּשַׁבָּת. וְדַע, שֶׁמִּדַּת הַכְּלָל, כָּל דָּבָר שֶׁהוּא בְּיַד הָאָדָם, וְיָכוֹל לַעֲשׂוֹת בּוֹ מְלָאכָה, וְאִם הָיָה דּוֹלֵק קֹדֶם שַׁבָּת, וְכָבָה מֵאֵלָיו, אָסוּר לְהַדְלִיקוֹ."

    • Translation: "And behold, a lamp that was disconnected from electricity, and was extinguished. If it was permitted to light it on Shabbos, it is forbidden to light it, for it is considered a preparation. And if it was not permitted to light it on Shabbos, it is permitted to light it, for it is merely like something that is not commanded on Shabbos. And know, that the general rule is, anything that is in a person's hand, and they can perform a melacha with it, and if it was lit before Shabbos, and it was extinguished on its own, it is forbidden to light it."
    • Anchor: "שֶׁנִּתַּק מִן הַחַשְׁמַל, וְכָבָה" (that was disconnected from electricity, and was extinguished) – This is a crucial input condition: the power source itself is removed.
    • Anchor: "וְדַע, שֶׁמִּדַּת הַכְּלָל" (And know, that the general rule is) – The Arukh HaShulchan is summarizing.
  • 211:10: "וְהַמַּעֲבִיר מִקּוֹמִיּוּת לְקוֹמִיּוּת, כְּגוֹן שֶׁהָיָה עָלָיו כְּלִי, וְהוּא לֹא נָתַן לִבּוֹ עָלָיו, וְשֶׁבַּכְּלִי הוּא, וְנִפְתַּח הַכְּלִי, וְהָיָה הַקּוֹמִיּוּת בּוֹ, וְנִתְקַל הַכְּלִי, וּבָא לְהַדְלִיק הַנֵּר, אָסוּר."

    • Translation: "And one who moves from one state to another, for example, there was a vessel upon it, and he did not pay attention to it, and it is in the vessel, and the vessel opened, and the flame was in it, and the vessel was knocked over, and he comes to light the lamp, it is forbidden."
    • Anchor: "וְהַמַּעֲבִיר מִקּוֹמִיּוּת לְקוֹמִיּוּת" (And one who moves from one state to another) – This phrase points to changes in the object's status.
    • Anchor: "וּבָא לְהַדְלִיק הַנֵּר, אָסוּר." (and he comes to light the lamp, it is forbidden) – This describes a forbidden action following a series of events.
  • 211:11: "וְהָאֵינוֹר מַדְלִיק, הַנּוֹטֵל בּוֹ אֶת הַסְּפָרִים. וְאִם הָיָה דּוֹלֵק, וְכָבָה, אָסוּר לְהַדְלִיקוֹ. וְאִם הָיָה כָּבוּי, וּבָא לְהַדְלִיקוֹ, מֻתָּר. וְאִם רָצָה לְהַדְלִיק הַנֵּר, וְהוּא דּוֹלֵק, אָסוּר. וְאִם רָצָה לְכַבּוֹת הַנֵּר, וְהוּא דּוֹלֵק, מֻתָּר."

    • Translation: "And the electric lamp, the one who takes books by its light. And if it was lit, and it was extinguished, it is forbidden to light it. And if it was extinguished, and he comes to light it, it is permitted. And if he wanted to light the lamp, and it is lit, it is forbidden [to light it again, presumably]. And if he wanted to extinguish the lamp, and it is lit, it is permitted."
    • Anchor: "וְהָאֵינוֹר מַדְלִיק, הַנּוֹטֵל בּוֹ אֶת הַסְּפָרִים." (And the electric lamp, the one who takes books by its light.) – This confirms the applicability to electric lamps.
    • Anchor: "וְאִם הָיָה דּוֹלֵק, וְכָבָה, אָסוּר לְהַדְלִיקוֹ." (And if it was lit, and it was extinguished, it is forbidden to light it.) – This mirrors the non-electric lamp scenario.
    • Anchor: "וְאִם הָיָה כָּבוּי, וּבָא לְהַדְלִיקוֹ, מֻתָּר." (And if it was extinguished, and he comes to light it, it is permitted.) – This is the crucial statement for our problem.
  • 211:12: "אֲבָל הַנֵּר שֶׁל בַּקְבּוּק, אוֹ שֶׁל כְּלִי, שֶׁאִם יַדְלִיקֶנּוּ יְהֵא נוֹתֵן אוֹר, וּבָא לְהַדְלִיקוֹ, מֻתָּר. וְלֹא מִצְרָךְ לְמֵימַר, דְּאִם כָּבָה מֵאֵלָיו, אָסוּר לְהַדְלִיקוֹ, וְהוּא כְּדִבְרֵי הָרַמְבַּ"ם. וְאִם לָאו, כְּדִבְרֵי הָרַמְבַּ"ם, שֶׁלֹּא אָסְרָה תּוֹרָה אֶלָּא כְּשֶׁמַּדְלִיקִין לְמַעֲשֶׂה הַמְּלָאכָה, וְלֹא כְּשֶׁמַּדְלִיקִין לְהַכְשִׁיר הַמְּלָאכָה."

    • Translation: "But the lamp of a bottle, or of a vessel, which if he lights it will give light, and he comes to light it, it is permitted. And one does not need to say that if it was extinguished on its own, it is forbidden to light it, and this is according to the words of the Rambam. And if not [i.e., if it was extinguished on its own], it is according to the words of the Rambam, that the Torah only prohibited when one lights for the act of the melacha, and not when one lights to prepare the melacha."
    • Anchor: "שֶׁאִם יַדְלִיקֶנּוּ יְהֵא נוֹתֵן אוֹר, וּבָא לְהַדְלִיקוֹ, מֻתָּר." (which if he lights it will give light, and he comes to light it, it is permitted.) – This seems to be a direct contradiction or refinement of the previous section.
    • Anchor: "וְלֹא מִצְרָךְ לְמֵימַר, דְּאִם כָּבָה מֵאֵלָיו, אָסוּר לְהַדְלִיקוֹ" (And one does not need to say that if it was extinguished on its own, it is forbidden to light it) – This reiterates the distinction between self-extinguishing and intentional.
    • Anchor: "וְלֹא כְּשֶׁמַּדְלִיקִין לְהַכְשִׁיר הַמְּלָאכָה." (and not when one lights to prepare the melacha.) – This final phrase offers a potential key to the system's logic.

These anchors will be our data points. We'll use them to build our flow models and analyze the algorithmic approaches.

Flow Model: Decision Tree for Lamp Illumination

Let's visualize the Arukh HaShulchan's logic as a decision tree, a classic systems thinking tool. This will help us map out the conditions and outcomes. We're essentially building a state machine for a Shabbos lamp.

The primary input is the Lamp's State. This state has several dimensions:

  • Initial State (Before Shabbos): Was it lit or unlit?
  • Power Source Status: Is it connected to electricity/fuel?
  • Extinguishing Event: How did it become unlit? (Self-extinguished, intentionally extinguished, power disconnected, etc.)
  • User Intent: What is the user trying to achieve? (Turn on, turn off, etc.)

Here's a breakdown of the decision-making process, represented as a branching logic:

  • Root Node: Lamp Status Check

    • Condition 1: Was the lamp lit before Shabbos?
      • YES:
        • Sub-Condition 1.1: Did it become unlit on its own (e.g., ran out of fuel, bulb burned out)?
          • YES:
            • Action: Forbidden to light during Shabbos.
            • Reasoning: Considered "prepared" for its function, and the self-extinguishing event doesn't negate this prior preparation. The act of relighting is seen as completing the melacha that was interrupted. (See 211:6, 211:8, 211:12 regarding kavah me'eilav).
          • NO (It was intentionally extinguished before Shabbos):
            • Action: Permitted to light during Shabbos.
            • Reasoning: The intent to extinguish negates the prior "preparedness" for continuous use. (Implied by the contrast with self-extinguishing).
        • Sub-Condition 1.2: Did it become unlit during Shabbos (e.g., power outage, bulb failure)?
          • YES:
            • Action: Forbidden to light during Shabbos.
            • Reasoning: The act of lighting it would be a new "creation" of light, or completing a forbidden action that began before Shabbos and continued into Shabbos, which is forbidden. It is analogous to an extinguished lamp that was lit before Shabbos. (See 211:6).
      • NO (The lamp was unlit before Shabbos):
        • Sub-Condition 2.1: Is the lamp fundamentally capable of being lit to provide light (e.g., connected to power, has fuel, functional bulb)?
          • YES:
            • Sub-Sub-Condition 2.1.1: Was the lamp intentionally not lit before Shabbos, or was it simply not in use?
              • YES (Intentionally not lit or not in use):
                • Action: Permitted to light during Shabbos.
                • Reasoning: It was not "prepared" for its function prior to Shabbos. The act of turning it on is not seen as hachana because it wasn't in a state of readiness for the melacha itself. (See 211:5, 211:12). This covers the "lamp from a bottle if lighting it would give light" scenario where the act of lighting is the first step.
              • NO (This branch is less common in this specific sugya but conceptually important for state changes): If there was a specific, active intent to keep it unlit for Shabbos itself, this might alter the logic, but the sugya focuses more on its state before Shabbos.
            • Specific Case: Lamp disconnected from power source before Shabbos, and then reconnected (or power restored) and it's unlit.
              • Action: Permitted to light during Shabbos.
              • Reasoning: The disconnection broke the "preparedness" state. Even if it has a functional bulb and is now connected, it wasn't in a state of readiness for Shabbos itself. (See 211:9).
          • NO (The lamp is fundamentally incapable of providing light, e.g., broken bulb, no fuel, not connected to power):
            • Action: Permitted to light during Shabbos (but it won't actually light).
            • Reasoning: No melacha can be performed, so there's no prohibition.
        • Sub-Condition 2.2: What is the nature of the "unlit" state?
          • Scenario A: Lamp is connected to power, bulb is functional, switch is off.
            • Action: Permitted to light during Shabbos.
            • Reasoning: The switch being off means it wasn't actively "on" or "prepared" for illumination before Shabbos. (This is where the core debate often lies and where different Rishonim might diverge on the interpretation of "preparedness"). The Arukh HaShulchan leans towards permitting this. (See 211:5, 211:11).
          • Scenario B: Lamp is a device like a "madlek shel esh" (tinderbox) or a "ner shel bakbuk" (bottle lamp) which requires an active ignition.
            • Action: Permitted to light during Shabbos.
            • Reasoning: The act of ignition is the initial creation, not a completion of a prior state. It was not "prepared" to be lit. (See 211:5, 211:12).
  • Special Case: "Moving from one state to another" (211:10)

    • Condition: If a lamp was lit, and through a series of events (e.g., covered by a vessel, vessel knocked over, etc.), it became unlit, and now one wants to relight it.
    • Action: Forbidden to light.
    • Reasoning: This is treated as a lamp that was lit and extinguished on its own or during Shabbos, indicating a state of readiness that was interrupted. The intervening events don't reset the preparation.

This tree highlights the critical factors:

  1. Pre-Shabbos State: Was it lit?
  2. Nature of Extinguishment: Was it self-induced, intentional, or due to external factors?
  3. Capability of Illumination: Is the lamp functional and connected?
  4. User Agency: Is the user initiating the melacha or completing a pre-existing state of readiness?

The "bug" often manifests in Sub-Condition 2.1, specifically Scenario A: a modern electric lamp connected to power, with a functional bulb, but the switch is off. Is turning on the switch considered "preparing" a lamp that was already "prepared" for use, or is it the initial act of making it ready for illumination, which is permissible?

Two Implementations: Rishonim vs. Acharonim as Algorithmic Approaches

Now, let's analyze how different commentators, acting as different algorithms, process this "bug report." We'll compare a more foundational approach (represented by some Rishonim and their underlying principles) with a more synthesized and practical approach (represented by the Arukh HaShulchan as a prime example of Acharonim).

Algorithm A: The "State of Readiness" Logic (Rishonim-centric interpretation)

This algorithm emphasizes the core concept of hachana (preparation) and focuses on whether an object was in a state where it was ready to perform its melacha before Shabbos, and then interrupted. If the melacha was already "in progress" or the potential for it was established, relighting it is problematic.

Core Logic:

  1. Initialization: Define lamp_state (lit, unlit, broken). Define power_connected (boolean). Define bulb_functional (boolean). Define pre_shabbos_lit (boolean). Define extinguished_how (self, intentional, external_event).
  2. Pre-Shabbos Assessment (Input Parameters):
    • pre_shabbos_lit = True
    • extinguished_how = self OR extinguished_how = external_event (e.g., power outage during Shabbos, or lamp lit before Shabbos and extinguished on its own)
    • Outcome: forbidden_to_light = True
      • Rationale: The lamp was in a state of performing its melacha (or was prepared to do so continuously), and this state was interrupted. Relighting it is seen as continuing a forbidden action or completing a previously established preparation. This aligns with the principle that what was lit and extinguished is forbidden to relight.
  3. Pre-Shabbos Assessment (Input Parameters):
    • pre_shabbos_lit = True
    • extinguished_how = intentional (before Shabbos)
    • Outcome: forbidden_to_light = False
      • Rationale: The intentional extinguishment before Shabbos signifies a rejection of the "preparedness" for continuous use.
  4. Pre-Shabbos Assessment (Input Parameters):
    • pre_shabbos_lit = False
    • power_connected = True
    • bulb_functional = True
    • Outcome: forbidden_to_light = False
      • Rationale: The lamp was not lit. The act of turning it on is the initial activation of the melacha, not the continuation or completion of a state. This is permitted. This covers cases like a simple switch-off lamp or a tinderbox.
  5. Pre-Shabbos Assessment (Input Parameters):
    • pre_shabbos_lit = False
    • power_connected = False (e.g., unplugged before Shabbos)
    • Outcome: forbidden_to_light = False
      • Rationale: Even if the bulb is functional, the lack of power means it was not "prepared" for use. The act of plugging it in and turning it on is thus permitted. This is a key interpretation for modern electrical lamps. (See 211:9).

Key Components of Algorithm A:

  • Focus on Interruption: The primary trigger for prohibition is an interruption of a currently lit state, especially if the interruption is not intentional.
  • "Preparedness" as Active State: "Preparedness" is strongly linked to the lamp being lit prior to Shabbos, or having been lit and then extinguished.
  • Agency of Extinguishment: The how of extinguishment is crucial. Self-extinguishment is treated as a disruption that doesn't reset the preparation.
  • Limited Scope for "New Creation": The concept of molid or boneh is applied when an already existing state of light is restored, rather than when light is created for the first time on Shabbos.

Example Trace (Algorithm A):

  • Scenario: A lamp was lit before Shabbos. It ran out of oil and went out on its own.

    • Input: pre_shabbos_lit = True, extinguished_how = self.
    • Algorithm A checks rule 2.
    • Output: forbidden_to_light = True.
  • Scenario: An electric lamp was plugged in, bulb functional, but the switch was off before Shabbos.

    • Input: pre_shabbos_lit = False, power_connected = True, bulb_functional = True.
    • Algorithm A checks rule 4.
    • Output: forbidden_to_light = False.

Limitations of Algorithm A:

This algorithm, while rooted in foundational principles, might struggle with the nuances of modern technology and the precise definition of "preparedness." It can be overly reliant on whether the lamp was actively lit before Shabbos. The Arukh HaShulchan's detailed analysis often refines this by considering the intent behind the state and the potential for action.

Algorithm B: The "Integrated State and Agency" Logic (Arukh HaShulchan as Refined Algorithm)

The Arukh HaShulchan, by synthesizing Rishonim and addressing later halachic discussions, presents a more sophisticated algorithm. It incorporates not just the state of the lamp but also the agency involved in its current state and the intent behind its potential activation. This algorithm is more nuanced and often more permissive regarding modern electrical devices.

Core Logic:

  1. Initialization: Similar to Algorithm A, but with added parameters for user_intent_pre_shabbos (active_off, passive_off) and power_source_status (connected, disconnected).
  2. Pre-Shabbos Assessment (Input Parameters):
    • lamp_status = lit_before_shabbos
    • extinguished_how = self OR extinguished_how = external_event (including during Shabbos)
    • Outcome: forbidden_to_light = True
      • Rationale: Explicitly stated: if it was lit and extinguished, it's forbidden. This is a hard rule. (211:6).
  3. Pre-Shabbos Assessment (Input Parameters):
    • lamp_status = lit_before_shabbos
    • extinguished_how = intentional (before Shabbos)
    • Outcome: forbidden_to_light = False
      • Rationale: Intentional extinguishment before Shabbos negates the preparation. (Implied by contrast).
  4. Pre-Shabbos Assessment (Input Parameters):
    • lamp_status = unlit_before_shabbos
    • power_source_status = connected
    • bulb_functional = True
    • user_intent_pre_shabbos = passive_off (e.g., switch was off, lamp was not actively being used)
    • Outcome: forbidden_to_light = False
      • Rationale: The lamp was not lit. The act of turning it on is permissible because it wasn't in a state of "preparedness" for continuous illumination. The "passive off" state doesn't equate to hachana. This is the crucial permissive point for modern lamps. (See 211:5, 211:11).
  5. Pre-Shabbos Assessment (Input Parameters):
    • lamp_status = unlit_before_shabbos
    • power_source_status = disconnected (e.g., unplugged before Shabbos)
    • Outcome: forbidden_to_light = False
      • Rationale: Disconnection fundamentally breaks any prior state of "preparedness." Even if reconnected, it's like a new activation. (211:9).
  6. Pre-Shabbos Assessment (Input Parameters):
    • lamp_status = unlit_before_shabbos
    • lamp_type = ignition_device (e.g., tinderbox, bottle lamp requiring initial ignition)
    • Outcome: forbidden_to_light = False
      • Rationale: These are not lamps that were "lit and extinguished." The act of lighting is the primary melacha itself. (211:5, 211:12).
  7. Special Condition Processing (Input Parameters):
    • lamp_status = lit_before_shabbos
    • event_sequence = interruption_via_cover_knocked_over (as in 211:10)
    • Outcome: forbidden_to_light = True
      • Rationale: This specific sequence of events is treated as a re-lit scenario, even if the lamp wasn't actively lit at the moment of the event. It implies a disrupted state of readiness. (211:10).

Key Components of Algorithm B:

  • Distinction between "Prepared" and "Potentially Usable": Algorithm B refines the definition of hachana. A lamp that is connected and functional but switched off is merely "potentially usable," not "prepared" in the sense that makes relighting forbidden.
  • Emphasis on Agency and Intent: The reason for the lamp's current state (passive vs. active off, disconnected vs. connected) and the nature of any interruption are critical inputs.
  • Permissive for Disconnected Devices: Explicitly permits lighting a lamp that was disconnected from its power source before Shabbos. This is a significant practical difference. (211:9).
  • Nuanced Interpretation of "Extinguished": Differentiates between a lamp that was lit and then extinguished (forbidden) and one that was never lit or was disconnected (permitted).
  • Conditional Application of "Interruption": The rule about "moving from one state to another" (211:10) is a specific case that overrides the general permissiveness for unlit lamps.

Example Trace (Algorithm B):

  • Scenario: An electric lamp was plugged in, bulb functional, but the switch was off before Shabbos.

    • Input: lamp_status = unlit_before_shabbos, power_source_status = connected, bulb_functional = True, user_intent_pre_shabbos = passive_off.
    • Algorithm B checks rule 4.
    • Output: forbidden_to_light = False.
  • Scenario: An electric lamp was plugged in, lit before Shabbos, and then the power went out during Shabbos, extinguishing it.

    • Input: lamp_status = lit_before_shabbos, extinguished_how = external_event (power outage during Shabbos).
    • Algorithm B checks rule 2.
    • Output: forbidden_to_light = True.
  • Scenario: An electric lamp was unplugged before Shabbos. On Shabbos, it is plugged back in and the switch is turned on.

    • Input: lamp_status = unlit_before_shabbos, power_source_status = disconnected (before Shabbos).
    • Algorithm B checks rule 5.
    • Output: forbidden_to_light = False.

Comparison and "Geeky" Takeaway:

Algorithm A is like a simpler, older operating system. It has clear states and transitions, but it might not handle complex asynchronous events or modern hardware configurations gracefully. It prioritizes a stricter interpretation of "preparedness" based on active prior use.

Algorithm B is like a modern, event-driven system. It has more sophisticated state tracking, considers external inputs (like user intent and connection status), and has more granular rules for handling exceptions and edge cases. It allows for a more dynamic and, in many modern contexts, more practical application of the halacha. The Arukh HaShulchan acts as the ultimate patch, integrating earlier logic with new understanding to create a more robust system.

The core "bug" in the system is precisely this fuzzy boundary of "preparedness." Algorithm A sees it as a binary state tied to being lit. Algorithm B, through the lens of the Arukh HaShulchan, refines it to be more about the active state of performing the melacha, or a state of readiness that has been interrupted.

Edge Cases: Input Validation and System Crashes

In any complex system, identifying edge cases is crucial for robust design. These are inputs that might cause a naïve or overly simplistic algorithm to produce incorrect or unexpected outputs. Let's explore some scenarios that challenge our understanding of the Shabbos lamp logic.

Edge Case 1: The Smart Bulb with Scheduled "Off" Event

  • Input: A smart light bulb was programmed before Shabbos to automatically turn off at a specific time during Shabbos (e.g., 10 PM). It was lit before Shabbos, and at 10 PM on Shabbos, it turns itself off. Now, a person wants to turn it back on.
  • Naïve Logic Output (Potentially Incorrect): Forbidden to light. The lamp was lit, and it extinguished. This fits the general rule of "lit and extinguished."
  • Expected Output (Based on Arukh HaShulchan's Nuance): Permitted to light.
  • Reasoning: This scenario hinges on the interpretation of "extinguished on its own" versus "actively turned off by an agent." While the smart bulb's action is automatic, the programming represents a pre-Shabbos intent to have it off at that specific time. It's not a failure or random extinguishment. The Arukh HaShulchan's emphasis on agency and intention (especially when it leads to a state of non-use) suggests this might be viewed differently than a bulb burning out or running out of fuel. It's akin to intentionally turning it off. The "preparation" was for its function until 10 PM, after which the preparation was for it to be off. The act of turning it back on is therefore initiating a new state of use, not restoring a previously interrupted one.

Edge Case 2: The Lamp with a "Flickering" Bulb

  • Input: A lamp was lit before Shabbos. The bulb is faulty and flickers intermittently – sometimes it's on, sometimes it's off, even without external intervention. During Shabbos, it flickers off. The user wants to turn it on.
  • Naïve Logic Output (Potentially Incorrect): Forbidden to light. It was lit and became unlit.
  • Expected Output (Based on Arukh HaShulchan's Nuance): Permitted to light.
  • Reasoning: This case tests the definition of "extinguished on its own" versus a stable state. A flickering bulb is not in a stable "lit" state. It's in a state of inherent instability. The intermittency means it wasn't consistently "prepared" for illumination throughout the time it was "lit." The flickering off event could be seen as a failure of the bulb to maintain its state, thus making the subsequent act of turning it on a permissible re-initiation rather than a forbidden continuation. The Arukh HaShulchan's emphasis on the lamp being "in a person's hand" and "able to perform a melacha" might imply a requirement for a stable, functional state to begin with for the prohibition of hachana to fully apply.

Edge Case 3: The Battery-Powered Lamp with "Low Battery" Warning

  • Input: A battery-powered lamp was lit before Shabbos. During Shabbos, it begins to dim significantly, and a "low battery" indicator flashes, indicating imminent failure. It then goes out. The user wants to replace the battery and turn it on.
  • Naïve Logic Output (Potentially Incorrect): Forbidden to light. It was lit and extinguished.
  • Expected Output (Based on Arukh HaShulchan's Nuance): Permitted to light.
  • Reasoning: Similar to the flickering bulb, the "low battery" warning signifies that the lamp was no longer in a stable, functional state of providing light. The extinguishment is a consequence of the depletion of its power source, indicating the end of its operational capacity. The act of replacing the battery and turning it on is akin to a new activation of a device that has effectively "finished its cycle" rather than being interrupted mid-preparation. The Arukh HaShulchan focuses on the melacha itself; if the melacha has ceased due to inherent limitations of the device, subsequent activation might be permitted.

Edge Case 4: The "Pilot Light" Scenario in Modern Appliances

  • Input: A modern gas stove has a pilot light that is always on, even when the main burners are off. This pilot light is connected to the gas supply and is essentially "lit" continuously. If the pilot light goes out on its own during Shabbos, is it forbidden to relight it (which would involve turning the gas control knob)?
  • Naïve Logic Output (Potentially Incorrect): Permitted to light. It's not a primary illumination device.
  • Expected Output (Based on Arukh HaShulchan's Nuance): Forbidden to light.
  • Reasoning: This pushes the boundaries of what constitutes "illumination" or "melacha." While not providing general light, the pilot light is a flame, and its continuous existence is a result of the gas supply being active and ignited. If it was lit before Shabbos and extinguished on its own, it falls under the prohibition of relighting something that was lit and extinguished, as it represents a continuous "state" of active gas flow being maintained by flame. The act of relighting the pilot is analogous to relighting a lamp that was lit. The Arukh HaShulchan's broad inclusion of "lamps outside" and "tinderboxes" suggests a wide interpretation of what "lighting" entails.

Edge Case 5: The "Smart Plug" Controlled Lamp

  • Input: An ordinary lamp is plugged into a smart plug. The smart plug is controlled via an app. The lamp was lit before Shabbos. During Shabbos, the user intentionally turns the lamp off using the app. Later, they want to turn it back on using the app.
  • Naïve Logic Output (Potentially Incorrect): Forbidden to light. It was lit and then turned off.
  • Expected Output (Based on Arukh HaShulchan's Nuance): Permitted to light.
  • Reasoning: This is a key test case for the distinction between "extinguished on its own" and "intentionally extinguished." Using an app to turn off a smart plug is a form of intentional action. The Arukh HaShulchan permits relighting if the lamp was intentionally extinguished before Shabbos. The app-based control, even if remote, represents a deliberate action by the user. Therefore, if the lamp was turned off intentionally via the app, relighting it via the app should be permissible. This is a direct application of the principle that user intent overrides the "preparedness" of the device.

These edge cases highlight that the system's rules are sensitive to:

  • The nature of the extinguishment (intentional vs. automatic vs. failure).
  • The timing of events (before Shabbos vs. during Shabbos).
  • The agency involved (user, device, external factors).
  • The fundamental capability of the device.

A robust halachic system, like good software, needs to handle these variations gracefully to ensure accurate and consistent observance.

Refactor: Minimal Change for Maximum Clarity

Let's propose a minimal refactor – a single, elegant change to the underlying logic that could clarify the rules and reduce ambiguity. This is like finding a single line of code that fixes a major bug and improves overall system readability.

Proposed Refactor:

Introduce a clear distinction between "Active Preparation" and "Passive Potential."

  • "Active Preparation" (Hachana Gemura): This refers to a state where the object was actively lit or in a state of continuous performance of its melacha before Shabbos, and this state was then interrupted by something other than intentional deactivation.
  • "Passive Potential" (Koach Le'hit'chatech): This refers to a state where the object has the capacity to perform a melacha, but it was not actively engaged in that melacha before Shabbos, and its current state of inactivity is either intentional or due to a lack of connection/power.

Implementation of Refactor in the Logic:

The core rule would be modified:

Original Rule (Simplified): If a lamp was lit before Shabbos and extinguished, it's forbidden to light it. Refactored Rule: If a lamp was in a state of Active Preparation before Shabbos and its active state was interrupted (not by intentional deactivation), it is forbidden to restore it. However, if it was in a state of Passive Potential and is now being activated, it is permitted.

Applying the Refactor:

  • Lamp lit and extinguished on its own (211:6): This is Active Preparation interrupted. Forbidden.
  • Lamp intentionally extinguished before Shabbos (implied): This negates Active Preparation. Permitted to relight (as it now enters a state of Passive Potential, then Active Use).
  • Lamp unlit, connected, functional, switch off (211:5, 211:11): This is Passive Potential. Permitted to activate.
  • Lamp disconnected from power before Shabbos (211:9): This is Passive Potential (or less than potential). Permitted to activate.
  • Lamp lit, then power outage during Shabbos (211:6): This is Active Preparation interrupted. Forbidden.
  • Smart bulb programmed to turn off (Edge Case 1): The programming represents an intentional deactivation for a period. After deactivation, it enters Passive Potential. Permitted to reactivate.
  • Flickering bulb (Edge Case 2) / Low Battery (Edge Case 3): These are states of failed Active Preparation. The failure means it's no longer actively preparing. Subsequent activation is from a state of Passive Potential (or less). Permitted.

Why this Refactor is Minimal and Effective:

  • Minimal Change: It doesn't introduce entirely new concepts but re-categorizes existing ones with clearer definitions. It's a semantic refactor, clarifying the meaning of the existing halachic categories.
  • Clarity: The distinction between "Active Preparation" and "Passive Potential" provides a more intuitive framework. "Active Preparation" is about maintaining a running process, while "Passive Potential" is about having the capability to start a process.
  • Resolves Ambiguity: It directly addresses the core ambiguity: when does being "ready" become a prohibition? It's when that readiness was an active, ongoing state that was interrupted. If the "readiness" was merely latent capability, then activating it is fine.
  • Modern Application: This refactor naturally accommodates modern devices. A switched-off lamp isn't actively "preparing" for illumination; it has the "passive potential." A lamp that was unplugged is even further from active preparation.

This refactoring aligns the system's logic with the practical application of halacha, making the rules more predictable and easier to implement in diverse technological contexts. It’s like adding a well-documented API to a complex library, making its functions accessible and understandable.

Takeaway: The System Architecture of Shabbos

Our deep dive into Arukh HaShulchan 211:5-12 reveals that the halachic system governing Shabbos lamps is not a simple if-then-else structure. Instead, it's a sophisticated system with complex state management, event handling, and nuanced rule-sets.

The central "bug" or ambiguity we've been debugging is the definition of "preparedness" (hachana). Is a lamp connected to power but switched off "prepared" for illumination, making its activation a prohibited continuation of a pre-existing state? Or is it merely in a state of "potential," where its activation is a permissible initial act?

We've seen how different commentators can be viewed as implementing different algorithms:

  • Algorithm A (Rishonim-centric): Focuses heavily on whether the lamp was lit before Shabbos and was then interrupted. This is a stricter interpretation, linking prohibition directly to a prior active state.
  • Algorithm B (Arukh HaShulchan): Presents a more refined algorithm, incorporating nuanced distinctions between active preparation and passive potential, the nature of extinguishment (intentional vs. accidental), and the importance of agency. This leads to a generally more permissive approach for modern devices.

We've explored edge cases – smart bulbs, flickering lamps, pilot lights – that test the limits of these algorithms, demonstrating that a robust system must account for diverse scenarios and interpretations.

The proposed refactor, distinguishing between Active Preparation and Passive Potential, offers a minimal yet powerful change. It clarifies that the prohibition applies when an active process is interrupted, not when a latent capability is activated. This framework allows for a more consistent and practical application of the halacha in our ever-evolving technological landscape.

Ultimately, this sugya teaches us that understanding Shabbos observance is like understanding system architecture. It requires:

  1. Defining States: Clearly identifying the possible states of an object (lit, unlit, connected, disconnected, functional, broken).
  2. Mapping Transitions: Understanding how an object moves between states and what triggers these transitions (user action, external event, internal failure).
  3. Interpreting Rules: Analyzing the specific halachic rules (like hachana, molid, boneh) as system-wide policies that govern these transitions.
  4. Handling Exceptions: Identifying and addressing edge cases that could lead to system errors or incorrect outputs.
  5. Refactoring for Clarity: Continuously seeking ways to simplify and clarify the underlying logic for more robust and accessible observance.

By applying systems thinking to these ancient texts, we can gain a deeper appreciation for the intricate design and enduring relevance of Jewish law. The humble Shabbos lamp, in its quiet glow, becomes a testament to a profound and dynamic system of ethical and spiritual engineering.