Skip to content

Latest commit

 

History

History
28 lines (15 loc) · 612 Bytes

README.md

File metadata and controls

28 lines (15 loc) · 612 Bytes

equiv

A function for determining if a set of statements are logically equivalent.

Usage

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