@@ -480,6 +480,63 @@ ce.box(['Not', ['Not', 'A']]).simplify(); // → A
480480
481481---
482482
483+ ### L-2. Prime Implicants/Implicates (Quine-McCluskey) ✅
484+
485+ ** IMPLEMENTED:** Added functions for finding prime implicants/implicates and
486+ computing minimal normal forms using the Quine-McCluskey algorithm:
487+
488+ 1 . ** ` PrimeImplicants(expr) ` ** - Find all prime implicants (minimal product terms):
489+ ``` typescript
490+ ce .box ([' PrimeImplicants' , [' Or' , [' And' , ' A' , ' B' ], [' And' , ' A' , [' Not' , ' B' ]]]]).evaluate ();
491+ // → [A] (AB and A¬B combine to just A)
492+
493+ ce .box ([' PrimeImplicants' , [' Or' , ' A' , ' B' ]]).evaluate ();
494+ // → [A, B] (two prime implicants)
495+ ```
496+
497+ 2 . ** ` PrimeImplicates(expr) ` ** - Find all prime implicates (minimal sum clauses):
498+ ``` typescript
499+ ce .box ([' PrimeImplicates' , [' And' , ' A' , ' B' ]]).evaluate ();
500+ // → [A, B] (the expression implies both A and B)
501+
502+ ce .box ([' PrimeImplicates' , [' Or' , ' A' , ' B' ]]).evaluate ();
503+ // → [A ∨ B] (single prime implicate)
504+ ```
505+
506+ 3 . ** ` MinimalDNF(expr) ` ** - Convert to minimal Disjunctive Normal Form:
507+ ``` typescript
508+ ce .box ([' MinimalDNF' , [' Or' ,
509+ [' And' , ' A' , ' B' ],
510+ [' And' , ' A' , [' Not' , ' B' ]],
511+ [' And' , [' Not' , ' A' ], ' B' ]
512+ ]]).evaluate ();
513+ // → A ∨ B (simplified from 3 terms to 2 prime implicants)
514+ ```
515+
516+ 4 . ** ` MinimalCNF(expr) ` ** - Convert to minimal Conjunctive Normal Form:
517+ ``` typescript
518+ ce .box ([' MinimalCNF' , [' And' , [' Or' , ' A' , ' B' ], [' Or' , ' A' , [' Not' , ' B' ]]]]).evaluate ();
519+ // → A (simplified to single literal)
520+ ```
521+
522+ ** Algorithm:** Quine-McCluskey with greedy covering:
523+ 1 . Generate minterms (for DNF) or maxterms (for CNF) from truth table
524+ 2 . Iteratively combine terms differing in exactly one variable
525+ 3 . Identify essential prime implicants
526+ 4 . Use greedy algorithm to find minimal cover
527+
528+ ** Performance:**
529+ - O(3^n) worst case complexity
530+ - Limited to 12 variables to prevent exponential blowup
531+ - Expressions with more variables return unevaluated
532+
533+ ** Files modified:**
534+ - ` src/compute-engine/library/logic-analysis.ts ` - Implemented Quine-McCluskey algorithm
535+ - ` src/compute-engine/library/logic.ts ` - Added 4 new function definitions
536+ - ` test/compute-engine/logic.test.ts ` - Added 17 new tests in "Prime Implicants and Minimal Forms" describe block
537+
538+ ---
539+
483540## Medium Priority (Completed)
484541
485542### 9. Implicit Multiplication Between ` \exp ` Function Calls ✅
0 commit comments