Chapter 4 - AI - Notes
Chapter 4 - AI - Notes
Chapter 4 - AI - Notes
• Characteristics of Knowledge:
– It is large in nature and requires proper structuring.
– It may be incomplete and vague.
– It may keep on changing (dynamic).
• It enables to:
– Automate reasoning , Discover new facts, Deduce new facts that follow from the
KB, and Answer users queries
Knowledge base
– It operates by storing a set of sentences (facts and relationship between facts)
about the world in its KB.
(KB update)
Inference mechanism :
– With the help of inference mechanism deduce new sentences and use them to
Learning
decide what action to take
Learning mechanism:
– Adapt to changes in the environment by updating the relevant knowledge
(actions
Output
Knowledge
Inference
Base
Engine
environment
Input from
• Contains set of facts about the domain expressed in a suitable representation language
– TELL it (i.e. to add new sentences to the KB) and ASK it (i.e. to query the KBA)
– When one ASKs a question, the answer should follow from what has been
TELLed to the KB previously
– Inference mechanism determines what follows from what has been TELLed to
the KB
Inference Engine (IE)
• The Inference engine derives new sentences from the input and KB
• The agent operates as follows:
1. It receives percepts from environment
2. It computes what action it should perform (by IE and KB)
3. It performs the chosen action.
• Knowledge Level.
• Logical Level.
– The physical representation of the sentences in the logical level - how will it be
represented in the computer?
• Reasoning: is the process of constructing new sentences from existing facts in the KB.
– Proper reasoning ensures that the new configuration represent facts that actually
follow from the facts in the KB.
Parts of KR language:
Semantics: determines the facts in the world to which the sentences refer.
Why KR is important ?
• It enables to:
– Automate reasoning
– Discover new facts.
– Deduce new facts that follow from the KB
– Answer users queries
– Make decisions - select courses of actions
– etc.
How is Knowledge represented?
– Rather than procedural language (like C++/Java data structures), use declarative
languages (like prolog).
Logic as KR
– Proof Theory: how we can draw new conclusions from existing statements in the
logic.
– The meaning of a sentence depends on the sentence itself and on the context on
which the sentence was spoken
Natural languages:
5. Propositional logic
Examples: Given the following sentences about the “weather problem” convert them into PL
sentences:
• “It is humid.”:Q
S :=<Sentence> ;
Exercise: 1
Convert the following English sentences to Propositional logic. Let:
• if Sara is absolutely beautiful, then if her personality is not perfect, Dawit will not in
love with Sara :A (R P )
Exercise: 2
Let A= Lectures are active , R = Text is readable, P = Kebede will pass the exam,
• if the lectures are active, then if the text is not readable, Kebede will not pass the exam:A
(R P )
Terminology
o Valid sentence: A sentence is valid sentence or tautology if and only if it is True under
all possible interpretations in all possible worlds.
Example: “It’s raining or it’s not raining.” (RR).
Logical equivalence
(p Λ q) Λ r ≡ p Λ (q Λ r) Associativity of conjunction
(p ν q) ν r ≡ p ν (q ν r) Associativity of disjunction
p Λ (q ν r) ≡ (p Λ q) ν (p Λ r) Distributive of Λ over ν
p ν (q Λ r) ≡ (p ν q) Λ (p ν r) Distributive of ν over Λ
p q ≡ q p Contraposition
Inference Rules
Modus Ponens A, A B B
Unit Resolution A B, B A
Resolution A B, B C AC
e.g., AA
Example
• Example 1: Given the following facts and rules that relates facts; what can we say about
the weather condition?
• It is humid:
• If it is humid, then it is hot :
• If it is hot and humid, then it is raining:
– Q Premise
– QP Premise
– (P Q) R Premise
• Example: Prove that “my dog Fido is Nice, given that “all dogs are Nice.”
– This requires to get at the structure and meanings of statements (where FOL is
useful).
• First-Order Logic (FOL) is expressive enough to concisely represent any kind of situation
that are expressed in natural language.
– FOL represents objects and relations between objects, variables, and quantifiers in
addition to propositions
x (elephant(x) → gray(x))
Syntax of FOL
• Constants symbol
• Predicates:
– Predicates used to relate one object with another. E.g. brother, >,...
• Variables: x, y, a, b,...
• Connectives:
• Quantifiers:
– Two standard quantifiers: Universal (" for all, for every) and Existential ($ there
exists, some)
1. Universal quantification
3. Nested quantifiers
Properties of quantifiers
Quantifier duality: each can be expressed using the other, using negation ()
x Likes(x,icecream) xLikes(x,icecream)
– Everyone likes ice cream means that there is nobody who dislikes ice cream
x Likes(x,cake) xLikes(x,cake)
– There is someone who likes cake means that there is no one who dislikes cake
Sentence structure
In FOL the basic unit is a predicate (argument/terms) structure called sentence to represent facts.
• A predicate is the one that says something about the subject. E.g., There is a red book
friends(motherof(jonas), motherof(semu))
Sentences
Atomic sentences: formed from a predicate symbol followed by a parenthesized list of terms
Example:Brother(John, Richard)
• Atomic sentences can have arguments that are complex terms (e.g. term = function
(term1,...,termn) )
Example:married(fatherof(Richard),motherof(John))
Complex sentences: complex sentences are made by combining atomic sentences using
connectives:
tall(john) handsome(john)
• Sentences can also be formed using quantifiers to indicate how to treat variables:
– Universal quantifier: x lovely(x) - Everything is lovely.
Exercise - 1
xy loves(x, y)
Exercise - 2
1. Buffalo(Bob)
2. Pig(Pat)
3. x,y Buffalo(x) ^ Pig(y)→ outrun(x,y)
4. Buffalo(Bob) ^ Pig(Pat) And Introduction (1, 2)
5. Buffalo(Bob) ^ Pig(Pat) → outrun (Bob, Pat)
6. outrun(Bob,Pat)
7. Inference Mechanisms
Properties of Good KB
• A KB should be clear, correct, expressive, concise, context-insensitive and effective.
• Separate the KB from inference procedure.
• This allows the KE (creator of the KB) to focus on the content of the KB
• Define a generally applicable KB.
• Every KB has two potential consumers: human readers and inference procedure
• E.g. consider the sentence:
BearOfVerySmallBrain(Lilly).
Do you think the Inference engine be able to infer from this sentence facts such as:
Lilly is a bear or Lilly has a very small brain; that it has a brain at all