Repository navigation
v0.2.0 — logic_minimize (minimum sum of products, don't-cares)
v0.2.0 — 最小和之积(含无关项)
新工具 logic_minimize:把布尔表达式最小化到和之积(Quine–McCluskey)。
- 输出素蕴含项(含覆盖的最小项与无关项)、必要素蕴含项,以及项数最少的覆盖
- 并列时按「项数 → 文字数 → 字典序」固定判定,并用
unique如实报告是否存在并列 - 可选
dontCare(无关项最小项下标)=卡诺图那一招:a & !b & c | a & !b & !c配dontCare: [6, 7]化简为a - 恒假函数返回
""、常数覆盖返回1;搜索穷尽(带节点预算),预算耗尽时标exact: false并回退到「必要素蕴含项 + 贪心」,绝不谎称已最小
logic_minimize { expr: "((a & b) | (a & c)) | (b & c)" }
→ a & b | a & c | b & c (3 项、6 文字,已证明最小、唯一)
logic_minimize { expr: "a & !b & c | a & !b & !c", dontCare: [6, 7] }
→ a (1 项、1 文字;覆盖 m[4,5] 并跨过无关项 dc[6,7])
其余变更:期望值出处迁移到仓内 test/oracle/anchors.py(真值表 itertools 暴力枚举 + 最小化的穷尽集合覆盖搜索,与插件不共享任何 QMC 代码,--check 自检、--write-fixture 可逐字节重建 fixture);测试 97 → 144,覆盖率 94.57% → 96.32%。
v0.2.0 — Minimum sum of products (with don't-cares)
New tool logic_minimize: minimize a boolean expression to a sum of products (Quine–McCluskey).
- Returns the prime implicants (with the minterms and don't-cares each one spans), the essential ones, and a cover with the fewest terms
- Ties are broken deterministically (fewest terms → fewest literals → reading order) and reported honestly through
unique - Optional
dontCareminterm indices are the Karnaugh-map move:a & !b & c | a & !b & !cwithdontCare: [6, 7]collapses toa - A function that is false everywhere returns
"", a constant cover returns1; the search is exhaustive under a node budget, and if the budget is ever hit the result is flaggedexact: falsewith an essentials + greedy cover instead of a false minimality claim
Also in this release: test anchors moved into the repository (test/oracle/anchors.py) — itertools enumeration for the truth-table fixture and an exhaustive set-cover search over all cubes for minimization, sharing no Quine–McCluskey code with the plugin (--check re-verifies, --write-fixture regenerates byte-identically). Tests 97 → 144, coverage 94.57% → 96.32%.
Install
dsh plugin --profile web add github:TYEclipse/dsh-boolean