CMSC250

Quantification

Quantification

Sets and Predicates
Quantifications
Basic Set Stuff
Complex Quantification

Sets

Set: a collection of unordered and unique things

Note: there could be 0 things

We sometimes need to group together items that have similar qualities

or items to be used as input for functions (later lecture)

\(\{\text{cliff},\text{paul}\}\)

\(\{1,2,3,4,5\}\)

We can give sets arbitrary names as long as we define them

\(TEACHERS\) is the set of all teachers at UMD

\(P\) is the set of all people in the world

\(x\) is an element of some set \(A\): \(x \in A\)

\(x \not\in A\) means \(x\) is not in the set \(A\)

\(\text{cliff} \in \{\text{cliff},\text{paul}\}\)

\(4 \not\in \{0,1,2,3\}\)

Common Sets

  • \(\mathbb{N}\): Naturals
  • \(\mathbb{Z}\): Integers
  • \(\mathbb{R}\): Reals
  • \(\mathbb{Q}\): Rationals
  • \(\mathbb{C}\): Complex
  • \(\mathbb{P}\): Primes
  • \(\mathbb{N}\): Naturals
  • \(\{0,1,2,\dots\}\)
  • \(\mathbb{Z}\): Integers
  • \(\mathbb{R}\): Reals
  • \(\mathbb{Q}\): Rationals
  • \(\mathbb{C}\): Complex
  • \(\mathbb{P}\): Primes
  • \(\mathbb{N}\): Naturals
  • \(\mathbb{Z}\): Integers
  • \(\{\dots,-2,-1,0,1,2,\dots\}\)
  • \(\mathbb{R}\): Reals
  • \(\mathbb{Q}\): Rationals
  • \(\mathbb{C}\): Complex
  • \(\mathbb{P}\): Primes
  • \(\mathbb{N}\): Naturals
  • \(\mathbb{Z}\): Integers
  • \(\mathbb{R}\): Reals
  • Any number that is not complex (no \(i\))
  • \(\mathbb{Q}\): Rationals
  • \(\mathbb{C}\): Complex
  • \(\mathbb{P}\): Primes
  • \(\mathbb{N}\): Naturals
  • \(\mathbb{Z}\): Integers
  • \(\mathbb{R}\): Reals
  • \(\mathbb{Q}\): Rationals
  • Numbers that can be the ratio between 2 integers
  • \(\mathbb{C}\): Complex
  • \(\mathbb{P}\): Primes
  • \(\mathbb{N}\): Naturals
  • \(\mathbb{Z}\): Integers
  • \(\mathbb{R}\): Reals
  • \(\mathbb{Q}\): Rationals
  • \(\mathbb{C}\): Complex
  • numbers in the form \(a+bi\), where \(a,b \in \mathbb{R}\)
  • \(\mathbb{P}\): Primes
  • \(\mathbb{N}\): Naturals
  • \(\mathbb{Z}\): Integers
  • \(\mathbb{R}\): Reals
  • \(\mathbb{Q}\): Rationals
  • \(\mathbb{C}\): Complex
  • \(\mathbb{P}\): Primes
  • Prime Numbers

The empty set \(\{\}\) is the set that contains no items

AKA the null set \(\emptyset\)

Note: \(\{\emptyset\} \neq \emptyset\)

Predicate: to assert a property about an item

\(HUMAN(x)\) means that \(x\) is a human

\(BLUE(y)\) means that \(y\) is blue

\(LIKES(x,y)\) means that \(x\) likes \(y\)

Predicate: to assert a property about an item

Can be arbitrary as long as they are defined

\(P(x)\) means that \(x\) is red

\(T(y)\) means that \(y\) is a number

\(S(x,y)\) means that \(x\) is a sibling of \(y\)

Quantification

Sometimes we want to talk about a bunch of things

Let \(P\) be the set of people in this class

Let \(S(x)\) mean that \(x\) is older than 7 years of age.

All people in this class are older than 7 years of age

All is an English quantifier, tells us how much

\((\forall x \in P)[S(x)]\)

\((\forall x \in P)[S(x)]\)

For all items, \(x\), in the set \(P\), such that \(S(x)\) is true

The set we are talking about is called a Domain

\((\forall x \in \{0,1,2,3\})[x \ge 0]\)

Only true if it applies to all values

\((\forall x \in \{0,1,2,3\})[x \ge 2]\) is false

Sometimes we just want something to be true about some items of a set

Let \(P\) be the set of people in this class

Let \(S(x)\) mean that \(x\) is older than 22 years of age.

Some people in this class are older than 22

Some is an English quantifier, tells us how much

In logic, we say there exists

\((\exists x \in P)[S(x)]\)

\((\exists x \in P)[S(x)]\)

There exists (at least) one person \(x\) in the set \(P\) such that \(S(x)\) is true

\((\exists x \in \{0,1,2,3\})[x \ge 2]\)

True if at least one item satisfies the condition

\((\exists x \in \{-2,-1,0,1\})[x \ge 2]\) is false

If we want to say only 1 item exists we use \(\exists !\) (exists unique)

\((\exists ! x \in \{0,1,2\})[x \ge 2]\)

\((\exists ! x \in \{0,1,2,3\})[x \ge 2]\) is false

Basic Set Stuff

Let's first do some basic set relations

Subset: \(A\) is a subset of \(B\) if all the elements in \(A\) are in \(B\)

\(A \subseteq B\)

\(A \subseteq B \Leftrightarrow (\forall x \in A)[x\in B]\)

\(\{1,2,3,4\} \subseteq \mathbb{Z}\)

Subset: \(A\) is a subset of \(B\) if all the elements in \(A\) are in \(B\)

\(A \subseteq B\)

\(A \subseteq B \Leftrightarrow (\forall x \in A)[x\in B]\)

\(\mathbb{Z} \subseteq \mathbb{R}\)

Subset: \(A\) is a subset of \(B\) if all the elements in \(A\) are in \(B\)

\(A \subseteq B\)

\(A \subseteq B \Leftrightarrow (\forall x \in A)[x\in B]\)

Note: \(A = B \Leftrightarrow ((A \subseteq B) \land (B \subseteq A))\)

Proper Subset: \(A\) is a subset of \(B\) and \(B\) has more elements

\(A \subset B\)

\(A \subset B \Leftrightarrow (\forall x \in A)[x \in B] \land (\exists y \in B)[y \not\in A])\)

\(\mathbb{Z} \subset \mathbb{R}\)

Let's now build new sets

Conventions for this class

  • Explicitly list them out
  • Can modify our established domains
  • Set builder notation (preferred)
  • Interval notation
  • Ellipses notation

Explicit Notation

Works for finite sets of small size

You must list out every item

\(\{1,2,3,4.5,cliff\}\)

Modify established domains

Only: \(\mathbb{N},\mathbb{Z},\mathbb{R},\mathbb{Q},\mathbb{C},\mathbb{P},\)

Can only modify in the following ways

  • Compared to a single value: \(\mathbb{N}^{\ge 3}\)
  • Not a single value:\(\mathbb{Z}^{\ne 0}\)
  • Even and Odds:\(\mathbb{Z}^{even}\)

Set Builder Notation

\(\{\text{variable(s)} \vert \text{conditions on variable(s)}\}\)

\(\{x \in \mathbb{R}\vert (1 \le x \le 2)\}\)

Interval Notation

\([1,2]:(\forall x \in \mathbb{R})[1 \le x \le 2\)]

\([1,3):(\forall x \in \mathbb{R})[1 \le x < 3\)]

Note: \([1,2] \neq \{1,2\}\)

Ellipses Notation

\(\{1 \dots 5\}:(\forall x \in \mathbb{N})[1 \le x \le 5\)]

Only for consecutive Naturals

More formally: \(\{a \in \mathbb{Z} | a \in [x,y] \text{ such that }, x, y \in \mathbb{Z}\}\)

Let's first do some basic set operations

Union(\(A,B\)): a set that has all the items of \(A\) and all the items of \(B\)

\(A \cup B = \{x\vert x \in A \lor x \in B\}\)

\(\{1,2,3,4\} \cup \{4,5,6,7\} = \{1,2,3,4,5,6,7\}\)

Intersection(\(A,B\)): a set that has all the items in both \(A\) and \(B\)

\(A \cap B = \{x\vert x \in A \land x \in B\}\)

\(\{1,2,3,4,5\} \cap \{4,5,6,7,8\} = \{4,5\}\)

Disjoint sets: sets where the intersection is \(\emptyset\)

\(\{1,2,3\}\) and \(\{6,7,8\}\) are disjoint

The Universal set \(U\): a set that consists of everything in the Universe

Note: practically this changes depending on context

No one here is a multibillionaire

Numbers are even or odd

The Universal set \(U\): a set that consists of everything in the universe

Compliment(\(A\)): the elements in the universe that are not in \(A\)

\(A^c = A' = \{x \in U\vert x \not\in A\}\)

\(U = \mathbb{Z}:\{evens\}^c = \{odds\}\)

Subtraction(\(A,B\)): a set that consists of all the items in \(A\) that are not in \(B\)

\(A-B\)

\(A/B\)

\(A-B = \{x\vert (x \in A) \land (x \not\in B)\}\)

\(\{1,2,3,4\}-\{3,4,5,6\} = \{1,2\}\)

\(\{3,4,5,6\}-\{1,2,3,4\} = \{5,6\}\)

Irrational Numbers: \(\mathbb{R} - \mathbb{Q}\)

Complex Quantification

Sometimes we need to talk about multiple items

Any two natural numbers added together are greater than -1

\((\forall x,y \in \mathbb{N})[x + y > -1]\)

There exist 2 natural numbers whose product is 12

\((\exists x,y \in \mathbb{N})[x * y = 12]\)

Different Domains need separate clauses

\((\forall x \in \mathbb{N})(\forall y \in \{1,3.2,4\})[x + y > -1]\)

\((\exists x \in \mathbb{N})(\exists y \in \{1,3.2,4\})[x * y = 12]\)

Same Quantifiers: order does not matter

\((\forall y \in \{1,3.2,4\})(\forall x \in \mathbb{N})[x + y > -1]\)

\((\exists y \in \{1,3.2,4\})(\exists x \in \mathbb{N})[x * y = 12]\)

We can mix quantifiers

\((\forall x \in \mathbb{R})(\exists y \in \mathbb{N})[y \ge x]\)

Order does matter here

\((\exists y \in \mathbb{N})(\forall x \in \mathbb{R})[y \ge x]\)

Above: for any real number, there exists a natural greater than it

Below: there exists a natural number where every real number is less than it

We can negate quantified statements

Let \(P\) be the set of people

Let \(B(x)\) mean that \(x\) likes the colour Blue

\((\forall x \in P)[B(x)]\) is false

\({\sim}(\forall x \in P)[B(x)]\) is true

There exists at least one person who does not like blue

\((\exists x \in P)[{\sim}B(x)]\)

We can negate quantified statements

Let \(P\) be the set of people

Let \(F(x)\) mean that \(x\) can fly

\((\exists x \in P)[F(x)]\) is false

\({\sim}(\exists x \in P)[F(x)]\) is True

All people cannot fly

\((\forall x \in P)[{\sim}F(x)]\) is True