Berikut di bawah ini adalah contoh-contoh daftar knowledge base dalam bentuk bahasa alami (bahasa manusia). Knowledge base tersebut akan diubah menjadi knowledge base dalam bentuk first order logic (FOL).
Contoh 1:
Di bawah ini adalah daftar kalimat dalam bahasa alami (dalam hal ini menggunakan bahasa inggris), kemudian diubah ke bahasa logika (dalam hal ini first order logic / FOL).
Bahasa alami:
- Chandra is a student
- Chandra is a student in computer science
- Each computer science student is member of school of computer
- Algorithm is difficult
- Each student in computer science likes or hates the algorithm
- Each student likes one lesson
- The student which do not come to in difficult lessons, they do not like these lesson
- Chandra does not come in algorithm
First Order Logic (FOL):
daftar konstanta (constants): Chandra, algorithm, computer_science, school_of_computer)
daftar predikat (predicates):student(x), member(x,y), difficult(x), like(x,y), hate(x,y), come(x,y)
- Student (Chandra)
- Student (Chandra, computer_science)
- "x : student(x) Ù computer_science(x) Þ member (x, school_of_computer)
- Difficult(Algorithm)
- "x : student(x, computer_science) Þ like(x, Algorithm) Ú hate(x, Algorithm)
- "x $y : like(x, y)
- "x "y : student(x) Ù difficult(y) Ù Øcome(x, y) Þ Ølike(x, y)
- Øcome(Chandra, Algorithm)
Contoh 2:
Bahasa alami:
- Marcus is a person.
- Marcus is a Pompeian.
- All Pompeians are Roman.
- Caesar is a ruler.
- All Romans are either loyal to Caesar or hate Caesar.
- Everyone is loyal to someone.
- People only try to assassinate rulers to whom they are not loyal.
- Marcus tried to assassinate Caesar.
First Order Logic (FOL):
Daftar konstanta (constants): Marcus, Caesar
Daftar predikat (predicates): People(x), Pompeian(x), Roman(x), Ruler(x), Loyal(x,y), Hate(x,y), Assassinate(x,y)
- People(Marcus)
- Pompeian(Marcus)
- ꓯxPompeian(x) → Roman(x)
- Ruler(Caesar)
- ꓯx Roman(x) → [Loyal(x, Caesar) ꓦ Hate(x, Caesar)]
- ꓯxꓱyLoyal(x, y)
- ꓯxꓯy(People(x) É… Ruler(y) É… Assassinate(x, y)) → ¬Loyal(x, y)
- Assassinate(Marcus; Caesar)
Comments
Post a Comment