Copyright 1999Paul F. Reynolds, Jr. Foundations of Logic Programming.

Slides:



Advertisements
Similar presentations
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.
Advertisements

Some Prolog Prolog is a logic programming language
Inference Rules Universal Instantiation Existential Generalization
Chapter 11 :: Logic Languages
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
Introduction to Theorem Proving
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.
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.
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.
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
13 Automated Reasoning 13.0 Introduction to Weak Methods in Theorem Proving 13.1 The General Problem Solver and Difference Tables 13.2 Resolution.
Deduction In addition to being able to represent facts, or real- world statements, as formulas, we want to be able to manipulate facts, e.g., derive new.
Artificial Intelligence Chapter 14. Resolution in the Propositional Calculus Artificial Intelligence Chapter 14. Resolution in the Propositional Calculus.
Prolog IV Logic, condensed. 2 Propositional logic Propositional logic consists of: The logical values true and false ( T and F ) Propositions: “Sentences,”
Formal Logic Proof Methods Direct Proof / Natural Deduction Conditional Proof (Implication Introduction) Reductio ad Absurdum Resolution Refutation.
CSE (c) S. Tanimoto, 2008 Propositional Logic
Constraint Logic Programming Ryan Kinworthy. Overview Introduction Logic Programming LP as a constraint programming language Constraint Logic Programming.
Inference in FOL Copyright, 1996 © Dale Carnegie & Associates, Inc. Chapter 9 Spring 2004.
Logic and Proof. Argument An argument is a sequence of statements. All statements but the first one are called assumptions or hypothesis. The final statement.
Inference and Resolution for Problem Solving
Chapter 3 Propositional Logic
First Order Logic (chapter 2 of the book) Lecture 3: Sep 14.
Artificial Intelligence
Plan for the rest of the quarter TuesdayThursday Week 7ResolutionProof carrying code Week 8No class (Sorin in DC for workshop) Predicate abstraction (Mystery.
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.
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.
For Wednesday Read chapter 10 Prolog Handout 4. Exam 1 Monday Take home due at the exam.
1 Inference Rules and Proofs (Z); Program Specification and Verification Inference Rules and Proofs (Z); Program Specification and Verification.
Conjunctive normal form: any formula of the predicate calculus can be transformed into a conjunctive normal form. Def. A formula is said to be in conjunctive.
1 Chapter 8 Inference and Resolution for Problem Solving.
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
CSE S. Tanimoto Horn Clauses and Unification 1 Horn Clauses and Unification Propositional Logic Clauses Resolution Predicate Logic Horn Clauses.
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
CS4026 Formal Models of Computation Part II The Logic Model Lecture 2 – Prolog: History and Introduction.
The AI War LISP and Prolog Basic Concepts of Logic Programming
Logic Programming Languages Session 13 Course : T Programming Language Concept Year : February 2011.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Automated Reasoning Early AI explored how to automate several reasoning tasks – these were solved by what we might call weak problem solving methods as.
Ch. 13 Ch. 131 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes?) Dr. Carter Tiernan.
1 Introduction to Abstract Mathematics Chapter 2: The Logic of Quantified Statements. Predicate Calculus Instructor: Hayk Melikya 2.3.
Automated Reasoning Systems For first order Predicate Logic.
CS6133 Software Specification and Verification
© Kenneth C. Louden, Chapter 12 - Logic Programming Programming Languages: Principles and Practice, 2nd Ed. Kenneth C. Louden.
Propositional Logic Predicate Logic
First Order Logic Lecture 3: Sep 13 (chapter 2 of the book)
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Backward chaining Assume the same representation of rules as in forward chaining, i.e. If is true, is true, … is true Then is true. Rule interpretation.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View Basic Concepts and Background.
By P. S. Suryateja Asst. Professor, CSE Vishnu Institute of Technology
Introduction to Logic for Artificial Intelligence Lecture 2
Resolution in the Propositional Calculus
Horn Clauses and Unification
Logic Use mathematical deduction to derive new knowledge.
First Order Logic Rosen Lecture 3: Sept 11, 12.
Horn Clauses and Unification
Prolog IV Logic, condensed.
Horn Clauses and Unification
Horn Clauses and Unification
Computer Security: Art and Science, 2nd Edition
Horn Clauses and Unification
CS2136: Paradigms of Computation
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
RESOLUTION.
Presentation transcript:

Copyright 1999Paul F. Reynolds, Jr. Foundations of Logic Programming

Copyright 1999Paul F. Reynolds, Jr. Deductive Logic e.g. of use: Gypsy specifications and proofs About deductive logic… –(Gödel, 1931) Interesting systems (with a finite number of axioms) are necessarily either: incomplete (there are statements that can't be proven) or inconsistent (  S such that S and ¬S can be proven true) Interesting systems include Presberger Arithmetic (0,1,*,+) and Peano Arithmetic (0,1,+) Recall: all inconsistent systems are complete

Copyright 1999Paul F. Reynolds, Jr. First Order Predicate Logic Logic programming is based on FOPL FOPL is complete (J.A. Robinson & resolution theorem proving) –"All clauses logically implied by an initial formula may be derived from the initial formula by the proof method." BUT FOPL is undecidable –An attempt to prove a formula may go on forever, but there will be no indication when to stop without sacrificing formulae that can be proven.  completeness of FOPL is of theoretical interest, but of limited practicality. (completeness is predicated on there being a search strategy that knows when to stop a particular unproductive line of deduction.) Higher order predicate logics (and calculi) - ones which allow predicates of predicates - are not complete.

Copyright 1999Paul F. Reynolds, Jr. Foundations of Logic Programming Logic programming is based on Horn Clauses –In the propositional calculus all formulae can be put in conjunctive normal form (disjuncts connected by  ) –Each disjunct can be expressed as: A 1  A 2 ...  A m  ¬B 1  ¬B 2 ...  ¬B n  A 1  A 2 ...  A m  ¬ (B 1  B 2 ...  B n )  A 1  A 2 ...  A m  (B 1  B 2 ...  B n ) interpretations: m > 1Conclusions are indefinite, one or more are true. m = 1Horn clauses. m = 1, n > 0(A  B 1  B 2 ...  B n ) -- definite clause, 1 conclusion m = 1, n = 0(A  ) unconditional definite clause (fact) m = 0, n > 0negation of (B 1  B 2 ...  B n ) m = 0, n = 0  the empty clause (contradiction) In logic, all clauses can be represented as Horn Clauses...

Copyright 1999Paul F. Reynolds, Jr. Proof by Refutation An important proof method: P: set of axioms Q: clause to be proven –show P  ¬Q is false by deriving a contradiction –i.e., assert  Q and try to derive empty clause, which represents false. –In this context, Q is called a goal. Propositional Horn Clause Resolution (PHC Resolution) –In doing a refutation proof, the following general PHC resolution step can be performed: A 1  (B 1  B 2 ...  B n )  A 1  A 2 ...  A m ________________________________  (B 1  B 2 ...  B n )  A 2 ...  A m  Keep applying this until  is achieved.

Copyright 1999Paul F. Reynolds, Jr. More PHC Resolution e.g.to prove A 2 (1)A 1  (2)A 2  A 1, A 3 (3)A 3  (4)  A 2 -- negated goal proof leading to contradiction: (5)  A 1, A 3 -- apply 2 & 4 (6)  A 3 -- apply 1 & 5 (7)  -- apply 3 & 6 Note: Prolog and other logic-based languages are based on this resolution proof strategy.

Copyright 1999Paul F. Reynolds, Jr. First Order Predicate Logic Predicates can have arguments: constants, variables, other functional terms. e.g. (1) a(X)  m(X) (2) m(X)  e(X) (3) e(c)  (4) a(X)  s(X) (5) s(b)  (6)  a(X) When we start dealing with variables, we need: Axiom of General Specification: A clause with logical variables is true for every set of values of the variables. –Supports generalizing PHC resolution into Horn Clause Resolution (HCR) by systematically instantiating variables.  "Unification”

Copyright 1999Paul F. Reynolds, Jr. FOPL (cont) e.g. 1) p(t) 2) q(X)  p(X) 3)  q(t) 4) q(t)  p(t) (X = t) -- from (2), (3) and substitution 5)  p(t) -- from (3) & (4) 6)  -- from (1) and (5 )  resolution is combination of unification and elimination in one operation.

Copyright 1999Paul F. Reynolds, Jr. More Proofs Using: (1) a(X)  m(X) (2) m(X)  e(X) (3) e(c)  (4) a(X)  s(X) (5) s(b)  (6)  a(X) with goal  a(X) (step (6)), we can derive: (7)  m(X) -- applying (1) & (6) (8)  e(X) -- applying (2) & (7) (9)  X = c -- applying (3) & (8) also: (10)  s(X) -- applying (4) & (6) (11)  X = b -- applying (5) & (10)

Copyright 1999Paul F. Reynolds, Jr. Alternative Proof Strategies Top Down: what we've just seen - collecting variable bindings. – Start with goal and reduce into subgoals until there is only the empty subgoal. Bottom up: Combining facts with rules or rules with other rules.

Copyright 1999Paul F. Reynolds, Jr. Bottom Up Using: (1) a(X)  m(X) (2) m(X)  e(X) (3) e(c)  (4) a(X)  s(X) (5) s(b)  (6)  a(X) Combine rule (2) m(X)  e(X) -- combining with fact (3) e(c)  -- rule with yielding: m(c)  -- a fact yields combined with rule (1) a(X)  m(X) -- a new yields: a(c) -- fact or Combine rule (1) a(X)  m(X) -- combining rules with rule (2) m(X)  e(X) -- to make a new yields: a(X)  e(X) -- rule -- allows us to make discoveries from known facts and rules.

Copyright 1999Paul F. Reynolds, Jr. Closed World Assumption Inabilty to demonstrate that something is true means that it is false. –assumes user made no typos and specified all things that need to be specified to properly identify true queries as true. –leads to joining "unknown" and "not provably true" into one class. –failing to prove something true leads to conclusion that it is false. CWA says that all things that are true have been specified as such or can be derived.

Copyright 1999Paul F. Reynolds, Jr. Closed World Assumption (2) Possible alternatives: (1) leave system alone; accept CWA (2) allow negation in clauses but not in conclusion of Horn Clauses (3) allow statement of negative conclusions: search positive; search negative; report unknown; (4) work in constrained environment where everything is known (5) work in statistical environment where answers are expressed in terms of likelihoods.

Copyright 1999Paul F. Reynolds, Jr. About Prolog Prolog lends itself nicely to concurrency form: p0 :- p1, p2, p3, p4 ^---^---^---^---- can be executed concurrently(with communications about bindings) -- "AND parallelism" or: HG : { HG : { "OR... { parallelism" HG : {

Copyright 1999Paul F. Reynolds, Jr. About Prolog (2) Prolog and principles: –Orthogonal - separates logic and control (assert, retract and cut violate this) –regular - regular rules –security - meaning of a program is determined by what a user writes <> –simplicity - simple rules violates: –localized cost - execution cost is determined by rule order –defense in depth - misspellings alter meaning of program