knowledge representation and reasoning

108
Knowledge Representation and Reasoning

Upload: ek-rah

Post on 06-Dec-2015

38 views

Category:

Documents


6 download

DESCRIPTION

Knowledge Representation with AI applications, Propositional Logic, Predicate Calculus, Natural Language,Representation Semantic Networks, Productions rules, Frames, Object, Scripts, reasoning, Case

TRANSCRIPT

Page 1: Knowledge Representation and Reasoning

Knowledge Representation and Reasoning

Page 2: Knowledge Representation and Reasoning

The AI Cycle

• Almost all AI systems have the following components in general:

• Perception

• Learning

• Knowledge Representation and Reasoning

• Planning

• Execution

Page 3: Knowledge Representation and Reasoning

The AI Cycle

Page 4: Knowledge Representation and Reasoning

Knowledge and its types

• what the ‘knowledge’ is?

• Durkin refers to it as the “Understanding of a subject area”.

• A well-focused subject area is referred to as a knowledge domain, for example, medical domain, engineering domain, business domain, etc..

Page 5: Knowledge Representation and Reasoning

Knowledge and its types

• If we analyze the various types of knowledge we use in every day life, we can broadly define knowledge to be one of the following categories:

Page 6: Knowledge Representation and Reasoning

Knowledge and its types

• Procedural knowledge: Describes how to do things, provides a set of directions of how to perform certain tasks, e.g., how to drive a car.

• Declarative knowledge: It describes objects, rather than processes. What is known about a situation, e.g. it is sunny today, and cherries are red.

• Meta knowledge: Knowledge about knowledge, e.g., the knowledge that blood pressure is more important for diagnosing a medical condition than eye color.

Page 7: Knowledge Representation and Reasoning

Knowledge and its types

• Heuristic knowledge: Rule-of-thumb, e.g. if I start seeing shops, I am close to the market.– Heuristic knowledge is sometimes called shallow

knowledge.– Heuristic knowledge is empirical as opposed to

deterministic

• Structural knowledge: Describes structures and their relationships. e.g.– how the various parts of the car fit together to make a

car, or knowledge structures in terms of concepts, sub concepts, and objects.

Page 8: Knowledge Representation and Reasoning

Knowledge and its types

Page 9: Knowledge Representation and Reasoning

Towards Representation

• There are multiple approaches and schemes that come to mind when we begin to think about representation.

– Pictures and symbols This is how the earliest humans represented knowledge when sophisticated linguistic systems had not yet evolved.

– Graphs and Networks

– Numbers

Page 10: Knowledge Representation and Reasoning

• What types of knowledge is best represented using pictures? , e.g. can we represent the relationship between individuals in a family using a picture?

• We could use a series of pictures to store procedural knowledge, e.g. how to boil an egg.

• But we can easily see that pictures are best suited for recognition tasks and for representing structural information.

• However, pictorial representations are not very easily translated to useful information in computers because computers cannot interpret pictures directly with out complex reasoning.

• So even though pictures are useful for human understanding, because they provide a high level view of a concept to be obtained readily, using them for representation in computers is not as straight forward.

Page 11: Knowledge Representation and Reasoning

Graphs and Networks

• Graphs and Networks allow relationships between objects/entities to be incorporated, e.g., to show family relationships, we can use a graph.

Page 12: Knowledge Representation and Reasoning

Graphs and Networks

• We can also represent procedural knowledge using graphs, e.g. How to start a car?

• A graph for procedural knowledge

Page 13: Knowledge Representation and Reasoning

Numbers

• Numbers are an integral part of knowledge representation used by humans.

• Numbers translate easily to computer representation.

• Eventually, as we know, every representation we use gets translated to numbers in the computers internal representation.

Page 14: Knowledge Representation and Reasoning

Example

Page 15: Knowledge Representation and Reasoning

Example

• Using a description in words

• For the family above, we could say in words

– Tariq is Mona’s Father

– Ayesha is Mona’s Mother

– Mona is Tariq and Ayesha’s Daughter

Page 16: Knowledge Representation and Reasoning

Example

• This example demonstrates the fact that each knowledge representation scheme has its own strengths and weaknesses.

Page 17: Knowledge Representation and Reasoning

Formal KR techniques

• Facts– Facts are a basic block of knowledge (the atomic units of

knowledge). – They represent declarative knowledge (they declare knowledge

about objects). – A proposition is the statement of a fact. – Each proposition has an associated truth value. It may be either

true or false.

• In AI, to represent a fact, we use a proposition and its associated truth value, e.g.– Proposition A: It is raining– Proposition B: I have an umbrella– Proposition C: I will go to school

Page 18: Knowledge Representation and Reasoning

Formal KR techniques

• Single-valued or multiple –valued

• Uncertain facts

• Fuzzy facts

• Object-Attribute-Value triplets

Page 19: Knowledge Representation and Reasoning

Single-valued or multiple –valued

• Facts may be single-valued or multivalued, where each fact (attribute) can take one or more than one values at the same time, e.g. an individual can only have one eye color, but may have many cars.

• So the value of attribute cars may contain more than one value.

Page 20: Knowledge Representation and Reasoning

Uncertain Facts

• Sometimes we need to represent uncertain information in facts. These facts are called uncertain facts, e.g. it will probably be sunny today.

• We may chose to store numerical certainty values with such facts that tell us how much uncertainty there is in the fact.

Page 21: Knowledge Representation and Reasoning

Fuzzy Facts

• Fuzzy facts are ambiguous in nature, e.g. the book is heavy/light. – Here it is unclear what heavy means because it is a

subjective description.

• Fuzzy representation is used for such facts. While defining fuzzy facts, we use certainty factor values to specify value of “truth”.

• We will look at fuzzy representation in more detail later.

Page 22: Knowledge Representation and Reasoning

Object-Attribute Value Triplets(OVT)

• Object-Attribute Value Triplets(OVT) are a type of fact composed of three parts; object, attribute and value.

• Such facts are used to assert a particular property of some object, e.g. Ali’s eye color is brown.– Object: Ali– Attribute: eye color– Value: brown

• Ahmed’s son is Ali– Object: Ahmed– Attribute: son– Value: Ali

Page 23: Knowledge Representation and Reasoning

Object-Attribute Value Triplets(OVT)

Page 24: Knowledge Representation and Reasoning

Rules

• Rules are another form of knowledge representation.

• Durkin defines a rule as “A knowledge structure that relates some known information to other information that can be concluded or inferred to be true.”

Page 25: Knowledge Representation and Reasoning

Components of a Rule

• A Rule consists of two components– Antecedent or premise or the IF part– Consequent or conclusion or the THEN part

• For example, we have a rule: – IF it is raining THEN I will not go to school

• Premise: It is raining• Conclusion: I will not go to school.

Page 26: Knowledge Representation and Reasoning

Compound Rules

• Multiple premises or antecedents may be joined using AND (conjunctions) and OR (disjunctions), e.g.– IF it is raining AND I have an umbrella THEN I will go

to school.– IF it is raining OR it is snowing THEN I will not go to

school.

Page 27: Knowledge Representation and Reasoning

Types of rules

• Relationship– Relationship rules are used to express a direct

occurrence relationship between two events, e.g. • IF you hear a loud sound THEN the silencer is not working

• Recommendation– Recommendation rules offer a recommendation on

the basis of some known information, e.g.• IF it is raining THEN bring an umbrella

Page 28: Knowledge Representation and Reasoning

Types of rules

• Directive– Directive rules are like recommendations rule but they

offer a specific line of action, as opposed to the ‘advice’ of a recommendation rule, e.g.

• IF it is raining AND you don’t have an umbrella THEN wait for the rain to stop

Page 29: Knowledge Representation and Reasoning

Types of rules

• Variable Rule– If the same type of rule is to be applied to multiple

objects, we use variable rules, i.e. rules with variables, e.g.

• If X is a Student AND X’s GPA>3.7 THEN place X on honor roll.

• Such rules are called pattern-matching rules. The rule is matched with known facts and different possibilities for the variables are tested, to determine the truth of the fact.

Page 30: Knowledge Representation and Reasoning

Types of rules

• Uncertain Rules– Uncertain rules introduce uncertain facts into the

system, e.g.• IF you have never won a match THEN you will

most probably not win this time.

• Meta Rules– Meta rules describe how to use other rules, e.g.

• IF you are coughing AND you have chest congestion THEN use the set of respiratory disease rules.

Page 31: Knowledge Representation and Reasoning

Semantic networks

• Semantic networks are graphs, with nodes representing objects and arcs representing relationships between objects.

• Various types of relationships may be defined using semantic networks.

• The two most common types of relationships are– IS-A (Inheritance relation)– HAS (Ownership relation)

Page 32: Knowledge Representation and Reasoning

Semantic networks

• Let’s consider an example semantic network to demonstrate how knowledge in a semantic network can be used

Page 33: Knowledge Representation and Reasoning

Semantic networks

Page 34: Knowledge Representation and Reasoning

Semantic networks

• Network OperationTo infer new information from semantic networks, we can ask questions from nodes– Ask node vehicle: ‘How do you travel?’

– This node looks at arc and replies: road– Ask node Suzuki: ‘How do you travel?’

– This node does not have a link to travel therefore it asks other nodes linked by the IS-A link

– Asks node Car (because of IS-A relationship)– Asks node Vehicle (IS-A relationship)– Node Vehicle Replies: road

Page 35: Knowledge Representation and Reasoning

Problems with Semantic Networks

• Semantic networks are computationally expensive at run-time.

• In the worst case, we may need to traverse the entire network and then discover that the requested info does not exist.

• They try to model human associative memory, but in the human brain the number of neurons and links are in the order of 1015.

• It is not practical to build such a large semantic network, hence this scheme is not feasible for this type of problems.

• Semantic networks are logically inadequate as they do not have any equivalent quantifiers, e.g., for all, for some, none.

Page 36: Knowledge Representation and Reasoning

Frames

• “Frames are data structures for representing stereotypical knowledge of some concept or object” according to Durkin, a frame is like a schema, as we would call it in a database design.

• They were developed from semantic networks and later evolved into our modern-day Classes and Objects.

Page 37: Knowledge Representation and Reasoning

Frames

• For example, to represent a student, we make use of the following frame:

• The various components within the frame are called slots, e.g. Frame Name slot.

Page 38: Knowledge Representation and Reasoning

Frames

Page 39: Knowledge Representation and Reasoning

Frames

• Facets– A slot in a frame can hold more that just a value, it

consists of metadata and procedures also.

• The various aspects of a slot are called facets. They are a feature of frames that allows us to put constraints on frames. – e.g. IF-NEEDED Facets are called when the data of a

particular slot is needed.

• Similarly, IFCHANGED Facets are when the value of a slot changes.

Page 40: Knowledge Representation and Reasoning

Logic

• Just like algebra is a type of formal logic that deals with numbers, e.g. 2+4 = 6, propositional logic and predicate calculus are forms of formal logic for dealing with propositions. We will consider two basic logic representation techniques:

–Propositional Logic

–Predicate Calculus

Page 41: Knowledge Representation and Reasoning

Logic

• Propositional logicA proposition is the statement of a fact. We usually assign a symbolic variable to represent a proposition, e.g.p = It is rainingq = I carry an umbrella

• A proposition is a sentence whose truth values may be determined. So, each proposition has a truth value, e.g.–The proposition ‘A rectangle has four sides’ is true–The proposition ‘The world is a cube’ is false.

Page 42: Knowledge Representation and Reasoning

Logic

• Compound statements

Different propositions may be logically related and we can form compound statements of propositions using logical connectives. Common logical connectives are:

Page 43: Knowledge Representation and Reasoning

Logic

• Truth Table of Binary Logical Connectives

Page 44: Knowledge Representation and Reasoning

Logic

• Limitations of propositional logic– Propositions can only represent knowledge as

complete sentences, e.g. a = the ball’s color is blue.– Cannot analyze the internal structure of the sentence.– No quantifiers are available, e.g. for-all, there-exists– Propositional logic provides no framework for proving

statements such as:• All humans are mortal• All women are humans• Therefore, all women are mortals

• This is a limitation in its representational power.

Page 45: Knowledge Representation and Reasoning

Predicate calculus

• Predicate Calculus is an extension of propositional logic that allows the structure of facts and sentences to be defined. With predicate logic, we can use expressions like Color( ball, blue)

• This allows the relationship of sub-sentence units to be expressed, e.g. the relationship between color, ball and blue in the above example.

• Due to its greater representational power, predicate calculus provides a mechanism for proving statements and can be used as a logic system for proving logical theorems.

Page 46: Knowledge Representation and Reasoning

Logic

• Quantifiers

• Predicate Logic

• You already have done sufficient work. Lets just have a look at an example.

Page 47: Knowledge Representation and Reasoning
Page 48: Knowledge Representation and Reasoning

48

P R O P O S I T I O N A L C A L C U L U S

Page 49: Knowledge Representation and Reasoning

49

P R O P O S I T I O N A L C A L C U L U S

Page 50: Knowledge Representation and Reasoning

50

P R O P O S I T I O N A L C A L C U L U S

Page 51: Knowledge Representation and Reasoning

51

In Propositional Calculus, each atomic symbol denotes a proposition.

For example:-

it is raining = P

it is sunny = Q

A proposition:

If it is raining, then it is not sunny

P ¬Q

P R O P O S I T I O N A L C A L C U L U S

Page 52: Knowledge Representation and Reasoning

52

PREDICATE CALCULUS

Page 53: Knowledge Representation and Reasoning

53

• In Propositional Calculus, a single

propsitional symbol P may denote the entire

sentence it rained on Tuesday.

it rained on Tuesday =P

• In Predicate Calculus, a predicate weather

may be created, that describes a relationship

between a day and the weather:

weather(tuesday,rain)

P R E D I C A T E C A L C U L S

Page 54: Knowledge Representation and Reasoning

54

• Predicate Calculus also allows

expressions to contain variables.

• For example:

• For all values of X, where X is a day of the

week, the statement weather(X,rain) is

true:

i.e. it rains every day.

P R E D I C A T E C A L C U L S

Page 55: Knowledge Representation and Reasoning

55

P R E D I C A T E C A L C U L S

Page 56: Knowledge Representation and Reasoning

56

Symbols are used to denote objects, properties or relations in the world of discourse.

The use of words that suggest the symbol’s intended meaning assists programmers in understanding program code.

Thus, l ( g , k ) = like (george , kate )Both are formally equal in predicate calculus.

But later can be a great help, for humans, in indicating the relationship the expression represents.

Predicate Calculus, however, concerns only with the formal semantics.

P R E D I C A T E C A L C U L S

Page 57: Knowledge Representation and Reasoning

57

Improper Symbols. Followings are

used to form well formed expressions.

These are called Improper Symbols.

Parentheses “( )”

Commas “,”

Periods ”.”

P R E D I C A T E C A L C U L S

Page 58: Knowledge Representation and Reasoning

58

•Predicate Calculus Term

A predicate calculus term is either a constant, variable or a function expression.

•Predicate Symbols Types Constants Variables Functions Predicates

P R E D I C A T E C A L C U L S

Page 59: Knowledge Representation and Reasoning

59

Constants Used to name specific objects or properties in

the world.Constant symbols must begin with a

lowercase letter.Examples

georgetreetallbLUeaRT

true and false are constants, they are reserved as truth symbols.

P R E D I C A T E C A L C U L S

Page 60: Knowledge Representation and Reasoning

60

VariablesVariable symbols represent general

classes of objects or properties in the world.

Variable symbols must begin with an uppercase letter.

ExamplesGeorgeTreeTallBLUeART

P R E D I C A T E C A L C U L S

Page 61: Knowledge Representation and Reasoning

61

Functions A function expression is a function symbol

followed by its argument.

functionsymbol ( argument )Function symbol begins with a lowercase

letter.A function expression consists of a function

constant of arity n, followed by n terms, t1,t2,…,tn, enclosed in parentheses and separated by commas.

func ( t1,t2,t3,…,tn )

P R E D I C A T E C A L C U L S

Page 62: Knowledge Representation and Reasoning

62

Functionsgoerge ( likes,kate ) george is a

function constant of arity 2, and there are two terms of argument.

Examples of Functionsf(X,Y)father(david)price(banana)plus(2,3)

P R E D I C A T E C A L C U L S

Page 63: Knowledge Representation and Reasoning

63

P R E D I C A T E C A L C U L S

Page 64: Knowledge Representation and Reasoning

64

Predicate Calculus SymbolsA predicate name a relationship between

none (zero) or more objects in the

world.

Number of objects so related is the arity

(argument number) of the predicate.

Predicate symbols begin with lowercase

letters.

P R E D I C A T E C A L C U L S

Page 65: Knowledge Representation and Reasoning

65

Predicate Calculus SymbolsAn atomic sentence in Predicate Calculus

is a predicate of arity n followed by n

terms enclosed in parentheses and

separated by commas.

P R E D I C A T E C A L C U L S

Page 66: Knowledge Representation and Reasoning

66

Structure of Atomic Sentence

likes ( goerge, kate )

Predicate of arity 2

two terms enclosed in parentheses

likes(goerge, kate, jim,tuesday )

Predicate of arity 4

4 terms enclosed in parentheses

P R E D I C A T E C A L C U L S

Page 67: Knowledge Representation and Reasoning

67

Examples of Atomic Sentenceslikes(george,kate)

likes(george ,susie)

friends(bill,goerge)

helps(bill,george)

likes(X,george)

likes(X,X)

friends(father(david),father(andrew))

P R E D I C A T E C A L C U L S

Page 68: Knowledge Representation and Reasoning

68

Likes, friends, help are predicate symbols.

Predicates with the same names but different arities are considered different.

Bill, george, kate etc are constant symbols and represent objects in the problem domain.

The arguments to a predicate are terms and may also include variables or function expressions. For example:-

friends(father(david),father(andrew))

`

P R E D I C A T E C A L C U L S

Page 69: Knowledge Representation and Reasoning

69

Atomic sentences are also called

atomic expressions, atoms or

propositions.

Atomic sentences may be combined

with connectives:

¬, , , ,

A variable in the sentence refers to

unspecified objects in the domain.

P R E D I C A T E C A L C U L S

Page 70: Knowledge Representation and Reasoning

70

Predicate calculus includes two symbols that defines the meaning of a sentence containing a variable. These are variable quantifiers:

Universal quantifier – : Indicate that sentence is true for all values of variable in the

domain.

Existential quantifier -- : Indicate that sentence is true for some values of variable in

the domain.

P R E D I C A T E C A L C U L S

Page 71: Knowledge Representation and Reasoning

71

A quantifier is followed by a variable and a

sentence, such that:

Y friends(Y,peter): A few elements of

the domain are friends of Peter.

X likes(X,ice_cream): All elements of

the domain like ice cream.

P R E D I C A T E C A L C U L S

Page 72: Knowledge Representation and Reasoning

72

A few examples of sentences represented in

predicate calculus:

•If it doesn’t rain tomorrow, Aslam will go to the

mountains.

¬ weather (rain , tomorrow) go (aslam , mountains)

•All basketball players are tall.

X (basketball_player (X) tall(X))

P R E D I C A T E C A L C U L S

Page 73: Knowledge Representation and Reasoning

73

•Some people like bananas.

X (person (X) likes ( X, bananas)).

•Nobody likes taxes.

¬ X likes (X , taxes)

P R E D I C A T E C A L C U L S

Page 74: Knowledge Representation and Reasoning

74

PREDICATE CALCULUS SENTENCES

•Every atomic sentence is a sentence:

–If ‘s’ is a sentence, so is its negation

‘¬s’.

–If s1 and s2 are sentences, then so is their

conjunction‘s1

s2’.

–If s1 and s2 are sentences, then so is their

disjunction ‘s1

s2’.

–If s1 and s2 are sentences, then so is their

implication ‘s1

s2’.

Page 75: Knowledge Representation and Reasoning

75

•Every atomic sentence is a sentence:–If s1 and s2 are sentences, then so is their

equivalence s1 s2.

–If ‘X’ is a variable and ‘s’ is a sentence,

then X s is a sentence.

–If ‘X’ is a variable and ‘s’ is a sentence,

then X s is a sentence.

PREDICATE CALCULUS SENTENCES

Page 76: Knowledge Representation and Reasoning

76

•Let times and plus be function symbols of arity

2.

•Let equal and foo be predicate symbols of arity

2 and 3 respectively.

•plus (2 , 3) is a function. Not an atomic

sentence.

•equal (plus (2 , 3) , five) Is an atomic sentence.

EXAMPLES OF WELL FORMED PREDICATE SENTENCES

Page 77: Knowledge Representation and Reasoning

77

•equal (plus (2 , 3) , seven) Is an atomic

sentence.

•Though the interpretation value of this

sentence is false. But well formedness and

truth values are independent issues.

EXAMPLES OF WELL FORMED PREDICATE SENTENCES

Page 78: Knowledge Representation and Reasoning

78

X foo (X, two, plus (2, 3)) equal (plus (2, 3), five)

is a sentence because both the conjuncts are sentences.

(foo (two, two, plus (2, 3))) (equal (plus (2, 3), five) = true)

Is a sentence because all its components are sentences connected by logical operators.

EXAMPLES OF WELL FORMED PREDICATE SENTENCES

Page 79: Knowledge Representation and Reasoning

79

SEMANTICS FOR THE PREDICATE CALCULUS

•Predicate calculus semantics provide a formal basis for determining the truth values of expressions.

•The truth of expressions depends on the mapping of constants, variables, predicates, and functions on to the objects and relations

in the domain of discourse.

Page 80: Knowledge Representation and Reasoning

80

•For example:

•Information about a person George and his friends Kate and Susie may be expressed by:

friends(george,susie)

friends(george,kate)

SEMANTICS FOR THE PREDICATE CALCULUS

Page 81: Knowledge Representation and Reasoning

81

•If it is true that George is a friend of Kate and Susie, then each expression would have truth value (assignment) “T”.

•If George is friend of Kate but not of Susie, then, friends (george, kate) has the truth

value ”T” and, friends (george, susie) has the truth value ”F”.

SEMANTICS FOR THE PREDICATE CALCULUS

Page 82: Knowledge Representation and Reasoning

82

INTERPRETATION

– Each constant is assigned an element of D.

– Each variable is assigned to a nonempty subset of

D. These are the allowable substitutions for that

variable.

Let the domain D be a nonempty set. An

interpretation over D is an assignment of the

entities of D to each of the constant, variable,

predicate and function symbols of a predicate

calculus expression, such that:

Page 83: Knowledge Representation and Reasoning

83

– Each function f of arity m is defined on m

arguments of D. defines a mapping from Dm

into D.

– Each predicate p of arity n is defined on n

arguments from D defines a mapping from Dn

into { T, F}.

INTERPRETATION

Page 84: Knowledge Representation and Reasoning

84

Sentence:

friends (father_of (david), father_of (andrew) )

Functions:

father_of(david) function evaluation : george

father_of(andrew) function evaluation : allen

Semantics of expression:

friends(george, allen)

INTERPRETATION

Page 85: Knowledge Representation and Reasoning

85

INFERENCE RULES

The ability to infer new correct expressions

from a set of true assertions is an

important feature of predicate calculus.

These new expressions are correct in that

they are consistent with all previous

interpretations of the original set of

expressions.

Page 86: Knowledge Representation and Reasoning

86

INFERENCE RULES

An interpretation that makes a sentence

true is said to satisfy that sentence.

An interpretation that satisfy every

member of a set of expressions is said to

satisfy the set.

Page 87: Knowledge Representation and Reasoning

87

INFERENCE RULES

An expression X logically follows from a set

of predicate calculus expressions S if every

interpretation that satisfy S also satisfy X.

The function of logical inference is to produce

new sentences that logically follow a set of

predicate calculus sentences.

Page 88: Knowledge Representation and Reasoning

88

INFERENCE RULESAn inference rule is essentially a mechanical

means of producing new predicate calculus

sentences from other sentences.

S 1: S 1: X human (X) X human (X) mortal (X) mortal (X)

I: I: all human die.all human die.

If ‘Socrates’ is substituted for ‘X’If ‘Socrates’ is substituted for ‘X’ S 2: S 2: human(socrates) human(socrates) mortal mortal

(socrates).(socrates).S2, an expression logically following from S1, S2, an expression logically following from S1,

also satisfied by I.also satisfied by I.

Page 89: Knowledge Representation and Reasoning

89

DEFINITIONSSATISFY, MODEL, VALID, INCONSISTENT

• For a predicate calculus expression X and an

interpretation I:

– If X has a value of T under I and a

particular variable assignment, then I is

said to satisfy X.

– If I satisfies X for all variable assignments,

then I is a model of X.

Page 90: Knowledge Representation and Reasoning

90

DEFINITIONSSATISFY, MODEL, VALID, INCONSISTENT

• For a predicate calculus expression X and an

interpretation I:

– X is satisfiable if and only if there exist an

interpretation and variable assignment that

satisfy it. Otherwise, it is unsatisfiable.

Page 91: Knowledge Representation and Reasoning

91

DEFINITIONSSATISFY, MODEL, VALID, INCONSISTENT

– A set of expressions is satisfiable if and only if

there exist an interpretation and variable

assignment that satisfy every element.

– If a set of expression is not satisfiable, it is said

to be inconsistent.

– If X has a value T for all possible interpretations,

X is said to be valid.

Page 92: Knowledge Representation and Reasoning

92

DEFINITIONS LOGICALLY FOLLOWS, SOUND AND

COMPLETE• A predicate calculus expression X logically

follows from a set S of expressions, if every

interpretation and variable assignment that

satisfies S also satisfies X.

• An inference rule is sound if every predicate

calculus expression produced by the rule from a

set S of expressions also logically follows S.

Page 93: Knowledge Representation and Reasoning

93

DEFINITIONS LOGICALLY FOLLOWS, SOUND AND

COMPLETE

• An inference rule is complete if, given a

set S of predicate calculus expressions, the

rule can infer every expression that

logically follows from S.

Page 94: Knowledge Representation and Reasoning

94

INFERENCE RULESINFERENCE RULES

• If the sentences P and P Q are known to be

true, then inference rule Modus Ponens lets us

infer Q.

• Under the inference rule Modus Tollen,

if P Q is known to be false, we can infer ¬ P.

Page 95: Knowledge Representation and Reasoning

95

• AND Elimination allows us to infer the truth of

either of the conjuncts from the truth of a

conjunctive sentence. For instance, P Q lets us

conclude P and Q are true.

INFERENCE RULESINFERENCE RULES

Page 96: Knowledge Representation and Reasoning

96

• AND Introduction lets us infer the truth of a

conjunction from the truth of its conjuncts, for

instance, if P and Q are true, then P Q is true.

INFERENCE RULESINFERENCE RULES

Page 97: Knowledge Representation and Reasoning

97

UNIFICATION• To apply inference rules such as modus

ponens, an inference system must be able to

determine when two expressions are the

SAME or MATCHING.

• Unification is an algorithm for determining

the substitutions needed to replace the

variables, in order to make two predicate

calculus expressions MATCH.

Page 98: Knowledge Representation and Reasoning

98

• Unification and inference rules such as modus

ponens allow us to make inferences on a set of

logical assertions. To do this the logical database

must be expressed in an appropriate form:-

– All variables be universally quantified.

– Existentially quantified variables may be eliminated from

sentences in the database by replacing them with the

constants that make the sentence true.

UNIFICATION

Page 99: Knowledge Representation and Reasoning

99

– A variable may be replaced by any term:-• Other variables.• Function expressions.• For example a few instances of the expression

foo (X, a, goo (Y)):-Instances Substitutions or

Unifications– foo (fred, a, goo (Z)) {fred / X, Z / Y}– foo(W, a, goo(jack)) {W / X, jack / Y}– foo (Z, a, goo(moo(Z))) {Z / X, moo (Z) / Y}

UNIFICATION

Page 100: Knowledge Representation and Reasoning

100

• A variable is said to be BOUND to the value

substituted for it. Therefore substitutions are also

referred to be BINDINGS.

UNIFICATION

Page 101: Knowledge Representation and Reasoning

Reasoning

• Now that we have looked at knowledge representation, we will look at mechanisms to reason on the knowledge once we have represented it using some logical scheme.

• Reasoning is the process of deriving logical conclusions

from given facts.

• Durkin defines reasoning as ‘the process of working with knowledge, facts and problem solving strategies to draw conclusions’.

Page 102: Knowledge Representation and Reasoning

Types of reasoning

• Deductive reasoning

• Inductive reasoning

• Abductive reasoning

• Analogical reasoning

• Common-sense reasoning

• Non-Monotonic reasoning

Page 103: Knowledge Representation and Reasoning

Deductive reasoning

• Deductive reasoning, as the name implies, is based on deducing new information from logically related known information.

• A deductive argument offers assertions that lead automatically to a conclusion, e.g.– If there is dry wood, oxygen and a spark, there will be

a fire• Given: There is dry wood, oxygen and a spark• We can deduce: There will be a fire.

– All men are mortal. Socrates is a man.• We can deduce: Socrates is mortal

Page 104: Knowledge Representation and Reasoning

Inductive Reasoning• Inductive reasoning is based on forming, or inducing a

‘generalization’ from a limited set of observations, e.g.– Observation: All the crows that I have seen in my life are black.– Conclusion: All crows are black

• Comparison of deductive and inductive reasoning– We can compare deductive and inductive reasoning using an example.

We conclude what will happen when we let a ball go using both each type of reasoning in turn

– The inductive reasoning is as follows: By experience, every time I have let a ball go, it falls downwards. Therefore, I conclude that the next time I let a ball go, it will also come down.

– The deductive reasoning is as follows: I know Newton's Laws. So I conclude that if I let a ball go, it will certainly fall downwards.

• Thus the essential difference is that inductive reasoning is based on experience while deductive reasoning is based on rules, hence the latter will always be correct.

Page 105: Knowledge Representation and Reasoning

Abductive reasoning

• Deduction is exact in the sense that deductions follow in a logically provable way from the axioms. Abduction is a form of deduction that allows for plausible inference, i.e. the conclusion might be wrong, e.g.– Implication: She carries an umbrella if it is raining– Axiom: she is carrying an umbrella– Conclusion: It is raining

• This conclusion might be false, because there could be other reasons that she is carrying an umbrella, e.g. she might be carrying it to protect herself from the sun.

Page 106: Knowledge Representation and Reasoning

Analogical reasoning

• Analogical reasoning works by drawing analogies between two situations, looking for similarities and differences, e.g. – when you say driving a truck is just like driving

a car, by analogy you know that there are some similarities in the driving mechanism, but you also know that there are certain other distinct characteristics of each.

Page 107: Knowledge Representation and Reasoning

Common-sense reasoning

• Common-sense reasoning is an informal form of reasoning that uses rules gained through experience or what we call rules-of-thumb.

• It operates on heuristic knowledge and heuristic rules.

Page 108: Knowledge Representation and Reasoning

Non-Monotonic reasoning

• Non-Monotonic reasoning is used when the facts of the case are likely to change after some time, e.g.– Rule: IF the wind blows– THEN the curtains sway

• When the wind stops blowing, the curtains should sway no longer. However, if we use monotonic reasoning, this would not happen.

• The fact that the curtains are swaying would be retained even after the wind stopped blowing. In non monotonic reasoning, we have a ‘truth maintenance system’. It keeps track of what caused a fact to become true. If the cause is removed, that fact is removed (retracted) also.