FA17 Lecture 1

From CS2800 wiki

Lecture 1: Introduction

  • Course policies and overview (see the syllabus)
  • Basic definitions (set, function)
  • Last semester
  • Reading: MCS [[../handouts/mcs.pdf#page=105|4.1 4.3]], [[../handouts/mcs.pdf#page=13|1.1 1.4]]

What is 2800 about?

  • "Discrete" is the opposite of "smooth" or "continuous". The real numbers are continuous, the integers are discrete. Most of the objects of study in computer science (e.g. data structures and algorithms) are discrete; 2800 develops mathematical tools that help analyze them.
  • 2800 is the first proof-based mathematics course for many students. You will learn to develop mathematical abstractions, clearly describe them, and prove things about them.
  • 2800 covers many of the mathematical tools that are useful in computer science, including functions, relations, combinatorics, probability, finite automata, modular arithmetic, graphs, and formal logic.

How to succeed in 2800

  • Take time after the lecture to reproduce the lecture, starting from a short list of topics that were covered. Unless stated otherwise, I expect you to be able to do everything that I do in lecture.
  • Try to do the homework on your own before seeking help from colleagues, in office hours, or on Piazza.
  • You must write your homework solutions on your own.
  • When reading proofs, write them too. The purpose of a proof is to make something obvious; so looking at a proof and saying "yep, that's obvious" doesn't mean that you understand or could reproduce the proof.
  • Ask questions.

Sets


Definition: Set
A set is a collection of elements. Any object is either in a set or not; and two sets are the same if exactly the same objects are in both of them.

This means that sets do not have order: 1 is in both [math]\{1,2,3\} [/math] and [math]\{3,2,1\} [/math], as are 2 and 3; nothing else is in either of them. Thus they are the same set.

This also means that sets ignore duplicates: 1 is in both [math]\{1,2,3\} [/math] and [math]\{1,1,1,2,3,1,2,1\} [/math], as are 2 and 3, and nothing else, so they are the same set.

Set notation

  • The symbol "[math]\in [/math]" ("\in" in LaTeX) means "is in" or just "in". For example, [math]1 \in \{1,2,3\} [/math], but [math]4 \notin \{1,2,3\} [/math].
  • Curly braces usually indicate a set. I have already used [math]\{1,2,3\} [/math] to denote the set containing 1, 2, and 3.
  • There is a "set comprehension" syntax that is useful for building other sets. For example, if [math]A = \{1,2,3\} [/math], we can write [math]\{x \in A \mid x \gt 2\} [/math]. This should be read as "the set of all elements [math]x [/math] in the set [math]A [/math] such that [math]x \gt 2 [/math]." This is another way of writing [math]\{3\} [/math]. You can use any description (as long as it is clear an unambiguous) in the predicate (the part after the vertical bar). For example [math]\{x \in A \mid x \gt 2 \text{ or } x = 1\} [/math].
  • Informally, one can describe a set, for example: [math]\{all~colors\} [/math] is an informal way to write [math]\{red, green, blue, tope, mauve, \dots\} [/math]. Be careful with this notation, for two reasons:
    1. It can be hard to unambiguously determine whether something is in the set or not. Is "tangerine" in [math]\{all~colors\} [/math]?
    2. it is unclear whether [math]\{all~colors\} [/math] is the set containing all colors, or the set containing the set of all colors.
  • A much better approach is to describe the set in English: Let [math]C [/math] be the set of all colors. In general, the test of whether you've given a good definition is not the notation you use, but whether the definition is clear and unambiguous. Sometimes notation helps with this, but other times it makes your writing less clear.
  • The symbol [math]\emptyset [/math] (LaTeX \emptyset) stands for the empty set (which contains no elements).

Functions

Function definition


We'll discuss functions in more detail next lecture.

Note: Our definition of function corresponds to MCS's definition of total function.

Note: some books use "range" to mean "codomain", while others use "range" to mean "image". I try to avoid the term "range" to avoid ambiguity.

Sudoku

Sudoku is a popular puzzle that involves filling in a grid of numbers while satisfying certain rules. In the next lecture we'll use the notions of sets and functions to model solved sudoku puzzles. In the mean time, try a sudoku puzzle if you haven't before, and think about how you would model a solved board.