Automated reasoning and theorem proving

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

1 Knowledge Representation Introduction KR and Logic.
Artificial Intelligence Chapter 13 The Propositional Calculus Biointelligence Lab School of Computer Sci. & Eng. Seoul National University.
Biointelligence Lab School of Computer Sci. & Eng.
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.
Logic Use mathematical deduction to derive new knowledge.
Chapter 6 Logical Reasoning Xiu-jun GONG (Ph. D) School of Computer Science and Technology, Tianjin University
Automated reasoning and theorem proving Introduction: logic in AI Automated reasoning: ResolutionUnificationNormalization.
Using Predicate Logic Chapter 5.
Knowledge Representation Methods
Logic in general Logics are formal languages for representing information such that conclusions can be drawn Syntax defines the sentences in the language.
CSE (c) S. Tanimoto, 2008 Propositional Logic
Knowledge Representation I (Propositional Logic) CSE 473.
CSE 311 Foundations of Computing I Lecture 6 Predicate Logic Autumn 2011 CSE 3111.
Logical and Rule-Based Reasoning Part I. Logical Models and Reasoning Big Question: Do people think logically?
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
FIRST ORDER LOGIC Levent Tolga EREN.
Intro to Discrete Structures
Notes for Chapter 12 Logic Programming The AI War Basic Concepts of Logic Programming Prolog Review questions.
Automated reasoning and theorem proving Introduction: logic in AI Automated reasoning: ResolutionUnificationNormalization.
SAT-solving Introduction: logic in AI SAT-solving techniques: Unit-propagationLocal-search.
UNIVERSITI TENAGA NASIONAL 1 CSNB234 ARTIFICIAL INTELLIGENCE Chapter 3 Propositional Logic & Predicate Logic Chapter 3 Propositional Logic & Predicate.
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.
Logical Agents Logic Propositional Logic Summary
CS Introduction to AI Tutorial 8 Resolution Tutorial 8 Resolution.
CS6133 Software Specification and Verification
For Wednesday Read chapter 9, sections 1-3 Homework: –Chapter 7, exercises 8 and 9.
© Copyright 2008 STI INNSBRUCK Intelligent Systems Propositional Logic.
Chapter 7. Propositional and Predicate Logic Fall 2013 Comp3710 Artificial Intelligence Computing Science Thompson Rivers University.
1 Example: The following knowledge is given :The following knowledge is given : 1. Marcus was a man. 2. Marcus was a Pompeian. 3. All Pompeians were Romans.
CIT 856 – Artificial Intelligence
First-Order Logic Semantics Reading: Chapter 8, , FOL Syntax and Semantics read: FOL Knowledge Engineering read: FOL.
ARTIFICIAL INTELLIGENCE Lecture 2 Propositional Calculus.
Logical Agents Chapter 7. Outline Knowledge-based agents Propositional (Boolean) logic Equivalence, validity, satisfiability Inference rules and theorem.
March 3, 2016Introduction to Artificial Intelligence Lecture 12: Knowledge Representation & Reasoning I 1 Back to “Serious” Topics… Knowledge Representation.
Logical Agents. Outline Knowledge-based agents Logic in general - models and entailment Propositional (Boolean) logic Equivalence, validity, satisfiability.
Chapter 7. Propositional and Predicate Logic
Knowledge Representation and Reasoning
Knowledge and reasoning – second part
A I (Artificial Intelligence)
The function of knowledge representation scheme is
The Propositional Calculus
Introduction to Logic for Artificial Intelligence Lecture 1
Predicate Logic Lecture 7.
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
CS201: Data Structures and Discrete Mathematics I
CSE 311 Foundations of Computing I
CHAPTER 1: LOGICS AND PROOF
Logic Use mathematical deduction to derive new knowledge.
1st-order Predicate Logic (FOL)
First Order Logic Rosen Lecture 3: Sept 11, 12.
Knowledge and reasoning – second part
Back to “Serious” Topics…
MA/CSSE 474 More Math Review Theory of Computation
Negations of quantifiers
Chapter 7. Propositional and Predicate Logic
CS 188: Artificial Intelligence
CSNB234 ARTIFICIAL INTELLIGENCE
CSNB234 ARTIFICIAL INTELLIGENCE
This Lecture Substitution model
Propositional Logic CMSC 471 Chapter , 7.7 and Chuck Dyer
CS201: Data Structures and Discrete Mathematics I
ece 720 intelligent web: ontology and beyond
Teorie assiomatico-deduttive (calcolo dei predicati)
Logical and Rule-Based Reasoning Part I
Introduction to Computational Linguistics
The Foundations: Logic and Proofs
Representations & Reasoning Systems (RRS) (2.2)
1st-order Predicate Logic (FOL)
Presentation transcript:

Automated reasoning and theorem proving Introduction: logic in AI Automated reasoning: Resolution Unification Normalization

Introduction: Syntax Model semantics Logical entailment Motivating example Automated reasoning Logic: Syntax Model semantics Logical entailment

Why Logic is needed in AI? Solutions to many problems might require logical analysis In order to automate logical reasoning, we need a formal language So, we need a language that can represent a problem and a method to search the problem 3

Logic and AI: The Basics Representation => predicate calculus Search => resolution principle 4

Things We Will Do With Logic A two step process 1. See if there is a solution 2. Find the solution 5

“Marcia is wherever John is” and “John is at school” Example Problems John and Marcia given “Marcia is wherever John is” and “John is at school” we will find where Marcia is! 6

Resolution Proofs - Example Given: ( x) {AT(John, x) AT(Marcia, x)} AT(John, school) Prove: ( x) AT(Marcia, x) i.e., “where is Marcia?” 7

Resolution Proof - Finally! ~AT(John, x) AT(Marcia, x) ~AT(Marcia,x) ~AT(John, x) AT(John, school) The negation is false; Marcia must be somewhere. But, where! nil 8

Modified Proof Tree ~AT(John, x) AT(Marcia, x) ~AT(Marcia,x)  AT(Marcia,x) ~AT(John, x)  AT(Marcia,x) AT(John, school) AT(Marcia, school) 9

Why Logical is good Representation? The principles of correct reasoning i.e. sound and complete inference rules and semantics of predicate calculus emphasizes truth preserving operations on well formed expression.

Problem Solving Requires sufficient knowledge Makes correct inference from this knowledge Must do inference sufficiently

Building Knowledge Select the significant objects and relation in the domain Map these into a formal language

Four Categories of Knowledge Representation Logical representation schemes Procedural representation schemes Network representation schemes Structured representation schemes

Four Categories of Knowledge Representation

H/W Assignment for Assignment group 2 G2: What does “sound and complete inference rules” mean? NAiST-LAB

Introduction: Syntax Model semantics Logical entailment Motivating example Automated reasoning Logic: Syntax Model semantics Logical entailment

The AI dream in the 60’s: Logic allows to express almost everything ‘formally’. Logic also allows to prove “theorems” based on the information given. Can we exploit this to build automated reasoning systems ??

Underlying premises: Logic is the ‘assembly language’ of knowledge and is closely related to natural language. In logic almost all kinds of knowledge can be represented formally and unambiguously. Since computers are supposed to process the knowledge, it should be expressed formally and unambiguously. Logical deduction allows us to derive systematically new knowledge from the existing one. Automating deduction ??

Example: The following knowledge is given : 1. Marcus was a man. 2. Marcus was a Pompeian. 3. All Pompeians were Romans. 4. Caesar was a ruler. 5. All Romans were either loyal to Caesar or hated him. 6. Everyone is loyal to someone. 7. People only try to assassinate rulers to whom they are not loyal. 8. Marcus tried to assassinate Caesar. Can we automatically answer the following questions? Was Marcus loyal to Caesar? Did Marcus hate Caesar?

Question Is there any ambiguity of given statement? Is there any problem about predicate selection?

Conversion to the First Order Logic: Representation of facts: 1. Marcus was a man. man(Marcus) 2. Marcus was a Pompeian. Pompeian(Marcus) 4. Caesar was a ruler. ruler(Caesar) 8. Marcus tried to assassinate Caesar. try_assassinate(Marcus, Caesar)

Conversion to the First Order Logic (2): General representation (representation of rules): 3. All Pompeians were Romans. x Pompeian(x)  Roman(x) 5. All Romans were either loyal to Caesar or hated him. ( )  ~(loyal_to(x,Caesar)  hates(x,Caesar)) XOR x Roman(x)  loyal_to(x,Caesar)  hates(x,Caesar) 6. Everyone is loyal to someone. x y loyal_to(x,y) 7. People only try to assassinate rulers to whom they are not loyal. xy person(x)  ruler(y)  try_assassinate(x,y)  ~loyal_to(x,y)

The “theorem” ? Was Marcus loyal to Caesar? Try, for example, to prove that he was not : ~loyal_to(Marcus,Caesar) Did Marcus hate Caesar? Prove that he did: hates(Marcus,Caesar)

A proof using backward-reasoning problem-reduction: ~loyal_to(Marcus,Caesar) person(Marcus) ruler(Cesar) AND try_assassinate(Marcus, Caesar) xy person(x)  ruler(y)  try_assassinate(x,y)  ~loyal_to(x,y) + substitution: x/Marcus y/Caesar person(Marcus)  ruler(Caesar)  try_assassi-nate(Marcus,Caesar)  ~loyal_to(Marcus,Caesar) + Modus ponens Extra rule: x man(x)  person(x) man(Marcus) Done! 8. Done! 4. Done! 1.

Way of Representing Class Membership 1. man(Marcus) 2. Pompeian(Marcus) 3. x: Pompeian(x) Roman(x) 4. ruler(Caesar) 5. x: Roman(x) loyalto(x,Caesar) hate(x,Caesar)

Way of Representing Class Membership 1. instance(Marcus,man) 2. instance(Marcus,Pompeian) 3. x: instance(x, Pompeian) instance(x, Roman) 4. instance(Caesar,ruler) 5. x: instance(x, Roman) loyalto(x,Caesar) hate(x,Caesar) CS 6833/CS 680 NAiST-LAB NAiST-LAB

Way of Representing Class Membership 1. instance(Marcus,man) 2. instance(Marcus,Pompeian) 3. isa(Pompeian,Roman) 4. instance(Caesar,ruler) 5. x: instance(x, Roman) loyalto(x,Caesar) hate(x,Caesar) 6. x: y: z: instance(x, y) isa(y,z) instance(x, z) CS 6833/CS 680 NAiST-LAB NAiST-LAB

Problems: 1) knowledge representation: Natural language is imprecise / ambiguous see “People only try …” Obvious information is easily forgotten. see man <-> person Some information is more difficult to represent in logic. Vb.: “perhaps …”, “possibly…”, “probably…”, “the chance of … is 45%”, Logic is inconvenient from a software engineering perspective. too ‘fine-grained’ (like an assembly language)

Problems: 2) Problem solving: All trade-offs that we had with search methods based on states space representation: backward/forward, tree/graph, OR-tree/AND- OR, control aspects, ... What deduction rules are needed in general? Example: prove “ hates(Marcus,Caesar) “ x Roman(x)  loyal_to(x,Caesar)  hates(x,Caesar) The only applicable rule is: Modus ponens??? How do we handle x and y ?

Problems: 2) Problem solving (2): How to compute substitutions in the general case ? xy person(x)  ruler(y)  try_assassinate(x,y)  ~loyal_to(x,y) + substitution: x/Marcus y/Caesar In general: more complex Which theorem do we try to prove? Ex.: loyal_to(Marcus,Caesar) or ~loyal_to(Marcus,Caesar) How to handle equality of objects? Problem: combinatorial explosion of the derived equalities (reflexivity, symmetry, transitivity, …) How to guarantee correctness/completeness?

The formal model semantics of Logic The meaning of “Logical entailment”

Propositional logic

Basic concepts: In propositional logic:    ~   connectors ( ) The alphabet:    ~   connectors weather_is_rainy joe_has_an_umbrella Atomic propositions ( ) punctuation joe_has_an_umbrella  weather_is_rainy ~ weather_is_rainy Well-formed formulas: Notation: p, q, r : atomic propositions.

Semantics (meaning) 1. Intuitive (natural) semantics: In general (for all knowledge representation formalisms): 2 approaches to define semantics: 1. Intuitive (natural) semantics: Describe the meaning by means of a natural language Exs. (propositional logic):  : “implies” ~ : “not true that”  : “or” p  q : “p if and only if q” ~ p  r : “not p and r” every symbol and every well-formed formula gets meaning through the associated natural language

Semantics (2) 2. Transformational semantics: Logically entailed p Describe the meaning by converting to an associated “mathematical” object In propositional logic : the set of all propositional symbols that are logically entailed by the given formulas: Logically entailed p p  ~ q p q  r q r p q p r q r p q r

But how to define “logical entailment” ? NOT as: Everything that we can derive from the formulas SINCE: At this moment we do not know yet: “what is a complete set of the derivation rules” This is exactly what Automated Reasoning aims to find out! BUT by: Interpretations Models

Interpretation: = a function that assigns a truth value to each “atomic” formula Also provides (indirectly) truth values for each well-formed formula p q ~p p  q p  q p  q p  q T F T T F F T F T T F F T F Truth table

Model Given a set of formulas S: a model is an interpretation that makes all formulas in S true p  ~ q p q  r S Example: p q r T F Model: p  ~q q  r T p

Logical entailment: Given a set of formulas S and a formula F: F is logically entailed by S ( S |= F ), if all models of S also make F true. p  ~ q p q  r S Example: F: r  p p q r T F (the only) Model: r  p T

Predicate logic

Well-formed formulas: The alphabet:  constants Yvonne Yvette variables x y z  ~   connectors  function symbols g f h  quantifiers  predicate symbols q p ( ) punctuation , Terms: Yvonne y f(x, g(Yvette)) Well-formed formulas: p(Yvonne) p(x)  ~q(x) z p(z) x y p(x)  q(y)  p(f(Yvonne, Yvette)

Formally: An alphabet consists of variables, constants, function symbols, predicate symbols (all user-defined) and of connectors, punctuations en quantifiers. Terms are either: variables, constants, function symbols provided with as many terms as arguments, as the function symbol expects. Well-formed formulas are constructed from predicate symbols, provided with terms as arguments, and from connectors, quantifiers and punctuation – according to the rules of the connectors.

Example: { {0}, {x,y}, {s}, {odd,even}, Con, Pun, Quan} Alphabet: { {0}, {x,y}, {s}, {odd,even}, Con, Pun, Quan} Terms: { 0, s(0), s(s(0)), s(s(s(0))), … x, s(x), s(s(x)), s(s(s(x))), … y, s(y), s(s(y)), s(s(s(y))), … } Well-formed formulas: odd(0), even(s(0)), … odd(x), odd(s(y)), … odd(x)  even(s(s(x))), … x ( odd(x)  even(s(x)) ), … odd(y)  x (even( s(x))), ...

Interpretation: A D = N Example: = a set D (the domain), and a function that maps constants to D, and a function that maps function symbols to functions: D -> D, and a function that maps predicate symbols to predicates: D -> Booleans. A s x y odd Example: Booleans true false “even” D = N 1 2 3

Assigning truth values: 1. To ground atomic formulas: form: p(f(a), g(a,b)) Example: I( odd( s ( s( 0 ) ) ) ) ) = ? = I (odd) ( I(s) ( I(s) ( I(0) ) ) ) = “even” ( succ ( succ ( 0 ) ) ) = “even” ( succ ( 1 ) ) = “even” ( 2 ) = true

Assigning truth values (2): 2. For closed well-formed formulas: (= no non-quantified variables) x F(x) is true if: for all d D: I( F(d) ) = true  x F(x) is true if: there exists d D such that: I( F(d) ) = true further: use the truth tables. I(x odd( s ( x ) )  odd(x) ) = ? = true if for all d in N: I (odd( s (d) )  odd(d) ) = true Example: = “even” ( succ(d) )  “even” (d) Assume: d = 0, then: = false  true Truth tables: false !

Semantics / Logical entailment: Exactly as in propositional logic ! Given a set of formulas S: a model is an interpretation that makes all formulas in S true. Given a set of formulas S and a formula F: F is logically entailed by S ( S |= F ), if all models of S also make F true. Additional: inconsistency: Given a set of formulas S: S is inconsistent if S has no models. Example: S = { p(a), ~p(a)}

Marcus example: A x y V Marcus Caesar C F =  ruler person man P Boolean true false “was_ruler” try_assassinate Pompeian Roman “was_pompeian” Boolean true false hates loyal_to “Intended” interpretation: D = world of ~40 VC. “Marcus” “Caesar” Is a model IF ALL FORMULAS ARE CORRECT

Marcus example: A x y V Marcus Caesar C F =  man person ruler Roman Pompeian hates loyal_to try_assassinate P N 4 3 I(man) = I(person)= I(Roman) = “natural number” I(try_assassinate) = “ > ” I(Pompeian) = “even number” I(loyal_to) = “divides” I(ruler) = “prime number” I(hates) = “doesn’t divide”

Model ?? YES ! 1. Marcus was a man. 4 is a natural number 2. Marcus was Pompeian. 4 is an even number 4. Caesar was a ruler. 3 is a prime number 8. Marcus tried to assassinate Caesar. 4 > 3 3. All Pompeians were Romans. Even numbers are naturals. 5. All Romans were either loyal to Caesar or hated him. A number either divides 3 or doesn’t divide 3. 6. Everybody is loyal to somebody. Each number is a divisor of some number. 7. People try to assassinate only those rulers to whom they are not loyal. A natural number that is greater than a prime number doesn’t divide the prime number.

“Logic is all form, no content” person(x)  mortal(x) person(Socrates) mortal(Socrates) January(x)  cold(x) January(21/1/01) cold(21/1/01) P(x)  Q(x) P(A) Q(A) Only the underlying structure of a set of logical formulas is important for the conclusions! (up to the names isomorphism) But from the knowledge representation perspective also the ‘contents’ is important.

Relation with respect to other courses:

Logic as a foundation for AI A much deeper and more formal study of Logic for Knowledge Representation and Reasoning !

Programming Languages and Programming Methodologies Logic-based programming languages (Prolog/CLP)

Selected Topics in Logic Programming Formal studies of semantics and formal methods (analysis, termination) of logic-based programming languages (also beyond Prolog)

Fundamentals of Artificial Intelligence First Order predicate Logic Formal semantics and analysis Logic-based programming languages (Prolog/CLP) Techniques for automated reasoning Problem-representation in logic Mostly in the exercises

Methodology for knowledge representation? Very complicated. Not many simple guidelines. Basis: Choose an alphabet that allows us to represent all objects and all relations from the problem domain: What are the basic objects, functions and relations in your problem domain ? Ontology: represent only the RELEVANT information Choose constants, function and predicate symbols to represent them. Translate every sentence in a natural language in one or more corresponding logical formulas.

Summary

Syntax of Predicate Calculus Universe - The domain of discourse, D, corresponding to the set of objects represented by logical variables. Terms - Variables are terms and f(T) is a term, where f is a function and T is a sequence of n terms. Atomic formula - P(T) is an atomic formula, where P is a predicate and T is a sequence of n terms. Literals - Atomic formulas and negated atomic formulas.

Syntax of Predicate Calculus Well-formed formulas (wffs) - Literals are wffs and wffs connected or quantified by logic symbols are also wffs. Sentence - A wff in which all variables are within the scope of corresponding quantifiers. Clause - A wff consisting of a literal or a disjunction of literals (literals connected by ORs).

Syntax of Predicate Calculus A system in first-order predicate calculus consists of a set of sentences S which represent a physical system. The system builder has complete freedom in selecting predicates and building expressions to represent the problem s/he is trying to solve.

Proposition โธมัส อัลวา เอดิสัน อัจฉริยะนั้น 99% เกิดจากความพากเพียร 1% ขึ้นอยู่ กับมันสมอง ความสำเร็จ 10% เกิดจากแรงบันดาลใจ 90% มา จากความทุ่มเทด้วยหยาดเหงื่อ