Case 952
The missed dose was doubled up and the peak was the problem
the_missed_dose_was_doubled_up_and_the_peak_was_the_problem.eml - A patient at steady state on a once-a-day drug misses a day, reasons that the missed tablet is owed and takes two the next morning, and the amount taken over the two days comes out exactly right. Where the two tablets put the peak is computed below.
ok: true — round-trip fixpoint reached (python1 == python2)updated 2026-09-21
EML
eml# Self-authored for the EML case corpus (no external origin). A patient at
# steady state on a once-a-day drug misses a day, reasons that the missed
# tablet is owed and takes two the next morning, and the amount taken over the
# two days comes out exactly right. Where the two tablets put the peak is
# computed below.
#
# The reasoning is careful. One dose was genuinely missed; two tablets over two
# days is exactly the prescribed total; the level had genuinely dropped; and
# the intent is exactly 'get back to where the schedule would have had me'.
#
# The schedule's peak is two tablets' worth, not one, because half of yesterday
# is always still there - so a double tablet lands on a half-cleared level and
# peaks a quarter above the normal peak, over the ceiling two mornings running,
# while one tablet would have been back inside the window the same morning.
100 => dose_mg
1 => half_life_days
80 => window_floor_mg
220 => window_ceiling_mg
dose_mg * 2 => steady_peak_mg
int(steady_peak_mg / 2) => steady_trough_mg
int(steady_trough_mg / 2) => level_after_the_missed_day_mg
window_floor_mg - level_after_the_missed_day_mg => shortfall_below_the_floor_on_the_missed_day_mg
level_after_the_missed_day_mg + dose_mg => single_tablet_peak_day_one_mg
int(single_tablet_peak_day_one_mg / 2) + dose_mg => single_tablet_peak_day_two_mg
level_after_the_missed_day_mg + dose_mg * 2 => double_tablet_peak_day_one_mg
int(double_tablet_peak_day_one_mg / 2) + dose_mg => double_tablet_peak_day_two_mg
double_tablet_peak_day_one_mg - window_ceiling_mg => double_tablet_above_ceiling_day_one_mg
double_tablet_peak_day_two_mg - window_ceiling_mg => double_tablet_above_ceiling_day_two_mg
window_ceiling_mg - single_tablet_peak_day_one_mg => single_tablet_below_ceiling_day_one_mg
int(double_tablet_peak_day_one_mg * 10000 / steady_peak_mg) => double_tablet_peak_as_a_share_of_the_normal_peak_per_myriad
dose_mg * 2 => tablets_taken_over_the_two_days_either_way_mg
"tablet : " + str(dose_mg) + " mg a day, half-life " + str(half_life_days) + " day" ^0
"window : " + str(window_floor_mg) + " to " + str(window_ceiling_mg) + " mg" ^0
"steady state : peak " + str(steady_peak_mg) + ", trough " + str(steady_trough_mg) + " mg" ^0
"after the missed day : " + str(level_after_the_missed_day_mg) + " mg, " + str(shortfall_below_the_floor_on_the_missed_day_mg) + " under the floor" ^0
"" ^0
"one tablet, next morning : peak " + str(single_tablet_peak_day_one_mg) + " mg, " + str(single_tablet_below_ceiling_day_one_mg) + " under the ceiling" ^0
"one tablet, morning after : peak " + str(single_tablet_peak_day_two_mg) + " mg, inside the window" ^0
"two tablets, next morning : peak " + str(double_tablet_peak_day_one_mg) + " mg, " + str(double_tablet_above_ceiling_day_one_mg) + " over the ceiling" ^0
"two tablets, morning after : peak " + str(double_tablet_peak_day_two_mg) + " mg, " + str(double_tablet_above_ceiling_day_two_mg) + " over the ceiling" ^0
"double peak vs normal peak : " + str(double_tablet_peak_as_a_share_of_the_normal_peak_per_myriad) + " per ten thousand" ^0
"tablets over the two days : " + str(tablets_taken_over_the_two_days_either_way_mg) + " mg, either way" ^0
"" ^0
# ---- what the patient verified ----
"the catch-up reasoning" ^0
" missed : one tablet, yesterday" ^0
" owed : one tablet, so two today" ^0
" total : two tablets over two days, exactly as prescribed" ^0
" level : genuinely low this morning" ^0
" intent : get back to where the schedule would have had me" ^0
" facts wrong : 0" ^0
" verdict : TAKE THE MISSED ONE WITH TODAY'S" ^0
"" ^0
" keeping the two-day total at two tablets is the part done" ^0
" right here, and it is why the amount swallowed matches the" ^0
" prescription to the milligram" ^0
"" ^0
# ---- where the two tablets land ----
"the peak" ^0
" what the schedule's peak is : " + str(steady_peak_mg) + " mg, one tablet on top" ^0
" of half of yesterday's, never a bare tablet" ^0
" what this morning's level is : " + str(level_after_the_missed_day_mg) + " mg, two halvings" ^0
" from the last peak" ^0
" one tablet on that : " + str(single_tablet_peak_day_one_mg) + " mg, inside the window at once" ^0
" two tablets on that : " + str(double_tablet_peak_day_one_mg) + " mg, " + str(double_tablet_above_ceiling_day_one_mg) + " over the ceiling," ^0
" and tomorrow's tablet lands on half of that, " + str(double_tablet_peak_day_two_mg) ^0
" what the total does not control : the height of the peak," ^0
" which is set by how much arrives at once" ^0
"" ^0
# ---- what the patient got ----
"the exposure" ^0
" believed : back on schedule" ^0
" actual : two mornings over the ceiling, " + str(double_tablet_above_ceiling_day_one_mg) + " and then " + str(double_tablet_above_ceiling_day_two_mg) + " mg" ^0
" is the two-day total right : yes, to the milligram" ^0
" is the peak right : no; the missed day already cost a morning" ^0
" under the floor, and the double tablet added two mornings" ^0
" over the ceiling to it" ^0
"" ^0
# ---- null control ----
# The same missed day answered by resuming the schedule instead of by
# repaying the total.
250 => nc_peak_on_repaying_the_total_mg
150 => nc_peak_on_resuming_the_schedule_mg
100 => nc_peak_height_the_repayment_adds_mg
"null control - resume the schedule, do not repay the total" ^0
" peak, repaying the total : " + str(nc_peak_on_repaying_the_total_mg) + " mg" ^0
" peak, resuming the schedule : " + str(nc_peak_on_resuming_the_schedule_mg) + " mg" ^0
" peak height the repayment adds : " + str(nc_peak_height_the_repayment_adds_mg) + " mg" ^0
" no tablet and no window changed; the level was steered by" ^0
" its peak and not by its total" ^0
"" ^0
# ---- the rule ----
"what an exact two-day total guarantees" ^0
" the prescribed amount was taken : exactly, " + str(tablets_taken_over_the_two_days_either_way_mg) + " mg over two days" ^0
" the level stayed inside the window : not addressed; the" ^0
" window is about peaks, and two tablets arriving together" ^0
" peak at " + str(double_tablet_peak_day_one_mg) + " mg, " + str(double_tablet_above_ceiling_day_one_mg) + " over a ceiling that one tablet would" ^0
" have stayed " + str(single_tablet_below_ceiling_day_one_mg) + " under" ^0
"" ^0
"a schedule is a shape, not a sum; the body answers to the height of what" ^0
"arrives this morning, and a debt repaid all at once is paid in a currency the" ^0
"ceiling counts and the total does not" ^0
"" ^0
"The two-day total is exact: " + str(tablets_taken_over_the_two_days_either_way_mg) + " mg, whichever way the tablets are taken." ^0
"But the ceiling is a peak, and two tablets on a morning level of " + str(level_after_the_missed_day_mg) + " mg peak" ^0
"at " + str(double_tablet_peak_day_one_mg) + " - " + str(double_tablet_above_ceiling_day_one_mg) + " over the ceiling, then " + str(double_tablet_peak_day_two_mg) + " the next day - where one tablet peaks at" ^0
"" + str(single_tablet_peak_day_one_mg) + ", inside the window at once, until the level is steered by its peak, not its sum." ^0Python (deterministic transpilation)
pythondose_mg = 100
half_life_days = 1
window_floor_mg = 80
window_ceiling_mg = 220
steady_peak_mg = dose_mg * 2
steady_trough_mg = int(steady_peak_mg / 2)
level_after_the_missed_day_mg = int(steady_trough_mg / 2)
shortfall_below_the_floor_on_the_missed_day_mg = window_floor_mg - level_after_the_missed_day_mg
single_tablet_peak_day_one_mg = level_after_the_missed_day_mg + dose_mg
single_tablet_peak_day_two_mg = int(single_tablet_peak_day_one_mg / 2) + dose_mg
double_tablet_peak_day_one_mg = level_after_the_missed_day_mg + dose_mg * 2
double_tablet_peak_day_two_mg = int(double_tablet_peak_day_one_mg / 2) + dose_mg
double_tablet_above_ceiling_day_one_mg = double_tablet_peak_day_one_mg - window_ceiling_mg
double_tablet_above_ceiling_day_two_mg = double_tablet_peak_day_two_mg - window_ceiling_mg
single_tablet_below_ceiling_day_one_mg = window_ceiling_mg - single_tablet_peak_day_one_mg
double_tablet_peak_as_a_share_of_the_normal_peak_per_myriad = int(double_tablet_peak_day_one_mg * 10000 / steady_peak_mg)
tablets_taken_over_the_two_days_either_way_mg = dose_mg * 2
print("tablet : " + str(dose_mg) + " mg a day, half-life " + str(half_life_days) + " day")
print("window : " + str(window_floor_mg) + " to " + str(window_ceiling_mg) + " mg")
print("steady state : peak " + str(steady_peak_mg) + ", trough " + str(steady_trough_mg) + " mg")
print("after the missed day : " + str(level_after_the_missed_day_mg) + " mg, " + str(shortfall_below_the_floor_on_the_missed_day_mg) + " under the floor")
print("")
print("one tablet, next morning : peak " + str(single_tablet_peak_day_one_mg) + " mg, " + str(single_tablet_below_ceiling_day_one_mg) + " under the ceiling")
print("one tablet, morning after : peak " + str(single_tablet_peak_day_two_mg) + " mg, inside the window")
print("two tablets, next morning : peak " + str(double_tablet_peak_day_one_mg) + " mg, " + str(double_tablet_above_ceiling_day_one_mg) + " over the ceiling")
print("two tablets, morning after : peak " + str(double_tablet_peak_day_two_mg) + " mg, " + str(double_tablet_above_ceiling_day_two_mg) + " over the ceiling")
print("double peak vs normal peak : " + str(double_tablet_peak_as_a_share_of_the_normal_peak_per_myriad) + " per ten thousand")
print("tablets over the two days : " + str(tablets_taken_over_the_two_days_either_way_mg) + " mg, either way")
print("")
print("the catch-up reasoning")
print(" missed : one tablet, yesterday")
print(" owed : one tablet, so two today")
print(" total : two tablets over two days, exactly as prescribed")
print(" level : genuinely low this morning")
print(" intent : get back to where the schedule would have had me")
print(" facts wrong : 0")
print(" verdict : TAKE THE MISSED ONE WITH TODAY'S")
print("")
print(" keeping the two-day total at two tablets is the part done")
print(" right here, and it is why the amount swallowed matches the")
print(" prescription to the milligram")
print("")
print("the peak")
print(" what the schedule's peak is : " + str(steady_peak_mg) + " mg, one tablet on top")
print(" of half of yesterday's, never a bare tablet")
print(" what this morning's level is : " + str(level_after_the_missed_day_mg) + " mg, two halvings")
print(" from the last peak")
print(" one tablet on that : " + str(single_tablet_peak_day_one_mg) + " mg, inside the window at once")
print(" two tablets on that : " + str(double_tablet_peak_day_one_mg) + " mg, " + str(double_tablet_above_ceiling_day_one_mg) + " over the ceiling,")
print(" and tomorrow's tablet lands on half of that, " + str(double_tablet_peak_day_two_mg))
print(" what the total does not control : the height of the peak,")
print(" which is set by how much arrives at once")
print("")
print("the exposure")
print(" believed : back on schedule")
print(" actual : two mornings over the ceiling, " + str(double_tablet_above_ceiling_day_one_mg) + " and then " + str(double_tablet_above_ceiling_day_two_mg) + " mg")
print(" is the two-day total right : yes, to the milligram")
print(" is the peak right : no; the missed day already cost a morning")
print(" under the floor, and the double tablet added two mornings")
print(" over the ceiling to it")
print("")
nc_peak_on_repaying_the_total_mg = 250
nc_peak_on_resuming_the_schedule_mg = 150
nc_peak_height_the_repayment_adds_mg = 100
print("null control - resume the schedule, do not repay the total")
print(" peak, repaying the total : " + str(nc_peak_on_repaying_the_total_mg) + " mg")
print(" peak, resuming the schedule : " + str(nc_peak_on_resuming_the_schedule_mg) + " mg")
print(" peak height the repayment adds : " + str(nc_peak_height_the_repayment_adds_mg) + " mg")
print(" no tablet and no window changed; the level was steered by")
print(" its peak and not by its total")
print("")
print("what an exact two-day total guarantees")
print(" the prescribed amount was taken : exactly, " + str(tablets_taken_over_the_two_days_either_way_mg) + " mg over two days")
print(" the level stayed inside the window : not addressed; the")
print(" window is about peaks, and two tablets arriving together")
print(" peak at " + str(double_tablet_peak_day_one_mg) + " mg, " + str(double_tablet_above_ceiling_day_one_mg) + " over a ceiling that one tablet would")
print(" have stayed " + str(single_tablet_below_ceiling_day_one_mg) + " under")
print("")
print("a schedule is a shape, not a sum; the body answers to the height of what")
print("arrives this morning, and a debt repaid all at once is paid in a currency the")
print("ceiling counts and the total does not")
print("")
print("The two-day total is exact: " + str(tablets_taken_over_the_two_days_either_way_mg) + " mg, whichever way the tablets are taken.")
print("But the ceiling is a peak, and two tablets on a morning level of " + str(level_after_the_missed_day_mg) + " mg peak")
print("at " + str(double_tablet_peak_day_one_mg) + " - " + str(double_tablet_above_ceiling_day_one_mg) + " over the ceiling, then " + str(double_tablet_peak_day_two_mg) + " the next day - where one tablet peaks at")
print("" + str(single_tablet_peak_day_one_mg) + ", inside the window at once, until the level is steered by its peak, not its sum.")stdout (executed)
texttablet : 100 mg a day, half-life 1 day
window : 80 to 220 mg
steady state : peak 200, trough 100 mg
after the missed day : 50 mg, 30 under the floor
one tablet, next morning : peak 150 mg, 70 under the ceiling
one tablet, morning after : peak 175 mg, inside the window
two tablets, next morning : peak 250 mg, 30 over the ceiling
two tablets, morning after : peak 225 mg, 5 over the ceiling
double peak vs normal peak : 12500 per ten thousand
tablets over the two days : 200 mg, either way
the catch-up reasoning
missed : one tablet, yesterday
owed : one tablet, so two today
total : two tablets over two days, exactly as prescribed
level : genuinely low this morning
intent : get back to where the schedule would have had me
facts wrong : 0
verdict : TAKE THE MISSED ONE WITH TODAY'S
keeping the two-day total at two tablets is the part done
right here, and it is why the amount swallowed matches the
prescription to the milligram
the peak
what the schedule's peak is : 200 mg, one tablet on top
of half of yesterday's, never a bare tablet
what this morning's level is : 50 mg, two halvings
from the last peak
one tablet on that : 150 mg, inside the window at once
two tablets on that : 250 mg, 30 over the ceiling,
and tomorrow's tablet lands on half of that, 225
what the total does not control : the height of the peak,
which is set by how much arrives at once
the exposure
believed : back on schedule
actual : two mornings over the ceiling, 30 and then 5 mg
is the two-day total right : yes, to the milligram
is the peak right : no; the missed day already cost a morning
under the floor, and the double tablet added two mornings
over the ceiling to it
null control - resume the schedule, do not repay the total
peak, repaying the total : 250 mg
peak, resuming the schedule : 150 mg
peak height the repayment adds : 100 mg
no tablet and no window changed; the level was steered by
its peak and not by its total
what an exact two-day total guarantees
the prescribed amount was taken : exactly, 200 mg over two days
the level stayed inside the window : not addressed; the
window is about peaks, and two tablets arriving together
peak at 250 mg, 30 over a ceiling that one tablet would
have stayed 70 under
a schedule is a shape, not a sum; the body answers to the height of what
arrives this morning, and a debt repaid all at once is paid in a currency the
ceiling counts and the total does not
The two-day total is exact: 200 mg, whichever way the tablets are taken.
But the ceiling is a peak, and two tablets on a morning level of 50 mg peak
at 250 - 30 over the ceiling, then 225 the next day - where one tablet peaks at
150, inside the window at once, until the level is steered by its peak, not its sum.Trace event types
eml:run:starteml:assigneml:outputeml:run:done