鬼はどこですか? Proositional logic (cont ) 命題論理 Reasoning where is wumus 鬼がいる場所を推理する 1
命題論理 : 意味論 semantics 論理積 A B A かつ B 論理和 A B A または B 否定 A A でない 含意 A B A ならば B を意味する 同等 A B (A ならば B) かつ (B ならば A) 命題論理では記号は命題 ( 事実 ) を表す 文を作るために各命題記号をブール演算子 (Boolean connective) を使って結合できる S 1 is true, then S 2 is true. S 1 is false, then S 2 is either true or false S 1 S 2 S 1 S 2 S 1 S 2 S 1 S 2 S 1 is true, then S 2 is true. S 1 is false, then S 2 is false white false white false 2
his relation etween sentences is called entailment. A = B his relation etween sentences is called imlication. A B or A => B A ならば B (A B) は A が真ならば B が真のときだけ真 A が偽ならば B の真偽にかかわらず真となります A is true, then B is true. A is false, then B is either true or false F A is true, B is false A is true, B is true A is false, B is true A is false, B is false 3
課題 : 真偽値の計算 =, q = F, r = のとき ( q) r =, q = F, r = F のとき ( q) r = F, q = F, r = のとき ( q) r = F, q = F, r = F のとき ( q) r
課題 : 真偽値の計算 =, q = F, r = のとき ( q) r F = = F, q = F, r = のとき ( q) r F = A = B A B A => B =, q = F, r = F のとき ( q) r F =F = F, q = F, r = F のとき ( q) r F F = F A is true, B is false A is true, B is true A is false, B is true A is false, B is false
Seven inference rules for roositional Logic (1) Modus Ponens And-Elimination And-Introduction α β, α β α 1 α 2 α n α i α 1, α 2,, α n α 1 α 2 α n Some notations: means imlication, means Or-Introduction Doule-Negation Elimination α i α 1 α 2 α n α α e.g. ((α β) α) = β Unit Resolution Multi-unit Resolution α β, β α α β, β γ α γ (α または β, not β ) α (α または β, not β または γ ) α または γ である 6
Seven inference rules for roositional Logic Modus Ponens モーダスポネンス ( modus onens, MP) α β, α β And-Elimination 論理積の消去 And-Introduction 論理積の導入 α 1 α 2 α n α i α 1, α 2,, α n α 1 α 2 α n Or-Introduction 論理和の導入 Doule-Negation Elimination 二重否定の除去 Unit Resolution 融合 α i α 1 α 2 α n α β, β α α γ α α α β, β γ (α または β, not β ) α (α または β, not β または γ ) α または γ である 7
Seven inference rules for roositional Logic (2) Modus Ponens モーダスポネンス ( modus onens, MP) α β, α β 論理演算の記法で (α β) α = β これらはいずれも前提条件が 2 つ存在する 第一の条件は条件文または論理包含演算であり β が α を包含することを示す 第二の条件は α であり 第一の条件の条件部分が真であることを主張している これら 2 つの前提から論理的に β が真であることが導かれる 例 : 今日が木曜日なら 私は働きに行く 今日は木曜日だ だから 私は働きに行く
Seven inference rules for roositional Logic And-Elimination 論理積の消去 α 1 α 2 α n N=2 の場合は ベン図で α i i=1, 2, 3,, n 私の身長は 168 cm 以上である 私の体重は 55 kg 以上である の二つの命題の論理積は 私の身長は 160 cm 以上であり かつ私の体重は 50 kg 以上である N=3,. ( ベン図?) N=n α 1 α 2 9
Unit Resolution Seven inference rules for roositional Logic 例 : w 13 w 22, w 22 => w 13 α β, β α Wumus may e in room [1, 3] or in room [2, 2], and it is known that there is no Wumus in room [2, 2], hen, there must e a Wumus in room [1, 3] w13 is true which means a Wumus is in room [1,3] (α または β, not β ) α An extension, for examle, α β γ, β γ α γ 10
Some more derived inference rules (A B, A B) (A B, B A) ( (A B), A B) (A, B A B) (A B A) (A A B) (A B, A C, B C C) (A B, A B) (A B, B C A C) (A P, B Q, A B P Q) (A P, B Q, P Q A B) (A B, B A A B) (A B A B) 11
Wumus world he agent always starts in the lower left corner, lael [1,1]. he agent s task is to find the gold, safely return to [1,1]. he neighoring squares of a room with are reeze. he neighoring squares of a room with w are smelly. 4 3 2 s w s s g A g s Agent Breeze 微風 Gold 金 Pit 穴 Smelly 臭い 1 A SAR w Wumus 鬼 1 2 3 4
he knowledge ase Percet sentences: (1) he fact aout Wumus (around a Wumus, there is smell) there is no smell in the square [1,1] S 1,1 there is smell in the square [1,2] S 1,2 there is no smell in the square [2,1] S 2,1 => For inferring where there is a Wumus (2) he fact aout Pit (around a Pit, there is reeze) there is no reeze in the square [1,1] B 1,1 s w s g there is no reeze in the square [1,2] B 1,2 s there is reeze in the square [2,1] B 2,1 => For inferring where there is a Pit A 13
knowledge sentences: If a square has no smell, then neither the square nor any of its adjacent squares can house a wumus. R 1 : S 1,1 W 1,1 W 1,2 W 2,1 he knowledge ase R 2 : S 2,1 W 1,1 W 2,1 W 2,2 W 3,1 If there is smell in [1,2], then there must e a wumus in [1,2] or in one or more of the neighoring squares. R 3 : S 1,2 W 1,3 W 1,2 W 2,2 W 1,1 If a square has no reeze, then neither the square nor any of its adjacent squares can have a it. R 4 : B 1,1 P 1,1 P 1,2 P 2,1 s w s g R 5 : B 1,2 P 1,1 P 1,2 P 2,2 P 1,3 If there is reeze in [2,1], then there must e a it in [2,1] or in one or more of the neighoring squares. R 6 : B 2,1 P 3,1 P 2,1 P 2,2 P 1,1 s A 14
Inferring knowledge using roositional logic Concerning with the 6 squares, [1,1], [2,1], [1,2], [3,1], [2,2], [1,3], there are 12 symols, S 1,1, S 2,1, S 1,2, B 1,1, B 2,1, B 1,2, W 1,1, W 1,2, W 2,1, W 2,2, W 3,1, W 1,3 he rocess of finding a wumus in [1,3] as follows: 1. Aly R 1 to S 1,1, we otain W 1,1 W 1,2 W 2,1 2. Aly And-Elimination, we otain W 1,1 W 1,2 W 2,1 3. Aly R 2 and And-Elimination to S 2,1, we otain α 1 α 2 α n α i α β, β α W 1,1 W 2,2 W 2,1 W R 3,1 3 : S 1,2 W 1,3 W 1,2 W 2,2 W 1,1 4. Aly R 3 and the unit resolution to S 1,2, we otain (α is W 1,3 W 1,2 W 2,2 and β is W 1,1 ) W 1,3 W 1,2 W 2,2 5. Aly the unit resolution again, we otain (α is W 1,3 W 1,2 and β is W 2,2 ) W 1,3 W 1,2 6. Aly the unit resolution again, we otain (α is W 1,3 and β is W 1,2 ) s w s g s W 1,3 Here is the answer: the wumus is in [1,3], that is, W 1,3 is true. A 15
Work in class: Prove there is a Pit in room [1, 3], that is to infer the sentence P 1,3 is rue 16
oo many roositions Prolem with roositional logic too many rules to define a cometent agent he world is changing, roositions are changing with time. do not know how many time-deendent roositions we will need have to go ack and rewrite time-deendent version of each rule. he rolem with roosition logic is that it only has one reresentational device: the roosition!!! he solutions to the rolem is to introduce other logic first-order logic hat can reresent ojects and relations etween ojects in addition to roositions. 17
Last week s home work: Comlete the following truth tale according to roositional syntax. S 1 S 2 S 1 S 1 S 2 S 1 S 2 S 1 S 2 S 1 S 2 False False F F False rue F F rue False F F F F rue rue F 18