First-order Logic.

Slides:



Advertisements
Similar presentations
First-Order Logic Chapter 8.
Advertisements

Predicate Logic Colin Campbell. A Formal Language Predicate Logic provides a way to formalize natural language so that ambiguity is removed. Mathematical.
First Order Logic Logic is a mathematical attempt to formalize the way we think. First-order predicate calculus was created in an attempt to mechanize.
First-Order Logic.
Computer Science CPSC 322 Lecture 25 Top Down Proof Procedure (Ch 5.2.2)
Biointelligence Lab School of Computer Sci. & Eng.
Inference Rules Universal Instantiation Existential Generalization
SLD-resolution Introduction Most general unifiers SLD-resolution
1 A formula in predicate logic An atom is a formula. If F is a formula then (~F) is a formula. If F and G are Formulae then (F /\ G), (F \/ G), (F → G),
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
Standard Logical Equivalences
Resolution.
Inference in first-order logic Chapter 9. Outline Reducing first-order inference to propositional inference Unification Generalized Modus Ponens Forward.
Automated Reasoning Systems For first order Predicate Logic.
1 Logic Logic in general is a subfield of philosophy and its development is credited to ancient Greeks. Symbolic or mathematical logic is used in AI. In.
Artificial Intelligence
First Order Logic Resolution
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.
We have seen that we can use Generalized Modus Ponens (GMP) combined with search to see if a fact is entailed from a Knowledge Base. Unfortunately, there.
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.
13 Automated Reasoning 13.0 Introduction to Weak Methods in Theorem Proving 13.1 The General Problem Solver and Difference Tables 13.2 Resolution.
Methods of Proof Chapter 7, Part II. Proof methods Proof methods divide into (roughly) two kinds: Application of inference rules: Legitimate (sound) generation.
Logic.
F22H1 Logic and Proof Week 7 Clausal Form and Resolution.
Knowledge Representation I Suppose I tell you the following... The Duck-Bill Platypus and the Echidna are the only two mammals that lay eggs. Only birds.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
11/7 Are there irrational numbers p and q such that p q is a rational number? Hint: Suppose p=q= Rational Irrational Why is the set that is the set of.
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Lecture of 11/13 Resolution theorem proving (end) Propositional Probabilistic Logic (start) Announcements: 1. Homework 4 socket closed; Due next week 2.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2004.
10/29 Plan(s) for make-up Class 1.Extend four classes until 12:15pm 2.Have a separate make- up class on a Friday morning.
1 Automated Reasoning Introduction to Weak Methods in Theorem Proving 13.1The General Problem Solver and Difference Tables 13.2Resolution Theorem.
Inference and Resolution for Problem Solving
10/31 Here are the stats for the in-class exam (out of 85) Undergrad Avg=30.85; Std dev= 16.72; Max=70.5; min= 8.5 Grad Avg=42.10; std dev=17.52; Max=74.5;
Knoweldge Representation & Reasoning
3/31. Notice that sampling methods could in general be used even when we don’t know the bayes net (and are just observing the world)!  We should strive.
Prop logic First order predicate logic (FOPC) Prob. Prop. logic Objects, relations Degree of belief First order Prob. logic Objects, relations.
Herbrand Interpretations Herbrand Universe –All constants Rao,Pat –All “ground” functional terms Son-of(Rao);Son-of(Pat); Son-of(Son-of(…(Rao)))…. Herbrand.
Propositional Logic Agenda: Other forms of inference in propositional logic Basics of First Order Logic (FOL) Vision Final Homework now posted on web site.
Why FOPC If your thesis is utter vacuous Use first-order predicate calculus. With sufficient formality The sheerest banality Will be hailed by the critics:
First Order Logic. This Lecture Last time we talked about propositional logic, a logic on simple statements. This time we will talk about first order.
Propositional Logic Reasoning correctly computationally Chapter 7 or 8.
INFERENCE IN FIRST-ORDER LOGIC IES 503 ARTIFICIAL INTELLIGENCE İPEK SÜĞÜT.
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
Proof Systems KB |- Q iff there is a sequence of wffs D1,..., Dn such that Dn is Q and for each Di in the sequence: a) either Di is in KB or b) Di can.
1 Knowledge Based Systems (CM0377) Lecture 4 (Last modified 5th February 2001)
Pattern-directed inference systems
Logical Agents Logic Propositional Logic Summary
Slide 1 Propositional Definite Clause Logic: Syntax, Semantics and Bottom-up Proofs Jim Little UBC CS 322 – CSP October 20, 2014.
Computing & Information Sciences Kansas State University Wednesday, 20 Sep 2006CIS 490 / 730: Artificial Intelligence Lecture 12 of 42 Wednesday, 20 September.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
Computing & Information Sciences Kansas State University Lecture 13 of 42 CIS 530 / 730 Artificial Intelligence Lecture 13 of 42 William H. Hsu Department.
Computing & Information Sciences Kansas State University Lecture 14 of 42 CIS 530 / 730 Artificial Intelligence Lecture 14 of 42 William H. Hsu Department.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
1 Introduction to Abstract Mathematics Chapter 2: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 2.3.
For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9.
Artificial Intelligence “Introduction to Formal Logic” Jennifer J. Burg Department of Mathematics and Computer Science.
1 First order theories (Chapter 1, Sections 1.4 – 1.5) From the slides for the book “Decision procedures” by D.Kroening and O.Strichman.
Inference in First Order Logic. Outline Reducing first order inference to propositional inference Unification Generalized Modus Ponens Forward and backward.
First-Order Logic Reading: C. 8 and C. 9 Pente specifications handed back at end of class.
Computing & Information Sciences Kansas State University Lecture 12 of 42 CIS 530 / 730 Artificial Intelligence Lecture 12 of 42 William H. Hsu Department.
1 Propositional Logic Limits The expressive power of propositional logic is limited. The assumption is that everything can be expressed by simple facts.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View Basic Concepts and Background.
Artificial Intelligence Logical Agents Chapter 7.
Introduction to Logic for Artificial Intelligence Lecture 2
Logic: Top-down proof procedure and Datalog
CS 416 Artificial Intelligence
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
Presentation transcript:

First-order Logic

Assertions; t/f FOPC Prob FOPC Ontological commitment Prob prop logic Facts Objects relations FOPC Prob FOPC Ontological commitment Prob prop logic Prop logic facts t/f/u Deg belief Epistemological commitment Assertions; t/f

AtomicPropositionalRelationalFirst order Expressiveness of Representations AtomicPropositionalRelationalFirst order Atomic representations: States as blackboxes.. Propositional representations: States as made up of state variables Relational representations: States made up of objects and relations between them First-order: there are functions which “produce” objects.. (so essentially an infinite set of objects Propositional can be compiled to atomic (with exponential blow-up) Relational can be compiled to propositional (with exponential blo-up) if there are no functions With functions, we cannot compile relational representations into any finite propositional representation “higher-order” representations can (sometimes) be compiled to lower order

Why FOPC If your thesis is utter vacuous Use first-order predicate calculus. With sufficient formality The sheerest banality Will be hailed by the critics: "Miraculous!"

Connection to propositional logic: general object referent Can’t have predicates of predicates.. thus first-order Connection to propositional logic: Think of “atomic sentences” as propositions…

Important facts about quantifiers Forall and There-exists are related through negation.. ~[forall x P(x)] = Exists x ~P(x) ~[exists x P(x)] = forall x ~P(x) Quantification is allowed only on variables can’t quantify on predicates; can’t say [Forall P Reflexive(P)  forall x,y P(x,y) => P(y,x) —you have to write it once per relation) Order of quantifiers matters

Family Values: Falwell vs. Mahabharata According to a recent CTC study, “….90% of the men surveyed said they will marry the same woman..” “…Jessica Alba.” Intuitively, x depends on y as it is in the scope of the quantification on y (foreshadowing Skolemization) English is Expressive but Ambiguous.

Caveat: Order of quantifiers matters Loves(x,y) means x loves y Intuitively, x depends on y as it is in the scope of the quantification on y (foreshadowing Skolemization) “either Fido loves both Fido and Tweety; or Tweety loves both Fido and Tweety” “ Fido or Tweety loves Fido; and Fido or Tweety loves Tweety”

Caveat: Decide whether a symbol is predicate, constant or function… Make sure you decide what are your constants, what are your predicates and what are your functions Once you decide something is a predicate, you cannot use it in a place where a predicate is not expected! In the previous example, you cannot say

More on writing sentences Forall usually goes with implications (rarely with conjunctive sentences) There-exists usually goes with conjunctions—rarely with implications Everyone at ASU is smart Someone at UA is smart

Apt-pet An apartment pet is a pet that is small Dog is a pet Cat is a pet Elephant is a pet Dogs and cats are small. Some dogs are cute Each dog hates some cat Fido is a dog

Notes on encoding English statements to FOPC Since you are allowed to make your own predicate and function names, it is quite possible that two people FOPCizing the same KB may wind up writing two syntactically different KBs If each of the KBs is used in isolation, there is no problem. However, if the knowledge written in one KB is supposed to be used in conjunction with that in another KB, you will need “Mapping axioms” which relate the “vocabulary” in one KB to the vocabulary in the other KB. This problem is PRETTY important in the context of Semantic Web You get to decide what your predicates, functions, constants etc. are. All you are required to do is be consistent in their usage. When you write an English sentence into FOPC sentence, you can “double check” by asking yourself if there are worlds where FOPC sentence doesn’t hold and the English one holds and vice versa The “Semantic Web” Connection

Two different Tarskian Interpretations This is the same as the one on The left except we have green guy for Richard Problem: There are too darned many Tarskian interpretations. Given one, you can change it by just substituting new real-world objects  Substitution-equivalent Tarskian interpretations give same valuations to the FOPC statements (and thus do not change entailment)  Think in terms of equivalent classes of Tarskian Interpretations (Herbrand Interpretations) We had this in prop logic too—The real World assertion corresponding to a proposition

Connection to propositional logic: Think of “atomic sentences” as propositions…

Herbrand Interpretations Let us think of interpretations for FOPC that are more like interpretations for prop logic Herbrand Interpretations Herbrand Universe All constants Rao,Pat All “ground” functional terms Son-of(Rao);Son-of(Pat); Son-of(Son-of(…(Rao)))…. Herbrand Base All ground atomic sentences made with terms in Herbrand universe Friend(Rao,Pat);Friend(Pat,Rao);Friend(Pat,Pat);Friend(Rao,Rao) Friend(Rao,Son-of(Rao)); Friend(son-of(son-of(Rao),son-of(son-of(son-of(Pat)) We can think of elements of HB as propositions; interpretations give T/F values to these. Given the interpretation, we can compute the value of the FOPC database sentences If there are n constants; and p k-ary predicates, then --Size of HU = n --Size of HB = p*nk But if there is even one function, then |HU| is infinity and so is |HB|. --So, when there are no function symbols, FOPC is really just syntactic sugaring for a (possibly much larger) propositional database

But what about Godel? In First Order Logic We have finite set of constants Quantification allowed only over variables… Godel’s incompleteness theorem holds only in a system that includes “mathematical induction”—which is an axiom schema that requires infinitely many FOPC statements If a property P is true for 0, and whenever it is true for number n, it is also true for number n+1, then the property P is true for all natural numbers You can’t write this in first order logic without writing it once for each P (so, you will have to write infinite number of FOPC statements) So, a finite FOPC database is still semi-decidable in that we can prove all provably true theorems

Proof-theoretic Inference in first order logic For “ground” sentences (i.e., sentences without any quantification), all the old rules work directly (think of ground atomic sentences as propositions) P(a,b)=> Q(a); P(a,b) |= Q(a) ~P(a,b) V Q(a) resolved with P(a,b) gives Q(a) What about quantified sentences? May be infer ground sentences from them…. Universal Instantiation (a universally quantified statement entails every instantiation of it) Existential instantiation (an existentially quantified statement holds for some term (not currently appearing in the KB). Can we combine these (so we can avoid unnecessary instantiations?) Yes. Generalized modus ponens Needs UNIFICATION

UI can be applied several times to add new sentences --The resulting KB is equivalent to the old one EI can only applied once --The resulting DB is not equivalent to the old one BUT will be satisfiable only when the old one is

Want mgu (maximal general unifiers)

How about knows(x,f(x)) knows(u,u)? x/u; u/f(u)leads to infinite regress (“occurs check”)

GMP can be used in the “forward” (aka “bottom-up”) fashion where we start from antecedents, and assert the consequent or in the “backward” (aka “top-down”) fashion where we start from consequent, and subgoal on proving the antecedents.

Apt-pet An apartment pet is a pet that is small Dog is a pet Cat is a pet Elephant is a pet Dogs, cats and skunks are small. Fido is a dog Louie is a skunk Garfield is a cat Clyde is an elephant Is there an apartment pet?

Your Project 4!

Efficiency can be improved by re-ordering subgoals adaptively e.g., try to prove Pet before Small in Lilliput Island; and Small before Pet in pet-store.

Forward (bottom-up) vs. Backward (top-down) chaining Suppose we have P => Q Q & R =>S S => Z Z & Q => W Q => J P R We want to prove J Forward chaining allows parallel derivation of many facts together; but it may derive facts that are not relevant for the theorem. Backward chaining concentrates on proving subgoals that are relevant to the theorem. However, it proves theorems one at a time. Some similarity with progression vs. regression… Forward chaining fires rules starting from facts Using P, derive Q Using Q & R, derive S Using S, derive Z Using Z, Q, derive W Using Q, derive J No more inferences. Check if J holds. It does. So proved Backward chaining starts from the theorem to be proved We want to prove J. Using Q=>J, we can subgoal on Q Using P=>Q, we can subgoal on P P holds. We are done.

Datalog and Deductive Databases Connection to Progression becoming goal directed w.r.t. P.G. reachability heuristics  Datalog and Deductive Databases A deductive database is a generalization of relational database, where in addition to the relational store, we also have a set of “rules”. The rules are in definite clause form (universally quantified implications, with one non-negated head, and a conjunction of non-negated tails) When a query is asked, the answers are retrieved both from the relational store, and by deriving new facts using the rules. The inference in deductive databases thus involves using GMP rule. Since deductive databases have to derived all answers for a query, top-down evaluation winds up being too inefficient. So, bottom-up (forward chaining) evaluation is used (which tends to derive non-relevant facts  A neat idea called magic-sets allows us to temporarily change the rules (given a specific query), such that forward chaining on the modified rules will avoid deriving some of the irrelevant facts. ?R(z) R(c); R(b).. Rules P(x,y),Q(y)=>R(y) Base facts P(a,b),Q(b) R(c).. RDBMS

Similar to “Integer Programming” or “Constraint Programming”

Generate compilable matchers for each pattern, and use them

Example of FOPC Resolution.. Everyone is loved by someone If x loves y, x will give a valentine card to y Will anyone give Rao a valentine card? z/SK(rao);x’/rao y/z;x/Rao ~loves(z,Rao)

Finding where you left your key.. Atkey(Home) V Atkey(Office) 1 Where is the key? Ex Atkey(x) Negate Forall x ~Atkey(x) CNF ~Atkey(x) 2 Resolve 2 and 1 with x/home You get Atkey(office) 3 Resolve 3 and 2 with x/office You get empty clause So resolution refutation “found” that there does exist a place where the key is… Where is it? what is x bound to? x is bound to office once and home once. so x is either home or office

Existential proofs.. Are there irrational numbers p and q such that pq is rational? This and the previous examples show that resolution refutation is powerful enough to model existential proofs. In contrast, generalized modus ponens is only able to model constructive proofs.. Rational Irrational

Existential proofs.. The previous example shows that resolution refutation is powerful enough to model existential proofs. In contrast, generalized modus ponens is only able to model constructive proofs.. (We also discussed a cute example of existential proof—is it possible for an irrational number power another irrational number to be a rational number—we proved it is possible, without actually giving an example).

GMP vs. Resolution Refutation While resolution refutation is a complete inference for FOPC, it is computationally semi-decidable, which is a far cry from polynomial property of GMP inferences. So, most common uses of FOPC involve doing GMP-style reasoning rather than the full theorem-proving.. There is a controversy in the community as to whether the right way to handle the computational complexity is to a. Develop “tractable subclasses” of languages and require the expert to write all their knowlede in the procrustean beds of those sub-classes (so we can claim “complete and tractable inference” for that class) OR Let users write their knowledge in the fully expressive FOPC, but just do incomplete (but sound) inference. See Doyle & Patil’s “Two Theses of Knowledge Representation”