Ch 04- Knowledge and Reasoning
Ch 04- Knowledge and Reasoning
Knowledge level:
- Facts about environment
Implementation level:
- Uses kb and algorithms
- E.g. logic
- Taking any action kb agent use existing knowledge
along current input
- Single fact is sentence, expressed as formal
representation language
- TELL and ASK mechanism
- TELL agent about surrounding
- Agent ASK itself what action to be taken
Architecture of KB agent
Knowledge level:
- Agent describe what it knows
- Knowledge is define at this level
- Specify what agent knows and goal of program
- E.g taxi driving agent
Logical level:
- Knowledge is encoded in sentence
- Languages used: propositional and predicate
- E.g likes(ram, apple)
Implementation level:
- Physical level to logical level conversion
of form of logic
It is advantageous when know ledge is represented in
small extent
Role of reasoning in AI:
- Proposition logic are represented values between 0 & 1
and 2nd level is predicate logic
1. Propositional logic:
- Use of propositions which is either true or false
- e.g. leaves are green, Violets are blue
2. Predicate logic:
- Makes use of variable, constants, predicates,
functions and quantifiers
3. Higher order logic:
- Uses additional quantifiers
4. Fuzzy logic:
- Value between TRUE and FALSE
5. Other logic:
- Multi-value logic, modal logic, temporal logic
Production rule representation:
- If-Then rule
Syntax:
- Symbols are represented as capital letter A,B,C…
- Constants having truth values 0 and 1
- ‘(…)’ used this for atomic sentences
- Literals of any sentence ~A
- Relation between two propositions A ∧ B, A ∨ B
Semantics:
- Set of facts used to represents in a form of propositional
logic
- E.g. A means “It is hot”
B means “It is humid”
- Number of rules used e.g. (A ∧ B), (A ∨ B)
- (A ∧ B), (A ∨ B) have same meaning but in natural
language may not,
e.g. Radha started feeling feverish and Radha went to dr.
- PL is relation between truth values of one stmt to other
PL sentences-example:
- Symbols can be defined as,
1. A= “It is hot”
2. B= “It is humid”
3. C= “It is raining”
- We can select a symbol which is easy understand,
1. HT= “It is hot”
2. HM= “It is humid”
3. RN= “It is raining”
- “It is humid then it is hot” = HM → HT
- “If it is humid and hot then it is raining” =
(HT ∧ HM) → RN
Advantages:
- Simple
- Efficient
- Foundation for higher logic
- Reasoning is decidable
- Inference is easy
Disadvantages:
- Problem in complex queries
- Impractical
- Lengthy
- Weak representation language
- Can represent properties of entity
First order predicate logic
Represent relation using relation, variables and
quantifiers
Gorila is black = Gorila(x) → Black(x)
Syntax:
- “x” is domain value
- Constant: fixed value
- Variable: assigned value
- Function: function of any arguments
- Connectives are same
Quantifiers:
- Quantify the no. of variables
1. Universal quantifiers ∀ :
- “for all”
- ∀x:A means A is true for all values of x
2. Existential quantifiers ∃ :
- “there exist”
- ∃x: A means A is true for at least one value of x
- E.g. there is a white dog = ∃x: (Dog(x) ∧ White(x))
Sr. Propositional logic Predicate logic
No.
1 Cannot represent small worlds Very well represents
2 Weak knowledge representation Strong knowledge representation
3 Uses propositions Uses predicate
4 Can’t represent properties Represent properties
5 Can’t express specialization, Can express specialization,
generalizations generalizations
6 Foundation level logic Higher level logic
7 Insufficient in expressive Sufficient in expressive
8 Assumes worlds contain facts Assumes world contain object
relation, functions
9 Context independent Context dependent
10 Declarative Derivative
Resolution
Inference rule
New clause generated by using two clauses containing
literals
Literals are atomic symbol or negation of that
It builds sound, complete theorem
Resolution procedure:
- Convert english statement to logical form
- Convert logical statement into CNF
- Negate the conclusion
- Infer the two complementary literals by using resolution tree
Convert from logic to CNF (Clausal Normal Form)
- Eliminate implication (→)
e.g. P →Q = ~P V Q
- Eliminate and (∧)
e.g. P ∧ Q = i) P
ii) Q
- Eliminate Universal Quantifiers (∀)
∀x ∀y ∀z: given( x,y,z) = given( x,y,z)
- Eliminate Existential Quantifiers (∃ )
∃x: P1(x) V P2(x) = P1(f(x)) V P2(f(x))
Consider the following facts
1. Rimi is hungry
2. If Rimi is hungry she barks
3. If Rimi is barking then Raja is angry
Assumptions:
a= maid stole jewellery
b= butler was guilty
c= maid milked cow
d= butler get cream
Step 1: converted into propositional logic
1. a → ~ b
2. a V c
3. c → d
To prove that,
b→d
Step 2: converted into CNF
1. ~ a V ~b
2. a V c
3. ~ c V d
4. ~ b V d
Step 3: Negate the conclusion
~ (~ b V d) = b ∧ ~d = i] b
Hence, conclusion is proved to be true
Consider the following facts
1. Ravi likes all kind of food
2. Apple and chicken are food
3. Anything anyone eats and is not killed, Is food
4. Ajay eats peanuts and is still alive
5. Rita eats everything that ajay eats
Conclusion: ~jump(Ram)
Step 2: converted to CNF
1. At(Ram,temple)
2. ~At(x,temple) V At(x,postbox)
3. ~At(x,temple) V takeleft(x)
4. ~At(x,temple) V At(x,postbox)
5. ~At(x,temple) V takeright(x)
6. ~takeleft(x) V cross(x,ditch)
7. ~cross(x,ditch) V jump(x)
8. ~takeright(x) V at(x,log)
9. ~At(x,log) V jump(x)
Forward Chaining:
- When decision is based on available data
- Works from initial state and continue until one of the
goal state
- E.g. “if it is raining then we will take umbrella” this is
called forward chaining
- It is also called data driven inference technique
E.g. human(a) => mortal(a)
if human(Mandela) is true then
mortal(Mandela) is also true
Fig.1 Forward
chaining
Consider following facts and prove that “Colonel west
is an criminal” is true
1. It is a crime for an American to sell weapons to the
enemy nations
- American(x) ∧ weapon(y) ∧ enemy(z, america)
=> criminal(x)
2. Country nano is an enemy to America
- enemy(nano, America)
3. Nano has some missiles
- owns(nano,x)
- Missile(x)
4. All the missiles were sold to nano by colonel west
- missile(x) ∧ owns(nano,x) => sell(west,x,nano)
5. Missile is a weapon
- missile(x) => weapon(x)
actions
Aim: to achieve a goal state by proper sequence of
actions
Simple planning agent
environment
Fig. 3 Planning agent
Planning Problem
To achieve a goal,
- What will be effect of action
- What kind of environment
E.g. tic-tac-toe game, while taking next step, has to
1. Set of actions
2. Set of ordering preconditions
3. Set of casual links
4. Set of open preconditions
1. Set of actions:
Steps of plan
E.g. set of actions= { start, rightsock, rightshoe,
leftsock, leftshoe, finish}
Consistent plan:
Does not have cycle constraints
No open precondition
No conflicts
Hierarchical Planning
Also called as plan decomposition
Complex actions can be decomposed into more
Move(X,Y,Z)
Pickup(X,Y) Putdown(X,Z)
To create hierarchical plan to travel from source to
destination
travel(source, dest)
rules
Declarative language
Implementation of PROLOG
There are set of implementation of prolog
Different set can have different semantics
and syntax
Basics of Prolog
Extensions of PROLOG: “.pl” , “.pro”, “.p”
PERL along with PROLOG: “.pro”
Thank You