给定集合 A A A B B B,可以通过集合的并 ( ∪ ) (\cup) ()、交 ( ∩ ) (\cap) ()、相对补 ( − ) (-) ()、绝对补 ( ∼ ) (\sim) ()和对称差 ( ⊕ ) (\oplus) ()等运算产生新的集合。

  1. 并集 A ∪ B A\cup B AB
    A ∪ B = { x ∣ x ∈ A ∨ x ∈ B } A\cup B = \{x|x\in A\lor x\in B\} AB={xxAxB}可以把 n n n个集合的并集简记为 ⋃ i = 1 n A i = A 1 ∪ A 2 ∪ . . . ∪ A n \bigcup_{i=1}^{n}A_i = A_1 \cup A_2 \cup...\cup A_n i=1nAi=A1A2...An
  2. 交集 A ∩ B A\cap B AB
    A ∩ B = { x ∣ x ∈ A ∧ x ∈ B } A\cap B = \{x|x\in A \land x\in B\} AB={xxAxB}当两个集合的交集是空集时,称它们是不交的。
    可以把 n n n个集合的交集简记为 ⋂ i = 1 n A i = A 1 ∩ A 2 ∩ . . . ∩ A n \bigcap_{i=1}^{n} A_i= A_1\cap A_2\cap...\cap A_n i=1nAi=A1A2...An
  3. B B B A A A的相对补集 A − B A-B AB
    A − B = A − A ∩ B = { x ∣ x ∈ A ∧ x ∉ B } A-B = A-A\cap B=\{x|x\in A\land x\notin B\} AB=AAB={xxAx/B}
  4. 绝对补集 ∼ A \sim A A
    E E E为全集, A ⊆ E A\subseteq E AE,则称 A A A E E E的相对补集为 A A A绝对补集,记做 ∼ A 或 A ‾ \sim A或\overline A AA ∼ A = E − A = { x ∣ x ∈ E ∧ x ∉ A } \sim A = E-A = \{x|x\in E\land x\notin A\} A=EA={xxEx/A}或简记为 ∼ A = { x ∣ x ∉ A } \sim A = \{x|x\notin A\} A={xx/A}
  5. A A A B B B的对称差 A ⊕ B A\oplus B AB
    A ⊕ B = ( A − B ) ∪ ( B − A ) = ( A ∪ B ) − ( A ∩ B ) \begin{aligned} A\oplus B & =(A-B)\cup(B-A) \\ & = (A\cup B)-(A\cap B) \\ \end{aligned} AB=(AB)(BA)=(AB)(AB)根据对称差的定义公式可得推论:
    5.1. A ⊕ A = ∅ A\oplus A = \varnothing AA=
    5.2. A ⊕ ∅ = A A\oplus \varnothing = A A=A

集合运算的主要算律

算律公式
幂等律 A ∪ A = A A∪A=A AA=A
A ∩ A = A A∩A=A AA=A
结合律 ( A ∪ B ) ∪ C = A ∪ ( B ∪ C ) (A∪B)∪C=A∪(B∪C) (AB)C=A(BC)
( A ∩ B ) ∩ C = A ∩ ( B ∩ C ) (A\cap B)\cap C = A\cap(B\cap C) (AB)C=A(BC)
交换律 A ∪ B = B ∪ A A\cup B = B\cup A AB=BA
A ∩ B = B ∩ A A\cap B = B\cap A AB=BA
分配律 A ∪ ( B ∩ C ) = ( A ∪ B ) ∩ ( A ∪ C ) A\cup(B\cap C) = (A\cup B)\cap(A\cup C) A(BC)=(AB)(AC)
A ∩ ( B ∪ C ) = ( A ∩ B ) ∪ ( A ∩ C ) A\cap(B\cup C) = (A\cap B)\cup(A\cap C) A(BC)=(AB)(AC)
同一律 A ∪ ∅ = A A\cup\varnothing = A A=A
A ∩ E = A A\cap E = A AE=A
零律 A ∪ E = E A\cup E = E AE=E
A ∩ ∅ = ∅ A\cap\varnothing = \varnothing A=
排中律 A ∪ ∼ A = E A\cup\sim A = E AA=E
矛盾律 A ∩ ∼ A = ∅ A\cap\sim A = \varnothing AA=
吸收律 A ∪ ( A ∩ B ) = A A\cup(A\cap B)=A A(AB)=A
A ∩ ( A ∪ B ) = A A\cap(A\cup B) = A A(AB)=A
德摩根律 A − ( B ∪ C ) = ( A − B ) ∩ ( A − C ) A-(B\cup C) = (A-B)\cap(A-C) A(BC)=(AB)(AC)
A − ( B ∩ C ) = ( A − B ) ∪ ( A − C ) A-(B\cap C)=(A-B)\cup(A-C) A(BC)=(AB)(AC)
∼ ( A ∪ B ) = ∼ A ∩ ∼ B \sim(A\cup B)=\sim A\cap\sim B (AB)=AB
∼ ( A ∩ B ) = ∼ A ∪ ∼ B \sim(A\cap B) = \sim A\cup\sim B (AB)=AB
∼ ∅ = E \sim\varnothing=E =E
∼ E = ∅ \sim E = \varnothing E=
否定律 ∼ ( ∼ A ) = A \sim(\sim A)=A (A)=A
Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐