copyright © 2002 cycorp writing efficient cycl part 1 part one –simpler is better –use rule...

19
Copyright © 2002 Cycorp Writing Efficient CycL Writing Efficient CycL Part 1 Part 1 Part One Simpler is Better Use Rule Macro Predicates Create Simplifying Vocabulary Part Two Factor out Commonality Existence is Expensive Exceptions are Exceptional State Negations Explicitly Generalize -- Don’t List – Use #$different

Post on 21-Dec-2015

212 views

Category:

Documents


0 download

TRANSCRIPT

Copyright © 2002 Cycorp

Writing Efficient CycL Writing Efficient CycL Part 1Part 1

• Part One– Simpler is Better

– Use Rule Macro Predicates

– Create Simplifying Vocabulary

• Part Two– Factor out Commonality

– Existence is Expensive

– Exceptions are Exceptional

– State Negations Explicitly

– Generalize -- Don’t List– Use #$different

Copyright © 2002 Cycorp

Writing Efficient CycL Writing Efficient CycL Part 1Part 1

• Simpler is Better• Use Rule Macro Predicates• Create Simplifying Vocabulary

Copyright © 2002 Cycorp

Simpler is BetterSimpler is Better

• Modularity leads to generality and reuse

• If it looks too complicated, it is

BETTER WORSE

GAFsBinary

Horn rulesSmall rules

RulesNon-binary

Non-horn rules1 gargantuan rule

Copyright © 2002 Cycorp

GAFs are better than rulesGAFs are better than rules

BETTER WORSE

GAFsBinary

Horn rulesSmall rules

RulesNon-binary

Non-horn rules1 gargantuan rule

Example: #$hasDiet

(#$hasDiet #$koala #$eucalyptus)(#$hasDiet #$cow #$grass)(#$hasDiet #$vampireBats #$blood)(#$hasDiet #$venusFlytrap #$fly-Insect)

Rule Macro Predicates = Rules + GAFs

99.9% of KB should be GAFs

Copyright © 2002 Cycorp

Binary is better than non-binaryBinary is better than non-binary

BETTER WORSE

GAFsBinary

Horn rulesSmall rules

RulesNon-binary

Non-horn rules1 gargantuan rule

Avoid gratuitously ternary or quaternary predicates:

(graduationDate ?PRSN ?DGREETYP ?DATE)

(graduationEvent ?PRSN ?EVENT)(dateOfEvent ?EVENT ?DATE)(degreeTypeOfGraduationEvent ?EVENT ?DGREETYP)

Value Null Vaule Vaule Vaule Null VauleNull Vaule Vaule Vaule Null Vaule Vaule

Non-Normal Table

Normal Table

Copyright © 2002 Cycorp

Horn-rules are better than Horn-rules are better than non-horn rulesnon-horn rules

BETTER WORSE

GAFsBinary

Horn rulesSmall rules

RulesNon-binary

Non-horn rules1 gargantuan rule

Horn Rule: (#$implies (#$isa ?ANIMAL #$Bird) (#$thereExists ?WING (#$and (#$isa ?WING #$Wing-AnimalBodyPart)

(#$anatomicalParts ?ANIMAL #$Wing-AnimalBodyPart)))))

Consequent of Non-horn Rule: (#$or (#$objectHasColor #$Rover #$TanColor) (#$objectHasColor #$Rover #$BlackColor))

If all of this is true, then

Copyright © 2002 Cycorp

Several small rules are better Several small rules are better than one gargantuan rulethan one gargantuan rule

BETTER WORSE

GAFsBinary

Horn rulesSmall rules

RulesNon-binary

Non-horn rules1 gargantuan rule

1 Gargantuan Rule:– way too complex to be correct– will never get used – large memory requirement– likely does not say what was intended– cannot be generalized

Copyright © 2002 Cycorp

Writing Efficient CycL Writing Efficient CycL Part 1Part 1

• Simpler is Better• Use Rule Macro Predicates• Create Simplifying Vocabulary

Copyright © 2002 Cycorp

Simpler is betterSimpler is better(#$genlPreds #$brothers #$siblings)

is better than

(#$implies (#$brothers ?AGT ?BRO) (#$siblings ?AGT ?BRO))

genlPredsRule Macro Predicates

helper functionmacros

ProgrammingOE

Copyright © 2002 Cycorp

Reason with the vocabulary itselfReason with the vocabulary itselfInstead of this:

(eats Cheetah Wildebeest)

(implies

(and

(isa ?EAT Eating)

(isa ?CH1 Cheetah)

(isa ?WIL1 Wildebeest)

(doer ?EAT ?CH1)

(objectActedOn ?WIL1)

(hasAttributes ?WIL1 Deceased))

(eats Cheetah Antelope)

(implies

(and

(isa ?EAT Eating)

(isa ?CH1 Cheetah) . . .

Do this:

(animalTypeEatsAnimalType Cheetah Wildebeest)

(implies (animalTypeEatsAnimalType ?ANM1 ?ANM2) (hasAttributes ?ANM2 Deceased))

(animalTypeEatsAnimalType Cheetah Antelope)

One rule applies to all animal types

Copyright © 2002 Cycorp

Reason with the vocabulary itself Reason with the vocabulary itself (cont.)(cont.)

Entering a lot of rich knowledge in a new

domain?

• add some abstractions as new vocabulary

• define new vocabulary in ways that link it up to other existing vocabulary

Now you can tersely write the things you need to say.

Copyright © 2002 Cycorp

Add Rule Macro PredicatesAdd Rule Macro Predicates

Simple vocabulary for the sake of being simple is not worth it. Add Rule Macro Predicates.

An extreme example of operating with too little vocabulary:

0(#$SuccessorFn 0)(#$SuccessorFn (#$SuccessorFn 0))(#$SuccessorFn (#$SuccessorFn (#$SuccessorFn 0)))(#$SuccessorFn (#$SuccessorFn (#$SuccessorFn (#$SuccessorFn 0)))). . .

Copyright © 2002 Cycorp

Writing Efficient CycL Writing Efficient CycL Part 1Part 1

• Simpler is Better• Use Rule Macro Predicates• Create Simplifying Vocabulary

Copyright © 2002 Cycorp

Some False IdeasSome False Ideas

Erroneous Mindset“vocabulary is expensive”

“complex assertions are cheap”

– Physics Envy– Maxwell’s Equations of KR

Copyright © 2002 Cycorp

New Vocabulary Will Not Make New Vocabulary Will Not Make Rules Less ReusableRules Less Reusable

• The same kinds of tools that help you find #$Dog will help you find your new vocabulary

• The meaning of #$Dog is only defined by how it’s linked up to other things in the system -- all new vocabulary must be linked up properly

• All truly large-scale, reusable, interesting knowledge bases are going to be big

• For all large-scale knowledge bases, you must have tools

Copyright © 2002 Cycorp

OE vs KE vs SME’s and Their OE vs KE vs SME’s and Their VocabularyVocabulary

• OE: make it so that a KE can create vocabulary

• KE: understand enough about the logic so that they can create vocabulary

• SME: use the vocabulary

– Should be able to say everything that they need to say with the available vocabulary

Copyright © 2002 Cycorp

The Rule of 10The Rule of 10

Simplifying many assertions is reason enough to create new vocabulary

(#$isa ?MAL #$MalePerson)

is better than(#$and (#$isa ?MAL #$Person) (#$hasGender ?MAL #$Masculine))

Copyright © 2002 Cycorp

Why Simplify Vocabulary?Why Simplify Vocabulary?

• Cyc is not a frame system:– Adding new vocabulary is NOT expensive

– Creating collections is NOT expensive

– Creating predicates is NOT expensive

– Creating functions is NOT expensive

– Creating microtheories is NOT expensive

• Reasoning with overly complicated rules is expensive

• Reasoning with overused vocabulary is hard to focus

Copyright © 2002 Cycorp

Summary SlideSummary Slide

• Simpler is Better

• Use Rule Macro Predicates

• Create Simplifying Vocabulary