Download presentation
Presentation is loading. Please wait.
1
Propositional Logic Session 3
Expert Systems: Knowledge Representation & Automated Reasoning By:H.Nematzadeh
2
Expert system is an intelligent agent
We want to create an intelligent agent which can perceives its environment and adds new information to its knowledge base and answer questions! Intelligent agent Knowledge base perceive Environment Inference engine action
3
Knowledge base agent Such an intelligent agent is called knowledge base agent. We have several ways to represent the knowledge to the knowledge base: 1) logic: propositional logic, predicate logic 2) programming languages : C, Basic,… 3) semantic network …
4
Main concepts We want to show how we can represent the knowledge inside a knowledge base using a prepositional logic Two important things: syntax and semantic Syntax shows the grammar of the logic (how the prepositional logic is built) and semantic shows the meaning of the logic
5
Syntax The grammar of prepositional logic can be defined as follow:
Sentence atomicsentence|complexsentence Atomicsentencetrue|false|p|q|r… Complexsentence(sentence)|sentenceconectivesentence|- sentence Connective ^ |v | => |<=> Try to find (p ^ q) , (p v r)
6
Semantics Semantic of prepositional logic is either true or false. Truth table helps to find the semantics of more complex logics
7
Inference using truth table
Using a truth table show that –p can be concluded from the given knowledge base. 1)- AND all the terms in Knowledge Base 2)- check to see if you can conclude –p from 1 R1: p=> q -p R2: q=> r True or false? R3: -q
8
Inference using truth table
9
inference using resolution
1- change all logics inside the KB to the form of CNF 2- to prove the logic S, we add the –S (contradiction of S) in the form of CNF to the KB We repeat the following three steps to find a contradiction or a new production is not available: 1- choose two logics inside the KB as parents and 2-produce the child 3- if the result (the child) is empty, then a contradiction happened, otherwise add the child to the logics in the KB
10
inference using resolution
How to transform from non-CNF logics to CNF logics? 1- eliminate the THEN connective (=>) p=>q : -p v q 2-distribute the contradiction: (p v q ) : -p ^ -q, - (p ^ q ) : -p v -q 3- simplify the logic to the form of conjunction of disjunct logics (p ^ q ) v r = (p v r) ^ (q v r) 4- each logic should be added separately to the KB Rn-1 : (p v r) R n-2 : (q v r) Rn : (p v r) ^ (q v r)
11
inference using resolution
Rn-1 : p R n-2 : q R n-3 : (s v r) Rn : (p ^ q) ^ (s v r) (p ^ q) v (s ^ r) = ((p v r) ^ (q v r)) ^ ((p v s) ^ (q v s)) Rn-1 : (p v r) Rn-2 : (q v r) Rn-3 : (p v s) Rn-4 : (q v s)
12
Example 1 Can you conclude r from the following KB? CNF
13
Example 1 ø
14
Example 2 2- If people becomes cruel, they wont have good thoughts
q 1- If rules are difficult, people will be cruel. 2- If people becomes cruel, they wont have good thoughts 3- People will have good thoughts or they miss unity 4-If people are not enslaved, they wont miss unity q r q -r s t -s If the rules are difficult, will the people be enslaved?
15
Example 2 CNF ø
16
Example 3 Is Tom sick? s p q p t r -r s
1- if Tom buys a house under her wife’s name , he is either kind or sick. 2- if Tom is kind or he is unemployed then he is poor. 3- Tom is not poor. 4- Tom buys a house under his wife’s name. p q p t r -r s Is Tom sick?
17
Example 3 CNF ø
18
Inference using rules 1: 2: 3: 4: 5: 6: 7:
The proof for rule 1 is given. The last column should always be TRUE!
19
Example using rules Using rule 2 from slide 18, we can conclude –p from the knowledge base Question: Answer:
20
Remember slide 14 p q 1- If rules are difficult, people will be cruel. 2- If people becomes cruel, they wont have good thoughts 3- People will have good thoughts or they miss unity 4-If people are not enslaved, they wont miss unity q r q -r s t -s If the rules are difficult, will the people be enslaved?
21
Solution using inference rules
22
Shift to predicate logic
Using prepositional logic we can not represent general rules, for example we can not show this in prepositional logic: All people are mortal Using predicate logic it is easy show it:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.