UNIVERSITI TENAGA NASIONAL 1 CSNB234 ARTIFICIAL INTELLIGENCE Chapter 3 Propositional Logic & Predicate Logic Chapter 3 Propositional Logic & Predicate.

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

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.
Introduction to Theorem Proving
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.
Resolution
Predicates and Quantifiers
Logic Concepts Lecture Module 11.
F22H1 Logic and Proof Week 7 Clausal Form and Resolution.
Goals Determine the true value of statements with AND, OR, IF..THEN. Negate statements with the connectives above Construct truth tables Understand when.
Automated reasoning and theorem proving Introduction: logic in AI Automated reasoning: ResolutionUnificationNormalization.
Using Predicate Logic Chapter 5.
Outline Recap Knowledge Representation I Textbook: Chapters 6, 7, 9 and 10.
CMSC 250 Discrete Structures Exam #1 Review. 21 June 2007Exam #1 Review2 Symbols & Definitions for Compound Statements pq p  qp  qp  qp  qp  q 11.
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.
Predicates and Quantifiers
UBI517 Expert Systems 1 Lecture 2 Knowledge Representation.
The Foundations: Logic and Proofs
Automated reasoning and theorem proving Introduction: logic in AI Automated reasoning: ResolutionUnificationNormalization.
SAT-solving Introduction: logic in AI SAT-solving techniques: Unit-propagationLocal-search.
Review I Rosen , 3.1 Know your definitions!
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.
Chapter 5 – Logic CSNB 143 Discrete Mathematical Structures.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
Logical Representations and Resolution. Boolean Logic Conjunctive normal form Resolution.
CSNB143 – Discrete Structure LOGIC. Learning Outcomes Student should be able to know what is it means by statement. Students should be able to identify.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
ARTIFICIAL INTELLIGENCE [INTELLIGENT AGENTS PARADIGM] Professor Janis Grundspenkis Riga Technical University Faculty of Computer Science and Information.
Automated Reasoning Early AI explored how to automated several reasoning tasks – these were solved by what we might call weak problem solving methods as.
CS6133 Software Specification and Verification
Chapter 2 Logic 2.1 Statements 2.2 The Negation of a Statement 2.3 The Disjunction and Conjunction of Statements 2.4 The Implication 2.5 More on Implications.
Propositional & Predicate Calculus _I
CSNB143 – Discrete Structure Topic 4 – Logic. Learning Outcomes Students should be able to define statement. Students should be able to identify connectives.
11 Artificial Intelligence CS 165A Thursday, October 25, 2007  Knowledge and reasoning (Ch 7) Propositional logic 1.
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
Symbolic Logic The Following slide were written using materials from the Book: The Following slide were written using materials from the Book: Discrete.
ARTIFICIAL INTELLIGENCE Lecture 2 Propositional Calculus.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
Invitation to Critical Thinking Chapter 7 Lecture Notes Chapter 7.
Outline Logic Propositional Logic Well formed formula Truth table
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
1 Chapter 2.1 Chapter 2.2 Chapter 2.3 Chapter 2.4 All images are copyrighted to their respective copyright holders and reproduced here for academic purposes.
Mathematics for Comter I Lecture 3: Logic (2) Propositional Equivalences Predicates and Quantifiers.
Lecture 041 Predicate Calculus Learning outcomes Students are able to: 1. Evaluate predicate 2. Translate predicate into human language and vice versa.
Foundations of Discrete Mathematics Chapter 1 By Dr. Dalia M. Gil, Ph.D.
Discrete Mathematical Structures: Theory and Applications 1 Logic: Learning Objectives  Learn about statements (propositions)  Learn how to use logical.
Chapter 3 Propositional calculus Predicate calculus Artificial Intelligence Dr.Hassan Al-Tarawneh.
Propositional Logic. Assignment Write any five rules each from two games which you like by using propositional logic notations.
Chapter 1. Chapter Summary  Propositional Logic  The Language of Propositions (1.1)  Logical Equivalences (1.3)  Predicate Logic  The Language of.
Chapter 1 Logic and proofs
Chapter 7. Propositional and Predicate Logic
2. The Logic of Compound Statements Summary
CSNB 143 Discrete Mathematical Structures
Knowledge Representation and Reasoning
Proposition & Predicates
Predicate Logic Lecture 7.
Chapter 7. Propositional and Predicate Logic
CSNB234 ARTIFICIAL INTELLIGENCE
Predicates and Quantifiers
CSNB234 ARTIFICIAL INTELLIGENCE
Foundations of Discrete Mathematics
Logical and Rule-Based Reasoning Part I
The Foundations: Logic and Proofs
Presentation transcript:

UNIVERSITI TENAGA NASIONAL 1 CSNB234 ARTIFICIAL INTELLIGENCE Chapter 3 Propositional Logic & Predicate Logic Chapter 3 Propositional Logic & Predicate Logic Instructor: Alicia Tang Y. C. (Chapter 2, pp , Textbook) (Chapter 8, pp , Ref. #3) Read online supplementary slides

UNIVERSITI TENAGA NASIONAL 2 Early Development of Symbolic Logic English mathematician DeMorgan criticised traditional logic because it was written in natural language. He thought that the formal meaning of a syllogistic statement was confused by the semantics of natural language. DeMorgan and Boole both contributed to the development of Propositional Logic (or Propositional Calculus). Using familiar algebraic symbols, they showed how certain algebraic rules were equally applicable to numbers, set and truth values of propositions.

UNIVERSITI TENAGA NASIONAL 3 Propositional Logic(I)  Definition –Propositional Logic Sentences Every propositional symbol and truth symbol is a sentence. –For example: true, P, Q, and R are four sentences The negation of a sentence is a sentence –For example:  P and  false are sentences The conjunction (and) of two sentences is a sentence –For example: P  P is a sentence

UNIVERSITI TENAGA NASIONAL 4 Propositional Logic (II)  Propositional Logic Sentences The disjunction (or) of two sentence s is a sentence –For example: P   P is a sentence The implication of one sentence for another is a sentence –For example: P  Q is a sentence The equivalence of two sentences is a sentence –for example: P  Q = R is a sentence

UNIVERSITI TENAGA NASIONAL 5  Propositional Logic Semantics –An interpretation of a set of propositions is the assignment of a truth value, either T of F, to each propositional symbol. –The interpretation or truth value for sentences is determined by: The truth assignment of negation,  P, where P is any propositional symbol, is F if the assignment to P is T and T if the assignment to P is F. The truth assignment of conjunction, , is T only when both conjuncts have truth value T; otherwise it is F. Propositional Logic (III)

UNIVERSITI TENAGA NASIONAL 6  Propositional Calculus Semantics –The truth assignment of disjunction, , is F only when both conjuncts have truth value F; otherwise it is T. –The truth assignment of implication, , is F only when the premise or symbol before the implication is T and the truth value of the consequent or symbol after the implication is F; otherwise it is always T. –The truth assignment of equivalence, =, is T only when both expressions have the same truth assignment for all possible interpretations; otherwise it is F. Propositional Logic (IV)

UNIVERSITI TENAGA NASIONAL 7  Prove that ((P  Q  R) =  P   Q  R is a well-formed sentence in the propositional calculus.  Answer. Since: –P, Q and R are propositions and thus sentences –P  Q, the conjunction of two sentences, is a sentence –(P  Q)  R, the implication of a sentence for another, is a sentence A Worked Example

UNIVERSITI TENAGA NASIONAL 8 P, Q and R are propositions and thus sentences  P and  Q, the negation of two sentences, are sentences  P   Q, the disjunction of two sentences, is a sentence  P   Q  R, the disjunction of two sentences, is a sentence ((P  Q)  R) =  P   Q  R, the equivalence of two sentences, is a sentence A Worked Example..cont We get back the original sentence

UNIVERSITI TENAGA NASIONAL 9 Conclusion for the worked example The above is our original sentence, which has been constructed through a series of applications of legal rules and is therefore well-formed.

UNIVERSITI TENAGA NASIONAL 10 Constant & Compound Sentences in Propositional Logic  Constants refer to atomic propositions. raining snowing eating hungry wet  Compound sentences capture relationships among propositions.  raining  snowing  wet

UNIVERSITI TENAGA NASIONAL 11 Compound Sentences  Negations: ¬ raining  The argument of a negation is called the target.  Conjunctions: (raining  snowing )  The arguments of a conjunction are called conjuncts.  Disjunctions: (raining  snowing )  The arguments of a disjunction are called disjuncts.

UNIVERSITI TENAGA NASIONAL 12 Compound Sentences  Implications: (raining  cloudy ) –The left argument of an implication is the antecedent. –The right argument of an implication is called the consequent.  Reductions: cloudy  raining –The left argument of a reduction is the consequent. –The right argument of a reduction is called the antecedent.  Equivalences: raining  cloudy

UNIVERSITI TENAGA NASIONAL 13  x  y = y  x Commutativity  x  y = y  x  x  (y  z) = (x  y)  z Associativity  x  (y  z) = (x  y)  z  x  (y  z) = (x  y)  (x  z) Distributivity  x  (y  z) = (x  y)  (x  z) Rules of Algebraic Manipulation Some Laws for Logic Use

UNIVERSITI TENAGA NASIONAL 14 Semantics of Logical Operators  Negation:  Conjunction: P  P T F FT PQP  Q TT T T F F FT F FF F

UNIVERSITI TENAGA NASIONAL 15 Semantics of Logical Operators  Disjunction: PQP  Q TT T T F T FT T FF F

UNIVERSITI TENAGA NASIONAL 16 More Semantics of Logical Operators Implication: Reverse Implication: Equivalence: PQP  Q TT T T F F FT T FF T PQQ  P TT T T F T FT F FF T PQQ  P TT T T F F FT F FF T

UNIVERSITI TENAGA NASIONAL 17 Satisfaction An interpretation i satisfies a sentence φ (written |= i φ ) if and only if φ i =T. A sentence is satisfiable if and only if there is some interpretation that satisfies it. A sentence is valid if and only if every interpretation satisfies it. A sentence is unsatisfiable if and only if there is no interpretation that satisfies it.

UNIVERSITI TENAGA NASIONAL 18 Truth Tables A truth table is a table of all possible values for a set of propositional constants. pqrpqr T TT TTFTTF T FT TFFTFF FTTFTT FTFFTF FFTFFT FFFFFF Each interpretation of a language is a row in the truth table for that language. For a propositional language with n logical constants,there are 2 n interpretations.

UNIVERSITI TENAGA NASIONAL 19 Logical Equivalence Two sentences are logically equivalent if and only if they logically entail each other. Examples: ¬(¬p)p ¬(p  q ) ¬p  ¬q de Morgan’s law ¬(p  q ) ¬p  ¬q de Morgan’s law (p  q ) ¬p  q

UNIVERSITI TENAGA NASIONAL 20 Problems  There can be many, many interpretations for a propositional language.  Remember that, for a language with n constants, there are 2 n possible interpretations.  Sometimes there are many constants among premises that are irrelevant to the conclusion Much work wasted. Solution: use other kind of proof theory, such as refutation proof (later part)

UNIVERSITI TENAGA NASIONAL 21  The interpretation of any expression in propostional logic can be specified in a truth table. An example of a truth table is shown here: Truth Tables

UNIVERSITI TENAGA NASIONAL 22 Example of validity: Problem to solve Problem: (p  q)  (q  r)? Solution: p q r (p  q) (q  r) (p  q )  (q  r ) T T T TTT T T FTFT T F TFTT T F FFTT F T TTTT F T FTFT F F TTTT F F FTTT All values are “true” It is a valid sentence!

UNIVERSITI TENAGA NASIONAL 23 Clausal Form  Propositional resolution works only on expressions in clausal form.  Fortunately, it is possible to convert any set of propositional calculus sentences into an equivalent set of sentences in clausal form.

UNIVERSITI TENAGA NASIONAL 24 Conversion to Clausal Form Implications Out: P  Q  P  Q P  Q  P  Q P  Q  P  Q)  (P  Q ) Negations In:  P  P  (P  Q)  P   Q  (P  Q )  P  Q

UNIVERSITI TENAGA NASIONAL 25 Predicate Calculus (=Predicate Logic)

UNIVERSITI TENAGA NASIONAL 26 Predicate Calculus (I)  In Proposition Logic, each atomic symbol (P, Q, etc) denotes a proposition of some complexity. There is no way to access the components of an individual assertion. Through inference rules we can manipulate predicate calculus expressions, accessing their individual components and inferring new sentences.

UNIVERSITI TENAGA NASIONAL 27 Predicate Calculus (II)  In Predicate Calculus, there are two ways variables may be used or quantified. In the first, the sentence is true for all constants that can be substituted for the variable under the intended interpretation. The variable is said to be universal quantified. Variables may also be quantified existentially. In this case the expression containing the variable is said to be true for at least one substitution from the domain of definition. Several relationships between negation and the universal and existential quantifiers are given below:

UNIVERSITI TENAGA NASIONAL 28  Predicate calculus sentences –Every atomic sentence is a sentence if s is a sentence, then so is its negation,  s if s1 and s2 are sentences, then so is their conjunction, s1  s2 if s1 and s2 are sentences, then so is their disjunction, s1  s2 if s1 and s2 are sentences, then so is their implication, s1  s2 if s1 and s2 are sentences, then so is their equivalence, s1 = s2 Predicate Calculus (III)

UNIVERSITI TENAGA NASIONAL 29  If X is a variable and s is a sentence, then X s is a sentence  If X is a variable and s is a sentence, then X s is a sentence Predicate Calculus (IV)

UNIVERSITI TENAGA NASIONAL 30 English sentences represented in Predicate Calculus:  Some people like fried chicken.   X (people(X)  likes(X, fried_chicken)).  Nobody likes income taxes.   X likes(X, income_taxes).   X  likes(X, income_taxes).

UNIVERSITI TENAGA NASIONAL 31 Rule: All purple mushrooms are poisonous.  X (purple(X)  mushroom(X)  poisonous(X)) Fact: Tom loves Jerry. loves(tom, Jerry).

UNIVERSITI TENAGA NASIONAL 32 Quiz: Translate the following English Statements into Predicate Expressions All people that are not poor and are intelligent are happy. Students who like to read books are not stupid. Batman is knowledgeable and he is wealthy. Tweety can fly if it is not fried and has wings.

UNIVERSITI TENAGA NASIONAL 33 Exercise #1 Everybody likes something. There is something whom everybody likes.

UNIVERSITI TENAGA NASIONAL 34 Answers to Exercise #1  Everybody likes something.   x.  y. likes(x,y)  There is something whom everybody likes.   y.  x. likes(x,y)

UNIVERSITI TENAGA NASIONAL 35 Exercise #2   X p(X) =  X  p(X)  Y q(Y) =  Y  q(Y) For predicates p & q, and variables X and Y: Write the following in English

UNIVERSITI TENAGA NASIONAL 36 Answers to Exercise #2

UNIVERSITI TENAGA NASIONAL 37 Quiz: Convert each of the following predicate logic to English sentences   X loves(X, superman)  loves(superman, X)  food(laksa)   X food(X)  like(arul, X)   X  Y eat(X, Y)  alive(X)  food(Y)   X eat(haswan, X)  eat(hasman, X)

UNIVERSITI TENAGA NASIONAL 38 Stages involved in Proof Theory  Stage 1 –convert all axioms into prenex form i.e. all quantifiers are at the front  Stage 2 –purge existential quantifiers –this process is known as skolemization  Stage 3 –drop universal quantifiers as they convey no information

UNIVERSITI TENAGA NASIONAL 39 An Example Consider the argument: All men are mortal ( given premise ) Superman is a man( given premise ) Superman is mortal (goal to test) The argument gets formalised as:  X man(X)  mortal(X) man(Superman) mortal(Superman) (goal) And has, as its conflict set in Clausal form:  man(X)  mortal(X)---- (1) man(Superman)---- (2)  mortal(Superman)---- (3) Negation of goal

UNIVERSITI TENAGA NASIONAL 40 Apply resolution to derive at a contradiction: We get:  man(Superman) from (1) & (3) and, direct contradictionfrom (2) & (4) The conclusion is that “the goal is true” ( i.e. superman is mortal)

UNIVERSITI TENAGA NASIONAL 41 Exercise #3  Convert each of the following into Predicate Calculus equivalence: –Marcus was a man –Marcus was a Pompeian –All Pompeians were Romans –Caesar was a ruler –All Romans were either loyal to Caesar or hated him –Everyone is loyal to someone –people only try to assassinate rulers they are not loyal to –Marcus tried to assassinate Caesar

UNIVERSITI TENAGA NASIONAL 42 Predicate logic for the 8 facts in Exercise #3 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) 6.  X.  Y. loyalto(X,Y) 7.  X.  Y. person(X)  ruler(Y)  tryassassinate(X,Y)   loyalto(X,Y) 8.tryassasinate(Marcus, Caesar) 9.  X. man(X)  person(X)

UNIVERSITI TENAGA NASIONAL 43 Answers to Exercise #3  loyato(Marcus, Caesar) (using 7, substitution, & apply M.P) person(Marcus)  tryassassinate(Marcus, Caesar)  ruler(Caesar) using (4) person(Marcus)  tryassassinate(Marcus, Caesar) using (8) person(Marcus) (using 9, substitution & apply M.P) man(Marcus) using (1) nil