-propositional logic
Syntax, semantics, inferences and reasoning patterns
-predicate logic
Syntax, semantics, instance and its relationships
-Unification and Resolution
Prepared by
T.ARCHANA, AP/CSE
LOGIC
WHAT IS A LOGIC?
• A language with concrete rules
• No ambiguity in representation (may be other errors!)
• Allows unambiguous communication and processing
PROPOSITIONAL LOGIC
• In propositional logic, the most fundamental propositions are called primitive propositions.
• Primitive propositions cannot be decomposed. Propositions that can be decomposed are
compound propositions
• Primitive propositions can be denoted by some symbols, and these symbols are called
atomic formulas.
• From atomic formulas we can construct various logic formulas corresponding to various
compound propositions.
PROPOSITION : SYMBOL
• Daisuke is a Japanese: P1
• Chieko is a Japanese: P2 •
• Daisuke and Chieko are husband and wife: P3 •
• Makoto is the child of Chieko: P4 •
• If Chieko is a Japanese AND Mokoto is the child of Chieko, THEN Mokoto is a Japanese:
P2∧P4⇒ P5
• If Daisuke and Chieko are husband and wife AND Makoto is the child of Chieko, THEN
Mokoto is the child of Daisuke: P3∧P4⇒ P6
• An atomic formula is a logic formula.
• If P is a logic formula, ¬P is also a logic formula.
• If P and Q are logic formulas, P∧Q, P∨Q, P ⇒ Q, and P⇔Q are also logic formulas.
• Logic formulas defined in the previous page are called well-formed formulas.
• Similar to operators used in arithmetic calculation, logic symbols also have priorities.
• We can also use parentheses to define the priorities if the formula is ambiguous.
LOGIC SYMBOLS AND THEIR PRIORITIES
PROPOSITIONAL LOGIC CONNECTIVES
TRUTH TABLES
Logic in Predicate and Propositional Logic
PROPERTIES OF OPERATORS
PREDICATE LOGIC
• Propositional logic combines atoms
• An atom contains no propositional connectives
• Have no structure (today_is_wet, john_likes_apples)
• Predicates allow us to talk about objects
• Properties: is_wet(today)
• Relations: likes(john, apples)
• True or false
• In predicate logic each atom is a predicate
• e.g. first order logic, higher-order logic
BASIC ELEMENTS OF FIRST-ORDER
LOGIC:
Constant 1, 2, A, John, Mumbai, cat,....
Variables x, y, z, a, b,....
Predicates Brother, Father, >,....
Function sqrt, LeftLegOf, ....
Connectives ∧, ∨, ¬, ⇒, ⇔
Equality ==
Quantifier ∀, ∃
ATOMIC SENTENCES:
• Atomic sentences are the most basic sentences of first-order logic. These
sentences are formed from a predicate symbol followed by a parenthesis
with a sequence of terms.
• We can represent atomic sentences as Predicate (term1, term2, ......,
term n).
• Example: Ravi and Ajay are brothers: => Brothers(Ravi, Ajay).
Chinky is a cat: => cat (Chinky).
COMPLEX SENTENCES:
• Complex sentences are made by combining atomic sentences using
connectives.
• First-order logic statements can be divided into two parts:
• Subject: Subject is the main part of the statement.
• Predicate: A predicate can be defined as a relation, which binds two
atoms together in a statement.
• Consider the statement: "x is an integer.", it consists of two parts, the
first part x is the subject of the statement and second part "is an integer,"
is known as a predicate.
QUANTIFIERS IN FIRST-ORDER LOGIC
• A quantifier is a language element which generates quantification, and
quantification specifies the quantity of specimen in the universe of
discourse.
• These are the symbols that permit to determine or identify the range and
scope of the variable in the logical expression. There are two types of
quantifier:
• Universal Quantifier, (for all, everyone, everything)
• Existential quantifier, (for some, at least one).
UNIVERSAL QUANTIFIER
• Universal quantifier is a symbol of logical representation, which specifies
that the statement within its range is true for everything or every instance
of a particular thing.
• The Universal quantifier is represented by a symbol ∀, which resembles
an inverted A.
• If x is a variable, then ∀x is read as:
• For all x
• For each x
• For every x.
• Example:
• All man drink coffee.
• ∀x man(x) → drink (x, coffee).
• It will be read as: There are all x where x is a man who drink coffee.
EXISTENTIAL QUANTIFIER
• Existential quantifiers are the type of quantifiers, which express that the
statement within its scope is true for at least one instance of something.
• It is denoted by the logical operator ∃, which resembles as inverted E.
When it is used with a predicate variable then it is called as an existential
quantifier.
• If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be
read as:
• There exists a 'x.'
• For some 'x.'
• For at least one 'x.'
• Example:
• Some boys are intelligent.
• ∃x: boys(x) ∧ intelligent(x)
• It will be read as: There are some x where x is a boy who is intelligent.
• Points to remember:
• The main connective for universal quantifier ∀ is implication →.
• The main connective for existential quantifier ∃ is and ∧.
• Properties of Quantifiers:
• In universal quantifier, ∀x∀y is similar to ∀y∀x.
• In Existential quantifier, ∃x∃y is similar to ∃y∃x.
• ∃x∀y is not similar to ∀y∃x.
SOME EXAMPLES OF FOL USING
QUANTIFIER:
• 1. All birds fly.
• 2. Every man respects his parent.
• 3. Some boys play cricket.
• 4. Not all students like both Mathematics and Science.
• 5. Only one student failed in Mathematics.
• 1. All birds fly.
• ∀x bird(x) →fly(x).
• 2. Every man respects his parent.
• ∀x man(x) → respects (x, parent).
• 3. Some boys play cricket.
• ∃x boys(x) → play(x, cricket).
• 4. Not all students like both Mathematics and Science.
• ¬∀ (x) [ student(x) → like(x, Mathematics) ∧ like(x, Science)].
• 5. Only one student failed in Mathematics.
• ∃(x) [ student(x) → failed (x, Mathematics) ∧∀ (y) [¬(x==y) ∧ student(y)
→ ¬failed (x, Mathematics)].
FIRST ORDER LOGIC
• More expressive logic than propositional
• Constants are objects: john, apples
• Predicates are properties and relations:
• likes(john, apples)
• Functions transform objects:
• likes(john, fruit_of(apple_tree))
• Variables represent any object: likes(X, apples)
• Quantifiers qualify values of variables
• True for all objects (Universal): ∀X. likes(X, apples)
• Exists at least one object (Existential): ∃X. likes(X, apples)
EXAMPLE: FOL SENTENCE
• “Every rose has a thorn”
• For all X
• if (X is a rose)
• then there exists Y
• (X has Y) and (Y is a thorn)
EXAMPLE: FOL SENTENCE
• “On Mondays and Wednesdays I go to John’s house for dinner”
IMPLICATION ELIMINATION
• A particularly important rule allows you to
get rid of the implication operator, ⇒ :
• X ⇒ Y ≡ ¬X ∨ Y
• We will use this later on as a necessary
tool for simplifying logical expressions
• The symbol ≡ means “is logically
equivalent to”
CONJUNCTION ELIMINATION
• Another important rule for simplifying logical
expressions allows you to get rid of the conjunction
(and) operator, ∧ :
• This rule simply says that if you have an and
operator at the top level of a fact (logical
expression), you can break the expression up into
two separate facts:
• MaryIsFemale ∧ MaryIsRich
• becomes:
• MaryIsFemale
• MaryIsRich
FORWARD AND BACKWARD REASONING
• Situation: You have a collection of logical expressions
(premises), and you are trying to prove some
additional logical expression (the conclusion)
• You can:
• Do forward reasoning: Start applying inference
rules to the logical expressions you have, and stop
if one of your results is the conclusion you want
• Do backward reasoning: Start from the conclusion
you want, and try to choose inference rules that
will get you back to the logical expressions you
have
EXAMPLE
• Given:
• it_is_raining ∨ it_is_sunny
• it_is_sunny ⇒ I_stay_dry
• it_is_raining ⇒ I_take_umbrella
• I_take_umbrella ⇒ I_stay_dry
• You can conclude:
• it_is_sunny ∨ it_is_raining
• I_take_umbrella ∨ it_is_sunny
• I_stay_dry ⇒ I_take_umbrella
UNIFICATION
• Unification is a process of making two different logical atomic expressions identical by finding a
substitution. Unification depends on the substitution process.
• It takes two literals as input and makes them identical using substitution.
• Let Ψ1 and Ψ2 be two atomic sentences and 𝜎 be a unifier such that, Ψ1𝜎 = Ψ2𝜎, then it can be
expressed as UNIFY(Ψ1, Ψ2).
• Example: Find the MGU for Unify{King(x), King(John)}
• Let Ψ1 = King(x), Ψ2 = King(John),
• Substitution θ = {John/x} is a unifier for these atoms and applying this substitution, and both
expressions will be identical.
• The UNIFY algorithm is used for unification, which takes two atomic sentences and returns a
unifier for those sentences (If any exist).
• Unification is a key component of all first-order inference algorithms.
• It returns fail if the expressions do not match with each other.
• The substitution variables are called Most General Unifier or MGU.
CONDITIONS FOR UNIFICATION:
• Following are some basic conditions for unification:
• Predicate symbol must be same, atoms or expression with different predicate symbol can
never be unified.
• Number of Arguments in both expressions must be identical.
• Unification will fail if there are two similar variables present in the same expression.
IMPLEMENTATION OF THE ALGORITHM
• Step.1: Initialize the substitution set to be empty.
• Step.2: Recursively unify atomic sentences:
• Check for Identical expression match.
• If one expression is a variable vi, and the other is a term ti which does not contain variable
vi, then:
• Substitute ti / vi in the existing substitutions
• Add ti /vi to the substitution setlist.
• If both the expressions are functions, then function name must be similar, and the
number of arguments must be the same in both the expression.
EXAMPLE
• From the pair of facts (not yet clauses, just facts):
• seafood(X) ⇒ likes(John, X) (where X is a variable)
• seafood(shrimp)
• We ought to be able to conclude
• likes(John, shrimp)
• We can do this by unifying the variable X with the constant shrimp
• This is the same “unification” as is done in Prolog
• This unification turns seafood(X) ⇒ likes(John, X) into seafood(shrimp) ⇒
likes(John, shrimp)
• Unification is a “pattern-matching” procedure
• Takes two atomic sentences, called literals, as input
• Returns “Failure” if they do not match and a substitution list, θ, if they do
• That is, unify(p,q) = θ means subst(θ, p) = subst(θ, q) for two atomic sentences, p
and q
• θ is called the most general unifier (mgu)
RESOLUTION
• Resolution is a theorem proving technique
that proceeds by building refutation proofs,
i.e., proofs by contradictions. It was
invented by a Mathematician John Alan
Robinson in the year 1965.
STEPS FOR RESOLUTION:
• Conversion of facts into first-order logic.
• Convert FOL statements into
CNF(conjunctive normal form)
• Negate the statement which needs to prove
(proof by contradiction)
• Draw resolution graph (unification).
EXAMPLE:
• John likes all kind of food.
• Apple and vegetable are food
• Anything anyone eats and not killed is food.
• Anil eats peanuts and still alive
• Harry eats everything that Anil eats.
Prove by resolution that:
• John likes peanuts.
STEP-1: CONVERSION OF FACTS INTO FOL
• In the first step we will convert all the given statements into its first order logic.
STEP-2: CONVERSION OF FOL INTO CNF
• Eliminate all implication (→) and rewrite
• Move negation (¬)inwards and rewrite
• Rename variables or standardize variables
• Eliminate existential instantiation quantifier by elimination.
• Drop Universal quantifiers.
• Distribute conjunction ∧ over disjunction ¬.
Logic in Predicate and Propositional Logic
STEP-3: NEGATE THE STATEMENT TO BE
PROVED
• In this statement, we will apply negation to the
conclusion statements, which will be written as
¬likes(John, Peanuts)
STEP-4: DRAW RESOLUTION GRAPH:
PRACTICE EXAMPLE
• Jack owns a dog. Every dog owner is an animal lover. No animal lover kills
an animal. Either Jack or Curiosity killed the cat, who is named Tuna. Did
Curiosity kill the cat?
These can be represented as follows:
• A. (∃x) Dog(x) ∧ Owns(Jack,x)
• B. (∀x) ((∃y) Dog(y) ∧ Owns(x, y)) → AnimalLover(x)
• C. (∀x) AnimalLover(x) → ((∀y) Animal(y) → ¬Kills(x,y))
• D. Kills(Jack,Tuna) ∨ Kills(Curiosity,Tuna)
• E. Cat(Tuna)
• F. (∀x) Cat(x) → Animal(x)
• G. Kills(Curiosity, Tuna)
Convert to clause form CNF
• A1. (Dog(D))
• A2. (Owns(Jack,D))
• B. (¬Dog(y), ¬Owns(x, y), AnimalLover(x))
• C. (¬AnimalLover(a), ¬Animal(b), ¬Kills(a,b))
• D. (Kills(Jack,Tuna), Kills(Curiosity,Tuna))
• E. Cat(Tuna)
• F. (¬Cat(z), Animal(z))
• Add the negation of query:
• G: (¬Kills(Curiosity, Tuna))
•
The resolution refutation proof
• R1: ¬G, D, {} (Kills(Jack, Tuna))
• R2: R1, C, {a/Jack, b/Tuna} (~AnimalLover(Jack), ~Animal(Tuna))
• R3: R2, B, {x/Jack} (~Dog(y), ~Owns(Jack, y), ~Animal(Tuna))
• R4: R3, A1, {y/D} (~Owns(Jack, D), ~Animal(Tuna))
• R5: R4, A2, {} (~Animal(Tuna))
• R6: R5, F, {z/Tuna} (~Cat(Tuna))
• R7: R6, E, {} FALSE
Logic in Predicate and Propositional Logic
• THANK YOU

More Related Content

PPTX
Numerical analysis ppt
PPTX
CMSC 56 | Lecture 8: Growth of Functions
PPT
Lu decomposition
PDF
Coal 10 instruction cycle and interrupts in Assembly Programming
PPT
Regular Languages
PPTX
Integral Calculus
PPTX
Group homomorphism
PPTX
Secant method
Numerical analysis ppt
CMSC 56 | Lecture 8: Growth of Functions
Lu decomposition
Coal 10 instruction cycle and interrupts in Assembly Programming
Regular Languages
Integral Calculus
Group homomorphism
Secant method

What's hot (20)

PPTX
Complex integration
PPTX
Prolog Programming Language
PPTX
#4 formal methods – predicate logic
PPTX
Power method
PPTX
2. Fixed Point Iteration.pptx
PDF
algebraic-geometry
PPTX
Section 11: Normal Subgroups
PPTX
Integral calculus
PPTX
Secant method
PPT
L5 infinite limits squeeze theorem
PPTX
Secant Method
PPTX
Engineering Numerical Analysis Lecture-1
PPT
Predicates and Quantifiers
PPT
introduction to Numerical Analysis
PPTX
PPTX
Introduction to Graph Theory
PPTX
System of linear equations
PPT
Linear algebra notes 1
PPT
Lecture 3,4
PPTX
Gauss Forward And Backward Central Difference Interpolation Formula
Complex integration
Prolog Programming Language
#4 formal methods – predicate logic
Power method
2. Fixed Point Iteration.pptx
algebraic-geometry
Section 11: Normal Subgroups
Integral calculus
Secant method
L5 infinite limits squeeze theorem
Secant Method
Engineering Numerical Analysis Lecture-1
Predicates and Quantifiers
introduction to Numerical Analysis
Introduction to Graph Theory
System of linear equations
Linear algebra notes 1
Lecture 3,4
Gauss Forward And Backward Central Difference Interpolation Formula
Ad

Similar to Logic in Predicate and Propositional Logic (20)

PPTX
Module_5_1.pptx
PPTX
Module4_AI 4th semester engineering.pptx
PDF
unit-3 First half..pdf nice ppt helps in ai intelligence
PDF
First order logic
PPTX
Basic Knowledge Representation and Reasonong
PPTX
First order predicate logic(fopl)
PPTX
First Order Logic
PPTX
Natural language processing: word senses and relations
PPTX
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
PPTX
continuity of module 2.pptx
DOCX
What is First Order Logic in AI or FOL in AI.docx
PPTX
Knowledge Representation and Reasoning.pptx
PDF
22PCOAM11_IAI_Unit III Notes Full Notesmerged.pdf
PPT
Propositional Logic and Pridicate logic
PPTX
Abdbfhdkmdmdjfmfkmfmfmfjjfjfjfnfnnfnfnfn
PDF
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
PPTX
Theory of first order logic
PDF
Chapter 01 - p2.pdf
PDF
Logic programming (1)
PPT
predicateLogic.ppt
Module_5_1.pptx
Module4_AI 4th semester engineering.pptx
unit-3 First half..pdf nice ppt helps in ai intelligence
First order logic
Basic Knowledge Representation and Reasonong
First order predicate logic(fopl)
First Order Logic
Natural language processing: word senses and relations
Artificial Intelligence (AI) | Prepositional logic (PL)and first order predic...
continuity of module 2.pptx
What is First Order Logic in AI or FOL in AI.docx
Knowledge Representation and Reasoning.pptx
22PCOAM11_IAI_Unit III Notes Full Notesmerged.pdf
Propositional Logic and Pridicate logic
Abdbfhdkmdmdjfmfkmfmfmfjjfjfjfnfnnfnfnfn
AI3391 Artificial intelligence Unit IV Notes _ merged.pdf
Theory of first order logic
Chapter 01 - p2.pdf
Logic programming (1)
predicateLogic.ppt
Ad

Recently uploaded (20)

PDF
BBC NW_Tech Facilities_30 Odd Yrs Ago [J].pdf
PPTX
SE unit 1.pptx by d.y.p.akurdi aaaaaaaaaaaa
PPTX
1. Effective HSEW Induction Training - EMCO 2024, O&M.pptx
PPT
Basics Of Pump types, Details, and working principles.
PPTX
IOP Unit 1.pptx for btech 1st year students
PPTX
Research Writing, Mechanical Engineering
PDF
25AF1191PC303 MODULE-1 CHAIN SURVEYING SEMESTER III SURVEYING
PPTX
Soft Skills Unit 2 Listening Speaking Reading Writing.pptx
PDF
MACCAFERRY GUIA GAVIONES TERRAPLENES EN ESPAÑOL
PDF
IAE-V2500 Engine for Airbus Family 319/320
PPTX
Unit IILATHEACCESSORSANDATTACHMENTS.pptx
PPT
Module_1_Lecture_1_Introduction_To_Automation_In_Production_Systems2023.ppt
PDF
IAE-V2500 Engine Airbus Family A319/320
DOCX
ENVIRONMENTAL PROTECTION AND MANAGEMENT (18CVL756)
PPTX
INTERNET OF THINGS - EMBEDDED SYSTEMS AND INTERNET OF THINGS
PPTX
22ME926Introduction to Business Intelligence and Analytics, Advanced Integrat...
PDF
Engineering Solutions for Ethical Dilemmas in Healthcare (www.kiu.ac.ug)
PDF
ST MNCWANGO P2 WIL (MEPR302) FINAL REPORT.pdf
PDF
Module 1 part 1.pdf engineering notes s7
PPTX
DATA STRCUTURE LABORATORY -BCSL305(PRG1)
BBC NW_Tech Facilities_30 Odd Yrs Ago [J].pdf
SE unit 1.pptx by d.y.p.akurdi aaaaaaaaaaaa
1. Effective HSEW Induction Training - EMCO 2024, O&M.pptx
Basics Of Pump types, Details, and working principles.
IOP Unit 1.pptx for btech 1st year students
Research Writing, Mechanical Engineering
25AF1191PC303 MODULE-1 CHAIN SURVEYING SEMESTER III SURVEYING
Soft Skills Unit 2 Listening Speaking Reading Writing.pptx
MACCAFERRY GUIA GAVIONES TERRAPLENES EN ESPAÑOL
IAE-V2500 Engine for Airbus Family 319/320
Unit IILATHEACCESSORSANDATTACHMENTS.pptx
Module_1_Lecture_1_Introduction_To_Automation_In_Production_Systems2023.ppt
IAE-V2500 Engine Airbus Family A319/320
ENVIRONMENTAL PROTECTION AND MANAGEMENT (18CVL756)
INTERNET OF THINGS - EMBEDDED SYSTEMS AND INTERNET OF THINGS
22ME926Introduction to Business Intelligence and Analytics, Advanced Integrat...
Engineering Solutions for Ethical Dilemmas in Healthcare (www.kiu.ac.ug)
ST MNCWANGO P2 WIL (MEPR302) FINAL REPORT.pdf
Module 1 part 1.pdf engineering notes s7
DATA STRCUTURE LABORATORY -BCSL305(PRG1)

Logic in Predicate and Propositional Logic

  • 1. -propositional logic Syntax, semantics, inferences and reasoning patterns -predicate logic Syntax, semantics, instance and its relationships -Unification and Resolution Prepared by T.ARCHANA, AP/CSE LOGIC
  • 2. WHAT IS A LOGIC? • A language with concrete rules • No ambiguity in representation (may be other errors!) • Allows unambiguous communication and processing
  • 3. PROPOSITIONAL LOGIC • In propositional logic, the most fundamental propositions are called primitive propositions. • Primitive propositions cannot be decomposed. Propositions that can be decomposed are compound propositions • Primitive propositions can be denoted by some symbols, and these symbols are called atomic formulas. • From atomic formulas we can construct various logic formulas corresponding to various compound propositions.
  • 4. PROPOSITION : SYMBOL • Daisuke is a Japanese: P1 • Chieko is a Japanese: P2 • • Daisuke and Chieko are husband and wife: P3 • • Makoto is the child of Chieko: P4 • • If Chieko is a Japanese AND Mokoto is the child of Chieko, THEN Mokoto is a Japanese: P2∧P4⇒ P5 • If Daisuke and Chieko are husband and wife AND Makoto is the child of Chieko, THEN Mokoto is the child of Daisuke: P3∧P4⇒ P6
  • 5. • An atomic formula is a logic formula. • If P is a logic formula, ¬P is also a logic formula. • If P and Q are logic formulas, P∧Q, P∨Q, P ⇒ Q, and P⇔Q are also logic formulas. • Logic formulas defined in the previous page are called well-formed formulas. • Similar to operators used in arithmetic calculation, logic symbols also have priorities. • We can also use parentheses to define the priorities if the formula is ambiguous.
  • 6. LOGIC SYMBOLS AND THEIR PRIORITIES
  • 11. PREDICATE LOGIC • Propositional logic combines atoms • An atom contains no propositional connectives • Have no structure (today_is_wet, john_likes_apples) • Predicates allow us to talk about objects • Properties: is_wet(today) • Relations: likes(john, apples) • True or false • In predicate logic each atom is a predicate • e.g. first order logic, higher-order logic
  • 12. BASIC ELEMENTS OF FIRST-ORDER LOGIC: Constant 1, 2, A, John, Mumbai, cat,.... Variables x, y, z, a, b,.... Predicates Brother, Father, >,.... Function sqrt, LeftLegOf, .... Connectives ∧, ∨, ¬, ⇒, ⇔ Equality == Quantifier ∀, ∃
  • 13. ATOMIC SENTENCES: • Atomic sentences are the most basic sentences of first-order logic. These sentences are formed from a predicate symbol followed by a parenthesis with a sequence of terms. • We can represent atomic sentences as Predicate (term1, term2, ......, term n). • Example: Ravi and Ajay are brothers: => Brothers(Ravi, Ajay). Chinky is a cat: => cat (Chinky).
  • 14. COMPLEX SENTENCES: • Complex sentences are made by combining atomic sentences using connectives. • First-order logic statements can be divided into two parts: • Subject: Subject is the main part of the statement. • Predicate: A predicate can be defined as a relation, which binds two atoms together in a statement. • Consider the statement: "x is an integer.", it consists of two parts, the first part x is the subject of the statement and second part "is an integer," is known as a predicate.
  • 15. QUANTIFIERS IN FIRST-ORDER LOGIC • A quantifier is a language element which generates quantification, and quantification specifies the quantity of specimen in the universe of discourse. • These are the symbols that permit to determine or identify the range and scope of the variable in the logical expression. There are two types of quantifier: • Universal Quantifier, (for all, everyone, everything) • Existential quantifier, (for some, at least one).
  • 16. UNIVERSAL QUANTIFIER • Universal quantifier is a symbol of logical representation, which specifies that the statement within its range is true for everything or every instance of a particular thing. • The Universal quantifier is represented by a symbol ∀, which resembles an inverted A. • If x is a variable, then ∀x is read as: • For all x • For each x • For every x.
  • 17. • Example: • All man drink coffee. • ∀x man(x) → drink (x, coffee). • It will be read as: There are all x where x is a man who drink coffee.
  • 18. EXISTENTIAL QUANTIFIER • Existential quantifiers are the type of quantifiers, which express that the statement within its scope is true for at least one instance of something. • It is denoted by the logical operator ∃, which resembles as inverted E. When it is used with a predicate variable then it is called as an existential quantifier. • If x is a variable, then existential quantifier will be ∃x or ∃(x). And it will be read as: • There exists a 'x.' • For some 'x.' • For at least one 'x.'
  • 19. • Example: • Some boys are intelligent. • ∃x: boys(x) ∧ intelligent(x) • It will be read as: There are some x where x is a boy who is intelligent.
  • 20. • Points to remember: • The main connective for universal quantifier ∀ is implication →. • The main connective for existential quantifier ∃ is and ∧. • Properties of Quantifiers: • In universal quantifier, ∀x∀y is similar to ∀y∀x. • In Existential quantifier, ∃x∃y is similar to ∃y∃x. • ∃x∀y is not similar to ∀y∃x.
  • 21. SOME EXAMPLES OF FOL USING QUANTIFIER: • 1. All birds fly. • 2. Every man respects his parent. • 3. Some boys play cricket. • 4. Not all students like both Mathematics and Science. • 5. Only one student failed in Mathematics.
  • 22. • 1. All birds fly. • ∀x bird(x) →fly(x). • 2. Every man respects his parent. • ∀x man(x) → respects (x, parent). • 3. Some boys play cricket. • ∃x boys(x) → play(x, cricket). • 4. Not all students like both Mathematics and Science. • ¬∀ (x) [ student(x) → like(x, Mathematics) ∧ like(x, Science)]. • 5. Only one student failed in Mathematics. • ∃(x) [ student(x) → failed (x, Mathematics) ∧∀ (y) [¬(x==y) ∧ student(y) → ¬failed (x, Mathematics)].
  • 23. FIRST ORDER LOGIC • More expressive logic than propositional • Constants are objects: john, apples • Predicates are properties and relations: • likes(john, apples) • Functions transform objects: • likes(john, fruit_of(apple_tree)) • Variables represent any object: likes(X, apples) • Quantifiers qualify values of variables • True for all objects (Universal): ∀X. likes(X, apples) • Exists at least one object (Existential): ∃X. likes(X, apples)
  • 24. EXAMPLE: FOL SENTENCE • “Every rose has a thorn” • For all X • if (X is a rose) • then there exists Y • (X has Y) and (Y is a thorn)
  • 25. EXAMPLE: FOL SENTENCE • “On Mondays and Wednesdays I go to John’s house for dinner”
  • 26. IMPLICATION ELIMINATION • A particularly important rule allows you to get rid of the implication operator, ⇒ : • X ⇒ Y ≡ ¬X ∨ Y • We will use this later on as a necessary tool for simplifying logical expressions • The symbol ≡ means “is logically equivalent to”
  • 27. CONJUNCTION ELIMINATION • Another important rule for simplifying logical expressions allows you to get rid of the conjunction (and) operator, ∧ : • This rule simply says that if you have an and operator at the top level of a fact (logical expression), you can break the expression up into two separate facts: • MaryIsFemale ∧ MaryIsRich • becomes: • MaryIsFemale • MaryIsRich
  • 28. FORWARD AND BACKWARD REASONING • Situation: You have a collection of logical expressions (premises), and you are trying to prove some additional logical expression (the conclusion) • You can: • Do forward reasoning: Start applying inference rules to the logical expressions you have, and stop if one of your results is the conclusion you want • Do backward reasoning: Start from the conclusion you want, and try to choose inference rules that will get you back to the logical expressions you have
  • 29. EXAMPLE • Given: • it_is_raining ∨ it_is_sunny • it_is_sunny ⇒ I_stay_dry • it_is_raining ⇒ I_take_umbrella • I_take_umbrella ⇒ I_stay_dry • You can conclude: • it_is_sunny ∨ it_is_raining • I_take_umbrella ∨ it_is_sunny • I_stay_dry ⇒ I_take_umbrella
  • 30. UNIFICATION • Unification is a process of making two different logical atomic expressions identical by finding a substitution. Unification depends on the substitution process. • It takes two literals as input and makes them identical using substitution. • Let Ψ1 and Ψ2 be two atomic sentences and 𝜎 be a unifier such that, Ψ1𝜎 = Ψ2𝜎, then it can be expressed as UNIFY(Ψ1, Ψ2). • Example: Find the MGU for Unify{King(x), King(John)} • Let Ψ1 = King(x), Ψ2 = King(John), • Substitution θ = {John/x} is a unifier for these atoms and applying this substitution, and both expressions will be identical. • The UNIFY algorithm is used for unification, which takes two atomic sentences and returns a unifier for those sentences (If any exist). • Unification is a key component of all first-order inference algorithms. • It returns fail if the expressions do not match with each other. • The substitution variables are called Most General Unifier or MGU.
  • 31. CONDITIONS FOR UNIFICATION: • Following are some basic conditions for unification: • Predicate symbol must be same, atoms or expression with different predicate symbol can never be unified. • Number of Arguments in both expressions must be identical. • Unification will fail if there are two similar variables present in the same expression.
  • 32. IMPLEMENTATION OF THE ALGORITHM • Step.1: Initialize the substitution set to be empty. • Step.2: Recursively unify atomic sentences: • Check for Identical expression match. • If one expression is a variable vi, and the other is a term ti which does not contain variable vi, then: • Substitute ti / vi in the existing substitutions • Add ti /vi to the substitution setlist. • If both the expressions are functions, then function name must be similar, and the number of arguments must be the same in both the expression.
  • 33. EXAMPLE • From the pair of facts (not yet clauses, just facts): • seafood(X) ⇒ likes(John, X) (where X is a variable) • seafood(shrimp) • We ought to be able to conclude • likes(John, shrimp) • We can do this by unifying the variable X with the constant shrimp • This is the same “unification” as is done in Prolog • This unification turns seafood(X) ⇒ likes(John, X) into seafood(shrimp) ⇒ likes(John, shrimp)
  • 34. • Unification is a “pattern-matching” procedure • Takes two atomic sentences, called literals, as input • Returns “Failure” if they do not match and a substitution list, θ, if they do • That is, unify(p,q) = θ means subst(θ, p) = subst(θ, q) for two atomic sentences, p and q • θ is called the most general unifier (mgu)
  • 35. RESOLUTION • Resolution is a theorem proving technique that proceeds by building refutation proofs, i.e., proofs by contradictions. It was invented by a Mathematician John Alan Robinson in the year 1965.
  • 36. STEPS FOR RESOLUTION: • Conversion of facts into first-order logic. • Convert FOL statements into CNF(conjunctive normal form) • Negate the statement which needs to prove (proof by contradiction) • Draw resolution graph (unification).
  • 37. EXAMPLE: • John likes all kind of food. • Apple and vegetable are food • Anything anyone eats and not killed is food. • Anil eats peanuts and still alive • Harry eats everything that Anil eats. Prove by resolution that: • John likes peanuts.
  • 38. STEP-1: CONVERSION OF FACTS INTO FOL • In the first step we will convert all the given statements into its first order logic.
  • 39. STEP-2: CONVERSION OF FOL INTO CNF • Eliminate all implication (→) and rewrite • Move negation (¬)inwards and rewrite • Rename variables or standardize variables • Eliminate existential instantiation quantifier by elimination. • Drop Universal quantifiers. • Distribute conjunction ∧ over disjunction ¬.
  • 41. STEP-3: NEGATE THE STATEMENT TO BE PROVED • In this statement, we will apply negation to the conclusion statements, which will be written as ¬likes(John, Peanuts)
  • 43. PRACTICE EXAMPLE • Jack owns a dog. Every dog owner is an animal lover. No animal lover kills an animal. Either Jack or Curiosity killed the cat, who is named Tuna. Did Curiosity kill the cat? These can be represented as follows: • A. (∃x) Dog(x) ∧ Owns(Jack,x) • B. (∀x) ((∃y) Dog(y) ∧ Owns(x, y)) → AnimalLover(x) • C. (∀x) AnimalLover(x) → ((∀y) Animal(y) → ¬Kills(x,y)) • D. Kills(Jack,Tuna) ∨ Kills(Curiosity,Tuna) • E. Cat(Tuna) • F. (∀x) Cat(x) → Animal(x) • G. Kills(Curiosity, Tuna)
  • 44. Convert to clause form CNF • A1. (Dog(D)) • A2. (Owns(Jack,D)) • B. (¬Dog(y), ¬Owns(x, y), AnimalLover(x)) • C. (¬AnimalLover(a), ¬Animal(b), ¬Kills(a,b)) • D. (Kills(Jack,Tuna), Kills(Curiosity,Tuna)) • E. Cat(Tuna) • F. (¬Cat(z), Animal(z)) • Add the negation of query: • G: (¬Kills(Curiosity, Tuna)) •
  • 45. The resolution refutation proof • R1: ¬G, D, {} (Kills(Jack, Tuna)) • R2: R1, C, {a/Jack, b/Tuna} (~AnimalLover(Jack), ~Animal(Tuna)) • R3: R2, B, {x/Jack} (~Dog(y), ~Owns(Jack, y), ~Animal(Tuna)) • R4: R3, A1, {y/D} (~Owns(Jack, D), ~Animal(Tuna)) • R5: R4, A2, {} (~Animal(Tuna)) • R6: R5, F, {z/Tuna} (~Cat(Tuna)) • R7: R6, E, {} FALSE