跳到主要内容

2024-2025学年下学期期中

2024-2025学年下学期期中试卷(A)(含答案)

一、Logic (5 questions, 35 points)

  1. (6 points) Determine the truth value of each of these statements if the universe of discourse for all variables consists of all integers.

    1. xy(x+y=1)\forall x\exists y(x+y=1)
    2. xy(x+2y=22x+2y=5)\exists x\exists y(x+2y=2 \land 2x+2y=5)
    3. xy(x<y2)\exists x\forall y(x<y^2)
    解:
    1. T
    2. F
    3. T

  2. (5 points) 证明下面的公式(不用真值表方法)

    ¬(pq)((pq)¬(pq)).\neg(p\leftrightarrow q)\equiv ((p\lor q)\land \neg(p\land q)).
    解:
    左边¬((pq)(qp))等价等值¬((¬pq)(¬qp))蕴含等值¬(¬pq)¬(¬qp)德摩根律(p¬q)(q¬p)德摩根律(pq)(p¬p)(¬qq)(¬q¬p)分配律(pq)¬(pq)右边.\begin{aligned} \text{左边} &\equiv \neg((p\to q)\land(q\to p)) && \text{等价等值}\\ &\equiv \neg((\neg p\lor q)\land(\neg q\lor p)) && \text{蕴含等值}\\ &\equiv \neg(\neg p\lor q)\lor\neg(\neg q\lor p) && \text{德摩根律}\\ &\equiv (p\land\neg q)\lor(q\land\neg p) && \text{德摩根律}\\ &\equiv (p\lor q)\land(p\lor\neg p)\land(\neg q\lor q)\land(\neg q\lor\neg p) && \text{分配律}\\ &\equiv (p\lor q)\land\neg(p\land q)\\ &\equiv \text{右边}. \end{aligned}

  3. (9 points) 将下列命题符号化(要求使用全总个体域)

    1. 火车比轮船快
    2. 在北京工作的人未必都是北京人
    3. 部分序集 (A,)(A,\le) 没有最大元
    解:

    (1)令 F(x)F(x)xx 是火车,G(y)G(y)yy 是轮船,H(x,y)H(x,y)xxyy 快。

    xy((F(x)G(y))H(x,y)).\forall x\forall y((F(x)\land G(y))\to H(x,y)).

    (2)令 P(x)P(x)xx 是北京人,Q(x)Q(x)xx 在北京工作。

    ¬x(Q(x)P(x)).\neg\forall x(Q(x)\to P(x)).

    (3)令 P(x)P(x)xAx\in AQ(x,y)Q(x,y)xyx\le y

    ¬x(P(x)y(P(y)Q(y,x))).\neg\exists x(P(x)\land\forall y(P(y)\to Q(y,x))).

  4. (7 points) 试证明下面的推理为有效推理

    前提:

    x(F(x)G(x))\forall x(F(x)\lor G(x)) x(G(x)¬R(x))\forall x(G(x)\to \neg R(x)) xR(x)\forall xR(x)

    结论:

    xF(x)\forall xF(x)
    解:
    1. x(G(x)¬R(x))\forall x(G(x)\to\neg R(x)),前提引入。
    2. G(a)¬R(a)G(a)\to\neg R(a),由(1)UI 规则。
    3. xR(x)\forall xR(x),前提引入。
    4. R(a)R(a),由(3)UI 规则。
    5. ¬G(a)\neg G(a),由(2)(4)拒取。
    6. x(F(x)G(x))\forall x(F(x)\lor G(x)),前提引入。
    7. F(a)G(a)F(a)\lor G(a),由(6)UI 规则。
    8. F(a)F(a),由(5)(7)析取三段论。
    9. xF(x)\forall xF(x),UG 规则。

  5. (8 points) 判断如下的结论是否正确

    1. x(A(x)B(x))xA(x)xB(x)\forall x(A(x)\land B(x))\equiv \forall xA(x)\land \forall xB(x)
    2. x(A(x)B(x))xA(x)xB(x)\exists x(A(x)\land B(x))\equiv \exists xA(x)\land \exists xB(x)
    3. x(A(x)B(x))xA(x)xB(x)\forall x(A(x)\lor B(x))\equiv \forall xA(x)\lor \forall xB(x)
    4. x(A(x)B(x))xA(x)xB(x)\exists x(A(x)\lor B(x))\equiv \exists xA(x)\lor \exists xB(x)
    解:
    1. True.
    2. False.
    3. False.
    4. True.

二、Sets and Functions (3 questions, 20 points)

  1. (6 points) Let A,BA,B and CC be sets. Prove that

    (AB)C=A(BC)(A-B)\cup C=A-(B-C)

    if and only if CAC\subseteq A.

    解:

    \Rightarrow:若 (AB)C=A(BC)(A-B)\cup C=A-(B-C),则

    C(AB)C=A(BC)A.C\subseteq (A-B)\cup C=A-(B-C)\subseteq A.

    \Leftarrow:若 CAC\subseteq A,则

    (AB)C=(AB)C=(AC)(BC)=A(BC)// because CA=A(BC)=A(BC).\begin{aligned} (A-B)\cup C &=(A\cap \overline{B})\cup C\\ &=(A\cup C)\cap(\overline{B}\cup C)\\ &=A\cap(\overline{B}\cup C)\qquad //\text{ because }C\subseteq A\\ &=A\cap\overline{(B\cap\overline{C})}\\ &=A-(B-C). \end{aligned}

  2. (8 points) Determine whether these statements are true or false.

    1. {{}}\varnothing\in\{\{\varnothing\}\}.
    2. If AA and BB are both uncountable sets, then ABA\cap B is also uncountable.
    3. The mapping ff from R\mathbb{R} to R\mathbb{R} defined by f(x)=1x2f(x)=\dfrac{1}{x^2} is a function which is neither onto nor one-to-one.
    4. The mapping ff from R\mathbb{R} to R\mathbb{R} defined by f(x)=22xf(x)=2-2x is a function which is both onto and one-to-one.
    解:
    1. False.
    2. False. If A=R+A=\mathbb{R}^+ and B=RB=\mathbb{R}^-, then AB=A\cap B=\varnothing.
    3. False. ff is not a function since it is undefined at x=0x=0.
    4. True.

  3. (6 points) Suppose AA is an infinite set. Prove that AA has a proper subset BB (i.e., BAB\subset A) such that A=B|A|=|B|.

    解:

    Since AA is infinite, it has a infinite countable subset A0AA_0\subseteq A. Suppose

    A0={a1,a2,a3,}.A_0=\{a_1,a_2,a_3,\ldots\}.

    Let

    B=A{a1}.B=A-\{a_1\}.

    We can construct a bijection ff from AA to BB as:

    f(x)={x,xAA0,ai+1,x=ai.f(x)= \begin{cases} x, & x\in A-A_0,\\ a_{i+1}, & x=a_i. \end{cases}

    Thus we have A=B|A|=|B| and complete the proof.


三、Relations (4 questions, 45 points)

  1. (10 points) 设 RA×AR\subseteq A\times A,分别定义以下操作:

    • r(R)r(R):对 RR 取自反闭包
    • s(R)s(R):对 RR 取对称闭包
    • t(R)t(R):对 RR 取传递闭包

    (1)请考虑两个组合操作:

    R1=t(s(r(R)))R_1=t(s(r(R))) R2=s(t(r(R)))R_2=s(t(r(R)))

    请证明或举反例说明:是否恒有 R1=R2R_1=R_2?若成立请证明;若不成立,请给出一个集合 AA 和关系 RR 的具体例子,并分别写出 R1R_1R2R_2

    (2)是否存在一个唯一的最小关系 S(RS)S(R\subseteq S),同时满足以下三个性质:自反性、对称性、传递性。如果存在,请说明该关系 SS 的构造方法;如果不存在,请说明原因。

    解:

    (1)不成立。举例 A={1,2,3}A=\{1,2,3\}R={(1,3),(2,3)}R=\{(1,3),(2,3)\}

    R1=t(s(r(R)))={(1,1),(2,2),(3,3),(1,3),(2,3),(3,1),(3,2),(1,2),(2,1)}.\begin{aligned} R_1 &=t(s(r(R)))\\ &=\{(1,1),(2,2),(3,3),(1,3),(2,3),(3,1),(3,2),(1,2),(2,1)\}. \end{aligned}R2=s(t(r(R)))={(1,1),(2,2),(3,3),(1,3),(2,3),(3,1),(3,2)}.\begin{aligned} R_2 &=s(t(r(R)))\\ &=\{(1,1),(2,2),(3,3),(1,3),(2,3),(3,1),(3,2)\}. \end{aligned}

    R2R_2 不包含 (1,2)(1,2)(2,1)(2,1),两者不相等。

    (2)存在唯一的最小关系 SS,即 RR 的等价闭包。构造方法为:先取 RR 的自反闭包 r(R)r(R),再取对称闭包 s(r(R))s(r(R)),最后取传递闭包 t(s(r(R)))t(s(r(R)))


  2. (10 points) Considering relations on the set A={1,2,3,,100}A=\{1,2,3,\ldots,100\} consisting of the first 100 positive integers, please answer the following questions:

    (a) How many nonzero entries does the matrix representing the relation have if R={(a,b)a>b}R=\{(a,b)\mid a>b\};

    (b) How many relations are there on set AA that are asymmetric(非对称);

    (c) How many relations are there on set AA that are both symmetric and antisymmetric(对称且反对称).

    解:

    (a)

    (1002)=4950.\binom{100}{2}=4950.

    (b)

    310021002=34950.3^{\frac{100^2-100}{2}}=3^{4950}.

    (c)

    2100.2^{100}.

    仅包含自环,每个元素可选是否包含自环。


  3. (12 points) Given a function f:XYf:X\to Y, define the relation

    R={(x1,x2)f(x1)=f(x2), x1,x2X}.R=\{(x_1,x_2)\mid f(x_1)=f(x_2),\ x_1,x_2\in X\}.

    (a) Prove that the relation RR is an equivalence relation.

    (b) Give the corresponding set BB of all equivalence classes.

    (c) Define the function g:Bf(X)g:B\to f(X) by g([x])=f(x)g([x])=f(x). Prove that gg is a bijective function.

    解:

    (a) To prove that RR is an equivalence relation, we need to show that it satisfies reflexivity, symmetry, and transitivity.

    1. Reflexivity: For any xXx\in X, we have f(x)=f(x)f(x)=f(x). Therefore, (x,x)R(x,x)\in R. This shows that RR is reflexive.
    2. Symmetry: If (x,y)R(x,y)\in R, then f(x)=f(y)f(x)=f(y). This implies f(y)=f(x)f(y)=f(x), so (y,x)R(y,x)\in R. This shows that RR is symmetric.
    3. Transitivity: If (x,y)R(x,y)\in R and (y,z)R(y,z)\in R, then f(x)=f(y)f(x)=f(y) and f(y)=f(z)f(y)=f(z). This implies f(x)=f(z)f(x)=f(z), so (x,z)R(x,z)\in R. This shows that RR is transitive.

    Since RR satisfies all three properties, it is an equivalence relation.

    (b) The set of equivalence classes BB is given by the partition of XX induced by the relation RR. Each equivalence class consists of all elements in XX that are related to each other under RR. Formally, the set of equivalence classes BB is:

    B={[x]xX},B=\{[x]\mid x\in X\},

    where

    [x]={yX(x,y)R}={yXf(x)=f(y)}.[x]=\{y\in X\mid (x,y)\in R\}=\{y\in X\mid f(x)=f(y)\}.

    (c) Define g:Bf(X)g:B\to f(X) by

    g([x])=f(x).g([x])=f(x).

    We need to show that gg is both injective (one-to-one) and surjective (onto).

    Injectivity: Suppose g([x])=g([y])g([x])=g([y]). Then f(x)=f(y)f(x)=f(y). By the definition of equivalence classes, xx and yy are in the same equivalence class, i.e., [x]=[y][x]=[y]. Therefore, gg is injective.

    Surjectivity: For any yf(X)y\in f(X), there exists some xXx\in X such that f(x)=yf(x)=y. Then g([x])=f(x)=yg([x])=f(x)=y. This shows that every element in f(X)f(X) is the image of some equivalence class in BB. Therefore, gg is surjective.

    Since gg is both injective and surjective, it is a bijective function.


  4. (13 分) 设 Πn\Pi_n 表示集合 Sn={1,2,,n}S_n=\{1,2,\ldots,n\} 的所有划分构成的集合。给定集合 SnS_n 上的两个划分 P1={A1,A2,,Ar}P_1=\{A_1,A_2,\ldots,A_r\}P2={B1,B2,,Bs}P_2=\{B_1,B_2,\ldots,B_s\},若对于每个 AjA_j 均有某个 BkB_k,使 AjBkA_j\subseteq B_k,则称 P1P_1P2P_2 的加细,记为 P1P2P_1\preceq P_2

    (a) 证明:集合 (Πn,)(\Pi_n,\preceq) 是一个偏序集。

    (b) 对于 n=3n=3,画出偏序集 (Πn,)(\Pi_n,\preceq) 的哈斯图。

    (c) 对于 n=5n=5,求 {P1,P2}\{P_1,P_2\} 的最大下界和最小上界,其中 P1={{1,2},{3},{4,5}}P_1=\{\{1,2\},\{3\},\{4,5\}\}P2={{1},{2,3},{4},{5}}P_2=\{\{1\},\{2,3\},\{4\},\{5\}\}

    解:

    (a) To show that (Πn,)(\Pi_n,\preceq) is a poset, we need to verify three properties:

    1. Reflexivity: For any partition PΠnP\in\Pi_n, clearly every block of PP is a subset of itself, so PPP\preceq P.

    2. Antisymmetry: Suppose P1P2P_1\preceq P_2 and P2P1P_2\preceq P_1. Let XP1X\in P_1. Since P1P2P_1\preceq P_2, there exists YP2Y\in P_2 such that XYX\subseteq Y. Since P2P1P_2\preceq P_1, there exists ZP1Z\in P_1 such that YZY\subseteq Z. But XYZX\subseteq Y\subseteq Z and X,ZP1X,Z\in P_1. Since the sets in a partition are non-overlapping, X=Y=ZX=Y=Z. Similarly, for any set in P2P_2, it is equal to a set in P1P_1. Thus, P1=P2P_1=P_2, and the relation is antisymmetric.

    3. Transitivity: If P1P2P_1\preceq P_2 and P2P3P_2\preceq P_3, then any block of P1P_1 is contained in some block of P2P_2, which in turn is contained in some block of P3P_3. Thus P1P3P_1\preceq P_3.

    Therefore, (Πn,)(\Pi_n,\preceq) is a poset.

    (b) For n=3n=3, the set S3={1,2,3}S_3=\{1,2,3\} has 5 partitions:

    P0={{1},{2},{3}}(finest partition)P_0=\{\{1\},\{2\},\{3\}\}\quad\text{(finest partition)}P1={{1},{2,3}}P_1=\{\{1\},\{2,3\}\}P2={{1,2},{3}}P_2=\{\{1,2\},\{3\}\}P3={{1,3},{2}}P_3=\{\{1,3\},\{2\}\}P4={{1,2,3}}(coarsest partition)P_4=\{\{1,2,3\}\}\quad\text{(coarsest partition)}

    The Hasse diagram is:

           P4
    / | \
    P1 P2 P3
    \ | /
    P0

    (c) Given:

    P1={{1,2},{3},{4,5}},P2={{1},{2,3},{4},{5}}.P_1=\{\{1,2\},\{3\},\{4,5\}\},\qquad P_2=\{\{1\},\{2,3\},\{4\},\{5\}\}.

    Greatest Lower Bound: The meet is the finest partition that is coarser than both A1A_1 and A2A_2. We find it by taking pairwise intersections:

    • The element 11 is merged with 22 in A1A_1, but forms a separate block in A2A_2. Therefore, 11 must form a separate block on its own.
    • The element 22 is merged with 11 in A1A_1 and with 33 in A2A_2. Therefore, 22 must form a separate block on its own.
    • Through similar analysis, it can be concluded that all elements form separate blocks.
    GLB={{1},{2},{3},{4},{5}}.GLB=\{\{1\},\{2\},\{3\},\{4\},\{5\}\}.

    Least Upper Bound (LUB): The join is the coarsest partition that refines both A1A_1 and A2A_2. We find it by taking connected components of the union:

    • The block {1,2}\{1,2\} of A1A_1 and the block {2,3}\{2,3\} of A2A_2 intersect due to the element 22, and they are merged into {1,2,3}\{1,2,3\}.
    • The block {4,5}\{4,5\} of A1A_1 is split into {4}\{4\} and {5}\{5\} in A2A_2. However, since the LUB needs to be coarser than A1A_1, the block {4,5}\{4,5\} is retained.
    LUB={{1,2,3},{4,5}}.LUB=\{\{1,2,3\},\{4,5\}\}.