Minimize complete Boolean logic with dont-care conditions
Supply safe complete JSON, fix the care set and DNF/CNF request, and verify exact costs, every truth row and the variable-to-gate mapping.
Fix the source and permitted changes first
Choose paste or file mode and supply one complete strict UTF-8 JSON. expression is the original function, dontCare describes ignorable inputs, and form is dnf, cnf or both. Omitted dontCare means False. File mode reads exactly one original File; paste mode reads only active text. One leading source UTF-8 BOM is supported and retained byte for byte in the original.
Names are case-sensitive ASCII identifiers. Use ~A or !A for NOT, & for AND, ^ for XOR and | for OR. Precedence is NOT, AND, XOR, OR; add parentheses deliberately. Code, functions, numeric comparisons and shifts are outside this grammar.
| Setting | Where to set it | Choice and verification |
|---|---|---|
| inputMode | Input mode on the workbench | Choose paste to use the complete text, or file to use one selected original JSON File; there is no fallback between modes. |
| expression | Required JSON string | Supply the complete original function in the supported Boolean grammar; keep every case-sensitive variable name. |
| dontCare | Optional JSON string | Omit it for False, or supply the explicit condition for rows whose outputs may change; all other rows must remain equivalent. |
| form | Required JSON string | Choose dnf, cnf or both. Both shares one total budget and produces a separate completed form and diagram for each request. |
{
"expression": "(A & B) | (A & C)",
"dontCare": "False",
"form": "both"
}
- Select the input mode before running, then check that its complete text or original File is the source you intend to process.
- Keep dontCare as False when every input must stay equivalent; change it only when you can state which rows may change.
- Choose the required form in the JSON, then verify each requested form is complete before saving its expression, report and diagram.
Check care conditions and mask identity
A row where dontCare=true permits a changed output. Every care row, where dontCare=false, must match the original. Variables are the union of both expressions sorted by ASCII; a variable omitted by the result still remains in this mapping.
The example uses A, B and C: A is bit0/mask1, B bit1/mask2 and C bit2/mask4. Row mask3 is therefore A=1, B=1, C=0, with a true original output. Do not substitute another library’s bit-order convention.
| Field or value | Meaning | Check |
|---|---|---|
| expression | Complete original function | Evaluate every input row |
| dontCare=false | Required care row | Every requested output is equivalent |
| dontCare=true | Input that may change | Retain before/dc/after anyway |
| form=both | Request both DNF and CNF | One tool and one total budget |
Check the small exact-cost example
With dontCare=False, all eight rows of the synthetic function (A & B) | (A & C) are care. DNF has two AND terms with four literals; CNF is (B | C) & A, with two clauses and three literals. Compare term or clause count first, then literals for equal counts.
Changing the same function’s dontCare explicitly to ~A leaves four care rows with A=1. DNF can be B | C (two terms, two literals); CNF is (B | C) (one clause, two literals). Original A remains in the truth table and bit/mask mapping. Changed conditions require a new run.
Save the complete table, mappings and diagrams
Check the complete report state and each requested form’s completed exact state before saving. The truth CSV retains every row and original/DC/after values. The report retains all primes, selected cubes, masks, term/clause mappings and costs; a visible expression alone is insufficient.
Each requested form has one complete SVG with all variables, selected terms or clauses, literals and explicit NOT gates, and any constants connected to its selected cover. Original JSON is saved byte for byte, alongside effective settings and expression text. A bounded preview is separate from complete downloads and full report copy. Summary work is measured before result encoding; the single total-work budget also covers all later full encoding.
| Artifact | What remains complete |
|---|---|
| original.input | Exact original bytes, including a supported leading BOM |
| original-settings.json | Complete parsed settings, input mode and source identity |
| truth-table.csv | All masks, variables, original/dontCare/requested-form values |
| report.json | Complete compact report, all primes/selected mappings, costs and completion |
| result.txt | Every requested expression; identical to full expression copy |
| dnf.svg / cnf.svg | One complete selected-cover gate SVG per requested form; all variables and NOT literals |
Recover and record deliberate revisions
Input limits are 64 KiB, 8 variables, 4,096 tokens and 1,000 combined AST nodes; parser and parentheses depths are each 64. At most 256 truth rows and 6,561 cubes. One 10,000,000-work budget includes parsing, complete evaluation, each cover search, checks, mappings, diagrams and full encoding.
One 60-second deadline includes reading, loading, Workers, callbacks, complete validation, cleanup and first publication. A limit or cancellation refuses the entire task, clears old success and publishes no partial or late output. Retry the same original and parameters in a fresh Worker; record any deliberate reduction. Complete files plus all full copy text are limited to 8 MiB, with a 256 MiB memory reservation budget.
References
- HaydenMcT — inconsistent dont-care handling
The complete saved question, both comments and attached notebook were read. The author corrected a suggested diff that did not match then-current master or 1.14.0. The saved timeline closed COMPLETED on 2025-12-31 via PR 28842; that PR’s implementation or released fix was not assessed. The notebook was read, not executed; this page’s three-variable examples are synthetic.
- SymPy logic documentation
Saved SOPform, POSform and simplify_logic documentation explains normal forms and dont-care conditions. This tool uses an independently written bounded JavaScript route; it does not run SymPy, Pyodide or Espresso and does not claim general library compatibility or an applied upstream patch.
Tools in this category
Expand a tool to see its steps, options and supported formats, then open its workspace.
Boolean logic minimizerMinimize DNF, CNF or both under an explicit dont-care set, verify every care row, and keep the full truth table, variable mapping, costs and gate SVGs.
Define which inputs may change, then minimize terms or clauses before literals. The complete truth table and gate diagrams let you review every required input.
Steps
- Choose paste or file mode and supply the complete JSON; explicitly record expression, dontCare and form.
- Use ~ or !, &, ^, | and parentheses for safe Boolean expressions; check that inputs marked true by dontCare may really change.
- After running, check completion, equivalence on every care row, term/clause and literal costs, and the variable-to-bit/mask mapping.
- Download each requested form’s SVG, the full truth CSV, report, settings, expression text and original; copy a complete expression or the complete report.
Available options
- Input mode
- Paste complete JSON · Select one original JSON File
Only the current mode’s complete source is processed; there is no automatic fallback.
Capabilities and limits
- Choose paste or file mode explicitly. Paste processes only active text; file mode processes exactly one original File, with no automatic fallback. Supply one complete strict UTF-8 JSON source, up to 64 KiB. The form belongs in the JSON; the workbench control selects only the input mode. One leading UTF-8 BOM is accepted and retained in the exact original; an original File name is limited to 512 UTF-8 bytes without control characters or BOM.
- JSON uses an expression string, form (dnf, cnf or both), and an optional dontCare string that defaults to False. The grammar accepts ASCII variables, True/False (also true/false), ~ or !, &, ^, | and parentheses; it never executes code. Case-sensitive identifiers match [A-Za-z_][A-Za-z0-9_]*.
- At most 8 distinct variables, each identifier at most 128 ASCII bytes; 4,096 combined tokens and 1,000 total expression/dontCare AST nodes. Parser recursion and parentheses are each limited to depth 64, including redundant parentheses.
- Variables are the union of both expressions, sorted by ASCII. Variable i binds to bit i and mask 1<<i; all at most 256 rows are enumerated. Rows where dontCare is true do not constrain the result, but retain original, dont-care and minimized values.
- Each requested form must finish an exact cover: minimum term count (clause count for CNF), then minimum literal count for equal term counts, followed by all-care-row verification. At most 6,561 candidate cubes and 10,000,000 total work units; unfinished search or any budget excess refuses the whole task.
- Download the complete truth CSV, all requested expressions, report, effective settings, exact original JSON and one complete gate SVG per requested form. The report retains all variable/bit/mask, prime/selected-cube mappings, costs and completion state. SVG shows the selected cover and does not establish minimum gate count.
- Complete files plus all full copy text are limited to 8 MiB; typed compact JSON has a separate 8 MiB limit, their aggregate 16 MiB, and binary plus complete transfer metadata 32 MiB. Memory reservation budget is 256 MiB. These guards are not measured browser-heap promises. Bounded previews never shorten exports.
- One 60-second deadline starts before source checks, native File metadata/read, loading and Worker creation, and includes full validation, cleanup and first publication after await; it never resets. Cancellation, timeout or changed input clears old success and publishes no partial or late output. Retry the same original and parameters.