0% found this document useful (0 votes)
4 views123 pages

AI-UNIT-3-2

The document provides an overview of propositional logic, highlighting its definition, basic facts, logical connectives, limitations, and its application in artificial intelligence. It explains the syntax of propositional logic, including atomic and compound propositions, and introduces inference rules and proofs, such as Modus Ponens and Modus Tollens. Additionally, it discusses the transition to first-order logic for more complex statements and the syntax and semantics of first-order predicate logic.

Uploaded by

anachen1903
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views123 pages

AI-UNIT-3-2

The document provides an overview of propositional logic, highlighting its definition, basic facts, logical connectives, limitations, and its application in artificial intelligence. It explains the syntax of propositional logic, including atomic and compound propositions, and introduces inference rules and proofs, such as Modus Ponens and Modus Tollens. Additionally, it discusses the transition to first-order logic for more complex statements and the syntax and semantics of first-order predicate logic.

Uploaded by

anachen1903
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 123

UNIT-3

PROPOSITIONAL LOGIC
Syllabus
Propositional logic in Artificial intelligence
Introduction
Propositional logic (PL) is the simplest form of logic
where all the statements are made by propositions. A
proposition is a declarative statement which is
either true or false. It is a technique of knowledge
representation in logical and mathematical form.
Example:
1.a) It is Sunday.
2.b) The Sun rises from West (False proposition)
3.c) 3+3= 7(False proposition)
4.d) 5 is a prime number.
Propositional Logic Facts
Following are some basic facts about propositional logic:
•Propositional logic is also called Boolean logic as it works on 0 and 1.
•In propositional logic, we use symbolic variables to represent the logic, and we can use any symbol
for a representing a proposition, such A, B, C, P, Q, R, etc.
•Propositions can be either true or false, but it cannot be both.
•Propositional logic consists of an object, relations or function, and logical connectives.
•These connectives are also called logical operators.
•The propositions and connectives are the basic elements of the propositional logic.
•Connectives can be said as a logical operator which connects two sentences.
•A proposition formula which is always true is called tautology, and it is also called a valid
sentence.
•A proposition formula which is always false is called Contradiction.
•A Statements which are questions, commands, or opinions are not propositions such as
"Where is Rohini", "How are you", "What is your name", are not propositions.
Ex. [~P^(P Q)]->Q
Ex.P->Q,~Q->~P
Propositional logic in Artificial
intelligence
A proposition is a statement - which in English is a declarative sentence and Logic defines the ways of
putting symbols together to form sentences that represent facts. Every proposition is either true or false.
Propositional logic is also called boolean algebra.
Examples:(a) The sky is blue.,

(b) Snow is cold. ,

(c) 12 * 12=144

Propositional logic : It is fundamental to all logic. Propositions are “Sentences”; either true or false but not
both. A sentence is smallest unit in propositional logic If proposition is true, then truth value is "true"; else
“false”.
Example ; Sentence "Grass is green";
Truth value “ true”;
Proposition “yes”
Logical Connectives:
• Logical connectives are used to connect two simpler propositions or representing a sentence logically. We can
create compound propositions with the help of logical connectives. There are mainly five connectives, which are given as
follows:
1. Negation: A sentence such as ¬ P is called negation of P. A literal can be either Positive literal or negative literal.
2. Conjunction: A sentence which has ∧ connective such as, P ∧ Q is called a conjunction.
Example: Rohan is intelligent and hardworking. It can be written as,
P= Rohan is intelligent,
Q= Rohan is hardworking. → P∧ Q.
3. Disjunction: A sentence which has ∨ connective, such as P ∨ Q. is called disjunction, where P and Q are the
propositions.
Example: "Ritika is a doctor or Engineer",
Here P= Ritika is Doctor. Q= Ritika is Engineer, so we can write it as P ∨ Q.
4. Implication: A sentence such as P → Q, is called an implication. Implications are also known as if-then rules. It can be
represented as
If it is raining, then the street is wet.
Let P= It is raining, and Q= Street is wet, so it is represented as P → Q
5. Biconditional: A sentence such as P⇔ Q is a Biconditional sentence, example If I am breathing, then I am alive
Limitations of Propositional logic:
• We cannot represent relations like ALL, some, or none with
propositional logic. Example:
• All the girls are intelligent.
• Some apples are sweet.
• Propositional logic has limited expressive power.
• In propositional logic, we cannot describe statements in terms of their
properties or logical relationships.
Syntax of propositional logic:

The allowed sentences for knowledge representation are


defined by the syntax of propositional logic. Propositions are
divided into two categories:
1.Atomic Propositions.
2.Compound propositions.
•Atomic propositions: Simple assertions are referred to as
atomic propositions. It is made up of only one proposition sign.
These are the sentences that must be true or untrue in order to
pass.
Example:
• 2+2 is 4, it is an atomic proposition as it is a true fact.
• "The Sun is cold" is also a proposition as it is a false fact.
•Compound proposition: Simpler or atomic statements are
combined with parenthesis and logical connectives to form
compound propositions.
Example:
Logical Connectives:
Logical connectives are used to link two simpler ideas or to
logically represent a statement. With the use of logical
connectives, we can form compound assertions. There
are five primary connectives, which are listed below:
1.Negation: A statement like ¬P is referred to as a
negation of P. There are two types of literals: positive and
negative literals.
P=It is raining.
¬P=It is not raining.
2.Conjunction: A conjunction is a sentence that
contains ∧ connective such as, P ∧ Q.
Example: Rohan is intelligent and hardworking. It can be
written as,
P = Rohan is intelligent,
3. Disjunction: A disjunction is a sentence with a
connective ∨ , such as P ∨ Q, where P and Q are the
propositions.
Example: "Ritika is a doctor or Engineer",
Here P = Ritika is Doctor. Q = Ritika is Engineer ,
so we can write it as P ∨ Q.
4.Implication: An implication is a statement such as P
→ Q. If-then rules are another name for implications. It
can be expressed as follows: If it rains, the street is
flooded.
Because P denotes rain and Q denotes a wet
street, the situation is written as P -> Q.
5.Biconditional: A sentence like P Q, for example, is a
biconditional sentence. I am alive if I am breathing.
Logical Connectives
Truth Table With Three Propositions
P Q-> ~R
Logical equivalence:
• Logical equivalence is one of the features of propositional logic. Two propositions are said to
be logically equivalent if and only if the columns in the truth table are identical to each other.
• Let's take two propositions A and B, so for logical equivalence, we can write it as A⇔B. In
below truth table we can see that column for ¬A∨ B and A→B, are identical hence A is
Equivalent to B.
Properties of Operators

Commutativity: The commutative property states that the order in


which the operators are applied does not affect the result.
Associativity: The associative property states that the grouping of
operators does not affect the result.
Identity element: The identity element property states that there is
an element that can be combined with any other element using the
operator without changing the result.
Distributive: The distributive property states that one operator can
be distributed over the other operator. For example, the intersection
operator is distributive over the union operator.
De Morgan's Law: De Morgan's Law states that the complement of
the union of two sets A and B is equal to the intersection of the
complement of A and the complement of B.
Double-negation elimination: Double negation elimination is a valid
rule of replacement that states that if not not-A is true, then A is
true.
Inference and Proofs
Inference:In artificial intelligence, we need intelligent
computers which can create new logic from old logic or by
evidence, so generating the conclusions from evidence and
facts is termed as Inference.

Inference rules:
• Inference rules are the templates for generating valid arguments.
• Inference rules are applied to derive proofs in artificial
intelligence, and the proof is a sequence of the conclusion that leads
to the desired goal.
•Implication: It is one of the logical connectives which can
be represented as P → Q. It is a Boolean expression.
•Converse: The converse of implication, which means the
right-hand side proposition goes to the left-hand side and
vice-versa. It can be written as Q → P.
•Contrapositive: The negation of converse is termed as
contrapositive, and it can be represented as ¬ Q → ¬ P.
•Inverse: The negation of implication is called inverse. It
can be represented as ¬ P → ¬ Q.
From the above term some of the compound statements are equivalent to each other, which we can
prove using truth table:

As a result from the above truth table, we can prove that P → Q is equivalent to ¬ Q → ¬ P, and Q→ P is
equivalent to ¬ P → ¬ Q.
Types of Inference rules:
1. Modus Ponens:
One of the most essential laws of inference is the Modus Ponens rule, which asserts that if P and P → Q
are both true, we can infer that Q will be true as well. It's written like this:

Example:
Statement-1: "If I am sleepy then I go to bed" ==> P → Q
Statement-2: ""I am sleepy" ==> P"
Conclusion: "I go to bed." ==> Q.
Hence, we can say that, if P → Q is true and P is true then Q will be true.
Proof by Truth table:
2.Modus Tollens:
According to the Modus Tollens rule if P→ Q is true and ¬ Q is true, then ¬ P will also true. It can be
represented as:

Example:
Statement-1: "If I am sleepy then I go to bed" ==> P→ Q
Statement-2: "I do not go to the bed."==> ~Q
Statement-3: Which infers that "I am not sleepy" => ~P
Proof by Truth table:
3. Hypothetical Syllogism:
According to the Hypothetical Syllogism rule if P→R is true whenever P→Q is true, and Q→R is true. It
can be represented as the following notation:
Example:
Statement-1: Statement-1: If you have my home key then you can unlock my home. P→Q
Statement-2: Statement-2: If you can unlock my home then you can take my money. Q→R
Statement-3: Conclusion: If you have my home key then you can take my money. P→R

Proof by Truth table:

4. Disjunctive Syllogism:
According to the Disjunctive syllogism rule if P∨Q is true, and ¬P is true, then Q will be true. It can be
represented as:
Example:
Statement-1:Today is Sunday or Monday. ==>P∨Q
Statement-2:Today is not Sunday. ==> ¬P
Conclusion: Today is Monday. ==> Q
Proof by Truth table:

6. Simplification:
According to the simplification rule if P∧ Q is true,
then Q or P will also be true. It can be represented
as:
5. Addition:
According to the Addition rule which is one of the
common
inference rule, If P is true, then P∨Q will be true.
Proof by Truth table:

Example:
Statement-1: I have a vanilla ice-cream. ==> P
Statement-2: I have Chocolate ice-cream.
Conclusion: I have vanilla or chocolate ice-cream.
==> (P∨Q)
Proof by Truth table:
7. Resolution:
According to the Resolution rule if P∨Q and ¬ P∧R
is true, then Q∨R will also be true. It can be
represented as

Proof by Truth table:


Proofs By Resolution
Resolution Method in Propositional Logic
In propositional logic, resolution method is the only inference rule which gives a new
clause when two or more clauses are coupled together.
Using propositional resolution, it becomes easy to make a theorem prover sound and
complete for all.
The process followed to convert the propositional logic into resolution method
contains the below steps:
•Convert the given axiom into clausal form, i.e., disjunction form.
•Apply and proof the given goal using negation rule.
•Use those literals which are needed to prove.
•Solve the clauses together and achieve the goal.
Applying resolution method:
Example of Propositional
Resolution
Consider the following Knowledge Base:

1.The humidity is high or the sky is cloudy.


2.If the sky is cloudy, then it will rain.
3.If the humidity is high, then it is hot.
4.It is not hot.
Goal: It will rain.
5. P V Q.
6. Q → R.
In (2), Q → R will be converted as (¬Q V R)
3. P → S.
In (3), P → S will be converted as (¬P V S)
4. ¬S.
Negation of Goal (¬R): It will not rain.
1.
3. 4.
First-Order Logic in Artificial intelligence
In propositional logic, we can only represent the facts, which are either true or false. PL is

not sufficient to represent the complex sentences or natural language statements. The

propositional logic has very limited expressive power. Consider the following sentence, which

we cannot represent using PL logic.


•"Some humans are intelligent", or "Sachin likes cricket."
To represent the above statements, PL logic is not sufficient, so we required some more
powerful logic, such as first-order logic.First-order logic is another way of knowledge
representation in artificial intelligence. It is an extension to propositional logic.
•FOL is sufficiently expressive to represent the natural language statements in a concise
way.
•First-order logic is also known as Predicate logic or First-order predicate logic.
Syntax and Semantics of First-Order Predicate Logic :
SYNTAX OF FOL :
The syntax of FOL determines which collection of symbols is a logical expression in first-order logic.
The basic syntactic elements of first-order logic are symbols. We write statements in short-hand
notation in FOL.
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 ∀, ∃
• Constants: represent specific objects in the domain being modeled,
such as "0" or "1" in the domain of integers.
• Variables: represent arbitrary objects in the domain being modeled,
such as "x" or "y".
• Predicates: represent relationships between objects in the domain
being modeled, such as "equal to" or "greater than".
• Functions: represent operations that map objects in the domain being
modeled to other objects, such as "addition" or "multiplication".
• Quantifiers: include "for all" (∀) and "there exists" (∃), which allow
for statements about all objects in the domain or some objects in the
domain
USING FIRST ORDER PREDICATE LOGIC
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
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.
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.

Example:
All men drink coffee.
Let a variable x which refers to a men so all x can
be represented
as∀xbelow:
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.’
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.
Convert Following statements in Predicate logic representations
1. All humans are mortal.
2. Some students love mathematics.
3. Every dog has a tail.
4. Some birds can fly.
5. No fish can fly.
6. If it rains, the ground is wet.
7. Some people are doctors.
8. Every car has an engine.
9. A person who studies hard will pass the exam.
10.There exists a number that is even.
1) ∀x bird(x) →fly(x)

2) ∀x man(x) → respects (x, parent).

3) . ∃x boys(x) → play(x, cricket).

4) ¬∀ (x) [ student(x) → like(x,

Mathematics) ∧ like(x, Science)].

5) ∃(x) [ student(x) → failed (x, Mathematics)

∧∀ (y) [¬(x==y) ∧ student(y) → ¬failed (y,

Mathematics)].
Some Examples of FOL using quantifier:

1. All birds fly.

In this question the predicate is "fly(bird)."And since there are all birds who fly so it will be

represented as follows.

2. Every man respects his parent.

In this question, the predicate is "respect(x, y)," where x=man, and y= parent.

Since there is every man so will use ∀, and it will be represented as follows:

3. Some boys play cricket.

In this question, the predicate is "play(x, y)," where x= boys, and y= game. Since there are some

boys so we will use ∃, and it will be represented as:


4. Not all students like both Mathematics and Science.

In this question, the predicate is "like(x, y)," where x= student, and

y= subject.

Since there are not all students, so we will use ∀ with negation,

so following representation for this:

5. Only one student failed in Mathematics.

In this question, the predicate is "failed(x, y)," where x= student, and

y= subject.

Since there is only one student who failed in Mathematics, so we will use

following representation for this:


HORN CLAUSES AND DEFINITE CLAUSES
Clause:-
a clause is an expression formed from a finite collection of literals . That is, it is a finite
disjunction or of literals, depending on the context.
Examples :Clausal form :

Literals can be positive literals or negative literals. For the forms of the

individual clauses where each of is a disjunction of literals.

For the clause form :NOT(P1) OR NOT(P2) OR ..... OR NOT(Pn) OR Q1 OR Q2 OR .....

OR Qm

The above clause has n negative literals and m positive literals.

This clause can be transformed into the following equivalent logical formula :

P1 AND P2 AND ..... AND Pn => Q1 OR Q2 OR ..... OR Qm

where ‘=>’ is the implies symbol.


Horn Clauses:
• Horn clauses and definite clauses are types of logical clauses used in knowledge
representation and automated reasoning systems, particularly in the context of logic
programming.
• They have specific syntactic forms and are widely used due to their simplicity and
computational properties.
• Here's a detailed explanation of each:
• A Horn clause is a logical formula with at most one positive literal. It is named after the
mathematician Alfred Horn. The general form of a Horn clause is:
H←B1​∧B2​∧…∧Bn​
Where:
•H is the head of the clause, which is a single positive literal.
•B1​,B2​,…,Bn​are the body of the clause, which are zero or more literals (positive or negative).
• A Horn clause is a clause containing at most one positive literal.
• A definite clause contains exactly one positive literal.
• Definition: horn clause is a disjunction of literal in
Types of Horn Clauses :

1) Horn clause with exactly one positive literal(1 positive literal, at least 1 negative literal) called

definite clause.an implication often called A “rule”. whose antecedent(left side) consists of

a conjunction of positive literals and whose consequent(right side) consists of a single positive

literal.

2) Unit clause : Definite clause with no negative literals.

3) Goal clause : Horn clause without a positive literal


Example:-~X1 V ~X2 V……..V~Xn V Y
Examples of a Horn Clause
1) [¬Child, ¬Mail, Boy]
Not a Horn Clause
2) [Rain, Sleet, Snow]

Example :- 3) {~lawyer(x),rich(x)}Every Horn clause can be written as an implication whose


Knowledge Engineering in First-order logic
Knowledge engineering in first-order logic (FOL) involves the process of structuring and formalizing
knowledge about a particular domain using the expressive power of first-order logic.
1. Define the Domain:
Identify the domain for which you want to represent knowledge. It could be any area of interest, such
Knowledge Engineering in First-order logic
as biology, finance, medicine, or robotics.

2. Identify Concepts and Relationships:


Break down the domain into its constituent concepts and relationships. Concepts are the entities or
objects within the domain, and relationships define how these entities are connected or related to
each other.
3.Formalize Concepts and Relationships:
Express these concepts and relationships in terms of first-order logic. This involves defining predicates
to represent properties, functions to represent actions or transformations, and constants/variables to
4. Represent Knowledge:
Utilize FOL expressions to represent various aspects of knowledge within the domain. This can include
facts, rules, constraints, and axioms.
• Facts: Concrete statements about the domain that are known to be true.

• Rules: Logical implications or constraints that govern the behavior of entities within the domain.

• Constraints: Limitations or conditions that must be satisfied by certain entities or relationships.

• Axioms: Fundamental truths or assumptions about the domain that serve as the basis for reasoning.

5. Formalize Inference:

• Define mechanisms for performing inference or reasoning over the knowledge base represented in

FOL. This could involve methods such as deduction, induction, abduction, or probabilistic reasoning.

6. Validate and Refine:

• Validate the knowledge representation against real-world scenarios or expert knowledge within the

domain. Refine the representation as needed to ensure accuracy and completeness.


Example:
Let's consider a simplified example of knowledge engineering in FOL within the domain of
academic advising:
Domain:
Academic advising for undergraduate students.
Concepts and Relationships:
Concepts: Students, courses, prerequisites, advisors.
Relationships: EnrolledIn(student, course), Prerequisite(course1, course2), AdvisedBy(student,
advisor), etc.
Knowledge Representation:
• Facts: EnrolledIn(Alice, Calculus), Prerequisite(Calculus, Algebra), AdvisedBy(Alice, ProfSmith).
• Rules: If EnrolledIn(student, course) and Prerequisite(course, prereq_course), then
EnrolledIn(student, prereq_course).
Queries:
• Is Alice eligible to enroll in Algebra?
• Who is advising Bob?
Inference in First-Order Logic
Inference in First-Order Logic is used to deduce new facts or sentences from
existing sentences. Before understanding the FOL inference rule, let's
understand some basic terminologies used in FOL.
Substitution:
Substitution is a fundamental operation performed on terms and formulas. It
occurs in all inference systems in first-order logic. The substitution is
complex in the presence of quantifiers in FOL. If we write F[a/x], so it refers
Equality:
to substitute a constant "a" in place of variable "x".
First-Order logic does not only use predicate and terms for making atomic
sentences but also uses another way, which is equality in FOL. For this,
we can use equality symbols which specify that the two terms refer to
the same object.
Example: Brother (John) = Smith.
As in the above example, the object referred by the Brother (John) is
similar to the object referred by Smith. The equality symbol can also be
used with negation to represent that two terms are not the same
objects.
FOL inference rules for quantifier:
As propositional logic we also have inference rules in first-order logic, so following are some basic
inference rules in FOL:
•Universal Generalization
•Universal Instantiation
•Existential Instantiation
•Existential introduction

1. Universal Generalization: Universal generalization is a valid inference rule


which states that if premise P(c) is true for any arbitrary element c in the universe of
discourse, then we can have a conclusion as ∀ x P(x).


It can be represented as: .
•This rule can be used if we want to show that every element has a similar property.
•In this rule, x must not appear as a free variable.
Free and Bound Variables:
The quantifiers interact with variables which appear in a suitable way. There are two types of

variables in First-order logic which are given below:

Free Variable: A variable is said to be a free variable in a formula if it occurs outside the

scope of the quantifier.

Example: ∀x ∃(y)[P (x, y, z)], where z is a free variable.

Bound Variable: A variable is said to be a bound variable in a formula if it occurs within the

scope of the quantifier.

Example: ∀x [A (x) B( y)], here x and y are the bound variables.


2. Universal Instantiation:
•Universal instantiation is also called as universal elimination or UI is a valid inference rule.
It can be applied multiple times to add new sentences.
•The new KB is logically equivalent to the previous KB.
•As per UI, we can infer any sentence obtained by substituting a ground term for the
variable.
•The UI rule state that we can infer any sentence P(c) by substituting a ground term c (a
constant within domain x) from ∀ x P(x) for any object in the universe of discourse.
•It can be represented as: .
Example:1.IF "Every person like ice-cream"=> ∀x P(x) so we can infer that
"John likes ice-cream" => P(c)
Example: 2.Let's take a famous example,"All kings who are greedy are Evil." So let our
knowledge base contains this detail as in the form of FOL:∀x king(x) ∧ greedy (x) → Evil (x),
So from this information, we can infer any of the following statements using Universal Instantiation:
•King(John) ∧ Greedy (John) → Evil (John),
•King(Richard) ∧ Greedy (Richard) → Evil (Richard),
•King(Father(John)) ∧ Greedy (Father(John)) → Evil (Father(John)),
ntial Instantiation:
stantiation is also called as Existential Elimination, which is a valid inference rule in first-or
lied only once to replace the existential sentence.
is not logically equivalent to old KB, but it will be satisfiable if old KB was satisfiable.
es that one can infer P(c) from the formula given in the form of ∃x P(x) for a new const
n with this rule is that c used in the rule must be a new term for which P(c ) is true.
esented as:
the given sentence: ∃x Crown(x) ∧ OnHead(x, John),
er: Crown(K) ∧ OnHead( K, John), as long as K does not appear in the knowledge base.
ed K is a constant symbol, which is called Skolem constant.
al instantiation is a special case of Skolemization process.
4. Existential Generalization/introduction
•An existential introduction is also known as an existential generalization, which
is a valid inference rule in first-order logic.
•This rule states that if there is some element c in the universe of
discourse which has a property P, then we can infer that
•there exists something in the universe which has the property P.
•It can be represented as:
•Example: Let's say that,
"Priyanka got good marks in English."
"Therefore, someone got good marks in English."
Prepositional vs First order logic
1) Prepositional

• Syntax:
• Propositional logic deals with propositions, which are statements that are either true or
false.
• It uses propositional variables (p, q, r, etc.) to represent propositions.
• Logical connectives include AND (∧), OR (∨), NOT (¬), IMPLIES (→), and IF AND ONLY IF
(↔).
• Semantics:
• Propositional logic doesn't deal with the internal structure of propositions. It treats
propositions as indivisible units.
• Truth values (true or false) are assigned to propositional variables or combinations of
them using truth tables.
• Expressiveness:
• Propositional logic is limited in expressiveness. It cannot represent the internal structure
of propositions or quantify over objects.
• It's suitable for representing simple relationships and logical operations but lacks the
ability to express more complex relationships involving objects and properties.
2) First order logic
• Syntax:
• First-order logic deals with objects, properties of objects, and relationships between objects.
• It includes variables to represent objects, constants representing specific objects, predicates
representing properties and relations, quantifiers (∀ for universal quantification and ∃ for
existential quantification), and logical connectives.
• Quantifiers allow statements to refer to all objects in the domain (universal quantification)
or to some objects (existential quantification).
• Semantics:
• FOL provides a rich semantics that allows for reasoning about objects, their properties, and
relationships.
• It allows for the interpretation of quantified statements in terms of the domain of discourse
and interpretations of predicates.
• Expressiveness:
• FOL is much more expressive than propositional logic. It can represent complex relationships
and quantified statements about objects and their properties.
• FOL can express statements such as "All humans are mortal," "Some mammals can fly," or
"Every student has a unique ID."
UNIFICATION
Unification is a fundamental process in artificial intelligence (AI) and symbolic reasoning that
involves finding a common solution or "unified" form for expressions containing
variables. It is the process of making different expressions or terms identical by assigning
values to variables in a way that allows them to match or unify. Unification plays a crucial role
in knowledge representation, logic programming, and natural language .
Example
Example
Unification in AI Examples of How Unification Works
in Logic:
Consider a simple example of unification in predicate logic:
Given two expressions:
1. P(x, a, b)
2. P(y, z, b)
We want to find a substitution that unifies these
expressions.
1. Start by matching the predicates. In this case, P is the
same in both expressions.
2. Now, compare the arguments:
x matches with y (x/y substitution).
a matches with z (a/z substitution).
b matches with b (no substitution needed).
The unification substitution for these expressions is:
x/y
a/z
Applying these substitutions to the original expressions, we obtain:
1. P(y, a, b)
2. P(y, z, b)
The expressions are now unified, and both are equivalent.

Unification is a fundamental process in logic and AI, allowing us to find

common ground between logical expressions and resolve

logical problems efficiently. It is a key component in automated

reasoning, logic programming, and knowledge representation.


First Order Predicate Logic Examples
A) Consider the following axioms:
1.Every child loves Santa.
2.Everyone who loves Santa loves any reindeer.
3.Rudolph is a reindeer, and Rudolph has a red nose.
4.Anything which has a red nose is weird or is a clown.
5.No reindeer is a clown.
6.Scrooge does not love anything which is weird.
7.(Conclusion) Scrooge is not a child.
1.Every child loves Santa.
∀ x (CHILD(x) → LOVES(x,Santa))
2.Everyone who loves Santa loves any reindeer.
∀ x (LOVES(x,Santa) → ∀ y (REINDEER(y) → LOVES(x,y)))
3.Rudolph is a reindeer, and Rudolph has a red nose.
REINDEER(Rudolph) ∧ REDNOSE(Rudolph)
4.Anything which has a red nose is weird or is a clown.
∀ x (REDNOSE(x) → WEIRD(x) ∨ CLOWN(x))
5.No reindeer is a clown.
¬ ∃ x (REINDEER(x) ∧ CLOWN(x))
6.Scrooge does not love anything which is weird.
∀ x (WEIRD(x) → ¬ LOVES(Scrooge,x))
7.(Conclusion) Scrooge is not a child.
¬ CHILD(Scrooge)
B) Consider the following axioms:
1.Anyone who buys carrots by the bushel owns either a rabbit or a grocery
store.
2.Every dog chases some rabbit.
3.Mary buys carrots by the bushel.
4.Anyone who owns a rabbit hates anything that chases any rabbit.
5.John owns a dog.
6.Someone who hates something owned by another person will not date that
person.
7.(Conclusion) If Mary does not own a grocery store, she will not date John.
1.Anyone who buys carrots by the bushel owns either a rabbit or a grocery store.
∀ x (BUY(x) → ∃ y (OWNS(x,y) ∧ (RABBIT(y) ∨ GROCERY(y))))
2.Every dog chases some rabbit.
∀ x (DOG(x) → ∃ y (RABBIT(y) ∧ CHASE(x,y)))
3.Mary buys carrots by the bushel.
BUY(Mary)
4.Anyone who owns a rabbit hates anything that chases any rabbit.
∀ x ∀ y (OWNS(x,y) ∧ RABBIT(y) → ∀ z ∀ w (RABBIT(w) ∧ CHASE(z,w)
→ HATES(x,z)))
5.John owns a dog.
∃ x (DOG(x) ∧ OWNS(John,x))
6.Someone who hates something owned by another person will not date that
person.
∀ x ∀ y ∀ z (OWNS(y,z) ∧ HATES(x,z) → ¬ DATE(x,y))
7.(Conclusion) If Mary does not own a grocery store, she will not date John.
(( ¬ ∃ x (GROCERY(x) ∧ OWN(Mary,x))) → ¬ DATE(Mary,John))
Forward Chaining and backward chaining in AI
• The inference engine is the component of the intelligent system in
artificial intelligence, which applies logical rules to the knowledge
base to infer new information from known facts.Inference engine
commonly proceeds in two modes, which are:
1.Forward chaining
2.Backward chaining
A. Forward Chaining
• Forward chaining is also known as a forward deduction or
forward reasoning method when using an inference engine.
Forward chaining is a form of reasoning which start with atomic
sentences in the knowledge base and applies inference rules
(Modus Ponens) in the forward direction to extract more
data until a goal is reached.
• The Forward-chaining algorithm starts from known facts, triggers all
rules whose premises are satisfied, and add their conclusion to the
known facts. This process repeats until the problem is solved.
Properties of Forward-Chaining:
• It is a down-up approach, as it moves from bottom to
top.
• It is a process of making a conclusion based on known
facts or data, by starting from the initial state and
reaches the goal state.
• Forward-chaining approach is also called as data-driven
as we reach to the goal using available data.
• Forward -chaining approach is commonly used in the
expert system, such as CLIPS, business, and
production rule systems.
Example:
A
A -> B
B
—————————–
He is running.
If he is running, he sweats.
Advantages
• Suitable to draw multiple conclusions simultaneously
• Higher flexibility than backward chaining
• Reliable for conclusion
Disadvantages
• Time-consuming due to data synchronization
• The fact explanation is unclear
Example of Forward-Chaining
“1 As per the law, it is a crime for an American to sell weapons to
hostile nations.
2 Country A, an enemy of America, has some missiles, and 3 all the
missiles were sold to it by Robert, who is an American citizen.“
Prove that "Robert is criminal.“
Facts Conversion into FOL:
• It is a crime for an American to sell weapons to hostile nations. (Let's say p,
q, and r are variables)
American (p) ∧ weapon(q) ∧ sells (p, q, r) ∧ hostile(r) →
Criminal(p) ...(1)
• Country A has some missiles. ?p Owns(A, p) ∧ Missile(p).
• It can be written in two definite clauses by using Existential Instantiation,
introducing new Constant T1.
Owns(A, T1) ......(2)
Missile(T1) .......(3)
• All of the missiles were sold to country A by Robert.
?p Missiles(p) ∧ Owns (A, p) → Sells (Robert, p, A) ......(4)
•Missiles are weapons.
Missile(p) → Weapons (p) .......(5)
•Enemy of America is known as hostile.
Enemy(p, America) →Hostile(p) ........(6)
•Country A is an enemy of America.
Enemy (A, America) .........(7)
•Robert is American
American(Robert). ..........(8)
Forward chaining proof:
Step-1:
In the first step we will start with the known facts and will choose the
sentences which do not have implications, such
as: American(Robert), Enemy(A, America), Owns(A, T1), and
Missile(T1).
All these facts will be represented as below
• Step-2:
• At the second step, we will see those facts which infer from
available facts and with satisfied premises.
• Rule-(1) does not satisfy premises, so it will not be added in
the first iteration.
• Rule-(2) and (3) are already added.
• Rule-(4) satisfy with the substitution {p/T1}, so Sells
(Robert, T1, A) is added, which infers from the conjunction
of Rule (2) and (3).
• Rule-(6) is satisfied with the substitution(p/A), so Hostile(A) is
added and which infers from Rule-(7).
Step-3:
• At step-3, as we can check Rule-(1) is satisfied with the
substitution {p/Robert, q/T1, r/A}, so we can add
Criminal(Robert) which infers all the available facts.
And hence we reached our goal statement.

Hence it is proved that Robert is Criminal using forward


chaining approach
B. Backward Chaining:
Backward-chaining is also known as a backward deduction or backward reasoning
method when using an inference engine. A backward chaining algorithm is a form of
reasoning, which starts with the goal and works backward, chaining through
rules to find known facts that support the goal. Example: B
A -> B
Properties of backward chaining: A
—————————–
• It is known as a top-down approach. He is sweating.
If he is running, he sweats.
• Backward-chaining is based on modus ponens inference rule.
He is running.
• In backward chaining, the goal is broken into sub-goal or sub-goals to prove the
facts true.
• It is called a goal-driven approach, as a list of goals decides which rules are selected
and used.
• Backward -chaining algorithm is used in game theory, automated theorem proving
tools, inference engines, proof assistants, and various AI applications.
• The backward-chaining method mostly used a depth-first search strategy for proof.
Advantages
• Swifter than forward chaining
• Easier process
• Efficiently drives correct solutions
Disadvantages
• Provides single answer
• Less flexibility
• Suitable only if the endpoint is known
• Difficult to execute
Example of Backward-
Chaining
In backward-chaining, we will use the same above example, and will
rewrite all the rules.
• American (p) ∧ weapon(q) ∧ sells (p, q, r) ∧ hostile(r) →
Criminal(p) ...(1)
Owns(A, T1) ........(2)
• Missile(T1)
• ∀ p : Missiles(p) ∧ Owns (A, p) → Sells (Robert, p, A) ......
(4)
• Missile(p) → Weapons (p) .......(5)
• Enemy(p, America) →Hostile(p) ........(6)
• Enemy (A, America) .........(7)
• American(Robert). ..........(8)
In Backward chaining, we will start with our goal
predicate, which is Criminal(Robert), and then infer
further rules.
Step-1:
At the first step, we will take the goal fact. And from the
goal fact, we will infer other facts, and at last, we will
prove those facts true. So our goal fact is "Robert is
Criminal," so following is the predicate of it.

Step-2:
At the second step, we will infer other facts form goal fact which
satisfies the rules. So as we can see in Rule-1, the goal predicate
Criminal (Robert) is present with substitution {Robert/P}. So we will
add all the conjunctive facts below the first level and will replace p
with Robert.
Here we can see American (Robert) is a fact, so it is proved
Step-3:t At step-3, we will extract
further fact Missile(q) which infer
from Weapon(q), as it satisfies
Rule-(5). Weapon (q) is also true
with the substitution of a constant
T1 at q.
• Step-4:
Step-5:
At step-4, we can infer facts At step-5, we can infer the
Missile(T1) and Owns(A, T1) fact Enemy(A,
form Sells(Robert, T1, r) which America) from Hostile(A) which
satisfies the Rule- 4, with the satisfies Rule- 6. And hence all
substitution of A in place of r. the statements are proved true
So these two statements are using backward chaining.
proved here.
Example of Backward-Chaining
Some Facts:
1.Ravi enjoys a wide variety of foods.
Conversion into FOL:
2.Banana are food. 1) ∀x Food ( x ) -> Likes ( Ravi, x )
3.Pizza is food. 2) Food ( Banana )
3) Food ( Pizza )
4.A food is anything that anyone
4) ∀x ∀y Eats(x, y) ^ ¬ Harmed(y) ->
consumes and isn't harmed by.
Food(x)
5.Sam eats Idli and is still alive. 5) Eats ( Idli, Sam ) -> ¬ Harmed
6.Bill eats everything Sam eats. ( Sam )
Goal: 6) ∀x Eats ( x, Sam ) -> Eats ( x, Bill )
Ravi Like Idli
iv. Backward-Chaining proof
Iteration 1:
• Separation of Facts:
• Food ( Banana )
• Food ( Pizza )
• Eats ( Idli, Sam ) -> ¬ Harmed ( Sam )
Iteration 2:
1.We must regard the statement we must establish to be true, i.e. Likes
( Ravi, Idli ) is now true.
2.We can deduce from the first rule that Food ( Idli ) is true.
3.We can deduce from the fourth rule that Eats ( Idli, Ravi ) -> ¬
Harmed ( Ravi ) is true.
• We demonstrated that the assertion we wished to prove is legitimate
because we ended up with all of the statements being true.
• Hence Proved!
Difference between Forwarding Chaining and Backward Chaining

Sr.N Forwarding Chaining Backward Chaining


o.
When based on available data a decision is Backward chaining starts from the goal and
1 taken then the process is called as Forward works backward to determine what facts must
chaining. be asserted so that the goal can be achieved
2. Backward chaining is known as goal-driven
Forward chaining is known as data-driven
technique because we start from the goal and
technique because we reaches to the goal
reaches the initial state in order to extract the
using the available data.
facts.

3. It is a bottom-up approach. It is a top-down approach.

4. It applies the Breadth-First Strategy. It applies the Depth-First Strategy.

Its goal is to get the possible facts or the


5. Its goal is to get the conclusion.
required data.

6. Slow as it has to use all the rules. Fast as it has to use only a few rules.

It operates in forward direction i.e it works It operates in backward direction i.e it works
7.
from initial state to final decision. from goal to reach initial state.

Forward chaining is used for the planning, It is used in automated inference engines,
8. monitoring, control, and interpretation theorem proofs, proof assistants and other
Resolution in FOL
• Resolution is used, if there are various statements are given, and
we need to prove a conclusion of those statements.
• Unification is a key concept in proofs by resolutions.
• Resolution is a single inference rule which can efficiently operate on
the conjunctive normal form or clausal form.
• Clause: Disjunction of literals (an atomic sentence) is called
a clause. It is also known as a unit clause.
• Conjunctive Normal Form: A sentence represented as a
conjunction of clauses is said to be conjunctive normal
form or CNF.
• Steps for Resolution:
1.Conversion of facts into first-order logic.
2.Convert FOL statements into CNF
3.Negate the statement which needs to prove (proof by
contradiction)
Normal Forms
• The problem of finding whether a given statement is tautology
or contradiction or satisfiable in a finite number of steps is
called the Decision Problem. For Decision Problem,
construction of truth table may not be practical always. We
consider an alternate procedure known as the reduction to
normal forms.
• There are two such forms:
1.Disjunctive Normal Form (DNF)
2.Conjunctive Normal Form
• Disjunctive Normal Form (DNF): If p, q are two statements,
then "p or q" is a compound statement, denoted by p ∨ q and
referred as the disjunction of p and q. The disjunction of p and q
is true whenever at least one of the two statements is true, and
it is false only when both p and q are false
p q p∨q
T T T
T F T
F T T
F F F

• Conjunctive Normal Form: If p, q are two statements,


then "p and q" is a compound statement, denoted by p
∧ q and referred as the conjunction of p and q. The
conjunction of p and q is true only when both p and q
are true, otherwise, it is false.
p q p∧q
T T T
T F F
F T F
F F F
Example: Step-1: Conversion of
1.John likes all kind of food.
Facts into FOL
2.Apple and vegetable are
food In the first step we will convert
3.Anything anyone eats and all the given statements into its
not killed is food. first order logic.
4.Anil eats peanuts and still
alive
5.Harry eats everything that
Anil eats.

Prove by resolution that:


6.John likes peanuts.
Steps to convert a formula into
CNF
• We eliminate all the occurrences of ⊕⊕ (XOR
operator), →→ (conditional), and ↔↔ (biconditional) from the
formula. We convert it into its equivalent formula
containing ∨∨, ∧∧ , and ¬¬ symbol. We use the following

𝐴⊕𝐵≡(𝐴∨𝐵)∧¬(𝐴∧𝐵)
logical equivalences:

𝐴→𝐵≡¬𝐴∨𝐵

𝐴↔𝐵≡(¬𝐴∨𝐵)∧(𝐴∨¬𝐵)

𝐴↔𝐵≡(𝐴∧𝐵)∨(¬𝐴∧¬𝐵)


• We move all the negations inwards to appear only as a part of
the literal. The ¬¬ symbol can only precede a propositional
variable or a predicate symbol. To accomplish this, we use

• ¬¬𝐴≡𝐴
the following logical equivalences:
• De Morgan's law
Some common equivalences that we use for the

Commutativity for disjunction: 𝐴∨𝐵≡𝐵∨𝐴


conversion are:

Commutativity for conjunction: 𝐴∧𝐵≡𝐵∧𝐴


Associativity for disjunction: (𝐴∨𝐵)∨𝐶≡𝐴∨(𝐵∨𝐶)


Associativity for conjunction: (𝐴∧𝐵)∧𝐶≡𝐴∧(𝐵∧𝐶)



disjunction: 𝐴∨(𝐵∧𝐶)≡(𝐴∨𝐵)∧(𝐴∨𝐶)
• Distribution over

conjunction: 𝐴∧(𝐵∨𝐶)≡(𝐴∧𝐵)∨(𝐴∧𝐶)
• Distribution over
• Step-2: Conversion of FOL into CNF

In First order logic resolution, it is required to • Move negation (¬)inwards and


convert the FOL into CNF as CNF form makes rewrite
easier for resolution proofs. • ∀x ¬ food(x) V likes(John, x)
Eliminate all implication (→) and rewrite • food(Apple) Λ food(vegetables)
• ∀x ¬ food(x) V likes(John, x) • ∀x ∀y ¬ eats(x, y) V killed(x) V
• food(Apple) Λ food(vegetables) food(y)
• ∀x ∀y ¬ [eats(x, y) Λ ¬ killed(x)] V food(y) • eats (Anil, Peanuts) Λ alive(Anil)
• eats (Anil, Peanuts) Λ alive(Anil) • ∀x ¬ eats(Anil, x) V eats(Harry, x)
• ∀x ¬ eats(Anil, x) V eats(Harry, x) • ∀x killed(x) ] V alive(x)
• ∀x¬ [¬ killed(x) ] V alive(x)
• ∀x ¬ alive(x) V ¬ killed(x)
• ∀x ¬ alive(x) V ¬ killed(x)
• likes(John, Peanuts).
• likes(John, Peanuts).
• Rename variables or standardize•Eliminate existential
variables instantiation quantifier
by elimination.
1.∀x ¬ food(x) V likes(John, x)
In this step, we will
2.food(Apple) Λ food(vegetables) eliminate existential
3.∀y ∀z ¬ eats(y, z) V killed(y) V food(z) quantifier ∃, and this
4.eats (Anil, Peanuts) Λ alive(Anil)
process is known
as Skolemization. But in
5.∀w¬ eats(Anil, w) V eats(Harry, w) this example problem since
6.∀g killed(g) ] V alive(g) there is no existential
7.∀k ¬ alive(k) V ¬ killed(k) quantifier so all the
statements will remain
8.likes(John, Peanuts).
same in this step.
• Drop Universal quantifiers.
In this step we will drop all universal quantifier since all
the statements are not implicitly quantified so we don't
need it.
• ¬ food(x) V likes(John, x)
• food(Apple)
• food(vegetables)
• ¬ eats(y, z) V killed(y) V food(z)
• eats (Anil, Peanuts)
• alive(Anil)
• ¬ eats(Anil, w) V eats(Harry, w)
• killed(g) V alive(g)
• ¬ alive(k) V ¬ killed(k)
• likes(John, Peanuts).
• Distribute conjunction ∧ over disjunction ¬.
This step will not make any change in this problem.
• 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:
Now in this step, we will solve the problem by resolution
tree using substitution. For the above problem, it will be
given as follows:
• Hence the negation of the conclusion has been proved as a
complete contradiction with the given set of statements.
Explanation of Resolution graph:
• In the first step of resolution graph, ¬likes(John, Peanuts) ,
and likes(John, x) get resolved(canceled) by substitution
of {Peanuts/x}, and we are left with ¬ food(Peanuts)
• In the second step of the resolution graph, ¬ food(Peanuts) ,
and food(z) get resolved (canceled) by substitution
of { Peanuts/z}, and we are left with ¬ eats(y, Peanuts) V
killed(y) .
• In the third step of the resolution graph, ¬ eats(y,
Peanuts) and eats (Anil, Peanuts) get resolved by
substitution {Anil/y}, and we are left with Killed(Anil) .
• In the fourth step of the resolution graph, Killed(Anil) and ¬
killed(k) get resolve by substitution {Anil/k}, and we are left
Example

1) ¬((¬𝐴→¬𝐵)∧¬𝐶)
Consider the first formula,

Remove the conditional symbol as per the rules explained in the first

≡¬((¬¬𝐴∨¬𝐵)∧¬𝐶)
step:

≡¬((𝐴∨¬𝐵)∧¬𝐶)
Remove the double negation as mentioned in the second step:

≡¬(𝐴∨¬𝐵)∨¬¬𝐶
Apply the De Morgans law that opens a negation as a whole:

≡¬(𝐴∨¬𝐵)∨𝐶
Remove the double negation similar to the step we did before:

≡(¬𝐴∧¬¬𝐵)∨𝐶
Apply the De Morgans law again:

≡(¬𝐴∧𝐵)∨𝐶
Remove the double negation again:
Apply the distributive property over disjunction, which will lead to two

≡(¬𝐴∨𝐶)∧(𝐵∨𝐶)
clauses:

This is the final conjunction form of the formula. This is in the product of
sums form.

2) (𝐴→𝐵)→(¬𝐶→𝐵)
Let's take another formula:

≡(𝐴∧¬𝐵)∨(¬𝐶∧𝐵)
Remove all the occurrences of the conditional symbols:

≡(𝐴∨(¬𝐶∧𝐵))∧(¬𝐵∨(¬𝐶∧𝐵))
Apply the distributive property over conjunction:

≡(𝐴∨(¬𝐶∧𝐵))∧(¬𝐵∨¬𝐶)∧(¬𝐵∨𝐵)
Apply the same property:

By the rules of disjunction, ¬𝐵∨𝐵¬B∨B is true:


≡(𝐴∨(¬𝐶∧𝐵))∧(¬𝐵∨¬𝐶)∧𝑇
Using the identity property for conjunction, 𝐴∧𝑇A∧T is 𝐴A:
≡(𝐴∨(¬𝐶∧𝐵))∧(¬𝐵∨¬𝐶)
Finally, using the distributive property over conjunction:
Convert To First Order Logic
Convert to Clausal Form
Examples Of Propositional Logic
1) Use truth tables to determine which of the following are equivalent to each other:
(a) P
(b) ¬P
(c) P ⇒ F
(d) P ⇒ T
(e) F ⇒ P
(f) T ⇒ P
(g) ¬¬P
2) Use truth tables to determine which of the following are equivalent to each other:
(a) (P ∧ Q) ∨ (¬P ∧ ¬Q)
(b) ¬P ∨ Q
(c) (P ∨ ¬Q) ∧ (Q ∨ ¬P)
(d) ¬(P ∨ Q)
(e) (Q ∧ P) ∨ ¬P
3) Let p stand for the proposition “I bought a lottery ticket” and q for “I won the jackpot”.
Express the following as natural English sentences:
(a) ¬p
(b) p ∨ q
(c) p ∧ q
(d) p ⇒ q
(e) ¬p ⇒ ¬q
(f) ¬p ∨ (p ∧ q)
Examples Of Predicate Logic

1. "All mammals are warm-blooded."

2. All white birds are beautiful.

3. Ramji is a man.

4. Ramji is a farmer

5. All Kuchchhis are Gujaratis.

6. Ramji belongs to Bhachau.

7.All people of Bhachau lost their houses


during the earthquake in 2000.

8. Government provided relief to all those


who lost their houses during the earthquake.
1.Ans 𝑀(𝑥):x is a mammal. 𝑊(𝑥): x is warm-blooded.
∀𝑥(𝑀(𝑥)→𝑊(𝑥))

2.Ans IsWhite(x): Represents the property that x is white.


•IsBeautiful(x): Represents the property that x is beautiful.
∀ x ( IsWhite(x) → IsBeautiful(x) )

3.Ans Man (Ramji)


4.Ans Farmer(Ramji)

5.Ans ∀X: Kuchchhi(X) →Gujrati (X)

6.Ans. Belongto (Ramji, Bhachau)

7.Ans ∀X:∃H:Person(X) ⋀Belongsto (X,Bhachau) ⋀House (H,X)


→Lost (X,H,2000)
8.Ans ∀X:∃Y:Person(X) ⋀House (H,X) ⋀Lost (X,H,2000) →Relief
(Government, X)
1) Which of the following is a valid logical equivalence in propositional logic?
a) De Morgan's Law: ¬(P ∧ Q) ≡ ¬P ∨ ¬Q
b) Distributive Law: P ∨ (Q ∧ R) ≡ (P ∨ Q) ∧ (P ∨ R)
c) Double Negation: ¬(¬P) ≡ P
d) None of the above
2) In propositional logic, if P, Q, and R are propositions, which of the following is NOT a tautology?
e) (P → Q) ∨ (Q → P)
f) (P ∧ Q) → P
g) (P ∨ Q) ↔ (Q ∨ P)
h) (P → Q) ↔ (¬Q → ¬P)
3) Which of the following is a valid inference rule in propositional logic?
i) Modus Ponens: From P and P → Q, infer Q
j) Modus Tollens: From P → Q and ¬Q, infer ¬P
k) Hypothetical Syllogism: From P → Q and Q → R, infer P → R
l) All of the above
4) In propositional logic, the statement "P → Q" is read as:
m) P or Q
n) P implies Q
o) P and Q
p) P if and only if Q
5) What is the primary goal of knowledge engineering in AI?
q) To develop intelligent agents
r) To represent knowledge in a usable form for AI systems
s) To design algorithms for machine learning
t) To optimize computational efficiency
6) Which approach to knowledge engineering involves acquiring knowledge from human experts and encoding it into a kb?
a) Top-down approach
b) Bottom-up approach
c) Expert-driven approach
d) Data-driven approach
7) Which of the following is the correct syntax for a predicate logic statement?
e) ∀x (P(x) → Q(x))
f) ∃x (P(x) ∧ Q(x))
g) ∃x (P(x) → Q(x))
h) ∀x (P(x) ∧ Q(x))
8) Which of the following statements is true about predicate logic?
i) Predicate logic deals with propositions that can be either true or false.
j) Predicate logic extends propositional logic by including predicates and quantifiers.
k) Predicate logic cannot express relationships between objects.
l) Predicate logic is primarily used for boolean algebra operations.
9) In predicate logic, what does the existential quantifier ( ∃) represent?
m) "For all"
n) "There exists"
o) "Not"
p) "If and only if"
10) Which of the following is the negation of the formula ∃x (P(x) ∧ Q(x)) in predicate logic?
q) ¬∀x (P(x) ∧ Q(x))
r) ∀x (¬P(x) ∨ ¬Q(x))
s) ∃x (¬P(x) ∧ ¬Q(x))
t) ¬∃x (P(x) ∧ Q(x))
1. De Morgan's Law: ¬(P ∧ Q) ≡ ¬P ∨ ¬Q
2. (P ∨ Q) ↔ (Q ∨ P)
3. All of the above
4. P implies Q
5. To represent knowledge in a usable form for AI systems
6. Expert-driven approach
7. ∃x (P(x) ∧ Q(x))
8. Predicate logic extends propositional logic by including predicates and
quantifiers
9. "There exists“
10.∀x (¬P(x) ∨ ¬Q(x))
1.''All boys are cool.''Corresponding FOL is:
a) ∀x: boy(x) → cool(x)
b) ∀x: boy(x) ∧ cool(x)
c) ∀x: boy(x) → (cool,x)
d) ∀x: boy(x) ↔ cool(x)
2. First Order Logic is also known as _____.First Order Propositional Logic
e) First Logic
f) Predicate Logic
g) AI Logic
3. ''Peter likes chocolates.''Corresponding FOL is:
h) likes(Peter) ∧ (chocolates)
i) Peter(likes,chocolate)
j) likes(Peter,chocolates)
k) chocolates(Peter,likes)
4. Which is created by using single propositional symbol?
a) Complex sentences
b) Atomic sentences
c) Composition sentences
d) None of the mentioned
5. Which is used to construct the complex sentences?
a) Symbols
b) Connectives
c) Logical connectives
d) All of the mentioned
6. How many proposition symbols are there in artificial intelligence?
a) 1
b) 2
c) 3
d) 4
7. How many logical connectives are there in artificial intelligence? 1)a
a) 2 2)b
b) 3 3)c
c) 4 4) B
d) 5 5) C
8.Which is used to compute the truth of any sentence?
a) Semantics of propositional logic
6) B
b) Alpha-beta pruning 7) D
c) First-order logic 8) A
d) Both Semantics of propositional logic & Alpha-beta pruning 9) A
9.From which rule does the modus ponens are derived? 10) a
a) Inference rule
b) Module rule
c) Both Inference & Module rule
d) None of the mentioned
10. 9. Which form is called as a conjunction of disjunction of literals?
a) Conjunctive normal form
b) Disjunctive normal form
c) Normal form
d) All of the mentioned

You might also like