1 / 21

First-Order Logic

First-Order Logic. Chapter 8. Outline. Why FOL? Syntax and semantics of FOL Interacting with FOL KBs Knowledge engineering in FOL. Pros and cons of propo. logic. Propositional logic is declarative Its semantics is based on a truth relation between sentences and possible worlds.

Download Presentation

First-Order Logic

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. First-Order Logic Chapter 8

  2. Outline • Why FOL? • Syntax and semantics of FOL • Interacting with FOL KBs • Knowledge engineering in FOL

  3. Pros and cons of propo. logic • Propositional logic is declarative • Its semantics is based on a truth relation between sentences and possible worlds.  Propositional logic allows partial information • Using disjunction and negation. • Propositional logic is compositional: • meaning of B1,1 P1,2 is derived from meaning of B1,1 and of P1,2  Meaning in propositional logic is context-independent • (unlike natural language, where meaning depends on context)  Propositional logic has very limited expressive power • (unlike natural language) • E.g., cannot say "pits cause breezes in adjacent squares“ • except by writing one sentence for each square

  4. First-order logic • Whereas propositional logic assumes the world contains facts, • first-order logic (like natural language) assumes the world contains • Objects: people, houses, numbers, colors, baseball games, wars, … • Relations (verbs/properties): brother of, bigger than, part of, comes between, red, round, prime, … • Functions (one-to-one relation): father of, best friend, plus, …

  5. Syntax of FOL: Basic elements • Constants (objects):KingJohn, 2,... • Predicates (relations):Brother, >,... • Functions (functions):Sqrt, LeftLegOf,... • Variables x, y, a, b,... • Connectives , , , ,  • Equality = • Quantifiers  (universal),  (existentail)

  6. Atomic sentences Atomic sentence = predicate (term1,...,termn) Term = function (term1,...,termn) or constant or variable • E.g., Brother(John,Mike) Married(Father(John), Mother(Mike)) Brother(x,y) Married(Father(x), Mother(y))

  7. Complex sentences • Complex sentences = atomic sentences + connectives S, S1 S2, S1  S2, S1 S2, S1S2, E.g. Brother(John,Mike)  Married(Father(John), Mother(Mike))

  8. Truth in first-order logic • Sentences are true with respect to a model and an interpretation • Model contains objects (domainelements) and relations among them • Interpretation specifies referents for constantsymbols→objects predicatesymbols→relations functionsymbols→ functional relations • An atomic sentence predicate(term1,...,termn) is true iff the objects referred to by term1,...,termn are in the relation referred to by predicate • An complex sentence is true, depends on the truth value of atomic sentences and truth table of connectives.

  9. Models for FOL: Example

  10. Universal quantification • A quantifier is a determiner that expresses properties of entire collections of objects. • <variables> <sentence> (for all) • x P is true in a model m iff P is true with x being each possible object in the model

  11. A common mistake to avoid • Typically,  is the main connective with  • Common mistake: using  as the main connective with .

  12. Existential quantification • <variables> <sentence> (for some, there exists) • xP is true in a model m iff P is true with x being some possible object in the model

  13. Another common mistake to avoid • Typically,  is the main connective with  • Common mistake: using  as the main connective with .

  14. Properties of quantifiers • Quantifier duality: each can be expressed using the other • x P x P • x P xP

  15. Properties of quantifiers • Nested quantifers • x y yx (x,y or y,x) x yyx(x,y or y,x) • x yyx x y loves(x,y) yx loves(x,y)

  16. Equality • term1 = term2is true under a given interpretation iff term1and term2refer to the same object e.g. x=y, father(x) = y, (x=y) • E.g. John has two brothers • E.g., definition of Sibling in terms of Parent:

  17. The Wumpus World KB • Perception • t,s,b Percept([s,b,Glitter],t)  Glitter(t) • t,b,g Percept([Stench,b,g],t)  Stench(t) • t,s,g Percept([s,Breeze,g],t)  Breeze(t) • Reflex action • t Glitter(t)  BestAction(Grab,t)

  18. Inferring Hidden Properties Adjacent location: • x,y,a,b Adjacent([x,y],[a,b])  [a,b]  {[x+1,y], [x-1,y],[x,y+1],[x,y-1]} Properties of squares: • s,t At(Agent, L, t)  Breeze(t)  Breezy(L) Squares are breezy near a pit: • Diagnostic rule---infer cause from effect L Breezy(L)  [r Adjacent(r,L)  Pit(r)] • Causalrule---infer effect from cause r Pit(r)  [L Adjacent(r,L)  Breezy(L)]

  19. Interacting with FOL KBs • Suppose a wumpus-world agent perceives a smell, a breeze and a glitter at t=5: Tell(KB,Percept([Stensh, Breeze, Glitter],5)) Ask(KB, a BestAction(a,5)) //does KB entail some best action at t=5? • Answer: Yes, {a/Grab} ← substitution (binding list): a set of variable/terms pairs • Given a sentence S and a substitution σ, Sσ denotes the result of plugging σ into S. e.g. S = Smarter(x,y) σ = {x/Hillary,y/Bill} Sσ = Smarter(Hillary,Bill) • Ask(KB,S) returns some/all σ that KB╞σ

  20. Knowledge engineering in FOL • Identify the task • Assemble the relevant knowledge • Decide on a vocabulary of predicates, functions, and constants • Encode general knowledge about the domain • Encode a description of the specific problem instance • Pose queries to the inference procedure and get answers • Debug the knowledge base

  21. Summary • First-order logic: • objects and relations are semantic primitives • syntax: constants, predicates, functions, equality, quantifiers • Increased expressive power: sufficient to define wumpus world

More Related