关于「素蕴含项:把四十条窄禁令并成四个本原」,《冲突多半是冗余》给出的定量结论是什么?
结论:第四章把 40 条窄禁令并成 4 个本原。
数据口径:书中规则库与数值均为示意;全部计算由书中程序生成;本书属非个人化经营方法,不构成法律、合规或经营决策意见,规则的增删须由主事者人工放行。 第一章正面陈述并量化命题:一千条示意规则里,标红配对中真矛盾只占 0.0392,裁决后 971 条是冗余,只剩 18 条约束性规则;越界规则占一成时真矛盾比例也只有 0.2667,但无解指标已遍及全部。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 40
written rules 40 (distinct 35), switches 5, combinations 32 forbidden by written rules 18; by the true policy 18 prime implicants 5, essential 4, minimum cover 4 minimum cover (F M C B L): 0-11- covers 4 true cube -11-- covers 8 true cube 1---0 covers 8 true cube 11--- covers 8 true cube prime not needed: --110 compression: 40 written rules -> 4 primitives
查看完整验算程序
# Chapter 4. p41: forty forbidding rules collapse to a handful of primes
# Model: five switches F flash sale, M member price, C coupon, B
# bundle, L live stock feed. The true policy forbids four illustrative
# combinations (cubes): M&F, C&M, F&~L, C&B&~F. Writers add 40 rules,
# each a random over-specific sub-cube of one true cube (fixed seed),
# so every written rule is correct but narrow. Quine-McCluskey (Quine
# 1952, McCluskey 1956) merges the forbidden minterms into prime
# implicants; a minimum cover of the written minterms is then chosen
# by exhaustive search over the primes. Cube notation per switch in
# the order F M C B L: 1 on, 0 off, - free.
import random
from itertools import combinations
VARS = "FMCBL"
NV = len(VARS)
TRUE = ["11---", "-11--", "1---0", "0-11-"]
def cube_minterms(cube):
out = [0]
for ch in cube:
nxt = []
for x in out:
if ch in "0-":
nxt.append(x << 1)
if ch in "1-":
nxt.append((x << 1) | 1)
out = nxt
return out
def text(v, mask):
s = ""
for i in range(NV - 1, -1, -1):
s += "-" if (mask >> i) & 1 else str((v >> i) & 1)
return s
def primes(minterms):
cur = {(m, 0) for m in minterms}
found = set()
while cur:
nxt = set()
used = set()
for a, b in combinations(sorted(cur), 2):
if a[1] == b[1]:
d = a[0] ^ b[0]
if d and d & (d - 1) == 0:
nxt.add((a[0] & b[0], a[1] | d))
used.add(a)
used.add(b)
found |= cur - used
cur = nxt
return sorted(found)
def covers(p, m):
return (m & ~p[1]) == p[0]
def min_cover(pr, ms):
for k in range(1, len(pr) + 1):
for combo in combinations(pr, k):
if all(any(covers(p, m) for p in combo) for m in ms):
return list(combo)
return []
rng = random.Random(20261113)
written = []
for _ in range(40):
cube = list(rng.choice(TRUE))
for i, ch in enumerate(cube):
if ch == "-" and rng.random() < 0.6:
cube[i] = rng.choice("01")
written.append("".join(cube))
ms = sorted({m for c in written for m in cube_minterms(c)})
truth = sorted({m for c in TRUE for m in cube_minterms(c)})
pr = primes(ms)
ess = [p for p in pr if any(
covers(p, m) and not any(covers(q, m) for q in pr if q != p)
for m in ms)]
cov = min_cover(pr, ms)
print("written rules %d (distinct %d), switches %d, combinations %d"
% (len(written), len(set(written)), NV, 1 << NV))
print("forbidden by written rules %d; by the true policy %d"
% (len(ms), len(truth)))
print("prime implicants %d, essential %d, minimum cover %d"
% (len(pr), len(ess), len(cov)))
print("minimum cover (F M C B L):")
for p in cov:
tag = "true cube" if text(*p) in TRUE else "narrower"
print(" %s covers %2d %s" % (text(*p), 1 << bin(p[1]).count("1"),
tag))
print("prime not needed: %s"
% ", ".join(text(*p) for p in pr if p not in cov))
print("compression: %d written rules -> %d primitives"
% (len(written), len(cov)))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《跨卷规则消解与公理归约、千条机器规则阈值冲突检测与最小原语集母典》第 4 章「素蕴含项:把四十条窄禁令并成四个本原」(版本 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}
}