I am having trouble seeing how I could apply the equivalence rules mentioned here to the following formula in order to convert it into Conjunctive Normal Form (CNF).
$$(p \wedge q) \vee (\neg p \wedge r)$$
I know the solution through Wolfram Alpha, but I do not see how these rules could be applied in order to obtain the answer. These rules get a little confusing for me when a negation of a literal is involved. Could someone please help me to understand this process?
If we look here we are given an algorithm to follow, and we will see that at each step all we need to do is step $5$.
$$(p \wedge q) \vee (\neg p \wedge r) \equiv ((p \wedge q) \vee \neg p) \wedge ((p \wedge q) \vee r) \quad \text{ distribute} \vee \text{ over } \wedge$$ $$\equiv ((p \vee \neg p) \wedge (q \vee \neg p)) \wedge ((p \vee r) \wedge (q \vee r)) \quad \text{ again distribute} \vee \text{ over } \wedge $$ $(p \vee \neg p)$ is a tautology and we know that $t \wedge a \equiv a$ for any tautology $t$, so that we can just "throw out" $(p \vee \neg p)$. This leaves us with:
$$(q \vee \neg p) \wedge ((p \vee r) \wedge (q \vee r)) \equiv (q \vee \neg p) \wedge (p \vee r) \wedge (q \vee r) \quad \text{ since } \wedge \text{ is associative} $$
This is in conjunctive normal form, although it is not exactly what Wolfram is giving.