Presentation is loading. Please wait.

Presentation is loading. Please wait.

Knowledge Representation III First-Order Logic

Similar presentations


Presentation on theme: "Knowledge Representation III First-Order Logic"— Presentation transcript:

1 Knowledge Representation III First-Order Logic
CSE 473

2 Why Not Propositional Logic?
“All monkeys are fuzzy” Propositional logic requires: fuzzy1, fuzzy2, …, fuzzyN Why? Lack of structure in/between atoms. What we’d like is a way to talk about objects and groups of objects, and to define relationships between them. First-order logic (aka “predicate logic”) © Daniel S. Weld

3 Propositional vs. First-Order
Propositional logic Facts: p, q, ¬r, etc. (p ^ q) v (¬r v q ^ p) First-order logic Objects: Dieter, Monkey, etc. Relations: German(Dieter) Smarter(Dieter, Monkey) Stooges(Larry, Moe, Curly) HasTail(Monkey) v ¬HasBanana(Dieter) © Daniel S. Weld

4 FOL Definitions Constants: a, dieter, monkey23, monkey4.
Name a specific object. Variables: X, Y. Refer to an object without naming it. Functions: dad-of, banana-of. Mapping from objects to objects. Terms: banana-of(monkey4). Refer to objects Relations: in, hungry. State relationships between objects. Atomic Sentences: in(banana-of(dieter), monkey4) Can be true or false Correspond to propositional symbols P, Q © Daniel S. Weld

5 More Definitions Logical connectives: and, or, not, => Quantifiers:
 Forall (Universal quantifier)  There exists (Existential quantifier) Examples George is brown Monkeys are curious There is a curious monkey Brown(George) m: Monkey(m)  Curious(m) m: Monkey(m) ^ Curious(m) © Daniel S. Weld

6 Quantifier / Connective Interaction
M(x) == “x is a monkey” C(x) == “x is curious” x: M(x)  C(x) x: M(x) C(x) x: M(x)  C(x) x: M(x) C(x) “Everything is a curious monkey” “All monkeys are curious” “There exists a curious monkey” “There exists an object that is either a curious monkey, or not a monkey at all” © Daniel S. Weld

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

8 Semantics Semantics: what the arrangement of symbols means in the world Propositional logic Basic elements are variables (references to facts) Possible worlds: mappings from variables to T/F First-order logic Basic elements are terms (references to objects) Possible worlds: mappings from terms to real- world elements. © Daniel S. Weld

9 Our First-Order Logic World
Syntactic elements: Constants: Functions: Relations: Richard John Leg(p,l) On(x,y) King(p) © Daniel S. Weld

10 Possible World (Interpretation) I
Possible worlds map syntactic tokens to model elements Constants: Functions: Relations: Richard John Leg(p,l) On(x,y) King(p) © Daniel S. Weld

11 Possible World (Interpretation) II
Constants: Functions: Relations: Richard John Leg(p,l) On(x,y) King(p) © Daniel S. Weld

12 How Many Interpretations?
Two named objects Richard, John One unary relation King(x) Two binary relations Leg(x, y); On(x, y) 52 = 25 object mappings Infinite number of values for x  infinite mappings Even if we restricted x to: R, J, crown, llR, llJ: 25 = 32 unary truth mappings Infinite. But even restricting x, y to five objects still yields 225 mappings for each binary relation © Daniel S. Weld

13 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

14 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

15 First-Order Wumpus World
Objects Squares, wumpuses, agents, gold, pits, stinkiness, breezes Relations Square topology (adjacency), Pits/breezes, Wumpus/stinkiness © Daniel S. Weld

16 Wumpus World: Squares Square topology relations?
Each square as an object: Square1,1, Square1,2, …, Square3,4, Square4,4 Square topology relations? Adjacent(Square1,1, Square2,1) Adjacent(Square3,4, Square4,4) Better: Squares as lists: [1, 1], [1,2], …, [4, 4] Square topology relations: x, y, a, b: Adjacent([x, y], [a, b])  [a, b] Є {[x+1, y], [x-1, y], [x, y+1], [x, y-1]} © Daniel S. Weld

17 Wumpus World: Pits Each pit as an object: Problem?
Pit1,1, Pit1,2, …, Pit3,4, Pit4,4 Problem? Not all squares have pits List only the pits we have: Pit3,1, Pit3,3, Pit4,4 Problem? No reason to distinguish pits. Complicates inference. Better: pit as unary predicate Pit(x) Pit([3,1]); Pit([3,3]); Pit([4,4]) will be true © Daniel S. Weld

18 Wumpus World: Breezes Represent breezes like pits,
as unary predicates: Breezy(x) “Squares next to pits are breezy”: x, y, a, b: Pit([x, y]) ^ Adjacent([x, y], [a, b])  Breezy([a, b]) © Daniel S. Weld

19 Wumpus World: Wumpuses
Wumpus as object: Wumpus Wumpus home as unary predicate: WumpusIn(x) Better: Wumpus’s home as a function: Home(Wumpus) references the wumpus’s home square. Why is this better? © Daniel S. Weld

20 Wumpus World: Still Todo
Time Inference/reasoning © Daniel S. Weld


Download ppt "Knowledge Representation III First-Order Logic"

Similar presentations


Ads by Google