关于「千条规则里的冲突,多半是同义冗余」,《冲突多半是冗余》给出的定量结论是什么?

结论:第一章正面陈述并量化命题:一千条示意规则里,标红配对中真矛盾只占 0.0392,裁决后 971 条是冗余,只剩 18 条约束性规则;越界规则占一成时真矛盾比例也只有 0.2667,但无解指标已遍及全部。序中修正立项蓝图:约翰逊 1974 年证明的贪心比值是调和数级,至多 ln n 加一倍;奎因 1952 年讨论的是素蕴含项而非集合覆盖;「冲突多半是冗余」是作者假说而非已发表定律。

数据口径:书中规则库与数值均为示意;全部计算由书中程序生成;本书属非个人化经营方法,不构成法律、合规或经营决策意见,规则的增删须由主事者人工放行。 第一章正面陈述并量化命题:一千条示意规则里,标红配对中真矛盾只占 0.0392,裁决后 971 条是冗余,只剩 18 条约束性规则;越界规则占一成时真矛盾比例也只有 0.2667,但无解指标已遍及全部。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.0392, 18, 971

illustrative library1000 rules, 12 metrics, seed 20261113
writer mix: same 0.550, variant 0.440, opposite side 0.010
same-metric pairs41,369
duplicate22,041 share 0.5328
subsumed18,423 share 0.4453
compatible148 share 0.0036
contradiction757 share 0.0183
pairs flagged (numbers differ)19,328
of which true contradictions share 0.0392
binding rules kept (one per side)18
rules redundant once ruled971
metrics infeasible 7 of 12; rules to delete for feasibility 11
audit snapshot 2026-11-13 (report quoted, not re-run):
rule lines 1333 kit + 330 canon; comparable metrics 12
threshold conflicts 3 (high 0, medium 0, low 1, ruled 2)
infeasible metrics 0; duplicates 20; near-synonyms 9
查看完整验算程序
# Chapter 1. p11: in a 1000-rule library most flagged pairs are redundancy
# Model: an illustrative library of machine rules, each a threshold
# (metric, op, value) with op in >=, <=, ==. Twelve metrics, each with
# one canonical value; every new rule restates the canonical rule
# (paraphrase), writes a stricter or looser variant in the same
# direction, or (rarely) writes a rule that crosses the opposite side.
# Writer mix 0.550 / 0.440 / 0.010 is illustrative; fixed seed.
# A naive checker flags every pair on one metric whose numbers differ.
# Exact rational comparison with fractions.Fraction throughout.
# The last block quotes counts from the read-only audit report of the
# production pruner (2026-11-13 snapshot), typed in, not re-run here.

import random
from collections import Counter
from fractions import Fraction as F
from itertools import combinations

SEED = 20261113
N_RULES = 1000
P_OPP = F(1, 100)
P_VAR = F(44, 100)
METRICS = [
    ("tap_px", "lower", F(44), F(4)),
    ("font_px", "lower", F(16), F(1)),
    ("contrast", "lower", F(9, 2), F(1, 2)),
    ("refund_days", "lower", F(7), F(7)),
    ("followups", "upper", F(2), F(1)),
    ("msgs_day", "upper", F(1), F(1)),
    ("pushes_week", "upper", F(4), F(1)),
    ("discount_pct", "upper", F(30), F(5)),
    ("quiet_start", "upper", F(21), F(1)),
    ("settle_day", "exact", F(5), F(1)),
    ("launch_hour", "exact", F(10), F(1)),
    ("resets", "exact", F(0), F(1)),
]


def make_rule(rng, p_opp=P_OPP, p_var=P_VAR):
    name, kind, c, step = METRICS[rng.randrange(len(METRICS))]
    u = F(rng.randrange(1000), 1000)
    if kind == "exact":
        if u < p_opp:
            return (name, "==", c + step * rng.choice([1, 2, 3]))
        return (name, "==", c)
    op = ">=" if kind == "lower" else "<="
    if u < p_opp:
        k = rng.choice([1, 2])
        if kind == "lower":
            return (name, "<=", c - step * k)
        return (name, ">=", c + step * k)
    if u < p_opp + p_var:
        k = rng.choice([-2, -1, 1, 2])
        return (name, op, max(F(0), c + step * k))
    return (name, op, c)


def pair_kind(a, b):
    (oa, va), (ob, vb) = sorted([a, b])
    if (oa, va) == (ob, vb):
        return "duplicate"
    if oa == ob and oa != "==":
        return "subsumed"
    if oa == ob:
        return "contradiction"
    if (oa, ob) == ("<=", ">="):
        return "contradiction" if vb > va else "compatible"
    if oa == "<=":                      # ("<=", "==")
        return "contradiction" if vb > va else "subsumed"
    return "contradiction" if va < vb else "subsumed"   # ("==", ">=")


def classify(rules):
    by = {}
    for name, op, v in rules:
        by.setdefault(name, Counter())[(op, v)] += 1
    tally = Counter()
    for name in sorted(by):
        keys = sorted(by[name].items())
        for (k, n) in keys:
            tally["duplicate"] += n * (n - 1) // 2
        for (ka, na), (kb, nb) in combinations(keys, 2):
            tally[pair_kind(ka, kb)] += na * nb
    return by, tally


def min_delete(cnt):
    vals = sorted({v for (_, v) in cnt})
    best = None
    for t in vals:
        cost = 0
        for (op, v), n in cnt.items():
            if (op == ">=" and v > t) or (op == "<=" and v < t):
                cost += n
            if op == "==" and v != t:
                cost += n
        best = cost if best is None else min(best, cost)
    return best


def kernel_size(cnt):
    ops = {op for (op, _) in cnt}
    return len(ops & {">=", "<="}) + (1 if "==" in ops else 0)


rng = random.Random(20261113)
rules = [make_rule(rng) for _ in range(N_RULES)]
by, tally = classify(rules)
pairs = tally["duplicate"] + tally["subsumed"] + tally["compatible"] \
    + tally["contradiction"]
flagged = pairs - tally["duplicate"]
kern = 0
dele = 0
bad = 0
for name in sorted(by):
    kern += kernel_size(by[name])
    d = min_delete(by[name])
    dele += d
    bad += 1 if d else 0
print("illustrative library: %d rules, %d metrics, seed %d"
      % (N_RULES, len(METRICS), SEED))
print("writer mix: same %.3f, variant %.3f, opposite side %.3f"
      % (1 - P_OPP - P_VAR, P_VAR, P_OPP))
print("same-metric pairs                 %7s" % format(pairs, ","))
for k in ("duplicate", "subsumed", "compatible", "contradiction"):
    print("  %-14s                  %7s   share %.4f"
          % (k, format(tally[k], ","), tally[k] / pairs))
print("pairs flagged (numbers differ)    %7s" % format(flagged, ","))
print("  of which true contradictions    share %.4f"
      % (tally["contradiction"] / flagged))
print("binding rules kept (one per side) %7d" % kern)
print("rules redundant once ruled        %7d" % (N_RULES - kern - dele))
print("metrics infeasible %d of %d; rules to delete for feasibility %d"
      % (bad, len(METRICS), dele))
print("audit snapshot 2026-11-13 (report quoted, not re-run):")
print("  rule lines 1333 kit + 330 canon; comparable metrics 12")
print("  threshold conflicts 3 (high 0, medium 0, low 1, ruled 2)")
print("  infeasible metrics 0; duplicates 20; near-synonyms 9")

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《跨卷规则消解与公理归约、千条机器规则阈值冲突检测与最小原语集母典》第 1 章「千条规则里的冲突,多半是同义冗余」(版本 1.0.0). 5D Library. DOI 待发布

DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-258 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026258,
  author    = {Fan, Yafu},
  title     = {Cross-Volume Rule Resolution and Axiom Reduction: Detecting Threshold Conflicts among a Thousand Machine Rules and Finding a Minimal Primitive Set},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论