https en wikipedia orgwikikarnaughmap https www allaboutcircuits comtechnicalarticleskarnaughmapbooleanalgebraicsimplificationtechnique simplify the karnaugh map simplifykmapkmap0 1 1 1 a b ab ab simplifykmapkmap0 0 0 0 simplifykmapkmap0 1 1 1 a b ab ab simplifykmapkmap0 1 1 2 a b ab ab simplifykmapkmap0 1 1 1 1 a b ab ab simplifykmapkmap0 1 1 a a b ab ab main function to create and simplify a kmap main 0 1 1 1 simplified expression a b ab ab manually generate the product of 0 1 and 0 1 simplify the karnaugh map simplify_kmap kmap 0 1 1 1 a b ab ab simplify_kmap kmap 0 0 0 0 simplify_kmap kmap 0 1 1 1 a b ab ab simplify_kmap kmap 0 1 1 2 a b ab ab simplify_kmap kmap 0 1 1 1 1 a b ab ab simplify_kmap kmap 0 1 1 a a b ab ab main function to create and simplify a k map main 0 1 1 1 simplified expression a b ab ab manually generate the product of 0 1 and 0 1
def simplify_kmap(kmap: list[list[int]]) -> str:
    
    simplified_f = []
    for a, row in enumerate(kmap):
        for b, item in enumerate(row):
            if item:
                term = ("A" if a else "A'") + ("B" if b else "B'")
                simplified_f.append(term)
    return " + ".join(simplified_f)


def main() -> None:
    
    kmap = [[0, 1], [1, 1]]

    

    for row in kmap:
        print(row)

    print("Simplified Expression:")
    print(simplify_kmap(kmap))


if __name__ == "__main__":
    main()
    print(f"{simplify_kmap(kmap=[[0, 1], [1, 1]]) = }")