Propositional Logic · Tautologies
Lesson 3
This is how you can verify these equivalences. In \(\texttt{Python}\), there is no dedicated operator for implication \(x \Rightarrow y\), but it can be rewritten as \(\overline{x}\lor y\).
from itertools import product
for x, y, z in product((True, False), repeat=3):
assert (x or y) == (y or x)
assert (x and y) == (y and x)
assert ((x or y) or z) == (x or (y or z))
assert ((x and y) and z) == (x and (y and z))
assert (not (x or y)) == (not x and not y)
assert (not (x and y)) == (not x or not y)
assert (x or (x and y)) == x
assert (x and (x or y)) == x
assert (not x or y) == (not (not y) or not x)
assert not(not x) == x