1 / 11

Intro to Maths for CS: 2012/13 Sets (week 1 part)

Intro to Maths for CS: 2012/13 Sets (week 1 part). John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK. Mathematical “sets”: Basics.

Download Presentation

Intro to Maths for CS: 2012/13 Sets (week 1 part)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Intro to Maths for CS:2012/13Sets (week 1 part) John Barnden Professor of Artificial Intelligence School of Computer Science University of Birmingham, UK

  2. Mathematical “sets”: Basics • A “set” is an unordered collection of items of any sorts (people, numbers, numerals, shoes, atoms, strings of characters, databases, sets, blades of grass, …) without any duplication of items. • The items are called “elements” or “members”. • S = {34, JAB, 59, UoB}, where “JAB” is a name for me and “UoB” is a name for this university, • means that • S is the set consisting of (exactly) the following four items: • the abstract number 34, me, the abstract number 59, this university.

  3. Basics, contd • {34, JAB, 59, UoB} = {UoB, 59, 34, JAB, JAB, 34} • Order of writing the members doesn’t matter; duplication in the writing doesn’t duplicate the member. • A set can be infinite (e.g., the set of all whole numbers). • A set can contain just one member (e.g. the set whose only element is your favourite pencil). Singleton set. • It’s different from the member itself.. • There’s a set with no members at all: the “empty set”, usually notated as , but can also be written { }. • Somewhat analogous to zero, or a new committee which has no members yet. • There is only one empty set (rather than an empty set of numbers, an empty set of pencils, etc.)

  4. Another Notation • {n | n is an integer, n > 301} = • “The set of n such that n is an integer and n > 301.” • (Actually, this notation is a slight simplification.) • The set is the same as that denoted by, for instance, • {n | n is an integer, n  302}.

  5. Some More Examples • {JAB, “JAB”} has 2 members: me, and a 3-char string. • {3, {4,5}, 4, 6}has 4 members, one of which is a set. • {3, {5,4}, 4, 6} is that same set. • { {4,5} } has 1 member, which is a set. • {4,5} has 2 members, both numbers. • {} has 1 member, which is the empty set. • {{}} is a different singleton set.

  6. Membership Relationship • a  A means that ais a member of A. • 5 {4,5} • {5,4}  {3, {4,5}, 4, 6} • a  A means that a is not a member of A. • 5 {3, {4,5}, 4, 6} • {5}{3, {4,5}, 4, 6} • {4,6} {3, {4,5}, 4, 6} • {3,4,5} {3, {4,5}, 4, 6}

  7. Subsets and Supersets • A  Bmeans that A is a “subset” of B (and that B is a “superset” of A). I.e., every member of A is also a member of B. • Carefully distinguish between subset-of and member-of!!! • The symbol means the same as  • does NOTmean that there cannot be equality. • Examples: •  {4,5} • {5}  {4,5,6}, {6,4}  {4,5,6,7}, {6,4,7,5}  {4,5,6,7} • {n | n is an EVEN whole number}  {n | n is a whole number}

  8. Subsets and Supersets •  Afor any set A. • A  Afor any set A. (Reflexivity) • If A BandBA then A = B. (Antisymmetry) • If A BandBC then AC. (Transitivity)

  9. Some Operations on Sets • Union of sets A and B: • AB = the set of things that are in A or B (or both). • NB: no repetitions created. • Intersection of sets A and B: • A  B = the set of things that are in both A and B. • Difference of sets A and B: • A  B = the set of things that are in A but not B. • Note: also notated by a backslash instead of a minus sign.

  10. Some Properties of those Operations • Union and intersection are commutative • (“can switch”): • AB = BA • A  B = B  A • Union and intersection are associative • (“can group differently”): • A (B  C) = (AB)  C • A  (B  C) = (A  B)  C • Because of associativity, we can omit parentheses: • AB  C  D A  B  C  D

  11. Two Other Properties • Union distributes over intersection: • A(B  C) = (AB)  (A  C) • Intersection distributes over union: • A(B  C) = (AB) (A  C)

More Related