Case 902
The demand rose ten percent and the factory saw eighty
the_demand_rose_ten_percent_and_the_factory_saw_eighty.eml - Customer demand at the shop rises ten percent, and each tier of the supply chain - retailer, wholesaler, factory - orders exactly what its own rule says: cover what it just sold and rebuild one week of safety stock. What the factory sees when every tier applies that rule to the tier below is computed below.
ok: true — round-trip fixpoint reached (python1 == python2)updated 2026-09-18
EML
eml# Self-authored for the EML case corpus (no external origin). Customer demand at
# the shop rises ten percent, and each tier of the supply chain - retailer,
# wholesaler, factory - orders exactly what its own rule says: cover what it
# just sold and rebuild one week of safety stock. What the factory sees when
# every tier applies that rule to the tier below is computed below.
#
# Each tier's ordering is careful. It reads its own real sales; it keeps exactly
# one week of safety stock; it orders to cover the sales it saw plus the stock
# it needs to restore; and the intent is exactly 'order what the demand needs'.
#
# Each tier adds its own safety-stock rebuild on top of the rise it sees, so a
# ten-percent rise at the shop becomes twenty at the retailer's order, forty at
# the wholesaler's, and eighty at the factory.
100 => shop_demand_before
110 => shop_demand_after
1 => weeks_of_safety_stock
shop_demand_after - shop_demand_before => shop_rise
shop_demand_after + shop_rise * weeks_of_safety_stock => retailer_order
retailer_order - shop_demand_before => retailer_rise
retailer_order + retailer_rise * weeks_of_safety_stock => wholesaler_order
wholesaler_order - shop_demand_before => wholesaler_rise
wholesaler_order + wholesaler_rise * weeks_of_safety_stock => factory_order
factory_order - shop_demand_before => factory_rise
int(shop_rise * 10000 / shop_demand_before) => shop_rise_per_myriad
int(factory_rise * 10000 / shop_demand_before) => factory_rise_per_myriad
int(factory_rise / shop_rise) => amplification_by_the_factory
"shop demand, before / after : " + str(shop_demand_before) + " / " + str(shop_demand_after) + ", up " + str(shop_rise_per_myriad) + " per ten thousand" ^0
"" ^0
"retailer orders : " + str(retailer_order) + " (sales " + str(shop_demand_after) + " + rebuild " + str(shop_rise) + ")" ^0
"wholesaler orders : " + str(wholesaler_order) + " (sales " + str(retailer_order) + " + rebuild " + str(retailer_rise) + ")" ^0
"factory builds : " + str(factory_order) + " (sales " + str(wholesaler_order) + " + rebuild " + str(wholesaler_rise) + ")" ^0
"" ^0
"rise at the factory : " + str(factory_rise_per_myriad) + " per ten thousand" ^0
"amplification, shop to factory : " + str(amplification_by_the_factory) + " times" ^0
"" ^0
# ---- what each tier verified ----
"each tier's order" ^0
" reads : its own real sales" ^0
" safety stock : exactly one week, restored when drawn down" ^0
" order : sales seen plus the stock to restore" ^0
" intent : order what the demand needs" ^0
" tiers ordering outside their rule : 0" ^0
" verdict : EVERY TIER ORDERED EXACTLY WHAT ITS RULE SAYS" ^0
"" ^0
" each tier reading its real sales and restoring its real" ^0
" safety stock is the part done right here, and it is why" ^0
" no tier is guessing or panicking" ^0
"" ^0
# ---- what each rule does to the tier above ----
"the whip" ^0
" the shop's rise : " + str(shop_rise) + ", the only real change" ^0
" the retailer : sees " + str(shop_rise) + " more sold, orders " + str(shop_rise) + " more plus " + str(shop_rise) + " to" ^0
" rebuild, a rise of " + str(retailer_rise) ^0
" the wholesaler : sees a rise of " + str(retailer_rise) + " and does the same, " + str(wholesaler_rise) ^0
" the factory : sees " + str(wholesaler_rise) + " and does the same, " + str(factory_rise) ^0
" so the factory builds for : a rise " + str(amplification_by_the_factory) + " times the one" ^0
" customers made" ^0
"" ^0
# ---- what the factory got ----
"the factory's view" ^0
" demand it planned for : " + str(factory_order) + " a week" ^0
" demand customers have : " + str(shop_demand_after) + " a week" ^0
" is any tier's order wrong by its rule : no" ^0
" is the factory reading customer demand : no; it is reading" ^0
" three tiers of safety-stock rebuilding stacked on it" ^0
" next week, when no tier needs to rebuild : orders fall" ^0
" back through the chain, and the factory sees a crash" ^0
"" ^0
# ---- null control ----
# The same chain sharing the shop's actual sales with every tier, so each tier
# orders on customer demand rather than on the order of the tier below.
80 => nc_factory_rise_ordering_on_the_tier_below
10 => nc_factory_rise_ordering_on_shop_sales
70 => nc_rise_the_shared_signal_removes
"null control - every tier orders on the shop's sales" ^0
" factory rise, ordering on the tier below : " + str(nc_factory_rise_ordering_on_the_tier_below) ^0
" factory rise, ordering on shop sales : " + str(nc_factory_rise_ordering_on_shop_sales) ^0
" rise the shared signal removes : " + str(nc_rise_the_shared_signal_removes) ^0
" no customer and no rule changed; each tier stopped" ^0
" reading the tier below as the customer" ^0
"" ^0
# ---- the rule ----
"what a cover-sales-and-restore-stock rule guarantees" ^0
" each tier orders what its own sales and stock require :" ^0
" exactly, real sales, real safety stock" ^0
" the chain orders what customers demand : not addressed;" ^0
" each tier reads the tier below as demand and adds its" ^0
" own rebuild, so a rise of " + str(shop_rise) + " at the shop is " + str(factory_rise) + " at the" ^0
" factory, " + str(amplification_by_the_factory) + " times over" ^0
"" ^0
"a signal passed through a chain of sensible rules is reshaped by each of them;" ^0
"what reaches the far end is the customers' change wearing three layers of" ^0
"other people's prudence, and the factory builds for the prudence" ^0
"" ^0
"Every tier orders exactly what its rule says - real sales plus a real safety" ^0
"stock rebuild. But each tier reads the one below as demand and adds its own" ^0
"rebuild, so the shop's rise of " + str(shop_rise_per_myriad) + " per ten thousand reaches the factory as" ^0
"" + str(factory_rise_per_myriad) + ", " + str(amplification_by_the_factory) + " times over, until every tier orders on the shop's own sales." ^0Python (deterministic transpilation)
pythonshop_demand_before = 100
shop_demand_after = 110
weeks_of_safety_stock = 1
shop_rise = shop_demand_after - shop_demand_before
retailer_order = shop_demand_after + shop_rise * weeks_of_safety_stock
retailer_rise = retailer_order - shop_demand_before
wholesaler_order = retailer_order + retailer_rise * weeks_of_safety_stock
wholesaler_rise = wholesaler_order - shop_demand_before
factory_order = wholesaler_order + wholesaler_rise * weeks_of_safety_stock
factory_rise = factory_order - shop_demand_before
shop_rise_per_myriad = int(shop_rise * 10000 / shop_demand_before)
factory_rise_per_myriad = int(factory_rise * 10000 / shop_demand_before)
amplification_by_the_factory = int(factory_rise / shop_rise)
print("shop demand, before / after : " + str(shop_demand_before) + " / " + str(shop_demand_after) + ", up " + str(shop_rise_per_myriad) + " per ten thousand")
print("")
print("retailer orders : " + str(retailer_order) + " (sales " + str(shop_demand_after) + " + rebuild " + str(shop_rise) + ")")
print("wholesaler orders : " + str(wholesaler_order) + " (sales " + str(retailer_order) + " + rebuild " + str(retailer_rise) + ")")
print("factory builds : " + str(factory_order) + " (sales " + str(wholesaler_order) + " + rebuild " + str(wholesaler_rise) + ")")
print("")
print("rise at the factory : " + str(factory_rise_per_myriad) + " per ten thousand")
print("amplification, shop to factory : " + str(amplification_by_the_factory) + " times")
print("")
print("each tier's order")
print(" reads : its own real sales")
print(" safety stock : exactly one week, restored when drawn down")
print(" order : sales seen plus the stock to restore")
print(" intent : order what the demand needs")
print(" tiers ordering outside their rule : 0")
print(" verdict : EVERY TIER ORDERED EXACTLY WHAT ITS RULE SAYS")
print("")
print(" each tier reading its real sales and restoring its real")
print(" safety stock is the part done right here, and it is why")
print(" no tier is guessing or panicking")
print("")
print("the whip")
print(" the shop's rise : " + str(shop_rise) + ", the only real change")
print(" the retailer : sees " + str(shop_rise) + " more sold, orders " + str(shop_rise) + " more plus " + str(shop_rise) + " to")
print(" rebuild, a rise of " + str(retailer_rise))
print(" the wholesaler : sees a rise of " + str(retailer_rise) + " and does the same, " + str(wholesaler_rise))
print(" the factory : sees " + str(wholesaler_rise) + " and does the same, " + str(factory_rise))
print(" so the factory builds for : a rise " + str(amplification_by_the_factory) + " times the one")
print(" customers made")
print("")
print("the factory's view")
print(" demand it planned for : " + str(factory_order) + " a week")
print(" demand customers have : " + str(shop_demand_after) + " a week")
print(" is any tier's order wrong by its rule : no")
print(" is the factory reading customer demand : no; it is reading")
print(" three tiers of safety-stock rebuilding stacked on it")
print(" next week, when no tier needs to rebuild : orders fall")
print(" back through the chain, and the factory sees a crash")
print("")
nc_factory_rise_ordering_on_the_tier_below = 80
nc_factory_rise_ordering_on_shop_sales = 10
nc_rise_the_shared_signal_removes = 70
print("null control - every tier orders on the shop's sales")
print(" factory rise, ordering on the tier below : " + str(nc_factory_rise_ordering_on_the_tier_below))
print(" factory rise, ordering on shop sales : " + str(nc_factory_rise_ordering_on_shop_sales))
print(" rise the shared signal removes : " + str(nc_rise_the_shared_signal_removes))
print(" no customer and no rule changed; each tier stopped")
print(" reading the tier below as the customer")
print("")
print("what a cover-sales-and-restore-stock rule guarantees")
print(" each tier orders what its own sales and stock require :")
print(" exactly, real sales, real safety stock")
print(" the chain orders what customers demand : not addressed;")
print(" each tier reads the tier below as demand and adds its")
print(" own rebuild, so a rise of " + str(shop_rise) + " at the shop is " + str(factory_rise) + " at the")
print(" factory, " + str(amplification_by_the_factory) + " times over")
print("")
print("a signal passed through a chain of sensible rules is reshaped by each of them;")
print("what reaches the far end is the customers' change wearing three layers of")
print("other people's prudence, and the factory builds for the prudence")
print("")
print("Every tier orders exactly what its rule says - real sales plus a real safety")
print("stock rebuild. But each tier reads the one below as demand and adds its own")
print("rebuild, so the shop's rise of " + str(shop_rise_per_myriad) + " per ten thousand reaches the factory as")
print("" + str(factory_rise_per_myriad) + ", " + str(amplification_by_the_factory) + " times over, until every tier orders on the shop's own sales.")stdout (executed)
textshop demand, before / after : 100 / 110, up 1000 per ten thousand
retailer orders : 120 (sales 110 + rebuild 10)
wholesaler orders : 140 (sales 120 + rebuild 20)
factory builds : 180 (sales 140 + rebuild 40)
rise at the factory : 8000 per ten thousand
amplification, shop to factory : 8 times
each tier's order
reads : its own real sales
safety stock : exactly one week, restored when drawn down
order : sales seen plus the stock to restore
intent : order what the demand needs
tiers ordering outside their rule : 0
verdict : EVERY TIER ORDERED EXACTLY WHAT ITS RULE SAYS
each tier reading its real sales and restoring its real
safety stock is the part done right here, and it is why
no tier is guessing or panicking
the whip
the shop's rise : 10, the only real change
the retailer : sees 10 more sold, orders 10 more plus 10 to
rebuild, a rise of 20
the wholesaler : sees a rise of 20 and does the same, 40
the factory : sees 40 and does the same, 80
so the factory builds for : a rise 8 times the one
customers made
the factory's view
demand it planned for : 180 a week
demand customers have : 110 a week
is any tier's order wrong by its rule : no
is the factory reading customer demand : no; it is reading
three tiers of safety-stock rebuilding stacked on it
next week, when no tier needs to rebuild : orders fall
back through the chain, and the factory sees a crash
null control - every tier orders on the shop's sales
factory rise, ordering on the tier below : 80
factory rise, ordering on shop sales : 10
rise the shared signal removes : 70
no customer and no rule changed; each tier stopped
reading the tier below as the customer
what a cover-sales-and-restore-stock rule guarantees
each tier orders what its own sales and stock require :
exactly, real sales, real safety stock
the chain orders what customers demand : not addressed;
each tier reads the tier below as demand and adds its
own rebuild, so a rise of 10 at the shop is 80 at the
factory, 8 times over
a signal passed through a chain of sensible rules is reshaped by each of them;
what reaches the far end is the customers' change wearing three layers of
other people's prudence, and the factory builds for the prudence
Every tier orders exactly what its rule says - real sales plus a real safety
stock rebuild. But each tier reads the one below as demand and adds its own
rebuild, so the shop's rise of 1000 per ten thousand reaches the factory as
8000, 8 times over, until every tier orders on the shop's own sales.Trace event types
eml:run:starteml:assigneml:outputeml:run:done