1 First Order Logic CS 171/271 (Chapter 8) Some text and images in these slides were drawn from Russel & Norvig’s published material
2 Propositional Logic Limitations Stating similar facts is cumbersome Can’t make generalizations World contains facts, not objects Natural language deals with objects (nouns) and relations (verbs), hence is more expressive Ontological commitment of PL is limited
3 First Order Logic World consists of Objects Relations Functions Sentences are made up of Symbols: for constant objects, predicates, and functions Connectives: as in PL Quantifiers and variables: x, y
4 FOL Syntax Sentence Atomic Sentence ( Sentence Connective Sentence ) Sentence Quantifier Variable Sentence Atomic Sentence Predicate-Symbol( Term, … ) Term = Term
5 FOL Syntax Term (refers to an object) Function-Symbol( Term, … ) Constant-Symbol Variable Connective: , , , , Quantifier: , Variable: x, y, z, …
6 Example
7 Symbols Constants: John, Richard, C, L1, L2 Predicates: Person={John, Richard} King={Richard} Crown={C} Brother={(John,Richard),(Richard,John)} OnHead={(C,Richard)} Functions: LeftLeg={(Richard->L1),(John->L2)} (strictly speaking, the function should be total)
8 Models and Interpretations A model in FOL consists of the objects (domain elements) and relations (including functions) See example diagram “conceptual” view of world An interpretation associates the symbols to the objects, relations, and functions in the model Number of interpretations for a given set of symbols is combinatorially explosive
9 Semantics Truth of a sentence in FOL: Determined with respect to a model and an interpretation Analogous notions for entailment, validity, and satisfiability Model enumeration is impractical in FOL
10 Sample Sentences Person(John) Person(Richard) OnHead(C, John) LeftLeg(John) = L1 LeftLeg(Richard) = L1 Richard, and LeftLeg(John) are examples of terms (a term is an expression that refers to an object) Atomic Sentences: constructed by equating terms (=) or by a predicate (with terms as arguments) Complex Sentences: sentences with connectives
11 Quantifiers Universal Quantification x P is true in a model m iff P is true with x being each possible object in the model A conjunction of instantiations Existential Quantification x P is true in a model m iff P is true with x being some object in the model A disjunction of instantiations
12 Sample Sentences Using Quantifiers x King(x) Person(x) x Crown(x) OnHead(x,John) “John has a crown on his head” x y Brother(x,y) Brother(y,x) x y Brother(x,Richard) Brother(y,Richard) (x=y) “Richard has at least 2 brothers”
13 Properties of Quantifiers Nested Quantifiers x y P equivalent to y x P y x P equivalent to y x P Does not apply if quantifiers are different De Morgan’s law for quantifiers x P x P x P x P x P x P x P x P
14 More About Quantifiers Be careful when: Using quantifiers ( , ) in combination with , The domain consists of multiple kinds of objects In the quantified sentence (such as x P or x P), P would typically contain terms that are variables Not just ground terms (terms that have no variables) x P as a query: binding list more important than truth of the sentence
15 Axioms and Theorems Axioms are sentences that represent first principles Plain facts Definitions Theorems are sentences entailed by axioms
16 Some Useful Domains Natural Numbers Built from 0, successor function S, and Peano axioms Sets , , , , and element insertion Lists Nil, Cons, Append, First, Rest, Find, …
17 FOL and the Wumpus World We can represent the Wumpus World in a more compact fashion Less sentences needed to represent rules We can include time and percept objects in the world A percept is represented as a list of constant symbols Predicates with time arguments capture the dynamic nature of the agent moving in this world
18 Knowledge Engineering Identify the task Assemble the relevant knowledge Decide on a vocabulary Encode general knowledge of the domain Encode the specific problem instance Pose queries to the inference procedure Debug the knowledge base