Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Logic Overview Scholastic logic Propositional logic – – Predicate calculus – – Syntax and semantics Inference rules Syntax and semantics Quantifiers Higher-order logics and modal operators Model theory – – The incremental, almost continuous nature of meaning Knowledge representation as an evolutionary process Features of Logic KR Languages Vocabulary – – – – Syntax Semantics – – Logical symbols Constants Variables Punctuation Theory of reference Theory of truth Rules of inference Automated Reasoning Premise: Given an appropriate KR language, new knowledge can be inferred from existing truths Syllogisms Aristotle set out the concept of a threesentence structure to represent knowledge All trailer trucks are 18 wheelers Some Peterbilt is a trailer truck Therefore, some Peterbilt is an 18 Wheeler Sentence Types A: Universal affirmative – All a is b I: Particular affirmative – Some a is b E: Universal negative – No a is b O: Particular negative – Some a is not b Valid Syllogisms bArbArA – – – A: All broad-leafed plants are deciduous A: All vines are broadleaf plants A: Therefore, all vines are deciduous Valid Syllogisms (cont.) cElArEnt – – – E: Nothing absent-minded is an elephant A: All professors are absent-minded E: Therefore, no professor is an elephant Valid Syllogisms (cont.) dArII – – – A: All trailer trucks are 18 wheelers I: Some Peterbilt is a trailer truck I: Therefore, some Peterbilt is an 18 Wheeler Valid Syllogisms (cont.) fErIO – – – E: No Corvette is a truck I: Some Chevrolet is a Corvette O: Therefore, some Chevrolet is not a truck Boolean Algebra George Boole System of representing and operating on truth values pxq p+q -p AND OR NOT First Order Logic (FOL) Extensions of Boolean Algebra and Aristotle’s syllogisms – – Universal and existential quantifiers Changes in syntax Why FOL? Expressive power Extensive Semantics Best-defined model and proof theories Syntax of Propositional Logic Symbols – – – Logical constants True, False Proposition symbols: P, Q, … Logical connectives: not (aka “? ”) and (aka “? ”) or (aka “? ”) => (aka “? ”) iff (aka “? ”) Sentences are made from these symbols Sentences True, False are sentences Any proposition symbol is a sentence Any sentences S1,… Sn combined with a connective is a sentence – – – – – (not S) is a sentence (and S1 S2) is a sentence (or S1 S2 S3 … Sn) is a sentence (=> Sa Sc) is a sentence (iff Sa Sc) is a sentence Semantics of propositional logic Formal semantics = function from sentences to true, false. – – True means that the sentence is true of the world False means that the sentence isn’t true of the world Truth tables define semantics of connectives – – See Sowa for details Example P false false true true Q false true false true (or P Q) false true true true Rules of Inference: Examples 1. Modus Ponens (aka implication-elimination) – 2. And-elimination – 3. Given P, Q, infer (and P Q) Unit resolution – 5. Given (and P Q), infer P; or infer Q And-introduction – 4. Given (=> P Q), P, infer Q Given (or P Q), (not P), infer Q Resolution – Given (or P Q), (or (not Q) R), infer (or P R) Using inference rules “On summer days in Memphis, it is either scorching hot or overcast and muggy outside. Today is a summer day in Memphis and it is not scorching hot outside.” Formalizing a situation “On summer days in Memphis, it is either scorching hot or overcast and muggy outside. Today is a summer day in Memphis and it is not scorching hot outside.” Summer = “It is a summer day in Memphis” Hot = “It is scorching hot outside” Overcast = “It is overcast outside” Muggy = “It is muggy outside” (=> Summer (or Hot (and Overcast Muggy))) (and Summer (not Hot)) Using the Inference Rules 1. 2. 3. 4. 5. 6. 7. 8. (=> Summer (or Hot (and Overcast Muggy))) Given (and Summer (not Hot )) Given Summer [AE 2] (or Hot (and Overcast Muggy)) [MP 1,3] (not Hot) [AE 2] (and Overcast Muggy) [UR 4,5] Overcast [AE 6] Muggy [AE 6] Properties of inference rules They are sound if, when the premises are true, the consequence is true Many different sets of inference rules have been created with the same expressive power (i.e., complete) Sometimes restricted sets of inference rules used for tractability – Example: Horn clauses (=> (and A1 … An) C) Predicate Calculus Propositions can have structure: (<predicate> . <terms>) Terms are either – – Constants denoting objects in some universe (e.g., Block32) Expressions denoting objects via a function (e.g., (color Block32)) Predicates describe attributes and relationships Examples: (Red Block32) (On Block32 Table) (Above Block24 Block32) Propositions express facts Concrete facts via appropriate vocabulary of relationships – Describing general facts of the world requires variables – Example: The things sitting on top of a table We’ll use ?<symbol> to denote variables. The meaning of variables are defined via quantifiers Universal Quantification (forall <vars> <sentence>) is true exactly when <sentence> is true for every possible set of bindings for <vars> – Examples: (forall ?x (=> (block ?x) (solid-object ?x))) (forall (?x ?y) (=> (and (person ?x) (person ?y) (friend-of ?x ?y)) (friend-of ?y ?x))) Inference with universal quantifiers Elimination via substitution – (forall ?x (=> (block ?x) (solid-object ?x))), Let ?x=Block32 (=> (block Block32) (solid-object Block32)) Introduction by proving statement for an arbitrary individual about which nothing else is known (a skolem) – (=> (even-number Foobar) (not (prime-number Foobar))) Existential Quantification (exists <varlist> <sentence>) is true exactly when there is at least one set of bindings for <varlist> that make <sentence> true. Examples – (for-all ?x (=> (number ?x) (exists ?y (> ?y ?x)))) (for-all ?x (=> (block ?x) (or (on ?x table) (held ?x) (exists ?y (and (block ?y) (on ?x ?y)))))) Using existential quantifiers Elimination by creating a skolem. – (exists ?y (and (block ?y) (on Block32 ?y))) create novel entity, G0012, and substitute: (and (block G0012) (on Block32 G0012)) Introduction by generalizing from a specific example (and (block Block18)(on Block32 Block18)) justifies the introduction of (exists (?x ?y) (and (block ?x) (on ?y ?x))) Tips for using quantifiers Be very careful of scoping when translating from natural language – “Wherever you go, there you are” B. Banzi Heuristic: Use => inside forall (forall ?x (and (block ?x) (solid-object ?x))) Heuristic: Use and inside exists (exists (?x ?y) (=> (block ?x) (on ?x ?y))) Heuristic: Use iff very sparingly (forall ?x (iff (block ?x) (solid-object ?x)) Higher-order logic First order logic ? variables range over objects Second order logic ? variables can range over predicates also (for-all ?r (iff (transitive ?r) (forall (?x ?y ?x) (=> (and (?r ?x ?y) (?r ?y ?z)) (?r ?x ?z))))) Omega-order logics have been used at times Even second order is undecidable, however Aside: Order in Structure-Mapping Not the same thing as the order of a logic – In structure-mapping, the order of an expression is – – Order of a logic indicates how expressive it can be 0 for entities 1+max(order(arguments)) for expressions Order of an expression indicates the degree of nesting Types of Logic Variations of FOL – – – – – – Syntax Subsets Proof theory Model theory Ontology Metalanguage Reification Formal trick: – For each predicate, create a constant that stands for it – – In KIF, it is the tuple semantics of the predicate Requires an axiom schema (think “macro”) Use those constants in axioms Since they are constants, the resulting theory is first-order Useful for expressing control knowledge – Reify facts, so one can say when they are relevant Reification Example See Glimmer Feel Breeze Include state = 1 Include state = 1 Move Forward Schema Node Synthetic Item Bump The itemreliability node reifies General of the this schema schema node’s node is verification conditions low, but local reliability Host link is high Schema Node Item Node “Wall to the left” Move Left Synthetic Item Bump Bump Item Node “Wall to the left” Schema Node Schema Node Context spin-offs Item Node 1) 3) Applicability Prediction 2) Successful byofbeing host refine the verification “Wall to the left” inexecution the schema resultnodes of set host of a conditions schema schema nodes node Move Left At pos. 1, 3 Move Left Modal Operators Modal operators extend the expressive power of a logic by specifying context – – Classic examples from logic: (necessary P), (possible P) – Metaphor: quotation and backquote Can use reification of their semantics to drop the reasoning to first order, but can still be hairy (iff (necessary P) (not (possible (not P)))) Classic examples from AI/Philosophy: (Knows A P), (Believes A P) (=> (knows John (visible morning-star)) (knows John (visible evening-star))) 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 corresponding 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 means “above”, sort of Caution: 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 (<position on table> <height>) ? block (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 axioms and make sure you are defining what you think you are defining Misconceptions about meaning “Predicates have definitions” – Most don’t. 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 concepts 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 version of a discontinuity. Representations as Sculptures How does one make a statue of an elephant? – How does one represent a concept? – Start with a marble block. Carve away everything that does not look like an elephant. Start with a vocabulary of predicates and other axioms. Add axioms involving the new predicate until it fits your intended model well. Knowledge representation is an evolutionary process – – It isn’t quick, but incremental additions lead to incremental progress All representations are by their nature imperfect