evaluate-boolean-expression
정보
이 스킬은 최대 여섯 변수까지의 불리언 표현식을 진리표, 대수적 법칙, 카르노 맵을 사용하여 평가하고 단순화합니다. 표현식을 최소 곱의 합 또는 합의 곱 형태로 축소하며 논리적 동등성을 검증합니다. 게이트 수준 구현을 위한 최소화된 함수를 준비하거나 디지털 논리를 분석하는 데 활용하세요.
빠른 설치
Claude Code
추천npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/evaluate-boolean-expressionClaude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요
문서
Evaluate Boolean Expression
Reduce Boolean expr → minimal form. Parse → canonical, truth table, algebraic laws, K-map (≤6 vars), verify equivalent to original.
Use When
- Simplify before map to gates
- Verify 2 exprs equivalent
- Generate minimal SOP or POS
- Teach/review Boolean algebra
- Prep for design-logic-circuit
In
- Required: Boolean expr any common notation (e.g.,
A AND (B OR NOT C),A * (B + C'),A & (B | ~C)) - Required: Target form — minimal SOP, POS, or both
- Optional: Variable ordering preference for K-map
- Optional: Don't-care conditions (minterms/maxterms unspecified)
- Optional: Second expr for equivalence check
Do
Step 1: Parse + Canonical
Convert to standard internal rep.
- Tokenize: Vars (letters/short names), ops (AND, OR, NOT, XOR, NAND, NOR), parens.
- Op notation: Consistent —
*AND,+OR,'NOT,^XOR. - Var count: Unique vars. Assign bit (A=MSB, ... Z=LSB default or provided).
- Canonical SOP: Expand → sum of all minterms via
X = X*(Y + Y'). - Canonical POS: Alt → product of all maxterms via
X = X + Y*Y'.
## Normalized Expression
- **Variables**: [A, B, C, ...]
- **Variable count**: [n]
- **Original expression**: [as given]
- **Canonical SOP (minterms)**: Sigma m(i, j, k, ...)
- **Canonical POS (maxterms)**: Pi M(i, j, k, ...)
- **Don't-care set**: d(i, j, ...) [if any]
→ Expr converted canonical SOP/POS w/ all min/maxterms listed, don't-cares separated.
If err: syntax/precedence ambiguous → clarify. Standard: NOT (highest) > AND > XOR > OR (lowest). >6 vars → K-map needs Quine-McCluskey.
Step 2: Truth Table
Build complete table for behavior over all inputs.
- Rows: All 2^n combos binary order (000, 001, 010, ...).
- Eval: Sub values → compute output (0/1).
- Don't-cares: Mark
Xinstead of 0/1. - Cross-check minterms: Rows w/ output 1 match minterm list Step 1.
## Truth Table
| A | B | C | F |
|---|---|---|---|
| 0 | 0 | 0 | _ |
| 0 | 0 | 1 | _ |
| ... | ... | ... | ... |
→ Complete 2^n rows, outputs match canonical, don't-cares marked.
If err: table disagrees w/ canonical → recheck Step 1 expansion. Common: misapply De Morgan during canonical → verify each step.
Step 3: Algebraic Simplify
Reduce via Boolean identities.
- Identity/null:
A + 0 = A,A * 1 = A,A + 1 = 1,A * 0 = 0. - Idempotent:
A + A = A,A * A = A. - Complement:
A + A' = 1,A * A' = 0. - Absorption:
A + A*B = A,A * (A + B) = A. - De Morgan:
(A * B)' = A' + B',(A + B)' = A' * B'. - Distributive:
A * (B + C) = A*B + A*C,A + B*C = (A + B) * (A + C). - Consensus:
A*B + A'*C + B*C = A*B + A'*C(B*C redundant). - XOR:
A*B' + A'*B = A ^ B. - Document each step: Expr after each law, cite law.
## Algebraic Simplification Trace
1. Original: [expression]
2. Apply [law name]: [result]
3. Apply [law name]: [result]
...
n. Final algebraic form: [simplified expression]
→ Step-by-step reduction w/ law citations, converging simpler. Trace = verifiable proof.
If err: no further simplify but non-minimal → Step 4 (K-map). Algebraic ≠ guaranteed global min — depends on order.
Step 4: K-map Minimize
Provably minimal SOP/POS (≤6 vars).
- Draw: Gray code on axes.
- 2 vars: 2x2
- 3 vars: 2x4
- 4 vars: 4x4
- 5 vars: two 4x4 stacked
- 6 vars: four 4x4 stacked
- Fill: 1s (minterms), 0s (maxterms), Xs (don't-cares).
- Group adj 1s: Rectangular groups of 1, 2, 4, 8, 16, 32 (powers of 2). Wrap edges. Include don't-cares if enlarge.
- Prime implicants: Each group → product term. Constant vars appear, changing eliminated.
- Essential prime implicants: Minterms covered by only 1 PI → essential.
- Cover remaining: Fewest additional PIs (Petrick's if needed).
- Minimal expr: Combine selected PIs → minimal SOP. For POS group 0s.
## K-map Result
- **Prime implicants**: [list with covered minterms]
- **Essential prime implicants**: [list]
- **Minimal SOP**: [expression]
- **Minimal POS**: [expression, if requested]
- **Literal count**: [number of literals in minimal form]
→ Minimal SOP/POS fewest literals, all PIs documented.
If err: ambiguous (multiple minimal covers) → list all equivalent. >6 vars → Quine-McCluskey tabular or Espresso heuristic, note change.
Step 5: Verify
Confirm logical equivalence simplified vs original.
- Truth table compare: Eval simplified all 2^n → compare Step 2. Every non-don't-care row must match.
- Algebraic proof (optional): Derive original from simplified (vice versa) via Step 3 laws.
- Spot-check: All-zeros, all-ones, tricky simplification inputs.
- Document: Equivalence holds? Final minimal form.
## Equivalence Verification
- **Method**: [truth table comparison / algebraic proof / both]
- **Mismatched rows**: [none, or list row numbers]
- **Verdict**: [Equivalent / Not equivalent]
- **Final minimal expression**: [the verified result]
→ Simplified matches original all non-don't-care. Final min form clear.
If err: mismatch → trace Steps 3-4. Common: incorrect K-map grouping (non-rect / non-power-of-2), forget wrap, group 0 cell.
Check
- All vars accounted for
- Canonical SOP/POS lists correct min/maxterms
- Truth table 2^n rows correct outputs
- Don't-cares handled (in groups, not coverage req)
- Algebraic steps cite law + verifiable
- K-map Gray code both axes
- All groups rect + power-of-2
- Essential PIs identified
- Simplified matches on non-don't-care
- Final = min literals
Traps
- K-map adjacency: Leftmost/rightmost cols + top/bottom rows adjacent (wrap). Essential for largest groups.
- Non-power-of-2 groups: 3 or 5 cells. Must be 1, 2, 4, 8, 16, 32. Irregular ≠ valid product.
- Ignore don't-cares: Treating as 0s not using to enlarge. Include when reduces, but not required for coverage.
- Precedence err: Assuming AND/OR equal. Standard: NOT > AND > OR.
A + B * C≠(A + B) * C. - Stop at algebraic: Local min not global. Cross-check K-map (Quine-McCluskey >6 vars) to confirm.
- Min vs maxterm: Minterms = AND (products) in SOP. Maxterms = OR (sums) in POS. m3 3 vars = A'BC; M3 = A+B'+C'.
→
design-logic-circuit— map minimized expr → gate-levelargumentation— structured logical reasoning, shares formal logic
GitHub 저장소
연관 스킬
executing-plans
디자인executing-plans 스킬은 검토 체크포인트가 포함된 통제된 배치로 실행할 완전한 구현 계획이 있을 때 사용합니다. 이 스킬은 계획을 불러와 비판적으로 검토한 후, 소규모 배치(기본값 3개 작업)로 작업을 실행하면서 각 배치 사이에 진행 상황을 아키텍트 검토를 위해 보고합니다. 이를 통해 내재된 품질 관리 체크포인트를 갖춘 체계적인 구현이 보장됩니다.
requesting-code-review
디자인이 스킬은 코드 변경 사항을 요구 사항에 따라 분석하기 위해 코드 리뷰어 하위 에이전트를 호출합니다. 작업 완료 후, 주요 기능 구현 후, 또는 메인 브랜치에 병합하기 전에 사용해야 합니다. 이 리뷰는 현재 구현체와 원래 계획을 비교하여 문제를 조기에 발견하는 데 도움이 됩니다.
connect-mcp-server
디자인이 스킬은 개발자들이 HTTP, stdio 또는 SSE 전송 방식을 통해 MCP 서버를 Claude Code에 연결하는 포괄적인 가이드를 제공합니다. GitHub, Notion 및 사용자 정의 API와 같은 외부 서비스를 통합하기 위한 설치, 구성, 인증 및 보안을 다룹니다. MCP 통합 설정, 외부 도구 구성 또는 Claude의 모델 컨텍스트 프로토콜 작업 시 활용하세요.
web-cli-teleport
디자인이 스킬은 작업 분석을 기반으로 개발자가 Claude Code 웹 인터페이스와 CLI 인터페이스 중 선택할 수 있도록 돕고, 두 환경 간 원활한 세션 텔레포트를 가능하게 합니다. 웹, CLI 또는 모바일 환경 전환 시 세션 상태와 컨텍스트를 관리하여 워크플로를 최적화합니다. 다양한 단계에서 서로 다른 도구가 필요한 복잡한 프로젝트에 사용하세요.
