## Applying Laws Of Logic

Using law of logic, simplify the statement form

p \/ [~(~p /\ q)]

### Solution:

p \/ [~(~p /\ q)] =p \/ [~(~p) \/ (~q)] -- -- -- -- DeMorgan’s Law

=p \/ [p\/(~q)] -- -- -- -- -- -- Double Negative Law

=[p \/ p]\/(~q)-- -- -- -- -- -- Associative Law for \/

=p \/ (~q)-- -- -- -- -- Indempotent Law

This is the simplified statement form.

### Example:

Using Laws of Logic, verify the logical equivalence

~ (~ p /\ q) /\ (p \/ q) =p

~(~p /\ q) /\ (p \/ q) = (~(~p) \/ ~q) /\(p \/ q) - -- -- -- DeMorgan’s Law

= (p \/ ~q) /\ (p \/ q) -- -- -- -- Double Negative Law

= p \/ (~q /\ q) -- -- -- -- Distributive Law

= p \/ c -- -- -- -- Negation Law

= p -- -- -- -- -- Identity Law

## Simplifying A Statement:

“You will get an A if you are hardworking and the sun shines, or you are hardworking and it rains.”

Rephrase the condition more simply.

### Solution:

Let p = “You are hardworking’

q = “The sun shines”

r = “It rains”. The condition is then (p /\ q) \/ (p /\ r)

And using distributive law in reverse,

(p /\ q) \/ (p /\ r) p /\ (q \/ r)

Putting p /\ (q \/ r) back into English, we can rephrase the given sentence as

“You will get an A if you are hardworking and the sun shines or it rains.

### Exercise:

Use Logical Equivalence to rewrite each of the following sentences more simply.

**It is not true that I am tired and you are smart.**

{I am not tired or you are not smart.}**It is not true that I am tired or you are smart.**

{I am not tired and you are not smart.}**I forgot my pen or my bag and I forgot my pen or my glasses.**

{I forgot my pen or I forgot my bag and glasses.**It is raining and I have forgotten my umbrella, or it is raining and I have forgotten my hat.**

{It is raining and I have forgotten my umbrella or my hat.}

## Conditional Statements:

### Introduction

Consider the statement:

**"If you earn an A in Math, then I'll buy you a computer."**

This statement is made up of two simpler statements:

p: "You earn an A in Math," and

q: "I will buy you a computer."

The original statement is then saying:

**if p is true, then q is true, or, more simply, if p, then q.**

We can also phrase this as p implies q, and we write p q.

## Conditional Statements OR Implications:

**If p and q are statement variables, the conditional of q by p is “If p then q”, or “p implies q” and is denoted p ---> q.**

It is false when p is true and q is false; otherwise it is true. The arrow "--->" is the conditional operator, and in p ----> q the statement p is called the hypothesis (or antecedent) and q is called the conclusion (or consequent).

Truth Table:p | q | p --> q |

T | T | T |

T | F | F |

F | T | T |

F | F | T |

## Practice With Conditional Statements:

Determine the truth value of each of the following conditional statements:

- “If 1 = 1, then 3 = 3.” -- -- -- -->
**TRUE** - “If 1 = 1, then 2 = 3.” -- -- -- -->
**FALSE** - “If 1 = 0, then 3 = 3.” -- -- -- -->
**TRUE** - “If 1 = 2, then 2 = 3.” -- -- -- -->
**TRUE** - “If 1 = 1, then 1 = 2 & 2 = 3.” -->
**FALSE** - “If 1 = 3 or 1 = 2 then 3 = 3.” --->
**TRUE**

## Alternative Ways Of Expressing Implications:

The implication p ---> q could be expressed in many alternative ways as:

- “if p then q” -- -- -- -- --> •“not p unless q”
- “p implies q” -- -- -- -- --> •“q follows from p”
- “if p, q” -- -- -- -- -- ---> •“q if p”
- “p only if q” -- -- -- -- --> •“q whenever p”
- “p is sufficient for q” -- --> •“q is necessary for p”

### Exercise:

Write the following statements in the form “if p, then q” in English.

**Your guarantee is good only if you bought your CD less than 90 days ago.**

If your guarantee is good, then you must have bought your CD player less than 90 days ago.**To get tenure as a professor, it is sufficient to be world-famous.**

If you are world-famous, then you will get tenure as a professor.**That you get the job implies that you have the best credentials.**

If you get the job, then you have the best credentials.**It is necessary to walk 8 miles to get to the top of the Peak.**

If you get to the top of the peak, then you must have walked 8 miles.

## Translating English SEentences To Symbols:

Let p and q be propositions:

p = “you get an A on the final exam”

q = “you do every exercise in this book”

r = “you get an A in this class”

Write the following propositions using p, q, and r and logical connectives.

- To get an A in this class it is necessary for you to get an A on the final.

**SOLUTION**-- -- -- -- --> p ---> r. - You do every exercise in this book; You get an A on the final, implies, you get an A in the class.

**SOLUTION**-- -- -- -- --> p /\ q ---> r. - Getting an A on the final and doing every exercise in this book is sufficient for getting an A in this class.

**SOLUTION**-- -- -- -- --> p /\ q ---> r.

## Translating Symbolic Propositions To English:

Let p, q, and r be the propositions:

p = “you have the flu”

q = “you miss the final exam”

r = “you pass the course”

Express the following propositions as an English sentence.

**p ---> q**

If you have flu, then you will miss the final exam.**~q ---> r**

If you don’t miss the final exam, you will pass the course.**~p /\ ~q ---> r**

If you neither have flu nor miss the final exam, then you will pass the course.

## Hierarchy Of Operations For Logical Connectives

~ (negation)

/\ (conjunction), \/(disjunction)

---> (conditional)

Construct a truth table for the statement form p \/ ~ q ---> ~ p.

p | q | ~ q | ~ p | p \/ ~q | p \/ ~q ---> ~p |

T | T | F | F | T | F |

T | F | T | F | T | F |

F | T | F | T | F | T |

F | F | T | T | T | T |

Construct a truth table for the statement form (p ---> q)/\(~ p ---> r)

P | q | r | p ---> q | ~ p | ~ p ---> r | ( p --- > q ) /\ ( ~ p ---> r ) |

T | T | T | T | F | T | T |

T | T | F | T | F | T | T |

T | F | T | F | F | T | F |

T | F | F | F | F | T | F |

F | T | T | T | T | T | T |

F | T | F | T | T | F | F |

F | F | T | T | T | T | T |

F | F | F | T | T | F | F |

## Logical Equivalence Involving Implication

Use truth table to show p --- > q = ~q ---> ~p

Hence the given two expressions are equivalent.

## Implication Law

p ---> q = ~p \/ q

## Negation Of A Conditional Statement:

Since p ---> q = ~p \/ q therefore

~ (p ---> q) = ~ (~ p \/ q)

= ~ (~ p) /\ (~ q) by De Morgan’s law

= p /\ ~ q by the Double Negative law

Thus the negation of “if p then q” is logically equivalent to “p and not q”.

Accordingly, the negation of an if-then statement does not start with the word if.

### Examples:

Write negations of each of the following statements:

- If Ali lives in Pakistan then he lives in Lahore.
- If my car is in the repair shop, then I cannot get to class.
- If x is prime then x is odd or x is 2.
- If n is divisible by 6, then n is divisible by 2 and n is divisible by 3.

### Solutions:

- Ali lives in Pakistan and he does not live in Lahore.
- My car is in the repair shop and I can get to class.
- x is prime but x is not odd and x is not 2.
- n is divisible by 6 but n is not divisible by 2 or by 3.

## Inverse Of A Conditional Statement:

The inverse of the conditional statement p ---> q is ~p ---> ~q

A conditional and its inverse are not equivalent as could be seen from the truth table.

## Writing Inverse:

**If today is Friday, then 2 + 3 = 5.**

If today is not Friday, then 2 + 3 = 5.**If it snows today, I will ski tomorrow.**

If it does not snow today I will not ski tomorrow.**If P is a square, then P is a rectangle.**

If P is not a square then P is not a rectangle.**If my car is in the repair shop, then I cannot get to class.**

If my car is not in the repair shop, then I shall get to the class.

## Converse Of A Conditional Statement:

The converse of the conditional statement p ---> q is q ---> p, A conditional and its converse are not equivalent. i.e., ---> is not a commutative operator.

## Writing Converse:

**If today is Friday, then 2 + 3 = 5.**

If 2 + 3 = 5, then today is Friday.**If it snows today, I will ski tomorrow.**

I will ski tomorrow only if it snows today.**If P is a square, then P is a rectangle.**

If P is a rectangle then P is a square.**If my car is in the repair shop, then I cannot get to class.**

If I cannot get to the class, then my car is in the repair shop.

## Contrapositive Of A Conditional Statement:

The contrapositive of the conditional statement p ---> q is~ q ---> ~ p, A conditional and its contrapositive are equivalent. Symbolically ---> q = ~q ---> ~p.

**If today is Friday, then 2 + 3 = 5.**

If 2 + 3 = 5, then today is not Friday.**If it snows today, I will ski tomorrow.**

I will not ski tomorrow only if it does not snow today.**If P is a square, then P is a rectangle.**

If P is not a rectangle then P is not a square.**If my car is in the repair shop, then I cannot get to class.**

If I get to the class, then my car is not in the repair shop.