unit2
unit2
unit2
2001 IT 7.9
man(Marcus)
∀x = man (x) ----------> mortal (x)
Procedural knowledge:
• Are any attribute of object so basic that they occur in every problem
domain
• Are there relationships between attributes of objects
• Is any good set of primitives into which knowledge can be broken
• How should set of objects be represented?
• Given large knowledge in database how relevant parts can be
accessed
Representation of facts in Logic
Form
Propositional
Logic
Propositional logic
• Logical constants: true, false
• Propositional symbols: P, Q, S, ... (atomic sentences)
• Wrapping parentheses: ( … )
• Sentences are combined by connectives:
...and [conjunction]
...or [disjunction]
...implies [implication / conditional]
..is equivalent [biconditional]
...not [negation]
• Literal: atomic sentence or negated atomic sentence
Examples of PL sentences
• P means “It is hot.”
• Q means “It is humid.”
• R means “It is raining.”
• (P Q) R
“If it is hot and humid, then it is raining”
•QP
“If it is humid, then it is hot”
• A better way:
Hot = “It is hot”
Humid = “It is humid”
Raining = “It is raining”
Propositional logic (PL)
• A simple language useful for showing key ideas and definitions
• User defines a set of propositional symbols, like P and Q.
• User defines the semantics of each propositional symbol:
• P means “It is hot”
• Q means “It is humid”
• R means “It is raining”
• A sentence (well formed formula) is defined as follows:
• A symbol is a sentence
• If S is a sentence, then S is a sentence
• If S is a sentence, then (S) is a sentence
• If S and T are sentences, then (S T), (S T), (S T), and (S ↔ T) are sentences
• A sentence results from a finite number of applications of the above rules
Some terms
A complex sentence:
Propositional logic is a weak
language
• Can’t directly talk about properties of individuals or relations
between individuals (e.g., “Bill is tall”)
• Generalizations, patterns, regularities can’t easily be represented
(e.g., “all triangles have 3 sides”)
• First-Order Logic (abbreviated FOL or FOPC) is expressive enough to
concisely represent this kind of information
FOL adds relations, variables, and quantifiers, e.g.,
• “Every elephant is gray”: x (elephant(x) → gray(x))
• “There is a white alligator”: x (alligator(X) ^ white(X))
Example
• Variable symbols
• E.g., x, y, foo
• Connectives
• Same as in PL: not (), and (), or (), implies (), if and
only if (biconditional )
• Quantifiers
• Universal x or (Ax)
• Existential x or (Ex)
Sentences are built from terms and
atoms
• A term (denoting a real-world individual) is a constant symbol, a variable
symbol, or an n-place function of n terms.
x and f(x1, ..., xn) are terms, where each xi is a term.
A term with no variables is a ground term
• An atomic sentence (which has value true or false) is an n-place predicate
of n terms
• A complex sentence is formed from atomic sentences connected by the
logical connectives:
P, PQ, PQ, PQ, PQ where P and Q are sentences
• A quantified sentence adds quantifiers and
• A well-formed formula (wff) is a sentence containing no “free” variables.
That is, all variables are “bound” by universal or existential quantifiers.
(x)P(x,y) has x bound as a universally quantified variable, but y is free.
Quantifiers
• Universal quantification
• (x)P(x) means that P holds for all values of x in the
domain associated with that variable
• E.g., (x) dolphin(x) mammal(x)
• Existential quantification
• ( x)P(x) means that P holds for some value of x in the
domain associated with that variable
• E.g., ( x) mammal(x) lays-eggs(x)
• Permits one to make a statement about some object
without naming it
Quantifiers
• Universal quantifiers are often used with “implies” to form “rules”:
(x) student(x) smart(x) means “All students are smart”
• Universal quantification is rarely used to make blanket statements about every
individual in the world:
(x)student(x)smart(x) means “Everyone in the world is a student and is smart”
• Existential quantifiers are usually used with “and” to specify a list of properties
about an individual:
(x) student(x) smart(x) means “There is a student who is smart”
• A common mistake is to represent this English sentence as the FOL sentence:
(x) student(x) smart(x)
• But what happens when there is a person who is not a student?
Quantifier Scope
• Universal instantiation
• x P(x) P(A)
• Universal generalization
• P(A) P(B) … x P(x)
• Existential instantiation
• x P(x) P(F) skolem constant F
• Existential generalization
• P(A) x P(x)
Universal instantiation
(a.k.a. universal elimination)
• If (x) P(x) is true, then P(C) is true, where C is any constant in the
domain of x
• Example:
(x) eats(Ziggy, x) eats(Ziggy, IceCream)
• The variable symbol can be replaced by any ground term, i.e., any
constant symbol or function symbol applied to ground terms only
Existential instantiation
(a.k.a. existential elimination)
• From (x) P(x) infer P(c)
• Example:
• (x) eats(Ziggy, x) eats(Ziggy, Stuff)
• Note that the variable is replaced by a brand-new constant not
occurring in this or any other sentence in the KB
• Also known as skolemization; constant is a skolem constant
• In other words, we don’t want to accidentally draw other inferences
about it by introducing the constant
• Convenient to use this to reason about the unknown object, rather
than constantly manipulating the existential quantifier
Existential generalization
(a.k.a. existential introduction)
• If P(c) is true, then (x) P(x) is inferred.
• Example
eats(Ziggy, IceCream) (x) eats(Ziggy, x)
• All instances of the given constant symbol are replaced by the new
variable symbol
• Note that the variable symbol cannot already exist anywhere in the
expression
Clause Form
3.Change variable names such that, each quantifier has a unique name.
We do this in preparation for the next step. As variables are just dummy names,
changing a variable name doesnot affect the truth value of the wff.
Suppose we have
x P(x) Ú x Q(x) will be converted to x P(x) Ú y Q(y)
4.Move all the quantifiers to the left of the formula without changing their relative
order.
As we already have unique names for each quantifier in the previous step, this will not
cause a problem.
Performing this on our example we get :
x y z [ ~Roman(x) Ú ~know(x,Marcus)] Ú [ hate(x,Caesar) Ú(~hate(y,z) Ú
thinkcrazy(x,y))]
5. Eliminate existential quantifiers
We can eliminate the existential quantifier by simply replacing the variable with a reference to a
function that produces the desired value.
for eg. : y President(y) can be transformed into the formula President(S1)
If the existential quantifiers occur within the scope of a universal quantifier, then the value that
satisfies the predicate may depend on the values of the universal quantified variables.
For eg.. x z fatherof(z,x) will be converted to x fatherof( S2(x),x )
7Father(chris,y1) 4
bill/y1
2 nil
Resolution in Propositional Logic
Steps for Resolution:
(1) man(Marcus)
(2) Pompeian(Marcus)
(3) Pompeian(x1) Roman(x1)
(4) ruler(Caesar)
(5) Roman(x2) loyalto(x2, Caesar) hate(x2, Caesar)
(6) loyalto(x3, S1(x3))
(7) man(x4) ruler(y1) tryassassinate(x4, y1) loyalto(x4, y1)
(8) tryassassinate(Marcus, Caesar)
Proving Marcus Not Loyal to Caesar
loyalto(M, C) man(x4) ruler(y1) tryassassinate(x4, y1) loyalto(x4, y1)
(M/x4)(C/y1)
tryassassinate(M,C) tryassassinate(M,C)
nil
Back to Marcus
• Consider the wffs we created above:
1. man(Marcus)
2. Pompeian(Marcus)
3. born(Marcus,40)
4. ∀x: man(x) → mortal(x)
5. erupted(volcano,79) /\ ∀x: Pompeian(x) → died(x,79)
6. ∀x ∀t1 ∀t2: mortal(x) /\ born(x,t1) /\ gt(t2-t1,150) → dead(x,t2)
7. now=2023
8. ∀x ∀t: [alive(x,t) → ~dead(x,t)] /\ [~dead(x,t) →alive(x,t)]
• Suppose we now want to use resolution to prove that “Marcus is not alive now”. We firstly have to
convert these statements to clause form:
1. man(Marcus)
2. Pompeian(Marcus)
3. born(Marcus,40)
4. ~man(x) \/ mortal(x)
5. erupted(volcano,79)
6. ~Pompeian(x1) \/ died(x1,79)
7. ~mortal(x2) \/ ~born(x2,t1) \/ ~gt(t2-t1,150) \/ dead(x2,t2)
8. now=1991
9. ~alive(x3,t) \/ dead(x3,t)
10. ~ dead(x4,t3) \/ alive(x4,t3) 7
• We want to prove ~alive(Marcus,2023).
• We negate this and convert it clause form: alive(Marcus, now) and find a contradication:
alive(Marcus,2023) (10)
↓ Marcus/ x4, 2023/t3
~ dead(Marcus,2023) (7)
↓ Marcus/ x2, 2023/t2
Marcus/ x
~man(Marcus) \/ ~gt(2023-40,150) (1)
~gt(2023-40,150)
Ø
Example:
1.John likes all kind of food.
2.Apple and vegetable are food
3.Anything anyone eats and not killed is food.
4.Anil eats peanuts and still alive
5.Harry eats everything that Anil eats.
Prove by resolution that:
6.John likes peanuts.
• Semantic Nets
• Frame
Weak slot filler structure
Partitioned Semantic Nets
214
A Simplified Frame System (Cont’d)
215
A Simplified Frame System (Cont’d)
216
Representing the Class of All
Teams as a Metaclass
217
Representing the Class of All
Teams as a Metaclass (Cont’d)
218
Classes and Metaclasses
219
Representing Relationships among Classes
220
Representing Relationships
among Classes (Cont’d)
221
Slots as Full – Fledged Objects
An inverse attribute.
222
Representing Slots as Frames, I
223
Representing Slots as Frames, II
224
Representing Slots as Frames, III
225
Representing Slots as Frames, IV
226
Associating Defaults with Slots
227
A Shorthand Notation for
slot-Range Specification
228
Representing Slot - Values
As simple frames :
229
Tangled Hierarchies
230
More Tangled Hierarchies
231
Defining Property Inheritance
Inferential Distance :
232
Algorithm : Property Inheritance
To retrieve a value V for slot S of an instance F do:
(a) If a value is found, add it to CANDIDATES and terminate that branch of the
search.
(b) If no value is found but there are instance or isa links upward, follow them.
(c) Otherwise, terminate the branch.
(a) See if there is any other element of CANDIDATES that was derived from a
class closer to F than
the class from which C came.
(b) If there is, then, remove C from CANDIDATES.
What is CYC?
• An ambitious attempt to form a very large knowledge base aimed at
capturing common-sense reasoning.
• Initial goals to capture knowledge from a hundred randomly selected articles
in the Encyclopedia Britannica.
• Also, Both Implicit and Explicit knowledge encoded.
• Moreover, Emphasis on study of underlying information (assumed by the
authors but not needed to tell to the readers. )
• Example: Suppose we read that Wellington learned of Napoleon’s
death . Then we (humans) can conclude Napoleon never new that
Wellington had died.
How do we do this?
So, We require special implicit knowledge or common-sense
such as:
• We only die once.
• You stay dead.
• Moreover, You cannot learn anything when dead.
• Time cannot go backward.
Why build large knowledge bases:
1. Brittleness
• Specialised knowledge bases are brittle.
• Hard to encode new situations and nongraceful degradation in
performance.
• Commonsense based knowledge bases should have a firmer
foundation.
2. Form and Content
• Moreover, Knowledge representation may not be suitable for AI.
• Commonsense strategies could point out where difficulties in content
may affect the form.
3. Shared Knowledge
• Also, Should allow greater communication among systems with
common bases and assumptions.
How is CYC coded?
• By hand.
• Special CYCL language:
• LISP-like.
• Frame-based
• Multiple inheritance
• Slots are fully fledged objects.
• Generalized inheritance — any link not just isa and instance.
CYCL
• Language to represent CYC
• Frame based system
• Eg. Mary likes people who program solely in Lisp
CYCL
Mary:
likes: ?
Constraints : (Lisp Constraint)
Lisp Constraint:
slot constrained: (likes)
slot value subsumes : ( The set of X(person All Instance) AND (Programs in X Lisp) AND
(NOT (There exists Y (Language All Instance)) AND ( NOT EQUAL Y
Lisp))
( Programs In X)))
Bob: Programs In(Lisp)
John : Programs In (Lisp. C)
THANK YOU