Vous êtes sur la page 1sur 4

3/22/17

Set Identities
Basic laws on how set operations work
Just like logical equivalence laws!
Set Properties Replace U with
Replace with
Replace complement with ~
CS 231 Replace with c
Dianna Xu Replace U with t
One additional on set differences

3/22/17 3/22/17

Communicative AUB=BUA AB=BA

Set identities: De Morgan again Associative (A U B) U C =


A U (B U C)
(A B) C =
A (B C)

Distributive A U (B C) = A (B U C) =
These should look (A U B) (A U C) (A B) U (A C)
very familiar Identity AU=A AU=A
Complement A U Ac = U A Ac =
Double Complement (A c)c = A
A! B = A" B Idempotent AUA=A AA=A
Universal Bound AUU=U A=
A" B = A! B De Morgans (A U B)c = A c B c (A B)c = A c U B c
Absorption A U (A B) = A A (A U B) = A
Complement of U Uc = c = U
and
3/22/17 3/22/17
Set Difference A B = A Bc

Subset Relations Proofs


A B A, A B B To prove that A is a subset of B (A B):
A A U B, B A U B Assume that xA is a particular but arbitrarily
chosen element of A
A B B C A C
Show that x B
To prove that two sets A and B are equal
(A = B):
prove A B, and
prove B A

3/22/17 3/22/17

1
3/22/17

How to Prove a Set Identity What we are going to prove


For example: AB = B(BA) AB = B(BA)
Methods:
The element method: Prove each set is a A B
subset of each other, by showing any element
that belongs to one also belongs to the other
B-(B-A)
AB B-A
Algebraic Proof: Use the set identity laws

3/22/17 3/22/17

Proof by Set Identity Laws Proof by Element Method


Prove that AB=B(BA)
Assume that an element is a member of
B (B A) = B (B A) Definition of difference one of the identities implies that it is a
Definition of difference member of the other
= B ! (B ! A )
De Morgans law Repeat for the other direction
= B " (B ! A )
Double Complement We are trying to show:
= B " (B ! A) (x AB x B(BA))(x B(BA) x
= (B ! B ) " (B ! A) Distributive law AB)
= " (B ! A) Complement law This is the bi-conditional: x AB x B
(BA)
= (B ! A) Identity law
Not good for long proofs
3/22/17 = A! B Commutative law n 3/22/17

Proof by Element Method Proof by Element Method


Assume that x B(BA) Assume that x AB
By definition of set difference, x B x BA By definition of intersection, x A x B
Consider x BA Thus, we know that x BA
x BA = x B x A
BA includes all the elements in B but not in A
x BA = ~(x B x A) = x B x A
Consider B(BA)
So we have x B (x B x A)
We know x B x BA
xBxB=c
By definition of difference, x B(BA)
x B x A = x AB
x AB x B(BA)
Thus, x B(BA) x AB
AB B(BA) n
B(BA) AB
3/22/17 3/22/17

2
3/22/17

Russells Paradox How Do We Fix It?


Consider the set: Consider the set:
S = { A | A is a set A A } S={A|AU AA}
Is S an element of itself? Similarly:
SSSUSS
Consider:
SS But:
Then S can not be in itself, by definition S S ~(S U S S) = S U S S
SS
Then S is in itself by definition
In other words, S is not a proper set
Contradiction!
3/22/17 3/22/17

The Halting Problem Some Notes


Given a program P, and input I, will the To solve the halting problem means we
program P ever terminate? create a function CheckHalt(P,I)
Meaning will P(I) loop forever or halt? P is the program we are checking for halting
I is the input to that program
Can a computer program determine this? And it will return loops forever or halts
Can a human?
Note it must work for any program, not just
some programs, and any input
First shown by Alan Turing in 1936

3/22/17 3/22/17

Perfect Numbers Where Does That Leave Us?


Numbers whose divisors (not including the number) add
up to the number
6=1+2+3 If a human cant figure out how to do the
28 = 1 + 2 + 4 + 7 + 14
halting problem, we cant make a
The list of the first 10 perfect numbers:
6, 28, 496, 8128, 33550336, 8589869056, computer do it for us
137438691328, 2305843008139952128,
2658455991569831744654692615953842176,
191561942608236107294793378084303638130997321 It turns out that it is impossible to write
548169216
The last one was 54 digits! such a CheckHalt() function
All known perfect numbers are even; its an open (i.e. But how to prove this?
unsolved) problem if odd perfect numbers exist
3/22/17 3/22/17

3
3/22/17

CheckHalt()s Non-existence CheckHalt()s non-existence


Consider P(I): a program P with input I Consider a new function:
Test(P):
Suppose that CheckHalt(P,I) exists loops forever if CheckHalt(P,P) prints halts
prints either loop forever or halt halts if CheckHalt(P,P) prints loops forever

A program is a series of bits Now run Test(Test)


And thus can be considered data as well If Test(Test) halts
Then CheckHalt(Test,Test) returns loops forever
Thus, we can call CheckHalt(P,P) Which means that Test(Test) loops forever
Contradiction!
Its using the bits of program P as the input to If Test(Test) loops forever
program P Then CheckHalt(Test,Test) returns halts
Which means that Test(Test) halts
3/22/17 3/22/17
Contradiction!

The Halting Problem

It was the first algorithm that was shown to


not be able to exist
You can prove an existential by showing an
example (a correct program)
But its much harder to prove that a program
can never exist

3/22/17

Vous aimerez peut-être aussi