What does Distilling Books into Skill Packs conclude, in numbers, about “Compilation: Turning Rule Sentences into Predicates, Decision Tables and Decision Trees”?

Answer: Compilation turns the extraction sheet into three runnable forms: atomic predicates, decision tables and decision trees. Comparison words decide open and closed; three writers' wordings of one deposit rule come out complete, conflicting and gapped at the single point of 8000 yuan, so this book accepts only left-closed, right-open bands and gives every threshold three boundary samples. Units and floating point must be pinned down first: read 0.3 as 30 and the rush fee jumps from 2040 yuan to 204000 yuan; with a margin floor of 0.2 the wrong formula rejects good orders, while a floor of 0.35 happens to hide the defect. The handbook's five rules expanded over 32 cells show 12 conflicts and 1 gap; a first-match precedence order plus a refusal branch settles them all, and the report states how many cells each rule loses to shadowing. Information gain is fooled into a perfect score by an identifier field and gain ratio does not stop it, so identifiers are excluded by schema before any tree is grown; a decision tree reproduces rules from cases but copies one rule into several branches, so rules stated in a book are always compiled into a decision table. The compile report and the boundary golden samples pass to Chapter 4, where they become the validation gates before release.

Scope of the numbers: All samples are invented; pricing and closing rules are written in general terms and are not legal or compliance advice.

中文版

Data table

The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.2, 0.3, 0.35, 2040, 204000, 30

price 2000 cost 1300 floor 0.35: exact margin 7/20, below floor False
(p - c) / p0.35 below floor False
1 - c / p0.35 below floor False
price 1000 cost 800 floor 0.2: exact margin 1/5, below floor False
(p - c) / p0.2 below floor False
1 - c / p0.19999999999999996 below floor True
grid: price 1000..20000 step 100, cost step 50; pairs where 1 - c/p flips the floor test
floor 0.139 flips, first (1000, 900)
floor 0.239 flips, first (1000, 800)
floor 0.350 flips
floor 0.4520 flips, first (1000, 550)
rush fee on 6800 yuan, rate 0.3 as fraction2040 yuan
rush fee on 6800 yuan, rate 30% as percent2040 yuan
rush fee on 6800 yuan, rate 30 bare number204000 yuan
round(0.125, 2)0.12 decimal half-up = 0.13
round(0.375, 2)0.38 decimal half-up = 0.38
round(2.675, 2)2.67 decimal half-up = 2.68
round(1.005, 2)1.0 decimal half-up = 1.01
ten payments of 0.1 yuan: running total 0.9999999999999999, fsum 1.0, integer fen 100
0.1 + 0.2 =0.3: False; Fraction: True
Show the full program
# Chapter 3. p33: Units, binary floats and rounding at a compiled threshold.
# The fictional handbook says "decline any order whose gross margin is below 0.35". Two algebraically
# equal margin formulas can give different floats; exact Fractions never do, and whether the float
# version misfires depends on the floor itself, so one passing threshold proves nothing. Then: the same
# rush fee read as a fraction, a percent and a bare number; Python's round() (half to even, on the
# binary value) versus decimal ROUND_HALF_UP on the decimal string; and a running float total versus
# fsum and integer fen.
import math
from decimal import Decimal, ROUND_HALF_UP
from fractions import Fraction

if __name__ == "__main__":
    for price, cost, floor in ((2000, 1300, "0.35"), (1000, 800, "0.2")):
        m1, m2, m3 = (price - cost) / price, 1 - cost / price, 1 - Fraction(cost, price)
        print("   price {} cost {} floor {}: exact margin {}, below floor {}".format(
            price, cost, floor, m3, m3 < Fraction(floor)))
        print("      (p - c) / p = {!r:22s} below floor {}".format(m1, m1 < float(floor)))
        print("      1 - c / p   = {!r:22s} below floor {}".format(m2, m2 < float(floor)))
    print("   grid: price 1000..20000 step 100, cost step 50; pairs where 1 - c/p flips the floor test")
    for floor in ("0.1", "0.2", "0.35", "0.45"):
        bad = [(p, c) for p in range(1000, 20001, 100) for c in range(0, p, 50)
               if (1 - c / p < float(floor)) != (1 - Fraction(c, p) < Fraction(floor))]
        first = ", first {}".format(bad[0]) if bad else ""
        print("   floor {:4s}: {:2d} flips{}".format(floor, len(bad), first))
    fee = 6800
    for label, rate in (("0.3 as fraction", Fraction(3, 10)), ("30% as percent", Fraction(30, 100)),
                        ("30 bare number", Fraction(30))):
        print("   rush fee on {} yuan, rate {:15s} -> {} yuan".format(fee, label, fee * rate))
    for x in ("0.125", "0.375", "2.675", "1.005"):
        print("   round({}, 2) = {}   decimal half-up = {}".format(
            x, round(float(x), 2), Decimal(x).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)))
    tenths, running = [0.1] * 10, 0.0
    for t in tenths:  # a naive running total, kept only to show the drift
        running += t
    print("   ten payments of 0.1 yuan: running total {!r}, fsum {!r}, integer fen {}".format(
        running, math.fsum(tenths), sum([10] * 10)))
    print("   0.1 + 0.2 == 0.3: {}; Fraction: {}".format(0.1 + 0.2 == 0.3,
                                                       Fraction(1, 10) + Fraction(2, 10) == Fraction(3, 10)))

Single source and citation

Fan, Y. (2026). Lossless Distillation of Monographs into Agent Skill Packs, Executable Rule Compilation and Self-Evolving Systems (Version 0.1.0), Chapter 3: Compilation: Turning Rule Sentences into Predicates, Decision Tables and Decision Trees. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-150 · v0.1.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026150,
  author    = {Fan, Yafu},
  title     = {Lossless Distillation of Monographs into Agent Skill Packs, Executable Rule Compilation and Self-Evolving Systems},
  year      = {2026},
  publisher = {5D Library},
  edition   = {0.1.0},
  note      = {DOI pending}
}

Other chapter answers in this book