Karnaugh map (K-map) implementation