1. 程式人生 > >離散結構:基礎結構:集合,函式,序列,總和,和矩陣(Basic Structure:Set,Function,Sequences,Sums and Matrixes )(1)

離散結構:基礎結構:集合,函式,序列,總和,和矩陣(Basic Structure:Set,Function,Sequences,Sums and Matrixes )(1)

第二章:

章節彙總:

  • 集合:
    • 集合語言,集合操作,集合
  • 函式:
    • 函式種類,函式操作,可計算性
  • 序列:
    • 序列種類,求和公式
  • 總和:
    • 可數集
  • 矩陣:
  • 矩陣算術

Chapter Summary

  • Sets
    • The Language of Sets, Set Operations, Set Identities
  • Functions
    • Types of Functions, Operations on Functions,
    • Computability
  • Sequences and Summations
    • Types of Sequences, Summation Formulae
  • Set Cardinality
    • Countable Sets
  • Matrices
    • Matrix Arithmetic

集合:

小節彙總:

  • 集的定義
  • 描述集
    • 名冊方法
    • Set-Builder表示法
  • 數學中的一些重要集合
  • 空集和通用集
  • 子集和設定平等
  • 集合的基數
  • 元組
  • 笛卡爾積

Section Summary

  • Definition of sets
  • Describing Sets
    • Roster Method
    • Set-Builder Notation
  • Some Important Sets in Mathematics
  • Empty Set and Universal Set
  • Subsets and Set Equality
  • Cardinality of Sets
  • Tuples
  • Cartesian Product

簡介

  • 集合是離散數學中考慮的物件型別的基本構建塊之一。
    • 計數很重要。
    • 程式語言已設定操作。
  • 集合論是數學的一個重要分支。
    • 許多不同的公理系統已被用於發展集合論。
    • 這裡我們不關心集合論的正式公理集。 相反,我們將使用所謂的樸素集理論(第118頁)。
  • Sets are one of the basic building blocks for the types of objects considered in discrete mathematics.
    • Important for counting.
    • Programming languages have set operations.
  • Set theory is an important branch of mathematics.
    • Many different systems of axioms have been used to develop set theory.
    • Here we are not concerned with a formal set of axioms for set theory. Instead, we will use what is called naïve set theory( page 118).

集合:

  • 集合是無序的物件集合。
    • 本課程的學生
    • 這個房間的椅子
  • 集合中的物件稱為元素或集合的成員。 據說一組包含其元素。
  • 符號a∈A表示a是集合A的元素。
  • 如果a不是A的成員,請寫一個∉A

set:

  • A set is an unordered collection of objects.
    • the students in this class
    • the chairs in this room
  • The objects in a set are called the elements, or members of the set. A set is said to contain its elements.
  • The notation a ∈ A denotes that a is an element of the set A.
  • If a is not a member of A, write a ∉ A

描述集合:名冊方法

  • S= {a,b,c,d}
  • 順序不重要
  • S = {a,b,c,d} = {b,c,a,d}
  • 每個不同的物件都是成員; 不止一次列出同一成員不會改變集合。
  • S = {a,b,c,d} = {a,b,c,b,c,d}
  • 當規律明瞭時,Elipses(...)可用於描述一個集合而不列出所有成員。
  • S = {a,b,c,d,......,z}

Describing a Set: Roster Method

  • S = {a,b,c,d}
  • Order not important
  • S = {a,b,c,d} = {b,c,a,d}
  • Each distinct object is either a member or not; listing more than once does not change the set.
  • S = {a,b,c,d} = {a,b,c,b,c,d}
  • Elipses (...) may be used to describe a set without listing all of the members when the pattern is clear.
  • S = {a,b,c,d, ......,z }
  • 英語字母表中所有母音的集合:V = {a,e,i,o,u}
  • 小於10的所有奇數正整數的集合:O = {1,3,5,7,9}
  • 小於100的所有正整數的集合:S = {1,2,3,........,99}
  • 小於0的所有整數的集合:S = {....,-3,-2,-1}
  • Set of all vowels in the English alphabet: V = {a,e,i,o,u}
  • Set of all odd positive integers less than 10: O = {1,3,5,7,9}
  • Set of all positive integers less than 100: S = {1,2,3,........,99}
  • Set of all integers less than 0: S = {...., -3,-2,-1}

一些重要的集合

  • N =自然數= {0,1,2,3 ....}
  • Z =整數= {..., - 3,-2,-1,0,1,2,3,...}
  • Z + = 正整數= {1,2,3,.....}
  • R =實數集
  • R + =正實數集合
  • C =複數集合。
  • Q =有理數集

Some Important Sets

  • N = natural numbers = {0,1,2,3....}
  • Z = integers = {...,-3,-2,-1,0,1,2,3,...}
  • Z+ = positive integers = {1,2,3,.....}
  • R = set of real numbers
  • R+ = set of positive real numbers
  • C = set of complex numbers.
  • Q = set of rational numbers

描述一個集合:集生成器表示法

  • 指定所有成員必須滿足的屬性:
  • S = {x | x是小於100的正整數}
  • O = {x | x是小於10的奇數正整數} O = {x∈Z+ | x是奇數,x <10}
  • 可以使用謂詞:S = {x | P(x)}
  • 示例:S = {x | Prime(x)}
  • 正有理數:
  • Q + = {x∈R| x = p / q,對於某些正整數p,q}

Describing a Set: Set-Builder Notation

  • Specify the property or properties that all members must satisfy:
  • S = {x | x is a positive integer less than 100}
  • O = {x | x is an odd positive integer less than 10} O = {x ∈ Z+ | x is odd and x < 10}
  • A predicate may be used: S={x|P(x)}
  • Example: S = {x | Prime(x)}
  • Positive rational numbers:
  • Q+ = {x ∈ R | x = p/q, for some positive integers p,q}

間隔符號

  • [a,b] = {x | a ≤ x ≤ b}
  • [a,b)={x|a≤x<b}
  • (a,b]={x|a<x≤b}
  • (a,b)={x|a<x<b}
  • 閉區間[a,b]
  • 開區間(a,b)

Interval Notation

  • [a,b] = {x | a ≤ x ≤ b}
  • [a,b)={x|a≤x<b}
  • (a,b]={x|a<x≤b}
  • (a,b)={x|a<x<b}
  • closed interval [a,b]
  • open interval (a,b)

包含其他集的集

  • 示例:集合{N,Z,Q,R}是一個包含四個元素的集合,每個元素都是一個集合。 這個集合的四個元素是

N,自然數的集合; Z,整數集; Q,有理數的集合; 和R,一組實數。

Sets containing other sets

  • Example: The set {N,Z,Q,R} is a set containing four elements, each of which is a set. The four elements

of this set are N, the set of natural numbers; Z, the set of integers; Q, the set of rational numbers; and R, the set of real numbers.

電腦科學中的資料型別

  • 電腦科學中資料型別或型別的概念建立在集合的概念之上。
  • 特別是,資料型別或型別是集合的名稱,以及可以對該集合中的物件執行的一組操作。
  • 例如,boolean是集合{0,1}的名稱以及該集合的一個或多個元素上的運算子,例如AND,OR和NOT。
  • 你還有另一個例子嗎?

Datatype in Computer Science

  • The concept of a datatype, or type, in computer science is built upon the concept of a set.
  • In particular, a datatype or type is the name of a set, together with a set of operations that can be performed on objects from that set.
  • For example, boolean is the name of the set {0, 1} together with operators on one or more elements of this set, such as AND, OR, and NOT.
  • Do you have another example?

全集和空集

  • 全集U是包含當前正在考慮的所有內容的集合。
    • 有時暗示
    • 有時明確說明。
    • 內容取決於具體情況。
  • 空集(空集)是沒有元素的集合。 符號化∅,但也使用{}。

Universal Set and Empty Set

  •  The universal set U is the set containing everything currently under consideration.
    • Sometimes implicit
    • Sometimes explicitly stated.
    • Contents depend on the context.
  • The empty set(null set)is the set with no elements. Symbolized ∅, but {} also used.

要記住一些事情

  • 集合可以是集合的元素。

{{1,2,3},a,{b,c}}

{N,Z,Q,R}

  • 空集與包含空集的集不同。

∅≠{∅}

Some things to remember

  • Sets can be elements of sets.

{{1,2,3},a, {b,c}}

{N,Z,Q,R}

  • The empty set is different from a set containing the empty set.

∅ ≠{ ∅ }

集合相等

  • 定義:當且僅當它們具有相同的元素時,兩個集合是相等的。
    • 因此,如果A和B是集合,當且僅當A和B是相同的集合,則A和B相等,

我們認為A = B if A 和 B是等集 。

{1,3,5} = {3,5,1} {1,5,5,5,3,3,1} = {1,3,5}

Set Equality

Definition: Two sets are equal if and only if they have the same elements.

  • Therefore if A and B are sets, then A and B are equal if and only if Any x(x∈A<->x∈B)
  • We write A = B if A and B are equal sets.

{1,3,5} = {3, 5, 1}

{1,5,5,5,3,3,1} = {1,3,5}

維恩圖

John Venn(1834-1923)英國劍橋

  • 可以用英語數學家約翰·維恩(John Venn)命名的圖表,以圖表的形式使用文字圖,他們在1881年介紹了它們的用法。

  • 在維恩圖中,包含所有考慮物件的通用集U由矩形表示。

Venn Diagrams

John Venn (1834-1923) Cambridge, UK

  • Sets can be represented graphically using Venn diagrams, named after the English mathematician John Venn, who introduced their use in 1881.

  • In Venn diagrams the universal set U, which contains all the objects under consideration, is represented by a rectangle.

  • Inside this rectangle, circles or other geometrical figures are used to represent sets. Sometimes points are used to represent the particular elements of the set.

  • Venn diagrams are often used to indicate the relationships between sets.

子集

定義:集合A是B的子集,當且僅當A的每個元素也是B的元素時。

  • 符號A⊆B用於表示A是集合B的子集。

  • 當且僅當a為真時,A⊆B成立。

        1.因為對於每一組S,a∈∅總是假的,對於任何 S,∅S。

        2.因為αS→a∈S,S⊆S,forevery setS。

        ⊆:子集

Subsets

Definition: The set A is a subset of B, if and only if every element of A is also an element of B.

  • The notation A ⊆ B is used to indicate that A is a subset of the set B.

  • A ⊆ B holds if and only if   is true.

            1. Because a ∈ ∅ is always false, ∅ ⊆ S , for every set S.

            2. Becausea∈S →a∈S, S⊆S, for every set S.

            ⊆ : subset of

表明一個集合是否是另一個集合的子集

  • 表明A是一個B的子集:為表明A⊆B,表明如果x屬於A,那麼x也屬於B.

  • 表明A不是B的子集:為了表明A不是B的子集,A⊈B,找一個屬於元素 x∈A與x∉B。(這樣的x是聲稱x∈Aimpliesx∈B的反例。)

例子:

1.你學校所有電腦科學專業的學生都是你學校所有學生的一部分。

2.平方小於100的整數集不是非負整數集的子集。

Showing a Set is or is not a Subset of Another Set

  • Showing that A is a Subset of B: To show that A⊆B, show that if x belongs to A, then x also belongs to B.

  • Showing that A is not a Subset of B: To show that A isnotasubsetofB,A⊈B, find an elementx∈Awith x ∉ B. (Such an x is a counterexample to the claim that x∈Aimpliesx∈B.)

Examples:

1. The set of all computer science majors at your school is a subset of all students at your school.

2. The set of integers with squares less than 100 is not a subset of the set of nonnegative integers.

再看看集合的平等性

  • 回想一下,兩組A和B相等,用A = B表示,iff

  • Any x(x∈A<->x∈B)

  • 使用邏輯等價,我們得到A = B iff

  • 這等價於

                            A⊆B和B⊆A

Another look at Equality of Sets

  • Recall that two sets A and B are equal, denoted by A = B, iff

    • Any x(x∈A<->x∈B)

  • Using logical equivalences we have that A = B iff

  • This is equivalent to

                            A⊆B and B⊆A

真子集

定義:如果A⊆B,但A≠B,那麼wesayAisa B的真子集,用A⊂B表示。如果A⊂B,那麼

是真的。

Proper Subsets

Definition:IfA⊆B,butA ≠B,thenwesayAisa proper subset of B, denoted by A ⊂ B. If A ⊂ B, thenis true.

集合的基數

定義:如果S中恰好有n個不同的元素,其中n是非負整數,我們說S是有限的。 否則它是無限的。

定義:有限集A的基數,由| A |表示,是A的(不同)元素的數量。

例子:

1. |ø| = 0

2.設S是英文字母的字母。 然後| S | = 26

3. | {1,2,3} | = 3

4. | {ø} | = 1

5. 整數集是無限的。

Set Cardinality

Definition: If there are exactly n distinct elements in S where n is a nonnegative integer, we say that S is finite. Otherwise it is infinite.

Definition: The cardinality of a finite set A, denoted by |A|, is the number of (distinct) elements of A.

Examples:

1. |ø| = 0

2. Let S be the letters of the English alphabet. Then |S| = 26

3. |{1,2,3}| = 3

4. |{ø}| = 1

5. The set of integers is infinite.

冪集

定義:集合A的所有子集的集合,表示為P(A),稱為A的冪集。

示例:如果A = {a,b}則

P(A)= {ø,{a},{b},{a,b}}總共4個子集 - 2^2

  • 如果一個集合有n個元素,那麼冪集的基數是2^n。

  • 讓我們以另一種方式看同一個例子。 示例:如果A = {a,b},則P(A)= {ø,{a},{b},{a,b}}

使用二進位制數字1表示元素包含在子集中; 使用二進位制數字0表示元素未包含在子集中。

00-子集中既不包含a也不包含b。ø

01 - b,而不是a,包含在子集中。{b}

10 - a,而不是b,包含在子集中。 {a}

11 - a或b都包含在子集中。{a,b}

  • 如果一個集合有n個元素,那麼冪集的基數是2^n。

示例:購買錘子和螺絲刀的方式有多少種?

解:

A = {錘子,螺絲刀}然後

P(A)= {ø,

{一個錘子},

{一把螺絲起子},

{錘子,螺絲刀}}

示例:空集的冪集是多少? 集合{∅}的冪集是多少?

解:

空集恰好有一個子集,即它本身。 所以,

P(∅)= {∅}。

集合{∅}恰好有兩個子集,即∅和

設定{∅}本身。 因此,P({∅})= {∅,{∅}}。

Power Sets

Definition: The set of all subsets of a set A, denoted P(A), is called the power set of A.

Example: If A = {a,b} then

P(A) = {ø, {a},{b},{a,b}} 4 subsets in total - 22

  • If a set has n elements, then the cardinality of the power set is 2n.

  • Let’ s look at the same example in another way. Example: If A = {a,b} then P(A) = {ø, {a},{b},{a,b}}

Use binary digit 1 to indicate an element is contained in a subset; use binary digit 0 to indicate an element is not contained in a subset.

00 – neither a nor b is contained in a subset. ø 01 – b, not a, is contained in a subset. {b}

10 – a, not b, is contained in a subset. {a}

11 – both a or b is contained in a subset. {a,b}

  • If a set has n elements, then the cardinality of the power set is 2n.

Example: How many different ways are there to purchase a hammer and a screw driver?

Solution:

A = {a hammer, a screw driver} then P(A) = {ø,

{a hammer},

{a screw driver},

{a hammer, a screw driver}}

Example: What is the power set of the empty set? What is the power set of the set {∅}?

Solution:

The empty set has exactly one subset, namely, itself. Consequently,

P(∅) = {∅}.

The set {∅} has exactly two subsets, namely, ∅ and the

set {∅} itself. Therefore, P({∅}) = {∅, {∅}}.

有序的n元組

  • 有序的n元組(a1,a2,.....,an)是有序集合,其中a1作為其第一個元素,a2作為其第二個元素,依此類推,直到作為其最後一個元素。

  • 當且僅當它們的相應元素相等時,兩個n元組是相等的。

  • 2元組稱為有序對。

  • 當且僅當a = c且b = d時,有序對(a,b)和(c,d)相等。

Ordered n-Tuples

  • The ordered n-tuple (a1,a2,.....,an) is the ordered collection that has a1 as its first element and a2 as its second element and so on until an as its last element.

  • Two n-tuples are equal if and only if their corresponding elements are equal.

  • 2-tuples are called ordered pairs.

  • The ordered pairs (a,b) and (c,d) are equal if and only if a = c and b = d.

笛卡爾積

定義:由A×B表示的兩組A和B的笛卡爾乘積是有序對(a,b)的集合,其中a∈A和b∈B。

例:

A = {a,b} B = {1,2,3}

A×B = {(a,1),(a,2),(a,3),(b,1),(b,2),(b,3)}

  • 定義:笛卡爾乘積A×B的子集R稱為從集合A到集合B的關係。關係將在第9章中詳細介紹。

  • 定義:集合A1,A2,......,An的笛卡爾積,由A1×A2×......×An表示,是有序n元組(a1,a2,...)的集合。 .....,a)ai屬於Ai

對於i = 1,... n。

示例:什麼是A×B×C,其中A = {0,1},B = {1,2}且C = {0,1,2}

解:A×B×C = {(0,1,0),(0,1,1),(0,1,2),(0,2,0),(0,2,1),( 0,2,2),(1,1,0),(1,1,1),(1,1,2),(1,2,0),(1,2,1),(1,2,2)}

Cartesian Product

Definition: The Cartesian Product of two sets A and B, denoted by A × B is the set of ordered pairs (a, b) where a∈A and b∈B.

Example:

A = {a,b} B = {1,2,3}

A × B = {(a,1),(a,2),(a,3), (b,1),(b,2),(b,3)}

  • Definition: A subset R of the Cartesian product A × B is called a relation from the set A to the set B. (Relations will be covered in depth in Chapter 9. )

  • Definition: The cartesian products of the sets A1,A2,......,An, denoted by A1 × A2 × ...... × An , is the set of ordered n-tuples (a1,a2,......,an) where ai belongs to Ai

for i = 1, ... n.

Example: What is A × B × C where A = {0,1}, B = {1,2} and C = {0,1,2}

Solution: A × B × C = {(0,1,0), (0,1,1), (0,1,2),(0,2,0), (0,2,1), (0,2,2),(1,1,0), (1,1,1), (1,1,2), (1,2,0), (1,2,1), (1,2,2)}

量詞的真實集合

  • 給定謂詞P和域D,我們將P的真值集定義為D中P(x)為真的元素集。 P(x)的真值集用表示

  • 例子:P(x)的真值集,其中域是整數,P(x)是“| x | = 1“是集合{-1,1}

Truth Sets of Quantifiers

  • Given a predicate P and a domain D, we define the truth set of P to be the set of elements in D for which P(x) is true. The truth set of P(x) is denoted by

  • Example: The truth set of P(x) where the domain is the integers and P(x) is “|x| = 1” is the set {-1,1}