1 Pertemuan 6 Using Predicate logic Matakuliah: T0264/Inteligensia Semu Tahun: Juli 2006 Versi: 2/1
2 Learning Outcomes Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : >
3 Outline Materi Materi 1 Materi 2 Materi 3 Materi 4 Materi 5
4 5. USING PRDICATE LOGIC Logika merupaka bentuk representasi Terdapat 2 jenis penalaran : 1.Penalaran Deduktif : Penalaran dimulai dari rpinsip umum untuk mendapatkan kesimpulan yang lebih khusus. 2.Penalaran Induktif : Penalaran dimulai dari fakta-fakta khsusus untuk mendapatkan kesimpulan umum. PROSES LOGIKA (LOGIC PROCESS) Input : Premis atau Fakta Output : Inferensi atau Konklusi
5 Operator Operator AND symbol Operator OR symbol Operator NOT symbol Operator For All symbol Operator There Exists symbol Operator Implication (jika-maka) symbol Operator Equivalent (jika dan hanya jika) symbol
6 5.1 Representing Simple Facts in Logic Representing Simple Facts in Logic It is raining. RAINING It is sunny. SUNNY It is windy. WINDY If it is rainning, then it is not sunny. RAINING SUNNY
7 A Predicate Logic Example 1.Marcus was a man. man(Marcus) 2.Marcus was a Pompeian. Pompeian(Marcus) 3.All Pompeian were Romans. x : Pompeian (x) Roman(x) 4.Caesar was a ruler. ruler(Caesar) 5.All Romans were either loyal to Caesar or hated him x : Roman(x) loyalto(x,Caesar) hate(x,Caesar) 6.Everyone is loyal to someone. x : y : loyalto (x,y)
8 A Predicate Logic Example 7.People only try to assassinate rulers they aren’t loyal to x : y : person(x) ruler(y) tryassassinate(x,y) loyalto(x,y) Marcus tried to assassinate Caesar. tryassassinate (Marcus, Caesar) 9.All men are people. x : man(x) person(x)
9 An Attempt to Prove loyalto(Marcus,Caesar)
10 Contoh lain Predicate Logic 1.Chandra adalah seorang mahasiswa 2.Chandra masuk jurusan Informatika 3.Setiap mahasiswa Informatika pasti mahasiswa Fasilkom 4.Algoritma adalah matakuliah yang sulit 5.Setiap mahasiswa Fasilkom pasti akan suka Algoritma atau membencinya 6.Setiap mahasiswa pasti menyukai suatu matakuliah 7.Mahasiswa yang tidak pernah hadir kuliah pada matakuliah slit, maka mereka pasti tidak suka terhadap matakuliah tersebut 8.Chandra tidak pernah hadir paka matakuliah Algoritma
11 Bentuk Predicate Logic 1.mahasiswa (Chandra) 2.Informatika (Chandra) 3. x : informatika(x) Fasilkom(x) 4.sulit(Algoritma) 5. x : Fasilkaom(x) suka(x,Algoritma) benci(x,Algoritma) 6. x : x : suka(x,y) 7. x : y : mahasiswa(x) sulit(y) hadir(x,y) suka(x,y) 8. hadir(Chandra,Algoritma)
12 Apakah Chandra suka mtakuliah Algoritma suka(Chandra,Algoritma) (8) mahasiswa(Chandra) sulit(Algoritma) hadir(Chandra,Algoritma) sulit(algoritma) hadir(Chandra,Algoritma) hadir(Chandra,Algoritma) (4) (1) (7)
Representing Instance and Isa Relationships Class membership is represented with unary predicates (such as Roman), each of which correspond to a class. Asserting that P(x) is true is equivalent to asserting that x is an instance (or element) of P. Three Ways of Representing Class Membership 1.man(Marcus) 2.Pompeian(Marcus) 3. x : Pompeian(x) Roman(x) 4.ruler(Caesar) 5. x:Roman(x) loyalto(x,Caesar) hate(x,Caesar)
14 Representing Instance and Isa Relationships 1.instance(Marcus,man) 2.instance(Marcus,Pompeian) 3. x : instance(x,Pompeian) instance(x,Roman) 4.instance(Caesar,ruler) 5. x : instance(x, Roman) loyalto(x,Caesar) hate(x,Caesar) 1.instance(Marcus,man) 2.instance(Marcus,Pompeian) 3.isa(Pompeian,Roman) 4.instance(Caesar,ruler) 5. x : instance(x,Roman) loyalto(x,Caesar) hate(x,Caesar) 6. x: y: z: instance(x,y) isa(y,z) instance(x,z)
Computable Functions and Predicates A Set of Facts about Marcus 1.man (Marcus) 2.Pompeian(Marcus) 3.born(Marcus,40) 4. x :man(x) mortal(x) 5.erupted(volcano,79) x : [Pompeian(x) died(x,79)] 6. x: t1: t2: mortal(x) born(x,t1) gt(t2- t1,150) dead(x,t2) 8.now = x: t:[alive(x,t) dead(x,t)] [ dead(x,t) alive(x,t)] 10. x: t1: t2: died(x,t1) gt(t2,t1) dead(x,t2)
16 One Way of Proving That Marcus Is Dead
17 > End of Pertemuan 6 Good Luck