Knowledge Representation II

Slides:



Advertisements
Similar presentations
First-Order Logic.
Advertisements

Inference Rules Universal Instantiation Existential Generalization
Standard Logical Equivalences
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
UIUC CS 497: Section EA Lecture #2 Reasoning in Artificial Intelligence Professor: Eyal Amir Spring Semester 2004.
Inference and Reasoning. Basic Idea Given a set of statements, does a new statement logically follow from this. For example If an animal has wings and.
Methods of Proof Chapter 7, second half.. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound)
Intelligent Systems (AI-2) Computer Science cpsc422, Lecture 20
For Friday No reading Homework: –Chapter 9, exercise 4 (This is VERY short – do it while you’re running your tests) Make sure you keep variables and constants.
Logic Use mathematical deduction to derive new knowledge.
Effective Propositional Reasoning CSE 473 – Autumn 2003.
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Logic.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
Proof methods Proof methods divide into (roughly) two kinds: –Application of inference rules Legitimate (sound) generation of new sentences from old Proof.
Inference and Resolution for Problem Solving
Knowledge Representation I (Propositional Logic) CSE 473.
CSE 473 Artificial Intelligence Review. © Daniel S. Weld 2 Logistics Problem Set due at midnight Exam next Wed 8:30—10:30 Regular classroom Closed book.
Methods of Proof Chapter 7, second half.
Knowledge Representation III First-Order Logic
Search in the semantic domain. Some definitions atomic formula: smallest formula possible (no sub- formulas) literal: atomic formula or negation of an.
Knoweldge Representation & Reasoning
Last time Proof-system search ( ` ) Interpretation search ( ² ) Quantifiers Equality Decision procedures Induction Cross-cutting aspectsMain search strategy.
Logic in AI CSE 573. © Daniel S. Weld 2 Logistics Monday? Reading Ch 8 Ch 9 thru p 278 Section 10.3 Projects Due 11/10 Teams and project plan due by this.
Knowledge Representation II (Inference in Propositional Logic) CSE 473.
Knowledge Representation II (Inference in Propositional Logic) CSE 473 Continued…
Knowledge Representation IV Inference in First-Order Logic CSE 473.
Logic - Part 2 CSE 573. © Daniel S. Weld 2 Reading Already assigned R&N ch 5, 7, 8, 11 thru 11.2 For next time R&N 9.1, 9.2, 11.4 [optional 11.5]
To do Check slides for next lecture and move some to this lecture. Consider eliminating resolution Simplify discussion of inference – just talk about SAT.
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
CSE PredLogic 1 Knowledge Representation with Logic: First Order Predicate Calculus Outline –Introduction to First Order Predicate Calculus (FOPC)
CHAPTERS 7, 8 Oliver Schulte Logical Inference: Through Proof to Truth.
Knowledge Representation IV Inference for First-Order Logic CSE 473.
Logical Agents Logic Propositional Logic Summary
1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of.
Logic in AI CSE 573. © Daniel S. Weld 2 Logistics Monday? Reading Ch 8 Ch 9 thru p 278 Section 10.3 Projects Due 11/10 Teams and project plan due by this.
Propositional Logic: Methods of Proof (Part II) This lecture topic: Propositional Logic (two lectures) Chapter (previous lecture, Part I) Chapter.
Logical Agents Chapter 7. Knowledge bases Knowledge base (KB): set of sentences in a formal language Inference: deriving new sentences from the KB. E.g.:
LDK R Logics for Data and Knowledge Representation Propositional Logic: Reasoning First version by Alessandro Agostini and Fausto Giunchiglia Second version.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
CSE 473 Propositional Logic SAT Algorithms Dan Weld (With some slides from Mausam, Stuart Russell, Dieter Fox, Henry Kautz, Min-Yen Kan…) Irrationally.
1 The Wumpus Game StenchBreeze Stench Gold Breeze StenchBreeze Start  Breeze.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
© Daniel S. Weld 1 Logistics Problem Set 2 Due Wed A few KR problems Robocode 1.Form teams of 2 people 2.Write design document.
First-Order Logic Daniel Weld CSE 473 Spring 2012.
© Daniel S. Weld Topics Agency Problem Spaces SearchKnowledge Representation Planning PerceptionNLPMulti-agentRobotics Uncertainty MDPs Supervised.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
UBC Department of Computer Science Undergraduate Events More
Inference in Propositional Logic (and Intro to SAT) CSE 473.
Proof Methods for Propositional Logic CIS 391 – Intro to Artificial Intelligence.
Knowledge Repn. & Reasoning Lecture #9: Propositional Logic UIUC CS 498: Section EA Professor: Eyal Amir Fall Semester 2005.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Inference in Propositional Logic (and Intro to SAT)
Announcements No office hours today!
Logical Inference 1 introduction
EA C461 – Artificial Intelligence Logical Agent
Knowledge Representation III First-Order Logic
The Propositional Calculus
Logical Inference: Through Proof to Truth
First-Order Logic CSE 573 A handful of GENERAL SEARCH TECHNIQUES lie at the heart of practically all work in AI We will encounter the SAME PRINCIPLES again.
Knowledge Representation III First-Order Logic
Propositional Resolution
Logic Use mathematical deduction to derive new knowledge.
Artificial Intelligence: Agents and Propositional Logic.
Knowledge Representation I (Propositional Logic)
Methods of Proof Chapter 7, second half.
Propositional Logic: Methods of Proof (Part II)
Presentation transcript:

Knowledge Representation II CSE 573 A handful of GENERAL SEARCH TECHNIQUES lie at the heart of practically all work in AI We will encounter the SAME PRINCIPLES again and again in this course, whether we are talking about GAMES LOGICAL REASONING MACHINE LEARNING These are principles for SEARCHING THROUGH A SPACE OF POSSIBLE SOLUTIONS to a problems.

Logistics Reading for Wednesday Projects Office Hour Ch 11 “Planning” Did we get everyone? Office Hour Monday 3-4pm Except…. Today only 3-3:20 © Daniel S. Weld

573 Topics Reinforcement Learning Supervised Learning Inference Planning Knowledge Representation Logic-Based Probabilistic Search Problem Spaces Agency © Daniel S. Weld

Review of “Last Time” Propositional Logic Resolution DPLL WalkSAT Expressiveness vs. Tractability Randomly Generating SAT © Daniel S. Weld

Resolution If the unicorn is mythical, then it is immortal, but if it is not mythical, it is a mammal. If the unicorn is either immortal or a mammal, then it is horned. Prove: the unicorn is horned. ( A  H) ( H) (I  H) M = mythical I = immortal A = mammal H = horned (M  A) (A) (I) ( M  I) M=>I (~M v I) ~M=>(~I & A) (M V ~I) (M v A) (I v A)=>H (~I v H) (~A v H) Conclude: H (~H) (M) ( M) () © Daniel S. Weld

DPLL (for real!) Davis – Putnam – Loveland – Logemann dpll(F, literal){ remove clauses containing literal if (F contains no clauses) return true; shorten clauses containing literal if (F contains empty clause) return false; if (F contains a unit or pure L) return dpll(F, L); choose V in F; if (dpll(F, V))return true; return dpll(F, V); } © Daniel S. Weld

WalkSat Local search over space of complete truth assignments With probability P: flip any variable in any unsatisfied clause With probability (1-P): flip best variable in any unsat clause Like fixed-temperature simulated annealing SAT encodings of N-Queens, scheduling Best algorithm for random K-SAT Best DPLL: 700 variables Walksat: 100,000 variables [Slide #s from 2001] © Daniel S. Weld

Horn Theories Recall the special case of Horn clauses: Binary clauses At most one positive literal / clause E.g. from “If (fever) AND (vomiting) then FLU” Unit propagation is refutation complete for Horn theories Good implementation – linear time inference! Binary clauses Linear-time inference © Daniel S. Weld

Random 3-SAT Random 3-SAT Which are the hard instances? sample uniformly from space of all possible 3-clauses n variables, l clauses Which are the hard instances? around l/n = 4.3 © Daniel S. Weld

Random 3-SAT Varying problem size, n Complexity peak appears to be largely invariant of algorithm backtracking algorithms like Davis-Putnam local search procedures like GSAT What’s so special about 4.3? © Daniel S. Weld

Random 3-SAT Complexity peak coincides with solubility transition l/n < 4.3 problems under-constrained and SAT l/n > 4.3 problems over-constrained and UNSAT l/n=4.3, problems on “knife-edge” between SAT and UNSAT © Daniel S. Weld

Themes Expressiveness Tractability Expressive but awkward No notion of objects, properties, or relations Number of propositions is fixed Tractability NPC in general Completeness / speed tradeoff Horn clauses, binary clauses © Daniel S. Weld

Logic-Based KR     Propositional logic First-order logic Syntax (CNF, Horn clauses, …) Semantics (Truth Tables) Inference (FC, Resolution, DPLL, WalkSAT) Restricted Subsets First-order logic Syntax (quantifiers, skolem functions, … Semantics (Interpretations) Inference (FC, Resolution, Compilation) Restricted Subsets (e.g. Frame Systems) Representing events, action & change    © Daniel S. Weld

Propositional. Logic vs. First Order Objects, Properties, Relations Facts (P, Q) Ontology Syntax Semantics Inference Algorithm Complexity Atomic sentences Connectives Variables & quantification Sentences have structure: terms father-of(mother-of(X))) Interpretations (Much more complicated) Truth Tables Unification Forward, Backward chaining Prolog, theorem proving DPLL, GSAT Fast in practice Semi-decidable NP-Complete © Daniel S. Weld

FOL Definitions Constants: a,b, dog33. Variables: X, Y. Name a specific object. Variables: X, Y. Refer to an object without naming it. Functions: dad-of Mapping from objects to objects. Terms: dad-of(dog33) Refer to objects Atomic Sentences: in(dad-of(dog33), food6) Can be true or false Correspond to propositional symbols P, Q © Daniel S. Weld

More Definitions Logical connectives: and, or, not, => Quantifiers:  Forall  There exists Examples Dumbo is grey Elephants are grey There is a grey elephant © Daniel S. Weld

Quantifier / Connective Interaction E(x) == “x is an elephant” G(x) == “x has the color grey” x E(x)  G(x) x E(x) G(x) x E(x)  G(x) x E(x) G(x) © Daniel S. Weld

Nested Quantifiers: Order matters! x y P(x,y)  y x P(x,y) Examples Every dog has a tail Every dog shares a tail! ? d t has(d,t) t d has(d,t) Someone is loved by everyone x y loves(y, x) © Daniel S. Weld

Semantics Syntax: a description of the legal arrangements of symbols (Def “sentences”) Semantics: what the arrangement of symbols means in the world Inference Sentences Sentences Representation Semantics Semantics World Models Models © Daniel S. Weld

Propositional Logic: SEMANTICS “Interpretation” (or “possible world”) Specifically, TRUTH TABLES Assignment to each variable either T or F Assignment of T or F to each connective P T F Q T F P  Q © Daniel S. Weld

Models Depiction of one possible “real-world” model © Daniel S. Weld

Interpretations=Mappings syntactic tokens  model elements Depiction of one possible interpretation, assuming Constants: Functions: Relations: Richard John Leg(p,l) On(x,y) King(p) © Daniel S. Weld

Interpretations=Mappings syntactic tokens  model elements Another interpretation, same assumptions Constants: Functions: Relations: Richard John Leg(p,l) On(x,y) King(p) © Daniel S. Weld

Satisfiability, Validity, & Entailment S is valid if it is true in all interpretations S is satisfiable if it is true in some interp S is unsatisfiable if it is false all interps S1 entails S2 if forall interps where S1 is true, S2 is also true |= © Daniel S. Weld

Skolemization Existential quantifiers aren’t necessary! Existential variables can be replaced by Skolem functions (or constants) Args to function are all surrounding  vars d t has(d, t) x y loves(y, x) d has(d, f(d) ) y loves(y, f() ) y loves(y, f97 ) © Daniel S. Weld

FOL Reasoning FO Forward & Backward Chaining FO Resolution Many other types of theorem proving Restricted representations Description logics Horn Clauses Compilation to SAT © Daniel S. Weld

? Forward Chaining Given Prove ?x dog(?x) => mammal(?x) dog(fido) ?x lifeform(?x) => mortal(?x) ?x mammal(?x) => lifeform(?x) ?x dog(?x) => mammal(?x) dog(fido) Prove mortal(fido) ?x dog(?x) => mammal(?x) dog(fido) mammal(fido) ? © Daniel S. Weld

Unification Emphasize variables with ? Useful for FO inference (modus ponens, …) Also for compilation of FOPC -> propositional Unify(, ) returns “mgu” Unify(city(?a), city(kent)) returns ?a/kent Substitute(expr, mapping) returns new expr Substitute(connected(?a, ?b), {?a/kent}) returns connected(kent, ?b) © Daniel S. Weld

Unification Examples Unify(road(?a, kent), road(seattle, ?b)) Unify(road(?a, ?a), road(seattle, kent)) Unify(f(g(?x, dog), ?y)), f(g(cat, ?y), dog) Unify(f(g(?x)), f(?x)) © Daniel S. Weld

Resolution [Robinson 1965] { (p  ), ( p    ) } |-R (    ) } Recall Propositional Case: Literal in one clause Its negation in the other Result is disjunction of other literals A completely mechanical process! Rules for deriving new sentences from old. Example: P, P=>Q, |- Q “Symbol Pushing”. © Daniel S. Weld

First-Order Resolution [Robinson 1965] { (p(?x)  a(a), ( p(q)  b(?x)  c(?y)) } |-R (a(a)  b(q)  c(?y)) A completely mechanical process! Rules for deriving new sentences from old. Example: P, P=>Q, |- Q “Symbol Pushing”. Literal in one clause The negation of something which unifies in the other Result is disjunction of other literals / mgu © Daniel S. Weld

First-Order Resolution Is it the case that  |=  ? Method Let  =    Convert  to clausal form Standardize variables Move quantifiers to front, skolemize to remove  Replace  with  and  Demorgan’s laws... Resolve until get empty clause © Daniel S. Weld

Example Given Prove ?x man(?x) => mortal(?x) ?x woman(?x) => mortal(?x) ?x person(?x) => man(?x)  woman(?x) person(kelly) Prove mortal(kelly) [m(?x),d(?x)] [w(?y), d(?y)] [p(?z),m(?z),w(?z)] [p (k)][d(k)] © Daniel S. Weld

Example Continued [m(?x),d(?x)] [w(?y), d(?y)] [p(?z),m(?z),w(?z)] [p (k)] [d(k)] [m(k),w(k)] [w(k), d(k)] [w(k)] [d(k)] [] © Daniel S. Weld

Compilation to Prop. Logic I Typed Logic city a,b connected(a,b) Universe Cities: seattle, tacoma, enumclaw Equivalent propositional formula: © Daniel S. Weld

Compilation to Prop. Logic II Universe Cities: seattle, tacoma, enumclaw Firms: IBM, Microsoft, Boeing First-Order formula city c firm f hasHQ(c, f) Equivalent propositional formula © Daniel S. Weld

Hey! You said FO Inference is semi-decidable But you compiled it to SAT Which is NP Complete So now we can always do the inference?!? Tho it might take exponential time… Something seems wrong here….???? © Daniel S. Weld

Restricted Forms of FO Logic Known, Finite Universes Compile to SAT Frame Systems Ban certain types of expressions Horn Clauses Aka Prolog Function-Free Horn Clauses Aka Datalog © Daniel S. Weld