งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

งานนำเสนอกำลังจะดาวน์โหลด โปรดรอ

Predicate Logic Dr.Yodthong Rodkaew.

งานนำเสนอที่คล้ายกัน


งานนำเสนอเรื่อง: "Predicate Logic Dr.Yodthong Rodkaew."— ใบสำเนางานนำเสนอ:

1 Predicate Logic Dr.Yodthong Rodkaew

2 Using Propositional Logic
Representing simple facts It is raining RAINING It is sunny SUNNY It is windy WINDY If it is raining, then it is not sunny RAINING  SUNNY

3 Using Propositional Logic
Using Predicate Logic Theorem proving is decidable Cannot represent objects and quantification Theorem proving is semi-decidable Can represent objects and quantification

4 Using Propositional Logic
Using Predicate Logic Socrates is a man SOCRATESMAN Plato is a man PLATOMAN Socrates is a man MAN( Socrates ) Plato is a man MAN( Plato )

5 Well-Formed Formulas(WFF’s)
กำหนดให้ P, Q, R, S, T , ... แทนสัญลักษณ์ของประพจน์ true, false แทนสัญลักษณ์ที่มีค่าความจริงเป็น จริงและเท็จ ตามลำดับ , , ,  แทนสัญลักษณ์ตัวเชื่อมทางคณิตศาสตร์ของประพจน์ สัญลักษณ์ของประพจน์,true,false เป็น WFF’s ¬ p แทนนิเสธของ p p  q แทน p AND q p  q แทน p OR q p  q แทน ประพจน์แบบมีเงื่อนไข p = q แทนการสมมูลกัน x for some x in  x for all x in 

6 Well-Formed Formulas(WFF’s)
Precedence Rules 1.  , 2., 3. , 4. , p  q  r  s  q   s p  q  r  s  ( q)  ( s) (p  q)  (r  s)  ( q)  ( s) ((p  q)  (r  s))  (( q)  ( s))

7 Using Predicate Logic Marcus was a man. Marcus was a Pompeian.
3. All Pompeians were Romans. 4. Caesar was a ruler. All Pompeians were either loyal to Caesar or hated him. 6. Every one is loyal to someone. People only try to assassinate rulers they are not loyal to. Marcus tried to assassinate Caesar. Q: Was Marcus loyal to Caesar?

8 Using Predicate Logic Marcus was a man. Marcus was a Pompeian.
All Pompeians were Romans. 4. Caesar was a ruler. 1. man(Marcus) 2. Pompeian(Marcus) 3. x Pompein(x)  Romans(x) 4. ruler(Caesar)

9 Using Predicate Logic All Pompeians were either loyal to Caesar or hated him. Everyone is loyal to someone. People only try to assassinate rulers they are not loyal to. Marcus tried to assassinate Caesar. 5. x Pompein(x)  loyal_to(Caesar)  hate(Caesar) 6. x y loyal_to(x,y) 7. x: y: man(x)  ruler(y)  tryassassinate(x, y)  loyal_to(x, y) 8. tryassassinate(Marcus, Caesar)

10 Using Predicate Logic Q:Was Marcus loyal to Caesar?
Q: loyal_to(Marcus,Caesar)

11 Resolution Resolution เป็นกระบวนการหรือเทคนิคที่ใช้ในการแก้ไขปัญหาเพื่อให้เกิดข้อสรุป Resolution ใช้ได้กับ propositional logic และ predicate calculus

12 Step 1 สมมติว่าสิ่งที่คุณต้องการจะพิสูจน์เป็นเท็จ ตัวอย่างเช่น ถ้าต้องการจะพิสูจน์ P จะต้องเริ่มพิสูจน์โดยการให้ P เป็นเท็จ นั่นคือ P เรียกวิธีนี้ว่า “Proof by refutation” Step 2 เปลี่ยนกฎที่มีเครื่องหมาย “ถ้า A แล้ว B” หรือ “AB” ให้เป็น “AB” จะกล่าวถึงทีหลัง Step 3 ใช้กฎของ pattern matching และ unification สำหรับการรวมกฎที่เป็น positive และ negative เข้าด้วยกัน เช่น P และ  P สามารถรวมกันแล้วตัดทิ้งได้ เรียกวิธีการนี้ว่า “resolvent” และขั้นตอนนี้จะต้องทำหลายๆ ครั้งเพื่อให้เหลือข้อสรุปเพียงข้อเดียว Step 4 เราจะได้เงื่อนไขแรกเป็น positive เช่น P ส่วนข้อสรุป คือ P ซึ่งเราสามารถมาเชื่อมกันได้และสรุปได้ว่า ถ้า P จริง P ก็ต้องเป็นเท็จ Step 5 สรุปว่า P เป็นจริง เมื่อ P เป็นเท็จ

13 Resolution in Propositional Logic
temperature>100  patient has high temperature patient has high temperature advise two paracet A  B B  C ถ้า A จริง เราสามารถสรุปได้ว่า C จริง ดังนี้

14 State 0 เปลี่ยนโดยใช้หลักของ Morgan’s Law AB BC A C

15 State 1 State 2 AB BC AB A BC C AC AC
รวม 3 และ 5 เข้าด้วยกัน C AB BC AC เขียนผลที่ได้ลงใน state 1

16 State 3 AB BC A C AC C
สามารถสรุปได้ว่า เมื่อ C จริง C จะเป็นเท็จ ดังนั้นสามารถสรุปได้ว่า Advise two paracet จริง

17 Resolution in Predicate Logic
1. John และ Marry รู้จักกัน 2. คนที่รู้จักกันเป็นเพื่อนกัน 1. Know(john)  Know(Marry) 2. Know(x)  Know(y)  Friend (x,y) 1.  Know(john)  Know(Marry) 2.  Know(x)   Know(y)  Friend (x,y) กรณีนี้ยังใช้ Morgan’s Law ไม่ได้ เนื่องจาก มีตัวแปรที่ไม่เท่ากัน Unification: UNIFY(p, q) = unifier  where SUBST(, p) = SUBST(, q)

18 Resolution in Predicate Logic
Unification: x: knows(John, x)  hates(John, x) knows(John, Jane) y: knows(y, Leonid) y: knows(y, mother(y)) x: knows(x, Elizabeth) UNIFY(knows(John, x), knows(John, Jane)) = {Jane/x} UNIFY(knows(John, x), knows(y, Leonid)) = {Leonid/x, John/y} UNIFY(knows(John, x), knows(y, mother(y))) = {John/y, mother(John)/x} UNIFY(knows(John, x), knows(x, Elizabeth)) = FAIL

19 Resolution in Predicate Logic
Unification: Standardization UNIFY(knows(John, x), knows(y, Elizabeth)) = {John/y, Elizabeth/x}

20 Resolution in Predicate Logic
Unification: Most general unifier UNIFY(knows(John, x), knows(y, z)) = {John/y, John/x, John/z} = {John/y, Jane/x, Jane/z} = {John/y, v/x, v/z} = {John/y, z/x, Jane/v} = {John/y, z/x}

21 Resolution in Predicate Logic
Unification: Occur check UNIFY(knows(x, x), knows(y, mother(y))) = FAIL

22 Conversion to Clause Form
Eliminate . P  Q  P  Q Reduce the scope of each  to a single term. (P  Q)  P  Q (P  Q)  P  Q x: P  x: P x: p  x: P  P  P Standardize variables so that each quantifier binds a unique variable. (x: P(x))  (x: Q(x))  (x: P(x))  (y: Q(y))

23 Conversion to Clause Form
Move all quantifiers to the left without changing their relative order. (x: P(x))  (y: Q(y))  x: y: (P(x)  (Q(y)) Eliminate  (Skolemization). x: P(x)  P(c) Skolem constant x: y P(x, y)  x: P(x, f(x)) Skolem function Drop . x: P(x)  P(x) Convert the formula into a conjunction of disjuncts. (P  Q)  R  (P  R)  (Q  R) 8. Create a separate clause corresponding to each conjunct. 9. Standardize apart the variables in the set of obtained clauses.

24 Using Predicate Logic 1. man(Marcus) Q: loyal_to(Marcus,Caesar)
2. Pompeian(Marcus) 3. x Pompein(x)  Romans(x) 4. ruler(Caesar) 5. x Pompein(x)  loyal_to(Caesar)  hate(Caesar) 6. x y loyal_to(x,y) 7. x: y: man(x)  ruler(y)  tryassassinate(x, y)  loyal_to(x, y) 8. tryassassinate(Marcus, Caesar)

25 Using Predicate Logic 1. man(Marcus) Q: loyal_to(Marcus,Caesar)
2. Pompeian(Marcus) 3.  Pompein(x3)  Romans(x3) 4. ruler(Caesar) 5.  Pompein(x5)  loyal_to(Caesar)  hate(Caesar) 6. loyal_to(x6,f(x6)) 7.  (man(x7)  ruler(y7)  tryassassinate(x7, y7) )  loyal_to(x7, y7) 7.  man(x7)   ruler(y7)   tryassassinate(x7, y7)  loyal_to(x7, y7) 8. tryassassinate(Marcus, Caesar)

26 Using Predicate Logic  tryassassinate(Marcus,Caesar)
Q: loyal_to(Marcus,Caesar) 7.  man(x7)   ruler(y7)   tryassassinate(x7, y7)  loyal_to(x7, y7) {Marcus/x7,Caesar/y7}  man(Marcus)   ruler(Caesar)   tryassassinate(Marcus,Caesar) 4. ruler(Caesar) 1. man(Marcus)  man(Marcus)   tryassassinate(Marcus,Caesar)  tryassassinate(Marcus,Caesar) 8. tryassassinate(Marcus, Caesar)

27 Example  hate(Marcus, Caesar)  tryassassinate(Marcus,Caesar)
9. hate(x,y)  tryassassinate(x,y) Prove:  hate(Marcus, Caesar) 9.  hate(x9,y9)  tryassassinate(x9,y9) {Marcus/x9,Caesar/y9}  hate(Marcus, Caesar)  tryassassinate(Marcus,Caesar) 8. tryassassinate(Marcus, Caesar)


ดาวน์โหลด ppt Predicate Logic Dr.Yodthong Rodkaew.

งานนำเสนอที่คล้ายกัน


Ads by Google