knowledge representation
DESCRIPTION
TRANSCRIPT
![Page 1: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/1.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 1
Knowledge Representation IIKnowledge Representation IILogicsLogics
Artificial IntelligenceArtificial IntelligenceVersion 1.0Version 1.0
There are 10 types of people in this world- who understand binary There are 10 types of people in this world- who understand binary and who do not understand binaryand who do not understand binary
![Page 2: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/2.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 2
Propositional LogicPropositional Logic
![Page 3: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/3.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 3
IntroductionNeed formal notation to represent
knowledge, allowing automated inference and problem solving.
One popular choice is use of logic.Propositional logic is the simplest.
Symbols represent facts: P, Q, etc..These are joined by logical connectives (and,
or, implication) e.g., P Λ Q; Q RGiven some statements in the logic we can
deduce new facts (e.g., from above deduce R)
![Page 4: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/4.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 4
Syntactic Properties of Propositional Logic
If S is a sentence, S is a sentence (negation)If S1 and S2 are sentences, S1 S2 is a sentence
(conjunction)If S1 and S2 are sentences, S1 S2 is a sentence
(disjunction)If S1 and S2 are sentences, S1 S2 is a sentence
(implication)If S1 and S2 are sentences, S1 S2 is a
sentence (bi-conditional)
![Page 5: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/5.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 5
Semantic Properties of Propositional Logic
S is true iff S is false
S1 S2 is true iff S1 is true and S2 is true
S1 S2 is true iff S1is true or S2 is true
S1 S2 is true iff S1 is false or S2 is true
i.e., is false iff S1 is true and S2 is false
S1 S2 is true iff S1S2 is true and
S2S1 is true
![Page 6: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/6.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 6
Truth Table for Connectives
![Page 7: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/7.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 7
Model of a FormulaIf the value of the formula X holds 1 for the
assignment A, then the assignment A is called model for formula X.
That means, all assignments for which the formula X is true are models of it.
![Page 8: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/8.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 8
Model of a Formula
![Page 9: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/9.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 9
Model of a Formula: Can you do it?
![Page 10: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/10.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 10
Satisfiable FormulasIf there exist at least one model of a formula
then the formula is called satisfiable.The value of the formula is true for at least
one assignment. It plays no rule how many models the formula has.
![Page 11: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/11.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 11
Satisfiable Formulas
![Page 12: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/12.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 12
Valid FormulasA formula is called valid (or tautology) if all
assignments are models of this formula.The value of the formula is true for all
assignments. If a tautology is part of a more complex formula then you could replace it by the value 1.
![Page 13: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/13.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 13
Valid Formulas
![Page 14: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/14.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 14
Unsatisfiable FormulasA formula is unsatisfiable if none of its
assignment is true in no models
![Page 15: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/15.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 15
Logical equivalenceTwo sentences are logically equivalent iff true in same
models: α ≡ ß iff α╞ β and β╞ α
![Page 16: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/16.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 16
Deduction: Rule of Inference
1.Either cat fur was found at the scene of the crime, or dog fur was found at the scene of the crime. (Premise)
C v D
![Page 17: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/17.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 17
Deduction: Rule of Inference
2.If dog fur was found at the scene of the crime, then officer Thompson had an allergy attack. (Premise)
D → A
![Page 18: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/18.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 18
Deduction: Rule of Inference
3.If cat fur was found at the scene of the crime, then Macavity is responsible for the crime. (Premise)
C → M
![Page 19: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/19.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 19
Deduction: Rule of Inference
4.Officer Thompson did not have an allergy attack. (Premise)
¬ A
![Page 20: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/20.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 20
Deduction: Rule of Inference
5.Dog fur was not found at the scene of the crime. (Follows from 2 D → A and 4. ¬ A). When is ¬ A true? When A is false- right? Now, take a look at the implication truth table. Find what is the value of D when A is false and D → A is true
¬ D
![Page 21: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/21.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 21
Rules for Inference: Modus TollensIf given α → β
and we know ¬β Then ¬α
![Page 22: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/22.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 22
Deduction: Rule of Inference
6.Cat fur was found at the scene of the crime. (Follows from 1 C v D and 5 ¬ D). When is ¬ D true? When D is false- right? Now, take a look at the OR truth table. Find what is the value of C when D is false and C V D is true
C
![Page 23: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/23.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 23
Rules for Inference: Disjunctive SyllogismIf given α v β
and we know ¬α then β
If given α v βand we know ¬β then α
![Page 24: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/24.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 24
Deduction: Rule of Inference
7.Macavity is responsible for the crime. (Conclusion. Follows from 3 C → M and 6 C). When is C → M true given that C is true? Take a look at the Implication truth table.
M
![Page 25: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/25.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 25
Rules for Inference: Modus PonensIf given α → β
and we know α Then β
![Page 26: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/26.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 26
Conjunctive Normal Form (CNF)A formula is in conjunctive normal form
(CNF) if it is a conjunction (AND) of clauses, where a clause is a disjunction (OR) of literals or a single literal.
It is similar to the canonical product of sums form used in circuit theory
All of the following formulas are in CNF:
![Page 27: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/27.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 27
Conjunctive Normal Form (CNF)The following formulae are not in CNF:
The above three formulas are respectively equivalent to the following three formulas that are in conjunctive normal form:
![Page 28: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/28.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 28
Conjunctive Normal Form (CNF)Eliminate implication with its equivalence.
This will turn P → Q into ¬ P V QUse de Morgan's law to move the ¬ symbol
onto atoms (not sentences), replace:
Perform the following operation:
![Page 29: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/29.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 29
CNF
(p ^ ~q) V (r V s) ^ (r V t)(p V r V s ) ^ (p V r V t) ^ (~q V r V s)^(~q V r V t)
![Page 30: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/30.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 30
Horn Clause A Horn clause is a clause with at most one positive
literal. Any Horn clause therefore belongs to one of four
categories: 1. A rule: 1 positive literal, at least 1 negative literal.
A rule has the form "~P1 V ~P2 V ... V ~Pk V Q".
2. A fact or unit: 1 positive literal, 0 negative literals. 3. A negated goal : 0 positive literals, at least 1
negative literal. 4. The null clause: 0 positive and 0 negative literals.
Appears only as the end of a resolution proof.
![Page 31: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/31.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 31
First Order Logic orFirst Order Logic orFirst Order Predicate Logic orFirst Order Predicate Logic or
Predicate LogicPredicate Logic
![Page 32: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/32.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 32
IntroductionPropositional logic is declarativePropositional logic allows partial/disjunctive/negated
information(unlike most data structures and databases)
Meaning in propositional logic is context-independent(unlike natural language, where meaning depends on context)
Propositional logic has very limited expressive power(unlike natural language)E.g., cannot say “if any student sits an exam they either pass or fail”.
Propositional logic is compositional(meaning of B ^ P is derived from meaning of B and of P)
![Page 33: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/33.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 33
Introduction You see that we can convert the sentences
into propositional logic but it is difficultThus, we will use the foundation of
propositional logic and build a more expressive logic
![Page 34: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/34.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 34
IntroductionWhereas propositional logic assumes the
world contains facts,first-order logic (like natural language)
assumes the world containsObjects: people, houses, numbers, colors,
baseball games, wars, …Relations: red, round, prime, brother of, bigger
than, part of, comes between, …Functions: father of, best friend, one more
than, plus, …
![Page 35: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/35.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 35
Syntax of FOL: Basic ElementsConstants KingJohn, 2, NUS,... Predicates Brother, >,...Functions Sqrt, LeftLegOf,...Variables x, y, a, b,...Connectives , , , , Equality = Quantifiers ,
![Page 36: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/36.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 36
ExamplesKing John and Richard the Lion heart are
brothersBrother(KingJohn,RichardTheLionheart)
The length of left leg of Richard is greater than the length of left leg of King John> (Length(LeftLegOf(Richard)),Length(LeftLegOf(KingJohn)))
![Page 37: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/37.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 37
Atomic Sentences
![Page 38: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/38.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 38
Atomic Sentences
![Page 39: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/39.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 39
Complex SentencesComplex sentences are made from atomic sentences
using connectives:S, S1 S2, S1 S2, S1 S2, S1 S2,
Example
Sibling(KingJohn,Richard) Sibling(Richard,KingJohn)
![Page 40: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/40.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 40
Complex Sentences
![Page 41: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/41.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 41
FOL illustrated Five objects-1. Richard the Lionheart2. Evil King John3. Left leg of Richard4. Left leg of John5. The crown
![Page 42: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/42.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 42
FOL illustrated Objects are related with
Relations For example, King John
and Richard are related with Brother relationship
This relationship can be denoted by(Richard,John),(John,Richard)
![Page 43: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/43.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 43
FOL illustrated Again, the crown and
King John are related with OnHead Relationship-OnHead (Crown,John)
Brother and OnHead are binary relations as they relate couple of objects.
![Page 44: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/44.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 44
FOL illustrated Properties are relations
that are unary. In this case, Person can
be such property acting upon both Richard and JohnPerson (Richard)Person (John)
Again, king can be acted only upon JohnKing (John)
![Page 45: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/45.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 45
FOL illustrated Certain relationships
are best performed when expressed as functions.
Means one object is related with exactly one object.Richard -> Richard’s left legJohn -> John’s left leg
![Page 46: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/46.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 46
Universal quantification<variables> <sentence>
Everyone studies at KUET is smart:
x Studies (x,KUET) Smart (x)
x P is true in a model m iff P is true with x being each possible object in the model
Roughly speaking, equivalent to the conjunction of instantiations of P
![Page 47: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/47.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 47
Universal quantification Remember, we had five
objects, let us replace them with a variable x-
1. x ―›Richard the Lionheart
2. x ―› Evil King John3. x ―› Left leg of Richard4. x ―› Left leg of John5. x ―› The crown
![Page 48: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/48.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 48
Universal quantification Now, for the quantified
sentencex King (x) Person (x)
Richard is king Richard is Person
John is king John is personRichard’s left leg is king
Richard’s left leg is personJohn’s left leg is king John’s
left leg is personThe crown is king the crown is
person
![Page 49: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/49.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 49
Universal quantificationRichard is king Richard is
PersonJohn is king John is personRichard’s left leg is king
Richard’s left leg is person
John’s left leg is king John’s left leg is person
The crown is king the crown is person
Only the second sentence is correct, the rest is incorrect
![Page 50: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/50.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 50
A common mistake to avoidTypically, is the main connective with
Common mistake: using as the main connective with :
x Studies (x,KUET) Smart (x)
means “Everyone Studies at KUET and everyone is smart”
![Page 51: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/51.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 51
Existential Quantification<variables> <sentence>
Someone studies at KUET is smart:x Studies (x,KUET) Smart (x)
x P is true in a model m iff P is true with x being some possible object in the model
Roughly speaking, equivalent to the disjunction of instantiations of P
![Page 52: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/52.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 52
Another common mistake to avoidTypically, is the main connective with
Common mistake: using as the main connective with :
x Studies (x,KUET) Smart (x)
means some guys, if they study in KUET, then they are smart
![Page 53: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/53.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 53
Properties of quantifiers
x y is the same as y x
x y is the same as y x
x y is not the same as y x
![Page 54: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/54.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 54
Properties of quantifiersx y Loves(x,y)
“There is a person who loves everyone in the world”
y x Loves(x,y)
“Everyone in the world is loved by at least one person”
![Page 55: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/55.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 55
Properties of quantifiersQuantifier duality: each can be expressed using
the other
x Likes(x,IceCream) is equivalent to x Likes(x,IceCream)
x Likes(x,Broccoli) is equivalent tox Likes(x,Broccoli)
![Page 56: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/56.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 56
Properties of quantifiers Equivalences-1. x P is equivalent to x P2. x P is equivalent to x P3. x P is equivalent to x P4. x P is equivalent to x P
![Page 57: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/57.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 57
Equalityterm1 = term2 is true under a given interpretation if
and only if term1 and term2 refer to the same object
E.g., definition of Sibling in terms of Parent:x,y Sibling(x,y) [(x = y) m,f (m = f) Parent(m,x)
Parent(f,x) Parent(m,y) Parent(f,y)]
![Page 58: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/58.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 58
Example knowledge baseThe law says that it is a crime for an
American to sell weapons to hostile nations. The country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it by Colonel West, who is American.
Prove that Col. West is a criminal
![Page 59: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/59.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 59
Example knowledge base... it is a crime for an American to sell weapons to hostile nations:
American(x) Weapon(y) Sells(x,y,z) Hostile(z) Criminal(x)Nono … has some missiles,
Owns(Nono,x)Missile(x)
… all of its missiles were sold to it by Colonel WestMissile(x) Owns(Nono,x) Sells(West,x,Nono)
Missiles are weapons:Missile(x) Weapon(x)
An enemy of America counts as "hostile“:Enemy(x,America) Hostile(x)
West, who is American …American(West)
The country Nono, an enemy of America …Enemy(Nono,America)
![Page 60: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/60.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 60
Forward ChainingAmerican(x) Weapon(y) Sells(x,y,z) Hostile(z) Criminal(x)
Owns(Nono,x)Missile(x)Missile(x) Owns(Nono,x) Sells(West,x,Nono)Missile(x) Weapon(x)Enemy(x,America) Hostile(x)American(West)Enemy(Nono,America)
![Page 61: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/61.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 61
Forward ChainingAmerican(x) Weapon(y) Sells(x,y,z) Hostile(z) Criminal(x)
Owns(Nono,x)Missile(x)Missile(x) Owns(Nono,x) Sells(West,x,Nono)Missile(x) Weapon(x)Enemy(x,America) Hostile(x)American(West)Enemy(Nono,America)
![Page 62: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/62.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 62
Forward ChainingAmerican(West) Weapon(y) Sells(x,y,z)
Hostile(z) Criminal(x)
Owns(Nono,x)Missile(x)Missile(x) Owns(Nono,x) Sells(West,x,Nono)Missile(x) Weapon(x)Enemy(x,America) Hostile(x)American(West)Enemy(Nono,America)
![Page 63: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/63.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 63
Forward ChainingAmerican(West) Weapon(y) Sells(West,y,z)
Hostile(z) Criminal(x)
Owns(Nono,x)Missile(x)Missile(x) Owns(Nono,x) Sells(West,x,Nono)Missile(x) Weapon(x)Enemy(x,America) Hostile(x)American(West)Enemy(Nono,America)
![Page 64: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/64.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 64
Forward ChainingAmerican(West) Weapon(y) Sells(West,y,z)
Hostile(z) Criminal(x)
Owns(Nono,x)Missile(x)Missile(x) Owns(Nono,x) Sells(West,x,Nono)Missile(x) Weapon(x)Enemy(x,America) Hostile(x)American(West)Enemy(Nono,America)
![Page 65: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/65.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 65
Forward ChainingAmerican(West) Weapon(y) Sells(West,y,z)
Hostile(z) Criminal(x)
Owns(Nono,x)Missile(x)Missile(x) Owns(Nono,x) Sells(West,x,Nono)Missile(x) Weapon(x)Enemy(Nono,America) Hostile(x)American(West)Enemy(Nono,America)
![Page 66: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/66.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 66
Forward ChainingAmerican(West) Weapon(y) Sells(West,y,z)
Hostile(z) Criminal(x)
Owns(Nono,x)Missile(x)Missile(x) Owns(Nono,x) Sells(West,x,Nono)Missile(x) Weapon(x)Enemy(Nono,America) Hostile(Nono)American(West)Enemy(Nono,America)
![Page 67: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/67.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 67
Forward ChainingAmerican(West) Weapon(y) Sells(West,y,z)
Hostile(Nono) Criminal(x)
Owns(Nono,x)Missile(x)Missile(x) Owns(Nono,x) Sells(West,x,Nono)Missile(x) Weapon(x)Enemy(Nono,America) Hostile(Nono)American(West)Enemy(Nono,America)
![Page 68: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/68.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 68
Backward ChainingAmerican(West) Weapon(y) Sells(West,y,z)
Hostile(Nono) Criminal(x)
Owns(Nono,x)Missile(x)Missile(x) Owns(Nono,x) Sells(West,x,Nono)Missile(x) Weapon(x)Enemy(Nono,America) Hostile(Nono)American(West)Enemy(Nono,America)
![Page 69: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/69.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 69
Backward ChainingAmerican(West) Weapon(y) Sells(West,y,z)
Hostile(Nono) Criminal(x)
Owns(Nono,x)Missile(x)Missile(x) Owns(Nono,x) Sells(West,x,Nono)Missile(x) Weapon(x)Enemy(Nono,America) Hostile(Nono)American(West)Enemy(Nono,America)
![Page 70: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/70.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 70
Backward ChainingAmerican(West) Weapon(y) Sells(West,y,z)
Hostile(Nono) Criminal(x)
Owns(Nono,x)Missile(x)Missile(x) Owns(Nono,x) Sells(West,x,Nono)Missile(x) Weapon(x)Enemy(Nono,America) Hostile(Nono)American(West)Enemy(Nono,America)
![Page 71: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/71.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 71
Backward ChainingAmerican(West) Weapon(y) Sells(West,y,z)
Hostile(Nono) Criminal(x)
Owns(Nono,x)Missile(x)Missile(x) Owns(Nono,x) Sells(West,x,Nono)Missile(x) Weapon(x)Enemy(Nono,America) Hostile(Nono)American(West)Enemy(Nono,America)
![Page 72: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/72.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 72
Backward ChainingAmerican(West) Weapon(y) Sells(West,y,z)
Hostile(Nono) Criminal(x)
Owns(Nono,x)Missile(x)Missile(x) Owns(Nono,x) Sells(West,x,Nono)Missile(x) Weapon(x)Enemy(Nono,America) Hostile(Nono)American(West)Enemy(Nono,America)
![Page 73: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/73.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 73
Backward ChainingAmerican(West) Weapon(y) Sells(West,y,Nono)
Hostile(Nono) Criminal(x)
Owns(Nono,x)Missile(x)Missile(x) Owns(Nono,x) Sells(West,x,Nono)Missile(x) Weapon(x)Enemy(Nono,America) Hostile(Nono)American(West)Enemy(Nono,America)
![Page 74: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/74.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 74
Backward ChainingAmerican(West) Weapon(y) Sells(West,y,Nono)
Hostile(Nono) Criminal(x)
Owns(Nono,x)Missile(x)Missile(x) Owns(Nono,x) Sells(West,x,Nono)Missile(x) Weapon(x)Enemy(Nono,America) Hostile(Nono)American(West)Enemy(Nono,America)
![Page 75: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/75.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 75
…& the InferenceAmerican(West) Weapon(y) Sells(West,y,Nono)
Hostile(Nono) Criminal(West)
Owns(Nono,x)Missile(x)Missile(x) Owns(Nono,x) Sells(West,x,Nono)Missile(x) Weapon(x)Enemy(Nono,America) Hostile(Nono)American(West)Enemy(Nono,America)
![Page 76: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/76.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 76
Probability: Logic for Probability: Logic for UncertaintyUncertainty
![Page 77: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/77.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 77
Conditional ProbabilityDefinition of conditional probability:
P(a | b) = P(a b) / P(b) if P(b) > 0Product rule gives an alternative formulation:
P(a b) = P(a | b) P(b) = P(b | a) P(a)
![Page 78: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/78.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 78
Inference with Probability
![Page 79: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/79.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 79
Inference in ProbabilityP(toothache) =
0.108 + 0.012 + 0.016 + 0.064 = 0.2
![Page 80: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/80.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 80
Inference in ProbabilityP(cavity V toothache) =
0.108 + 0.012 + 0.072 + .008 + 0.016 + 0.064 = 0.28
![Page 81: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/81.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 81
Inference in ProbabilityCan also compute conditional probabilities:
![Page 82: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/82.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 82
Inference in ProbabilityCan also compute conditional probabilities:
![Page 83: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/83.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 83
Baye’s RuleProduct rule gives an alternative formulation:
P(a b) = P(a | b) P(b) = P(b | a) P(a)
Joining them together, we can find-P(a | b) = P(b | a) P(a)
P(b)
![Page 84: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/84.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 84
Application of Bayes’ RuleA doctor knows that the disease meningitis causes the patient to have a stiff neck is 50%Means probability of stiff neck given the probability of having meningitis P(s | m) = 0.5He also knows that in every 50000 patients, 1 may have meningitisMeans probability that a patient has meningitisP (m) = 1/50000He also knows that in every 20 patients, 1 may have stiff neckMeans probability that a patient has meningitisP (m) = 1/20Then, from Bayes’ ruleP(m | s) = P(s | m) P(m)
P(s)
![Page 85: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/85.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 85
Application of Bayes’ RuleP(m | s) = P(s | m) P(m)
P(s)= 0.5 X (1/50000)
1/20= 0.0002
Means he can expect only 1 in 5000 patients with a stiff neck
to have meningitis
![Page 86: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/86.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 86
ReferencesArtificial Intelligence: A Modern Approach
(2nd Edition)by Russell and NorvigChapter 7, 8, 9, 13
http://www.iep.utm.edu/p/prop-log.htm#H5 http://www.cs.yale.edu/homes/cc392/node5.h
tml
http://www.cs.nyu.edu/courses/spring03/G22.2560-001/horn.html
![Page 87: Knowledge representation](https://reader038.vdocuments.mx/reader038/viewer/2022110115/54bd2e3d4a795927668b4569/html5/thumbnails/87.jpg)
Rushdi Shams, Dept of CSE, KUET, Bangladesh 87
Acknowledgement Dr. Adel Elsayed
Research Leader, M3C Lab, University of Bolton, UK
Weiqiang WeiPhD Student, University of Bolton, UK