UT CS 341 - Review of Mathematical Concepts

Unformatted text preview:

Supplementary Materials Review of Mathematical Concepts 1 Review of Mathematical Concepts 1 Sets 1.1 What is a Set? A set is simply a collection of objects. The objects (which we call the elements or members of the set) can be anything: numbers, people, fruits, whatever. For example, all of the following are sets: A = {13, 11, 8, 23} B = {8, 23, 11, 13} C = {8, 8, 23, 23, 11, 11, 13, 13} D = {apple, pear, banana, grape} E = {January, February, March, April, May, June, July, August, September, October, November, December} F = {x : x ∈ E and x has 31 days} G = {January, March, May, July, August, October, December} N = the nonnegative integers (We will generally call this set N, the natural numbers.) H = {i : ∃x ∈ N and i = 2x} I = {0, 2, 4, 6, 8, …} J = the even natural numbers K = the syntactically valid C programs L = {x : x ∈ K and x never gets into an infinite loop} Z = the integers ( … -3, -2, -1, 0, 1, 2, 3, …) In the definitions of F and H, we have used the colon notation. Read it as "such that". We've also used the standard symbol ∈ for "element of". We will also use ∉ for "not an element of". So, for example, 17 ∉ A is true. Remember that a set is simply a collection of elements. So if two sets contain precisely the same elements (regardless of the way we actually defined the sets), then they are identical. Thus F and G are the same set, as are H, I, and J. An important aside: Zero is an even number. This falls out of any reasonable definition we can give for even numbers. For example, the one we used to define set H above. Or consider: 2 is even and any number that can be derived by adding or subtracting 2 from an even number is also even. In order to construct a definition for even numbers that does not include zero, we'd have to make a special case. That would make for an inelegant definition, which we hate. And, as we'll see down the road, we'd also have to make corresponding special cases for zero in a wide variety of algorithms. Since a set is defined only by what elements it contains, it does not matter what order we list the elements in. Thus A and B are the same set. Our definition of a set considers only whether or not an element is contained within the set. It does not consider how many times the element is mentioned. In other words, duplicates don't count. So A, B, and C are all equal. Whenever we define a set, it would be useful if we could also specify a decision procedure for it. A decision procedure for a set S is an algorithm that, when presented with an object O, returns True if O ∈ S and False otherwise. Consider set K above (the set of all syntactically valid C programs). We can easily decide whether or not an object is an element of K. First, of course, it has to be a string. If you bring me an apple, I immediately say no. If it is a string, then I can feed it to a C compiler and let it tell me whether or not the object is in K. But now consider the set L (C programs that are guaranteed to halt on all inputs). Again, I can reject apples and anything else that isn't even in K. I can also reject some programs that clearly do loop forever. And I can accept some C programs, for example ones that don't contain any loops at all. But what about the general problem. Can I find a way to look at an arbitrary C program and tell whether or not it belongs in L. It turns out, as we'll see later, that the answer to this is no. We can prove that no program to solve this problem can exist. But that doesn’t mean that the set L doesn't exist. It's a perfectly fine set. There just isn't a decision procedure for it.Supplementary Materials Review of Mathematical Concepts 2 The smallest set is the set that contains no elements. It is called the empty set, and is written ∅ or {}. When you are working with sets, it is very important to keep in mind the difference between a set and the elements of a set. Given a set that contains more than one element, this not usually tricky. It's clear that {1, 2} is distinct from either the number 1 or the number 2. It sometimes becomes a bit trickier though with singleton sets (sets that contain only a single element). But it is equally true here. So, for example, {1} is distinct from the number 1. As another example, consider {∅}. This is a set that contains one element. That element is in turn a set that contains no elements (i.e., the empty set). 1.2 Relating Sets to Each Other We say that A is a subset of B (which we write as A ⊆ B) if every element of A is also an element of B. The symbol we use for subset (⊆) looks somewhat like ≤. This is no accident. If A ⊆ B, then there is a sense in which the set A is "less than or equal to" the set B, since all the elements of A must be in B, but there may be elements of B that are not in A. Given this definition, notice that every set is a subset of itself. This fact turns out to offer us a useful way to prove that two sets A and B are equal: First prove that A is a subset of B. Then prove that B is a subset of A. We'll have more to say about this later in Section 6.2. We say that A is proper subset of B (written A ⊂ B) if A ⊆ B and A ≠ B. The following Venn diagram illustrates the proper subset relationship between A and B: B A Notice that the empty set is a subset of every set (since, trivially, every element of ∅, all none of them, is also an element of every other set). And the empty set is a proper subset of every set other than itself. It is useful to define some basic operations that can be performed on sets: The union of two sets A and B (written A ∪ B) contains all elements that are contained in A or B (or both). We can easily visualize union using a Venn diagram. The union of sets A and B is the entire hatched area: A B The intersection of two sets A and B (written A ∩ B) contains all elements that are contained in both A and B. In the Venn diagram shown above, the intersection of A and B is the double hatched area in the middle. The difference of two …


View Full Document

UT CS 341 - Review of Mathematical Concepts

Documents in this Course
Load more
Download Review of Mathematical Concepts
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Review of Mathematical Concepts and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Review of Mathematical Concepts 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?