56
cse@buffalo Symbolic Representation and Reasoning an Overview Stuart C. Shapiro Department of Computer Science and Engineering, Center for Multisource Information Fusion, and Center for Cognitive Science University at Buffalo, The State University of New York 201 Bell Hall, Buffalo, NY 14260-2000 [email protected] http:// www.cse.buffalo.edu /~shapiro/

Cse@buffalo Symbolic Representation and Reasoning an Overview Stuart C. Shapiro Department of Computer Science and Engineering, Center for Multisource

  • View
    217

  • Download
    0

Embed Size (px)

Citation preview

cse@buff

alo

SymbolicRepresentation and Reasoning

an Overview

Stuart C. Shapiro Department of Computer Science and Engineering,

Center for Multisource Information Fusion,

and Center for Cognitive Science

University at Buffalo, The State University of New York

201 Bell Hall, Buffalo, NY 14260-2000

[email protected]

http://www.cse.buffalo.edu/~shapiro/

September, 2004 S. C. Shapiro 2

cse@buff

alo

Introduction

Knowledge Representation

Reasoning

Symbols

Logics

September, 2004 S. C. Shapiro 3

cse@buff

alo

Knowledge RepresentationA subarea of Artificial Intelligence

Concerned with understanding, designing, and implementing ways of representing information in computers

So that programs can use this information toderive information that is implied by it,

to converse with people in natural languages,

to plan future activities,

to solve problems in areas that normally require human expertise.

September, 2004 S. C. Shapiro 4

cse@buff

alo

Reasoning

Deriving information that is implied by the information already present is a form of reasoning.

Knowledge representation schemes are useless without the ability to reason with them.

So, Knowledge Representation and Reasoning

September, 2004 S. C. Shapiro 5

cse@buff

alo

Knowledge vs. Belief

Knowledge: Justified True Belief

KR systems operate the same whether or not the information stored is justified or true.

So, Belief Representation and Reasoning would be better.

But we’ll stick with KR.

September, 2004 S. C. Shapiro 6

cse@buff

alo

What Is a Symbol?

“A symbol token is a pattern that can be compared to some other symbol token and judged equal with it or different from it…

Symbols may be formed into symbol structures by means of a set of relations…

The `objects’ that symbols designate may include … objects in an external environment of sensible (readable) stimuli.”

[Newell & Simon, Concise Encyclopedia of CS, 2004]

September, 2004 S. C. Shapiro 7

cse@buff

alo

What Is Logic?

The study of correct reasoning.

Not a particular KR language.

There are many systems of logic.

With slight abuse, we call a system of logic a logic.

KR research may be seen as the search for the correct logic(s) to use in intelligent systems.

September, 2004 S. C. Shapiro 8

cse@buff

alo

Parts of Specifying a Logic

Syntax

Semantics

Proof Theory

September, 2004 S. C. Shapiro 9

cse@buff

alo

Syntax

The specification of a set of atomic symbols, and the grammatical rules for combining them into well-formed expressions (symbol-structures).

September, 2004 S. C. Shapiro 10

cse@buff

alo

Syntactic ExpressionsAtomic symbols

Individual constants: Tom, Betty, whiteVariables: x, y, zFunction symbols: motherOfPredicate symbols: Person, Elephant, ColorPropositions: P, Q, BdT

TermsIndividual constants: Tom, Betty, whiteVariables : x, y, zFunctional terms: motherOf(Fred)

Well-formed formulas (wffs)Propositions (Proposition symbols) : P, Q, BdTAtomic formulas: Color(x, white), Duck(motherOf(Fred))Non-atomic formulas: TdB Td Bp

September, 2004 S. C. Shapiro 11

cse@buff

alo

Semantics

The specification of the meaning (designation) of the atomic symbols, and the rules for determining the meanings of the well-formed expressions from the meanings of their parts.

September, 2004 S. C. Shapiro 12

cse@buff

alo

Semantic ValuesTerms could denote

Objects

Categories of objects

Properties…

Wffs could denotePropositions

Truth values

September, 2004 S. C. Shapiro 13

cse@buff

alo

Truth ValuesCould be 2, 3, 4, …, ∞ different truth values.Some truth values are “distinguished”Needn’t have anything to do with truth in the real world.By default, we’ll assume 2 truth values.

Call distinguished one True (T)Call other False (F)

September, 2004 S. C. Shapiro 14

cse@buff

alo

Proof Theory

The specification of a set of rules, which, given an initial collection of well-formed expressions, specify what other well-formed expressions can be added to the collection.

September, 2004 S. C. Shapiro 15

cse@buff

alo

Proof / Knowledge BaseThe collection could be

A proofA knowledge base

The initial collection could beAxiomsHypothesesAssumptionsDomain facts & rules

The added expressions could beTheoremsDerived facts & rules

September, 2004 S. C. Shapiro 16

cse@buff

alo

Example

Logic: Standard Propositional LogicDomain: CarPool WorldAtomic Proposition Symbols:

BdT, TdB, Bd, Td, Bp, TpUnary wff-forming connective: Binary wff-forming connectives: , , ,

September, 2004 S. C. Shapiro 17

cse@buff

alo

Intended Interpretation(Intensional Semantics)

BdT: Betty drives TomTdB: Tom drives BettyBd: Betty is the driverTd: Tom is the driverBp: Betty is the passengerTp: Tom is the passenger

September, 2004 S. C. Shapiro 18

cse@buff

alo

Extensional (Denotational) Semantics

BdT T T T F F

TdB T T F T F

Bd T T T F F

Td T F F T F

Bp T F F T F

Tp T F T F F

Bd Tp T F T F F

Td Td T T T T T

Td Td F F F F F

5 of 26 = 64 possible situations

September, 2004 S. C. Shapiro 19

cse@buff

alo Properties of WffsSatisfiable

T in some situation

BdT T T T F F

TdB T T F T F

Bd T T T F F

Td T F F T F

Bp T F F T F

Tp T F T F F

Bd Tp T F T F F

Td Td T T T T T

Td Td F F F F F

September, 2004 S. C. Shapiro 20

cse@buff

alo Properties of WffsContingent

T in some, F in some

BdT T T T F F

TdB T T F T F

Bd T T T F F

Td T F F T F

Bp T F F T F

Tp T F T F F

Bd Tp T F T F F

Td Td T T T T T

Td Td F F F F F

September, 2004 S. C. Shapiro 21

cse@buff

alo Properties of WffsValid

T in all situations

BdT T T T F F

TdB T T F T F

Bd T T T F F

Td T F F T F

Bp T F F T F

Tp T F T F F

Bd Tp T F T F F

Td Td T T T T T

Td Td F F F F F

September, 2004 S. C. Shapiro 22

cse@buff

alo Properties of WffsContradictory

T in no situation

BdT T T T F F

TdB T T F T F

Bd T T T F F

Td T F F T F

Bp T F F T F

Tp T F T F F

Bd Tp T F T F F

Td Td T T T T T

Td Td F F F F F

September, 2004 S. C. Shapiro 23

cse@buff

alo

Logical Implication

P1, …, Pn logically imply Q

P1, …, Pn |= Q

In every situation that P1, …, Pn are True,

so is Q.

September, 2004 S. C. Shapiro 24

cse@buff

alo

Example: CarPool World KB

Let KBCPW =

Bd Bp

Td Tp

BdT Bd Tp

TdB Td Bp

TdB BdT

September, 2004 S. C. Shapiro 25

cse@buff

alo

Extensional (Denotational) Semantics

BdT T F

TdB F T

Bd T F

Td F T

Bp F T

Tp T F

Only 2 of the 64 situations where KBCPW are TSo, e.g.,

KBCPW, BdT |= Bd Bp

This is how a KB constrains a model to the domain we want.

September, 2004 S. C. Shapiro 26

cse@buff

alo

Proof TheorySome Rules of Inference

P

Q

P Q P

Q

P Q

P

QPP Q

P Q

Modus Ponens or Elimination Elimination

Elimination Introduction

September, 2004 S. C. Shapiro 27

cse@buff

alo

Derivation from Assumptions

Q is derivable from P1, …, Pn

P1, …, Pn |- Q

Starting from the collection P1, …, Pn,

one can repeatedly apply rules of inference,

and eventually get Q.

September, 2004 S. C. Shapiro 28

cse@buff

alo

Example: CarPool World ProofBdT Bd TpBdT

Bd Tp

Bd

Bd Bp

Bp

So, KBCPW, BdT |- Bd Bp

Bd Bp

September, 2004 S. C. Shapiro 29

cse@buff

alo

Theoremhood

If Q is derivable from no assumptions,

|- Q

We say that Q is provable,

and that Q is a theorem.

September, 2004 S. C. Shapiro 30

cse@buff

alo

Deduction Theorem

P1, …, Pn |= Q iff |= (P1 · · · Pn ) Q

P1, …, Pn |- Q iff |- (P1 · · · Pn ) Q

So theorem-proving is relevant to reasoning.

September, 2004 S. C. Shapiro 31

cse@buff

alo

Properties of Logics

SoundnessIf |- P then |= P

(If P is a provable, then P is valid.)

CompletenessIf |= P then |- P

(If P is valid, then P is a provable.)

September, 2004 S. C. Shapiro 32

cse@buff

alo

Soundness vs. Completeness

Soundness is the essence of correct reasoning

Completeness is less important because it doesn’t indicate how long it might take.

September, 2004 S. C. Shapiro 33

cse@buff

alo Commutativity Diagramfor

Sound and Complete Logics

P1, …, Pn |= Q |= (P1 · · · Pn ) Q

P1, …, Pn |- Q |- (P1 · · · Pn ) Q

completeness

completenessso

undn

ess

soun

dnes

sSo, whenever you want one, you can do another.

September, 2004 S. C. Shapiro 34

cse@buff

alo

Use of Commutativity DiagramRefutation proof techniques,

such as resolution refutationor semantic tableaux,

prove that there can be no situation

in which P1, …, and Pn are Trueand Q is False.

These are semantic proof techniques.

September, 2004 S. C. Shapiro 35

cse@buff

alo

Decision ProcedureA procedure that is guaranteed

to terminate

and tell whether or not P is provable.

September, 2004 S. C. Shapiro 36

cse@buff

alo

Semidecision ProcedureA procedure that, if P is a theorem

is guaranteedto terminate

and say so.

Otherwise, it may not terminate.

September, 2004 S. C. Shapiro 37

cse@buff

alo

A Tour ofSome Classes of Logics

Propositional Logics

Elementary Predicate Logics

Full First-Order Logics

September, 2004 S. C. Shapiro 38

cse@buff

alo

Propositional LogicsSmallest Unit: Proposition/Sentence

propositional logics that areSound

Complete

Have decision procedures

September, 2004 S. C. Shapiro 39

cse@buff

alo

What You Can Dowith Propositional Logic

• BettyDrivesTom TomDrivesBetty

• BettyDrivesTom NearTomBetty

• TomDrivesBetty NearTomBetty NearTomBetty

Can derive conclusions

even though the “facts” aren’t entirely known.

September, 2004 S. C. Shapiro 40

cse@buff

alo

Elementary Predicate LogicsPropositions plusPredicate (Relation) symbols,Individual terms, variables, quantifiers elementary predicate logics that are

SoundCompleteHave decision procedures

September, 2004 S. C. Shapiro 41

cse@buff

alo

What You Can Say withElementary Predicate Logic

x[Elephant(x) HasA(x, trunk)]

Can state generalities

before all individuals are known.

x[Elephant(x) Color(x, white)]

Can describe individuals

Even when they are not specifically known.

September, 2004 S. C. Shapiro 42

cse@buff

alo

Full First-Order LogicsElementary predicate logic plus

Function symbols/ functional terms

full first-order logics that areSound

None areComplete

Have decision procedures

September, 2004 S. C. Shapiro 43

cse@buff

alo

What You Can Say withFull First-Order Logic

p[HasProp(0, p)

x[HasProp(x, p) HasProp(x+1, p)]

x HasProp(x, p)]

Principle of induction.

September, 2004 S. C. Shapiro 44

cse@buff

alo

Example of Undecidability

• Large KB about ducks, etc.x[y (Duck(y) WalksLike(x,y))

y (Duck(y) TalksLike(x,y))

Duck(x)]x Duck(motherOf(x)) Duck(x)

• Duck(Fred)?• If Fred is not a duck, possible ∞ loop.

September, 2004 S. C. Shapiro 45

cse@buff

alo

Unsound ReasoningInduction

FromRaven(a) Black(a)

Raven(b) Black(b)

Raven(c) Black(c)

Raven(d) Black(d)

Raven(n) Black(n)

Tox[Raven(x) Black(x)]

September, 2004 S. C. Shapiro 46

cse@buff

alo

Unsound ReasoningAbduction

Fromx[Person(x) Injured(x) Bandaged(x)]

Person(Tom)

Bandaged(Tom)

ToInjured(Tom)

September, 2004 S. C. Shapiro 47

cse@buff

alo

What’s “First-Order” aboutFirst-Order Logics

Can’t quantify overFunction symbols

Predicate symbols

Propositions

September, 2004 S. C. Shapiro 48

cse@buff

alo

Examples ofSNePS

Reasoning

Using a Logic

Designed for KRR

September, 2004 S. C. Shapiro 49

cse@buff

alo

SNePS, A “Higher-Order” Logic: all(R)(Transitive(R) => (all(x,y,z)(R(x,y) and R(y,z) => R(x,z)))).

: Bigger(elephants, lions).

: Bigger(lions, mice).

: Transitive(Bigger).

: Bigger(elephants, mice)? Bigger(elephants,mice)

Really a higher-order language for a first-order logic

September, 2004 S. C. Shapiro 50

cse@buff

alo

“Higher-Order” Example 2

: all(source)(Trusted(source) => all(p)(Says(source, p) => p)).

: Trusted(Agent007).

: Says(Agent007, Dangerous(Dr_No)).

: Dangerous(Dr_No)? Dangerous(Dr_No)

September, 2004 S. C. Shapiro 51

cse@buff

alo

Designing New Connectives

: andor(1,1){OnFloor(G2), OnFloor(G1), OnFloor(1), OnFloor(2)}.

: OnFloor(G1).

: OnFloor(?where)? ~OnFloor(G2) ~OnFloor(1) ~OnFloor(2) OnFloor(G1)

September, 2004 S. C. Shapiro 52

cse@buff

alo

Belief Change

: andor(1,1){OnFloor(G2), OnFloor(G1), OnFloor(1), OnFloor(2)}.

: {OnFloor(G2), OnFloor(G1)} => {Location(belowGround)}.

: {OnFloor(1), OnFloor(2)} => {Location(aboveGround)}.

: perform believe(OnFloor(G2))

: Location(?where)? Location(belowGround)

: perform believe(OnFloor(2))

: Location(?where)? Location(aboveGround)

September, 2004 S. C. Shapiro 53

cse@buff

alo

Summary 1

Symbolic KRR uses logic.

There are many logics.The question is which to use.

September, 2004 S. C. Shapiro 54

cse@buff

alo

Summary 2A logic has a

SyntaxSemanticsProof Theory

Logics mayBe soundBe completeHave a decision procedure

September, 2004 S. C. Shapiro 55

cse@buff

alo

Summary 3

Logics provide non-atomic wffsThat can describe situations

Without knowing all specifics

September, 2004 S. C. Shapiro 56

cse@buff

alo

Summary 4

One can design and buildUseful new logics

And reasoning systems using them.