1、Knowledge RepresentationPraveen ParitoshCogSci 207:Fall 2019:Week 1Thu,Sep 30,2019Some RepresentationsElements of a Representation Represented world:about what?Representing world:using what?Representing rules:how to map?Process that uses the representation:conventions and systems that use the repres
2、entations resulting from above.Analog versus SymbolicMarrs levels of description Computational:What is the goal of the computation,why is it appropriate,and what is the logic of the strategy by which it can be carried out?Algorithmic:How can this computational theory be implemented?In particular,wha
3、t is the representation for the input and output,and what is the algorithm for the transformation?Implementation:How can the representation and algorithm be realized physically?Marrs levels of description 2 Computational:a lot of cognitive psychology Algorithmic:a lot of cognitive science Implementa
4、tion:neuroscienceA closer lookOverview How knowledge representation works Basics of logic(connectives,model theory,meaning)Basics of knowledge representation Why use logic instead of natural language?Quantifiers Organizing large knowledge bases Ontology Microtheories Resource:OpenCyc tutorial materi
5、alsHow Knowledge Representation Works Intelligence requires knowledge Computational models of intelligence require models of knowledge Use formalisms to write down knowledge Expressive enough to capture human knowledge Precise enough to be understood by machines Separate knowledge from computational
6、 mechanisms that process it Important part of cognitive model is what the organism knowsHow knowledge representations are used in cognitive models Contents of KB is part of cognitive model Some models hypothesize multiple knowledge bases.KnowledgeBaseInferenceMechanism(s)LearningMechanism(s)Examples
7、,StatementsQuestions,requestsAnswers,analysesWhats in the knowledge base?Facts about the specifics of the world Northwestern is a private university The first thing I did at the party was talk to John.Rules(aka axioms)that describe ways to infer new facts from existing facts All triangles have three
8、 sides All elephants are grey Facts and rules are stated in a formal language Generally some form of logic(aka predicate calculus)Propositional logic A step towards understanding predicate calculus Statements are just atomic propositions,with no structure Propositions can be true or false Statements
9、 can be made into larger statements via logical connectives.Examples:C=“Its cold outside”;C is a proposition O=“Its October”;O is a proposition If O then C;if its October then its cold outsideSymbols for logical connectives Negation:not,Conjunction:and,Disjunction:or,Implication:implies,Biconditiona
10、l:iff,-Universal quantifier:forall,Existential quantifier:exists,Semantics of connectives For propositional logic,can define in terms of truth tablesABA BFFFFTFTFFTTTABA BFFFTTFTTImplication and biconditionalABABFFFTTFTTABABFFTFTTTFFTTTAB ABAB (AB)(BA)Rules of inference There are many rules that ena
11、ble new propositions to be derived from existing propositions Modus Ponens:PQ,P,derive Q deMorgans law:(AB),derive AB Some properties of inference rules Soundness:An inference rule is sound if it always produces valid results given valid premises Completeness:A system of inference rules is complete
12、if it derives everything that logically follows from the axioms.Predicate calculus Same connectives Propositions have structure:Predicate/Function+arguments.R,2;Terms.Terms are not individuals,not propositions Red(R),(Red R);A proposition,written in two ways(southOf UnicornCafe UniHall);a propositio
13、n(+2 2);Term,since the function+ranges over numbers Quantifiers enable general axioms to be written(forall?x (iff(Triangle?x)(and(polygon?x)(numberOfSides?x 3)Model Theory Meaning of a theory=set of models that satisfy it.Model=set of objects and relationships If statement is true in KB,then the cor
14、responding relationship(s)hold between the corresponding objects in the modeled world The objects and relationships in a model can be formal constructs,or pieces of the physical world,or whatever Meaning of a predicate=set of things in the models for that theory which correspond to it.E.g.,above mea
15、ns“above”,sort ofCaution:Meaning pertains to simplest model There is usually an intended model,i.e.,what one is representing.A sparse set of axioms can be satisfied by dramatically simpler worlds than those intended Example:Classic blocks world axioms have ordered pairs of integers as a model()block
16、(on A B)p(A)=p(B)&h(A)=h(B)+1(above A B)p(A)=p(B)&h(A)h(B)Moral:Use dense,rich set of axiomsMisconceptions about meaning“Predicates have definitions”Most dont.Their meaning is constrained by the sum total of axioms that mention them.“Logic is too discrete to capture the dynamic fluidity of how our c
17、oncepts change as we learn”If you think of the set of axioms that constrain the meaning of a predicate as large,then adding(and removing)elements of that set leads to changes in its models.Sometimes small changes in the set of axioms can lead to large changes in the set of models.This is the logical
18、 version of a discontinuity.Representations as Sculptures How does one make a statue of an elephant?Start with a marble block.Carve away everything that does not look like an elephant.How does one represent a concept?Start with a vocabulary of predicates and other axioms.Add axioms involving the new
19、 predicate until it fits your intended model well.Knowledge representation is an evolutionary process It isnt quick,but incremental additions lead to incremental progress All representations are by their nature imperfectIntroduction to Cycs KR system These materials are based on tutorial materials d
20、eveloped by Cycorp,for training knowledge entry people and ontological engineers For this class,we have simplified them somewhat.In examinations,you will only be responsible for the simplified versionsNL vs.Logic:ExpressivenessNL:Jims injury resulted from his falling.Jims falling caused his injury.J
21、ims injury was a consequence of his falling.Jims falling occurred before his injury.Logic:identify the common concepts,e.g.the relation:x caused yWrite rules about the common concepts,e.g.x caused y x temporally precedes yNL:Write the rule for every expression?NL vs.Logic:Ambiguity and Precisionx is
22、 running-InMotion x is changing locationx is running-DeviceOperating x is operatingx is running-AsCandidate x is a candidatex is at the bank.river bank?financial institution?NL:AmbiguousLogic:Precisex is running.changing location?operating?a candidate for office?Reasoning:Figuring out what must be t
23、rue,given what is known.Requires precision of meaning.NL vs.Logic:Calculus of MeaningLogic:Well-understood operators enable reasoning:Logical constants:not,and,or,all,someNot(All men are taller than all women).All men are taller than 12”.Some women are taller than 12”.Not(All A are F than all B).All
24、 A are F than x.Some B are F than x.Syntax:Terms(aka Constants)A sampling of some constants:Dog,SnowSkiing,PhysicalAttribute BillClinton,Rover,DisneyLand-TouristAttraction likesAsFriend,bordersOn,objectHasColor,and,not,implies,forAll RedColor,Soil-SandyTerms denote specific individuals or collection
25、s (relations,people,computer programs,types of cars.)Each Terms is a character string prefixed by These denote collectionsThese denote individuals:Partially Tangible IndividualsRelationsAttribute ValuesSyntax:PropositionsPropositions:a relation applied to some arguments,enclosed in parentheses Also
26、called formulas,sentences Examples:(isa GeorgeWBush Person)(likesAsFriend GeorgeWBush AlGore)(BirthFn JacquelineKennedyOnassis)Syntax:Non-Atomic Terms New terms can be made by applying functions to other things In the Cyc system,functions typically end in“Fn”Examples of functions:BirthFn,GovernmentF
27、n,BorderBetweenFnExamples of Non-Atomic Terms:(GovernmentFn France)(BorderBetweenFn France Switzerland)(BirthFn JacquelineKennedyOnassis)Non-atomic Terms can be used in statements like any other term(residenceOfOrganization(GovernmentFn France)CityOfParisFrance)Why Use NATs?Uniformity All kinds of f
28、ruits,nuts,etc.,are represented in the same,compositional way:(FruitFn PLANT)*Inferential Efficiency Forward rules can automatically conclude many useful assertions about NATs as soon as they are created,based on the function and arguments used to create the NAT.what kind of thing that NAT represent
29、s how to refer to the NAT in English Well-formedness:Arity Arity constraints are represented in CycL with the predicate arity:(arity performedBy 2)Represents the fact that performedBy takes two arguments,e.g.:(performedBy AssassinationOfPresidentLincoln JohnWilkesBooth)(arity BirthFn 1)Represents th
30、e fact that BirthFn takes one arguments,e.g.:(BirthFn JacquelineKennedyOnassis)Well-Formedness:Argument TypeArgument type constraints are represented in CycL with the following 2 predicates:1 argIsa(argIsa performedBy 1 Action)means that the first argument of performedBy must be an individual Action
31、,such as the assassination of Lincoln in:(performedBy AssassinationOfPresidentLincoln JohnWilkesBooth)2 argGenl(argGenl penaltyForInfraction 2 Event)means that the second argument of penaltyForInfraction must be a type of Event,such as the collection of illegal equipment use events in:(penaltyForInf
32、raction SportsEvent IllegalEquipmentUse Disqualification)Why constraints are important They guide reasoning(performedBy PaintingTheHouse Brick2)(performedBy MarthaStewart CookingAPie)They constrain learningCompound propositions Connectives from propositional logic can be used to make more complex st
33、atementsn(and(performedBy GettysburgAddress Lincoln)(objectHasColor Rover TanColor)n(or(objectHasColor Rover TanColor)(objectHasColor Rover BlackColor)n(implies(mainColorOfObject Rover TanColor)(not(mainColorOfObject Rover RedColor)n(not(performedBy GettysburgAddress BillClinton)Variables and Quanti
34、fiersGeneral statements can be made by using variables and quantifiers Variables in logic are like variables in algebra Sentences involving concepts like“everybody,”“something,”and“nothing”require variables and quantifiers:Everybody loves somebody.Nobody likes spinach.Some people like spinach and so
35、me people like broccoli,but no one likes them both.Quantifiers Adding variables and quantifiers,we can represent more general knowledge.Two main quantifiers:1.Universal Quantifer-forAllUsed to represent very general facts,like:All dogs are mammalsEveryone loves dogs2.Existential Quantifier-thereExis
36、tsUsed to assert that something exists,to state facts like:Someone is bored Some people like dogsQuantifiers Universal Quantifier(forAll?THING(isa?THING Thing)Existential Quantifier:(thereExists?JOE(isa?JOE Poodle)Others defined in CycL:(thereExistsExactly 12?ZOS(isa?ZOS ZodiacSign)(thereExistsAtLea
37、st 9?PLNT(isa?PLNT Planet)Everything is a thing.Something is a poodle.There are exactly 12 zodiac signsThere are at least 9 planetsImplicit Universal QuantificationAll variables occurring“free”in a formula are understood by Cyc to be implicitly universally quantified.So,to CYC,the following two form
38、ulas represent the same fact:(forAll?X(implies(isa?X Dog)(isa?X Animal)(implies(isa?X Dog)(isa?X Animal)Pop Quiz#1 What does this formula mean?(thereExists?PLANET (and (isa?PLANET Planet)(orbits?PLANET Sun)Pop Quiz#1 What does this formula mean?(thereExists?PLANET (and (isa?PLANET Planet)(orbits?PLA
39、NET Sun)“There is at least one planet orbiting the Sun.”Pop Quiz#2 What does this formula mean?(forAll?PERSON1(implies (isa?PERSON1 Person)(thereExists?PERSON2 (and (isa?PERSON2 Person)(loves?PERSON1?PERSON2)Pop Quiz#2 What does this formula mean?(forAll?PERSON1(implies (isa?PERSON1 Person)(thereExi
40、sts?PERSON2 (and (isa?PERSON2 Person)(loves?PERSON1?PERSON2)“Everybody loves somebody.”Pop Quiz#3 How about this one?(implies(isa?PERSON1 Person)(thereExists?PERSON2 (and (isa?PERSON2 Person)(loves?PERSON2?PERSON1)Pop Quiz#3 How about this one?(implies(isa?PERSON1 Person)(thereExists?PERSON2 (and (isa?PERSON2 Person)(loves?PERSON2?PERSON1)“Everyone is loved by someone.”Pop Quiz#4And this?(implies(isa?PRSN Person)(loves?PRSN?PRSN)Pop Quiz#4And this?(implies(isa?PRSN Person)(loves?PRSN?PRSN)“Everyone loves his(or her)self.”