I'm trying to create a associate xor chart on Haskell, which to my understanding, should come out true in every instance. Though, when i call my function I get: [True, True, True, False, True, False, True, True]. Can anyone see the mistake I made?
bools = [True, False]
xor_assoc = [ ((r || (p || q)) && not (r || (p && q)))
== ((p || (r || q)) && not (p || (r && q)))
| r <- bools,
p <- bools,
q <- bools]
I dont know what you are doing exactly. But the way you are doing list comprehension, it will generate all possible
2^3cases. And your predicate returnsFalsein two of them.When
(p,q,r) = (False,False,True)then(r || (p && q))becomesTruehence lhs isFalse, whereas(p || (r && q))isFalseand hence rhs isTrue.Similar is the case with
(True,False,False)in which lhs isTrueand rhs isFalse.