正如讲义终所述,我们不会太担心你使用什么公理【axioms】或逻辑推导【logical deduction】。
任何合理的事情,我们都可以接受。
我们不会要求你知道什么是肯定前件 (Modus ponens),或者在你进行逻辑推理时给某个定律【law】贴上标签。
只要你知道是合理的即可。
在这门数学课程中,你所知道的任何事实【fact】,都很接近可以用作公理【axioms】。
想确保你的公理是一致的【consistent】,这没问题。现在的例外情况是,假设我们正在考试,
我们要求你证明一些命题,p。
现在的例外情况是,假设我们正在考试,我们要求你证明一些命题 p。
你不能说,我已经知道 p,这是一个公理,解答完毕。那不太好。 我们要求您从一些更基本的事实【facts】中证明这一点。
现在我们上一节中介绍的证明,问题集,都是所谓的直接证明【direct proofs】的例子。
你从一些公理【axiom】开始,你有一些你以前知道的定理【theorems】,然后你进行逻辑推理【logical deduction】,直到你到达你想去的地方,即定理【theorems】。
我们今天将从一个间接证明【indirect proof】开始,例如,反证法。
反证法
在反证法中,你的假设与你要证明的相反。然后你只需要一步步地进行逻辑推理【logical deduction】,直到你得出一个矛盾的结论,即证明 false 等于 true。那就意味着你一开始的假设是错的。也就是说,你要证明的必然是真的。
我们把它写下来,因为一开始可能会有点混乱。
反证法:为了证明命题 P ,我们假定 P 为假(即 ¬ P = true),然后你用这个假设【hypothesis】,来推导出一个谬误【falsehood】或者矛盾【contradiction】。
IF ¬ P => false IS true
而根据真值表,¬ P 必然为 false ,因此 P = true
栗子1
证明 是无理数
假定 是有理数
=> = a / b (该分数为最简分数,即a 与 b 哪有公约数)
=> 2 =
=> 2 =
=> 为偶数,a 必然为偶数,即 a 可以被 2 整除法,我们记为(2 | a)
=> 4 |
=> 2 |
=> 为偶数,b 也必然为偶数
=> 矛盾,a 与 b 之间存在公约数
=> 是有理数
QED 或者 口 (表示证明完毕)
false proof
证明 90 比 92 大!!
我将取两个总面积为 90 的三角形放在一起,然后将它们分成四个面积大于 92 的三角形。
通过面积守恒公理,你可能会想到,这将意味着 90 的面积大于 92 的面积。
因此 90 大于 92。
下面就是我的三角形。
它们是直角三角形,9 x 10。
将这两个三角形合并一起,其面试为 9 x 10 = 90
我们沿着对角线进行移动
我将沿着图中虚线截断,你可以看到虚线,是的,不会太精确计算,但它确实比 2 大一点。
我们现在得到如下的图:
我们讲这两个小三角形合并成一个矩形,其面积大于4:
下面的新矩形面积则大于 88
证明 90 > 92!!
因为面积守恒定理吗?
是因为三角形并非等比例画的~~
这也是图片证明或者说PPT证明的问题。
好的,所以对于今天剩下的时间和本周的剩余时间,我们将讨论另一种证明技术,即归纳法【induction】。
归纳法
归纳法是迄今为止计算机科学中最强大和最常用的证明技术。
事实上,如果在我们完成这门课时你会知道一件事,那就是如何进行归纳证明。
归纳公理
P(n) 为一个谓词,
如果P(0) 为真,且 ∀ n ∈ N ,(P(n) => P(n+1) ) 为真,
那么∀ n ∈ N ,P(n) 为真
简而言之,如果P(0)为真,P(1)=>P(2)为真,P(2)=>P(3)为真 ......
则 P(0),P(1),P(2),P(3) ..... 为真。
现在你可以明白为什么公理是合理的:
因为如果P(0)为真,而P(0) => P(1) 为真,那么通过肯定前件或者其他的逻辑推理【logical deductions】,我们知道P(1)也为真。
如果P(1)为真,P(1) => P(2)为真,那么我们可以通过同样的推理,知道P(2) 为真正,以此类推,直到永远。
我们可以将这个过程想象为多米诺骨牌。
例子1
证明 ∀ n >= 0 1 + 2 + 3 + 4 + ...+ n = n(n+1) / 2
首先,我们 需要确定谓词是什么,设 p(n) 是一个命题,即
然后,我们来检查基本情况【base case】,也有人称其为基本步骤【base step】
即 P(0) 为真 check~~
最后,就是归纳步骤【inductive step】,对于 n >= 0,我们要证明 P(n) => P(n + 1) 为真
那么我们如何来证明 P(n) => P(n + 1)这个蕴含为真呢??
因为蕴含只有在 true => false 的情况下为假的,如果P(n) 为假的,我们可以证明蕴含为真,证明结束。我们唯一需要关注的只有P(n) 为真的情况。
因此,我们假定P(n) 为真,并确认 P(n+1) 也为真。
我们假设 P(n) 为真,你也可以写下这是“为了归纳的目的【for purposes of induction】”或“为验证归纳假设的目的【purposes of it verifying the inductive hypothesis】”。 只是让我们知道你为什么假设它。换句话说,出于矛盾的目的,您并没有假设 pn 是正确的。 你假设它是为了归纳的目的。
这意味着:假定 1 + 2 + 3 + ... + n = n * (n + 1) / 2
我们需要证明 1 + 2 + 3 + ... + (n+1) = (n+1) * (n + 2) / 2
1 + 2 + 3 + ... + (n+1) = = =
因此我们证得 ∀ n >= 0 P(n) => P(n+1)
归纳法帮助我们证明定理【theorem】。它是否帮助我们理解了为什么这个定理【theorem】是正确的?看到证明后,你对为什么这个定理是真的有任何感觉吗?
有时归纳会给你一个理解【 understanding】,但有时就没有。
在这里你不明白为什么这个定理是正确的,这有点不幸。
归纳法是否帮助你找出总和【sum】的答案?
也就是说,假设您试图从这个总和( 即 )中得出这个答案(即 )。
归纳法给出你答案了吗?
不,你必须先知道答案,即这个,才能证明它是正确的。
现在稍后我们将看到一些例子,在其中,归纳法实际上可以给你答案的,但通常情况下它并不能。
栗子2
证明 所有的马都是相同的颜色
我们首先给出归纳的谓词,首先,我们排出“所有的马都是相同的颜色”,因为我们无法在“所有”中插入任何东西,既然要归纳,我们需要一个数字 n ,并在其之上进行归纳。
所以我们的谓词为:在任何大于 1 的马的集合上(n >= 1),所有的马均相同颜色。
基本情况【base case】/基本步骤【base step】: P(1) 为真,因为很自由一匹马
归纳步骤【inductive step】: 假定 P(n) 为真,证明 P(n) => P(n + 1) 为真
考虑一个 n+1 的马的集合, h1,h2,h3,h4,h(n+1),
然后h1,h2,h3,h4...h(n) 是相同颜色的马
h2,h3,h4,...h(n+1) 也是相同颜色的马,他也是一个n集合
因为 Color(h1) = Color(h2,h3,...hn) == Color(h(n+1))
所以 Color(h1) = Color(h(n+1))
所以 P(n + 1) 也为真
QED / 口
这是一个错误证明【false proof】,主要的问题点在于,我们我们无法证明P(1) => P(2)
因为在证明P(1) => P(2)时,Color(h1) = Color(h2,h3,...hn) == Color(h(n+1)) 中的纽带Color(h2,h3,...hn)其实是一个空集,无法为Color(h1) = Color(h(n+1))搭起桥梁~~