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^3
cases. And your predicate returnsFalse
in two of them.When
(p,q,r) = (False,False,True)
then(r || (p && q))
becomesTrue
hence lhs isFalse
, whereas(p || (r && q))
isFalse
and hence rhs isTrue
.Similar is the case with
(True,False,False)
in which lhs isTrue
and rhs isFalse
.