CSNB234 ARTIFICIAL INTELLIGENCE

Slides:



Advertisements
Similar presentations
Artificial Intelligence
Advertisements

The Foundations: Logic and Proofs
Knowledge & Reasoning Logical Reasoning: to have a computer automatically perform deduction or prove theorems Knowledge Representations: modern ways of.
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.
Logic Use mathematical deduction to derive new knowledge.
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.
Knowledge Representation Methods
From Chapter 4 Formal Specification using Z David Lightfoot
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.
Mathematical Structures A collection of objects with operations defined on them and the accompanying properties form a mathematical structure or system.
UNIVERSITI TENAGA NASIONAL 1 CSNB234 ARTIFICIAL INTELLIGENCE Chapter 3 Propositional Logic & Predicate Logic Chapter 3 Propositional Logic & Predicate.
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 1 Logic Section 1-1 Statements Open your book to page 1 and read the section titled “To the Student” Now turn to page 3 where we will read the.
Chapter 1, Part II: Predicate Logic With Question/Answer Animations.
1 Knowledge Representation. 2 Definitions Knowledge Base Knowledge Base A set of representations of facts about the world. A set of representations of.
Propositional Logic Dr. Rogelio Dávila Pérez Profesor-Investigador División de Posgrado Universidad Autónoma Guadalajara
Logical Representations and Resolution. Boolean Logic Conjunctive normal form Resolution.
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.
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.
Predicates and Quantifiers Dr. Yasir Ali. 1.Predicates 2.Quantifiers a.Universal Quantifiers b.Existential Quantifiers 3.Negation of Quantifiers 4.Universal.
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
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.
Instructor: Eyal Amir Grad TAs: Wen Pu, Yonatan Bisk Undergrad TAs: Sam Johnson, Nikhil Johri CS 440 / ECE 448 Introduction to Artificial Intelligence.
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.
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.
Knowledge Representation
Logic.
Chapter 7. Propositional and Predicate Logic
2. The Logic of Compound Statements Summary
CSNB 143 Discrete Mathematical Structures
Knowledge Representation and Reasoning
Methods of proof Section 1.6 & 1.7 Wednesday, June 20, 2018
Automated reasoning and theorem proving
A I (Artificial Intelligence)
Proposition & Predicates
Predicate Logic Lecture 7.
The Foundations: Logic and Proofs
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
Chapter 1 The Foundations: Logic and Proof, Sets, and Functions
CHAPTER 1: LOGICS AND PROOF
Propositional Equivalences
Artificial Intelligence
Back to “Serious” Topics…
Discrete Mathematics and Its Applications Kenneth H
Chapter 7. Propositional and Predicate Logic
CSNB234 ARTIFICIAL INTELLIGENCE
Predicates and Quantifiers
Foundations of Discrete Mathematics
Propositional Calculus
CS201: Data Structures and Discrete Mathematics I
Logic Logic is a discipline that studies the principles and methods used to construct valid arguments. An argument is a related sequence of statements.
Teorie assiomatico-deduttive (calcolo dei predicati)
Logical and Rule-Based Reasoning Part I
The Foundations: Logic and Proofs
Habib Ullah qamar Mscs(se)
Presentation transcript:

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

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

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

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

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. UNIVERSITI TENAGA NASIONAL

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. UNIVERSITI TENAGA NASIONAL

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 UNIVERSITI TENAGA NASIONAL

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 We get back the original sentence UNIVERSITI TENAGA NASIONAL

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

Constants refer to atomic propositions. raining snowing eating hungry wet Compound sentences capture relationships among propositions. raining  snowing  wet UNIVERSITI TENAGA NASIONAL

The argument of a negation is called the target . 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

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

Rules of Algebraic Manipulation Some Laws for Logic Use 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) UNIVERSITI TENAGA NASIONAL

Semantics of Logical Operators Negation: Conjunction: P P T F F T P Q P  Q T T T T F F F T F F F F UNIVERSITI TENAGA NASIONAL

Semantics of Logical Operators Disjunction: P Q P  Q T T T T F T F T T F F F UNIVERSITI TENAGA NASIONAL

More Semantics of Logical Operators Implication: Reverse Implication: Equivalence: P Q P  Q T T T T F F F T T F F T P Q Q  P T T T T F T F T F F F T P Q Q  P T T T T F F F T F F F T UNIVERSITI TENAGA NASIONAL

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

Truth Tables A truth table is a table of all possible values for a set of propositional constants. p q r T T T T T F T F T T F F F T T F T F F F T F F F 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

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

Problems There can be many, many interpretations for a propositional language. Remember that, for a language with n constants, there are 2n 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

Example of validity: Problem to solve Problem: what sentence is this (p  q) (q  r)? Solution: p q r (p  q) (q  r) (p q )  (q  r ) T T T T T T T T F T F T T F T F T T T F F F T T F T T T T T F T F T F T F F T T T T F F F T T T It is a valid sentence! All values are “true” UNIVERSITI TENAGA NASIONAL

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

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

Predicate Calculus (=Predicate Logic) UNIVERSITI TENAGA NASIONAL

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

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

Predicate Calculus (III) 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 UNIVERSITI TENAGA NASIONAL

Predicate Calculus (IV) 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 UNIVERSITI TENAGA NASIONAL

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

All students passed examination. X (student(X)  pass_exam(X)) Rules: All students passed examination. X (student(X)  pass_exam(X)) All purple mushrooms are poisonous. X (purple(X)  mushroom(X)  poisonous(X)) Facts: Tom loves Jerry. loves(tom, Jerry). Ali is a student. student(ali). UNIVERSITI TENAGA NASIONAL

Batman is knowledgeable and he is wealthy. Exercise #1: Translate The Following English Statements Into Predicate Expressions Batman is knowledgeable and he is wealthy. All people that are not poor are happy. Students who like to read books are intelligent. Tweety can fly if it is not fried and has wings. UNIVERSITI TENAGA NASIONAL

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

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

Exercise #3   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   X p(X) =  X  p(X)  Y q(Y) =  Y  q(Y) UNIVERSITI TENAGA NASIONAL

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

Exercise #5 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

Predicate logic for the 8 facts in Exercise #5 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

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

person(Marcus)  tryassassinate(Marcus, Caesar)  ruler(Caesar) 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

Towards the Resolution and Refutation Proof UNIVERSITI TENAGA NASIONAL

Stages involved in Proof Theory 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

An Example Consider the arguments: 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

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