April 24th, 2017

## Another perspective of Logic

Things have Attributes

All the Things that share a given Attribute are a Set

For example:

• red things
• wild flowers
• smart students

## Universe

When we say “all the things”, what do we mean by “all”?

In principle all can mean literally everything, real or imaginary

In practice we mean all thing of some class. This is called “the Universe

For example:

• In “red things” the universe can be “physical objects with color”
• In "wild flowers" the universe can be “all flowers”
• In "smart students" the universe can be “all students”

## Universe

If it is not clear from the context, we have to define explicitly the universe

For notation we often use $$U$$. That is

$$U$$ is the set of all things that are relevant to the current issue

## Attributes and set notation

If a thing $$x$$ has an attribute $$A$$, then the predicate $$A(x)$$ is true

Now we will use the same symbol $$A$$ to represent the set of all things with that property

We say that $$A$$ is the set of all things $$x$$ such that $$A(x)$$ is true $A=\{x : A(x)\}$

Now if $$x$$ has the property $$A$$, we can say that $$x\in A$$

Notice: With parenthesis it is a logic phrase, without it is a set

## Empty sets

We said that attributes only exist when some thing has the attribute

In more general we can imagine attributes that can exist, but there is nothing in the universe that has that attribute

(like “being a time machine”)

If an Set does not have anything, we say it is an empty set

We write $$\emptyset$$, meaning “the empty set”

## Set complement

What about the things that do not have an attribute?

We can also define the set of things $$x$$ such that $$\neg A(x)$$

We call this set the complement of the set $$A$$

We write it as $$\overline{A}$$ or as $$A^C$$, so

$\overline{A} = \{x: \neg A(x)\}$ which can also be written $\overline{A} = \{x: x\not\in A\}$

## Mixing sets with “AND”

We can give names to all sets that we make from Logical predicates

For example, the set of all $$x$$ with property $$A$$ AND property $$B$$ is called the intersection of the set $$A$$ and the set $$B$$

$A\cap B=\{x: x\in A\, \&\, x\in B\} =\{x: A(x)\, \&\, B(x)\}$

Therefore, if we know that $$x\in A\cap B$$ then we know that $$x\in A$$ AND $$x\in B$$

Notice: The intersection of two roads is the part that belongs to both roads

## Mixing sets with “OR”

In the same way we can define the set of all $$x$$ with property $$A$$ OR property $$B$$

It is called the union of the sets $$A$$ and $$B$$

$A\cup B = \{x: x\in A\, \vert\, x\in B\} =\{x: A(x)\, \vert\, B(x)\}$

Therefore, if we know that $$x\in A\cup B$$ then we know that $$x\in A$$ OR $$x\in B$$

## Set difference

What about all the elements of $$A$$ that are not elements of $$B$$?

The set difference of $$A$$ and $$B$$ is the set of all elements in $$A$$ that are not elements of $$B$$

$A\setminus B = \{x: x\in A \,\&\, x\not\in B\}$

## Visualization: Venn diagram We can draw two sets and identify all the elements we just described

• $$U$$
• $$\overline{A}$$
• $$A\cap B$$
• $$A \cup B$$
• $$A\setminus B$$