March 16th, 2018

## There are two types of “Why”

The question “why?” can have two types of answers

• What is the purpose of something
• This assumes that things have a purpose
• This is called “Teleology”
• What is the mechanisms that causes something
• This is the scientific approach
• The mechanism has to follow some logic

## Logic Arguments

Speaking the Truth

## A brief introduction to Logic

• The Universe contains Things

• For example, “I”, “Istanbul”, “roses”, ”Turkish books”, “a letter”
• Things have Attributes

• For example, “large”, “red”, “old”, “which I received yesterday”
• It is the same as to say that Things have Properties

Based on the book “Symbolic Logic” by Lewis Carroll

## “Things” have “Attributes”

One Thing may have many Attributes, and one Attribute may belong to many Things

• The Thing “a rose” may have the Attributes “red,” “scented,” “full-blown,”
• The Attribute “red” may belong to the Things “a rose,” “a brick,” “a ribbon,”

## Simple Predicates: one thing, one attribute

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

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

Predicates are either TRUE or FALSE

That is called the truth value of the predicate

## We use symbols for “Things” and “Attributes”

Abstracting a little (to make it general), we can say that

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

When we see $$A(x)$$ we say “$$x$$ is $$A$$”

Example: $$x$$: snow, $$A$$ hot, $$A(x)$$ is FALSE

## Complex Predicates: several things, several attributes

We can combine simple predicates to make complex phrases that can be either TRUE or FALSE

To combine predicates, we can use only a few words

• NOT: “The rose is NOT red”
• AND: “The rose is red AND Istanbul is a small city”
• OR: “The rose is red OR Istanbul is a small city”
• IF…THEN: “IF the rose is red THEN Istanbul is a small city”

## The meaning of “NOT”

This rule applies to a single predicate $$P(x)$$

The truth value of the complex predicate “NOT $$P(x)$$” depends on the truth value of $$P(x)$$. We can see it in the truth table

$$P(x)$$ NOT $$P(x)$$
TRUE FALSE
FALSE TRUE

## Meaning of “AND”

The complex predicate $$P(x)\text{ AND }Q(y)$$ is TRUE when all parts are true.

We can see it in a truth table

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

## Meaning of “OR”

The predicate $$P(x)\text{ OR }Q(y)$$ is TRUE if any of the parts is TRUE

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

Notice that this is an Inclusive OR

## Exclusive OR rule

“XOR” is TRUE if any of $$P(x)$$ and $$Q(y)$$ is TRUE, but not both

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

Now the result if FALSE if $$P(x)$$ and $$Q(y)$$ are TRUE at the same time

## 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

## Many ways to say EQUIVALENT

$$P(x)$$ is EQUIVALENT to $$Q(y)$$

$$P(x)$$ is true IF AND ONLY IF $$Q(y)$$ is true

($$P(x)$$ is true IF $$Q(y)$$ is true) AND ($$P(x)$$ is true ONLY IF $$Q(y)$$ is true)

(IF $$Q(y)$$ is true THEN $$P(x)$$ is true) AND (IF $$P(x)$$ is true THEN $$Q(y)$$ is true)

($$Q(y)$$ IMPLIES $$P(x)$$) AND ($$P(x)$$ IMPLIES $$Q(y)$$)

$$P(x)$$ is NECESSARY AND SUFFICIENT for $$Q(y)$$

## Implication

### The most important one

When it is true that “IF $$P(x)$$ THEN $$Q(y)$$”?

$$P(x)$$ $$Q(y)$$ IF $$P(x)$$ THEN $$Q(y)$$
TRUE TRUE TRUE
TRUE FALSE FALSE
FALSE TRUE TRUE
FALSE FALSE TRUE

## All these are equivalent

$$P(x)$$ IMPLIES $$Q(y)$$

IF $$P(x)$$ is true THEN $$Q(y)$$ is true

$$Q(y)$$ is true IF $$P(x)$$ is true

$$Q(y)$$ is NECESSARY for $$P(x)$$

$$P(x)$$ is SUFFICIENT for $$Q(y)$$

$$P(x)$$ is true ONLY IF $$Q(y)$$ is true

## Bigger predicates

We can easily combine all the previous operations

• $$P(x)$$ AND $$Q(y)$$ AND $$R(z)$$
• $$P(x)$$ OR NOT $$Q(x)$$

We use parenthesis to avoid ambiguity. For example

• NOT $$P(x)$$ AND $$Q(y)$$ can be
• NOT ($$P(x)$$ AND $$Q(y)$$)
• (NOT $$P(x)$$) AND $$Q(y)$$

## Avoid ambiguity

### What do we mean when we say “NOT $$P(x)$$ AND $$Q(y)$$”?

Let’s compare the two interpretations

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

They are different. Parenthesis are important

## Are we saying “the same thing”?

Two predicates are equivalent when they have the same truth table

For example

$$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

## For AND and OR, the order is not important

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

## An important rule

### De Morgan’s law

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

Negation of AND is the OR of negations

## Another De Morgan’s law

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

Negation of OR is the AND of negations

## 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) \wedge Q(y)$$
$$P(x)$$ OR $$Q(y)$$ $$P(x) \vee 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)$$

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

So far we saw how to evaluate the truth value of a logical phrase depending on the specific things ($$x$$ and $$y$$)

Now we care about the truth of the phrase in general

We have two key words, called quantifiers:

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

## Examples of predicates about attributes

For example

• “All things are natural”
• “Some things are too expensive”
• “All men are mortal”
• “Nothing is impossible”

## Writing the phrase in the correct form

The correct form of writing is using a Formal notation

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)$