<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>lr:rss</title>
		<link>http://ccckmit.wikidot.com</link>
		<description>陳鍾誠的首頁 -- 金門大學 資訊工程系</description>
				<copyright></copyright>
		<lastBuildDate>Sun, 19 Apr 2026 08:26:54 +0000</lastBuildDate>
		
					<item>
				<guid>http://ccckmit.wikidot.com/lr:history</guid>
				<title>邏輯學的歷史</title>
				<link>http://ccckmit.wikidot.com/lr:history</link>
				<description>

&lt;h1&gt;&lt;span&gt;簡介&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Tue, 07 Sep 2010 01:46:25 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <h1><span>簡介</span></h1> <p>邏輯學是西方科學中淵遠流長的一門學問，從西元前 350 年亞里斯多德的三段論開始，就開啟了歐洲文明對邏輯學的興趣之窗。然而這一個興趣同樣隨著西方文明的發展而起伏不定，直到西元 1850 年左右，George Boole (布爾) 開始研究布林代數，才讓邏輯學成為近代數學的一個重要領域。接著，Gottlob Frege 在 1870 年左右所提出的一階邏輯系統，繼承布林系統並向上延伸，形成一個數學基礎穩固且強大的邏輯系統，於是整個經典的邏輯系統建立完成。</p> <p>雖然如此，這些邏輯系統仍然是掌上的玩物，而且沒有人能確定這樣的邏輯系統，其能力到底有多強，是否一致且完備，是否有某些極限。希爾伯特在 1900 年所提出的 25 個數學問題中，這個問題被排在第二個提出。然而，希爾伯特並沒有能證明一階邏輯系統的完備性，而是在 1929 年由哥德爾證明完成了。</p> <p>哥德爾的成就不僅於此，1931 年他更進一步證明了一個非常令人驚訝的定理，在「一階邏輯的擴充系統 - 皮諾數論系統」當中，不具有完備性，而且它證明了假如該系統是完備的，將會導致矛盾。</p> <p>哥德爾在證明完備定理與不完備定理時，採用的都是矛盾証法，也就是透過排中律所證明的，這樣的証明並非建構性的，因此即使建立了完備定理，也沒有人能構造出一個建構式的証明方法，可以檢證一階邏輯的定理。</p> <p>1965 年，Robinson 提出了一條非常簡單的邏輯證明規則 &#8212; Resolution，並且說明了如何利用矛盾檢證程序 Refutation，證明邏輯規則在某系統中的真假，這個方法既簡單又優美，因此廣為數學界與計算機科學界所稱道。以下，我們將更詳細的說明上述人物在邏輯學上的貢獻。</p> <h1><span>亞里斯多德 (Aristotle)</span></h1> <p>亞里斯多德在其其理則學 (zoology) 研究中，提出了下列的三段式推論規則 Barbara，簡稱為三段論。</p> <table class="wiki-content-table"> <tr> <td>大前提</td> <td>所有人都終會死亡</td> <td>(普遍原理)</td> </tr> <tr> <td>小前提</td> <td>蘇格拉底是人</td> <td>(特殊陳述)</td> </tr> <tr> <td>結論</td> <td>蘇格拉底終會死亡</td> <td>(推論結果)</td> </tr> </table> <h1><span>布爾 (Boole)</span></h1> <p>Boole 研究邏輯時，提出了一種只有真值與假值的邏輯，稱為二值邏輯，通常我們用 0 代表假值，1 代表真值。布爾研究這種邏輯系統，並寫出了一些代數規則，稱為布林代數，以下是其中的一些代數規則。</p> <table class="wiki-content-table"> <tr> <td>規則</td> <td>名稱</td> </tr> <tr> <td><span class="math-inline">$a \lor (b \lor c) = (a \lor b) \lor c$</span></td> <td>結合律</td> </tr> <tr> <td><span class="math-inline">$a \lor b = b \lor a$</span></td> <td>交換律</td> </tr> </table> <h1><span>福雷格 (Frege)</span></h1> <p>Frege 在研究邏輯系統時，將函數的概念引入到邏輯系統當中，這種函數被稱為謂詞，因此該邏輯系統被稱為謂詞邏輯。然後，Frege 又引入了兩個量詞運算， <span class="math-inline">$\forall$</span> (對於所有) 與 <span class="math-inline">$\exists$</span> (存在)，透過謂詞的限定作用，以及這兩個量詞，Frege 架構出了這種具有函數的邏輯系統，後來被稱為一階邏輯系統 (First Order Logic)。</p> <p>以下是我們將亞里斯多德的三段論，轉化為一階邏輯後，所寫出的一階邏輯規則。</p> <table class="wiki-content-table"> <tr> <td>大前提</td> <td><span class="math-inline">$\forall x \quad people(x) \rightarrow mortal(x)$</span></td> <td>所有人都終會死亡</td> </tr> <tr> <td>小前提</td> <td><span class="math-inline">$people(Socrates)$</span></td> <td>蘇格拉底是人</td> </tr> <tr> <td>結論　</td> <td><span class="math-inline">$mortal(Socrates)$</span></td> <td>蘇格拉底終會死亡</td> </tr> </table> <h1><span>希爾伯特 (David Hilbert)</span></h1> <p>事實上，在電腦被發明之前，數學界早已開始探索「公理系統」的能力極限。在西元 1900 年時，德國的偉大數學家希爾伯特 (Hilbert)，提出了著名的 23 個數學問題，其中的第二個問題如下所示。</p> <blockquote> <p>證明算術公理系統的無矛盾性 The compatibility of the arithmetical axioms.</p> </blockquote> <p>在上述問題中，希爾伯特的意思是要如何證明算術公理系統的 Compatibility，Compatibility 這個詞意謂著必須具有「一致性」 (Consistency) 與「完備性」(Completeness)。</p> <p>所謂的「一致性」，是指公理系統本身不會具有矛盾的現象。假如我們用 A 代表該公理系統，那麼 A 具有一致性就是 A 不可能導出兩個矛盾的結論，也就是 A =&gt; P 與 A=&gt; -P 不可能同時成立。</p> <p>所謂的「完備性」，是指所有合法的算式都是可以被証明或否証的，沒有任何一個算式可以逃出該公理系統的掌握範圍。</p> <p>然而，希爾伯特耗盡了整個後半生，卻也無法證明整數公理系統的一致性與完備性。或許是造化弄人，這個任務竟然被希爾伯特的一位優秀學生 - 哥德爾 (Godel) 所解決了，或者應該說是否決了。</p> <h1><span>哥德爾 (Kurt Gödel)</span></h1> <p>哥德爾實際上證明了兩個定理，第一個是 1929 年提出的「哥德爾完備定理」(Gödel's Complete Theorem)，第二個是 1931 年證明的「哥德爾不完備定理」(Gödel's Incomplete Theorem)，這兩個定理看來似乎相當矛盾，但事實上不然，因為兩者所討論的是不同的公理系統，前者的焦點是「一階邏輯系統」(First Order Logic)，而後者的焦點則是「具備整數運算體系的一階邏輯系統」。</p> <p>哥德爾完備定理證明了下列數學陳述：</p> <blockquote> <p>一階邏輯系統是一致且完備的</p> </blockquote> <p>一致性代表一階邏輯系統不會具有矛盾的情況，而完備性則說明了一階邏輯當中的所有算式都可以被証明或否証。</p> <p>哥德爾不完備定理證明了下列數學陳述：</p> <blockquote> <p>任何一個相容的數學形式化理論中，只要它強到足以蘊涵皮亞諾算術公理，就可以在其中構造在體系中既不能證明也不能否證的命題。</p> </blockquote> <p>哥德爾不完備定理改用另一個說法，如下所示：</p> <blockquote> <p>如果一個（強度足以證明基本算術公理的）公理系統可以用來證明它自身的相容性，那麼它是不相容的。</p> </blockquote> <h1><span>羅賓遜 (John Alan Robinson)</span></h1> <p>雖然哥德爾證明了一階邏輯是完備的，但是卻沒有給出一個建構式的方法，可以推理出所有的的一階邏輯定理。這個問題由 John Alan Robinson 在 1965 年解決了。</p> <p>Robinson 提出的 refutation 邏輯推論法是一種反證法，任何一階邏輯的算式 P 只要在系統 S 當中是真的，只要將 -P 加入該系統 S 中，就可以經由反證法導出矛盾。如果 P 在系統 S 當中不是真的，那麼將 P 加入 S 當中就無法導出矛盾。</p> <p>所謂的 refutation 反證法是依靠一個稱為 resolution 的邏輯規則，該規則如下所示：</p> <span class="equation-number">(1)</span> <div class="math-equation" id="equation-97842-1">\begin{eqnarray} \frac{ a_1 | \ldots | a_i | \ldots | a_n \quad ; \quad b_1 | \ldots | -a_i | \ldots | b_m} {a_1 | \ldots | a_{i-1} | a_{i+1} | \ldots | a_n | b_1 | \ldots | b_{j-1} | b_{j+1} | \ldots | b_m} \end{eqnarray}</div> <p>假如我們將上述算式中的 <span class="math-inline">$a_1 | \ldots | a_{i-1} | a_{i+1} | \ldots | a_n$</span> 寫為 A，將 <span class="math-inline">$b_1 | \ldots | b_{j-1} | b_{j+1} \ldots | b_m$</span> 寫為 B，則上述算式可以改寫如下：</p> <span class="equation-number">(2)</span> <div class="math-equation" id="equation-97842-2">\begin{eqnarray} \frac{ A | a_i ; B | -a_i} {A | B} \end{eqnarray}</div> <h1><span>參考文獻</span></h1> <ol> <li><a href="http://zh.wikipedia.org/zh-tw/%E4%BA%9A%E9%87%8C%E5%A3%AB%E5%A4%9A%E5%BE%B7">維基百科：亞里斯多德</a></li> <li><a href="http://zh.wikipedia.org/zh-tw/%E4%B8%89%E6%AE%B5%E8%AB%96">維基百科：三段論</a></li> <li><a href="http://en.wikipedia.org/wiki/Zoology">Wikipedia:Zoology</a></li> <li><a href="http://en.wikipedia.org/wiki/Aristotle">Wikipedia:Aristotle</a></li> <li><a href="http://en.wikipedia.org/wiki/Boolean_logic">Wikipedia:Boolean Logic</a></li> <li><a href="http://zh.wikipedia.org/zh-tw/%E4%B9%94%E6%B2%BB%C2%B7%E5%B8%83%E5%B0%94">喬治·布爾</a></li> <li><a href="http://en.wikipedia.org/wiki/George_Boole">Wikipedia:George Boole</a></li> <li><a href="http://zh.wikipedia.org/zh-tw/%E6%88%88%E7%89%B9%E6%B4%9B%E5%B8%83%C2%B7%E5%BC%97%E9%9B%B7%E6%A0%BC">維基百科：戈特洛布·弗雷格</a></li> <li><a href="http://en.wikipedia.org/wiki/Frege">Wikipedia:Frege</a></li> <li><a href="http://zh.wikipedia.org/zh-tw/%E5%B8%8C%E5%B0%94%E4%BC%AF%E7%89%B9%E7%9A%8423%E4%B8%AA%E9%97%AE%E9%A2%98">維基百科：希爾伯特的23個問題</a></li> <li><a href="http://aleph0.clarku.edu/~djoyce/hilbert/toc.html">Hilbert's Mathematical Problems</a></li> <li><a href="http://en.wikipedia.org/wiki/Hilbert's_problemsTuring">wikipedia:Hilterg's Problem</a></li> <li><a href="http://zh.wikipedia.org/zh-tw/%E5%93%A5%E5%BE%B7%E5%B0%94%E4%B8%8D%E5%AE%8C%E5%A4%87%E5%AE%9A%E7%90%86">維基百科：哥德爾不完備定理</a></li> <li><a href="http://zh.wikipedia.org/zh-tw/%E5%93%A5%E5%BE%B7%E5%B0%94%E5%AE%8C%E5%A4%87%E6%80%A7%E5%AE%9A%E7%90%86">維基百科：哥德爾完全性定理</a></li> <li><a href="http://en.wikipedia.org/wiki/Kurt_G%C3%B6del">wikipedia:Kurt_Gödel</a></li> <li><a href="http://en.wikipedia.org/wiki/J._Alan_Robinson">John Alan Robinson</a></li> <li><a href="http://en.wikipedia.org/wiki/Resolution_(logic)">Resolution (Logic)</a></li> </ol> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:godelcomplete</guid>
				<title>哥德爾完備定理</title>
				<link>http://ccckmit.wikidot.com/lr:godelcomplete</link>
				<description>

&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;Normalize theorem 
Any first order logic can be rewritten in normal form. 
(Davis and Putnam 1960)

Resolution Complete Theorem : 
  if S is an unsatisfiable set of sentences in clausal form, then the application of a finite number of resolution steps to S will yield a contradiction.
Proof :
  Herbrand universe Hs : Hs = constant symbol + function symbol
  example :
    P(x, F(x,A))&amp;amp;Q(x,A)=&amp;gt;R(x,B)
Hs = {A,B,F(A,A),F(A,B),F(B,A),F(B,B),F(A,F(A,A))..}
Hs = {F(x1,..Xt):xi in Hs or xi is constant}
  Saturation Ps: 
Ps = {P(x1,..Xt):xi in Hs} , P is a predicate.
  Herbrand base :
    Hs = {φi(x1..xt):xi in Hs} , φ is a sentence.
  Resolution closure :
Rs = all clause derivable by resolution on S
Herbrand’s theorem : 
  if a set of ground clauses S’ in S is unsatisfiable then Rs(S’) contain False.
Proof : by contradiction

Collary : Ground Resolution Complete theorem : 
Informal : resolution is complete for ground sentences 
Formal : if Rs(S’) does not contain False then S’ is satisfiable.
Proof : if Rs’ does not contain False then T(S’) construct by the following algorithm satisfy S’

Assignment
input : S’, {A1,..,At}
for i = 1 to t
   if (φ in Hs(S) and literal(φ) = {A1,..,At} 
             and T(A1)=False,..,T(Ai-1)=False, 
            and -Ai in φ )
   then T(Ai) &amp;lt;- False
   else T(Ai) &amp;lt;- True
return : {T(S’)}  
Example :
   S’ = {P(A), P(A)=&amp;gt;Q(A), Q(A)=&amp;gt;False}
   As’= {P(A), Q(A), False }
   Rs’= {P(A), P(A)=&amp;gt;Q(A), Q(A)=&amp;gt;False, Q(A), P(A)=&amp;gt;False, False}

Lifting Lemma : 
Informal : for any ground resolution proof, there is a corresponding proof using the first-order sentences from which the ground sentences were obtained.
Formal: Let C1 and C2 be two clauses with no shared variables, and let C1’ and C2’ be ground instance of C1 and C2. If C’ is a resolvent of C1’ and C2’ then there exist a clause C such that (1) C is a resolvent of C1 and C2 and (2) C’ is a ground instance of C.
Graph :
  C = Resolvent(C1 ,C2 )  C, C1, C2  is first order sentence.
  C’= Resolvent(C1’,C2’)  C’,C1’,C2’ is ground sentence.

example :
  C1 = P(x,F(x,A))&amp;amp;Q(x,A)=&amp;gt;R(x,B)
  C2 = N(G(y),z) =&amp;gt; P(H(y),z)
  C1’= P(H(B),F(H(B),A))&amp;amp;Q(H(B),A)=&amp;gt;R(H(B),B)
  C2’= N(G(B),F(H(B),A))=&amp;gt;P(H(B),F(H(B),A))
  C’ = N(G(B),F(H(B),A))&amp;amp;Q(H(B),A)=&amp;gt;R(H(B),B)
  C  = N(G(y),F(H(y),A))&amp;amp;Q(H(y),A)=&amp;gt;R(H(y),B)

Godel’s Incompleteness Theorem

Number Theory : FOL + (0, S, +, *, ^)

We can number each sentence φ with a unique natural number #φ.  Number theory contains a name for each of its own sentences.
Similarly, we can number each possible proof P with Godel number G(P), because a proof is simply a finite sequence of sentence.

Now we have a set of A of sentences that are true statements about the natural numbers. Recalling that A can be named by a given set of integers, we can imagine writing in our language a sentence

φ(j,A) : 
In informal form :
$i i is not the Godel number of a proof of the sentence whose Godel number is j, where the proof use only premises in A.

In formal form :
k : Godel number of a proof of sentence j
i ≠ k
A : axiom set
I! = proof(A, j)
then proof(#proof, A) = ?
if proof(#proof, A)=True then 
   the procedure proof should return False 
   (by the definition of procedure proof)
ie : proof(#proof, A)=False &amp;gt;&amp;lt;

if proof(#proof, A)=False then
   the procedure proof should return True
   (by the definition of procedure proof)
ie: proof(#proof, A)=True &amp;gt;&amp;lt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sat, 18 Sep 2010 10:20:57 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <div class="code"> <pre><code>Normalize theorem Any first order logic can be rewritten in normal form. (Davis and Putnam 1960) Resolution Complete Theorem : if S is an unsatisfiable set of sentences in clausal form, then the application of a finite number of resolution steps to S will yield a contradiction. Proof : Herbrand universe Hs : Hs = constant symbol + function symbol example : P(x, F(x,A))&amp;Q(x,A)=&gt;R(x,B) Hs = {A,B,F(A,A),F(A,B),F(B,A),F(B,B),F(A,F(A,A))..} Hs = {F(x1,..Xt):xi in Hs or xi is constant} Saturation Ps: Ps = {P(x1,..Xt):xi in Hs} , P is a predicate. Herbrand base : Hs = {φi(x1..xt):xi in Hs} , φ is a sentence. Resolution closure : Rs = all clause derivable by resolution on S Herbrand’s theorem : if a set of ground clauses S’ in S is unsatisfiable then Rs(S’) contain False. Proof : by contradiction Collary : Ground Resolution Complete theorem : Informal : resolution is complete for ground sentences Formal : if Rs(S’) does not contain False then S’ is satisfiable. Proof : if Rs’ does not contain False then T(S’) construct by the following algorithm satisfy S’ Assignment input : S’, {A1,..,At} for i = 1 to t if (φ in Hs(S) and literal(φ) = {A1,..,At} and T(A1)=False,..,T(Ai-1)=False, and -Ai in φ ) then T(Ai) &lt;- False else T(Ai) &lt;- True return : {T(S’)} Example : S’ = {P(A), P(A)=&gt;Q(A), Q(A)=&gt;False} As’= {P(A), Q(A), False } Rs’= {P(A), P(A)=&gt;Q(A), Q(A)=&gt;False, Q(A), P(A)=&gt;False, False} Lifting Lemma : Informal : for any ground resolution proof, there is a corresponding proof using the first-order sentences from which the ground sentences were obtained. Formal: Let C1 and C2 be two clauses with no shared variables, and let C1’ and C2’ be ground instance of C1 and C2. If C’ is a resolvent of C1’ and C2’ then there exist a clause C such that (1) C is a resolvent of C1 and C2 and (2) C’ is a ground instance of C. Graph : C = Resolvent(C1 ,C2 ) C, C1, C2 is first order sentence. C’= Resolvent(C1’,C2’) C’,C1’,C2’ is ground sentence. example : C1 = P(x,F(x,A))&amp;Q(x,A)=&gt;R(x,B) C2 = N(G(y),z) =&gt; P(H(y),z) C1’= P(H(B),F(H(B),A))&amp;Q(H(B),A)=&gt;R(H(B),B) C2’= N(G(B),F(H(B),A))=&gt;P(H(B),F(H(B),A)) C’ = N(G(B),F(H(B),A))&amp;Q(H(B),A)=&gt;R(H(B),B) C = N(G(y),F(H(y),A))&amp;Q(H(y),A)=&gt;R(H(y),B) Godel’s Incompleteness Theorem Number Theory : FOL + (0, S, +, *, ^) We can number each sentence φ with a unique natural number #φ. Number theory contains a name for each of its own sentences. Similarly, we can number each possible proof P with Godel number G(P), because a proof is simply a finite sequence of sentence. Now we have a set of A of sentences that are true statements about the natural numbers. Recalling that A can be named by a given set of integers, we can imagine writing in our language a sentence φ(j,A) : In informal form : $i i is not the Godel number of a proof of the sentence whose Godel number is j, where the proof use only premises in A. In formal form : k : Godel number of a proof of sentence j i ≠ k A : axiom set I! = proof(A, j) then proof(#proof, A) = ? if proof(#proof, A)=True then the procedure proof should return False (by the definition of procedure proof) ie : proof(#proof, A)=False &gt;&lt; if proof(#proof, A)=False then the procedure proof should return True (by the definition of procedure proof) ie: proof(#proof, A)=True &gt;&lt;</code></pre></div> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:folreasoning</guid>
				<title>一階邏輯的推論方法</title>
				<link>http://ccckmit.wikidot.com/lr:folreasoning</link>
				<description>

&lt;p&gt;一階邏輯的推論法則有很多種，但是其中最簡單且優美的莫過於羅氏 (Robinson) 推論法則，該方法只用了一條推論法則 Resolution，然後利用矛盾法進行推論。&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Tue, 07 Sep 2010 03:06:21 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>一階邏輯的推論法則有很多種，但是其中最簡單且優美的莫過於羅氏 (Robinson) 推論法則，該方法只用了一條推論法則 Resolution，然後利用矛盾法進行推論。</p> <p>然而該方法的速度可能會相當的慢，因此假如能將語句限定在 Horn Clause 上，那麼推論時就會變得既簡單又快速，在此我們將介紹這兩種推論方法。</p> <div class="code"> <pre><code>Chapter 9: Inference in first order logic SUBST(b, φ) : the result of applying the substition b to the sentence φ. b is a binding list example : SUBST({x/Sam, y/Pam}, Likes(x,y)) = Likes(Sam, Pam) Inference rule : 1. Universal elimination : $v φ =&gt; SUBST({v, g}, φ) where g is any ground term. 2. Existential elimination : #v φ =&gt; SUBST({v, k}, φ) where k is a constant symbol that does not appear elsewhere. 3. Existential Introduction : φ =&gt; #v SUBST({g/v}, φ) where g is a ground term, v is a variable. Generalized Modus Ponens if SUBST(theta, pi')=SUBST(theta, pi) then p1',p2', ...,pn', (p1&amp;p2&amp;...&amp;pn=&gt;q) =&gt; SUBST(theta, q) Horn Sentence Unification UNIFY(p, q) = theta if SUBST(theta, p)=SUBST(theta, q) where the UNIFY return the Most General Unifier (MGU) example: UNIFY(Knows(John, x), Knows(y, z)) may have {y/John, x/z}, {y/John, x/John, z/John}... but {y/John, x/z} use the least commitment Forward Chaining Algorithm ( is a data-driven (data-directed) procedure) Renaming : Likes(x, IceCream) = Likes(y, IceCream) Composition : COMPOSE(theta1, theta2) SUBST(COMPOSE(theta1, theta2), p) = SUBST(theta2, SUBST(theta1, p)) procedure FORWARD-CHAIN(KB, p) if there is a sentence in KB that is a renaming of p then return Add p to KB // 新加入一條 fact, 盡可能的去觸發所有可能的 unification. for each (p1&amp;...&amp;pn=&gt;q) in KB such that for some i, UNIFY(pi, p)= theta succeeds do FIND-AND-INFER(KB, [p1,...,Pi-1,Pi+1,...Pn], q, theta) end procedure FIND-AND-INFER(KB, premoses, concolusion, theta) if premise = [] then // 本規則完全 unify 成功, 把 conclusion 也加入, 並看能否進一步觸發其它規則. FORWARD-CHAIN(KB, SUBST(theta, conclusion)) else for each p' in KB such that UNIFY(p', SUBST(theta, FIRST(premises))) = theta2 do // 把可以 unify 的規則一直 unify 到無法 unify 為止. FIND-AND-INFER(KB, REST(premise), conclusion, COMPOSE(theta, theta2)) end function BACK-CHAIN(KB, q) returns a set of substitutions BACK-CHAIN-LIST(KB, [q], {}) function BACK-CHAIN-LIST(KB, qlist, theta) returns a set of substitutions input : KB, a knowledge base qlist, a list of conjuncts forming a query (theta already applied) theta, the current substitution local variables : answers, a set of substitutions, initially empty if qlist is empty then return {theta} q = FIRST(qlist) for each qi' in KB such that theta i = UNIFY(qi, qi') succeeds do Add COMPOSE(theta, theta i) to answer end for each sentence (p1&amp;...&amp;pn=&gt;qi') in KB such that theta i = UNIFY(q, q') succeeds do answers = BACK-CHAIN-LIST(KB, SUBST(theta i, [p1,...,pn]), COMPOSE(theta, theta i)) ∪ answers end return the union of BACK-CHAIN-LIST(KB, REST(qlist), theta) for each theta in answers. KB : American(x) &amp; Weapon(y) &amp; Nation(z) &amp; Hostile(z) &amp; Sells(x, z, y) =&gt; Criminal(x) Owns(Nono, x) &amp; Missile(x) =&gt; Sells( West, Nono, x) Missile(x) =&gt; Weapon(x) Enemy(x, America ) =&gt; Hostile(x) FACTS : American(West) Nation(Nono) Enemy(Nono, America) Owns(Nono, M1) Missile(M1) Forward chaining example {American(West)} &amp; Weapon(y) &amp; Nation(z) &amp; Hostile(z) &amp; Sells(West, z, y) =&gt; Criminal(West) {Nation(Nono)} &amp; American(x) &amp; Weapon(y) &amp; Hostile(z) &amp; Sells(x, z, y) =&gt; Criminal(x) {American(West) &amp; Nation(Nono)} &amp; Weapon(y) &amp; Hostile(Nono) &amp; Sells(x, z, y) =&gt; Criminal(West) {Enemy(Nono, America)} ... =&gt; Hostile(Nono) {American(West) &amp; Nation(Nono) &amp; Hostile(Nono)} &amp; Weapon(y) &amp; Sells(West, Nono, y) =&gt; Criminal(West) {Owns(Nono, M1) } &amp; Missile(M1) =&gt; Sells( West, Nono, M1) {Owns(Nono, M1) , Missile(M1) } ... =&gt; Sells(West, Nono, M1) {American(West) &amp; Nation(Nono) &amp; Hostile(Nono) &amp; Sells(West, Nono, M1) } &amp; Weapon(y) =&gt; Criminal(West) { Missile(M1) } ...=&gt; Weapon(M1) {American(West) &amp; Nation(Nono) &amp; Hostile(Nono) &amp; Sells(West, Nono, M1) &amp; Weapon(M1)} ...=&gt; Criminal(West) question sentence found. Backward chaining example ? Criminal(West):?American(West)&amp;?Weapon(y)&amp;?Nation(z)&amp;?Hostile(z)&amp;?Sells(West, z, y): yes ? American(West) : yes-^ ^ ^ ^ ^ ? Weapon(y) : ? Missile(y) : Missile(M1) {y/M1} | | | ? Nation(z) : Nation(Nono) {z/Nono}-------------+ | | ? Hostile(Nono) : yes-----------------------------------------+ | ? Sell(West, Nono, M1) : yes -------------------------------------------+ Forward chaining and Backward chaining is not complete Proof : In Case Analysis KB : $x P(x) =&gt; Q(x) $x -P(x)=&gt; R(x) $x Q(x) =&gt; S(x) $x R(x) =&gt; S(x) --------------- KB ╞ $x S(x) but KB !╞ $x S(x) in Forward chaining and Backward chaining. Complete : if KB╞φ then KB ├ φ by Resolution Procedure Resolution in and/or form (a|b) &amp; (-b|c) =&gt; a|c Resolution in implication form (-a=&gt;b &amp; b=&gt;c) =&gt; -a=&gt;c Generalized Resolution in and/or form [p] = [p1|...pj...|pm] [q] = [q1|...qk...|qn] [p] &amp;[q] =&gt; SUBST(theta, [p]-pj, [q]-qk) where UNIFY(pj, -qk) = theta Generalized Resolution in implication form [p] = [p1&amp;...pj...&amp;pn1] [r] = [r1|........|rn2] [s] = [s1&amp;........&amp;sn3] [q] = [q1|...qk...|qn4] (([p] =&gt; [r]) &amp; ([s] =&gt; [q])) =&gt; SUBST(theta, (([p]-pj)&amp;[s])=&gt;([r]|([q]-qk)))) (where UNIFY(pj, -qk) = theta ) Canonical form for resolution : Conjunctive normal form (CNF) -P(w)|Q(w) P(x)|R(x) -Q(y)|S(y) -R(z)|S(z) Implicative Normal Form (INF) P(w)=&gt;Q(w) True=&gt;P(x)|R(x) Q(y)=&gt;S(y) R(z)=&gt;S(z) P(w)=&gt;Q(w) Q(y)=&gt;S(y) \ {y/w} / P(w)=&gt;S(w) True=&gt;P(x)|R(x) \ {w/x} / True=&gt;S(x)|R(x) R(z)=&gt;S(z) \ {x/A,z/A} / True=&gt;S(A) S(A)=&gt;False \ / True=&gt;False -P(w)|Q(w) -Q(y)|S(y) \ {y/w} / -P(w)|S(w) P(x)|R(x) \ {w/x} / S(x)|R(x) -R(z)|S(z) \ {x/A,z/A} / S(A) -S(A) \ / FALSE Conversion to Normal Form Eliminate implication (p=&gt;q) ├ (-p|q) Move - inwards -(p|q) ├ (-p&amp;-q) -(p&amp;q) ├ (-p|-q) -($x,p)├ (#x -p) --p ├ p Standardize variables rename variable in different scope with different name. Move quantifiers left p|$x q ├ $x p|q Skolemize : removing # by elimination. $x Person(x) =&gt; #y Heart(y)&amp;Has(x, y) -&gt;$x Person(x) =&gt; Heart(F(x))&amp;Has(x, F(x)) Distribute &amp; over | : (a&amp;b)|c -&gt; (a|c)&amp;(b|c) Flatten nested conjunctions and disjunctions : (a|b)|c -&gt; (a|b|c) Convert disjunctions to implications (-a|-b|c|d) -&gt; (a&amp;b=&gt;c|d) Example Proof : In implication normal form : Axiom : #x Dog(x)&amp;Own(Jack, x) $x(#y Dog(y)&amp;Own(x, y))=&gt;AnimalLover(x)) $x(AnimalLover(x)=&gt;($y -Animal(y)=&gt;-Kill(x,y))) $x(Cat(x)=&gt;Animal(x)) Dog(D) Own(Jack, D) Cat(Tuna) Kills(jack, Tuna)|Kills(Curiosity, Tuna) In implication form: $x(#y Dog(y)&amp;Own(x, y))=&gt;AnimalLover(x)) Dog(F1[x]) $x$y(AnimalLover(x)=&gt;(Animal(y)=&gt;-Kill(x,y))) $x(Cat(x)=&gt;Animal(x)) Dog(D) Own(Jack, D) Cat(Tuna) Kills(Jack, Tuna)|Kills(Curiosity, Tuna) Dog(D) Dog(y)&amp;Own(x, y)=&gt;AnimalLover(x) \ / {y/D} Own(x, D)=&gt;AnimalLover(x) Own(Jack, D) {x/Jack} \ / AnimalLover(x)=&gt;(-Animal(y)=&gt;-Kill(x, y)) AnimalLover(Jack) \ / Cat(Tuna) Cat(x)=&gt;Animal(x) Animal(y)=&gt;-Kill(Jack, y) \ / / Animal(Tuna) / \ / -Kill(Jack, Tuna) Kills(Jack, Tuna)|Kills(Curiosity, Tuna) \ / Kill(Curiosity, Tuna) -Kill(Curiosity, Tuna) \ / False In conjunction normal form : -Dog(y)|-Own(x, y)|AnimalLover(x) Dog(F1[x]) -AnimalLover(x)|-Animal(y)|Kill(x,y) -Cat(x)|Animal(x) Dog(D) Own(Jack, D) Cat(Tuna) Kills(Jack, Tuna)|Kills(Curiosity, Tuna) Dog(D) -Dog(y)|-Own(x, y)|AnimalLover(x) \ / {y/D} -Own(x, D)|AnimalLover(x) Own(Jack, D) {x/Jack} \ / -AnimalLover(x)|-Animal(y)|Kill(x, y) AnimalLover(Jack) \ / Cat(Tuna) -Cat(x)|Animal(x) -Animal(y)|Kill(Jack, y) \ / / Animal(Tuna) / \ / -Kill(Jack, Tuna) Kills(Jack, Tuna)|Kills(Curiosity, Tuna) \ / Kill(Curiosity, Tuna) -Kill(Curiosity, Tuna) \ / False Dealing with equality A=B &amp; P(A) cannot unify with P(B), it’s unreasonable. Method 1 : Axiomize equality $x x=x $x,y x=y =&gt; y=x $x,y,z x=y &amp; y=z =&gt; x=z $x,y x=y =&gt; (P1(x)&lt;=&gt;P1(y)) .. .. $w,x,y,z w=y&amp;x=z =&gt; (F(w,x)=F(y,z)) .. .. Method 2 : Demodulation UNIFY(x,z)= theta &amp; x=y, (.. z .. ) =&gt; (.. SUBST(theta, y) ..) Resolution strategy Unit preference (Wos 1964): 短者優先 Set of support (Wos 1965): 1. identify set of support 2. combine(x,y) x in set of support, y in KB Input resolution : combine(x,y) x is input sentence, y in KB In Horn clause , input resolution is complete. Linear resolution (Loveland 1968): if P=&gt;..=&gt;Q then Q, Q then Unify(P,z), Unify(Q,z) should be done together. Subsumption : eliminates all sentences that are subsumed by an existing sentence in the KB. Example : if P(x) in KB then P(A) should be deleted from axiom.</code></pre></div> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:fol</guid>
				<title>一階邏輯簡介</title>
				<link>http://ccckmit.wikidot.com/lr:fol</link>
				<description>

&lt;p&gt;布林邏輯、謂詞邏輯與一階邏輯是最常被使用的兩種邏輯系統，布林邏輯在電路設計上有強大的用途，而一階邏輯則成為人工智慧領域的理論基礎。&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Tue, 07 Sep 2010 03:03:02 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>布林邏輯、謂詞邏輯與一階邏輯是最常被使用的兩種邏輯系統，布林邏輯在電路設計上有強大的用途，而一階邏輯則成為人工智慧領域的理論基礎。</p> <p>謂詞邏輯乃是布林邏輯的延伸，此種邏輯具有一種類似布林函數的基本元素，通常稱為謂詞 (Predicate)，因此稱為謂詞邏輯 (Predicate Logic) 。</p> <p>一階邏輯乃是謂詞邏輯的延伸，包含兩個很特別的量詞運算，全部 (forall) 與存在 (exist) 等，如果我們不處理這兩個運算，則將退化為謂詞邏輯。</p> <p>由於引入謂詞之後，就必然要面對到底是全部還是部分的問題，因此通常我們所稱的謂詞邏輯就是一階邏輯。</p> <h1><span>人工智慧版</span></h1> <div class="code"> <pre><code>Chapter 7: First order logic Constant + Predicate + Function = First Order Logic Term : Constant , variable or Function Ground Term : A term with no variable Atomic Sentence : Predicate with parameter. Complex Sentence : Sentence with logical connective. Quantifier : $, #, #!, Second Order Logic : $p φ Situation calculus : 1. Special time sequence variable called situation : S0,S1,S2,.. , St, … 2. Result(action, Si)=Si+1 3. Effect axiom : axioms that make the world change. Ex: -Hold(x, Result(Release, s)) 4. Frame axioms : axioms that describe how the world stay the same. Ex: -Hold(x,s)^(a≠Grab├(Present(x,s)^Portable(x))=&gt;-Hold(x,Result(a,s)) 5. Successor-state axiom = Effect axiom + Frame axiom Ex: Hold(x,Result(a,s)) &lt;=&gt;[(a=Grab^Present(x,s)^Portable(x))|(Hold(x,s)^a≠Release)] Representational Frame Problem : The proliferation of frame axioms (solved by Successor-state axiom) Inferential Frame Problem : When reasoning about the result or a long sequence of action in situation calculus, we have to carry each property through all intervening situation one step at a time, even if the property remain unchanged throughout.(this is why that special purpose reasoning system such as planning system is needed). Qualification : it’s difficult to define the circumstances under which a given action is guaranteed to work. Ramification Problem : it’s almost impossible to describe all the implicit consequence of actions. Deduce Hidden Properties of the World Synchronic rules : relate properties of a world property of the world causes certain percepts to be generated. (Type1) Causal rules : Conclusion =&gt; Environment (Type2) Diagnostic rules : Percept =&gt; Conclusion</code></pre></div> <h1><span>計算理論版</span></h1> <div class="code"> <pre><code>Chapter 5: First Order Logic Syntax : Vocabulary : Σ = (Φ, π, r) Φ : a set of function symbol π : a set of relation symbol r : Φ ∪ π --&gt; N , arity function Remark1 : if f in Φ and r(f) = 0 then f is called a constant Remark2: We can treat Boolean logic as a special case of first order logic, in which Φ = empty and r(p) = 0 for all p in π Remark3: The text book require the arity of a relation symbol cannot be 0, in which case lemma 2 does not apply. V = {x, y, z, ... } , a countably infinite set of variable T(Φ, V) : set of terms (1) V in T(Φ, V) (2) if f in Φ , r(f) = k and t1... tk in T(Φ, V) then f(t1...tk) in T(Φ, V) A(Φ, π, V) : set of atomic expression if p in π, r(p) = k, t1...tk in T(Φ, V) then p(t1...tk) in A(Φ, π, V) F(Φ, π, V) : set of first order expression(first order formulas) (1) A(Φ, π, V) in F(Φ, π, V) (2) if φ, ψin F(Φ, π, V) then -φ, φ|ψ, φ  ψin F(Φ, π, V) (3) if φ in F(Φ, π, V) and x in V then x φ, x φin F(Φ, π, V) f(x)|g(x) is wrong P(f(x))|Q(g(x)) is correct. Model Theory of First Order Logic : Given Σ a model appropriate to Σ is a pair of M = (U, μ) where U ≠ Empty U : universe of M μ: V-&gt; U , for every variable we assign an interpretation X(μ) for every function f in Φ of arity k , μ assign a function f(μ): Uk-&gt;U for every predicate P in π of arity k, μ assign a set of k tuple Pk in Uk Given formula Φin F(Φ, π, V) μ satisfied Φ iff (1) Φ is an atom P(t1,…,tn) and &lt;t1M…tnM&gt; in PM Example : M satisfied P(a,x) if aM=0 , xM=3, PM = {&lt;x,y&gt;; x &lt; y} (2) Φ IS -P and M satisfied P (3) Φ is P&amp;Q and M satisfied P and M|=Q Φ is P|Q and M satisfied P or M|=Q Φ is P=&gt;Q and M not satisfied P and M|=Q (4) Φ is X P and for every u in U μ(x=u) |= P Φ is X P and there is a u in U s.t. μ(x=u) |= P Given M, u in U definedμM(x=u)=u Proposition : let P be an expression, and M as M' be two model s.t. they differ only on variables in P, then M|=P iff M'|=P Remark : when consider the satisfiability or validity of sentence we do not need to worry about how the variable are interpreted in the model. A sentence is valid if it is true in all models. A sentence is unsatisfiable if it is not true in any model. Theorem : there is a model N' s.t. for all sentence P expressible in the language of number theory , N|=P iff N'|=P Remark : Axiomitization (N cannot be axiomitization by the language of N, but G, N mod p can ) Proof Theory : Axiom 0 : tautulogies Axiom 1 : 1. t=t 2. t1 = t1' &amp; t2=t2' &amp;…&amp;tn=tn'  f(t1,..,tn) = f(t1',..,tn') 3. t1 = t1' &amp; t2=t2' &amp;…&amp;tn=tn' &amp; R(t1,…,tn)  R(t1',.., tn') Axiom 2 : x PP[x=t] when t is a term Axiom 3 :P x P x is not free in P Axiom 4 : x (PQ) (x P xQ) Modus Ponens P; PQ  Q example : P(f(a), x)|Q(f(y), g(a, y)) --&gt; ψ  P(f(a), x)|Q(f(y), g(a, y)) --&gt; F Example : number theory Φ = {0, succ, +, *, ^ } π = { &lt; } // recall that = is always exist Note 1 : we can use 1 as a shorthand for succ(0) Example : graph theory Φ = Empty π = {G} r(G) = 2 Undirected Graph xy G(x,y)  G(y,x) Transitivity xyG(x,y) &amp; G(y,z)  G(x,z) A variable is free if it is not within the scope of any x or x Otherwise, x is bound A sentence is a FOE without any free variable. Theorem : For any expression φ over Σ(G), the problem φ-graph is in P Semantic : Proposition 1 : if φ is unsatisfiable (has no model) then ╞ -φ An expression is unsatisfiable iff its negation is valid. 2 : Boolean Validity : Suppose that Boolean form of an expression φ is a tautology, then φ is valid. 3 : Equality : (t1=t1' &amp; ... &amp; tk = tk') =&gt; f(t1,...,tk)=f(t1',...,tk') (t1=t1' &amp; ... &amp; tk = tk') =&gt; R(t1,...,tk)=R(t1',...,tk') 4 : Quantifiers : 4.1 Any expression of the form φ =&gt; φ[x&lt;-t] is valid. 4.2 If φ is valid, then so is xφ 4.3 If x does not appear free in φ, then φ =&gt; x φ is valid. 4.4 For all φ and ψ, (x (φ=&gt;ψ)) =&gt; ((x φ)=&gt; (x ψ)) Hilbert Style Proof Theory 1. Axioms : AX0: Any expression whose boolean form is a tautology. example : x P(x) =&gt; x P(x) , its boolean form (A=&gt;A) is a tatulogy. x P(x) =&gt; P(X), has no exact boolean form. AX1: AX1a: t = t for every t in T(F, x) AX1b: t1=t1'&amp;t2=t2'&amp;..&amp;tn=tn' =&gt; f(t1,...,tn)=f(t1',...,tn') AX1c: t1=t1'&amp;t2=t2'&amp;..&amp;tn=tn'&amp;R(t1,...,tn)=&gt; R(t1',...,tn') AX2: Any expression of the form x φ=&gt;φ[x&lt;-t] AX3: Any expression of the form φ=&gt;x φ, with x not free in φ AX4: Any expression of the form (x (φ=&gt;ψ))=&gt;( xφ=&gt; xψ) illogical 不合邏輯的 alogical 非關邏輯的 Derivation (├) given a set of expression Δ and an expression φ, Δ├φ (Δ derive φ or φ is a theorem of Δ) if there is a finite sequence of expression (φ1,..., φn) s.t : (1) φn = φ (2) For all 1≦i≦n φI in Λ ∪ Δ or j,k&lt;i s.t φj is φk=&gt;φi If ├φ then φ is a theorem Theoremhood : Given φ , is ├φ Theorem : Theoremhood is recursive enumerable Deductive Theorem If Δ ∪ {φ} ├ ψ then Δ ├ φ=&gt;ψ Proof: (Induction in the length of sequence of derivation) Consider a proof of S=(φ1,...,φn) of ψ from Δ ∪ {φ} (ie : φn = ψ) Suppose that for all j&lt;i, φ=&gt;φj if φi in Δ ∪ Λ then φi (by hypothesis), φi=&gt;(φ=&gt;φi) (by axiom) so φ=&gt;φi else // if φi not in Δ ∪ Λ then the proof include φ=&gt;φj, φ=&gt;(φj=&gt;φi) (by induction hypothesis) and (φ=&gt;φj)=&gt;((φ=&gt;(φj=&gt;φi))=&gt;(φ=&gt;φi)) is a tautology so (φ=&gt;(φj=&gt;φi))=&gt;(φ=&gt;φi) by MP φ=&gt;φi by MP so by induction, Δ ├{φ}=&gt;φn(= ψ)</code></pre></div> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:boolean</guid>
				<title>布林邏輯</title>
				<link>http://ccckmit.wikidot.com/lr:boolean</link>
				<description>

&lt;p&gt;布林邏輯在電路設計上有強大的用途，是最簡單的邏輯系統，由於是喬治、布林(George Boole)所建立的基礎理論，因此被稱為布林邏輯。&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Tue, 07 Sep 2010 02:43:10 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>布林邏輯在電路設計上有強大的用途，是最簡單的邏輯系統，由於是喬治、布林(George Boole)所建立的基礎理論，因此被稱為布林邏輯。</p> <p>布林所提出的真值表，是布林邏輯中最基礎也最重要的方法，在布林邏輯中，每個值都只能是真的或假的，不可以是其他值。這種非真即假的特性，稱為「排中律」，我們可以將「排中律」寫成下列公式。</p> <blockquote> <p>P | -P =&gt; true // P 或 -P 中必然有一者為真。</p> </blockquote> <h1><span>人工智慧版</span></h1> <div class="code"> <pre><code>Chapter 6 : Agent that reason logically Syntax : Describes the possible configurations that can constitute sentences. Semantic : Determines the facts in the world to which the sentences refer. interpretation for syntax Proof theory : A set of axiom + a set of inference rule. Proper reasoning should ensure that the new configurations represent facts that actually follow from the facts that the old configurations represent. ╞ (entail) (proof by truth table) KB ╞ φ means for all case -KB|φ is always true ├ (derive) (proof by axiom and inference rule) KB ├ φ means that we can derive φ from KB by axiom and inference rule. i Sound : An inference procedure i that generates only entailed sentences is called sound or truth-preserving. !├ φ &amp; -φ Proof : The record of operation of a sound inference procedure is called a proof (proof theory). 1. KB + {φ1...φi-1} =&gt; φi ( φn = φ ) 2. For every i≦n φi in KB or φi is an axiom. Complete : An inference procedure is complete if it can find a proof for any sentence that is entailed. if φ is valid then ├ φ (Natural language have evolved more to meet the need of communication rather than representation.) Shapir-Whorf hypothesis : the language we speak profoundly influences the way in which we think and make decision. entail Sentences -----------&gt; Sentence ↓ ↓ Facts -----------&gt; Fact follow (理論與世界同構) Valid sentence : (tautologies , analytic sentences) A sentence that is true under all possible interpretations in all possible worlds. Satisfiable sentence : there is some interpretation in some world for which it is true. PL : propositional logic FOL : First Order Logic TL : temporal logic PT : probability theory FL : Fuzzy logic Ontological Commitment Epistemological Commitment (What exist in the world) (What an agent believes about facts) PL = (&amp;,|,-) + proposition true/false/unknown FOL = (&amp;,|,-) + proposition + function + predicate true/false/unknown TL = (&amp;,|,-) + proposition + function + predicate + times true/false/unknown PT = proposition degree of belief 0..1 FL = degree of truth degree of belief 0..1 Model : any world in which a sentence is true under a particular interpretation is called a model of the sentence under that interpretation. A sentence φ is entailed by a KB if the models of KB are all models of φ. ie : KB ╞ φ ==&gt; ╞ KB=&gt;φ, ie: KB=&gt;φ is valid. Prepositional logic : Syntax : 1. A set of proportion {A, B, C,...} in this language 2. All form of P&amp;Q, P|Q, -P (P=&gt;Q) in this language 3. No other things is in this language Semantic : 1. P =&gt; {T, F} 2. P Q -P P&amp;Q P|Q P=&gt;Q F F T F F T F T T F T T T F F F T F T T F T T T A sentence is valid if it's true in all row of truth table. Proof Theory Inference rule : Modus ponens : A=&gt;B, A --&gt; B And Elimination : A1&amp;A2...&amp;An --&gt; Ai And Introduction : A1,A2,...An --&gt; A1&amp;A2...&amp;An OR Introduction : Ai --&gt; A1|A2...|An Double Negation : --A --&gt; A Unit Resolution : A|B, -B --&gt; A Resolution : A|B, -B|C --&gt; A|C implication form : -A=&gt;B, B=&gt;C --&gt; -A=&gt;C Complexity of prepositional inference : SAT problem in set NP-complete Horn sentence : P1&amp;P2...&amp;Pn=&gt;Q HORN-SAT in set P Monotonically : if KB1╞A then (KB1 ∪ KB2)╞A</code></pre></div> <h1><span>計算理論版</span></h1> <div class="code"> <pre><code>Proof Theory A set of axiom + A set of inference rule Δ├ φ ( Δ deduce φ, φ is a theorem of Δ) if there is a sequence of boolean expressions (φ1, .., φn) such that (1) φn is φ (2) for every i≦n, φi in Δ or φi is an axiom. Soundness : A proof theory is Sound if for every φ,├φ ==&gt; ╞ φ Completeness : A proof theory is complete if for every φ,╞ φ==&gt;├φ To prove soundness need to prove : 1. Axiom are sound : For every axiom φ, NIL=&gt;φ 2. Inference are sound : MP: if ╞ X and ╞ (X=&gt;Y) then ╞ Y Boolean Logic Syntax : Boolean variable X = {x1, x2,... , xn...} logical connectiver : &amp;, or, -, =&gt; Boolean expression (BE) (1) Every variable is a BE (2) If a, b is BE, so is a&amp;b, a or b, -a, a=&gt;b (3) Nothing else is a BE Semantic : Truth assignment ==&gt; T:X -&gt; {T, F} (1) Given T, Boolean expression φ, (T╞ φ) (2) φ is a&amp;b ==&gt; T╞ a and T╞ b (3) φ is -a ==&gt; not T╞ a (4) φ is a or b ==&gt; T╞ a or T╞ b (5) φ is a=&gt;b ==&gt; T╞ -a or T╞ b (6) φ is ab ==&gt; T╞ (a=&gt;b) &amp; T╞ (b=&gt;a) φ is satisfiable if there is a T s.t T╞ φ φ is valid if T╞ φ for all T in which all variable assignment in φ // If φ is valid we also call φ a tautology φ is unsatisfiable if there is no T s.t. T╞ φ Atom : a variable Literal : an atom or it's negation Clause : a disjunction of literals Set of clauses : S = a conjunction of clauses S = {c1, c2, …, cn} = c1 &amp; c2 &amp; ... &amp; cn A propositional formula is in clausal form if it is represented as a set of clauses. Every boolean formula can be expressed in clausal form. To decide if φ is valid, both Davis-Patumn method and Ground resolution convert -φ into clausal form then try to prove that it is unsatisfiable. Truth Table Proof Theory φ is valid iff T╞ φ for the 2^n truth assignment in which validity the n variable of φ appear Hilbert style proof theory : (logical induction system) Axiom : (1) a=&gt;(a=&gt;a) (2) a=&gt;(b=&gt; a&amp;b) (3) a&amp;b =&gt;a (4) a&amp;b =&gt;b (5) a=&gt; a or b (6) b=&gt; a or b (7) (a or b) =&gt; ((a=&gt;r)=&gt;((a=&gt;b)=&gt;r)) (8) (a=&gt;b) =&gt; ((a=&gt;(b=&gt;r))=&gt;(a=&gt;r)) (9) (a=&gt;b) =&gt; ((a=&gt;(-b))=&gt;-r) (10)--a=&gt;b Inference Rule : Modus Ponens : a, a=&gt;b ==&gt; b Gentzen style proof theory (Sequent Calculus) Axiom : (1) T,φ ├ Δ,φ (2) T∪{φ} ├ Δ∪{φ} Inference Rule : // &quot;,&quot; 在左邊表示 &amp; // &quot;,&quot; 在右邊表示 or // &quot;;&quot; 表示兩式之 &amp; // 目的：不斷縮短算式的長度。 (&amp;├) (├&amp;) T, a, b ├ Δ T ├ a, Δ ; T ├ b, Δ ----------------------------- ---------------------------- T, a &amp; b ├ Δ T ├ a &amp; b, Δ ( or ├) (├ or ) T ├ Δ, a; T ├ Δ, b T ├ Δ, a, b ----------------------------- ---------------------------- T a or b├ Δ T ├ Δ, a or b (-├) (├ -) T ├ Δ, a T, a ├ Δ ----------------------------- ---------------------------- T, -a ├ Δ T ├ Δ, -a (=&gt;├) (├ =&gt;) T ├ Δ,a; T, b ├ Δ T, a ├ Δ, b ----------------------------- ---------------------------- T, a=&gt;b ├ Δ T ├ a=&gt;b (cut rule) T, a =&gt; Δ; T =&gt; Δ, a ------------------------- + (cut elimination theorem) = complete. T =&gt; Δ 若我們把 cut rule 用 (-├) 移位，則 cut rule 變成 T, a, -a ├ Δ Sequent : T=&gt;Δ where T,Δ are finite sets of BE's {φ1,...φn}=&gt;{ci1, ...cim} Informally we want to capture φ1,...,φn =&gt; ci1,...cim Davis Patumn proof method : Method : divide and conquer S ---------------------------- P = true ; P = false S[p = true] S[p=false] Case 1 : Unit clauses rule : S&amp;{L}  S{Ltrue} Case 2 : Elimination rule : S&amp;{Ci|L}  S Case 3 : Split rule : S  S[Ptrue] ; S[pfalse] Theorem : S is unsatisfiable iff all sets producted for Davis Patumn are unsatisfiable. φ = {(p|q) &amp; (-q|s) &amp; (-s|p) &amp; (-p|r) &amp; (-r|-p|t) }  (t &amp; -r) -φ = (p|q) &amp; (-q|s) &amp; (-s|p) &amp; (-p|r) &amp; (-r|-p|t) &amp; (-t | r) S ------------------------------------------------- S[p=true] ; S[p=false] {-q|s, r, -r|t, -t|r} {q, -q|s, -s, -r | -t} --------unit clause of r ----------------unit clause of -s {-q|s, t, -t} {q, -q, -r|-t} ------------- ---------------- false false If there is a P s.t P, -P in S then S is unsatisfiable. Ground Resolution Proof Theory Methodology : To prove that φ is valid, we prove that -φ is unsatisfiable instead. Inference Rule : c or x; d or -x --------------- c or d Example : s = { p or q, -p or r, -r or -s or t, q or s, -q , -r or -t} p or q -p or r \ / -r or -t q or r -r or -s or t \ / \ / q or -t q or -s or t \ / q or -s q or s \ / q -q \ / False Completeness of ground resolution theorem : φ is valid iff NIL can be deduced from S using ground resolution. Proof : Given a set of propositional variable {p1, ..., pn} A semantic tree is S T F p1 T F T F p2 P3… Each nodes represents is a partial interpretation of the variables assigned so far, where values are indicated as labeled as the edges. If S is unsatisfiable, S=c1&amp;c2&amp;...&amp;cn Then each ci is a false A tree in which all pathes ends in a falsified node is called a closed semantic tree. Proposition : If S is unsatisfiable then one can get a closed semantic tree no matter how the variable are ordered. Proof of proposition Choose the (longest) path from the closed semantic tree. / / \ T F D|-P C|P Then ground resolution will produce C|D By induction , ground resolution is complete. Refinement 1 : Ordered ground resolution (assumed there is an ordering on variable, any order is good) If P is the longest atom assigning, C|P &amp; D|-P  C|D Refinement 2 : Positive ground resolution (Choose the rightest path with all positive asignment) Refinement 3 : positive ordered ground resolution (Choose the all positive clause with longest path) The Refinement doesn't means that the produced proof will be shorter than resolution. It means that the choosing space of each step is small than the resolution case. My Refinment : Shortest first ground resolution My Refinment : Prune the other branch that is not needed any more. P|-q  prune the -p&amp;q Boolean Ring : 設計理念： 把所有的 boolean expression 分成 class partition, 利用 normal form 來比較是否相等。 literal : . and + exclusive or 1 true 0 false Axiom : a set of rewrite rules which are used to perform reduction. . + : commutative and associative. x+y = y+x x.y = y.x (x+y)+z = x+(y+z) (x.y).z = x.(y.z) Inference Rule : x or y ==&gt; x.y + x + y x =&gt; y ==&gt; xy + x + 1 x = y ==&gt; x + y + 1 -x ==&gt; x + 1 x + 0 ==&gt; x (identity) x . 0 ==&gt; 0 (zero) x . 1 ==&gt; x (unit) x . x ==&gt; x (idempotent law) x + x ==&gt; 0 (nilpotent law) x + y = y + x (communicative law) x . y = y . x (x+y).z ==&gt; xz + yz (distributive law) (x + y)+ z = x + (y + z) (associative law) (x . y) . z = x . (y . z) monomial : product of distinct variables xyz, z, 1 polynomial : sum of distinct monomials xy + x + xyz = 1 Boolean ring normal form Canonical rewrite system BR (Hsiang, 1982) X | y -&gt; xy + x + y X = y -&gt; x + y + 1 -x -&gt; x + 1 x =&gt; y -&gt; xy + x + 1 x + 0 -&gt; x x + x -&gt; 0 x . 1 -&gt; x x . 0 -&gt; 0 x . x -&gt; x x . (y+z)-&gt; xy + xz Claim : Every Boolean expression has a unique boolean ring normal form which can be obtained through reduction. (Any Boolean formula can be uniquely translate into an equivalent BRNF.) Example : absorption law : p or (p&amp;q) = p ppq + p + pq ==&gt; pq + p + pq ==&gt; p + 0 ==&gt; p Proof : Method 1: arguing by contradiction. If BRNF is not unique then There are two BRNF (p1, p2) for some case Such that p1+p2 = m1 + m2 + … =0 Let m1 be the shortest monomial in p1+p2, Let all variable in m1 be 1, and the other variable be 0, then p1+p2 (m1 = 1) = 1, contradiction -&gt;&lt;- Method 2: counting argument M1 + m2 + … + mk There are 2n monomial for n variable expression, So there are 2^2n BRNF for n variable expression, It can be 1-1 mapping to Boolean function. Theorem： valid 1 φ is { unsatisfiable } if its BNF is { 0 } satisfiable but not valid otherwise Remark : A BRNF is 0, 1 or m1+...+mr where each mi is a conjunction of boolean variable and the mi's are distinct from each other. Inference mechanism : reduction : given φ, reduce φ using BR until no any reduction can be done. Boolean ring equations : (x | y | -z) &amp; (-x | -y | -z) &amp; (y | -z | -t) if we want to satisfy the equation above then y | -z | -t = 1 De Morgan's law  -(y | -z | -t) = 0 so -y &amp; z &amp; t = 0 (Replace &amp; by ., - by 1+) (1+y) . z . t = 0 (expand the equation ) zt + yzt = 0 a expression x1 | x2 | .. | xn wan be rewrite to a BRNF with 2n-1 urinal , so operator | is expensive. Simplification F = (x | y) &amp; (x | -y) &amp; (-x | y) &amp; (-x | -y) Calculation : Xy + x + y + 1 = 0 0 = 0 + 0 + 1 , contradiction -&gt;&lt;- so F is unsatisfiable. Xy + y = 0 0 + y = 0, y = 0 Xy + x = 0 0 + x = 0, x = 0 Xy = 0 let xy = 0 ↑ Simplification is sound, however, not complete. For example : Xy = 1 Yz = 1 Xz = 0 can not be simplified. Superposition (最小公倍式) Example 1 : Xy = 1 xyz = z z = 0 Yz = 1 xyz = x x = 0 Xz = 0 xyz = 0 0 = 0 Xx = x Yy = y Zz = z Example 2 : Xyz = z + 1 Xyzt = (z + 1) . t xyz = t Xyt = xy + zt Xyzt = (xy + zt) . z z = t + 1 M1 = m2  m1m1' M1' = m2' m2(m1m1'/m1) m2'(m1m1'/m1') Simplification + superposition + idempotent law  complete {x|y, -x|s, -y|t, -s|t, -t|s, -s|-t} xy = x + y + 1 xs = x yt = t st = s st = t st = 0 Davis-Putnum in Boolean ring Variety -- number of different variable in an equation. Degree -- length of the largest nominal in an equation Length -- (distinct monomials) in an equation Eample : Xyz + zy + ut + 1 variety = 5, degree = 3, length = 4 Linear : degree &lt;= 1 X+y+z = 1, x+1 = 0, 1 = 0, … Binomial : length &lt;= 2 Xyz + xu = 0, xy + t = 0, … Quadratic : Variety &lt;= 2 Xy + x + y = 0, x+y+1 = 0, x+1 = 0,… Theorem Linear equation can be solved in time O(n3) (by Gaussian Elimination) Binomial equation can be solved in linear time. ( = HORN-SAT) Quadratic equations can be solved in linear time. (= 2-SAT) A reasoning model of Binomal-Linear Binomial equations B  optimize Linear equations L  optimize ↑ lift Unit equations U Important : All Boolean function can transform into the linear + binomial + unit equation by adding variable. Inference rules 1. Tautology Deletion S'{0=0} =&gt; S' S'{1=1} =&gt; S' 1 = 0 =&gt; unsatisfiable 2. Decomposition B'{x1'.x2'…xm'}  1} =&gt; B'{x1'-&gt;1, x2'-&gt;1, …,xm'-&gt;1} 3. Simplification Perform only with B or L, but not across them. 4. Unit Rule : Collect all equations x=0 or x=1 into U, Use U to simplify B, L. 5. Splitting Rule : U =&gt; U{X1} ; U{X0} 6. Transportation Given y1+y2+…+yk-1+yk = 0, where c in {0, 1} Add y1y2..yk = y1y2..yk-1 . c to B when K is odd. Add y1y2..yk = y1y2..yk-1 . (c+1) to B when K is even. Example X+y = 1 =&gt; xy = 0 X+y = 0 =&gt; xy = x X+y+z = 1 =&gt; xyz = xy, xyz = xz, xyz = yz X+y+z = 0 =&gt; xyz = 0 Discovering essential rules by local search V : the set of variables A : assignment on V For all X in V , either x = 0 in A or x = 1 in A, but not both P : partial assignment, subset of A  : Complete fence the set of partial assignments, such that given any (full) assignment A on V, P in  with P is subset of A f(x1,x2..,xm) : Schema Example : if f(x,y) = x+xy then f(x,y) = {x+xy, y+yx} fr(P) : the set of unit literals that can be inferred in (B; L; U) without the Splitting Rule. 1. Predetermine a set of schemata F. 2. Choose a complete fence  3. For each P in , evaluate fr(P) 4. W in V , with for any x in W, either x = 0 in fr(P) or x = 1 in fr(P) for all P in . 5. Bind W with f in F Find instances of f that output the same value for all p in  P1 P2 ... Pm Fr(P1) fr(P2)... fr(Pm) W ↓ F Ex : F = {x+y, xy, xy+x, x} Let F(x1, …, xm) and F'(x1', …, xm') be different formulations of the same boolean function (with xi  xi') Then F  F' can be proved Example： X1 : x+y, x1': (x|y)&amp;(-x|-y) X2 : 1+z+t x2': (z|-t)&amp;(-z|t) F(x1,x2) = x1+x2 F'(x1',x2') = (x1'|x2') &amp; (-x1'|-x2') To prove (X+y) + (1+z+t)  (((x|y)&amp;(-x|-y)) | ((z|-t)&amp;(-z|t))) ^ (-((x|y)&amp;(-x|-y)) | -((z|-t)&amp;(-z|t))) Ordered binary decision diagram (OBDD) (R. E. Bryant 1986) 1. graph based NF 2. unique wrt the variable (node : CNF , DNF : no unique normal form, no variable sharing too)(BRNF : no variable sharing too) Provide an efficient way to manipulate Boolean function X Y Z F G F&amp;g F|g F=&gt;g 0 0 0 0 0 0 0 1 0 0 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 0 0 1 0 0 1 0 0 1 1 0 1 0 1 1 1 0 1 0 0 0 0 1 1 1 0 0 1 0 1 1 1 1 1 1 1 1 1 1 Assume an ordering on variable X1 &lt; X2 &lt; ... &lt; Xn X1X2X3' + X1X2X3 X1 X1 X1 1/ \ / \ / | X2 X2 X2 X2 X2 | 1/ \ / \ =&gt; /\ /\ =&gt; / \ | X3 X3 X3 X3 1 0 0 0 1 0 / \ / \ /\ / \ 1 1 0 0 00 0 0 Idea : using Shannon entropy φ : Boolean expression φ = φ(x=1)*X + φ(x=0)*X' transform φ into its BDD give order X1&lt;...&lt;Xn Expansion X Share t ==&gt; X t1==&gt;X X&lt;==t2 X / \ |\ /| =&gt; / \ φ(X=1) φ(X=0) |/ \| ts tu ts tu Delete Merge t1==&gt;X t1==&gt;t2 t1 t2 t1 t2 | | ==&gt; | | \ / t2 t3 t3 t3 Theorem : OBDD is unique for any given φ and order. 2SAT in P A clause is definite iff it has exactly one positive literal. A clause is Horn iff it has at most one positive literal HORNSAT : HORNSAT in P (3SAT is NP complete) HORN = DEF + NEG example : (-x|-y|-z|-w|u)&amp;(-x|-y|z)&amp;(-z|-w|v)&amp;(-x|-z|w) &amp;(-x|-y)&amp;(-x|-z|-u) &amp; x &amp; y We consider a truth assignment T as a set that contain all variable assigned value true. HORN-ASSIGN(φ) returns T T := empty loop Pick one unsatisfied x1&amp;…&amp;xn =&gt; y from Def T := T ∪ {y} until all clauses in Def are satisfied end Example : (in HORN example above) {x, y, z, w, v, u} will added into T in sequence. Claim 1 : The T produced satisfy all implication in φ Claim 2 : If there is a T’ that satisfies all implication in φ then T in T’ Proof : Let y be the first variable in T\T’ then there is a clause x1&amp;..&amp;xn =&gt; y s.t. x1,..,xn in T ∩ T’, so T’ !╞ (x1&amp;..&amp;xn=&gt;y) -&gt;&lt;- Claim 3 : φ is satisfiable iff T╞ φ Proof : &lt;= trivial =&gt; by way of contradiction if T!╞φ then there is a claim -x1&amp;..&amp;-xn in φ s. t. T!╞-x1|..|-xn ie : {x1,..,Xn} in T If T’╞φ by claim 2 (T in T’) then T!╞{-x1,..,-xn} Every set of boolean formula can be express as a set of clauses, each of which has almost 2 positive literal. A|B|C|-D  (A|B|-T)(T|C|-D) Under HORN : classical logic and intuitionistic logic are the same. Classic Logic : law of excluded middle p|-p = true Intuitionistic logic : No law of excluded middle. Example : P(x,0,x) P(x,y,z)P(x,s(y),s(z)) // meaning : P=add Proof 1 : Exist z, P(5, 3, z) P(x,0,x) -P(x,y,z) | p(x,s(y),s(z)), -P(5,3,z) -P(5,2,z-1) -P(5,1,z-2) P(x, 0, x) bind -P(5,0,z-3) // z-3 = 5 NIL (z-2=6, z-1=7, z=8) // The resolution above is what we called input resolution Input Resolution  backward reasoning In every resolution steps, one of the clauses must be an input clause. Proof 2 : Exist z, P(5, 3, z) P(x,0,x) -P(x,y,z) | p(x,s(y),s(z)) P(x,s(0),s(x)) P(x,2,x+2) P(x, 3, x+3) bind P(5, 3, z) // x = 5, z = x+3 = 8 // The resolution above is what we called unit resolution Unit Resolution  forward reasoning In every resolution steps, one of the clauses must be a unit clauses. Theorem : In HORN logic, both unit and input resolution are complete. (Remark : not true in First Order Logic)</code></pre></div> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:incompletetheory</guid>
				<title>哥德爾不完備定理 (Godel Incomplete Theorem)</title>
				<link>http://ccckmit.wikidot.com/lr:incompletetheory</link>
				<description>

&lt;h1&gt;&lt;span&gt;Godel incomplete theorem&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sat, 18 Sep 2010 08:28:50 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <h1><span>Godel incomplete theorem</span></h1> <p>Any theory that contains formal number theory is either incomplete or inconsistent. (N, 0, succ, +, *, &gt;, =)</p> <div class="code"> <pre><code>Sound : every theorem is a logically valid well form formula. Consistent : no well form formula V such that { |-V } and { |- not V }. Complete : every logically valid well form formula is a theorem. Incomplete Theorem : Natural Number System is consistent but incomplete, that is, there is a closed well form formula V such that neither { |- V } nor { |- not V }</code></pre></div> <div class="code"> <pre><code>Chapter 6 : Undecidability in Logic N=(Φ, π, r) Φ = { 0, s, +, *, ^ } π = { &lt;, = } r = { &lt;(2) , =(2) } Axiom for number theory N (Inductive definition) NT1 : x (s(x) ≠ 0) // NT1~NT3 for Natural number NT2 : x,y (s(x)=s(y) =&gt; x=y) NT3 : x (x=0 | y s(y)=x) NT4 : x (x+0 = x) // NT4~NT5 for + NT5 : x,y (x+s(y) = s(x+y)) NT6 : x (x*0 = 0) // NT6~NT6 for * NT7 : x,y (x*s(y) = x*y+x) NT8 : x (x^0 = 0) // NT8~NT9 for ^ NT9 : x,y (x^s(y) = (x^y)*x) NT10: x,y (x &lt; s(x)) // NT10~NT13 for &lt; NT11: x,y (x&lt;y =&gt; s(x)≦y) NT12: x,y (-(x&lt;y) =&gt; y≦ x) NT13: x,y,z (x&lt;y &amp; x&lt;z =&gt; y&lt;z) // NT14 for mod NT14: x,y,z,z' (mod(x,y,z) &amp; mod(x,y,z') =&gt; z=z') NT = NT1~NT14 NT15φ : φ(0) &amp; x (φ(x)=&gt;φ(s(x)))=&gt; x φ(x) // Induction Axiom (問題： NT15φ 不是 first order formula ) NT ├ ? example : NT├x,y (x+y = y+x) if we don't use the axiom NT15φ, we cannot prove this example. we can only prove that special case of this example. NT ├ 3+5 = 5+3 3+5 = s^3(0) + s^5(0) 5+3 = s^5(0) + s^3(0) = s(s^3(0) + s^4(0)) , by NT5 = s^(s^5(0) + s^2(0)) ... ... = s^5(s^3(0) + 0) = s^5(s^3(0) + 0) = s^8(0) ==by NT4= = = s^8(0) A First order sentence is ground (variable-free) if it does not contain any variable. Theorem : if φ is a ground sentence in N then N╞φ iff N├φ Bounded quantifier: x (x&lt;5 =&gt; φ(x)) ==&gt;  (x&lt;5) φ(x) x (x&lt;s(x) =&gt; φ(x)) ==&gt;  (x&lt;s(x)) φ(x) Bounded prenex form (b.p.f) : A sentence is in bounded prenex form if all quantifier (bounded or unbounded) precede the rest of expression. Bounded sentence : In it's b.p.f , all of it's universal quantifier is bounded. example : x&lt;3yz&lt;x+y φ(x,y,z) Theorem : let φ be a bounded sentence, then N╞φ iff NT├φ Proof : by induction on number of quantifiers x 不需要是 bounded, 因為我們可以一個一個試，直到找到為止 (r.e) x 一定要是 bounded, 因為若不是 bounded, 不管我們怎麼試，永遠無法確定x φ 是否成立。 Theorem : Bounded sentences = TM (Meaning : Bounded sentences are sufficient to express computation !) Without Lost of Generality (WLOG), assume TM's with 1. single tape 2. stop at &quot;yes&quot;, &quot;no&quot;, or does not stop. 3. never write a right(&gt;) symbol 4. when stops, the cursor goes to the right end of the used tapes, then stop. Given TM, M=(K, Σ, δ, s) Encode symbol as numbers symbol : Σ = {0, 1, 2, ... , |Σ|-1} State : K = {|Σ|, ... , |Σ|+|K|-1 } Start : s = |Σ| right : &gt; = 0 blank : _ = 1 &quot;yes&quot; = |Σ| + 1 &quot;no&quot; = |Σ| + 2 let b = |Σ| + |K| Configuration (snap shot) (w1, w2, ..., wm, q, u1, ... , un) is encoded as : Σ wi*b^(m+n+1-i) + q*b^n + Σ ui*b^(n-i) example : Σ = {&gt;, _, a, b} K = { s, &quot;yes&quot;, &quot;no&quot;, q } 0 1 2 3 4 5 6 7 (&gt; a a _ s b a b } 0 2 2 1 4 3 2 3 Problem : How to formulate δ into ground equation δ(a, q) = (b, p, D) s state symbol δ s q (s, a, -&gt;) s b (s, b, -&gt;) s _ (q, _, &lt;-) q &gt; (q, _, -&gt;) ... a s _ = a _ s (2 4 1 =&gt; 2 1 4) a s a = a a s (2 4 2 =&gt; 2 2 4) a s b = a b s (2 4 3 =&gt; 2 3 4) _ s = q a (1 4 =&gt; 7 2 ) ... table(x, y) = (x=241 &amp; y=214) | (x=242 &amp; y=224) | ... | (x=243 &amp; y=234)|(x=14 &amp; y=72) | ... pads(x, x') // append _ at the end = y&lt;b (mod(x, b, y) &amp; y&gt;|Σ| ) =&gt; x' = x*b+1 ( if tail(x)=y and y is a state then x' = concat(x, _) conf(x) // x is an encoding of an configuration = (y&lt;x z&lt;x state(x, y) &amp; state(x, z) =&gt; z = y &amp; nonzeros(x)) (解釋： x have only one state digit, only one &gt;(0) in the head) ( if both x[y] &amp; x[z] are state then y=z) nonzeros(x) = y&lt;x u&lt;x (mod(x, b^y, u) &amp; (mod(x, b^(y+1), u) =&gt; x = u) (解釋: if substr(x, y, tail) = substr(x, y+1, tail) then x=substr(x, y+1, tail)) state(x, y) // yth digit is a state = z&lt;xw&lt;x div(x, b^y, z) &amp; mod(z, b, w) &amp; |Σ| ≦ w) (解釋： yStr = substr(x, y, tail); w = y[0](note: w = y[0] = x[y]); w &gt; |Σ|) yield(x, x') // x' is the next configuration after x = pads(x, x') | y&lt;x z1&lt;x z2&lt;x z2'&lt;x z3&lt;x z3'&lt;x z4&lt;x conf(x) &amp; conf(x') &amp; mod(x, b^y, z1) &amp; div(x, b^y, z2) &amp; mod(x', b^y, z1) &amp; div(x', b^y, z2') &amp; mod(z2, b^3, z3) &amp; div(z2, b^3, z4) &amp; mod(z2, b^3, z3') &amp; div(z2', b^3, z4) &amp; table(z3, z3') (解釋： x cursor 在最後且 x'=concat(x, _) 或 x 與 x' 都是合法的 configuration 且 且 x 依據 cursor 所在的位置分成 4 個小段 x = z1z2 &amp; z2 = z4z3 z4 z3 [-...-][---] ---------------------- &lt;==== x [-... ---][-...] z2 z1 z4'=z4 z3' [-...-][---] ---------------------- &lt;==== x' [-... ---][-...] z2' z1'=z1 且 z3--&gt;z3' 可以在 table 上查得到。) comp(x) // comp(x) formulate a computing sequence = y1&lt;xy2&lt;xy3&lt;xz1&lt;xz2&lt;xz3&lt;xu&lt;xu'&lt;x ((mod(x,b^y,z1) &amp; mod(x,b^(y+1),z1) &amp; div(x,b^(y+1),z2) &amp; mod(z2,b^y2,u)&amp;mod(z2,b^(y2+1),u)&amp;div(z2,b^(y2+1),z3)&amp; mod(z2,b^y2,u')&amp; mod(z2,b^(y3+1),u') &amp; conf(u) &amp; conf(u')) =&gt; yield(u', u)) &amp; (u&lt;x mod(x,b^2,u)=&gt;(u=b*(|Σ|+1) | u = b*(|Σ|+2))) &amp; (u&lt;x y&lt;x (div(x,b^y,u) &amp; u&lt;b^2 &amp; b≦ u)=&gt; u = b*|Σ|) （解釋： the sequence of computation x0 =&gt; x1 =&gt; ... =&gt; xn where xi is configuration and xi =&gt; xi+1 is legal transformation and xn is halting state say &quot;yes&quot; or &quot;no&quot; and x0 is in start state &gt;s&gt;） Two language L1, L2 are recursively inseparable iff doesn't Exist recursive set R s.t. L1 ∩ R = empty and L2 in R property : If L1 and L2 are recursively inseparable and L1 ∩ L2 = empty then neither L1 nor L2 is recursive. Theroem 3.3 If L1 = {M:M(M)=&quot;yes&quot;} and L2={M:M(M)=&quot;no&quot;} then L1 and L2 are recursively inseparable. Proof: By way of contradiction, if Exist recursive set R s.t. R ∩ L1 = empty and L2 in R, Let MR be a TM that decides R ie: MR(x)=&quot;yes&quot; if x in R MR(x)=&quot;no&quot; if not x in R If MR(MR) = &quot;yes&quot; then MR in L1 ∩ R ≠ empty (by Def of L1) &gt;&lt; If MR(MR) = &quot;no&quot; then MR in L2 (by Def of L2) and MR not in R (by Def of MR) &gt;&lt; Collary 3.4 If L1' = {M:M(NULL) = &quot;yes&quot;} and L2' = {M:M(NULL) = &quot;no&quot;} then L1' and L2' are recursively inseparable. Proof : For any M, define TM M'M(x) = M(M) let R' recursively separate L1' and L2' define M&quot;(x) = if x is an encoding of TM M', then generate M'M, if M' in R' then &quot;yes&quot; else &quot;no&quot; (ie: if M'M(x) = &quot;no&quot; then &quot;yes&quot; else &quot;no&quot;) then R = {x: M&quot;(x) = &quot;yes&quot;} is decidable Claim : R recursively separate L1 and L2 &gt;&lt; Proof of Claim : (1) R ∩ L1 = empty If M in R =&gt; M&quot;(M) = &quot;yes&quot; =&gt; MM' in R' =&gt; not MM' in L1' =&gt; MM'(NULL) ≠ &quot;yes&quot; =&gt; not M in L1 &gt;&lt; (2) L2 in R M in L2 =&gt; M(M) = &quot;no&quot; =&gt; MM'(NULL) = &quot;no&quot; =&gt; MM' in L2' =&gt; MM' in R' =&gt; M&quot;(M) = &quot;yes&quot; =&gt; M in R &gt;&lt; 因為theorem 3.3 已經證明了 L1, L2 是 recursive inseparable, 但若假設 R 是 recursive, 則可證出 R 會 recursive separate L1, L2, 因此、R 必然不是 recursive. ╞φ,NT├φ,N╞φ,NT╞-φ,NT├-φ,╞-φ --- ---- ---------- ----------- ---------------- ------------------ ╞φ =&gt; NT├φ by godel completeness theorem  φ (N╞φ &amp; NT!├φ) by godel incomplete theorem None of the boundary above is recursive Theorem 6.3 |= -φ and {φ:NT├φ} are recursively inseparable. Proof : Idea : Given M, use Corollary 3.4 , find a sentence s.t. If M(NULL) = &quot;yes&quot; iff NT ├ φM &quot;no&quot; iff |= -φM By way of contradiction, If so, then there exist a recursive R s.t {φ:NT╞φ}in R and R ∩ {φ:|= -φ} = empty then define R' = {M:M in R and M is an encoding of a TM} then {M:M(NULL) = &quot;yes&quot;} in {M:NT├φM} in R' and {M:M(NULL) = &quot;no&quot; } in {M:|=-φM} ∩ R' = empty &gt;&lt; (because these two set are r.i) φM = NT &amp; ψ M where ψ =  x (Comp(x) &amp;  y&lt;x -Comp(y) &amp; mod(x, b^2, (|Σ|+1)*b)) (解釋： x is the least number that encode computation of M input NULL and the computation ends in &quot;yes&quot;) Corollary 6.3.1: The following problem are undecidable Given φ (1) is φ valid ? {φ:|= φ} (ie : THEOREMHOOD is undecidable) (2) Does N |= φ ? {φ:N|=φ} (3) Does NT ├ φ ? {φ: NT ├ φ} Corollary 6.3.2: Godel incompleteness theorem (Weaker version) (1931) There is no recursively enumerable set of axiom A s.t φ A├φ iff N╞φ Proof : If such an A exist, then Th(A)={φ:A├φ} is r.e. by definition , φ N╞φ or N╞-φ then Th(N) = {φ:N╞φ} = Th(A) is r.e Th(N)' = {φ:N╞-φ} is r.e (because it's equal to Th(N)) so Th(N) is recursive &gt;&lt; (Because by the corollary 6.3.1, THEREMHOOD is undecidable) Remark : Godel theorem holds for the theory of (N, 0, s, +, *, &lt;, =), But the theory of (N, 0, s, +, *, &lt;, =) is decidable. (Presburger 1929) Equality processing : “=” assume the fllowing axioms x x=x E(x,x) x x=y  y=x -E(x,y) | E(y,x) x x=y&amp;y=z  x=z -E(x,y) | -E(y,z) | E(x,z) For each f of arity n x1=y1&amp;..&amp;xn=yn  f(x1,..,xn) = f(y1,..,yn) (-E(x1,y1) |..|-E(xn,yn)|E(f(x1,..,xn),f(y1,..,yn)) For each p of arity n x1=y1&amp;..&amp;xn=yn&amp;P(x1,..,xn)  P(y1,..,yn) (-E(x1,y1) |..|-E(xn,yn)|-P(x1,..,xn)|P(y1,..,yn) How to deal with “=” in theorem proving ? 1. Add an uninterpreted predicate symbol E. and add all the axioms as clauses. And then Use resolution (problem : generate to many clauses) 2. Define a new inference rule to deal with “=” Paramodulation C|s=t, D[u]  (C|D[t])x // u is a subterm of D, if sx = ux x=mgu(s,u) (Was Robinson 67) Theorem : S in FOL += is unsatisfiable iff resolution + paramodulation produce NIL from S Union { f(x1,.., xn) = f(x1,..,xn) }  function reflexible axioms (FRA) Remark : (1) Does R+P still complete without the FRA (Assume yes) (2) Paramodulation should not be done “into” a variable. (is it complete under this condition) Focus a Equational Theory Assume that “=” is the only predicates In this case, paramodulation becomes s=t; r[u] = v  r[t]x = vx (where ux=sx u is non-variable subterms of r) Example : 1. a=b; f(a)=c  f(b)=c 6. f(a)=b; g(f(x))=x  g(b)=a Rewrite method : Group theory x * x^-1 = e x * e = x (x*y)*z = x*(y*z) If we use resolution, then it may fall into infinite loop because (x*y)*z = x*(y*z) = (x*y)*z … Rewrite method : x * x^-1  e “” notion of simplification x * e  x should be a well founded ordering (x*y)*z  x*(y*z) No S1-&gt;S2-&gt;… infinite chain. Given a set of equation E={s=t} How to find a well-founded ordering &gt; s.t E can be converted into {si-&gt;ti} where si &gt; ti ? Let T be the set of term and &gt; be a irreflexive, transitive relation in T, (&gt;,T) is a simplification ordering if (1) if s &gt; t then sx &gt; tx (2) if s &gt; t then u[s] &gt; u[t] (3) if s is a proper subterm of u (u[s]) then u[s] &gt; s Theorem : Dershowitz 82 A simplification ordering is well-founded Term rewriting theory</code></pre></div> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:completetheory</guid>
				<title>哥德爾完備定理 (Complete Theory)</title>
				<link>http://ccckmit.wikidot.com/lr:completetheory</link>
				<description>

&lt;p&gt;Proposition : 簡單的 theorem , 常識的定理 (forward reasoning)。&lt;br /&gt;
Lemma : 為證明此 theorem 所需的輔助定理（引理 backward reasoning）。&lt;br /&gt;
Theorem : 欲證明的定理。&lt;br /&gt;
Collary : 由此定理所導出來的有用的衍生定理。&lt;/p&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;Arguing by contradiction theorem
If Δ ∪ {-φ} is inconsistent then Δ├φ
(Δ is inconsistent if Δ├φ or -φ
Proof:
if Δ ∪ {-φ} is inconsistent then Δ ∪ {-φ}├φ,
by Decuctive Theorem, Δ ├ {-φ}=&amp;gt;φ, ie Δ├φ 
(because-φ=&amp;gt;φ == φ , 
 by Hilbert style (Δ├-φ=&amp;gt;φ)=&amp;gt;φ, Δ├-φ=&amp;gt;φ, so Δ├φ by MP)

Prenex Normal Form :
Proposition : Let A and B be arbitrary first-order expressions. Then :
1. (x A &amp;amp; x B) = x (A&amp;amp;B)
2. If x does not appear free in B, (x A &amp;amp; B) =  x (A&amp;amp; B)
3. If x does not appear free in B, (x A | B) = x (A| B)
4. If y does not appear in A, x A = y A[x&amp;lt;-y]
5. -x B = x (-B)
6. -x B = x (-B)
7. x A  B = x (AB)
8. x A  B = x (AB)

An expression is said to be in prenex normal form if it consists of a sequence of quantifiers, followed by an expression that is free of quantifiers.

Theorem : Any first-order expression can be transformed to an equivalent one in Prenex normal form.

Skolemization (Just like Henken’s witness)
    Given a sentence in P.N.F.
    x1x2x3 A(x1,x2,x3…) --&amp;gt;  x1x2x3 A(x1,x2,f(x1,x2),…)
    where f is called skolem function, is a function never appeared in the vocabulary before
    x1x2x3x4x5x6 P(x1,x2,x3,x4,x5,x6) --&amp;gt;  x2x3x5 P(c,x2,x3,f(x2,x3),x5,f(x2,x3,x5))
A sentence is in clausal form if it is skolemize into 
x1x2x3…xn S
Where S is a conjunction of clauses

Property : Every sentence has a equivalent clausal form 
    S : set of clauses = {c1,c2,.., cn}
Theorem 4.1 : Given a sentence A and its equivalent set of claim S, A is inconsistent iff S is inconsistent.

From now on , we don’t tgalk about sentence , only S
Herbrand Universe (H = set of ground terms)
Herbrand base = {p(t1,..,tn) : P is a predicate symbol and t1,t2,…,tn in H}
        = the set of ground atomic
A ground instance of a clause C is a clause obtained from replacing its variables uniformly by terms in H.
    C = p(x,y) | -q(x, f(x)), | r(y)
M = (H, PM)
PM in Hn
Example : 
    F = {a,b, f:uniary}
    H = {a,b,f(a),f(b),f(f(a)), f(f(b)),...}
    If we have 2 uniary predicate symbols p,q
        A = {p(a), p(b), q(a), q(b), p(f(a)), q(f(a)), p(f(b)),…}
    M1:A  {T,F}
    M2:A  {T,F}
Herbrand interpretation =&amp;gt; A syntactic model with H as its universe
(Note : this is a syntactic model, so f(a) doesn’t have to be element of U, just element of H)
    I1 = {p(a),q(a),-p(b),-q(b),-p(f(a)),-q(f(a)),…}

Theorem : A set of clause S is unsatisfiable iff it is false in all Herbrand interpretation
Let A = {A1,A2,…} be the Herbrand base of S

Clause Semantic tree.
A1    A2    A3 …
1
1    0
1    0    1
        0
        1
    1    0
0    0    1
        0

Herbrand Theorem : first version
    S is unsatisfiable iff corresponding to all semantic tree of S, there is a closed semantic tree. (Otherwise , there must be a interpretation with infinite length satisfied S)

Herbrand Theorem : second version
    S is unsatisfiable iff there is a finite set of ground instances of S where conjunction is unsatisfiable.

Ground resolution  complete ^ lift to first order logic

Resolution S                         First order logic
down to  Herbranditize lift to    

Unification 
    Subsitution
    S(v)  T(F,V) // set of terms
    s.t. 
1.    not S(x) = x for finitely many xs
2.    {x: not S(x)=x} intersect {y : not S(x)=x and y is a variable in S(x)} = empty then 
   S is a substitution
Example :
    S1:     xf(z)        S1 is a substitution
        ya
    S2: xf(x)        S2 is not a substitution (because cycle, recursive sutstitute error!)
        ya
    S3: xf(y)        S3 is not a substitution,     xf(a)
        ya            but may rewrite into         ya
    S4: xf(y)        S4 is not a substitution, cannot rewrite.
        yf(x)
two expression t and s are unifiable it there is a substitution S s.t. sS=tS

f(x,g(y,z),a) unified f(h(w),w,z) by assign
xh(w)            h(g(y,a))
S=     wg(y,z)g(y,a)
za

f(x,g(y,z),a) cannot unified to f(h(w),w,z)

If S is a substitution s.t sS = tS then S is a unifier of s and t
S is a most general unifier (mgu) of S and t if 
(1)    S is a unifier of S and t
(2)    For any unifier S1 of s and t, there exist a substitution S2 such that S*S2=S1

Theorem (Robinson)
    If s and t are unifiable then the mgu of s and t is unique upon renaming
Resolution
    s =(S) t    (see if s and are unifiable, If so return an mgu)
    {s1 =(S)t1,..,sn=(S)tn}

1. Decompose 
S union {f(s1,..,sn) =(S) f(t1,..,tn)}  S Union {s1=(S)t1, .., sn=(S)tn}
2. Clash
S union {f(s1,..,sn) =(S) g(t1,..,tm)  NIL        //  not f=g
3.    Delete
S union {s=s}  S                                
4.    Replace 
S Union {x=(S)t}  S[xt] union {x=(S)t}        // x is not in t
5.    Occurs Check 
S union {X=(S)

Justified generalization theorem
  If Δ├φ, x is not free in Δ then Δ├x φ
Proof:
(Induction in the length of sequence of derivation, too)
Consider a proof of S=(φ1,...,φn) of φ from Δ (ie : φn=φ)
suppose that for all j&amp;lt;i, φ=&amp;gt;φj
Δ├xφj for all j&amp;lt;i
if φi in Λ then
   x φi is an axiom, too (by AX3)
else if φi inΔ then
   φi (by hypothesis), φi=&amp;gt;x φi(by AX3) so x φi
else // notφi in Δ∪Λ
   φi obtain from φj, φj=&amp;gt;φi by modus ponens , 
   x φj (by induction hypothesis), x (φj=&amp;gt;φi) 
   (becauseφj=&amp;gt;φi is an theorem in φ1..φi ∪ Δ ∪ Λ, too)
   x (φj=&amp;gt;φi)=&amp;gt;(( x φj)=&amp;gt;( x φi)) (it&#039;s a tautology)
   so (x φj)=&amp;gt;( x φi)
   so x φi.

Rewrite theorem 
  If φ and ψ are identical except that φ has free occurrences of x exactly at those position that ψ has free occurrence of y, then x φ=&amp;gt; x ψ.

Proof the completeness of axiom system
  Δ╞φ =&amp;gt; Δ├φ

Soundness of ├

  Δ├φ =&amp;gt; Δ╞φ

Proof : By induction on the length of derivation

Godel&#039;s Completeness Theorem
1st form : Δ╞φ =&amp;gt; Δ├φ
2nd form : if Δ is consistent then Δ has a model satisfy it
( Δ is consistent if it is not inconsistent)
1st form &amp;lt;= 2nd form
Proof :
  if Δ╞φ (and Δ is consistent) ==&amp;gt; Δ∪{-φ} has no model satisfy it then by Arguing by contradiction theorem , Δ├φ.
1st form =&amp;gt; 2nd form
Proof :
  suppose Δhas no model , then -Δis valid
  but Δis consistent, so 
      Δ!├φ&amp;amp;-φ
      Δ=&amp;gt;φ&amp;amp;-φis unsatisfiable
      -Δ|(φ&amp;amp;-φ) is unsatisfiable
      -Δis unsatisfiable &amp;gt;&amp;lt; (because -Δis valid)
  so by Arguing by contradiction theorem, Δhas a model.
Proof of 2nd form
Proof :
  Basic : given Δ over vocabulary Σ, Δ is consistent

  Idea : (1) Enlarge Δ to a manually consistent set Δ&#039;
         (2) Build a model for Δ&#039;
  M = (U, μ) is an interpretation
  Assume a consistent Δ 
  (ex :{-P(a), -P(b), x P(x)} U={a,b} then expand U={a,b,c})
Idea : 
  For each x P(x), construct a constant &amp;quot;witness&amp;quot; called Henkin
  constant)

Step1: Add new constants c1,c2,... to Σ called the resulting alphabetΣ&#039;
Claim : Δ remain consistent over Σ&#039;
proof of claim :
  Suppose there is a proof (φ1,...,φn) s.t. Δ├φ&amp;amp;-φ that involve some
  constant ψ, but there are no ψ in axiom, so ├ψ in some step, replace all 
  ψ with xi for some variable that not show up elsewhere, once again 
  Δ├φ&amp;amp;-φ (after replace ψ with xi)
  so, Δ is inconsistent, &amp;gt;&amp;lt;.
Step 2: Enlarge Δ to a consistent and complete set Δ&#039;
(note : Δ&#039; is complete if for every expression φ, φin Δ&#039; or -φ inΔ&#039;)
Let{φ1,φ2,φ3,...}be an enumeration of all expression overΣ&#039;
Define : 
Δ(0) = Δ
Δ(i+1) : 
case 1: 
   if Δ(i-1) ∪ {φi} is consistent, and not φi = x ψ then
      Δ(i) = Δ(i-1) ∪ {φi}
case 2: 
   if Δ(i-1) ∪ {φi} is consistent, and φi = x ψ then
   (Let c be a constant not appearing in any one of 
   the expressions φ1,...,φi-1)
   Δ(i)=Δ(i-1) ∪ {x ψ, ψ[x&amp;lt;-c]}
case 3: 
   if Δ(i-1) ∪ {φi} is inconsistent, and not φi=x ψ then
      Δ(i)=Δ(i-1) ∪ {-φi}
case 4: 
   if Δ(i-1) ∪ {φi} is inconsistent, and φi = x ψ then
      Δ(i)=Δ(i-1) ∪ {-x ψ, -ψ[x&amp;lt;-c]}

Claim: For all i≧0, Δ(i) is consistent
Proof of Claim :
case 1 : 
  Δ(i) = Δ(i-1) ∪ {φi} is consistent (by case hypothesis)
case 2 : 
  Δ(i) = Δ(i-1) ∪ {x ψ, ψ[x&amp;lt;-c]} is consistent,
case 3 : 
  Δ(i) = Δ(i-1) ∪ {φi} is inconsistent and Δ(i-1) is consistent
  , Δ(i-1)├-φi (Arguing by contradiction),
  so Δ(i) ∪ {-φi} is consistent
case 4 : 
  Δ(i) = Δ(i-1) ∪ {-x ψ, -ψ[x&amp;lt;-c]}
  if Δ(i) is inconsistent then
     Δ(i-1) ∪ {-ψ[x&amp;lt;-c]}├x ψ (arguing by contradiction)
  but 
     Δ(i-1)├x ψ (by case hypothesis)
  so &amp;gt;&amp;lt;, ie : Δ(i-1) ∪ {-φ[x&amp;lt;-c]} is inconsistent      
  so Δ(i-1)├{-φ[x&amp;lt;-c]} (arguing by contradiction)
  c is not show elsewhere, so we may rewrite c as variable y
  ie:Δ(i-1)├{-φ[x&amp;lt;-y]}
  so Δ(i-1)├y ψ[x&amp;lt;-y] ( justify generalization )
  so Δ(i-1)├x ψ (Rewrite theorem)
  but Δ(i-1) ∪ {x ψ} is inconsistent 
 (by case hypothesis)&amp;gt;&amp;lt;.
  so Δ(i) is consistent -&amp;gt; Δ&#039; is consistent 

Consistent : not Δ├φ&amp;amp;-φ 
// Δ(i) is consistent, so Δ&#039; is consistent.
Closed     :   for any x φ in Δ&#039; there is an φ[x&amp;lt;-c] in Δ&#039;
Complete   : for any φ, either φ in Δ&#039; or -φ in Δ&#039;

Step 3: Build model M = (U, μ) for Δ&#039;
U = T(F&#039;)/equal = {[u]| u in T(F&#039;)} where 
F&#039; is the set of function in Σ&#039;,U is the∪verse of our model M
Model definition :
  cm = [c]
  fm = fm([t1],...,[tm]) = [f(t1,...,tm)]
  Rm = Rm([t1],...,[tm]) = [R(t1,...,tm)] , iff R in Δ&#039;

Collary : M is well defined 

Well defined : 
if ti=ti&#039; forall 1≦i≦k then 
   f(t1,...,tn) in Δ&#039;=&amp;gt;f(t1&#039;,...,tn&#039;)inΔ&#039;
if t1=t1&#039; for all 1≦i≦k then 
   R(t1 ,...,tn) in Δ&#039; =&amp;gt; R(t1&#039;,...,tn&#039;) in Δ&#039;
proof : Δ by AX1b and AX1c

Claim : M╞Δ&#039; ( M╞φ iff φin Δ&#039;)
Proof : (by induction on the structure of φ
1. if φ=R(t1,...,tk) is atomic expression then
    Rm([t1], ..., [tk]) iff φinΔ&#039;
2. if φ=-ψ then
    M╞φ iff not M╞ψ
    M!╞ψ iff ψnot in Δ&#039; (by induction hypothesis)
    M╞φ iff φinΔ&#039;
   (because Δ&#039;is complete, either ψ in Δ&#039; or -ψ in Δ&#039; )
3. if φ=ψ1|ψ2 then 
    M╞φ iff M╞ψ1 or M╞ψ2
    M╞φ iff ψ1 in Δ&#039; or ψ2 in Δ&#039;
    M╞φ iff φin Δ&#039;
4. if φ=ψ1&amp;amp;ψ2 then
    M╞φ iff M╞ψ1 and M╞ψ2
    M╞φ iff ψ1 in Δ&#039; and ψ2 inΔ&#039;
    M╞φ iff φin Δ&#039;
5. if φ=x ψthen
Claim : φinΔ&#039; iff ψ[x&amp;lt;-t] inΔ&#039; for all term t
proof of claim :  
=&amp;gt; 
  if φinΔ&#039;, x ψ=&amp;gt;ψ[x&amp;lt;-t]
  so Δ&#039;├ψ[x&amp;lt;-t] for all t(by MP)
  so ψ[x&amp;lt;-t] inΔ&#039;
&amp;lt;=
  if φnot inΔ&#039; then 
  -x ψin Δ&#039; (because Δ&#039; is complete)
  ie : x -ψinΔ&#039;
  by the construction of Δ&#039;
  there is a c s.t 
    -ψ[x&amp;lt;-c] inΔ&#039;
  so not for all term t, ψ[x&amp;lt;-t].

Collary 1: VALIDITY is recursively enumerable
Proof    : 
trivial , because Δ&#039; is r.e. by our building process.

Collary 2: (The Compactness theorem)
If all finite subset of a set of sentences Δ are satisfiable, 
then Δ is satisfiable.
Proof    : 
if that Δ is not satisfiable then
Δ is inconsistent (because Δ is complete)
so there is an derivation{φ1,...,φn}from Δ that derive ψ&amp;amp;-ψ
ie : {φ1,...,φn} is inconsistent (unsatisfiable) &amp;gt;&amp;lt;

Collary 3: (The theorem of FOPC cannot make difference of N and N&#039;)
If Δ is a set of first-order sentences such that N╞Δ, 
then there is a model N&#039; is a superset of N such that N&#039;╞Δ.
Proof    : 
φi = x (x≠0&amp;amp;x≠1&amp;amp;...&amp;amp;x≠i)
any finite subset of Δ ∪ {φi, i≧0} is consistent
(because N╞Δ ∪ {φi, i&amp;lt;n for any n})
so Δ ∪ {φi, i≧0} is consistent.
so there is a model N&#039;╞Δ ∪ {φi, i≧0}, 
and N&#039; is a superset of N (because N!╞Δ ∪ {φ, i≧0})

Collary 4: If a sentence has a model, it has a countable model.
Proof    : 
  Because the model M constructed in Godel completeness proof is countable.

Collary 5: (Lowenheim-Skolem Theorem)
If sentence φ has finite models of arbitrary large cardinality,
then it has an infinite model.
Proof    : 
Define ψ(k)= x1 ... xk (&amp;amp; -(xi=xj)) for all 1≦i&amp;lt;j≦k where k&amp;gt;1
φ ∪ {ψ(k): k&amp;gt;1} is satisfiable by compactness theorem
but any model satisfied φ ∪ {ψ(k): k&amp;gt;1} most be infinite,
so φ has an infinite model.

REACHABILITY : Given G, a, b, can a reach b ?
φ-graph     : Given an expression φ in graph theory, given L, is L ╞ φ ?

We know that φ-graph in P (chapter 1), but we have following theorem :

Collary 6: There is no first-order expression φ (with two free variable x and y) such that φ-graph is the same as reachability.
(ie : the power of First order logic &amp;lt;&amp;lt; the power of Turing Machine)
Proof    : 
  Assume that there is such an φ, then we can use φ to build the following expression

  φ0 = x,y φ (ie : the graph is strongly connected)
  φ1 = xy G(x,y) &amp;amp; xyz (G(x, y) &amp;amp; G(x, z)=&amp;gt;y=z)
  (ie : every node has exactly an edge going out)
  φ2 = xy G(x,y) &amp;amp; xyz (G(y, x) &amp;amp; G(z, x)=&amp;gt;y=z)
  (ie : every node has exactly an edge going in)
  ψ = φ0&amp;amp;φ1&amp;amp;φ2 (ie : ψ defines a cycle)

since there are arbitrary large cycle, by Lowenheim-Skolem Theorem, 
there is an infinite cycle, it&#039;s a contradiction, so φ cannot be builded in First order expression.

Boolean Logic (Zero Order Logic) : 
  P, -P, P&amp;amp;Q, P|Q
First Order Logic  : 
  add x P(x), x P(x),  x is a term
Existential Second Order Logic : 
  add P P(x), P can be an predicate
Existential Second Order Logic :
  Σ  = (Φ, π, r)
add p φ where φ is an first order expression of 
  Σ&#039; = (Φ, π ∪ {P}, r)
  M╞p φ if there is P^M in U^r(P) s.t. φ[p&amp;lt;-P] = true

example :
  P (x (P(x)|P(x+1))&amp;amp;-(P(x)&amp;amp;P(x+1)))
  P^N = set of even number or P^N = set of odd number

Law of excluded middle (P├P is always true)
For a program P├P is not true, a program may going on forever.

Brouwer : Intuitionistic Logic 
Heyking&#039;s algebra
   P|Q is true if there is a (constructive) proof of P or there is 
   a proof of Q
   -P is true if there is a proof of P derive ╞FALSE

The only difference in axiom between Heyking&#039;a algebra and Hilbert algebra is that :
Heykings : ---p=&amp;gt;-p   Hilbert : --p=&amp;gt;p&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sat, 18 Sep 2010 09:20:12 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>Proposition : 簡單的 theorem , 常識的定理 (forward reasoning)。<br /> Lemma : 為證明此 theorem 所需的輔助定理（引理 backward reasoning）。<br /> Theorem : 欲證明的定理。<br /> Collary : 由此定理所導出來的有用的衍生定理。</p> <div class="code"> <pre><code>Arguing by contradiction theorem If Δ ∪ {-φ} is inconsistent then Δ├φ (Δ is inconsistent if Δ├φ or -φ Proof: if Δ ∪ {-φ} is inconsistent then Δ ∪ {-φ}├φ, by Decuctive Theorem, Δ ├ {-φ}=&gt;φ, ie Δ├φ (because-φ=&gt;φ == φ , by Hilbert style (Δ├-φ=&gt;φ)=&gt;φ, Δ├-φ=&gt;φ, so Δ├φ by MP) Prenex Normal Form : Proposition : Let A and B be arbitrary first-order expressions. Then : 1. (x A &amp; x B) = x (A&amp;B) 2. If x does not appear free in B, (x A &amp; B) = x (A&amp; B) 3. If x does not appear free in B, (x A | B) = x (A| B) 4. If y does not appear in A, x A = y A[x&lt;-y] 5. -x B = x (-B) 6. -x B = x (-B) 7. x A  B = x (AB) 8. x A  B = x (AB) An expression is said to be in prenex normal form if it consists of a sequence of quantifiers, followed by an expression that is free of quantifiers. Theorem : Any first-order expression can be transformed to an equivalent one in Prenex normal form. Skolemization (Just like Henken’s witness) Given a sentence in P.N.F. x1x2x3 A(x1,x2,x3…) --&gt; x1x2x3 A(x1,x2,f(x1,x2),…) where f is called skolem function, is a function never appeared in the vocabulary before x1x2x3x4x5x6 P(x1,x2,x3,x4,x5,x6) --&gt; x2x3x5 P(c,x2,x3,f(x2,x3),x5,f(x2,x3,x5)) A sentence is in clausal form if it is skolemize into x1x2x3…xn S Where S is a conjunction of clauses Property : Every sentence has a equivalent clausal form S : set of clauses = {c1,c2,.., cn} Theorem 4.1 : Given a sentence A and its equivalent set of claim S, A is inconsistent iff S is inconsistent. From now on , we don’t tgalk about sentence , only S Herbrand Universe (H = set of ground terms) Herbrand base = {p(t1,..,tn) : P is a predicate symbol and t1,t2,…,tn in H} = the set of ground atomic A ground instance of a clause C is a clause obtained from replacing its variables uniformly by terms in H. C = p(x,y) | -q(x, f(x)), | r(y) M = (H, PM) PM in Hn Example : F = {a,b, f:uniary} H = {a,b,f(a),f(b),f(f(a)), f(f(b)),...} If we have 2 uniary predicate symbols p,q A = {p(a), p(b), q(a), q(b), p(f(a)), q(f(a)), p(f(b)),…} M1:A  {T,F} M2:A  {T,F} Herbrand interpretation =&gt; A syntactic model with H as its universe (Note : this is a syntactic model, so f(a) doesn’t have to be element of U, just element of H) I1 = {p(a),q(a),-p(b),-q(b),-p(f(a)),-q(f(a)),…} Theorem : A set of clause S is unsatisfiable iff it is false in all Herbrand interpretation Let A = {A1,A2,…} be the Herbrand base of S Clause Semantic tree. A1 A2 A3 … 1 1 0 1 0 1 0 1 1 0 0 0 1 0 Herbrand Theorem : first version S is unsatisfiable iff corresponding to all semantic tree of S, there is a closed semantic tree. (Otherwise , there must be a interpretation with infinite length satisfied S) Herbrand Theorem : second version S is unsatisfiable iff there is a finite set of ground instances of S where conjunction is unsatisfiable. Ground resolution  complete ^ lift to first order logic Resolution S First order logic down to  Herbranditize lift to Unification Subsitution S(v)  T(F,V) // set of terms s.t. 1. not S(x) = x for finitely many xs 2. {x: not S(x)=x} intersect {y : not S(x)=x and y is a variable in S(x)} = empty then S is a substitution Example : S1: xf(z) S1 is a substitution ya S2: xf(x) S2 is not a substitution (because cycle, recursive sutstitute error!) ya S3: xf(y) S3 is not a substitution, xf(a) ya but may rewrite into ya S4: xf(y) S4 is not a substitution, cannot rewrite. yf(x) two expression t and s are unifiable it there is a substitution S s.t. sS=tS f(x,g(y,z),a) unified f(h(w),w,z) by assign xh(w) h(g(y,a)) S= wg(y,z)g(y,a) za f(x,g(y,z),a) cannot unified to f(h(w),w,z) If S is a substitution s.t sS = tS then S is a unifier of s and t S is a most general unifier (mgu) of S and t if (1) S is a unifier of S and t (2) For any unifier S1 of s and t, there exist a substitution S2 such that S*S2=S1 Theorem (Robinson) If s and t are unifiable then the mgu of s and t is unique upon renaming Resolution s =(S) t (see if s and are unifiable, If so return an mgu) {s1 =(S)t1,..,sn=(S)tn} 1. Decompose S union {f(s1,..,sn) =(S) f(t1,..,tn)}  S Union {s1=(S)t1, .., sn=(S)tn} 2. Clash S union {f(s1,..,sn) =(S) g(t1,..,tm)  NIL // not f=g 3. Delete S union {s=s}  S 4. Replace S Union {x=(S)t}  S[xt] union {x=(S)t} // x is not in t 5. Occurs Check S union {X=(S) Justified generalization theorem If Δ├φ, x is not free in Δ then Δ├x φ Proof: (Induction in the length of sequence of derivation, too) Consider a proof of S=(φ1,...,φn) of φ from Δ (ie : φn=φ) suppose that for all j&lt;i, φ=&gt;φj Δ├xφj for all j&lt;i if φi in Λ then x φi is an axiom, too (by AX3) else if φi inΔ then φi (by hypothesis), φi=&gt;x φi(by AX3) so x φi else // notφi in Δ∪Λ φi obtain from φj, φj=&gt;φi by modus ponens , x φj (by induction hypothesis), x (φj=&gt;φi) (becauseφj=&gt;φi is an theorem in φ1..φi ∪ Δ ∪ Λ, too) x (φj=&gt;φi)=&gt;(( x φj)=&gt;( x φi)) (it's a tautology) so (x φj)=&gt;( x φi) so x φi. Rewrite theorem If φ and ψ are identical except that φ has free occurrences of x exactly at those position that ψ has free occurrence of y, then x φ=&gt; x ψ. Proof the completeness of axiom system Δ╞φ =&gt; Δ├φ Soundness of ├ Δ├φ =&gt; Δ╞φ Proof : By induction on the length of derivation Godel's Completeness Theorem 1st form : Δ╞φ =&gt; Δ├φ 2nd form : if Δ is consistent then Δ has a model satisfy it ( Δ is consistent if it is not inconsistent) 1st form &lt;= 2nd form Proof : if Δ╞φ (and Δ is consistent) ==&gt; Δ∪{-φ} has no model satisfy it then by Arguing by contradiction theorem , Δ├φ. 1st form =&gt; 2nd form Proof : suppose Δhas no model , then -Δis valid but Δis consistent, so Δ!├φ&amp;-φ Δ=&gt;φ&amp;-φis unsatisfiable -Δ|(φ&amp;-φ) is unsatisfiable -Δis unsatisfiable &gt;&lt; (because -Δis valid) so by Arguing by contradiction theorem, Δhas a model. Proof of 2nd form Proof : Basic : given Δ over vocabulary Σ, Δ is consistent Idea : (1) Enlarge Δ to a manually consistent set Δ' (2) Build a model for Δ' M = (U, μ) is an interpretation Assume a consistent Δ (ex :{-P(a), -P(b), x P(x)} U={a,b} then expand U={a,b,c}) Idea : For each x P(x), construct a constant &quot;witness&quot; called Henkin constant) Step1: Add new constants c1,c2,... to Σ called the resulting alphabetΣ' Claim : Δ remain consistent over Σ' proof of claim : Suppose there is a proof (φ1,...,φn) s.t. Δ├φ&amp;-φ that involve some constant ψ, but there are no ψ in axiom, so ├ψ in some step, replace all ψ with xi for some variable that not show up elsewhere, once again Δ├φ&amp;-φ (after replace ψ with xi) so, Δ is inconsistent, &gt;&lt;. Step 2: Enlarge Δ to a consistent and complete set Δ' (note : Δ' is complete if for every expression φ, φin Δ' or -φ inΔ') Let{φ1,φ2,φ3,...}be an enumeration of all expression overΣ' Define : Δ(0) = Δ Δ(i+1) : case 1: if Δ(i-1) ∪ {φi} is consistent, and not φi = x ψ then Δ(i) = Δ(i-1) ∪ {φi} case 2: if Δ(i-1) ∪ {φi} is consistent, and φi = x ψ then (Let c be a constant not appearing in any one of the expressions φ1,...,φi-1) Δ(i)=Δ(i-1) ∪ {x ψ, ψ[x&lt;-c]} case 3: if Δ(i-1) ∪ {φi} is inconsistent, and not φi=x ψ then Δ(i)=Δ(i-1) ∪ {-φi} case 4: if Δ(i-1) ∪ {φi} is inconsistent, and φi = x ψ then Δ(i)=Δ(i-1) ∪ {-x ψ, -ψ[x&lt;-c]} Claim: For all i≧0, Δ(i) is consistent Proof of Claim : case 1 : Δ(i) = Δ(i-1) ∪ {φi} is consistent (by case hypothesis) case 2 : Δ(i) = Δ(i-1) ∪ {x ψ, ψ[x&lt;-c]} is consistent, case 3 : Δ(i) = Δ(i-1) ∪ {φi} is inconsistent and Δ(i-1) is consistent , Δ(i-1)├-φi (Arguing by contradiction), so Δ(i) ∪ {-φi} is consistent case 4 : Δ(i) = Δ(i-1) ∪ {-x ψ, -ψ[x&lt;-c]} if Δ(i) is inconsistent then Δ(i-1) ∪ {-ψ[x&lt;-c]}├x ψ (arguing by contradiction) but Δ(i-1)├x ψ (by case hypothesis) so &gt;&lt;, ie : Δ(i-1) ∪ {-φ[x&lt;-c]} is inconsistent so Δ(i-1)├{-φ[x&lt;-c]} (arguing by contradiction) c is not show elsewhere, so we may rewrite c as variable y ie:Δ(i-1)├{-φ[x&lt;-y]} so Δ(i-1)├y ψ[x&lt;-y] ( justify generalization ) so Δ(i-1)├x ψ (Rewrite theorem) but Δ(i-1) ∪ {x ψ} is inconsistent (by case hypothesis)&gt;&lt;. so Δ(i) is consistent -&gt; Δ' is consistent Consistent : not Δ├φ&amp;-φ // Δ(i) is consistent, so Δ' is consistent. Closed : for any x φ in Δ' there is an φ[x&lt;-c] in Δ' Complete : for any φ, either φ in Δ' or -φ in Δ' Step 3: Build model M = (U, μ) for Δ' U = T(F')/equal = {[u]| u in T(F')} where F' is the set of function in Σ',U is the∪verse of our model M Model definition : cm = [c] fm = fm([t1],...,[tm]) = [f(t1,...,tm)] Rm = Rm([t1],...,[tm]) = [R(t1,...,tm)] , iff R in Δ' Collary : M is well defined Well defined : if ti=ti' forall 1≦i≦k then f(t1,...,tn) in Δ'=&gt;f(t1',...,tn')inΔ' if t1=t1' for all 1≦i≦k then R(t1 ,...,tn) in Δ' =&gt; R(t1',...,tn') in Δ' proof : Δ by AX1b and AX1c Claim : M╞Δ' ( M╞φ iff φin Δ') Proof : (by induction on the structure of φ 1. if φ=R(t1,...,tk) is atomic expression then Rm([t1], ..., [tk]) iff φinΔ' 2. if φ=-ψ then M╞φ iff not M╞ψ M!╞ψ iff ψnot in Δ' (by induction hypothesis) M╞φ iff φinΔ' (because Δ'is complete, either ψ in Δ' or -ψ in Δ' ) 3. if φ=ψ1|ψ2 then M╞φ iff M╞ψ1 or M╞ψ2 M╞φ iff ψ1 in Δ' or ψ2 in Δ' M╞φ iff φin Δ' 4. if φ=ψ1&amp;ψ2 then M╞φ iff M╞ψ1 and M╞ψ2 M╞φ iff ψ1 in Δ' and ψ2 inΔ' M╞φ iff φin Δ' 5. if φ=x ψthen Claim : φinΔ' iff ψ[x&lt;-t] inΔ' for all term t proof of claim : =&gt; if φinΔ', x ψ=&gt;ψ[x&lt;-t] so Δ'├ψ[x&lt;-t] for all t(by MP) so ψ[x&lt;-t] inΔ' &lt;= if φnot inΔ' then -x ψin Δ' (because Δ' is complete) ie : x -ψinΔ' by the construction of Δ' there is a c s.t -ψ[x&lt;-c] inΔ' so not for all term t, ψ[x&lt;-t]. Collary 1: VALIDITY is recursively enumerable Proof : trivial , because Δ' is r.e. by our building process. Collary 2: (The Compactness theorem) If all finite subset of a set of sentences Δ are satisfiable, then Δ is satisfiable. Proof : if that Δ is not satisfiable then Δ is inconsistent (because Δ is complete) so there is an derivation{φ1,...,φn}from Δ that derive ψ&amp;-ψ ie : {φ1,...,φn} is inconsistent (unsatisfiable) &gt;&lt; Collary 3: (The theorem of FOPC cannot make difference of N and N') If Δ is a set of first-order sentences such that N╞Δ, then there is a model N' is a superset of N such that N'╞Δ. Proof : φi = x (x≠0&amp;x≠1&amp;...&amp;x≠i) any finite subset of Δ ∪ {φi, i≧0} is consistent (because N╞Δ ∪ {φi, i&lt;n for any n}) so Δ ∪ {φi, i≧0} is consistent. so there is a model N'╞Δ ∪ {φi, i≧0}, and N' is a superset of N (because N!╞Δ ∪ {φ, i≧0}) Collary 4: If a sentence has a model, it has a countable model. Proof : Because the model M constructed in Godel completeness proof is countable. Collary 5: (Lowenheim-Skolem Theorem) If sentence φ has finite models of arbitrary large cardinality, then it has an infinite model. Proof : Define ψ(k)= x1 ... xk (&amp; -(xi=xj)) for all 1≦i&lt;j≦k where k&gt;1 φ ∪ {ψ(k): k&gt;1} is satisfiable by compactness theorem but any model satisfied φ ∪ {ψ(k): k&gt;1} most be infinite, so φ has an infinite model. REACHABILITY : Given G, a, b, can a reach b ? φ-graph : Given an expression φ in graph theory, given L, is L ╞ φ ? We know that φ-graph in P (chapter 1), but we have following theorem : Collary 6: There is no first-order expression φ (with two free variable x and y) such that φ-graph is the same as reachability. (ie : the power of First order logic &lt;&lt; the power of Turing Machine) Proof : Assume that there is such an φ, then we can use φ to build the following expression φ0 = x,y φ (ie : the graph is strongly connected) φ1 = xy G(x,y) &amp; xyz (G(x, y) &amp; G(x, z)=&gt;y=z) (ie : every node has exactly an edge going out) φ2 = xy G(x,y) &amp; xyz (G(y, x) &amp; G(z, x)=&gt;y=z) (ie : every node has exactly an edge going in) ψ = φ0&amp;φ1&amp;φ2 (ie : ψ defines a cycle) since there are arbitrary large cycle, by Lowenheim-Skolem Theorem, there is an infinite cycle, it's a contradiction, so φ cannot be builded in First order expression. Boolean Logic (Zero Order Logic) : P, -P, P&amp;Q, P|Q First Order Logic : add x P(x), x P(x), x is a term Existential Second Order Logic : add P P(x), P can be an predicate Existential Second Order Logic : Σ = (Φ, π, r) add p φ where φ is an first order expression of Σ' = (Φ, π ∪ {P}, r) M╞p φ if there is P^M in U^r(P) s.t. φ[p&lt;-P] = true example : P (x (P(x)|P(x+1))&amp;-(P(x)&amp;P(x+1))) P^N = set of even number or P^N = set of odd number Law of excluded middle (P├P is always true) For a program P├P is not true, a program may going on forever. Brouwer : Intuitionistic Logic Heyking's algebra P|Q is true if there is a (constructive) proof of P or there is a proof of Q -P is true if there is a proof of P derive ╞FALSE The only difference in axiom between Heyking'a algebra and Hilbert algebra is that : Heykings : ---p=&gt;-p Hilbert : --p=&gt;p</code></pre></div> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:peanosystem</guid>
				<title>皮諾公設系統</title>
				<link>http://ccckmit.wikidot.com/lr:peanosystem</link>
				<description>

&lt;h1&gt;&lt;span&gt;Axiom of Natural Number System (Peano)&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sat, 18 Sep 2010 08:27:55 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <h1><span>Axiom of Natural Number System (Peano)</span></h1> <div class="code"> <pre><code>PE1 : 0 exist PE2 : x' = x+1 PE3 : x' &gt; x PE4 : If x' = y' then x = y PE5 : Principle of mathmatical Induction : If P(0) and P(x) -&gt; P(x') then For all x, P(x)</code></pre></div> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:dir</guid>
				<title>邏輯推論 -- 目錄</title>
				<link>http://ccckmit.wikidot.com/lr:dir</link>
				<description>

&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:introduction&quot;&gt;邏輯推論簡介&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:introduction&quot;&gt;邏輯與推理&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:history&quot;&gt;邏輯的歷史&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:boolean&quot;&gt;布林邏輯&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:truthtable&quot;&gt;真值表&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:booleanreasoning&quot;&gt;推論方法&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:hornclause&quot;&gt;Horn Clause&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:resolution&quot;&gt;Resolution&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:booleancode&quot;&gt;程式實作&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:fol&quot;&gt;一階邏輯&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:folreasoning&quot;&gt;推論方法&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:folhornclause&quot;&gt;Horn Clause&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:folresolution&quot;&gt;Resolution&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:folcode&quot;&gt;程式實作&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:completetheory&quot;&gt;完備定理&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:consistent&quot;&gt;一致性&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:complete&quot;&gt;完備性&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:godelcomplete&quot;&gt;哥德爾完備定理&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:leonhenkin&quot;&gt;Henkin 的証明方法&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:robinsoncomplete&quot;&gt;推論法的完備性&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:incompletetheory&quot;&gt;不完備定理&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:paradox&quot;&gt;悖論&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:numbersystem&quot;&gt;數論系統&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:peanosystem&quot;&gt;皮諾公設系統&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:peanoparadox&quot;&gt;皮諾系統的悖論&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:godelincomplete&quot;&gt;哥德爾不完備定理&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Mon, 06 Sep 2010 23:48:58 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <ul> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:introduction">邏輯推論簡介</a> <ul> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:introduction">邏輯與推理</a></li> <li><a href="http://ccckmit.wikidot.com/lr:history">邏輯的歷史</a></li> </ul> </li> <li><a href="http://ccckmit.wikidot.com/lr:boolean">布林邏輯</a> <ul> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:truthtable">真值表</a></li> <li><a href="http://ccckmit.wikidot.com/lr:booleanreasoning">推論方法</a></li> <li><a href="http://ccckmit.wikidot.com/lr:hornclause">Horn Clause</a></li> <li><a href="http://ccckmit.wikidot.com/lr:resolution">Resolution</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:booleancode">程式實作</a></li> </ul> </li> <li><a href="http://ccckmit.wikidot.com/lr:fol">一階邏輯</a> <ul> <li><a href="http://ccckmit.wikidot.com/lr:folreasoning">推論方法</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:folhornclause">Horn Clause</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:folresolution">Resolution</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:folcode">程式實作</a></li> </ul> </li> <li><a href="http://ccckmit.wikidot.com/lr:completetheory">完備定理</a> <ul> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:consistent">一致性</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:complete">完備性</a></li> <li><a href="http://ccckmit.wikidot.com/lr:godelcomplete">哥德爾完備定理</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:leonhenkin">Henkin 的証明方法</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:robinsoncomplete">推論法的完備性</a></li> </ul> </li> <li><a href="http://ccckmit.wikidot.com/lr:incompletetheory">不完備定理</a> <ul> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:paradox">悖論</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:numbersystem">數論系統</a></li> <li><a href="http://ccckmit.wikidot.com/lr:peanosystem">皮諾公設系統</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:peanoparadox">皮諾系統的悖論</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:godelincomplete">哥德爾不完備定理</a></li> </ul> </li> </ul> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:modify</guid>
				<title>邏輯推論 -- 最新修改文章</title>
				<link>http://ccckmit.wikidot.com/lr:modify</link>
				<description>


&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sun, 12 Sep 2010 22:29:34 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:main</guid>
				<title>免費電子書 -- 邏輯推論</title>
				<link>http://ccckmit.wikidot.com/lr:main</link>
				<description>

&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:introduction&quot;&gt;邏輯推論簡介&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:introduction&quot;&gt;邏輯與推理&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:history&quot;&gt;邏輯的歷史&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:boolean&quot;&gt;布林邏輯&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:truthtable&quot;&gt;真值表&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:booleanreasoning&quot;&gt;推論方法&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:hornclause&quot;&gt;Horn Clause&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:resolution&quot;&gt;Resolution&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:booleancode&quot;&gt;程式實作&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:fol&quot;&gt;一階邏輯&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:folreasoning&quot;&gt;推論方法&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:folhornclause&quot;&gt;Horn Clause&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:folresolution&quot;&gt;Resolution&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:folcode&quot;&gt;程式實作&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:completetheory&quot;&gt;完備定理&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:consistent&quot;&gt;一致性&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:complete&quot;&gt;完備性&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:godelcomplete&quot;&gt;哥德爾完備定理&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:leonhenkin&quot;&gt;Henkin 的証明方法&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:robinsoncomplete&quot;&gt;推論法的完備性&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:incompletetheory&quot;&gt;不完備定理&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:paradox&quot;&gt;悖論&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:numbersystem&quot;&gt;數論系統&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://ccckmit.wikidot.com/lr:peanosystem&quot;&gt;皮諾公設系統&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:peanoparadox&quot;&gt;皮諾系統的悖論&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class=&quot;newpage&quot; href=&quot;http://ccckmit.wikidot.com/lr:godelincomplete&quot;&gt;哥德爾不完備定理&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Mon, 06 Sep 2010 23:48:10 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <ul> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:introduction">邏輯推論簡介</a> <ul> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:introduction">邏輯與推理</a></li> <li><a href="http://ccckmit.wikidot.com/lr:history">邏輯的歷史</a></li> </ul> </li> <li><a href="http://ccckmit.wikidot.com/lr:boolean">布林邏輯</a> <ul> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:truthtable">真值表</a></li> <li><a href="http://ccckmit.wikidot.com/lr:booleanreasoning">推論方法</a></li> <li><a href="http://ccckmit.wikidot.com/lr:hornclause">Horn Clause</a></li> <li><a href="http://ccckmit.wikidot.com/lr:resolution">Resolution</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:booleancode">程式實作</a></li> </ul> </li> <li><a href="http://ccckmit.wikidot.com/lr:fol">一階邏輯</a> <ul> <li><a href="http://ccckmit.wikidot.com/lr:folreasoning">推論方法</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:folhornclause">Horn Clause</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:folresolution">Resolution</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:folcode">程式實作</a></li> </ul> </li> <li><a href="http://ccckmit.wikidot.com/lr:completetheory">完備定理</a> <ul> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:consistent">一致性</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:complete">完備性</a></li> <li><a href="http://ccckmit.wikidot.com/lr:godelcomplete">哥德爾完備定理</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:leonhenkin">Henkin 的証明方法</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:robinsoncomplete">推論法的完備性</a></li> </ul> </li> <li><a href="http://ccckmit.wikidot.com/lr:incompletetheory">不完備定理</a> <ul> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:paradox">悖論</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:numbersystem">數論系統</a></li> <li><a href="http://ccckmit.wikidot.com/lr:peanosystem">皮諾公設系統</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:peanoparadox">皮諾系統的悖論</a></li> <li><a class="newpage" href="http://ccckmit.wikidot.com/lr:godelincomplete">哥德爾不完備定理</a></li> </ul> </li> </ul> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:logicreasoningjava</guid>
				<title>人工智慧 -- 邏輯推論引擎實作 (Java)</title>
				<link>http://ccckmit.wikidot.com/lr:logicreasoningjava</link>
				<description>

&lt;div class=&quot;code&quot;&gt;
&lt;pre&gt;&lt;code&gt;import java.util.*;

class BooleanLogic {
    Random random = new Random();

    public static void main(String[] args) {
        String rules = &amp;quot;a&amp;lt;-b,c;b&amp;lt;-d,e;c&amp;lt;-d,f;d;e;f&amp;quot;;
        hornReasoning(rules.split(&amp;quot;;&amp;quot;));
        unitResolution(rules.split(&amp;quot;;&amp;quot;));
    }

    public static String neg(String pTerm) {
        if (pTerm.startsWith(&amp;quot;-&amp;quot;))
            return pTerm.substring(1);
        else
            return &amp;quot;-&amp;quot;+pTerm;
    }

    public static String rewrite(String rule) {
        StringBuffer rzRule = new StringBuffer();
        String head = STR.head(rule, &amp;quot;&amp;lt;-&amp;quot;);
        String body = STR.tail(rule, &amp;quot;&amp;lt;-&amp;quot;);
        rzRule.append(head);
        if (body.length() &amp;gt; 0) {        
            String[] conds = body.split(&amp;quot;,&amp;quot;);
            for (int i=0; i&amp;lt;conds.length; i++)
                rzRule.append(&amp;quot;,&amp;quot;+neg(conds[i]));
        }
        return rzRule.toString();
    }

    public static void unitResolution(String[] pRules) {
        Vector rules = new Vector();
        for (int ri=0; ri&amp;lt;pRules.length; ri++)
            rules.add(rewrite(pRules[ri]));
        for (int ri=0; ri&amp;lt;rules.size(); ri++) {
            String rule1 = (String) rules.get(ri);
            if (rule1.indexOf(&amp;quot;,&amp;quot;)&amp;gt;0) continue; // it&#039;s not unit rule.
            String term = rule1;
            String negTerm = neg(term);
            for (int rj=0; rj&amp;lt;rules.size(); rj++) {
                String rule2 = (String) rules.get(rj);
                String exp = &amp;quot;,&amp;quot;+rule2+&amp;quot;,&amp;quot;;
                if (exp.indexOf(&amp;quot;,&amp;quot;+negTerm+&amp;quot;,&amp;quot;)&amp;gt;0) {
                    String unifyExp = STR.replace(exp, &amp;quot;,&amp;quot;+negTerm+&amp;quot;,&amp;quot;, &amp;quot;,&amp;quot;);
                    String newRule = unifyExp.substring(1, unifyExp.length()-1);
                    rules.add(newRule);
                    System.out.println(&amp;quot;unfiy(&amp;quot;+rule1+&amp;quot;|&amp;quot;+rule2+&amp;quot;)=&amp;quot;+newRule);
                }
            }
        }        
    }

    public static void hornReasoning(String[] rules) {
        TreeMap trueMap = new TreeMap();
          int satisfyRuleCount;
        do {
          satisfyRuleCount = 0;
          for (int ri=0; ri&amp;lt;rules.length; ri++) {
              if (rules[ri].length() == 0) continue;
            String head = STR.head(rules[ri], &amp;quot;&amp;lt;-&amp;quot;);
            String body = STR.tail(rules[ri], &amp;quot;&amp;lt;-&amp;quot;);
            String[] conds = body.split(&amp;quot;,&amp;quot;);
            boolean isSatisfy = true;
            for (int ci=0; ci&amp;lt;conds.length; ci++) {
                if (conds[ci].length() == 0) continue;
                if (trueMap.get(conds[ci]) == null)
                    isSatisfy = false;
            }
            if (isSatisfy) {
                System.out.println(rules[ri]);
                trueMap.put(head, &amp;quot;1&amp;quot;);
                rules[ri] = &amp;quot;&amp;quot;;
                satisfyRuleCount ++;
            }
          }
        } while (satisfyRuleCount &amp;gt; 0);
    }
}

/* a-b(X),c(Y);b(X)&amp;lt;-d(X),e(X);c(Y)&amp;lt;-d(Y),f(Y);d(a);e(a);d(b);f(b) */&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Thu, 26 Aug 2010 02:35:40 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <div class="code"> <pre><code>import java.util.*; class BooleanLogic { Random random = new Random(); public static void main(String[] args) { String rules = &quot;a&lt;-b,c;b&lt;-d,e;c&lt;-d,f;d;e;f&quot;; hornReasoning(rules.split(&quot;;&quot;)); unitResolution(rules.split(&quot;;&quot;)); } public static String neg(String pTerm) { if (pTerm.startsWith(&quot;-&quot;)) return pTerm.substring(1); else return &quot;-&quot;+pTerm; } public static String rewrite(String rule) { StringBuffer rzRule = new StringBuffer(); String head = STR.head(rule, &quot;&lt;-&quot;); String body = STR.tail(rule, &quot;&lt;-&quot;); rzRule.append(head); if (body.length() &gt; 0) { String[] conds = body.split(&quot;,&quot;); for (int i=0; i&lt;conds.length; i++) rzRule.append(&quot;,&quot;+neg(conds[i])); } return rzRule.toString(); } public static void unitResolution(String[] pRules) { Vector rules = new Vector(); for (int ri=0; ri&lt;pRules.length; ri++) rules.add(rewrite(pRules[ri])); for (int ri=0; ri&lt;rules.size(); ri++) { String rule1 = (String) rules.get(ri); if (rule1.indexOf(&quot;,&quot;)&gt;0) continue; // it's not unit rule. String term = rule1; String negTerm = neg(term); for (int rj=0; rj&lt;rules.size(); rj++) { String rule2 = (String) rules.get(rj); String exp = &quot;,&quot;+rule2+&quot;,&quot;; if (exp.indexOf(&quot;,&quot;+negTerm+&quot;,&quot;)&gt;0) { String unifyExp = STR.replace(exp, &quot;,&quot;+negTerm+&quot;,&quot;, &quot;,&quot;); String newRule = unifyExp.substring(1, unifyExp.length()-1); rules.add(newRule); System.out.println(&quot;unfiy(&quot;+rule1+&quot;|&quot;+rule2+&quot;)=&quot;+newRule); } } } } public static void hornReasoning(String[] rules) { TreeMap trueMap = new TreeMap(); int satisfyRuleCount; do { satisfyRuleCount = 0; for (int ri=0; ri&lt;rules.length; ri++) { if (rules[ri].length() == 0) continue; String head = STR.head(rules[ri], &quot;&lt;-&quot;); String body = STR.tail(rules[ri], &quot;&lt;-&quot;); String[] conds = body.split(&quot;,&quot;); boolean isSatisfy = true; for (int ci=0; ci&lt;conds.length; ci++) { if (conds[ci].length() == 0) continue; if (trueMap.get(conds[ci]) == null) isSatisfy = false; } if (isSatisfy) { System.out.println(rules[ri]); trueMap.put(head, &quot;1&quot;); rules[ri] = &quot;&quot;; satisfyRuleCount ++; } } } while (satisfyRuleCount &gt; 0); } } /* a-b(X),c(Y);b(X)&lt;-d(X),e(X);c(Y)&lt;-d(Y),f(Y);d(a);e(a);d(b);f(b) */</code></pre></div> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:firstorderlogic1</guid>
				<title>一階邏輯 (First Order Logic)</title>
				<link>http://ccckmit.wikidot.com/lr:firstorderlogic1</link>
				<description>

&lt;h1&gt;&lt;span&gt;簡介&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Tue, 13 Oct 2009 02:14:14 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <h1><span>簡介</span></h1> <p>布林邏輯與一階邏輯是最常被使用的兩種邏輯系統，布林邏輯在電路設計上有強大的用途，而一階邏輯則成為人工智慧領域的理論基礎。</p> <p>一階邏輯 (First Order Logic) 乃是布林邏輯的延伸，此種邏輯具有一種類似布林函數的基本元素，通常稱為謂詞 (Predicate)，因此一階邏輯又稱為謂詞邏輯 (Predicate Logic) 。</p> <p>一階邏輯中包含兩個很特別的量詞運算，全部 (forall) 與存在 (exist) 等，如果我們不處理這兩個運算，也可以形成一個較弱的邏輯系統，在此我們以弱謂詞邏輯稱呼之。</p> <p>羅氏 (Robinson) 的邏輯推論法 Resolution Method 具有理論上的重要性，該方法只要碰到相反的兩個謂詞就可以進行統一消去，這個方法簡單又優美，是一種理論上很棒的推論系統。</p> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:predicatelogic1</guid>
				<title>謂詞邏輯 (Predicate Logic)</title>
				<link>http://ccckmit.wikidot.com/lr:predicatelogic1</link>
				<description>

&lt;h1&gt;&lt;span&gt;簡介&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Sat, 21 Aug 2010 03:39:53 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <h1><span>簡介</span></h1> <p>布林邏輯、謂詞邏輯與一階邏輯是最常被使用的兩種邏輯系統，布林邏輯在電路設計上有強大的用途，而一階邏輯則成為人工智慧領域的理論基礎。</p> <p>謂詞邏輯乃是布林邏輯的延伸，此種邏輯具有一種類似布林函數的基本元素，通常稱為謂詞 (Predicate)，因此稱為謂詞邏輯 (Predicate Logic) 。</p> <p>一階邏輯乃是謂詞邏輯的延伸，包含兩個很特別的量詞運算，全部 (forall) 與存在 (exist) 等，如果我們不處理這兩個運算，則將退化為謂詞邏輯。</p> <h1><span>謂詞邏輯的推論</span></h1> <p>謂詞邏輯的推論法則有很多種，在此我們使用最簡單且強大的羅氏 (Robinson) 推論法則，利用解析法 (Resolution) 進行推論。</p> <p>我們設計了一個一階邏輯的推論器，用來對這種較弱的謂詞邏輯進行推論，以下 Java 程式片段是其推論引擎的核心。</p> <div class="code"> <div class="hl-main"> <pre><span class="hl-code"> </span><span class="hl-comment">/**@param pRules Example : &quot;a(X,Y)|-p(X,Y);a(X,Y)|-p(X,Z)|-a(Z,Y);p(a,b);p(b,c)&quot;.split(&quot;;&quot;) *@return Example : &quot;a(a,b);a(b,c);a(a,c);&quot; */</span><span class="hl-code"> </span><span class="hl-reserved">public</span><span class="hl-code"> </span><span class="hl-types">static</span><span class="hl-code"> </span><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">unitResolution</span><span class="hl-brackets">(</span><span class="hl-identifier">String</span><span class="hl-brackets">[]</span><span class="hl-code"> </span><span class="hl-identifier">pRules</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">Vector</span><span class="hl-code"> </span><span class="hl-identifier">rules</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">Vector</span><span class="hl-brackets">(</span><span class="hl-identifier">Arrays</span><span class="hl-code">.</span><span class="hl-identifier">asList</span><span class="hl-brackets">(</span><span class="hl-identifier">pRules</span><span class="hl-brackets">))</span><span class="hl-code">; </span><span class="hl-reserved">for</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-types">int</span><span class="hl-code"> </span><span class="hl-identifier">ri</span><span class="hl-code">=</span><span class="hl-number">0</span><span class="hl-code">; </span><span class="hl-identifier">ri</span><span class="hl-code">&lt;</span><span class="hl-identifier">rules</span><span class="hl-code">.</span><span class="hl-identifier">size</span><span class="hl-brackets">()</span><span class="hl-code">; </span><span class="hl-identifier">ri</span><span class="hl-code">++</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">rule1</span><span class="hl-code"> = </span><span class="hl-brackets">(</span><span class="hl-identifier">String</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-identifier">rules</span><span class="hl-code">.</span><span class="hl-identifier">get</span><span class="hl-brackets">(</span><span class="hl-identifier">ri</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-identifier">rule1</span><span class="hl-code">.</span><span class="hl-identifier">indexOf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">|</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">&gt;</span><span class="hl-number">0</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-reserved">continue</span><span class="hl-code">; </span><span class="hl-comment">// it's not a unit rule</span><span class="hl-code"> </span><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">negTerm1</span><span class="hl-code"> = </span><span class="hl-identifier">negate</span><span class="hl-brackets">(</span><span class="hl-identifier">rule1</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-comment">// negate the unit rule</span><span class="hl-code"> </span><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">negTag</span><span class="hl-code"> = </span><span class="hl-identifier">STR</span><span class="hl-code">.</span><span class="hl-identifier">head</span><span class="hl-brackets">(</span><span class="hl-identifier">negTerm1</span><span class="hl-code">, </span><span class="hl-quotes">&quot;</span><span class="hl-string">(</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-reserved">for</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-types">int</span><span class="hl-code"> </span><span class="hl-identifier">rj</span><span class="hl-code">=</span><span class="hl-number">0</span><span class="hl-code">; </span><span class="hl-identifier">rj</span><span class="hl-code">&lt;</span><span class="hl-identifier">rules</span><span class="hl-code">.</span><span class="hl-identifier">size</span><span class="hl-brackets">()</span><span class="hl-code">; </span><span class="hl-identifier">rj</span><span class="hl-code">++</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">rule2</span><span class="hl-code"> = </span><span class="hl-brackets">(</span><span class="hl-identifier">String</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-identifier">rules</span><span class="hl-code">.</span><span class="hl-identifier">get</span><span class="hl-brackets">(</span><span class="hl-identifier">rj</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-comment">// ex : unify e(a) with b(a),-d(a),-e(a) =&gt; b(a),-d(a)</span><span class="hl-code"> </span><span class="hl-identifier">String</span><span class="hl-brackets">[]</span><span class="hl-code"> </span><span class="hl-identifier">terms2</span><span class="hl-code"> = </span><span class="hl-identifier">rule2</span><span class="hl-code">.</span><span class="hl-identifier">split</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-special">\\</span><span class="hl-string">|</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-comment">// terms2 = {-e(X)}</span><span class="hl-code"> </span><span class="hl-reserved">for</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-types">int</span><span class="hl-code"> </span><span class="hl-identifier">ti</span><span class="hl-code">=</span><span class="hl-number">0</span><span class="hl-code">; </span><span class="hl-identifier">ti</span><span class="hl-code">&lt;</span><span class="hl-identifier">terms2</span><span class="hl-code">.</span><span class="hl-identifier">length</span><span class="hl-code">; </span><span class="hl-identifier">ti</span><span class="hl-code">++</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">tag</span><span class="hl-code"> = </span><span class="hl-identifier">STR</span><span class="hl-code">.</span><span class="hl-identifier">head</span><span class="hl-brackets">(</span><span class="hl-identifier">terms2</span><span class="hl-brackets">[</span><span class="hl-identifier">ti</span><span class="hl-brackets">]</span><span class="hl-code">, </span><span class="hl-quotes">&quot;</span><span class="hl-string">(</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-code">!</span><span class="hl-identifier">tag</span><span class="hl-code">.</span><span class="hl-identifier">equals</span><span class="hl-brackets">(</span><span class="hl-identifier">negTag</span><span class="hl-brackets">))</span><span class="hl-code"> </span><span class="hl-reserved">continue</span><span class="hl-code">; </span><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">unify</span><span class="hl-code"> = </span><span class="hl-identifier">unify</span><span class="hl-brackets">(</span><span class="hl-identifier">negTerm1</span><span class="hl-code">, </span><span class="hl-identifier">terms2</span><span class="hl-brackets">[</span><span class="hl-identifier">ti</span><span class="hl-brackets">])</span><span class="hl-code">; </span><span class="hl-comment">// unify e(a), -e(X)</span><span class="hl-code"> </span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-identifier">unify</span><span class="hl-code"> == </span><span class="hl-reserved">null</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-reserved">continue</span><span class="hl-code">; </span><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">bindRule</span><span class="hl-code"> = </span><span class="hl-identifier">STR</span><span class="hl-code">.</span><span class="hl-identifier">expand</span><span class="hl-brackets">(</span><span class="hl-identifier">rule2</span><span class="hl-code">, </span><span class="hl-identifier">unify</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-comment">// b(X),-d(X),-e(X) =&gt; b(a),-d(a),-e(a)</span><span class="hl-code"> </span><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">unifyRule</span><span class="hl-code"> = </span><span class="hl-identifier">STR</span><span class="hl-code">.</span><span class="hl-identifier">replace</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">|</span><span class="hl-quotes">&quot;</span><span class="hl-code">+</span><span class="hl-identifier">bindRule</span><span class="hl-code">+</span><span class="hl-quotes">&quot;</span><span class="hl-string">|</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-quotes">&quot;</span><span class="hl-string">|</span><span class="hl-quotes">&quot;</span><span class="hl-code">+</span><span class="hl-identifier">negTerm1</span><span class="hl-code">+</span><span class="hl-quotes">&quot;</span><span class="hl-string">|</span><span class="hl-quotes">&quot;</span><span class="hl-code">, </span><span class="hl-quotes">&quot;</span><span class="hl-string">|</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-comment">// ,b(a),-d(a),-e(a), =&gt; ,b(a),-d(a)</span><span class="hl-code"> </span><span class="hl-identifier">unifyRule</span><span class="hl-code"> = </span><span class="hl-identifier">STR</span><span class="hl-code">.</span><span class="hl-identifier">trim</span><span class="hl-brackets">(</span><span class="hl-identifier">unifyRule</span><span class="hl-code">, </span><span class="hl-quotes">'</span><span class="hl-string">|</span><span class="hl-quotes">'</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-comment">// ,b(a),-d(a), =&gt; b(a),-d(a)</span><span class="hl-code"> </span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-identifier">rules</span><span class="hl-code">.</span><span class="hl-identifier">indexOf</span><span class="hl-brackets">(</span><span class="hl-identifier">unifyRule</span><span class="hl-brackets">)</span><span class="hl-code"> &lt; </span><span class="hl-number">0</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">rules</span><span class="hl-code">.</span><span class="hl-identifier">add</span><span class="hl-brackets">(</span><span class="hl-identifier">unifyRule</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-identifier">System</span><span class="hl-code">.</span><span class="hl-identifier">out</span><span class="hl-code">.</span><span class="hl-identifier">println</span><span class="hl-brackets">(</span><span class="hl-identifier">rule1</span><span class="hl-code">+</span><span class="hl-quotes">&quot;</span><span class="hl-string"> </span><span class="hl-quotes">&quot;</span><span class="hl-code">+</span><span class="hl-identifier">rule2</span><span class="hl-code">+</span><span class="hl-quotes">&quot;</span><span class="hl-special">\r\n</span><span class="hl-string"> [</span><span class="hl-quotes">&quot;</span><span class="hl-code">+</span><span class="hl-identifier">unify</span><span class="hl-code">+</span><span class="hl-quotes">&quot;</span><span class="hl-string">] =&gt; </span><span class="hl-quotes">&quot;</span><span class="hl-code">+</span><span class="hl-identifier">unifyRule</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-identifier">StringBuffer</span><span class="hl-code"> </span><span class="hl-identifier">facts</span><span class="hl-code"> = </span><span class="hl-reserved">new</span><span class="hl-code"> </span><span class="hl-identifier">StringBuffer</span><span class="hl-brackets">()</span><span class="hl-code">; </span><span class="hl-reserved">for</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-types">int</span><span class="hl-code"> </span><span class="hl-identifier">ri</span><span class="hl-code">=</span><span class="hl-identifier">pRules</span><span class="hl-code">.</span><span class="hl-identifier">length</span><span class="hl-code">; </span><span class="hl-identifier">ri</span><span class="hl-code">&lt;</span><span class="hl-identifier">rules</span><span class="hl-code">.</span><span class="hl-identifier">size</span><span class="hl-brackets">()</span><span class="hl-code">; </span><span class="hl-identifier">ri</span><span class="hl-code">++</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-brackets">{</span><span class="hl-code"> </span><span class="hl-identifier">String</span><span class="hl-code"> </span><span class="hl-identifier">rule</span><span class="hl-code"> = </span><span class="hl-brackets">(</span><span class="hl-identifier">String</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-identifier">rules</span><span class="hl-code">.</span><span class="hl-identifier">get</span><span class="hl-brackets">(</span><span class="hl-identifier">ri</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-reserved">if</span><span class="hl-code"> </span><span class="hl-brackets">(</span><span class="hl-identifier">rule</span><span class="hl-code">.</span><span class="hl-identifier">indexOf</span><span class="hl-brackets">(</span><span class="hl-quotes">&quot;</span><span class="hl-string">|</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code"> &lt; </span><span class="hl-number">0</span><span class="hl-brackets">)</span><span class="hl-code"> </span><span class="hl-identifier">facts</span><span class="hl-code">.</span><span class="hl-identifier">append</span><span class="hl-brackets">(</span><span class="hl-identifier">rule</span><span class="hl-code">+</span><span class="hl-quotes">&quot;</span><span class="hl-string">;</span><span class="hl-quotes">&quot;</span><span class="hl-brackets">)</span><span class="hl-code">; </span><span class="hl-brackets">}</span><span class="hl-code"> </span><span class="hl-reserved">return</span><span class="hl-code"> </span><span class="hl-identifier">facts</span><span class="hl-code">.</span><span class="hl-identifier">toString</span><span class="hl-brackets">()</span><span class="hl-code">; </span><span class="hl-brackets">}</span></pre></div> </div> <h1><span>結語</span></h1> <p>羅氏的謂詞邏輯推論法具有理論上的重要性，既簡單又優美，本文對該方法進行了一個簡易的實作，雖然不夠完整，但希望能清楚的說明其原理。</p> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:booleanlogic1</guid>
				<title>布林邏輯 (Boolean Logic)</title>
				<link>http://ccckmit.wikidot.com/lr:booleanlogic1</link>
				<description>

&lt;h1&gt;&lt;span&gt;簡介&lt;/span&gt;&lt;/h1&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Tue, 13 Oct 2009 02:12:06 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <h1><span>簡介</span></h1> <p>布林邏輯在電路設計上有強大的用途，是最簡單的邏輯系統，由於是喬治、布林(George Boole)所建立的基礎理論，因此被稱為布林邏輯。</p> <p>布林所提出的真值表，是布林邏輯中最基礎也最重要的方法，在布林邏輯中，每個值都只能是真的或假的，不可以是其他值。這種非真即假的特性，稱為「排中律」，我們可以將「排中律」寫成下列公式。</p> <blockquote> <p>P | -P =&gt; true // P 或 -P 中必然有一者為真。</p> </blockquote> <h1><span>推論法則</span></h1> <p>要用布林邏輯來進行推論，必須依靠所謂的推理方法，亞里斯多德 (Aristotle)、希爾伯特 (Hilbert)、洪氏 (Horn)、簡森 (Gentzen) 與羅賓遜 (Robinson) 前後對這些推論方法進行了關鍵性的研究，其中、最簡單且功能強大的莫過於羅氏 (Robinson) 的解析法 (Resolution) 了。</p> <p>關於布林邏輯的進一步訊息，請參看下列兩份投影片。</p> <ol> <li>LogicIntroduction.ppt &#8212; <a href="http://www.scribd.com/doc/20974598/Logic-Introduction">http://www.scribd.com/doc/20974598/Logic-Introduction</a></li> <li>LogicReasoning.ppt &#8212; <a href="http://www.scribd.com/doc/20974606/Logical-Reasoning">http://www.scribd.com/doc/20974606/Logical-Reasoning</a></li> </ol> <p>然而，純粹的解析法並不完備，要利用羅氏的解析法證明任意問題，必須使用反證法 (Refutation)，其方法是將待證明語句 P 的反向句 -P 加入到規則庫當中，如果可以導出矛盾 (假值)，則代表該語句 P 被證實。</p> <p>根據 Horn 的前向推論法與 Robinson 的 Refutation 方法，我們用 Java 寫了一個推理引擎，其程式碼位於 <a href="http://ccckmit.wdfiles.com/local--files/lr:booleanlogic1/BooleanLogic.java">BooleanLogic.java</a> 中，該程式中的 unitResolution() 函數是採用 Robinson 的推論法則，而 hornReasoning() 函數則採用 Horn 的推論法則，兩者的程式碼分別如下。</p> <h1><span>洪式推論法 (Horn Clause Reasoning)</span></h1> <div class="code"> <pre><code> public static void hornReasoning(String[] rules) { TreeMap trueMap = new TreeMap(); int satisfyRuleCount; do { satisfyRuleCount = 0; for (int ri=0; ri&lt;rules.length; ri++) { if (rules[ri].length() == 0) continue; String head = STR.head(rules[ri], &quot;&lt;-&quot;); String body = STR.tail(rules[ri], &quot;&lt;-&quot;); String[] conds = body.split(&quot;,&quot;); boolean isSatisfy = true; for (int ci=0; ci&lt;conds.length; ci++) { if (conds[ci].length() == 0) continue; if (trueMap.get(conds[ci]) == null) isSatisfy = false; } if (isSatisfy) { System.out.println(rules[ri]); trueMap.put(head, &quot;1&quot;); rules[ri] = &quot;&quot;; satisfyRuleCount ++; } } } while (satisfyRuleCount &gt; 0); }</code></pre></div> <h1><span>羅式的推論法 (Robinson's Resolution Reasoning)</span></h1> <div class="code"> <pre><code> public static void unitResolution(String[] pRules) { Vector rules = new Vector(); for (int ri=0; ri&lt;pRules.length; ri++) rules.add(rewrite(pRules[ri])); for (int ri=0; ri&lt;rules.size(); ri++) { String rule1 = (String) rules.get(ri); if (rule1.indexOf(&quot;,&quot;)&gt;0) continue; // it's not unit rule. String term = rule1; String negTerm = neg(term); for (int rj=0; rj&lt;rules.size(); rj++) { String rule2 = (String) rules.get(rj); String exp = &quot;,&quot;+rule2+&quot;,&quot;; if (exp.indexOf(&quot;,&quot;+negTerm+&quot;,&quot;)&gt;0) { String unifyExp = STR.replace(exp, &quot;,&quot;+negTerm+&quot;,&quot;, &quot;,&quot;); String newRule = unifyExp.substring(1, unifyExp.length()-1); rules.add(newRule); System.out.println(&quot;unfiy(&quot;+rule1+&quot;|&quot;+rule2+&quot;)=&quot;+newRule); } } } }</code></pre></div> <h1><span>結語</span></h1> <p>布林邏輯雖然是一種簡單的邏輯系統，但其數學基礎非常紮實，是西洋文化的精隨之所在。如果我們能欣賞這種邏輯系統的美麗之處，那麼將能理解西方數學的重要性，進而將其應用到電腦領域，發展出更好的人工智慧程式。</p> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:resolution</guid>
				<title>布林邏輯的 Resolution 推論法</title>
				<link>http://ccckmit.wikidot.com/lr:resolution</link>
				<description>

&lt;p&gt;羅氏 (Robinson) 的邏輯推論法 Resolution Method 具有理論上的重要性，該方法只要碰到相反的兩個項目就可以進行統一消去，這個方法簡單又優美，是一種理論上很棒的推論系統。&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Tue, 07 Sep 2010 03:10:41 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>羅氏 (Robinson) 的邏輯推論法 Resolution Method 具有理論上的重要性，該方法只要碰到相反的兩個項目就可以進行統一消去，這個方法簡單又優美，是一種理論上很棒的推論系統。</p> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:hornclause</guid>
				<title>Horn Clause 的推論法則</title>
				<link>http://ccckmit.wikidot.com/lr:hornclause</link>
				<description>

&lt;p&gt;所謂的 Horn Clause 是結論中只有一個項目的語句，舉例而言，以下是一個符合 Horn Clause 的邏輯規則系統。&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Tue, 07 Sep 2010 02:53:27 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>所謂的 Horn Clause 是結論中只有一個項目的語句，舉例而言，以下是一個符合 Horn Clause 的邏輯規則系統。</p> <table class="wiki-content-table"> <tr> <td>A &amp; B &amp; C =&gt; D</td> </tr> <tr> <td>X &amp; Y =&gt; A</td> </tr> <tr> <td>P &amp; Q =&gt; B</td> </tr> </table> <p>等等邏輯規則，其結論的語句，也就是 =&gt; 的右邊，只有一個項目，這種邏輯系統的推論出奇的簡單，只要從前提開始不斷檢查是否有規則可以推論就行了，舉例而言，假如我們知道 X, Y, P, Q, C 為真，那麼就可以進行推論如下。</p> <p>推論開始前：真理 = {X, Y, P, Q, C}</p> <table class="wiki-content-table"> <tr> <td>前提</td> <td>規則</td> <td>結論</td> </tr> <tr> <td>X ; Y ;</td> <td>X &amp; Y =&gt; A</td> <td>推論出 A</td> </tr> <tr> <td>P ; Q ;</td> <td>P &amp; Q =&gt; B</td> <td>推論出 B</td> </tr> <tr> <td>A ; B ; C;</td> <td>A &amp; B &amp; C =&gt; D</td> <td>推論出 D</td> </tr> </table> <p>推論完成後：真理 = {X, Y, P, Q, C, A, B, D }</p> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://ccckmit.wikidot.com/lr:booleanreasoning</guid>
				<title>布林邏輯的推論方法</title>
				<link>http://ccckmit.wikidot.com/lr:booleanreasoning</link>
				<description>

&lt;p&gt;要用布林邏輯來進行推論，必須依靠所謂的推理方法，亞里斯多德 (Aristotle)、希爾伯特 (Hilbert)、洪氏 (Horn)、簡森 (Gentzen) 與羅賓遜 (Robinson) 前後對這些推論方法進行了關鍵性的研究，其中、最簡單且功能強大的莫過於羅氏 (Robinson) 的解析法 (Resolution) 了。&lt;/p&gt;
&lt;p&gt;by &lt;span class=&quot;printuser avatarhover&quot;&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;&lt;img class=&quot;small&quot; src=&quot;http://www.wikidot.com/avatar.php?userid=296763&amp;amp;amp;size=small&amp;amp;amp;timestamp=1776587214&quot; alt=&quot;ccckmit&quot; style=&quot;background-image:url(http://www.wikidot.com/userkarma.php?u=296763)&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.wikidot.com/user:info/ccckmit&quot;  &gt;ccckmit&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
</description>
				<pubDate>Tue, 07 Sep 2010 02:44:21 +0000</pubDate>
												<content:encoded>
					<![CDATA[
						 <p>要用布林邏輯來進行推論，必須依靠所謂的推理方法，亞里斯多德 (Aristotle)、希爾伯特 (Hilbert)、洪氏 (Horn)、簡森 (Gentzen) 與羅賓遜 (Robinson) 前後對這些推論方法進行了關鍵性的研究，其中、最簡單且功能強大的莫過於羅氏 (Robinson) 的解析法 (Resolution) 了。</p> <p>關於布林邏輯的進一步訊息，請參看下列兩份投影片。</p> <ol> <li>LogicIntroduction.ppt &#8212; <a href="http://www.scribd.com/doc/20974598/Logic-Introduction">http://www.scribd.com/doc/20974598/Logic-Introduction</a></li> <li>LogicReasoning.ppt &#8212; <a href="http://www.scribd.com/doc/20974606/Logical-Reasoning">http://www.scribd.com/doc/20974606/Logical-Reasoning</a></li> </ol> <p>然而，純粹的解析法並不完備，要利用羅氏的解析法證明任意問題，必須使用反證法 (Refutation)，其方法是將待證明語句 P 的反向句 -P 加入到規則庫當中，如果可以導出矛盾 (假值)，則代表該語句 P 被證實。</p> <p>by <span class="printuser avatarhover"><a href="http://www.wikidot.com/user:info/ccckmit" ><img class="small" src="http://www.wikidot.com/avatar.php?userid=296763&amp;amp;size=small&amp;amp;timestamp=1776587214" alt="ccckmit" style="background-image:url(http://www.wikidot.com/userkarma.php?u=296763)" /></a><a href="http://www.wikidot.com/user:info/ccckmit" >ccckmit</a></span></p> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>