Today s topics. Binary Relations. Inverse Relations. Complementary Relations. Let R:A,B be any binary relation.

Similar documents
Discrete Mathematics. 2. Relations

Relations --- Binary Relations. Debdeep Mukhopadhyay IIT Madras

CS2013: Relations and Functions

Relations. Relations of Sets N-ary Relations Relational Databases Binary Relation Properties Equivalence Relations. Reading (Epp s textbook)

Section Summary. Relations and Functions Properties of Relations. Combining Relations

Relations Graphical View

Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

Today. Binary relations establish a relationship between elements of two sets

Relationships between elements of sets occur in many contexts. Every day we deal with

Notes. Relations. Introduction. Notes. Relations. Notes. Definition. Example. Slides by Christopher M. Bourke Instructor: Berthe Y.

Relations. We have seen several types of abstract, mathematical objects, including propositions, predicates, sets, and ordered pairs and tuples.

CHAPTER 1. Relations. 1. Relations and Their Properties. Discussion

COMP 182 Algorithmic Thinking. Relations. Luay Nakhleh Computer Science Rice University

Math.3336: Discrete Mathematics. Chapter 9 Relations

What are relations? f: A B

Relations, Functions, Binary Relations (Chapter 1, Sections 1.2, 1.3)

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Fall Inverse of a matrix. Institute: UC San Diego. Authors: Alexander Knop

Reading 11 : Relations and Functions

Chapter 9: Relations Relations

Automata and Languages

CSC Discrete Math I, Spring Relations

Discrete Mathematics. Chapter 4. Relations and Digraphs Sanguk Noh

Week 4-5: Binary Relations

CHAPTER THREE: RELATIONS AND FUNCTIONS

spaghetti fish pie cake Ann X X Tom X X X Paul X X X

BASIC MATHEMATICAL TECHNIQUES

1.A Sets, Relations, Graphs, and Functions 1.A.1 Set a collection of objects(element) Let A be a set and a be an elements in A, then we write a A.

Lecture 3: Matrix and Matrix Operations

COMP232 - Mathematics for Computer Science

Harvard CS121 and CSCI E-121 Lecture 2: Mathematical Preliminaries

Section 7.1 Relations and Their Properties. Definition: A binary relation R from a set A to a set B is a subset R A B.

Packet #5: Binary Relations. Applied Discrete Mathematics

Week 4-5: Binary Relations

Rela%ons and Their Proper%es. Slides by A. Bloomfield

The main limitation of the concept of a. function

Mathematics for linguists

DRAFT CONCEPTUAL SOLUTION REPORT DRAFT

CSCI 2670 Introduction to Theory of Computing

Spring Based on Partee, ter Meulen, & Wall (1993), Mathematical Methods in Linguistics

Relations. Definition 1 Let A and B be sets. A binary relation R from A to B is any subset of A B.

Exercises for Discrete Maths

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

Discrete Structures: Sample Questions, Exam 2, SOLUTIONS

Functions and Relations II. CS2100 Ross Whitaker University of Utah

Chapter 2 - Basics Structures MATH 213. Chapter 2: Basic Structures. Dr. Eric Bancroft. Fall Dr. Eric Bancroft MATH 213 Fall / 60

Math 42, Discrete Mathematics

Binary Relation Review Questions

Chapter 2 - Basics Structures

Matrix operations Linear Algebra with Computer Science Application

Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

Outline for Today. Binary Relations. Equivalence Relations. Partial Orders. Quick Midterm Review

Lecture 7. Logic III. Axiomatic description of properties of relations.

Discrete Structures: Sample Questions, Exam 2, SOLUTIONS

Logical Structures in Natural Language: First order Logic (FoL)

Massachusetts Institute of Technology 6.042J/18.062J, Fall 02: Mathematics for Computer Science Professor Albert Meyer and Dr.

ICS 6N Computational Linear Algebra Matrix Algebra

Math 4377/6308 Advanced Linear Algebra

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

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

MTH202 Discrete Mathematics

Relational Composition

Exercises. Exercise Sheet 1: Propositional Logic

Lecture 4.3: Closures and Equivalence Relations

1. To be a grandfather. Objects of our consideration are people; a person a is associated with a person b if a is a grandfather of b.

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

Definition: Let S and T be sets. A binary relation on SxT is any subset of SxT. A binary relation on S is any subset of SxS.

Chapter 6. Relations. 6.1 Relations

A primer on matrices

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Chapter 0 Introduction. Fourth Academic Year/ Elective Course Electrical Engineering Department College of Engineering University of Salahaddin

Equivalence, Order, and Inductive Proof

Matrix Operations. Linear Combination Vector Algebra Angle Between Vectors Projections and Reflections Equality of matrices, Augmented Matrix

Foundations of Mathematics

Relations. P. Danziger. We may represent a relation by a diagram in which a line is drawn between two elements if they are related.

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Rigorous Software Development CSCI-GA

Notes for Science and Engineering Foundation Discrete Mathematics

2MA105 Algebraic Structures I

7 Matrix Operations. 7.0 Matrix Multiplication + 3 = 3 = 4

CSE 311: Foundations of Computing I Autumn 2014 Practice Final: Section X. Closed book, closed notes, no cell phones, no calculators.

Mathematical Preliminaries. Sipser pages 1-28

A is a subset of (contained in) B A B iff x A = x B Socrates is a man. All men are mortal. A = B iff A B and B A. A B means A is a proper subset of B

Sets. Subsets. for any set A, A and A A vacuously true: if x then x A transitivity: A B, B C = A C N Z Q R C. C-N Math Massey, 72 / 125

Exam 2. Is g one-to-one? Is g onto? Why? Solution: g is not one-to-one, since for c A, g(b) = g(c) = c. g is not onto, since a / g(a).

Phys 201. Matrices and Determinants

Math 42, Discrete Mathematics

MATHEMATICS. IMPORTANT FORMULAE AND CONCEPTS for. Final Revision CLASS XII CHAPTER WISE CONCEPTS, FORMULAS FOR QUICK REVISION.

CLASS12 RELATIONS AND FUNCTIONS

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

Databases 2011 The Relational Algebra

INSTITIÚID TEICNEOLAÍOCHTA CHEATHARLACH INSTITUTE OF TECHNOLOGY CARLOW MATRICES

Matrices BUSINESS MATHEMATICS

Review 3. Andreas Klappenecker

Fuzzy and Rough Sets Part I

1. Foundations of Numerics from Advanced Mathematics. Mathematical Essentials and Notation

Math 3191 Applied Linear Algebra

Discrete Mathematics. W. Ethan Duckworth. Fall 2017, Loyola University Maryland

A FIRST COURSE IN LINEAR ALGEBRA. An Open Text by Ken Kuttler. Matrix Arithmetic

CS375 Midterm Exam Solution Set (Fall 2017)

Transcription:

Today s topics Binary Relations Relations Kinds of relations n-ary relations Representations of relations Reading: Sections 7.-7.3 Upcoming Upcoming Minesweeper Let A, B be any sets. A binary relation R from A to B, written (with signature) R:AB, or R:A,B, is (can be identified with) a subset of the set AB. E.g.,, let : NN : {(n,m) n < m} The notation a R b or arb means that (a,b)r. E.g., a b means (a,b) If arb we may say a is related to b (by relation R), or just a relates to b (under relation R). A binary relation R corresponds to a predicate function P R :AB{ {T,F} defined over the 2 sets A,B; e.g.,, predicate eats : {(a,b) organism a eats food b} 5. 5.2 Complementary Relations Inverse Relations Let R:A,B be any binary relation. Then, R:AB,, the complement of R,, is the binary relation defined by R : {(a,b) ) (a,b)r}( } = (AB)( R Note this is just R if the universe of discourse is U = AB; ; thus the name complement. Note the complement of R is R. Example: < = {(a,b) ) (a,b)<}( } = {(a,b) ) a<b} } = Any binary relation R:AB has an inverse relation R :BA,, defined by R : {(b,a) ) (a,b)r}.( E.g., < = {(b,a) ) a<b} } = {(b,a) ) b>a} } = >. E.g.,, if R:PeopleFFoods is defined by a R b a eats b,, then: b R a b is eaten by a.. (Passive voice.) 5.3 5.4

Relations on a Set Reflexivity A (binary) relation from a set A to itself is called a relation on the set A. E.g.,, the relation from earlier was defined as a relation on the set N of natural numbers. The (binary) identity relation I A on a set A is the set {(a,a) ) aa}. A relation R on A is reflexive if aa, ara. E.g.,, the relation : {(a,b) ) ab} is reflexive. A relation R is irreflexive iff its complementary relation R is reflexive. Example: < is irreflexive,, because is reflexive. Note irreflexive does NOT mean not reflexive! For example: the relation likes between people is not reflexive, but it is not irreflexive either. Since not everyone likes themselves, but not everyone dislikes themselves either! 5.5 5.6 Symmetry & Antisymmetry Transitivity A binary relation R on A is symmetric iff R = R, that is, if (a,b)r (b,a)r. E.g., = (equality) is symmetric. < is not. is married to is symmetric, likes is not. A binary relation R is antisymmetric if ab,, (a,b)r( (b,a)r. Examples: < is antisymmetric, likes is not. Exercise: prove this definition of antisymmetric is equivalent to the statement that RR I A. A relation R is transitive iff (for all a,b,c) (a,b)r (b,c)r (a,c)r. A relation is intransitive iff it is not transitive. Some examples: is an ancestor of is transitive. likes between people is intransitive. is located within mile of is? 5.7 5.8

Totality A relation R:AB is total if for every aa, there is at least one bb such that (a,b)r. If R is not total, then it is called strictly partial. A partial relation is a relation that might be strictly partial. (Or, it might be total.) In other words, all relations are considered partial. partial. Functionality A relation R:AB is functional if, for any aa, there is at most b B such that (a,b)r.( R is functional aa: b b 2 B: arb arb 2. Iff R is functional, then it corresponds to a partial function R:AB where R(a)= )=b arb; e.g. E.g.,, The relation arb : a + b = yields the function (a) ) = b. R is antifunctional if its inverse relation R is functional. Note: A functional relation (partial function) that is also antifunctional is an invertible partial function. R is a total function R:AB if it is both functional and total, that is, for any aa,, there is exactly b such that (a,b)r. I.e., aa:!b: arb. If R is functional but not total, then it is a strictly partial function. Exercise: Show that iff R is functional and antifunctional,, and both it and its inverse are total, then it is a bijective function. 5.9 5. Lambda Notation Composite Relations The lambda calculus is a formal mathematical language for defining and operating on functions. It is the mathematical foundation of a number of functional (recursive function-based) programming languages, such as LISP and ML. It is based on lambda notation,, in which a: f(a) is a way to denote the function f without ever assigning it a specific symbol. E.g. g., (x.. 3x3 2 +2x) is a name for the function f:rr where f(x)=3x 2 +2x. Lambda notation and the such that operator can also be used to compose an expression for the function that corresponds to any given functional relation. Let R:AB be any functional relation on A,B. Then the expression (a: b arb) denotes the function f:ab where f(a) ) = b iff arb. E.g., If I write: f : (a: b a+b = ), this is one way of defining the function f(a)= )=a. Let R:ABB,, and S:BCC.. Then the composite SoR of R and S is defined as: SoR = {(a,c) ) b: arb bsc} Note that function composition fog is an example. Exer.: : Prove that R:AA is transitive iff RoR = R. The n th power R n of a relation R on a set A can be defined recursively by: R : I A ; R n+ : R n or for all n. Negative powers of R can also be defined if desired, by R n : (R ) n. 5. 5.2

7.2: n-ary Relations Relational Databases An n-ary relation R on sets A,,A n, written (with signature) R:A A n or R:A,,A n, is simply a subset R A A n. The sets A i are called the domains of R. The degree of R is n. R is functional in the domain A i if it contains at most one n-tuple (, a i, ) for any value a i within domain A i. A relational database is essentially just an n-ary relation R. A domain A i is a primary key for the database if the relation R is functional in A i. A composite key for the database is a set of domains {A i, A j, } such that R contains at most n-tuple (,a i,,a j, ) for each composite value (a i, a j, )A i A j 5.3 5.4 Selection Operators Selection Operator Example Let A be any n-ary domain A=A A n, and let C:A{ {T,F} be any condition (predicate) on elements (n-tuples( -tuples)) of A. Then, the selection operator s C is the operator that maps any (n-ary( -ary)) relation R on A to the n-ary relation of all n-tuples from R that satisfy C. I.e., RA, s C (R)) = {ar s C (a)) = T} Suppose we have a domain A = StudentName Standing SocSecNos Suppose we define a certain condition on A, UpperLevel(name name,standing,ssn) ) :: [(standing = junior) (standing = senior)] Then, s UpperLevel is the selection operator that takes any relation R on A (database of students) and produces a relation consisting of just the upper- level classes (juniors and seniors). 5.5 5.6

Projection Operators Projection Example Let A = A A n be any n-ary domain, and let {i k }=(i,,i m ) be a sequence of indices all falling in the range to n, That is, where i k n for all k m. Then the projection operator on n-tuples is defined by: P { i } : A A i K A k i m P i }( a,..., a ) ( k n = ai,..., a { im ) Suppose we have a ternary (3-ary) domain Cars=Model ModelYearColor. (note n=3). Consider the index sequence {i k }=,3.. (m=2)( Then the projection P {i simply maps each tuple k } (a,a 2,a 3 ) = (model( model,year,color) to its image: ( ai, a ) (, ) (, ) i = a a3 = model color 2 This operator can be usefully applied to a whole relation RCars (a database of cars) to obtain a list of the model/color combinations available. 5.7 5.8 Join Operator Join Example Puts two relations together to form a sort of combined relation. If the tuple (A,B) appears in R, and the tuple (B,C) appears in R 2, then the tuple (A,B,C) appears in the join J(R,R 2 ). A, B,, and C here can also be sequences of elements (across multiple fields), not just single elements. Suppose R is a teaching assignment table, relating Professors to Courses. Suppose R 2 is a room assignment table relating Courses to Rooms,Times Times. Then J(R,R 2 ) is like your class schedule, listing (professor,course,room,time). 5.9 5.2

7.3: Representing Relations Using Zero-One Matrices Some ways to represent n-ary relations: With an explicit list or table of its tuples. With a function from the domain to {T,F}. Or with an algorithm for computing this function. Some special ways to represent binary relations: With a zero-one matrix. With a directed graph. To represent a binary relation R:AB by an A B - matrix M R = [m[ ij ],, let m ij = iff (a i,b j )R. E.g.,, Suppose Joe likes Susan and Mary, Fred likes Mary, and Mark likes Sally. Then the - matrix Susan Mary Sally representation of the relation Joe Likes:BoysGirls Fred relation is: Mark 5.2 5.22 Zero-One Reflexive, Symmetric Using Directed Graphs Terms: Reflexive, non-reflexive, irreflexive, symmetric, asymmetric, and antisymmetric. These relation characteristics are very easy to recognize by inspection of the zero-one matrix. Reflexive: all s on diagonal Irreflexive: all s on diagonal Symmetric: all identical across diagonal Antisymmetric: all s are across from s 5.23 A directed graph or digraph G=( =(V G,E G ) is a set V G of vertices (nodes) with a set E G V G V G of edges (arcs,links).. Visually represented using dots for nodes, and arrows for edges. Notice that a relation R:AB can be represented as a graph G R =(V G =AB, E G =R). Matrix representation M R : Susan Mary Sally Joe Fred Mark Graph rep. G R : Joe Fred Mark Edge set E G (blue arrows) Node set V G (black dots) Susan Mary Sally 5.24

Digraph Reflexive, Symmetric It is extremely easy to recognize the reflexive/irreflexive/ symmetric/antisymmetric properties by graph inspection. Reflexive: Every node has a self-loop Irreflexive: No node links to itself These are asymmetric & non-antisymmetric Symmetric: Every link is bidirectional Antisymmetric: No link is bidirectional These are non-reflexive & non-irreflexive 5.25