190 likes | 329 Views
Writing Efficient CycL 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.
E N D
Writing Efficient CycL 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
Writing Efficient CycL Part 1 • Simpler is Better • Use Rule Macro Predicates • Create Simplifying Vocabulary
BETTER WORSE GAFs Binary Horn rules Small rules Rules Non-binary Non-horn rules 1 gargantuan rule Simpler is Better • Modularity leads to generality and reuse • If it looks too complicated, it is
BETTER WORSE GAFs Binary Horn rules Small rules Rules Non-binary Non-horn rules 1 gargantuan rule GAFs are better than rules Rule Macro Predicates = Rules + GAFs 99.9% of KB should be GAFs Example: #$hasDiet (#$hasDiet #$koala #$eucalyptus) (#$hasDiet #$cow #$grass) (#$hasDiet #$vampireBats #$blood) (#$hasDiet #$venusFlytrap #$fly-Insect)
BETTER WORSE GAFs Binary Horn rules Small rules Rules Non-binary Non-horn rules 1 gargantuan rule Binary is better than non-binary Avoid gratuitously ternary or quaternary predicates: (graduationDate ?PRSN ?DGREETYP ?DATE) (graduationEvent ?PRSN ?EVENT) (dateOfEvent ?EVENT ?DATE) (degreeTypeOfGraduationEvent ?EVENT ?DGREETYP)
BETTER WORSE GAFs Binary Horn rules Small rules Rules Non-binary Non-horn rules 1 gargantuan rule Horn-rules are better than non-horn rules Consequent of Non-horn Rule: (#$or (#$objectHasColor #$Rover #$TanColor) (#$objectHasColor #$Rover #$BlackColor)) Horn Rule: (#$implies (#$isa ?ANIMAL #$Bird) (#$thereExists ?WING (#$and (#$isa ?WING #$Wing-AnimalBodyPart) (#$anatomicalParts ?ANIMAL #$Wing-AnimalBodyPart))))) If all of this is true, then
BETTER WORSE GAFs Binary Horn rules Small rules Rules Non-binary Non-horn rules 1 gargantuan rule Several small rules are better than one 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
Writing Efficient CycL Part 1 • Simpler is Better • Use Rule Macro Predicates • Create Simplifying Vocabulary
OE Programming genlPreds Rule Macro Predicates helper function macros Simpler is better (#$genlPreds #$brothers #$siblings) is better than (#$implies (#$brothers ?AGT ?BRO) (#$siblings ?AGT ?BRO))
Reason with the vocabulary itself Do this: (animalTypeEatsAnimalType Cheetah Wildebeest) (implies (animalTypeEatsAnimalType ?ANM1 ?ANM2) (hasAttributes ?ANM2 Deceased)) (animalTypeEatsAnimalType Cheetah Antelope) Instead 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) . . . One rule applies to all animal types
Reason with the vocabulary itself (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.
Add 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)))) . . .
Writing Efficient CycL Part 1 • Simpler is Better • Use Rule Macro Predicates • Create Simplifying Vocabulary
Some False Ideas Erroneous Mindset “vocabulary is expensive” “complex assertions are cheap” • Physics Envy • Maxwell’s Equations of KR
New Vocabulary Will Not Make Rules 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
OE vs KE vs SME’s and Their Vocabulary • 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
The 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))
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
Summary Slide • Simpler is Better • Use Rule Macro Predicates • Create Simplifying Vocabulary