# equivalence comparator
import math
#Variable declaration
in1 = 1 # input-1
in2 = not(in1) # input-2
#Calculations
out=((not(in1))*( not(in2)))+(in1*in2)
#Result
print("output of comparator:")
print("out = %d"% out)
# antivalence comparator
import math
#Variable declaration
in1 = 1 # input-1
in2 = not(in1) # input-2
#Calculations
out=((not(in1))+( not(in2)))*(in1+in2)
#Result
print("output of comparator:")
print("out = %d"%out)
print("Theoretical example")
print("Theoretical example")
# simplify Boolean function
import math
#Variable declaration(Inputs)
#enter binary values only(1bit)
a=input("enter value of a") #input-1
b=input("enter value of b") #input-2
c=input("enter value of c") #input-3
#Calculations
x=not(a and b)
y=(x or c) #final output
#Result
print("\noutput:y=%d\n"%y)
print("verify from truth table\n")
print("a b c y\n")
print("0 0 0 1\n")
print("0 0 1 1\n")
print("0 1 0 1\n")
print("0 1 1 1\n")
print("1 0 0 1\n")
print("1 0 1 1\n")
print("1 1 0 0\n")
print("1 1 1 1\n")
print("Theoretical example")