0% found this document useful (0 votes)
0 views

CH 4

Chapter 4 discusses knowledge and reasoning in artificial intelligence, focusing on logical agents, propositional and predicate logic, and inference methods. It emphasizes the importance of knowledge representation and knowledge-based systems in AI, detailing various methods for encoding knowledge. The chapter also covers the properties of logical systems, types of knowledge, and the role of inference in deriving conclusions from knowledge bases.

Uploaded by

abrishali171
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

CH 4

Chapter 4 discusses knowledge and reasoning in artificial intelligence, focusing on logical agents, propositional and predicate logic, and inference methods. It emphasizes the importance of knowledge representation and knowledge-based systems in AI, detailing various methods for encoding knowledge. The chapter also covers the properties of logical systems, types of knowledge, and the role of inference in deriving conclusions from knowledge bases.

Uploaded by

abrishali171
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

Chapter 4: Knowledge and Reasoning

 Logical Agents

Propositional Logic

Predicate (First-Order)Logic

Inference in First-Order Logic

Knowledge Representation

Knowledge-based Systems

Uncertain Knowledge and Reasoning


Knowledge and Reasoning
Knowledge
 The fact or condition of knowing something with familiarity
gained through experience or association.

 “The fact or condition of being aware of something” .(Ex.


Sun is hot, balls are round, sky is blue,…)

 Humans can know “things” and “reason”


– Representation: How are the things stored?
– Reasoning: How is the knowledge used?
• To solve a problem…
• To generate more knowledge
What is Logic ?
• Logic is the analysis of a language, is concerned with
reasoning and the validity of arguments.

• Symbolic logic is the science of thinking or reasoning .

• A piece of reasoning is valid if its conclusion is true in


cases where its premises are also true.
• Logic is concerned with truth values with their true and
false that are the fundamental units of logic, and almost all
logic is ultimately concerned with these truth values.
4.1 Logical Agents
• Logical agents apply inference to a knowledge base to derive
new information and make decisions

• Knowledge-based agents: agents that have an explicit


representation of knowledge that can be reasoned with

• Basic concepts of logic:

syntax: formal structure of sentences

semantics: truth of sentences with models


Cont...
• Logical agents deal with knowledge-based agents
(KBA)that bring knowledge to life in AI.

• Humans know things and do reasoning that are important


for artificial agents

• knowledge of action outcomes enables problem solving


agents to perform well in complex environments.

• A KBA can combine general knowledge with current


precepts to infer hidden aspects of the current state prior
to selecting actions.
Languages of Logic
•Why Logic is used in AI?
•Logic used as a representation for AI: knowledge-based
agents and for communicating concepts and theories
within the AI community.
•The central component of a KBA is its knowledge
base(KB): is a set of sentences(clauses).
Knowledge Bases

 Knowledge base = set of sentences in a formal language


 Declarative approach to building an agent (or other system): Tell it what it needs to know
Then it can Ask itself what to do - answers should follow from the KB
 Agents can be viewed at the knowledge level - i.e., what they know, regardless of how
implemented Or at the implementation level i.e., data structures in KB and algorithms that
manipulate them
4.2 Propositional Logic
• Logic in general - models and entailment

• A (declarative) sentence or a statement in propositional


logic is said to be proposition if and only if it is either
true or false but not both.

• E.g.: Zero is the smallest real number.

• Ethiopia is in Asia.
• Propositions are usually denoted by letters such as P, Q,
R etc
4.3 Predicate (First-Order)Logic
• The use of formal logic as a primary knowledge
representation

• Formal logic is a language with its own syntax, which


defines how to make sentences, and corresponding
semantics, which describe the meaning of the sentences.

• Stated with logical connector and quantifiers.


Conti….
• Formal logic is the field of study of entailment
relations, formal languages, truth conditions,
semantics, and inference.
• All propositions/statements are represented as
formulae which have a semantics according to the
logic in question.
• Logical system = Formal language + semantics
• Formal logics gives us a framework to discuss
different kinds of reasoning.
Properties of logical systems
• Consistency - no theorem of the system contradicts another.

• Soundness - the system's rules of proof will never allow a false inference
from a true premise. If a system is sound and its axioms are true then its
theorems are also guaranteed to be true.

• Completeness - there are no true sentences in the system that cannot, at


least in principle, be proved in the system.

• Some logical systems do not have all three properties.

• Kurt Godel's incompleteness theorems show that no standard formal


system of arithmetic can be consistent and complete.
How can knowledge be represented ?
• Symbolic methods
– Declarative Languages (Logic)
– Imperative Languages (C, C++, Java, etc.)
– Hybrid Languages (Prolog)
– Rules
– Frames
– Semantic Networks
• Non – symbolic methods
– Neural Networks
– Genetic Algorithms
Symbolic Methods of Knowledge Representation
Types of Knowledge
• Declarative Knowledge
– Description of notions, facts, and rules of the world
• E.g.
– For each lecture there is a specific time and place
– Only one lecture can take place at each time and place
• Description knowledge, non procedural, independent of targets and problem
solving
• Procedural Knowledge
– Description of procedures required to achieve targets
– Knowledge of the order in which actions must be performed
– Heuristic knowledge
• E.g.
– To construct the exams timetable, assign first the classes of the first year
– To reach Athens faster, take the airplane
It depends on the targets and problems
Propositional logic: Syntax
• Atomic sentence:
– A proposition symbol representing a true or false statement
• Negation:
– If P is a sentence, P is a sentence
• Conjunction:
– If P and Q are sentences, P  Q is a sentence
• Disjunction:
– If P and Q are sentences, P  Q is a sentence
• Implication:
– If P and Q are sentences, P  Q is a sentence
• Biconditional:
– If P and Q are sentences, P  Q is a sentence
• , , , ,  are called logical connectives
Propositional logic: Semantics
• A model specifies the true/false status of each proposition
symbol in the knowledge base
– E.g., P is true, Q is true, R is false
– With three symbols, there are 8 possible models, and they can be enumerated exhaustively

– Rules for evaluating truth with respect to a model:


Truth Table
• A truth table specifies the truth value of a composite sentence
for each possible assignments of truth values to its atoms

•The truth value of a more complex sentence can be evaluated


recursively or compositionally
Logical Equivalence
• Two sentences are logically equivalent iff they are
true in same models
Predicate ...
• Sentences can be constructed using proposition symbols (P,
Q, R) and boolean Connectives, such as conjunction (And),
disjunction (Or), implication (P implies Q).

• Ex: if P and Q then R, the preceding rule, P and Q, is called


the premise or antecedent, and R is the conclusion or
consequent.
Predicate ...
Predicate logic introduces the concept of quantifiers,
which allow us to refer to sets of objects.

 Using objects, attributes, and relations, we can


represent almost any type of knowledge.

Two quantifiers: universal (all objects of this type have


this attribute), existential (there exists some object that
has the specified attribute)
Universal quantification
• x P(x)

• Example: “Everyone at UNC is smart”


x At(x,UNC)  Smart(x)
Why not x At(x,UNC)  Smart(x)?

• Roughly speaking, equivalent to the conjunction of all possible


instantiations of the variable:
[At(John, UNC)  Smart(John)]  ...
[At(Richard, UNC)  Smart(Richard)]  ...

• x P(x) is true in a model m iff P(x) is true with x being each


possible object in the model
Existential quantification
• x P(x)

• Example: “Someone at UNC is smart”


x At(x, UNC)  Smart(x)
Why not x At(x,UNC)  Smart(x)?
• Roughly speaking, equivalent to the disjunction of all possible
instantiations:
[At(John,UNC)  Smart(John)] 
[At(Richard,UNC)  Smart(Richard)]  …

• x P(x) is true in a model m iff P(x) is true with x being some


possible object in the model
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
x y Loves(x,y)
“There is a person who loves everyone”
y x Loves(x,y)
“Everyone is loved by at least one person”
• Quantifier duality: each quantifier can be expressed using the
other with the help of negation
x Likes(x, IceCream) x Likes(x, IceCream)
x Likes(x, Broccoli)
Validity and satisfiability
A sentence is valid if it is true in all models,

e.g., True, A A, A  A, (A  (A  B))  B

Validity is connected to inference via the Deduction Theorem:

KB ╞ α if and only if (KB  α) is valid

A sentence is satisfiable if it is true in some model

e.g., A B, C

A sentence is unsatisfiable if it is true in no models

e.g., AA

Satisfiability is connected to inference via the following:

KB ╞ α if and only if (KB α) is unsatisfiable


4.4 Inference in First-Order Logic
• Inference is the process of deriving a specific sentence from a
KB (where the sentence must be entailed by the KB)
• It include unification, modus pones, etc
• Entailment: necessary truth of one sentence given another
entailment means that one thing follows from another: KB ╞ α
• This does mean Knowledge base KB entails sentence α if and
only if α is true in all worlds where KB is true
• Entailment is a relationship between sentences (i.e., syntax) that
is based on semantics
– inference: deriving sentences from other sentences
– soundness: derivations produce only entailed sentences
– completeness: derivations can produce all entailed sentences
• Inference in FOL does mean grounding approach: reduce all sentences to PL and
apply propositional inference techniques.
Inference rules and theorem proving
• FOL/Lifted inference techniques
– Propositional techniques + Unification.
– Generalized Modus Ponens
– Resolution-based inference
– forward chaining
– backward chaining
• simple example: query = Knows(John,x), i.e., who does John know?

p q θ
Knows(John,x) Knows(John,Jane) {x/Jane}
Knows(John,x) Knows(y,OJ) {x/OJ,y/John}
Knows(John,x) Knows(y,Mother(y)) {y/John,x/Mother(John)}
Knows(John,x) Knows(x,OJ) {fail}

To unify Knows(John,x) and Knows(y,z),


θ = {y/John, x/z } or θ = {y/John, x/John, z/John}

• Theorem: There is a single most general unifier (MGU) that is unique up to


renaming of variables.

• MGU = { y/John, x/z }


Syntax of FOL
• Constants: John, Sally, 2, ...
• Variables: x, y, a, b,...
• Predicates: Person(John), Siblings(John, Sally), IsOdd(2)
• Functions: MotherOf(John), Sqrt(x), ...
• Connectives: , , , , 
• Equality: =
• Quantifiers: , 
• Term: Constant or Variable or Function(Term1, ... , Termn)
• Atomic sentence: Predicate(Term1, ... , Termn) or Term1 = Term2
• Complex sentence: made from atomic sentences using connectives
and quantifiers
4.5 Knowledge Representation
• Knowledge is a description of the world.

• It determines a system‟s competence by what it knows.

• Representation is the way Knowledge is encoded.

• In general, a representation is a set of conventions about


how to describe a class of things

• A description makes use of the conventions of a


representation to describe some particular thing.
Knowledge Representation
• The function of any representation scheme is to capture essential
features of a problem domain and make that information
available to a problem solving procedure.
• KR is the method used to encode knowledge in an intelligent
system‟s knowledge base in computer-tractable form.
• KR is an important issue in both cognitive science and artificial
intelligence.
− In cognitive science, it is concerned with the way people store
and process information

− In artificial intelligence (AI), main focus is to store


knowledge so that programs can process it and achieve human
intelligence.
KR ...
• There are different ways /schemes of knowledge
representation:
1. Logical schemes: in the form of rules & facts in Prolog.
• Predicate calculus
• Propositional calculus
2. Procedural schemes: IF…THEN...rules
3. Structured schemes
• Scripts
• Frames
4. Networked schemes: relationship between objects
• Semantic nets
• Conceptual graphs
Representation in Predicate Logic

● Every human, animal and ● Cat is an animal and has a


bird is living thing who fur.
breathe and eat. animal(cat)  has(cat, fur)
X [human(X)  living(X)] ● All animals have skin and
X [animal(X)  living(X)] can move.
X [bird(X)  living(X)] X [animal(X)  has(X, skin)
● All birds are animal and can  canmove(X)]
fly. ● Giraffe is an animal who is
X [bird(X)  canfly(X)] tall and has long legs.
● Every man and woman are animal(giraffe)  has(giraffe,
humans who have two legs. long_legs)  is(giraffe, tall)
X [man(X)  haslegs(X)] ● Parrot is a bird and is green
X [woman(X)  haslegs(X)] in color.
X [human(X)  has(X, legs)] bird(parrot)  has(parrot,
green_colour)
Knowledge Representation using Frames
● Frames are more structured form of packaging knowledge,

− used for representing objects, concepts etc.

● Frames are organized into hierarchies or network of frames.

● Lower level frames can inherit information from upper level


frames in network.
Conti…
● Nodes are connected using links viz.,

− ako / subc (links two class frames, one of which is subclass of


other e.g., Technology_faculty class is ako of faculty class),

− is_a / inst ( connects a particular instance of a class frame e.g.,


Computer Science is_a Technology_faculty)

− a_part_of (connects two class frames one of which is


contained in other e.g., faculty class is_part_of department
class).

− Property link of semantic net is replaced by SLOT fields.


Conti….
● A frame may have any number of slots needed for describing
object. e.g.

− faculty frame may have name, age, address, qualification etc.


as slot names.
● Each frame includes two basic elements : slots and facets.

− Each slot may contain one or more facets (called fillers) which may take
many forms such as:
 value (value of the slot),

 default (default value of the slot),

 range (indicates the range of integer or enumerated values, a slot can have),

 demons (procedural attachments such as if_needed, if_deleted, if_added


Description of Frames
● Each frame represents either a class or an instance.

● Class frame represents a general concept whereas instance


frame represents a specific occurrence of the class instance.

● Class frame generally have default values which can be


redefined at lower levels.

● If class frame has actual value facet then decedent frames can
not modify that value.

● Value remains unchanged for subclasses and instances.


Inheritance Program in Prolog
find(X, Y) :- frame(X, Z), search(Z, Y), !.
find(X, Y) :- frame(X, [is_a(Z),_]), find(Z, Y), !.
find(X, Y) :- frame(X, [ako(Z), _]), find(Z, Y), !.
find(X, Y) :- frame(X, [a_part_of(Z), _]), find(Z, Y).
● Predicate search will basically retrieve the list of slots-facet pair
and will try to match Y for slot.

● If match is found then its facet value is retrieved otherwise


process is continued till we reach to root frame
Semantic Network
 Formalism for representing information about objects,
people, concepts and specific relationship between them.
 The syntax of semantic net is simple. It is a network of labeled
nodes and links.
− It‟s a directed graph with nodes corresponding to concepts,
facts, objects etc. and
− arcs showing relation or association between two concepts.
 The commonly used links in semantic net are of the following
types.
- isa  subclass of entity (e.g., campus is subclass of
university)
- inst  particular instance of a class (e.g., Ethiopia is an
instance of country)
- prop  property link (e.g., property of dog is „bark‟)
Representation of Knowledge in Sem Net

“Every human, animal and bird is living thing who


breathe and eat. All birds can fly. All man and woman
are humans who have two legs. Cat is an animal and
has a fur. All animals have skin and can move. Giraffe
is an animal who is tall and has long legs. Parrot is a
bird and is green in color”.
Representation in Semantic Net

Semantic Net
breathe, eat
Living_thing prop
isa isa
two legs isa fly
Human Animal Bird
isa isa inst isa inst
prop green
Man Woman Giraffe Cat Parrot
prop prop prop
inst fur
john skin, move tall, long legs
Inheritance
● Inheritance mechanism allows knowledge to be stored at the
highest possible level of abstraction which reduces the size of
knowledge base.
− It facilitates inferencing of information associated with semantic nets.

− It is a natural tool for representing taxonomically structured information


and ensures that all the members and sub-concepts of a concept share
common properties.

− It also helps us to maintain the consistency of the knowledge base by


adding new concepts and members of existing ones.

● Properties attached to a particular object (class) are to be


inherited by all subclasses and members of that class.
Property Inheritance Algorithm
Input: Object, and property to be found from Semantic Net;
Out put: Yes, if the object has the desired property else return
false;
Procedure:
● Find an object in the semantic net; Found = false;
● While {(object ≠ root) OR Found }
DO
{ If there is a a property attribute attached with an object then
{ Found = true; Report „Yes‟}
else
object=inst(object, class) OR isa(object, class)
};
● If Found = False then report „No‟; Stop
Coding of Semantic Net in Prolog
Isa facts Instance facts Property facts

isa(living_thing, nil). inst(john, man). prop(breathe, living_thing).


isa(human, living_thing). inst(giraffe, animal). prop(eat, living_thing).
isa(animals, living_thing). inst(parrot, bird) prop(two_legs, human).
isa(birds, living_thing). prop(skin, animal).
isa(man, human ). prop(move, animal).
isa(woman, human). prop(fur, bird).
isa(cat, animal). prop(tall, giraffe).
prop(long_legs, giraffe).
prop(tall, animal).
prop(green, parrot).
Inheritance Rules in Prolog
Instance rules:
instance(X, Y) :- inst(X, Y).
instance (X, Y):- inst(X, Z), subclass(Z,Y).
Subclass rules:
subclass(X, Y) :-is a(X, Y).
subclass(X, Y) :-is a(X, Z), subclass(Z, Y) .
Property rules:
property(X, Y) :- prop(X, Y).
property(X, Y) :- instance(Y,Z), property(X, Z).
property(X, Y) :- subclass(Y, Z), property(X, Z).
Queries

● Is john human? ?- instance(john, humans). Y


● Is parrot a living thing? ?- instance (parrot, living_thing).
● Is giraffe an animal? Y
● Is woman sub class of ?- instance (giraffe, animal).Y
living thing ?- subclass(woman,
● Does parrot fly? living_things). Y
● Does john breathe? ?- property(fly, parrot). Y
● has parrot fur? ?- property (john, breathe). Y
● Does cat fly? ?- property(fur, parrot). N
?- property(fly, cat). N
4.6 Knowledge-based Systems: KBSs
• Data, information, knowledge and wisdom are major
elements of human thinking and reasoning process = DIKW
chain =data pyramid
Knowledge-based Systems: KBSs
• KBSs are intended to perform tasks which require some specialized
knowledge and reasoning. E.g.. Medical diagnosis, geological
analysis, chemical compound identification, etc

• KBSs are often called expert systems because the problems in their
application domain are usually solved by human experts.

• Expert system is a computer program that simulates the judgment


and behaviour of a human that has expert knowledge and
experience in a particular field.

• KBSs / Expert systems consist of the ff. major parts(components)


are:
In automated AI systems, key issues:
• K. Engineering is a general term for the processes
involved in building expert systems: planning, KA, KR
system building, system installation, system
maintenance.
• Persons involved in expert system development are
domain expert, user, knowledge engineer and system
maintenance personnel.
1. Knowledge engineer is involved in the development of
the inference engine, structure of the knowledge base and
user interface.
2. Domain expert has special knowledge, judgment,
experience and methods to give advice and solve
problems.
KBS Components...
3. Knowledge acquisition: the transformation of potential
problem-solving expertise from some knowledge source to a
computer program for constructing KB/ES.
• KA: obtaining knowledge for use in the KB of an expert
system. Also called knowledge elicitation - obtaining
knowledge from a human expert (s) for use in an expert
system.
• In the state of the art in AI (especially NLP) is not
sufficiently advanced to permit fully-automated knowledge
elicitation due to the nature of the Knowledge
• Sources of Knowledge: Documents, Experts,
• techniques used for KA are protocol analysis, interviews,
observation, etc.
4. Knowledge representation: as a set of sentences of first
order logic symbolic encoding of propositions
5. The Explainer: provides explanation and verification of
knowledge reasoning.
• Knowledge reasoning: deducing/ infering /reasoning logical
consequences manipulation of symbols encoding
propositions to produce representations of new propositions
• It is a subsystem that explains the system's actions.
• The explanation can range from how the final or intermediate
solutions were arrived at to justifying the need for additional
data.
6. KB
• The storage of knowledge, contains the knowledge
necessary for understanding, formulating and for
solving problems.

• It is a warehouse of the domain specific knowledge


captured from the human expert via the knowledge
acquisition method.

• The KB of expert system contains both factual


(documented) and heuristic (judgemental) knowledge.
7. Inference Engine
• It is a brain of expert system and use of knowledge in a
productive way .

• It uses the control structure (rule interpreter) and


provides methodology for reasoning.
• It acts as an interpreter which analyses and processes the rules.

• It is to trace its way through a forest of rules to arrive at a


conclusion through the two approaches: forward chaining
and backward chaining
8. User interface

• It is a means of communication with the user.

• It provides facilities such as menus, graphical interface


etc. to make the dialog user friendly.

• Its responsibility is to convert the rules from its internal


representation (which user may not understand) to the
user understandable form.
THANK YOU

You might also like