LECTURE 15: RELATIONS. Software Engineering Mike Wooldridge

Similar documents
cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Relational Composition

Lecture 7: Relations

Preference, Choice and Utility

EQUIVALENCE RELATIONS (NOTES FOR STUDENTS) 1. RELATIONS

Mathematics Review for Business PhD Students Lecture Notes

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

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

Outline Inverse of a Relation Properties of Relations. Relations. Alice E. Fischer. April, 2018

Topics in Logic, Set Theory and Computability

Relations and Equivalence Relations

Preliminary Matters. Semantics vs syntax (informally):

Relations Graphical View

Definition of geometric vectors

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

Automata and Languages

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

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

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.

QUASI-PREFERENCE: CHOICE ON PARTIALLY ORDERED SETS. Contents

MITOCW Lec 11 MIT 6.042J Mathematics for Computer Science, Fall 2010

Context-free grammars and languages

Reading 11 : Relations and Functions

Relations. Binary Relation. Let A and B be sets. A (binary) relation from A to B is a subset of A B. Notation. Let R A B be a relation from A to B.

Binary Relation Review Questions

Chapter 9: Relations Relations

Plan diagnosis with agents

Sets, Logic, Relations, and Functions

Lecture 8: Equivalence Relations

CS 6110 Lecture 28 Subtype Polymorphism 3 April 2013 Lecturer: Andrew Myers

CSC Discrete Math I, Spring Relations

a + b = b + a and a b = b a. (a + b) + c = a + (b + c) and (a b) c = a (b c). a (b + c) = a b + a c and (a + b) c = a c + b c.

Properties of the Integers

RELATIONS AND FUNCTIONS

Relations, Functions & Binary Operations

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.

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

On sets, functions and relations

Chapter 1A -- Real Numbers. iff. Math Symbols: Sets of Numbers

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

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

Combining Propositional Dynamic Logic with Formal Concept Analysis

Introductory Analysis I Fall 2014 Homework #5 Solutions

* 8 Groups, with Appendix containing Rings and Fields.

CS2013: Relations and Functions

Set, functions and Euclidean space. Seungjin Han

Computational Models: Class 3

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

Relations. Relations. Definition. Let A and B be sets.

Axioms of Kleene Algebra

CMPSCI 250: Introduction to Computation. Lecture #11: Equivalence Relations David Mix Barrington 27 September 2013

Assignment #2 COMP 3200 Spring 2012 Prof. Stucki

Lecture 4: Constructing the Integers, Rationals and Reals

Modal Logic. UIT2206: The Importance of Being Formal. Martin Henz. March 19, 2014

Universal Algebra for Logics

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

Sums of Squares (FNS 195-S) Fall 2014

Mathematics for linguists

Homework 1 (revised) Solutions

Chapter 3. Cartesian Products and Relations. 3.1 Cartesian Products

Chapter 10 Markov Chains and Transition Matrices

Completeness of Star-Continuity

Mathematics-I Prof. S.K. Ray Department of Mathematics and Statistics Indian Institute of Technology, Kanpur. Lecture 1 Real Numbers

Introduction to Functions

Course 2BA1: Hilary Term 2007 Section 8: Quaternions and Rotations

Discrete Mathematics. 2. Relations

CS411 Notes 3 Induction and Recursion

(Refer Slide Time: 0:21)

Real Analysis Prof. S.H. Kulkarni Department of Mathematics Indian Institute of Technology, Madras. Lecture - 13 Conditional Convergence

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

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

and e 2 ~ e 2 iff e 1

A Logician s Toolbox

Theorems. Theorem 1.11: Greatest-Lower-Bound Property. Theorem 1.20: The Archimedean property of. Theorem 1.21: -th Root of Real Numbers

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

Equivalence Relations and Partitions, Normal Subgroups, Quotient Groups, and Homomorphisms

Lecturer three. General Concept in Q. M. Imagine a room containing 14 people, whose ages are as follows:

Sets. A set is a collection of objects without repeats. The size or cardinality of a set S is denoted S and is the number of elements in the set.

COMP2111 Glossary. Kai Engelhardt. Contents. 1 Symbols. 1 Symbols 1. 2 Hoare Logic 3. 3 Refinement Calculus 5. rational numbers Q, real numbers R.

Rational Numbers. a) 5 is a rational number TRUE FALSE. is a rational number TRUE FALSE

Notes for Science and Engineering Foundation Discrete Mathematics

Turing Machines. Lecture 8

BASIC MATHEMATICAL TECHNIQUES

Discrete Mathematics. Benny George K. September 22, 2011

Number Axioms. P. Danziger. A Group is a set S together with a binary operation (*) on S, denoted a b such that for all a, b. a b S.

This chapter contains a very bare summary of some basic facts from topology.

The main limitation of the concept of a. function

Math 300 Introduction to Mathematical Reasoning Autumn 2017 Axioms for the Real Numbers

09 Modal Logic II. CS 3234: Logic and Formal Systems. October 14, Martin Henz and Aquinas Hobor

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

Phil Introductory Formal Logic

Fair Divsion in Theory and Practice

RELATIONS AND FUNCTIONS

Sequence convergence, the weak T-axioms, and first countability

INTENSIONS MARCUS KRACHT

Definition 2.3. We define addition and multiplication of matrices as follows.

Section 7.1: Functions Defined on General Sets

However another possibility is

EC 521 MATHEMATICAL METHODS FOR ECONOMICS. Lecture 1: Preliminaries

Transcription:

LECTURE 15: RELATIONS Mike Wooldridge

1 Introduction We saw in earlier lectures that a function is just a set of maplets, for example: tel == {mikew 1531, eric 1489}. A maplet is just an ordered pair, so another way of writing this is tel == {(mikew, 1531), (eric, 1489)} Formally, if f : T 1 T 1, then f is a subset of the cartesian product of T 1 T 1 : f T 1 T 2. But functions can t be defined in this way, as they must have the uniqueness property the following is not a function: {(mike, 1531), (eric, 1531)}. A more general way of capturing a relationship between two sets is to use a relation. Relations are similar to functions, but do not have the uniquness property. Mike Wooldridge 1

Just as we have a variety of function construction arrows, so we have the relation constructor arrow,. Definition: If T 1 and T 2 are arbitrary types, then T 1 T 2 is an expression giving the set of all relations between T 1 and T 2. It may be defined: T 1 T 2 == IP(T 1 T 2 ). EXAMPLE. Let then A == {a, b, c} B == {1, 2} {(a, 1), (a, 2)} A B. Mike Wooldridge 2

2 Operations on Relations Everything you can do with a function, you can do with a relation: dom R domain of R ran R range of R S R R with domain restricted to S R S R with range restricted to S S R R with S subtracted from domain of R R S R with S subtracted from range of R Mike Wooldridge 3

EXAMPLES. Let then R == {(a, 1), (a, 2), (b, 1), (c, 3)} dom R = {a, b, c} ran R = {1, 2, 3} {a} R = {(a, 1), (a, 2)} {a, b} R = {(a, 1), (a, 2), (b, 1)} R {1} = {(a, 1), (b, 1)} R {1, 3} = {(a, 1), (b, 1), (c, 3)} {a} R = {(b, 1), (c, 3)} {a, b} R = {(c, 3)} R {1} = {(a, 2), (b, 3)} R {1, 2, 3} =. Mike Wooldridge 4

2.1 The Inverse of a Relation Additionally, we can take the inverse of a relation. Definition: If then R : T 1 T 2 R : T 1 : T 2 such that (y, x) R iff (x, y) R. Formally: EXAMPLE. If then R == {x : T 1 ; y : T 1 (x, y) R (y, x)} R == {(a, 1), (a, 2), (b, 1), (c, 3)} R = {(1, a), (1, 2), (1, b), (3, c)}. Note that you can always take the inverse of a function, since functions are just special kinds of relation, but you do not always get a function as a result. Mike Wooldridge 5

EXAMPLE. Suppose we had f == {a 1, b 1} Now f is certainly a function (though it is not one-to-one.) But take the inverse of f : f = {(1, a), (1, b)}. Although f is a relation, it is not a function. Mike Wooldridge 6

2.2 Relational Image Can we do relation application...? EXAMPLE. If then R == {(a, 1), (a, 2), (b, 1), (c, 3)} R(a) =? No, we can t, since it is not defined what the value of R should be here should it be 1 or 2 or both? However, we can do something a bit more general we can get the relation image of a value, using the image brackets ( ). Mike Wooldridge 7

Definition: If then S : IP T 1 R : T 1 T 2 R( S ) is an expression of type IP T 2, such that y R( S ) x : T 1 x S (x, y) R (i.e., y is in R( S ) iff there is some x in S such that R relates x to y). EXAMPLE. If then R == {(a, 1), (a, 2), (b, 1), (c, 3)} R( {a} ) = {1, 2} R( {a, b} ) = {1, 2} R( {a, c} ) = {1, 2, 3} R( {b} ) = {1} Mike Wooldridge 8

3 Properties of Relations An interesting class of relations are those that are defined on just one set. EXAMPLE. Consider the set of binary relations on IN: IN IN. Definition: If R : T T, then we say R is a binary relation on T. We shall now consider the properties of these types of relation. Mike Wooldridge 9

3.1 Reflexivity Suppose we have a relation R on T such that for any element x (dom R ran R), we have (x, x) R. Then R is said to be reflexive. EXAMPLES. 1. {(1, 1), (1, 2), (2, 2), (1, 3), (3, 3)}... is a reflexive relation on IN. 2. {(1, 1), (1, 2), (2, 2), (1, 3)}... is not a reflexive relation on IN (because (3, 3) is not a member). 3. The subset relation,, is reflexive, because S S, for any set S. 4. The less that relation, <, is not reflexive, because it is not true that n < n, for any value n. 5. The is the father of relation (defined on the set of people) is not reflexive, because it is not true that p is the father of p, for any person p. Mike Wooldridge 10

3.2 Symmetry A relation R is said to be symmetric if whenever (x, y) R, we have (y, x) R. EXAMPLES. 1. {(2, 1), (1, 2), (2, 3), (3, 2)}... is a symmetric relation on IN. 2. {(2, 1), (1, 2), (2, 3)}... is not a symmetric relation on IN (because (2, 3) is a member, but (3, 2) is not). 3. The equality relation, =, is a symmetric relation, since a = b implies b = a. 4. The subset relation,, is not a symmetric relation, since it is not generally the case that S T implies T S. 5. The is father of relation is not symmetric. Mike Wooldridge 11

3.3 Transitivity A relation R is said to be transitive iff whenever we have (x, y) R and (y, z) R, we also have (x, z) R. EXAMPLES. 1. {(2, 1), (1, 2), (2, 3), (3, 2)}... is not a transitive relation, as it does not contain (1, 3). 2. The less than relation, <, is transitive, since if a < b and b < c then a < c. 3. The is an ancestor of relation is transitive. 4. Equality is transitive. Mike Wooldridge 12

3.4 Equivalence Relations Definition: If a relation is reflexive, symmetric, and transitive, then it is called an equivalence relation. The general idea behind equivalence relations is that they classify objects which are alike in some respect. EXAMPLES. 1. Equality is an equivalence relation. 2. The relation is the same species as, defined on the set of all animals, is an equivalence relation. 3. The relation owns the same make car as, defined on the set of people, is an equivalence relation. 4. Neither < nor are equivalence relations. Equivalence relation are often written or. Mike Wooldridge 13

3.5 Reflexive and Transitive Closures Definition: If R is a relation on some set T, then the reflexive closure of R is the smallest reflexive relation containing R, and is given by the expression R +. Definition: If R is a relationon some set T, then the transitive closure of R is the smallest transitive relation containing R, and is given by the expression R. Mike Wooldridge 14