Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can a contradiction Boolean expression with variables 𝑎 and 𝑏 be represented in NAND form?

I have f(a,b) = 0 and want to represent it in NAND form in terms of a and b, but I don’t think is possible.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

def NAND(a, b):
    return (a & b) ^ 1

def f(a, b):
    return NAND(
        NAND(a, NAND(a, a)),
        NAND(b, NAND(b, b)),
    )

for a in 0, 1:
    for b in 0, 1:
        print(f(a, b))

Output (Attempt This Online!):

0
0
0
0
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading