View
216
Download
0
Tags:
Embed Size (px)
Citation preview
Copyright © 2002 Cycorp
Writing Efficient CycL: Part 2
• Part One: General Suggestions– Simpler is Better
– Use Rule Macro Predicates
– Create Simplifying Vocabulary
• Part Two: Cyc-Specific Suggestions– Factor out Commonality
– Existence is Expensive
– Exceptions are Exceptional
– State Negations Explicitly
– Generalize -- Don’t List– Use #$different
Copyright © 2002 Cycorp
Writing Efficient CycL: Part 2
• Factor out Commonality• Existence is Expensive• Exceptions are Exceptional• State Negations Explicitly• Generalize -- Don’t List• Use #$different
Copyright © 2002 Cycorp
N*M reduces to N+M
When similarity is not a coincidenceN*M reduces to N+M
A B C D
W X Y Z
P
A B C D
W X Y Z
Copyright © 2002 Cycorp
Commonalities in Collections
Olympic Men’s Individual 400 Meter Butterfly
Olympic Women’sIndividual 100 Meter Backstroke
Olympic Women’s Individual 200 MeterFreestyle
Olympic Men’s Individual 200 MeterBackstroke
Copyright © 2002 Cycorp
Commonalities in Collections
Olympic Competition
Individual Competition
Swimming Competition
Olympic Men’s Individual 400 Meter Butterfly
Olympic Women’sIndividual 100 Meter Backstroke
Olympic Women’s Individual 200 MeterFreestyle
Olympic Men’s Individual 200 MeterBackstroke
Copyright © 2002 Cycorp
Commonalities in Collections
Olympic Competition
Individual Competition
Swimming Competition
Olympic Men’s Individual 400 Meter Butterfly
Olympic Women’sIndividual 100 Meter Backstroke
Olympic Women’s Individual 200 MeterFreestyle
Olympic Men’s Individual 200 MeterBackstroke
Copyright © 2002 Cycorp
Commonalities in Collections
Olympic Competition
Individual Competition
Swimming Competition
Olympic Men’s Individual 400 Meter Butterfly
Olympic Women’sIndividual 100 Meter Backstroke
Olympic Women’s Individual 200 MeterFreestyle
Olympic Men’s Individual 200 MeterBackstroke
Olympic Individual Swimming
Copyright © 2002 Cycorp
Commonalities in Microtheories
April 15, 2002 USA Today
Sports SectionMt
June 2, 2002 USA Today
Sports SectionMt
October 8, 2002 USA Today
Sports SectionMt
September 21, 2002 USA Today
Sports SectionMt
............
Copyright © 2002 Cycorp
Commonalities in Microtheories
Rules forGames Mt
American SportsCompetition Mt
Current and Historical Stats Mt
April 15, 2002 USA Today
Sports SectionMt
June 2, 2002 USA Today
Sports SectionMt
October 8, 2002 USA Today
Sports SectionMt
September 21, 2002 USA Today
Sports SectionMt
Copyright © 2002 Cycorp
Commonalities in Microtheories
April 15, 2002 USA Today
Sports SectionMt
June 2, 2002 USA Today
Sports SectionMt
October 8, 2002 USA Today
Sports SectionMt
September 21, 2002 USA Today
Sports SectionMt
Rules forGames Mt
American SportsCompetition Mt
Current and Historical Stats Mt
Copyright © 2002 Cycorp
Commonalities in Microtheories
Rules, Competition, and Stats Mt
April 15, 2002 USA Today
Sports SectionMt
June 2, 2002 USA Today
Sports SectionMt
October 8, 2002 USA Today
Sports SectionMt
September 21, 2002 USA Today
Sports SectionMt
Rules forGames Mt
American SportsCompetition Mt
Current and Historical Stats Mt
Copyright © 2002 Cycorp
T
PQRS
...
S Shared Assumptions Mt
Microtheories + a Forward Rule
X Y Z
C DA B
P Q R
Copyright © 2002 Cycorp
Writing Efficient CycL: Part 2
• Factor out Commonality• Existence is Expensive• Exceptions are Exceptional• State Negations Explicitly• Generalize -- Don’t List• Use #$different
Copyright © 2002 Cycorp
Concluding #$thereExists
• Skolemization– In order to conclude #$thereExists,
introduce a function to denote the thing that so exists so that we can reason with it
– Extends the number of concepts and symbols in the language that the system might have to think about
– Things that conclude #$thereExists are a little more expensive than others
Copyright © 2002 Cycorp
State Existence Generally• Pervasive problem
Every elephant has a headEvery elephant has a head with a trunkEvery cat has a head with whiskersEvery spotted wombat has a spotted head…
• State existence generally, constrain specificallyEvery animal has a headEvery elephant has a trunkAn animal’s trunk is part of its head
Copyright © 2002 Cycorp
Writing Efficient CycL: Part 2
• Factor out Commonality• Existence is Expensive• Exceptions are Exceptional• State Negations Explicitly• Generalize -- Don’t List• Use #$different
Copyright © 2002 Cycorp
Overuse of #$not(#$implies (#$and (#$isa ?BRD #$Bird) (#$not (#$isa ?BRD #$Penguin)))(#$behaviorCapableOf ?BRD #$Flying #$performedBy))
What about Emus?
What about these examples?– broken wings– feet in concrete– slathered in crude oil– hypnotized into thinking it is a dog
Copyright © 2002 Cycorp
Use Default ReasoningSolution : use default reasoning(#$implies (#$isa ?BRD #$Bird) (#$behaviorCapableOf ?BRD #$Flying #$performedBy))
(#$exceptWhen (#$isa ?BRD #$FlightlessBird) (#$implies (#$isa ?BRD #$Bird) (#$behaviorCapableOf ?BRD #$Flying
#$performedBy)))
(#$genls #$Penguin #$FlightlessBird)(#$genls #$Emu #$FlightlessBird)...
Copyright © 2002 Cycorp
Postpone Checking for Exceptions
• Save a lot of work– only check for exceptional cases after using the
rule
• #$not’s in the antecedent of a rule you’re writing?– ask yourself “is this what the rule really means
or this a meta-statement about cases where that rule wouldn’t apply and should be stated as an exception?”
Copyright © 2002 Cycorp
Writing Efficient CycL: Part 2
• Factor out Commonality• Existence is Expensive• Exceptions are Exceptional• State Negations Explicitly• Generalize -- Don’t List• Use #$different
Copyright © 2002 Cycorp
Underuse of #$not
• Better to conclude than assume• Negations can prune inferences• Some Powerful Negations
• #$disjointWith
is not a (#$disjointWith)
Copyright © 2002 Cycorp
Powerful Negations
• #$SiblingDisjointCollection
• #$completeExtentKnown
is not a (#$SiblingDisjointCollection)
is not a (#$SiblingDisjointCollection)
(#$completeExtentKnown #$nationalBorder)
Copyright © 2002 Cycorp
Another Powerful Negation
• #$completeCollectionExtent
(#$completeCollectionExtent #$MonthOfYearType)
#$January, #$February, #$March, #$April, #$May, #$June, #$July, #$August, #$September, #$October, #$November, #$December
+ #$Yule ?
Copyright © 2002 Cycorp
Writing Efficient CycL: Part 2
• Factor out Commonality• Existence is Expensive• Exceptions are Exceptional• State Negations Explicitly• Generalize -- Don’t List• Use #$different
Copyright © 2002 Cycorp
Disjunctions? Try to Generalize
• “list-em” KR is almost always wrong
(#$implies (#$and (#$isa ?PRSN #$Person) (#$or (#$brothers ?PRSN ?SBLNG) (#$sisters ?PRSN ?SBLNG)))(#$feelsTowardsObject ?PRSN ?SBLNG #$Rivalry
#$Positive))
• Create vocabulary for the generalization#$siblings
Copyright © 2002 Cycorp
Writing Efficient CycL: Part 2
• Factor out Commonality• Existence is Expensive• Exceptions are Exceptional• State Negations Explicitly• Generalize -- Don’t List• Use #$different
Copyright © 2002 Cycorp
Use #$different
Avoid (#$not (#$equals ...))
(#$different <ITEM-1> <ITEM-2> <ITEM-3> ...)
is much better than
(#$and (#$not (#$equals <ITEM-1> <ITEM-2>))
(#$not (#$equals <ITEM-1> <ITEM-3>)) (#$not (#$equals <ITEM-2> <ITEM-3>))
...)