Case 986
The van gaining four saved more than the hybrid gaining twenty
the_van_gaining_four_saved_more_than_the_hybrid_gaining_twenty.eml - A household with two cars, each driven 10000 km a year, can afford to replace one. The van does 8 km per litre and its replacement would do 12; the sedan does 20 and a hybrid would do 40. The household reasons that a gain of 20 km per litre is five times a gain of 4 and replaces the sedan. Which swap saves more fuel is computed below.
ok: true — round-trip fixpoint reached (python1 == python2)updated 2026-09-23
EML
eml# Self-authored for the EML case corpus (no external origin). A household with
# two cars, each driven 10000 km a year, can afford to replace one. The van does
# 8 km per litre and its replacement would do 12; the sedan does 20 and a hybrid
# would do 40. The household reasons that a gain of 20 km per litre is five
# times a gain of 4 and replaces the sedan. Which swap saves more fuel is
# computed below.
#
# The reasoning is careful. All four ratings are accurate; both cars really are
# driven the same distance; 20 really is five times 4; and the intent is exactly
# 'burn the least fuel'.
#
# Fuel used is distance divided by kilometres per litre, so a gain in km per
# litre is worth most where the figure is low: the van's 8 to 12 saves 417
# litres a year, the sedan's 20 to 40 saves 250. Measured in litres per 100 km -
# the unit the fuel bill is written in - the van's swap is the bigger one.
10000 => km_a_year_each_car
8 => van_km_per_litre
12 => new_van_km_per_litre
20 => sedan_km_per_litre
40 => hybrid_km_per_litre
new_van_km_per_litre - van_km_per_litre => van_gain_km_per_litre
hybrid_km_per_litre - sedan_km_per_litre => sedan_gain_km_per_litre
int(sedan_gain_km_per_litre / van_gain_km_per_litre) => gain_ratio
int(km_a_year_each_car / van_km_per_litre) => van_litres_a_year
int(km_a_year_each_car / new_van_km_per_litre) => new_van_litres_a_year
int(km_a_year_each_car / sedan_km_per_litre) => sedan_litres_a_year
int(km_a_year_each_car / hybrid_km_per_litre) => hybrid_litres_a_year
van_litres_a_year - new_van_litres_a_year => van_swap_saves_litres
sedan_litres_a_year - hybrid_litres_a_year => sedan_swap_saves_litres
van_swap_saves_litres - sedan_swap_saves_litres => van_swap_saves_more_by_litres
int(1000 / van_km_per_litre) => van_tenths_of_a_litre_per_100_km
int(1000 / new_van_km_per_litre) => new_van_tenths_of_a_litre_per_100_km
int(1000 / sedan_km_per_litre) => sedan_tenths_of_a_litre_per_100_km
int(1000 / hybrid_km_per_litre) => hybrid_tenths_of_a_litre_per_100_km
"each car : " + str(km_a_year_each_car) + " km a year" ^0
"van : " + str(van_km_per_litre) + " to " + str(new_van_km_per_litre) + " km per litre, a gain of " + str(van_gain_km_per_litre) ^0
"sedan : " + str(sedan_km_per_litre) + " to " + str(hybrid_km_per_litre) + " km per litre, a gain of " + str(sedan_gain_km_per_litre) + ", " + str(gain_ratio) + " times the van's" ^0
"" ^0
"van, litres a year : " + str(van_litres_a_year) + " now, " + str(new_van_litres_a_year) + " after, saving " + str(van_swap_saves_litres) ^0
"sedan, litres a year : " + str(sedan_litres_a_year) + " now, " + str(hybrid_litres_a_year) + " after, saving " + str(sedan_swap_saves_litres) ^0
"the van's swap saves more by : " + str(van_swap_saves_more_by_litres) + " litres a year" ^0
"" ^0
"in tenths of a litre per 100 km : van " + str(van_tenths_of_a_litre_per_100_km) + " to " + str(new_van_tenths_of_a_litre_per_100_km) + ", sedan " + str(sedan_tenths_of_a_litre_per_100_km) + " to " + str(hybrid_tenths_of_a_litre_per_100_km) ^0
"" ^0
# ---- what the household verified ----
"the bigger-gain reasoning" ^0
" ratings : all four accurate" ^0
" distance : " + str(km_a_year_each_car) + " km a year for each car" ^0
" gains : " + str(sedan_gain_km_per_litre) + " against " + str(van_gain_km_per_litre) + ", " + str(gain_ratio) + " times as big" ^0
" intent : burn the least fuel" ^0
" facts wrong : 0" ^0
" verdict : REPLACE THE SEDAN, THE GAIN IS FIVE TIMES BIGGER" ^0
"" ^0
" reading the four ratings accurately is the part done right" ^0
" here, and it is why both gains in km per litre are exactly" ^0
" what the dealers said" ^0
"" ^0
# ---- what a kilometre per litre is worth ----
"fuel is distance over the rating" ^0
" what the bill counts : litres, and litres are the distance" ^0
" divided by km per litre" ^0
" a gain at the low end : 8 to 12 cuts every 100 km from " + str(van_tenths_of_a_litre_per_100_km) ^0
" to " + str(new_van_tenths_of_a_litre_per_100_km) + " tenths of a litre" ^0
" a gain at the high end : 20 to 40 cuts it from " + str(sedan_tenths_of_a_litre_per_100_km) + " to " + str(hybrid_tenths_of_a_litre_per_100_km) ^0
" why the small number wins : a car that already sips has" ^0
" little left to save, however large the gain looks" ^0
" over a year : " + str(van_swap_saves_litres) + " litres against " + str(sedan_swap_saves_litres) ^0
"" ^0
# ---- what the household got ----
"the fuel bill" ^0
" believed : the bigger saving, five times the van's" ^0
" actual : " + str(sedan_swap_saves_litres) + " litres a year, " + str(van_swap_saves_more_by_litres) + " fewer than the van's swap" ^0
" is any rating wrong : no" ^0
" is a bigger gain in km per litre a bigger saving : not across" ^0
" cars; the unit runs the wrong way for the question" ^0
"" ^0
# ---- null control ----
# The same choice made by litres saved over the year's driving instead of by
# the gain in km per litre.
250 => nc_litres_saved_ranking_by_km_per_litre_gain
417 => nc_litres_saved_ranking_by_litres_a_year
167 => nc_litres_a_year_the_right_unit_recovers
"null control - rank the swaps by litres a year" ^0
" litres saved, ranking by the km per litre gain : " + str(nc_litres_saved_ranking_by_km_per_litre_gain) ^0
" litres saved, ranking by litres a year : " + str(nc_litres_saved_ranking_by_litres_a_year) ^0
" litres a year the right unit recovers : " + str(nc_litres_a_year_the_right_unit_recovers) ^0
" no car and no rating changed; the swaps were compared in the" ^0
" quantity the bill is written in" ^0
"" ^0
# ---- the rule ----
"what a bigger gain in km per litre guarantees" ^0
" the new car goes further on each litre : exactly" ^0
" it saves more fuel than a smaller gain : not addressed; fuel is" ^0
" distance over km per litre, so " + str(van_km_per_litre) + " to " + str(new_van_km_per_litre) + " saves " + str(van_swap_saves_litres) + " litres a year" ^0
" and " + str(sedan_km_per_litre) + " to " + str(hybrid_km_per_litre) + " saves " + str(sedan_swap_saves_litres) ^0
"" ^0
"a rate written upside down makes the small gains look small; the fuel is in" ^0
"the reciprocal, and the reciprocal is steepest where the number is low" ^0
"" ^0
"The ratings are right and " + str(sedan_gain_km_per_litre) + " is " + str(gain_ratio) + " times " + str(van_gain_km_per_litre) + ". But fuel is distance over km" ^0
"per litre: the van's " + str(van_km_per_litre) + " to " + str(new_van_km_per_litre) + " saves " + str(van_swap_saves_litres) + " litres a year and the sedan's " + str(sedan_km_per_litre) + " to " + str(hybrid_km_per_litre) + " saves" ^0
"" + str(sedan_swap_saves_litres) + ", " + str(van_swap_saves_more_by_litres) + " fewer, until the swaps are compared in litres and not in the" ^0
"size of the gain." ^0Python (deterministic transpilation)
pythonkm_a_year_each_car = 10000
van_km_per_litre = 8
new_van_km_per_litre = 12
sedan_km_per_litre = 20
hybrid_km_per_litre = 40
van_gain_km_per_litre = new_van_km_per_litre - van_km_per_litre
sedan_gain_km_per_litre = hybrid_km_per_litre - sedan_km_per_litre
gain_ratio = int(sedan_gain_km_per_litre / van_gain_km_per_litre)
van_litres_a_year = int(km_a_year_each_car / van_km_per_litre)
new_van_litres_a_year = int(km_a_year_each_car / new_van_km_per_litre)
sedan_litres_a_year = int(km_a_year_each_car / sedan_km_per_litre)
hybrid_litres_a_year = int(km_a_year_each_car / hybrid_km_per_litre)
van_swap_saves_litres = van_litres_a_year - new_van_litres_a_year
sedan_swap_saves_litres = sedan_litres_a_year - hybrid_litres_a_year
van_swap_saves_more_by_litres = van_swap_saves_litres - sedan_swap_saves_litres
van_tenths_of_a_litre_per_100_km = int(1000 / van_km_per_litre)
new_van_tenths_of_a_litre_per_100_km = int(1000 / new_van_km_per_litre)
sedan_tenths_of_a_litre_per_100_km = int(1000 / sedan_km_per_litre)
hybrid_tenths_of_a_litre_per_100_km = int(1000 / hybrid_km_per_litre)
print("each car : " + str(km_a_year_each_car) + " km a year")
print("van : " + str(van_km_per_litre) + " to " + str(new_van_km_per_litre) + " km per litre, a gain of " + str(van_gain_km_per_litre))
print("sedan : " + str(sedan_km_per_litre) + " to " + str(hybrid_km_per_litre) + " km per litre, a gain of " + str(sedan_gain_km_per_litre) + ", " + str(gain_ratio) + " times the van's")
print("")
print("van, litres a year : " + str(van_litres_a_year) + " now, " + str(new_van_litres_a_year) + " after, saving " + str(van_swap_saves_litres))
print("sedan, litres a year : " + str(sedan_litres_a_year) + " now, " + str(hybrid_litres_a_year) + " after, saving " + str(sedan_swap_saves_litres))
print("the van's swap saves more by : " + str(van_swap_saves_more_by_litres) + " litres a year")
print("")
print("in tenths of a litre per 100 km : van " + str(van_tenths_of_a_litre_per_100_km) + " to " + str(new_van_tenths_of_a_litre_per_100_km) + ", sedan " + str(sedan_tenths_of_a_litre_per_100_km) + " to " + str(hybrid_tenths_of_a_litre_per_100_km))
print("")
print("the bigger-gain reasoning")
print(" ratings : all four accurate")
print(" distance : " + str(km_a_year_each_car) + " km a year for each car")
print(" gains : " + str(sedan_gain_km_per_litre) + " against " + str(van_gain_km_per_litre) + ", " + str(gain_ratio) + " times as big")
print(" intent : burn the least fuel")
print(" facts wrong : 0")
print(" verdict : REPLACE THE SEDAN, THE GAIN IS FIVE TIMES BIGGER")
print("")
print(" reading the four ratings accurately is the part done right")
print(" here, and it is why both gains in km per litre are exactly")
print(" what the dealers said")
print("")
print("fuel is distance over the rating")
print(" what the bill counts : litres, and litres are the distance")
print(" divided by km per litre")
print(" a gain at the low end : 8 to 12 cuts every 100 km from " + str(van_tenths_of_a_litre_per_100_km))
print(" to " + str(new_van_tenths_of_a_litre_per_100_km) + " tenths of a litre")
print(" a gain at the high end : 20 to 40 cuts it from " + str(sedan_tenths_of_a_litre_per_100_km) + " to " + str(hybrid_tenths_of_a_litre_per_100_km))
print(" why the small number wins : a car that already sips has")
print(" little left to save, however large the gain looks")
print(" over a year : " + str(van_swap_saves_litres) + " litres against " + str(sedan_swap_saves_litres))
print("")
print("the fuel bill")
print(" believed : the bigger saving, five times the van's")
print(" actual : " + str(sedan_swap_saves_litres) + " litres a year, " + str(van_swap_saves_more_by_litres) + " fewer than the van's swap")
print(" is any rating wrong : no")
print(" is a bigger gain in km per litre a bigger saving : not across")
print(" cars; the unit runs the wrong way for the question")
print("")
nc_litres_saved_ranking_by_km_per_litre_gain = 250
nc_litres_saved_ranking_by_litres_a_year = 417
nc_litres_a_year_the_right_unit_recovers = 167
print("null control - rank the swaps by litres a year")
print(" litres saved, ranking by the km per litre gain : " + str(nc_litres_saved_ranking_by_km_per_litre_gain))
print(" litres saved, ranking by litres a year : " + str(nc_litres_saved_ranking_by_litres_a_year))
print(" litres a year the right unit recovers : " + str(nc_litres_a_year_the_right_unit_recovers))
print(" no car and no rating changed; the swaps were compared in the")
print(" quantity the bill is written in")
print("")
print("what a bigger gain in km per litre guarantees")
print(" the new car goes further on each litre : exactly")
print(" it saves more fuel than a smaller gain : not addressed; fuel is")
print(" distance over km per litre, so " + str(van_km_per_litre) + " to " + str(new_van_km_per_litre) + " saves " + str(van_swap_saves_litres) + " litres a year")
print(" and " + str(sedan_km_per_litre) + " to " + str(hybrid_km_per_litre) + " saves " + str(sedan_swap_saves_litres))
print("")
print("a rate written upside down makes the small gains look small; the fuel is in")
print("the reciprocal, and the reciprocal is steepest where the number is low")
print("")
print("The ratings are right and " + str(sedan_gain_km_per_litre) + " is " + str(gain_ratio) + " times " + str(van_gain_km_per_litre) + ". But fuel is distance over km")
print("per litre: the van's " + str(van_km_per_litre) + " to " + str(new_van_km_per_litre) + " saves " + str(van_swap_saves_litres) + " litres a year and the sedan's " + str(sedan_km_per_litre) + " to " + str(hybrid_km_per_litre) + " saves")
print("" + str(sedan_swap_saves_litres) + ", " + str(van_swap_saves_more_by_litres) + " fewer, until the swaps are compared in litres and not in the")
print("size of the gain.")stdout (executed)
texteach car : 10000 km a year
van : 8 to 12 km per litre, a gain of 4
sedan : 20 to 40 km per litre, a gain of 20, 5 times the van's
van, litres a year : 1250 now, 833 after, saving 417
sedan, litres a year : 500 now, 250 after, saving 250
the van's swap saves more by : 167 litres a year
in tenths of a litre per 100 km : van 125 to 83, sedan 50 to 25
the bigger-gain reasoning
ratings : all four accurate
distance : 10000 km a year for each car
gains : 20 against 4, 5 times as big
intent : burn the least fuel
facts wrong : 0
verdict : REPLACE THE SEDAN, THE GAIN IS FIVE TIMES BIGGER
reading the four ratings accurately is the part done right
here, and it is why both gains in km per litre are exactly
what the dealers said
fuel is distance over the rating
what the bill counts : litres, and litres are the distance
divided by km per litre
a gain at the low end : 8 to 12 cuts every 100 km from 125
to 83 tenths of a litre
a gain at the high end : 20 to 40 cuts it from 50 to 25
why the small number wins : a car that already sips has
little left to save, however large the gain looks
over a year : 417 litres against 250
the fuel bill
believed : the bigger saving, five times the van's
actual : 250 litres a year, 167 fewer than the van's swap
is any rating wrong : no
is a bigger gain in km per litre a bigger saving : not across
cars; the unit runs the wrong way for the question
null control - rank the swaps by litres a year
litres saved, ranking by the km per litre gain : 250
litres saved, ranking by litres a year : 417
litres a year the right unit recovers : 167
no car and no rating changed; the swaps were compared in the
quantity the bill is written in
what a bigger gain in km per litre guarantees
the new car goes further on each litre : exactly
it saves more fuel than a smaller gain : not addressed; fuel is
distance over km per litre, so 8 to 12 saves 417 litres a year
and 20 to 40 saves 250
a rate written upside down makes the small gains look small; the fuel is in
the reciprocal, and the reciprocal is steepest where the number is low
The ratings are right and 20 is 5 times 4. But fuel is distance over km
per litre: the van's 8 to 12 saves 417 litres a year and the sedan's 20 to 40 saves
250, 167 fewer, until the swaps are compared in litres and not in the
size of the gain.Trace event types
eml:run:starteml:assigneml:outputeml:run:done