What does Formalising Founder Wishes conclude, in numbers, about “Counterexamples First: Property-Based Testing, Shrinking and the Minimal Contradictory Subset”?

Answer: Chapter 5's property tester finds a counterexample to a discount rule on the 4th random case, and delta debugging reduces a contradiction among twelve constraints to 3 in 33 calls.

Scope of the numbers: Amounts are in illustrative units with no currency, parameters are illustrative, and all calculations are generated by the book's programs. The book is non-personalised business guidance, not personal financial or investment advice; the psychological literature is reported only as associations with their conditions, and the lower end of an interval is never a promise of income.

中文版

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: 33

grid points: 1,365  clauses: 12
full set unsatisfiable: True
1-minimal core (3 clauses, 33 oracle calls):
  C03 orders >= 200
  C04 no ads: visits <= 80
  C05 conv <= 2
drop C03 -> still unsat: False
drop C04 -> still unsat: False
drop C05 -> still unsat: False
Show the full program
# Chapter 5. p52: delta debugging finds the minimal contradictory clauses
# Twelve clauses of a compiled wish over price p, conversion c (percent)
# and visits v (hundreds a month); orders = v * c. The full set has no
# solution on the grid. ddmin (Zeller and Hildebrandt 2002) shrinks it
# to a 1-minimal subset that is still contradictory. Illustrative data.
import itertools

GRID = list(itertools.product(range(20, 62, 2), range(1, 6),
                              range(40, 170, 10)))


def net(p, c, v):
    return v * c * p * 0.55 - 1200


CLAUSES = {
    "C01 price <= 40": lambda p, c, v: p <= 40,
    "C02 price >= 30": lambda p, c, v: p >= 30,
    "C03 orders >= 200": lambda p, c, v: v * c >= 200,
    "C04 no ads: visits <= 80": lambda p, c, v: v <= 80,
    "C05 conv <= 2": lambda p, c, v: c <= 2,
    "C06 net >= 1500": lambda p, c, v: net(p, c, v) >= 1500,
    "C07 price != 34": lambda p, c, v: p != 34,
    "C08 visits >= 50": lambda p, c, v: v >= 50,
    "C09 conv >= 1": lambda p, c, v: c >= 1,
    "C10 orders <= 260": lambda p, c, v: v * c <= 260,
    "C11 unit margin >= 18": lambda p, c, v: p * 0.55 >= 18,
    "C12 orders >= 120": lambda p, c, v: v * c >= 120,
}
NAMES = sorted(CLAUSES)
calls = [0]


def unsat(names):
    calls[0] += 1
    fs = [CLAUSES[n] for n in names]
    return not any(all(f(*x) for f in fs) for x in GRID)


def ddmin(items):
    n = 2
    while len(items) >= 2:
        size = len(items) // n
        parts = [items[i * size:(i + 1) * size] for i in range(n - 1)]
        parts.append(items[(n - 1) * size:])
        for part in parts:
            if unsat(part):
                items, n = part, 2
                break
        else:
            for part in parts:
                rest = [x for x in items if x not in part]
                if unsat(rest):
                    items, n = rest, max(n - 1, 2)
                    break
            else:
                if n >= len(items):
                    break
                n = min(len(items), 2 * n)
    return items


print("grid points: {:,}  clauses: {}".format(len(GRID), len(NAMES)))
print("full set unsatisfiable: {}".format(unsat(NAMES)))
core = ddmin(NAMES)
print("1-minimal core ({} clauses, {} oracle calls):".format(
    len(core), calls[0]))
for c in core:
    print("  " + c)
for c in core:
    rest = [x for x in core if x != c]
    print("drop {} -> still unsat: {}".format(c[:3], unsat(rest)))

Single source and citation

Fan, Y. (2026). Formalising Fuzzy Founder Wishes: Constraint Inversion, Falsifiable Spec Synthesis and Executable Revenue System Compilation (Version 1.0.0), Chapter 5: Counterexamples First: Property-Based Testing, Shrinking and the Minimal Contradictory Subset. 5D Library. DOI pending

DOI pending · monograph page goes live after publication · 5DL-B-414 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026414,
  author    = {Fan, Yafu},
  title     = {Formalising Fuzzy Founder Wishes: Constraint Inversion, Falsifiable Spec Synthesis and Executable Revenue System Compilation},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

Other chapter answers in this book