• 离散数学读书记录


    离散数学读书记录

    如果选课系统面子给够的话,我下学期大概有三门数学课。非常恐怖。

    所以提前学一下离散,避免挂科。

    用的书是 Discrete Mathematics and Its Applications 8th Edition

    Chapter 1: The Foundations: Logic and Proofs

    1.1 Propositional Logic

    高中内容,略。

    Exercises

    T53

    The (n) th statement in a list of 100 statements is "Exactly (n) of the statements in the list are false."

    a) What conclusions can you draw from these statements?

    b) Answer part (a) if the (n) th statement is "At least (n) of the statements in the list are false."

    c) Aswer part(b) assuming that the list contains 99 statements.

    Sol

    a)

    讨论:

    1. 假如有超过两个命题都是真的,那么天然矛盾。

    2. 假如没有任何一个命题是真的,也就是 100 条都是假的,那么第 100 条命题就是真的了,矛盾。

    3. 假如恰好有一个命题是真的,也就是 99 条都是假的,那么只有第 99 条命题是真的,其他都是假的。

    综合,第 99 条是真的,别的都是假的。

    b)

    发现第 (i) 条命题是第 (i+1,i+2,dots,n) 条命题的充分不必要条件。

    这意味着存在一个唯一的 (k) ,满足前 (k) 条命题为真,而剩余的为假。

    容易发现

    [egin{cases} kleq 100-k \ k+1 > 100-k end{cases} ]

    (k) 仅能取 50 ,经验证无误。

    c)

    同理,

    [egin{cases} kleq 99-k \ k+1 > 99-k end{cases} ]

    无整数解,矛盾。这一事实与命题本身可以判断真假又矛盾,是个悖论。

    1.2 Applications of Propositional Logic

    • 一些五三等习题集边角处的逻辑小谜题的出处 ( ゚∀。)
    • 基础的逻辑门知识
    • 搜索引擎与逻辑运算符

    Exercises

    T19

    Each inhabitant of a remote village always tells the truth or always lies. A villager will give only a "Yes" or a "No" response to a question a tourist asks. Suppose you are a tourist visiting this area and come to a fork in the road. One branch leads to the ruins you want to visit; the other branch leads deep into the jungle. A village is standing at the fork in the road. What one question can you ask the village to determine which branch to take?

    Sol

    wwwwwww

    我觉得比较标准的一个答案是:

    「如果我问你,左边这条路是不是可以到遗迹去,你会回答 Yes 吗?」

    还有不讲道理的答案:

    「如果你只会说谎,那左边不能走到遗迹去对吗,或者你不会说谎,那左边能走到遗迹去对吗?」

    似乎也没有毛病。

    T42

    Solve this famous logic puzzle, attributed to Albert Einstein, and known as the zebra puzzle.

    Five men with different nationalities and with different jobs live in consecutive houses on a street. These houses are painted different colors. The men have different pets and have different favorite drinks. Determine who owns a zebra and whose favorite drink in mineral water ( which is one of the favorite drinks ) given these clues:

    The Englishman lives in the red house.

    The Spaniard owns a dog.

    The Japanese man is a painter.

    The Italian drinks tea.

    The Norwegian lives in the first house on the left.

    The green house in immediately to the right of the white one.

    The photographer breeds snails.

    The diplomat lives in the yellow house.

    Milk is drunk in the middle house.

    The owner of the green house drinks coffee.

    The Norwegian 's house is next to the blue one.

    The violinist drinks orange juice.

    The fox is in a house next to that of the physician

    The horse is in a house next to that of the diplomat.

    Sol

    ???什么破题


    ID Nationality Pet Job Favorite Drink The color of house The location of house
    1 Englishman Red
    2 Spaniard Dog
    3 Japanese Painter
    4 Italian Tea
    5 Norwegian 1

    photographer breeds snails 那么 Pet 和 Job 已填写的都不可能对应这一关系。

    diplomat lives in the yellow house 同样 Job 或 color 已填写的也不能对应这一关系。

    violinist drinks orange juice 类似地,Job 或 Drink 已填写的不能对应这一关系。

    总之,

    photographer 可能在 ID 1 4 5

    diplomat 可能在 ID 2 4 5

    violinist 可能在 ID 1 2 5

    physician 可能在 ID 1 2 4 5

    类似地,

    Green, White, Blue 只能在 ID 2 3 4

    且 Blue 对应 Location 2

    Green 的 Location 比 White 的大 1

    设各ID的 location 是 (x_1,x_2,x_3,x_4) 那么,


    铁尼玛无语,还推理个锤头,暴力得到答案:

    ID Nationality Pet Job Favorite Drink The color of house The location of house
    1 Englishman Snail Photographer Milk Red 3
    2 Spaniard Dog Violinist Orange Juice White 4
    3 Japanese Zebra Painter Coffee Green 5
    4 Italian Horse Physician Tea Blue 2
    5 Norwegian Fox Diplomat Mineral Water Yellow 1

    没验证别的,我猜想应该只有这一个答案。

    佛了。

    1.3 Propositional Equivalences

    • Tautology: 重言式,恒为真值的复合命题。这个命名感觉有 You can say it again 的意思。

    • Contradiction: 矛盾式,恒为假值的符合命题。

    • Logical Equivalences: (pequiv q) ( or (pLeftrightarrow q) ) means (p leftrightarrow q) is tautology

      下面给出一些重要的 Logical Equivalences

      Equivalence Name
      (p o q equiv eg por q)
      (pleftrightarrow q equiv ( eg por q) and ( eg qor p))
      Conditional-disjunction equivalence
      (p and T equiv p)
      (por F equiv p)
      Identity laws
      (p or T equiv T)
      (pand F equiv F)
      Domination laws
      (p and pequiv p)
      (por p equiv p)
      Idempotent laws
      ( eg( eg p) equiv p) Double negation law
      (por qequiv qor p)
      (p and q equiv q and p)
      Commutative laws
      ((por q)or requiv qor (por r))
      ((pand q)and requiv qand (pand r))
      Associative laws
      (por (q and r) equiv (por q) and (p or r))
      (p and (q or r) equiv (pand q) or (p and r))
      Distributive law
      ( eg(pand q) equiv eg p or eg q)
      ( eg (p or q) equiv eg p and eg q)
      De Morgan's law
      (por(pand q) equiv p)
      (pand(por q) equiv p)
      Absorption laws
      (por eg p equiv T)
      (pand eg p equiv F)
      Negation laws
    • Satisfiability: 如果存在至少一种变量取值使得一个符合命题可以取真值,这个命题就是 satisfiable 的。具体讨论了八皇后问题和数独

    Exercises

    T43

    Why are the duals of two equicalent compound propositions are also equivaalent, where these compound propositions contain only the operators (and,or, eg)

    Sol

    一个复合命题的对偶应当是把命题中出现的 (or)(and) 全部互相替换,(T)(F) 互相替换得到的命题。

    接下来说明等价命题的对偶也是等价命题。

    首先看两个很自然的引理:

    Lemma 1: ((pequiv q) Leftrightarrow ( eg p equiv eg q))

    Lemma 2: 考虑 (p=f(p_1,p_2,dots),~~q=g(q_1,q_2,dots)) ,若 (pequiv q) ,那么 (f( eg p_1, eg p_2,dots) equiv g( eg q_1, eg q_2,dots))

    利用真值表,可以清楚地观察出这两个引理。

    接着,首先考虑复合命题中的 ( eg) 运算符。为了方便说明,我们不断地对原命题使用 De Morgan's Law,使得所有 ( eg) 运算符都作用在了不可分的 atomic statement 上。这样可以简化后续的说明。

    假设原命题可以划分成 (pequiv p_1and p_2,~~qequiv q_1and q_2) 的形式,那么

    首先在 (p equiv q) 的基础上用引理1,得到 ( eg(p_1and p_2) equiv eg(q_1and q_2))

    再用 De morgan's Law 有 ( eg p_1 or eg p_2 equiv eg q_1 or eg q_2)

    这时由引理2,就有 (p_1or p_2 equiv q_1or q_2) ,完成了符号变换。

    (pequiv p_1or p_2,~~ qequiv q_1or q_2)

    (pequiv p_1 and p_2,~~ q equiv q_1or q_2)

    (pequiv p_1 or p_2,~~ q equiv q_1and q_2) 也可以通过相似的流程完成符号变换。

    我们按照运算优先级的逆序,不断地划分复合命题的结构,再重复这种 Lemma 1 -> De Morgan's Law -> Lemma 2 的循环,就可以把复合命题中的所有 (or,and) 完成转置。

    说得不很清楚,但总之可以机械地通过这种方法,说明任意两个等价命题的对偶也等价。

    T47, 48, 49

    A collection of operators is called functionally complete if every compound propostion is logically equivalent to a compoud proposition involving only these logical operators.

    T47: Show that ( eg,or,and) form a functionally complete collection of logical operators.

    T48: Show that ( eg) and (and) form a functionally complete collection of logical operators.

    T49: Show that ( eg) and (or) form a functionally complete collection of logical operators.

    Sol

    T47: 根据 Conditional-disjunction equivalence 和 Negation laws 可以替换掉 ( o, leftrightarrow,T,F) ,于是结论成立。

    T48: 在T47的基础上逆用 De Morgan's Law ,即 (por q equiv eg( eg(pand q))) 即可。

    T49: 同理根据 (pand q equiv eg( eg(por q))) 即可

    T55

    We now present a group of exercises that involve the logical operators NAND and NOR.

    The proposition (p) NAND (q) is ture when either (p) or (q) or both are false; and it is false when both (p) and (q) are true.

    The proposition (p) NOR (q) is ture when both (p) and (q) are false; and it is false otherwise.

    The proposition (p) NAND (q) and (p) NOR (q) are denoted by (p~|~q) and (pdownarrow q) respectively.

    T50-54 passed

    T55: Find a compound proposition logically equivalent to (p o q) using only the logically operator (downarrow)

    Sol

    顺着做T50-54可以得到

    1. (pdownarrow p equiv eg p)
    2. ((p downarrow q) downarrow (p downarrow q) equiv p or q)

    又因为 (p o q equiv eg por q)

    所以有 (p o q equiv ((p downarrow p) downarrow q) downarrow ((p downarrow p) downarrow q))

    挺奇妙的。

    T59

    How many different truth table of compound propositions are there that involve the propositional variables (p) and (q) ?

    Sol

    要说明这个问题其实是有点难度的。假如我们知道逻辑的这套体系非常完备,就可以应用简单的数学知识,得到是 16 种。(考虑一个真值表,固定 (p,q) 两列不动,在 compound proposition 那一列填值,可以从 0 0 0 0 写到 1 1 1 1,共16种)。

    但是现在我们未必知道体系是完备的,所以应该需要举例子,就非常麻烦。

    我太懒,答案略。

    1.4 Predicates and Quantifiers

    • A statement of the form (P(x_1,x_2,dots,x_n)) is the value of the propositional function (P) at the (n)-tuple ((x_1,x_2,dots,x_n)), and (P) is also called an (n)-place predicate or and (n)-ary predocate

      举例来讲,可以令 (Q(x,y)) 代表 (x+y=3) ,那么 (Q(1,2)) 就是真值,(Q(1,1)) 就是假值。

      做上一节习题的时候不小心用到这个玩意了,,,

    • Quantifiers 即量词。考虑把某个 propositional function 变成一个 proposition ,除了代入具体值意外,还可以通过量词。也就是高中那种内容:(forall x, P(x))(exist x, P(x)) 。还额外附加了一种 (exist!x,P(x)) (或写成 (exist_1x,P(x)) )表示唯一存在。

      优先级方面呢,(forall x P(x) or Q(x)) 实际上的意义是 ((forall x P(x)) or Q(x)) 而不是 (forall x (P(x)or Q(x)))

    • Logic Programming 给了一个逻辑式编程的小例子。

    Exercises

    梦回高中,略。

    1.5 Nested Quantifiers

    • 提示了一些含有多个逻辑量词的命题,确实是超出高中范围了,不过学微积分的时候也教过了。

      (forall x~exist y ,~~x+y=0) 就理解成 (forall x Q(x)), where (Q(x)) is (exist y P(x,y)), where (P(x,y)) is (x+y =0)

      另一个经典的例子是,(lim_{x o x_0} f(x) = C) 的定义即为 (forall varepsilon >0,~exist delta >0,forall x in mathring{U}_delta(x_0),|f(x)-C|<varepsilon)

      否定是需要把量词逐个改掉

    Exercises

    T17

    Express each of these sstem specifications using predicates, quantifiers, and logical connectives, if necessary.

    a) Every user has access to exactly one mailbox

    b) There is a process that continues to run during all error conditions only if the kernel is working correctly.

    c) All users on the campus network can access all websites whose url has a .edu extension.

    d) There are exactly two systems that monitor every remote server.

    Sol

    • a) (forall u,exist_1 m, A(u,m)), where (A(u,m)) means user (u) has access to mailbox (m)

    • b) (exist p, forall e, R(p) and Cond(e) o R(kernel)),

      where (R(x)) means (x) is working / running correctly, and (Cond(x)) means under the (x) condition

    • c) (forall u in Campus ~~forall w ()w.url.find(".edu") != string::npos ( o H(u,w))),

      where (H(u,w)) means the user (u) has access to the website (w)

    • d) (forall r,exist_2s, ~M(s,r)), where (M(s,r)) means (s) monitors (r)

      俺自己发明的符号!难道不能用吗(

      上网了找答案,说的是

      [exist xexist y(x ot=yandforall z ((forall s M(z,s)) leftrightarrow (z=xor z=y))) ]

      where (M(z,s)) means thar system (z) monitors remote sever (s)

      意外地好难啊orz

    T48

    Show that (forall x P(x)or forall x Q(x) equiv forall xforall y(P(x) or Q(y))) , where all quantifiers have the same nonempty domain.

    Sol

    如果 (forall x P(x) or forall x Q(x)) 是真值,讨论可能的情况:

    1. (forall x P(x)) 为真,而 (forall y (Tor Q(y))) 为真,于是 (forall y(P(x) or Q(y))) 为真,从而右式为真。
    2. (forall x Q(x)) 为真,而 (forall x (P(x) or T)) 为真,于是 (forall y(P(x) or Q(y))) 为真,从而右式为真。

    如果左式是假值,那么 (forall x P(x))(forall x Q(x)) 均为假,从而 (exist x, eg P(x),~~exist y, eg Q(y)) ,于是 (exist x exist y eg(P(x)or Q(y))) 。这恰好是右式的否定,从而右式也是假值。

    综合,(forall x P(x)or forall x Q(x) equiv forall xforall y(P(x) or Q(y)))

    T49

    a) Show that (forall x P(x) and exist x Q(x)) is logically equivalent to (forall x exist y (P(x)and Q(y))) , where all quantifiers have the same nonempty domain.

    b) Show that $forall x P(x) or exist x Q(x) $ is equivalent to (forall x exist y (P(x)or Q(y))) , where all quantifiers have the same nonempty domain.

    Sol

    陷在 logically equivalent 和 equivalent 区别的泥淖里畏首畏尾。

    往前翻书试图区别未果,

    google 之倒是有 logically equivalent 和 martial equivalent 的区别:

    https://philosophy.stackexchange.com/questions/65024/what-is-the-difference-between-logical-equivalence-and-material-equivalence

    好像也不太一样(

    所以到底是怎么样呢?

    看答案反推,发现 logically equivalent 只需要前真后即真,equivalent 还需要附加一条后真前即真。

    • a) 如果 (forall x P(x) and exist x Q(x)) 是真值,就需要 (forall x P(x)) 为真且 (exist x Q(x)) 为真。由后者可以得到 (exist y (T and Q(y))) 为真。再由前者就得到 (forall x exist y (P(x)and Q(y))) 为真。于是做完了。

    • b)

      如果 (forall x P(x) or exist x Q(x)) 是真值,讨论可能的情况:

      1. (forall x P(x)) 为真,而有 (exist y (T or Q(y))) 为真,从而 (forall x exist y (P(x) or Q(y))) 为真。
      2. (exist x Q(x))为真,而有 (forall x (P(x)or T)) 为真,从而 (forall x exist y (P(x)or Q(y))) 为真。

      相反地,考虑 (forall x exist y (P(x) or Q(y))) 为真的情况:

      1. (forall x P(x)) 为真,此式显然为真;
      2. 否则,即 (exist x_0 eg P(x_0)) ,在这种情况下此式仍然需要为真,那么就必然有 (exist y Q(y)) 为真。

      综合,两式等价。

    T50, 51, 52

    明天再做吧orz

  • 相关阅读:
    php随笔3-thinkphp 学习-ThinkPHP3.1快速入门(1)基础
    自己动手写PHP MVC框架
    Aptana Studio 3 官方汉化包汉化
    PHP使用手册
    关系型数据库:关系模式设计原则
    Git使用教程
    高并发与负载均衡-nginx-session一致性
    高并发与负载均衡-nginx-安装-配置-location-负载均衡
    高并发与负载均衡-nginx-反向代理概念
    Java-笔记2
  • 原文地址:https://www.cnblogs.com/Shimarin/p/14290638.html
Copyright © 2020-2023  润新知