COMP Logic for Computer Scientists. Lecture 16

Similar documents
COMP Logic for Computer Scientists. Lecture 16

COMP Intro to Logic for Computer Scientists. Lecture 15

3.4 Set Operations Given a set A, the complement (in the Universal set U) A c is the set of all elements of U that are not in A. So A c = {x x / A}.

COMP Intro to Logic for Computer Scientists. Lecture 16

Set Theory. CSE 215, Foundations of Computer Science Stony Brook University

With Question/Answer Animations. Chapter 2

COMP Intro to Logic for Computer Scientists. Lecture 15

2. Sets. 2.1&2.2: Sets and Subsets. Combining Sets. c Dr Oksana Shatalov, Spring

Stat 451: Solutions to Assignment #1

CS2742 midterm test 2 study sheet. Boolean circuits: Predicate logic:

CHAPTER 6. Copyright Cengage Learning. All rights reserved.

ICS141: Discrete Mathematics for Computer Science I

Statistical Inference

Today s topics. Introduction to Set Theory ( 1.6) Naïve set theory. Basic notations for sets

4. Sets The language of sets. Describing a Set. c Oksana Shatalov, Fall

Sets. Introduction to Set Theory ( 2.1) Basic notations for sets. Basic properties of sets CMSC 302. Vojislav Kecman

CS 173: Discrete Structures. Eric Shaffer Office Hour: Wed. 1-2, 2215 SC

4. Sets The language of sets. Describing a Set. c Oksana Shatalov, Fall Set-builder notation (a more precise way of describing a set)

Chapter Summary. Sets The Language of Sets Set Operations Set Identities Functions Types of Functions Operations on Functions Computability

MATH2206 Prob Stat/20.Jan Weekly Review 1-2

Discrete Mathematics. (c) Marcin Sydow. Sets. Set operations. Sets. Set identities Number sets. Pair. Power Set. Venn diagrams

Fundamentals of Probability CE 311S

If f = ABC + ABC + A B C then f = AB C + A BC + AB C + A BC + A B C

Binomial Coefficient Identities/Complements

Discrete Basic Structure: Sets

Review CHAPTER. 2.1 Definitions in Chapter Sample Exam Questions. 2.1 Set; Element; Member; Universal Set Partition. 2.

1. (B) The union of sets A and B is the set whose elements belong to at least one of A

Propositional Logic, Predicates, and Equivalence

Proving simple set properties...

Automata Theory and Formal Grammars: Lecture 1

Statistics 1L03 - Midterm #2 Review

First Midterm Examination

CM10196 Topic 2: Sets, Predicates, Boolean algebras

CSE 20. Lecture 4: Introduction to Boolean algebra. CSE 20: Lecture4

Set Operations. Combining sets into new sets

Operations on Sets. Gazihan Alankuş (Based on original slides by Brahim Hnich et al.) August 6, 2012

1. SET 10/9/2013. Discrete Mathematics Fajrian Nur Adnan, M.CS

Sets. Alice E. Fischer. CSCI 1166 Discrete Mathematics for Computing Spring, Outline Sets An Algebra on Sets Summary

2.1 Sets. Definition 1 A set is an unordered collection of objects. Important sets: N, Z, Z +, Q, R.

Sets are one of the basic building blocks for the types of objects considered in discrete mathematics.

Chapter 1 Math Set: a collection of objects. For example, the set of whole numbers is W = {0, 1, 2, 3, }

We are going to discuss what it means for a sequence to converge in three stages: First, we define what it means for a sequence to converge to zero

Chapter 7. Inclusion-Exclusion a.k.a. The Sieve Formula

2030 LECTURES. R. Craigen. Inclusion/Exclusion and Relations

Introduction to Proofs

Tutorial on Axiomatic Set Theory. Javier R. Movellan

Math 105A HW 1 Solutions

THE KENNESAW STATE UNIVERSITY HIGH SCHOOL MATHEMATICS COMPETITION PART II Calculators are NOT permitted Time allowed: 2 hours

Lecture 4: Constructing the Integers, Rationals and Reals

= A. Example 2. Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, A = {4, 6, 7, 9, 10}, and B = {2, 6, 8, 9}. Draw the sets on a Venn diagram.

In N we can do addition, but in order to do subtraction we need to extend N to the integers

Introduction to Quantum Logic. Chris Heunen

Notes 1 Autumn Sample space, events. S is the number of elements in the set S.)

In N we can do addition, but in order to do subtraction we need to extend N to the integers

Notes for Science and Engineering Foundation Discrete Mathematics

CIVL Probability vs. Statistics. Why are we studying probability and statistics? Basic Laws and Axioms of Probability

CHAPTER 1. Preliminaries. 1 Set Theory

CISC 1100: Structures of Computer Science

MTH202 Discrete Mathematics

BOOLEAN ALGEBRA INTRODUCTION SUBSETS

1.1 Introduction to Sets

Probability (Devore Chapter Two)

Lesson 14: Solving Inequalities

SAMPLE ANSWERS MARKER COPY

Chapter 1 : The language of mathematics.

Chapter 4. Basic Set Theory. 4.1 The Language of Set Theory

Problem # Number of points 1 /20 2 /20 3 /20 4 /20 5 /20 6 /20 7 /20 8 /20 Total /150

Do not open this exam until you are told to begin. You will have 75 minutes for the exam.

COMP9020 Lecture 3 Session 2, 2014 Sets, Functions, and Sequences. Revision: 1.3

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Sec$on Summary. Definition of sets Describing Sets

INFINITY: CARDINAL NUMBERS

God doesn t play dice. - Albert Einstein

Lesson 18: Recognizing Equations of Circles

Section 2: Classes of Sets

Counting. Spock's dilemma (Walls and mirrors) call it C(n,k) Rosen, Chapter 5.1, 5.2, 5.3 Walls and Mirrors, Chapter 3 10/11/12

Seminaar Abstrakte Wiskunde Seminar in Abstract Mathematics Lecture notes in progress (27 March 2010)

A B is shaded A B A B

Any Wizard of Oz fans? Discrete Math Basics. Outline. Sets. Set Operations. Sets. Dorothy: How does one get to the Emerald City?

Sets. We discuss an informal (naive) set theory as needed in Computer Science. It was introduced by G. Cantor in the second half of the nineteenth

Discrete Mathematics Set Operations

The Inclusion-Exclusion Principle

Lesson 24: Using the Quadratic Formula,

5 Set Operations, Functions, and Counting

Discrete Mathematical Structures: Theory and Applications

Set theory background for probability

Statistics for Financial Engineering Session 2: Basic Set Theory March 19 th, 2006

F.1 Greatest Common Factor and Factoring by Grouping

Week Some Warm-up Questions

Axioms of Kleene Algebra

Problem 1: Suppose A, B, C and D are finite sets such that A B = C D and C = D. Prove or disprove: A = B.

Unit 1 Day 1. Set Operations & Venn Diagrams

Lesson 23: Deriving the Quadratic Formula

Axioms of Probability. Set Theory. M. Bremer. Math Spring 2018

The integers. Chapter 3

Section 2.2 Set Operations. Propositional calculus and set theory are both instances of an algebraic system called a. Boolean Algebra.

Notes for Comp 497 (Comp 454) Week 10 4/5/05

Test One Mathematics Fall 2009

Background for Discrete Mathematics

Part IA Numbers and Sets

Transcription:

COMP 1002 Logic for Computer Scientists Lecture 16 5 2 J

dmin stuff 2 due Feb 17 th. Midterm March 2 nd. Semester break next week!

Puzzle: the barber In a certain village, there is a (male) barber who shaves all and only those men of the village who do not shave themselves. Question: who shaves the barber?

Operations on sets Let and be two sets. Such as ={1,2,3} and ={ 2,3,4} Intersection = xx xx xx } The green part of the picture above = {2,3} nion = xx xx xx } The coloured part in the top picture. = 1,2,3,4 Difference = xx xx xx } The yellow part in the top picture. = 1 - Symmetric difference Δ = ( ) The yellow and blue parts of the top picture. Δ = 1,4 Δ Complement = xx xx } The blue part on the bottom Venn diagram If universe = N, = xx N xx 1,2,3 }

Subsets and operations If then Intersection = nion = Difference = Difference =

Size (cardinality) If a set has n elements, for a natural number n, then is a finite set and its cardinality is =n. 1,2,3 = 3 = 0 Sets that are not finite are infinite. More on cardinality of infinite sets in a couple of lectures N, Z, Q R, C 0,1 : set of all finite-length binary strings.

Rule of inclusion-exclusion Let and be two sets. Then = + Proof idea: notice that elements in are counted twice in +, so need to subtract one copy. If and are disjoint, then = + If there are 112 students in COMP 1001, 70 in COMP 1002, and 12 of them are in both, then the total number of students in 1001 or 1002 is 112+70-12=170. For three sets (and generalizes) CC = + + CC CC CC + CC C

Power sets power set of a set, P, is a set of all subsets of. Think of sets as boxes of elements. subset of a set is a box with elements of (maybe all, maybe none, maybe some). Then P is a box containing boxes with elements of. When you open the box P, you don t see chocolates (elements of ), you see boxes. Subsets of : ={1,2}, P =, 1, 2, 1,2 =, P =. They are not the same! There is nothing in, and there is one element, an empty box, in P If has n elements, then P has 2 nn elements. Power set P

Cartesian products Cartesian product of and is a set of all pairs of elements with the first from, and the second from : x = xx, yy xx, yy } ={1,2,3}, ={a,b} = { 1, aa, 1, bb, 2, aa, 2, bb, 3, aa, 3, bb } ={1,2}, = { 1,1., 1,2, 2,1, 2,2 } Order of pairs does not matter, order within pairs does:. Number of elements in is = a b 1 (1,a) (1,b) 2 (2,a) (2,b) 3 (3,a) (3,b) x Can define the Cartesian product for any number of sets: 1 2 kk = xx 1, xx 2, xx kk ) xx 1 1 xx kk kk = 1,2,3, ={a,b}, C={3,4} CC = { 1, aa, 3, 1, aa, 4, 1, bb, 3, 1, bb, 4, 2, aa, 3, 2, aa, 4, 2, bb, 3, 2, bb, 4, 3, aa, 3, 3, aa, 4, 3, bb, 3, 3, bb, 4 }

Proofs with sets Two ways to describe the purple area, xx when xx This happens when xx xx. So xx. Since we picked an arbitrary x, then Not quite done yet Now let xx Then xx xx. So xx xx. xx xx xx xx. So xx. Thus xx. Since x was an arbitrary element of, then. Therefore =

Laws of set theory Two ways to describe the purple area = y similar reasoning, = Does this remind you of something?... pp q pp qq DeMorgan s law works in set theory! What about other equivalences from logic?

More useful equivalences For any formulas,, C: TTTTTTTT FFFFFFFFFF TTTTTTTT TTTTTTTT. TTTTTTTT FFFFFFFFFF. FFFFFFFFFF FFFFFFFFFF lso, like in arithmetic (with as +, as *) aaaaaa CC CC Same holds for. lso, CC CC CC nd unlike arithmetic CC CC ( CC)

Propositions vs. sets Propositional logic Set theory Negation pp Complement pp qq Intersection OR pp qq nion FLSE TRE Empty set niverse

More useful equivalences For any formulas,, C: TTTTTTTT FFFFFFFFFF TTTTTTTT TTTTTTTT. TTTTTTTT FFFFFFFFFF. FFFFFFFFFF FFFFFFFFFF lso, like in arithmetic (with as +, as *) aaaaaa CC CC Same holds for. lso, CC CC CC nd unlike arithmetic CC CC ( CC)

Laws of set theory For any sets,, C: = = =. = =. = = = lso, like in arithmetic (with as +, as *) = aaaaaa CC = CC Same holds for. lso, CC = CC CC nd unlike arithmetic - CC CC ( CC)

oolean algebra The algebra of both propositional logic and set theory is called oolean algebra (as opposed to algebra on numbers). Propositional logic Set theory oolean algebra Negation pp Complement aa pp qq Intersection aa bb OR pp qq nion aa + bb FLSE Empty set 0 TRE niverse 1

xioms of oolean algebra 1. aa + bb = bb + aa, aa bb = bb aa 2. (a+b)+c=a+(b+c) a bb cc = aa bb cc 3. aa + bb cc = aa + bb aa + cc aa bb + cc = aa bb + (aa cc ) 4. There exist distinct elements 0 and 1 (among underlying set of elements of the algebra) such that for all aa, aa + 0 = aa aa 1 = aa 5. For each aa there exists an element aa such that aa + aa = 1 aa aa = 0 How about DeMorgan, etc? They can be derived from the axioms!

Puzzle: the barber club In a certain barber s club, Every member has shaved at least one other member No member shaved himself No member has been shaved by more than one member There is a member who has never been shaved. Question: how many barbers are in this club?