1 / 61

三个逻辑学家走进酒吧,侍者问:“每个人都要来杯啤酒吗?”第一个逻辑学家说:“我不知道。”第二个说:“我也不知道。”第三个说:“是的!”

逻辑. 三个逻辑学家走进酒吧,侍者问:“每个人都要来杯啤酒吗?”第一个逻辑学家说:“我不知道。”第二个说:“我也不知道。”第三个说:“是的!”. 信息系一共就三个班。今天他对我说,你是 3 班的么?我说,原来你是 2 班的啊!他说,原来你是 1 班啊!. 能否设计一套推理系统,判断所有命题? 能否有一门计算机语言,能够描述自身?. 布尔逻辑. 常量:真,假 运算: n 元组到常量的映射 -a= 真 a*b= 真 a*b*c…= 假. 一元运算 相当于 布尔常量到布尔常量的映射 可以理解为一种二元关系。 例如: Not. Not in ES.

waseem
Download Presentation

三个逻辑学家走进酒吧,侍者问:“每个人都要来杯啤酒吗?”第一个逻辑学家说:“我不知道。”第二个说:“我也不知道。”第三个说:“是的!”

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 逻辑

  2. 三个逻辑学家走进酒吧,侍者问:“每个人都要来杯啤酒吗?”第一个逻辑学家说:“我不知道。”第二个说:“我也不知道。”第三个说:“是的!”

  3. 信息系一共就三个班。今天他对我说,你是3班的么?我说,原来你是2班的啊!他说,原来你是1班啊!信息系一共就三个班。今天他对我说,你是3班的么?我说,原来你是2班的啊!他说,原来你是1班啊!

  4. 能否设计一套推理系统,判断所有命题? • 能否有一门计算机语言,能够描述自身?

  5. 布尔逻辑

  6. 常量:真,假 • 运算:n元组到常量的映射 • -a=真 • a*b=真 • a*b*c…=假

  7. 一元运算 • 相当于 布尔常量到布尔常量的映射 • 可以理解为一种二元关系。 • 例如:Not

  8. Not in ES • In EcmaScript • Logical not is: ! • Bitwise not is:~ alert(!1); //false alert(~1);//-2

  9. Unary Op • 始点集合的每个元素可以指向终点集合的任意元素;每个元素有二种指法。 • 总共有2*2种二元关系 T F T F

  10. 一元运算

  11. BiOp • 二元运算 • 二元组到常量的映射 <F,F> <F,T> <T,F> <T,T> T F

  12. 总共有多少这样的二元运算?(? • 每个二元组可以有两种映射方法,总共有4个二元组, • 2^4 <F,F> <F,T> <T,F> <T,T> T F

  13. and alert(true && false); //false //bitwise alert(3 & 2); //2 alert(-3 & -2); //?

  14. or alert(true || false); //true //bitwise alert(-3 | -2); //?

  15. nor

  16. nand

  17. Xor

  18. Implication ( if |x|>1,then x>1 ) holds if |x|<=1 x>1 other wise, doesn’t hold

  19. iif A B

  20. People on an island understand English but speak their native language. In Da and ja, one means yes and the other no; but whether da means yes or no is unknown. • If you want to know if KadaKata is in the south, and you’re allowed to ask only one question to a person, what should you ask?

  21. Da means yes  K is in the south, right? • If da means yes and k is in the south, • Da • If da means yes and k is not in the south • Ja • If da means no and k is in the south • Da • If da means no and k is not in the south • ja

  22. uttered True Da K is in the south Not uttered (Ja) False K is in the south Da uttered

  23. BiOp’s • …

  24. UnaOp represented by BiOp • 一元元算

  25. n元运算符 • n元函数 • n+1元关系。 • 可以用二元运算表示 • F(x1,x2,…x[n])=F(x1,G(x2,…x[n]))=…

  26. 完备组 • 有一些运算可以表达成其它运算的复合 • 比如:a^b= (a||b) && ! (a&&b) • 如果有些运算可以代替所有的运算,则这些运算是完备的 • ! ,||, && • !, || • !, && In most languages such as ES/natural,…

  27. 最小完备组 • 如果完备运算组合中,去掉任何一个都不行,则称之为最小的 • ! ,||, && ? • ! ,|| ? • ! , && ?

  28. 最小完备组 • 就用一个运算符可能不可能呢? • Nor,或者Nand! • Nor: • Not a=a nor a, a& b=(a nor a) nor (b nor b) • a ||b =(a nor b) nor ( a nor b) • Nand: • Not a=a nand a, a && b=(a nand b) nand (a nand b), a || b= (a nand a) nand (b nand b)

  29. 命题逻辑

  30. 命题逻辑 • 命题: • 陈述句,有对错。真假必居其一, 且只居其一. • 5>3 • 我正在撒谎. —— 悖论,不是命题 • 命题变量 • 有对错,但不知道 • 命题运算仿照bool逻辑

  31. Normal Form • And Form • A and !B and (C or !D) • Or Form • A Or !B or (C and !D)

  32. Predicate

  33. 谓词逻辑 • 带变量的陈述句 • X>3 • 返回值为bool类型的函数 • Arguments 可以任意多个

  34. First Order Logic

  35. First Order Logic • Predicate + Quantifier (∀,∃) • ∀x P(x) ∧ Q(x) • P:x>-1, Q x>0

  36. Free and Bound Variables • An occurrence of variable in a sentence is free if it is not in the scope of any quantifier with the same variable. A non-free variable occurrence is bound. • ∀x P(x) ∧ Q(x) both occurrences of x bound by ∀x • (∀x P(x)) ∧ Q(x) first occurrence of x bound by ∀x, second free • ∀x (R(x, z) ∧ ∃y S(x, y)) both occurrences of x bound by ∀x, occurrence of y bound by ∃y, occurrence of z free • A sentence is open if it contains free variables; it is closed otherwise

  37. Some Op/Func can be regarded as predicate • > • == • != • … • Many Theorems/Axioms are represented in First Order Logic alert(3>4); alert(“”==“a”);

  38. Godel Theorem

  39. Godel’s incomplete theorem • A System cannot be complete if consistent

  40. Example • This sentence is not true

  41. Significance

  42. Application • A system cannot be complete, if consistent • A system can only upgraded from outside. • Never expect a self-evolving model • Otherwise it’s like expecting a perpetual motion machine

  43. Never expect a system • Omni-potent

  44. Self-Describing

  45. Application • A system can only be described from external, higher order language • Care must be taken to separate standard terms to the terms of the language itselfE.g., • type in C# standard and the Type instance in C# language • function in ES standard and the Function instance in ES lang. • Confusion about the two will make your head spin

  46. Example • LiteralVar • Expression • The rules of expression • Language • Production Rules • Courses About Production Rules • Facts • Statistics • Conclusion • Proposition Logic • First Order Logic • …

  47. Second order

  48. Any • Some

  49. Halting Problem

  50. The Halting problem • Given a program P, and input I, will the program P ever terminate? • Meaning will P(I) loop forever or halt? • Can a computer program determine this? • Can a human? • First shown by Alan Turing in 1936 • Before digital computers existed!

More Related