how to use Shannon-expansion to rewrite Logic to Normal if-then-else Form (INF)

478 Views Asked by At

I'm taking a (online) course in logic, one goal of the course is to rewrite logic expressions to if-then-else form, using shannon-expansion, the following is a text-book example:

we got:

(p ∨ ¬r) → p

this can be rewriten using a Shannon-expansion to Normal if-then-else form (INF) and the solution looks like this when done so:

(p ∨ ¬r) → p
p → ((⊺ ∨ ¬r) → ⊺); ((┴ ∨ ¬r) → ┴)
p → (r → ((⊺ ∨ ¬⊺) → ⊺); ((⊺ ∨ ¬┴) → ⊺));
(r → ((┴ ∨ ¬⊺) → ┴); ((┴ ∨ ¬┴) → ┴)))
p → (r → (⊺ → ⊺); (⊺ → ⊺)); (r → (┴ → ┴); (⊺ → ┴))
p → (r → ⊺; ⊺); (r → ⊺;┴ )
p → ⊺; (r → ⊺;┴ )

I'm having a hard time understanding exactly what is happening here and can't rly find any other examples or good explanations of this, so if there is some one that could explain this answer to me that would be great!

1

There are 1 best solutions below

2
On BEST ANSWER

In general, the expression

$$p\rightarrow (expression_1;expression_2)$$

is understood as:

'if $p$ is true, then $expression_1$ holds, otherwise $expression_2$ holds'

So, for example, given the initial expression

$$(p \lor \neg r) \rightarrow p$$

we can say that if $p$ is true, then the expression evaluates to

$$(\top \lor \neg r) \rightarrow \top$$

while if $p$ is false, then it evaluates to:

$$(\bot \lor \neg r) \rightarrow \bot$$

and therefore the original expression can be written as:

$$p \rightarrow ((\top \lor \neg r) \rightarrow \top ; (\bot \lor \neg r) \rightarrow \bot)$$

and this is what you see on the second line.

And now just do the same for $r$

That is, if we expand the first half

$$(\top \lor \neg r)\rightarrow \top $$, we get

$$(\top \lor \neg \top)\rightarrow \top $$

if $r$ is true, and:

$$(\top \lor \neg \bot)\rightarrow \top $$

if $r$ is false, and so this becomes:

$$r \rightarrow ((\top \lor \neg \top)\rightarrow \top ; (\top \lor \neg \bot)\rightarrow \top) $$

while the second half becomes:

$$r \rightarrow ((\bot \lor \neg \top)\rightarrow \bot ; (\bot \lor \neg \bot)\rightarrow \bot) $$

meaning that we get:

$$p \rightarrow (r \rightarrow ((\top \lor \neg \top)\rightarrow \top ; (\top \lor \neg \bot)\rightarrow \top) ; r \rightarrow ((\bot \lor \neg \top)\rightarrow \bot ; (\bot \lor \neg \bot)\rightarrow \bot))$$

on line 3

And form this point on, it's just a matter of evaluating the 4 expressions you end up with. For example, the first expression

$$(\top \lor \neg \top)\rightarrow \top$$

works out to:

$$\top \rightarrow \top$$

(this you see as the first expression on line 4) which itself works out to :

$$\top$$

(and this you see as the first expression on line 5)

Finally, the expression $r \rightarrow (\top ; \top)$ that is part of line 6 is being replaced by $\top$ on line 7 since apparently it does not matter what $r$'s truth-value is.