COMP Logic for Computer Scientists. Lecture 17

Similar documents
Chapter 3. Set Theory. 3.1 What is a Set?

What is Set? Set Theory. Notation. Venn Diagram

CSC Discrete Math I, Spring Sets

Discrete Mathematics Lecture 4. Harper Langston New York University

2.1 Sets 2.2 Set Operations

2.2 Set Operations. Introduction DEFINITION 1. EXAMPLE 1 The union of the sets {1, 3, 5} and {1, 2, 3} is the set {1, 2, 3, 5}; that is, EXAMPLE 2

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

Sets 1. The things in a set are called the elements of it. If x is an element of the set S, we say

This Lecture. We will first introduce some basic set theory before we do counting. Basic Definitions. Operations on Sets.

Outline. CISC 1100/1400 Structures of Comp. Sci./Discrete Structures Chapter 1 Sets. Sets. Enumerating the elements of a set

CSE 20 DISCRETE MATH. Fall

Set and Set Operations

Lecture 4: examples of topological spaces, coarser and finer topologies, bases and closed sets

A set with only one member is called a SINGLETON. A set with no members is called the EMPTY SET or 2 N

SETS. Sets are of two sorts: finite infinite A system of sets is a set, whose elements are again sets.

CSE 20 DISCRETE MATH. Winter

2 Review of Set Theory

[Ch 6] Set Theory. 1. Basic Concepts and Definitions. 400 lecture note #4. 1) Basics

Review of Sets. Review. Philippe B. Laval. Current Semester. Kennesaw State University. Philippe B. Laval (KSU) Sets Current Semester 1 / 16

Problem One: A Quick Algebra Review

1 Sets, Fields, and Events

Introduction II. Sets. Terminology III. Definition. Definition. Definition. Example

11 Sets II Operations

Fuzzy Reasoning. Outline

Sets MAT231. Fall Transition to Higher Mathematics. MAT231 (Transition to Higher Math) Sets Fall / 31

Section Sets and Set Operations

1.1 - Introduction to Sets

Slides for Faculty Oxford University Press All rights reserved.

UNIT 14C The Limits of Computing: Non computable Functions. Problem Classifications

LECTURE NOTES ON SETS

Solution: It may be helpful to list out exactly what is in each of these events:

The Intersection of Two Sets


Sets. {1, 2, 3, Calvin}.

Figure 1: From Left to Right, General Venn Diagrams for One, Two, and Three Sets

CMPSCI 250: Introduction to Computation. Lecture #7: Quantifiers and Languages 6 February 2012

Sets and set operations

Counting. Rosen, Chapter 6 Walls and Mirrors, Chapter 3

Boolean relationships on Venn Diagrams

9/19/12. Why Study Discrete Math? What is discrete? Sets (Rosen, Chapter 2) can be described by discrete math TOPICS

MAT 090 Brian Killough s Instructor Notes Strayer University

Notes on Topology. Andrew Forrester January 28, Notation 1. 2 The Big Picture 1

Summary of Course Coverage

Thompson groups, Cantor space, and foldings of de Bruijn graphs. Peter J. Cameron University of St Andrews

1.2 Venn Diagrams and Partitions

CS100: DISCRETE STRUCTURES

Provide a drawing. Mark any line with three points in blue color.

2.1 Symbols and Terminology

Taibah University College of Computer Science & Engineering Course Title: Discrete Mathematics Code: CS 103. Chapter 2. Sets

SEVENTH EDITION and EXPANDED SEVENTH EDITION

Sets. X. Zhang Dept. of Computer & Information Sciences Fordham University

Chapter 2: Sets. Diana Pell. In the roster method: elements are listed between braces, with commas between the elements

1KOd17RMoURxjn2 CSE 20 DISCRETE MATH Fall

Sets. Sets. Subset, universe. Specifying sets, membership. Examples: Specifying a set using a predicate. Examples

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Discrete Mathematics

Counting: Basics. Rosen, Chapter 6.1

Today s Topics. What is a set?

Fundamental Mathematical Concepts Math 107A. Professor T. D. Hamilton

CSE 215: Foundations of Computer Science Recitation Exercises Set #9 Stony Brook University. Name: ID#: Section #: Score: / 4

Logic Synthesis & Optimization Lectures 4, 5 Boolean Algebra - Basics

Algebra of Sets. Aditya Ghosh. April 6, 2018 It is recommended that while reading it, sit with a pen and a paper.

MATH 22 MORE ABOUT FUNCTIONS. Lecture M: 10/14/2003. Form follows function. Louis Henri Sullivan

c) the set of students at your school who either are sophomores or are taking discrete mathematics

Lecture 6,

Lecture 5: More Examples/Applications of Quasirandom Graphs

CHAPTER 1 BOOLEAN ALGEBRA CONTENTS

Algebra of Sets (Mathematics & Logic A)

Relational terminology. Databases - Sets & Relations. Sets. Membership

Eric Roberts Handout #39 CS 106B February 20, 2015 Sets

Complexity Theory. Compiled By : Hari Prasad Pokhrel Page 1 of 20. ioenotes.edu.np

The set consisting of all natural numbers that are in A and are in B is the set f1; 3; 5g;

Relational Database: The Relational Data Model; Operations on Database Relations

The Inclusion-Exclusion Principle

9.5 Equivalence Relations

r=1 The Binomial Theorem. 4 MA095/98G Revision

A point is pictured by a dot. While a dot must have some size, the point it represents has no size. Points are named by capital letters..

Math 110 FOUNDATIONS OF THE REAL NUMBER SYSTEM FOR ELEMENTARY AND MIDDLE SCHOOL TEACHERS

Math 202 Test Problem Solving, Sets, and Whole Numbers 19 September, 2008

11,23,35,47 B) 1 is a multiple of 12

Automated Reasoning Systems

HOMEWORK #4 SOLUTIONS - MATH 4160

AXIOMS FOR THE INTEGERS

SET DEFINITION 1 elements members

Lecture 20 : Trees DRAFT

CS228 - Basic Counting and the Pigeonhole Principle

Mathematics for Computer Scientists 2 (G52MC2)

Math Introduction to Advanced Mathematics

COMP 122/L Lecture 2. Kyle Dewey

An Interesting Way to Combine Numbers

Topology notes. Basic Definitions and Properties.

Introduction to Homotopy Type Theory

The Further Mathematics Support Programme

TOPICS. Integers Properties of addition and. Rational Numbers Need for rational numbers. Exponents or Powers Introduction to Exponents or

CHAPTER 8. Copyright Cengage Learning. All rights reserved.

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

CNS 188a Overview. Implementing Boolean functions with relay circuits, circuits of AON (AND, OR, NOT) gates and LT (Linear Threshold) gates

Discrete Mathematics

CSE 417 Network Flows (pt 4) Min Cost Flows

HW Graph Theory SOLUTIONS (hbovik) - Q

Separation Logic: syntax, semantics and calculus

Transcription:

COMP 1002 Logic for Computer Scientists Lecture 17 5 2 J

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 = x x x } The green part of the picture above = {2,3} nion = x x x } The coloured part in the top picture. = 1,2,3,4 Difference = x x x } The yellow part in the top picture. = 1 - Symmetric difference Δ = ( ) The yellow and blue parts of the top picture. Δ = 1,4 Δ Complement = x x } The blue part on the bottom Venn diagram If universe = N, = x N x 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) C = + + C C C + C 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 n 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 = x, y x, y } ={1,2,3}, ={a,b} = { 1, a, 1, b, 2, a, 2, b, 3, a, 3, b } ={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 k = x 1, x 2, x k ) x 1 1 x k k = 1,2,3, ={a,b}, C={3,4} C = { 1, a, 3, 1, a, 4, 1, b, 3, 1, b, 4, 2, a, 3, 2, a, 4, 2, b, 3, 2, b, 4, 3, a, 3, 3, a, 4, 3, b, 3, 3, b, 4 }

Proofs with sets Two ways to describe the purple area, x when x This happens when x x. So x. Since we picked an arbitrary x, then Not quite done yet Now let x Then x x. So x x. x x x x. So x. Thus x. 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?... p q p q DeMorgan s law works in set theory! What about other equivalences from logic?

More useful equivalences For any formulas,, C: TTTT FFFFF TTTT TTTT. TTTT FFFFF. FFFFF FFFFF lso, like in arithmetic (with as +, as *) aaa C C Same holds for. lso, C C C nd unlike arithmetic C C ( C)

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

More useful equivalences For any formulas,, C: TTTT FFFFF TTTT TTTT. TTTT FFFFF. FFFFF FFFFF lso, like in arithmetic (with as +, as *) aaa C C Same holds for. lso, C C C nd unlike arithmetic C C ( C)

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

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 p Complement a p q Intersection a b OR p q nion a + b FLSE Empty set 0 TRE niverse 1

xioms of oolean algebra 1. a + b = b + a, a b = b a 2. (a+b)+c=a+(b+c) a b c = a b c 3. a + b c = a + b a + c a b + c = a b + (a c ) 4. There exist distinct elements 0 and 1 (among underlying set of elements of the algebra) such that for all a, a + 0 = a a 1 = a 5. For each a there exists an element a such that a + a = 1 a a = 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?