Tải bản đầy đủ (.pdf) (133 trang)

Giáo trình bài tập dsp midterm hki 2010 2011

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (882.92 KB, 133 trang )

Relations

Chapter 5

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

Relations
Discrete Structures for Computing on 22 March 2012
Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations
Types of Relations

Huynh Tuong Nguyen, Tran Huong Lan, Tran Vinh Tan
Faculty of Computer Science and Engineering
University of Technology - VNUHCM
5.1


Contents

Relations

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan


1 Properties of Relations

2 Combining Relations

Contents
Properties of Relations
Combining Relations

3 Representing Relations

Representing Relations
Closures of Relations
Types of Relations

4 Closures of Relations

5 Types of Relations

5.2


Introduction

Relations

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

Contents

Properties of Relations
Combining Relations
Representing Relations
Closures of Relations
Types of Relations

5.3


Relations

Introduction

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations
Types of Relations

Function?
5.3


Relations


Relation

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

Definition

Let A and B be sets. A binary relation (quan hệ hai ngôi) from a
set A to a set B is a set
R⊆A×B

Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations
Types of Relations

5.4


Relations

Relation

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan


Definition

Let A and B be sets. A binary relation (quan hệ hai ngôi) from a
set A to a set B is a set
R⊆A×B

Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations

• Notations:

Types of Relations

5.4


Relations

Relation

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

Definition

Let A and B be sets. A binary relation (quan hệ hai ngôi) from a

set A to a set B is a set
R⊆A×B

Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations

• Notations:
(a, b) ∈ R ←→ aRb

Types of Relations

5.4


Relations

Relation

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

Definition

Let A and B be sets. A binary relation (quan hệ hai ngôi) from a
set A to a set B is a set
R⊆A×B


Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations

• Notations:
(a, b) ∈ R ←→ aRb



Types of Relations

n-ary relations?

5.4


Example

Relations

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

Example

Let A = {a, b, c} be the set of students, B = {l, c, s, g} be the set

of the available optional courses. We can have relation R that
consists of pairs (a, b), where a is a student enrolled in course b.
Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations
Types of Relations

5.5


Relations

Example

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

Example

Let A = {a, b, c} be the set of students, B = {l, c, s, g} be the set
of the available optional courses. We can have relation R that
consists of pairs (a, b), where a is a student enrolled in course b.
Contents
Properties of Relations
Combining Relations
Representing Relations


R

=

{(a, l), (a, s), (a, g), (b, c),
(b, s), (b, g), (c, l), (c, g)}

Closures of Relations
Types of Relations

5.5


Relations

Example

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

Example

Let A = {a, b, c} be the set of students, B = {l, c, s, g} be the set
of the available optional courses. We can have relation R that
consists of pairs (a, b), where a is a student enrolled in course b.
Contents
Properties of Relations
Combining Relations
Representing Relations


R

{(a, l), (a, s), (a, g), (b, c),

=

(b, s), (b, g), (c, l), (c, g)}
R
a
b
c

l
x

c
x

x

s
x
x

Closures of Relations
Types of Relations

g
x

x
x

5.5


Functions as Relations

Relations

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

• Is a function a relation?

Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations
Types of Relations

5.6


Functions as Relations

Relations


Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

• Is a function a relation?
• Yes!

Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations
Types of Relations

5.6


Functions as Relations

Relations

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

• Is a function a relation?
• Yes!
• f : A→B

Contents

Properties of Relations
Combining Relations
Representing Relations
Closures of Relations
Types of Relations

5.6


Functions as Relations

Relations

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

• Is a function a relation?
• Yes!
• f : A→B

Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations

R = {(a, b) | b = f (a)}

Types of Relations


5.6


Functions as Relations

Relations

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

• Is a relation a function?

Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations
Types of Relations

5.7


Functions as Relations

Relations

Huynh Tuong Nguyen,
Tran Huong Lan, Tran

Vinh Tan

• Is a relation a function?
• No
Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations
Types of Relations

5.7


Functions as Relations

Relations

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

• Is a relation a function?
• No
Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations
Types of Relations


5.7


Functions as Relations

Relations

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

• Is a relation a function?
• No
Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations
Types of Relations

• Relations are a generalization of functions

5.7


Relations on a Set

Relations


Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

Definition

A relation on the set A is a relation from A to A.

Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations
Types of Relations

5.8


Relations on a Set

Relations

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

Definition

A relation on the set A is a relation from A to A.
Example


Let A be the set {1, 2, 3, 4}. Which ordered pairs are in the
relation R = {(a, b) | a divides b} (a là ước số của b)?

Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations
Types of Relations

5.8


Relations

Relations on a Set

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

Definition

A relation on the set A is a relation from A to A.
Example

Let A be the set {1, 2, 3, 4}. Which ordered pairs are in the
relation R = {(a, b) | a divides b} (a là ước số của b)?


Contents
Properties of Relations
Combining Relations
Representing Relations

Solution:

Closures of Relations

R = {(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 4), (3, 3), (4, 4)}
R
1
2
3
4

1
x

2
x
x

3
x

Types of Relations

4
x

x

x
x

5.8


———————————————————–

Relations

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations
Types of Relations

5.9


Relations can have special properties

Relations


Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

Contents
Properties of Relations
Combining Relations
Representing Relations
Closures of Relations
Types of Relations

5.9


Relations can have special properties

Relations

Huynh Tuong Nguyen,
Tran Huong Lan, Tran
Vinh Tan

Reflexive
(phản xạ)

xRx, ∀x ∈ A
Contents
Properties of Relations
Combining Relations
Representing Relations

Closures of Relations
Types of Relations

5.9


×