Using the distributivity law for propositional logic

I know how to use the standard rule

$$p\vee (q\wedge r)\equiv (p\vee q)\wedge (p\vee r)$$

but what if I have a two by two statement like:

$$(p\vee q)\wedge (r\vee s)$$ ...

I'm guessing that it follows a similar rule to the FOIL method in algebra? I took a shot in the dark and came up with this, but I want to make sure my logic is correct.

$$(p\wedge r)\vee (p\wedge s)\vee (q\wedge r)\vee (q\wedge s)$$


You’re right: the underlying law is the same as in ordinary algebra, so the calculation works out in the same fashion. In detail:

Think of $p\lor q$ as a single entity; call it $t$ temporarily. Then you have

$$t\land(r\lor s)\equiv(t\land r)\lor(t\land s)\;.$$

Now expand $t$ in each of the disjuncts:

$$t\land r\equiv(p\lor q)\land r\equiv(p\land r)\lor(q\land r)$$

and

$$t\land s\equiv(p\lor q)\land s\equiv(p\land s)\lor(q\land s)\;,$$

so the original expression is equivalent to

$$\Big((p\land r)\lor(q\land r)\Big)\lor\Big((p\land s)\lor(q\land s)\Big)\;.$$

Finally, the big parentheses are clearly unnecessary, so you have

$$(p\land r)\lor(q\land r)\lor(p\land s)\lor(q\land s)\;.$$


Let $t=p\lor q$. Then:

$$(p\lor q) \land (r\lor s) = t\land (r\lor s) = (t\land r)\lor(t\land s)$$

Substitute back $p\lor q$ and you get:

$$=((p\lor q)\land r)\lor ((p\lor q)\land s)$$

Now distribute the sub-expressions:

$$(p\lor q)\land r) = (p\land r)\lor (q\land r)$$ $$(p\lor q)\land s) = (p\land s)\lor (q\land s)$$

Substituting back in you get:

$$\begin{align}(p\lor q) \land (r\lor s) &= ((p\land r)\lor (q\land r))\lor ((p\land s)\lor (q\land s))\\ &= (p\land r)\lor (q\land r)\lor (p\land s)\lor (q\land s) \end{align}$$