2
$\begingroup$

I am confused regarding the absorption rule which states: A OR (A AND B) = A.

I do not completely understand how the expression simplifies to A and while i have seen proofs for this question, i still feel that i don't completely grasp it.

I will outline my working out below:

if expression = A OR (A AND B) then, according to the commutative rule we can rewrite this as (A OR A) AND B. (A OR A) simplifies to A. This means we should be left with A AND B. However, the expression simplifies to A which i don't understand. Why is this the case?

$\endgroup$
  • $\begingroup$ "according to the commutative rule". Can you double check the commutative rule? $\endgroup$ – Apass.Jack Feb 5 at 22:42
  • $\begingroup$ The commutative rule states that A OR (A AND B) is the same as (A OR A) AND B right? The same as saying 5 x 2 + 3 is the same as (5 x 2) +3. $\endgroup$ – weary27 Feb 5 at 22:57
  • $\begingroup$ How did you double check the commutative rule? What about 5 + 2 x 3? $\endgroup$ – Apass.Jack Feb 5 at 23:04
  • $\begingroup$ Sorry, my mistake i was actually referring the associative law. I thought the two laws were the same rule. The commutative law states that A + B is the same as B + A $\endgroup$ – weary27 Feb 5 at 23:14
  • $\begingroup$ The associative law allows you to regroup variables without actually changing the order of operations. Hence, 5 + 2 x 3 would not be a valid commutation since you are changing the order of the operations. $\endgroup$ – weary27 Feb 5 at 23:18
1
$\begingroup$

One way to grasp it would be with concrete examples.

So an expression like:

"is a man" OR "is a man with a sister" (i.e. A = is a man and B = has a sister)

In this expression, if you're a man, it doesn't really matter whether you have a sister or not, you are to be counted.

or perhaps closer to a program, in an answer to "which words should we select?":

"words that start with W" OR "words that start with W and end with S"

You can see that the second condition identifies at most a subset of the first and is therefore redundant (and can safely be lopped off).

In code, you would simplify an expression like:

if s.startswith("W") or (s.startswith("W") and s.endswith("S"))

to

if s.startswith("W")

This might be why it's handy to know as a computer scientist. Conditional expressions have a tendency to become complex (and therefore difficult to reason about). Being able to simplify them safely is often a good refactoring move.

Another way to grasp it would be visually, with a Venn diagram with A and B overlapping circles. In that case, A AND B would be their intersection (the overlapping part) and the expression A OR (A AND B) would mean all points inside A or inside the intersection. Since the intersection is by definition all within A, specifying the (A AND B) intersection as an alternative is redundant.

$\endgroup$
  • 1
    $\begingroup$ Way to go scanny! Nice practical examples :-) $\endgroup$ – Musa Al-hassy Feb 6 at 17:06
0
$\begingroup$

A OR (A AND B) = A

1 OR (1 AND 0) = 1
1 OR 0 = 1

1 OR (1 AND 1) = 1
1 OR 1 = 1

0 OR (0 AND 1) = 0
0 OR 0 = 0

0 OR (0 AND 0) = 0
0 OR 0 = 0


Hope this helps.

$\endgroup$
  • $\begingroup$ Please could you explain where i went wrong in my working out? $\endgroup$ – weary27 Feb 5 at 21:24
  • 1
    $\begingroup$ I understand that when you actually put in the numbers the simplification works out but, i don't understand why my working out is invalid $\endgroup$ – weary27 Feb 5 at 21:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.