#!/usr/bin/python
# -*- coding: utf-8 -*-
def AND(A, B):
return (A and B)
def OR(A, B):
return (A or B)
def NOT(A):
return (not A)
def IMP(A, B):
return (not A or B)
def BIC(A, B):
return (IMP(A, B) and IMP(B, A))
def main():
print "Z = (¬(PvQ) v (¬Rv(R^R))"
print "P\\tQ\\tR\\t¬(PvQ)\\t¬Rv(R^R) Z"
for P in range(2):
for Q in range(2):
for R in range(2):
VarP = bool(P)
VarQ = bool(Q)
VarR = bool(R)
VarParte1 = bool(NOT(OR(P,Q)))
VarParte2 = bool(OR(NOT(R),(AND(R, R))))
VarZ = bool(OR((NOT((OR(P,Q)))), (OR((NOT(R)),(AND(R,R))))))
print "%r\\t%r\\t%r\\t%r\\t%r\\t = %r" % (VarP, VarQ, VarR, VarParte1, VarParte2, VarZ)
#print bool(OR((NOT((OR(P,Q)))), (OR((NOT(R)),(AND(R,R))))))
main()