<!-- canonical: efficientnewlanguage.org/ai/examples/960-the-house-that-cooled-overnight-lost-less | ai_layer_version: 0.1.0 | updated: 2026-09-22 -->

# Example 960 — The house that cooled overnight lost less

`the_house_that_cooled_overnight_lost_less.eml` - A household keeps the heating on all night because reheating a cold house in the morning is said to cost more than the heat saved, the reasoning is repeated by the neighbours, and the meter says the opposite. What a house loses at each temperature, and what reheating actually pays for, is computed below.

## EML

```eml
# Self-authored for the EML case corpus (no external origin). A household
# keeps the heating on all night because reheating a cold house in the morning
# is said to cost more than the heat saved, the reasoning is repeated by the
# neighbours, and the meter says the opposite. What a house loses at each
# temperature, and what reheating actually pays for, is computed below.
#
# The reasoning is careful. Reheating from cold really does take a burst of
# energy; the burst is visible on the meter; the night is long; and the intent
# was exactly 'use the least energy overall'.
#
# A house loses heat in proportion to how much warmer it is than outside, so
# every hour it spends cooler than its daytime setting loses less, and the
# morning reheat is exactly the heat the cooler house did not lose overnight -
# never more. Modelled here with a simple linear cool-down from 20 to 15
# degrees over the eight hours, which is enough to show the sign.

20 => inside_setting_c
15 => cooled_inside_by_morning_c
5 => outside_c
8 => night_hours
200 => house_loss_watts_per_kelvin

inside_setting_c - outside_c => gap_at_the_setting_k
cooled_inside_by_morning_c - outside_c => gap_when_cooled_k
gap_at_the_setting_k * night_hours => heating_on_loss_kelvin_hours
int((gap_at_the_setting_k + gap_when_cooled_k) * night_hours / 2) => heating_off_loss_kelvin_hours
heating_on_loss_kelvin_hours - heating_off_loss_kelvin_hours => kelvin_hours_saved
int(kelvin_hours_saved * 10000 / heating_on_loss_kelvin_hours) => saving_per_myriad
int(house_loss_watts_per_kelvin * heating_on_loss_kelvin_hours / 1000) => heating_on_kwh
int(house_loss_watts_per_kelvin * heating_off_loss_kelvin_hours / 1000) => heating_off_kwh_including_the_reheat
heating_on_kwh - heating_off_kwh_including_the_reheat => kwh_saved_per_night
inside_setting_c - cooled_inside_by_morning_c => degrees_the_reheat_must_restore_k

"setting                         : " + str(inside_setting_c) + " C inside, " + str(outside_c) + " C outside, gap " + str(gap_at_the_setting_k) + " K" ^0
"if left off                     : cools to " + str(cooled_inside_by_morning_c) + " C by morning, gap " + str(gap_when_cooled_k) + " K" ^0
"night                           : " + str(night_hours) + " hours; house loses " + str(house_loss_watts_per_kelvin) + " W per K" ^0
"" ^0
"loss, heating on all night      : " + str(heating_on_loss_kelvin_hours) + " kelvin-hours, " + str(heating_on_kwh) + " kWh" ^0
"loss, heating off, reheat included : " + str(heating_off_loss_kelvin_hours) + " kelvin-hours, " + str(heating_off_kwh_including_the_reheat) + " kWh" ^0
"saved by switching off          : " + str(kelvin_hours_saved) + " kelvin-hours, " + str(saving_per_myriad) + " per ten thousand, " + str(kwh_saved_per_night) + " kWh a night" ^0
"the morning reheat restores     : " + str(degrees_the_reheat_must_restore_k) + " K, paid out of the " + str(heating_off_kwh_including_the_reheat) + " kWh, not on top of it" ^0
"" ^0

# ---- what the household verified ----

"the reheat-costs-more reasoning" ^0
"  the burst : real, and visible on the meter each morning" ^0
"  the night : " + str(night_hours) + " hours, long" ^0
"  the neighbours : agree" ^0
"  intent : use the least energy overall" ^0
"  facts wrong : 0" ^0
"  verdict : KEEP IT ON, REHEATING COSTS MORE" ^0
"" ^0
"  noticing that the reheat is a real burst of energy is the" ^0
"  part done right here, and it is why the morning meter reading" ^0
"  genuinely jumps when the heating comes back on" ^0
"" ^0

# ---- what a house loses at each temperature ----

"loss follows the gap" ^0
"  what leaves the house : heat in proportion to inside minus" ^0
"    outside, every hour" ^0
"  heating on : the gap stays " + str(gap_at_the_setting_k) + " K all night, " + str(heating_on_loss_kelvin_hours) + " kelvin-hours" ^0
"  heating off : the gap shrinks from " + str(gap_at_the_setting_k) + " to " + str(gap_when_cooled_k) + ", " + str(heating_off_loss_kelvin_hours) + " kelvin-hours" ^0
"  what the reheat is : the heat that left the house while it" ^0
"    cooled, put back - and less left, because it was cooler" ^0
"  what the burst on the meter shows : that heat is being" ^0
"    supplied fast, not that more of it is being supplied" ^0
"" ^0

# ---- what the household got ----

"the meter" ^0
"  believed : less energy overall by never letting it cool" ^0
"  actual : " + str(kwh_saved_per_night) + " kWh a night more than switching off" ^0
"  is the reheat burst imaginary : no; it is " + str(degrees_the_reheat_must_restore_k) + " K of heat" ^0
"    supplied quickly" ^0
"  does it exceed the saving : no; it IS what was saved, minus" ^0
"    the part the cooler house never lost" ^0
"" ^0

# ---- null control ----

# The same night compared by total kelvin-hours of gap instead of by the size
# of the morning burst.
120 => nc_loss_read_from_keeping_the_gap_kelvin_hours
100 => nc_loss_read_from_letting_the_gap_shrink_kelvin_hours
20 => nc_kelvin_hours_the_cooler_house_never_lost

"null control - count the gap over the whole night" ^0
"  loss, keeping the gap : " + str(nc_loss_read_from_keeping_the_gap_kelvin_hours) + " kelvin-hours" ^0
"  loss, letting the gap shrink : " + str(nc_loss_read_from_letting_the_gap_shrink_kelvin_hours) + " kelvin-hours" ^0
"  kelvin-hours the cooler house never lost : " + str(nc_kelvin_hours_the_cooler_house_never_lost) ^0
"  no house and no weather changed; the whole night was" ^0
"  counted instead of the moment the heating came back" ^0
"" ^0

# ---- the rule ----

"what a visible morning reheat guarantees" ^0
"  heat is supplied fast when the heating returns : exactly" ^0
"  keeping the house warm all night uses less : not addressed;" ^0
"    loss follows the gap, the cooler house loses " + str(heating_off_loss_kelvin_hours) + " kelvin-hours" ^0
"    to the warm house's " + str(heating_on_loss_kelvin_hours) + ", and the reheat is paid out of that smaller" ^0
"    figure, " + str(kwh_saved_per_night) + " kWh a night less in all" ^0
"" ^0

"a burst is a rate, not an amount; the house that spent the night cooler owed" ^0
"less to the outside, and the morning's rush is the smaller debt being paid" ^0
"quickly, not a larger one" ^0
"" ^0

"The morning reheat is real - the meter jumps. But loss follows the gap to" ^0
"outside: on all night is " + str(heating_on_loss_kelvin_hours) + " kelvin-hours, off is " + str(heating_off_loss_kelvin_hours) + " with the reheat" ^0
"inside that figure, so switching off saves " + str(kelvin_hours_saved) + " kelvin-hours, " + str(kwh_saved_per_night) + " kWh a night, until" ^0
"the burst is read as speed and the night is read as a total." ^0
```

## Python (deterministic transpilation)

```python
inside_setting_c = 20
cooled_inside_by_morning_c = 15
outside_c = 5
night_hours = 8
house_loss_watts_per_kelvin = 200
gap_at_the_setting_k = inside_setting_c - outside_c
gap_when_cooled_k = cooled_inside_by_morning_c - outside_c
heating_on_loss_kelvin_hours = gap_at_the_setting_k * night_hours
heating_off_loss_kelvin_hours = int((gap_at_the_setting_k + gap_when_cooled_k) * night_hours / 2)
kelvin_hours_saved = heating_on_loss_kelvin_hours - heating_off_loss_kelvin_hours
saving_per_myriad = int(kelvin_hours_saved * 10000 / heating_on_loss_kelvin_hours)
heating_on_kwh = int(house_loss_watts_per_kelvin * heating_on_loss_kelvin_hours / 1000)
heating_off_kwh_including_the_reheat = int(house_loss_watts_per_kelvin * heating_off_loss_kelvin_hours / 1000)
kwh_saved_per_night = heating_on_kwh - heating_off_kwh_including_the_reheat
degrees_the_reheat_must_restore_k = inside_setting_c - cooled_inside_by_morning_c
print("setting                         : " + str(inside_setting_c) + " C inside, " + str(outside_c) + " C outside, gap " + str(gap_at_the_setting_k) + " K")
print("if left off                     : cools to " + str(cooled_inside_by_morning_c) + " C by morning, gap " + str(gap_when_cooled_k) + " K")
print("night                           : " + str(night_hours) + " hours; house loses " + str(house_loss_watts_per_kelvin) + " W per K")
print("")
print("loss, heating on all night      : " + str(heating_on_loss_kelvin_hours) + " kelvin-hours, " + str(heating_on_kwh) + " kWh")
print("loss, heating off, reheat included : " + str(heating_off_loss_kelvin_hours) + " kelvin-hours, " + str(heating_off_kwh_including_the_reheat) + " kWh")
print("saved by switching off          : " + str(kelvin_hours_saved) + " kelvin-hours, " + str(saving_per_myriad) + " per ten thousand, " + str(kwh_saved_per_night) + " kWh a night")
print("the morning reheat restores     : " + str(degrees_the_reheat_must_restore_k) + " K, paid out of the " + str(heating_off_kwh_including_the_reheat) + " kWh, not on top of it")
print("")
print("the reheat-costs-more reasoning")
print("  the burst : real, and visible on the meter each morning")
print("  the night : " + str(night_hours) + " hours, long")
print("  the neighbours : agree")
print("  intent : use the least energy overall")
print("  facts wrong : 0")
print("  verdict : KEEP IT ON, REHEATING COSTS MORE")
print("")
print("  noticing that the reheat is a real burst of energy is the")
print("  part done right here, and it is why the morning meter reading")
print("  genuinely jumps when the heating comes back on")
print("")
print("loss follows the gap")
print("  what leaves the house : heat in proportion to inside minus")
print("    outside, every hour")
print("  heating on : the gap stays " + str(gap_at_the_setting_k) + " K all night, " + str(heating_on_loss_kelvin_hours) + " kelvin-hours")
print("  heating off : the gap shrinks from " + str(gap_at_the_setting_k) + " to " + str(gap_when_cooled_k) + ", " + str(heating_off_loss_kelvin_hours) + " kelvin-hours")
print("  what the reheat is : the heat that left the house while it")
print("    cooled, put back - and less left, because it was cooler")
print("  what the burst on the meter shows : that heat is being")
print("    supplied fast, not that more of it is being supplied")
print("")
print("the meter")
print("  believed : less energy overall by never letting it cool")
print("  actual : " + str(kwh_saved_per_night) + " kWh a night more than switching off")
print("  is the reheat burst imaginary : no; it is " + str(degrees_the_reheat_must_restore_k) + " K of heat")
print("    supplied quickly")
print("  does it exceed the saving : no; it IS what was saved, minus")
print("    the part the cooler house never lost")
print("")
nc_loss_read_from_keeping_the_gap_kelvin_hours = 120
nc_loss_read_from_letting_the_gap_shrink_kelvin_hours = 100
nc_kelvin_hours_the_cooler_house_never_lost = 20
print("null control - count the gap over the whole night")
print("  loss, keeping the gap : " + str(nc_loss_read_from_keeping_the_gap_kelvin_hours) + " kelvin-hours")
print("  loss, letting the gap shrink : " + str(nc_loss_read_from_letting_the_gap_shrink_kelvin_hours) + " kelvin-hours")
print("  kelvin-hours the cooler house never lost : " + str(nc_kelvin_hours_the_cooler_house_never_lost))
print("  no house and no weather changed; the whole night was")
print("  counted instead of the moment the heating came back")
print("")
print("what a visible morning reheat guarantees")
print("  heat is supplied fast when the heating returns : exactly")
print("  keeping the house warm all night uses less : not addressed;")
print("    loss follows the gap, the cooler house loses " + str(heating_off_loss_kelvin_hours) + " kelvin-hours")
print("    to the warm house's " + str(heating_on_loss_kelvin_hours) + ", and the reheat is paid out of that smaller")
print("    figure, " + str(kwh_saved_per_night) + " kWh a night less in all")
print("")
print("a burst is a rate, not an amount; the house that spent the night cooler owed")
print("less to the outside, and the morning's rush is the smaller debt being paid")
print("quickly, not a larger one")
print("")
print("The morning reheat is real - the meter jumps. But loss follows the gap to")
print("outside: on all night is " + str(heating_on_loss_kelvin_hours) + " kelvin-hours, off is " + str(heating_off_loss_kelvin_hours) + " with the reheat")
print("inside that figure, so switching off saves " + str(kelvin_hours_saved) + " kelvin-hours, " + str(kwh_saved_per_night) + " kWh a night, until")
print("the burst is read as speed and the night is read as a total.")
```

## stdout (executed)

```text
setting                         : 20 C inside, 5 C outside, gap 15 K
if left off                     : cools to 15 C by morning, gap 10 K
night                           : 8 hours; house loses 200 W per K

loss, heating on all night      : 120 kelvin-hours, 24 kWh
loss, heating off, reheat included : 100 kelvin-hours, 20 kWh
saved by switching off          : 20 kelvin-hours, 1666 per ten thousand, 4 kWh a night
the morning reheat restores     : 5 K, paid out of the 20 kWh, not on top of it

the reheat-costs-more reasoning
  the burst : real, and visible on the meter each morning
  the night : 8 hours, long
  the neighbours : agree
  intent : use the least energy overall
  facts wrong : 0
  verdict : KEEP IT ON, REHEATING COSTS MORE

  noticing that the reheat is a real burst of energy is the
  part done right here, and it is why the morning meter reading
  genuinely jumps when the heating comes back on

loss follows the gap
  what leaves the house : heat in proportion to inside minus
    outside, every hour
  heating on : the gap stays 15 K all night, 120 kelvin-hours
  heating off : the gap shrinks from 15 to 10, 100 kelvin-hours
  what the reheat is : the heat that left the house while it
    cooled, put back - and less left, because it was cooler
  what the burst on the meter shows : that heat is being
    supplied fast, not that more of it is being supplied

the meter
  believed : less energy overall by never letting it cool
  actual : 4 kWh a night more than switching off
  is the reheat burst imaginary : no; it is 5 K of heat
    supplied quickly
  does it exceed the saving : no; it IS what was saved, minus
    the part the cooler house never lost

null control - count the gap over the whole night
  loss, keeping the gap : 120 kelvin-hours
  loss, letting the gap shrink : 100 kelvin-hours
  kelvin-hours the cooler house never lost : 20
  no house and no weather changed; the whole night was
  counted instead of the moment the heating came back

what a visible morning reheat guarantees
  heat is supplied fast when the heating returns : exactly
  keeping the house warm all night uses less : not addressed;
    loss follows the gap, the cooler house loses 100 kelvin-hours
    to the warm house's 120, and the reheat is paid out of that smaller
    figure, 4 kWh a night less in all

a burst is a rate, not an amount; the house that spent the night cooler owed
less to the outside, and the morning's rush is the smaller debt being paid
quickly, not a larger one

The morning reheat is real - the meter jumps. But loss follows the gap to
outside: on all night is 120 kelvin-hours, off is 100 with the reheat
inside that figure, so switching off saves 20 kelvin-hours, 4 kWh a night, until
the burst is read as speed and the night is read as a total.
```

## Round-trip

`ok: true` — round-trip fixpoint reached (python1 == python2)

## Trace event types

eml:run:start · eml:assign · eml:output · eml:run:done
