A function for determining if a set of statements are logically equivalent.
To compare any number of logical statements, first define them all as functions that take their variables as input.
Then, pass them into the equiv
function.
Note: the variables of the statements are matched across the functions by their input variable names.
For example, to show that s1 : ¬(p \/ q)
is logically equivalent to s2 : ¬p /\ ¬q
:
from equiv import equiv
def s1(p, q):
return not (p or q)
def s2(p, q):
return (not p) and (not q)
print(equiv(s1, s2)) # True