April 17th, 2017

## Logic

In the previous class we analyzed propositions about Things

• “The rose is red”
• “London is a small city”

and we discussed how to know the truth value of some complex phrases

Now we want to speak also about Attributes and understand the truth value of phrases like

• “All roses are red”
• “All men are mortal”

A phrase stating if a Thing has (or hasn’t) an Attribute

Predicates are either TRUE or FALSE. That is called the truth value of the predicate

To speak in general, we abstract and we say that

• If $$x$$ is a Thing and $$A$$ is an Attribute
• then $$A(x)$$ is a Predicate

## Remember: Complex Predicates

We can use logic connectors to combine simple predicates and make complex logic phrases

• “The rose is red AND London is a small city”
• “The rose is red OR London is a small city”
• “The rose is NOT red”
• “IF the rose is red THEN London is a small city”
• Same as “the rose is red IMPLIES London is a small city”

A logic phrase is a sentence that is either TRUE or FALSE

## Remember: Logical equivalence

Two predicates are equivalent when they have the same truth table

$$P(x)$$ $$Q(y)$$ $$P(x)$$ AND $$Q(y)$$ $$Q(y)$$ AND $$P(x)$$
TRUE TRUE TRUE TRUE
TRUE FALSE FALSE FALSE
FALSE TRUE FALSE FALSE
FALSE FALSE FALSE FALSE

Equivalence is also a logic connector

## All these are equivalent

P IMPLIES Q

IF P is true THEN Q is true

Q is true IF P is true

Q is NECESSARY for P

P is SUFFICIENT for Q

P is true ONLY IF Q is true

## Equivalence is a logic connector

Equivalence means “equal value”. $$P(x)$$ is equivalent to $$Q(y)$$ when $P(x)\text{ is true IF AND ONLY IF }Q(y)\text{ is true}$

$$P(x)$$ $$Q(y)$$ $$P(x)$$ EQUIVALENT TO $$Q(y)$$
TRUE TRUE TRUE
TRUE FALSE FALSE
FALSE TRUE FALSE
FALSE FALSE TRUE

## Translation

P is true IF AND ONLY IF Q is true

(P is true IF Q is true) AND (P is true ONLY IF Q is true)

(Q IMPLIES P) AND (P IMPLIES Q)

P is NECESSARY AND SUFFICIENT for Q

## Short notation of connectors

• Good notation makes easy to write complex phrases in short space
• Also helps to avoid ambiguity and errors

Complex Phrase Notation
$$P(x)$$ AND $$Q(y)$$ $$P(x) \,\&\, Q(y)$$
$$P(x)$$ OR $$Q(y)$$ $$P(x) \,\vert\, Q(y)$$
NOT $$P(x)$$ $$\neg P(x$$)
IF $$P(x)$$ THEN $$Q(y)$$ $$P(x) \Rightarrow Q(y)$$
$$P(x)$$ EQUIVALENT TO $$Q(y)$$ $$P(x) \Leftrightarrow Q(y)$$
• There is no short notation for $$P(x)$$ XOR $$Q(y)$$

To make phrases about Attributes we have to speak about the Things having these attributes

We have two key words, called quantifiers:

• “All” (sometimes written as $$\forall$$)
• “Some”, or “Exists” (written as $$\exists$$)

For example

• “All things are natural”
• “Some things are too expensive”

## Formal notation

Formal means “writing the phrase in the correct form

Helps to be clear and precise

“All things are natural”

• For all things $$x$$, $$Natural(x)$$
• $$\forall x, Natural(x)$$

“Some things are too expensive”

• There exists a thing $$x$$ such that $$TooExpensive(x)$$
• $$\exists x,\, TooExpensive(x)$$

## Negation of quantifiers

“Not all things are natural” means “There are some things that are not natural”

• There exists a thing $$x$$ such that NOT $$Natural(x)$$
• $$\exists x,\, \neg Natural(x)$$

“Nothing is too expensive” means “All things are not too expensive”

• For all things $$x$$, NOT $$TooExpensive(x)$$
• $$\forall x, \neg TooExpensive(x)$$

## Rules for negations

These are the same

• NOT (FOR ALL $$x$$, $$P(x)$$)
• THERE EXISTS $$x$$ SUCH THAT NOT $$P(x)$$ $\neg (\forall x, P(x)) \Leftrightarrow \exists x,\, \neg P(x)$

These are the same

• NOT (THERE EXISTS $$x$$ SUCH THAT $$P(X)$$) is equivalent to
• FOR ALL $$x$$ NOT $$P(x)$$ $\neg (\exists x, P(x)) \Leftrightarrow \forall x,\, \neg P(x)$

In the previous class we saw how to evaluate the truth value of a logical phrase depending on the specific cases of $$P(x)$$ and $$Q(Y)$$

Now we care about the truth of the phrase in general

If a predicate $$P(x)$$ is TRUE for all $$x$$, we say it is a TAUTOLOGY

“a statement that is true by necessity or by virtue of its logical form”

If a predicate $$P(x)$$ is FALSE for all $$x$$, we say it is a CONTRADICTION

## Example of Tautology

NOT (P(x) AND Q(x)) EQUIVALENT (NOT P(x) OR NOT Q(x))

$\neg(P(x)\,\&\, Q(x)) \Leftrightarrow (\neg P(x) \,|\, Q(x))$

## Understanding the complete phrase

Now we can understand better the meaning of “IMPLIES”

“If you are at Istanbul then you are in Turkey”

• For all things $$x$$, IF $$AtIstanbul(x)$$ THEN $$InTurkey(x)$$
• $$\forall x, AtIstanbul(x)\Rightarrow InTurkey(x)$$

This phrase is a TAUTOLOGY

That means that the argument is correct, in the logic sense

## Valid arguments

An argument is a phrase saying that IF several predicates (called premises) are true, THEN another predicate (called conclusion) must also be true

All the premises are connected by AND

$(P(x)\text{ AND }Q(x))\Rightarrow R(x)$

The argument is valid if it is a tautology

If the argument is not correct, we say it is a fallacy

## Example

• Elizabeth owns either a Honda or a Toyota.
• Elizabeth does not own a Honda.
• Therefore, Elizabeth owns a Toyota.

$(OwnHonda(e)\vert OwnToyota(e)) \&\neg OwnHonda(e)) \Rightarrow OwnToyota(e)$

$(P(x)\vert Q(x)) \&\neg P(x)) \Rightarrow Q(x)$

Notice that the argument is valid even if Elizabeth as no car

## Another example

• All toasters are items made of gold.
• All items made of gold are time-travel devices.
• Therefore, all toasters are time-travel devices.

$\begin{matrix}(\forall x, Toaster(x) \Rightarrow Gold(x)) \& (\forall x,Gold(x)\Rightarrow TimeMachine(x))\\ \Rightarrow (\forall x, Toaster(x) \Rightarrow TimeMachine(x))\end{matrix}$ $(P(x)\vert Q(x)) \,\&\,\neg P(x)) \Rightarrow Q(x)$

The first two propositions are not true. Nevertheless if they were true, the third proposition is necessarily true

## Validity and Soundness

An argument may be valid even if the premises are never true

A argument is sound if and only if it is both valid, and all of its premises are actually true.

Reference: http://www.iep.utm.edu/val-snd/

## Some important arguments

We saw that, for all x $(P(x)\vert Q(x)) \,\&\,\neg P(x)) \Rightarrow Q(x)$ $(P(x)\Rightarrow Q(x)) \,\&\, (Q(x)\Rightarrow R(x))\Rightarrow (P(x)\Rightarrow R(x))$ We also have “modus ponens” $(P(x)\Rightarrow Q(x)) \,\&\, P(x))\Rightarrow Q(x)$ and “modus tollens” $(P(x)\Rightarrow Q(x)) \,\&\, \neg Q(x))\Rightarrow \neg P(x)$

## Example of modus ponens

If being rich makes you happy and you are rich, then you are happy

IF you being rich IMPLIES you being happy AND you are rich THEN you are happy

IF $$Rich(x)\Rightarrow Happy(x)$$ AND $$Rich(x)$$, THEN $$Happy(x)$$

$$(P(x)\Rightarrow Q(x)) \,\&\, P(x))\Rightarrow Q(x)$$

## Example of modus tollens

If being rich makes you happy and you are unhappy, then you are not rich

IF you being rich IMPLIES you being happy AND you are not happy THEN you are not rich

IF $$Rich(x)\Rightarrow Happy(x)$$ AND $$\neg Happy(x)$$, THEN $$\neg Rich(x)$$

$$(P(x)\Rightarrow Q(x)) \,\&\, \neg Q(x))\Rightarrow \neg P(x)$$

## Instantiation

### General rules apply to particular cases

• All men are mortal
• Socrates is a man
• Therefore Socrates is mortal

For all things $$x$$, IF $$x$$ is Man, THEN $$x$$ is Mortal, AND socrates is Man, THEN socrates is mortal

For all $$x$$, ($$Man(x)$$ IMPLIES $$Mortal(x)$$) AND $$Man(socrates)$$, THEN $$Mortal(socrates)$$

$$(\forall x, Man(x)\Rightarrow Mortal(x))\,\&\,Man(socrates) \Rightarrow Mortal(socrates)$$

## Summary

IF someone is at Istanbul THEN that person is on Turkey

• What can we deduce if we know that Ali is at Istanbul
• What can we deduce if we know that Ali is not in Turkey