AI3391 ARTIFICAL INTELLIGENCE
(II YEAR (III Sem))
Department of Artificial Intelligence and Data Science
Session 25
by
Asst.Prof.M.Gokilavani
NIET
1/24/2024 Department of AI & DS 1
TEXTBOOK:
• Artificial Intelligence A modern Approach, Third Edition, Stuart
Russell and Peter Norvig, Pearson Education.
REFERENCES:
• Artificial Intelligence, 3rd Edn, E. Rich and K.Knight (TMH).
• Artificial Intelligence, 3rd Edn, Patrick Henny Winston, Pearson
Education.
• Artificial Intelligence, Shivani Goel, Pearson Education.
• Artificial Intelligence and Expert Systems- Patterson, Pearson
Education.
1/24/2024 Department of AI & DS 2
Topics covered in session 25
• Propositional Logic: Knowledge-Based Agents, The Wumpus World, Logic,
Propositional Logic, Propositional Theorem Proving: Inference and proofs, Proof
by resolution, Horn clauses and definite clauses, Forward and backward chaining,
Effective Propositional Model Checking, Agents Based on Propositional Logic.
1/24/2024 Department of AI & DS 3
RECAP
• Knowledge: Taking decisions and reasoning to act efficiently.
• sentences are expressed in a language which is called a knowledge
representation language.
• Knowledge-base of KBA stores fact about the world.
• Types of knowledge
• Technique of knowledge representation
• Inference system: Inference system applies logical rules to the KB to deduce new
information.
• Inference Knowledge: Inferential knowledge approach represents knowledge in
the form of formal logics.
Example: Let's suppose there are two statements:
a. Marcus is a man
b. All men are mortal
Then it can be represented as:
a. man(Marcus)
b. ∀x = men (x) ----------> mortal (x)s
1/24/2024 Department of AI & DS 4
Basic of Logical Representation
• Logic : It consists of precisely defined syntax and semantics which
supports the sound inference.
• Each sentence can be translated into logics using syntax and
semantics.
• Syntax: Syntaxes are the rules which decide how we can construct
legal sentences in the logic. (Symbols)
• Semantics: Semantics are the rules by which we can interpret the
sentence in the logic. ( meaning of sentence).
• Pros: Logical representation enables us to do logical reasoning.
• Cons: Logical representation technique may not be very natural, and
inference may not be so efficient.
1/24/2024 Department of AI & DS 5
Propositional Logic
Logical representation can be categorized into mainly two logics:
• Propositional Logic
• Predicate Logic
• Propositional Logic: 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
can not be both.
• Example:
a) It is Sunday.
b) The Sun rises from West (False proposition)
c) 3+3= 7(False proposition)
d) 5 is a prime number.
1/24/2024 Department of AI & DS 6
Propositional Logic
• Propositional logic consists of an object, relations or function, and
logical connectives.
• These connectives are also called logical operators.
1/24/2024 Department of AI & DS 7
Types of Propositions
There are two types of Propositions:
a. Atomic Propositions
b. Compound propositions
a. Atomic Proposition: Atomic propositions are the simple propositions. It consists
of a single proposition symbol. These are the sentences which must be either true or
false.
Example:
a) 2+2 is 4, it is an atomic proposition as it is a true fact.
b) "The Sun is cold" is also a proposition as it is a false fact.
b. Compound proposition: Compound propositions are constructed by combining
simpler or atomic propositions, using parenthesis and logical connectives.
Example:
a) "It is raining today, and street is wet."
b) "Ankit is a doctor, and his clinic is in Mumbai."
1/24/2024 Department of AI & DS 8
Semantic Knowledge Representation
(predicate logic)
• Semantic networks are alternative of predicate logic for knowledge
representation.
• If-Then rule or IS-A relation (Inheritance).
• Pros: These networks are simple and easily understandable.
• Cons: Human-like memory (Which has 1015 neurons and links) to store the
information.
• Example:
Statements: a. Jerry is a cat.
b. Jerry is a mammal
c. Jerry is owned by Priya.
d. Jerry is brown colored.
e. All Mammals are animal.
1/24/2024 Department of AI & DS 9
1/24/2024 Department of AI & DS 10
Rule of Inference
• What is Inference? 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 are the templates for generating valid arguments.
(formal sentence).
• Terminologies:
• 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.
1/24/2024 Department of AI & DS 11
Rule of Inference
1/24/2024 Department of AI & DS 12
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.
Resolution
• The Resolution rule state that if P∨Q and ¬ P∧R is true, then Q∨R will
also be true. It can be represented as:
1/24/2024 Department of AI & DS 13
Proof of Resolution
• Resolution is a single inference rule which can efficiently operate on
the conjunctive normal form or clausal form.
• Unification is a key concept in proofs by resolutions.
• 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.
• Rule is also called the binary resolution rule because it only resolves
exactly two literals.
1/24/2024 Department of AI & DS 14
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)
4. Draw resolution graph (unification).
1/24/2024 Department of AI & DS 15
Example: John likes all kind of food
Step 1: Conversion of Facts into FOL.
Step 2: Conversion of FOL into CNF
In First order logic resolution, it is required to convert the FOL
into CNF as CNF form makes easier for resolution proofs.
Step 3: Negate the statement to be proved.
• In this statement, we will apply negation to the conclusion statements, which will
be written as
Step 4: Draw Resolution Graph
1/24/2024 Department of AI & DS 16
Horn clauses and definite clauses
1/24/2024 Department of AI & DS 17
• Definite clause: A clause which is a disjunction of literals
with exactly one positive literal is known as a definite clause or strict
horn clause.
• Horn clause: A clause which is a disjunction of literals with at most
one positive literal is known as horn clause. Hence all the definite
clauses are horn clauses.
Example:
(¬ p V ¬ q V k)
It has only one positive literal k.
It is equivalent to p ∧ q → k.
Topics to be covered in next session 26
• First Order Logic (FOL)
Thank you!!!
1/24/2024 Department of AI & DS 18

AI3391 Artificial Intelligence Session 25 Horn clause.pptx

  • 1.
    AI3391 ARTIFICAL INTELLIGENCE (IIYEAR (III Sem)) Department of Artificial Intelligence and Data Science Session 25 by Asst.Prof.M.Gokilavani NIET 1/24/2024 Department of AI & DS 1
  • 2.
    TEXTBOOK: • Artificial IntelligenceA modern Approach, Third Edition, Stuart Russell and Peter Norvig, Pearson Education. REFERENCES: • Artificial Intelligence, 3rd Edn, E. Rich and K.Knight (TMH). • Artificial Intelligence, 3rd Edn, Patrick Henny Winston, Pearson Education. • Artificial Intelligence, Shivani Goel, Pearson Education. • Artificial Intelligence and Expert Systems- Patterson, Pearson Education. 1/24/2024 Department of AI & DS 2
  • 3.
    Topics covered insession 25 • Propositional Logic: Knowledge-Based Agents, The Wumpus World, Logic, Propositional Logic, Propositional Theorem Proving: Inference and proofs, Proof by resolution, Horn clauses and definite clauses, Forward and backward chaining, Effective Propositional Model Checking, Agents Based on Propositional Logic. 1/24/2024 Department of AI & DS 3
  • 4.
    RECAP • Knowledge: Takingdecisions and reasoning to act efficiently. • sentences are expressed in a language which is called a knowledge representation language. • Knowledge-base of KBA stores fact about the world. • Types of knowledge • Technique of knowledge representation • Inference system: Inference system applies logical rules to the KB to deduce new information. • Inference Knowledge: Inferential knowledge approach represents knowledge in the form of formal logics. Example: Let's suppose there are two statements: a. Marcus is a man b. All men are mortal Then it can be represented as: a. man(Marcus) b. ∀x = men (x) ----------> mortal (x)s 1/24/2024 Department of AI & DS 4
  • 5.
    Basic of LogicalRepresentation • Logic : It consists of precisely defined syntax and semantics which supports the sound inference. • Each sentence can be translated into logics using syntax and semantics. • Syntax: Syntaxes are the rules which decide how we can construct legal sentences in the logic. (Symbols) • Semantics: Semantics are the rules by which we can interpret the sentence in the logic. ( meaning of sentence). • Pros: Logical representation enables us to do logical reasoning. • Cons: Logical representation technique may not be very natural, and inference may not be so efficient. 1/24/2024 Department of AI & DS 5
  • 6.
    Propositional Logic Logical representationcan be categorized into mainly two logics: • Propositional Logic • Predicate Logic • Propositional Logic: 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 can not be both. • Example: a) It is Sunday. b) The Sun rises from West (False proposition) c) 3+3= 7(False proposition) d) 5 is a prime number. 1/24/2024 Department of AI & DS 6
  • 7.
    Propositional Logic • Propositionallogic consists of an object, relations or function, and logical connectives. • These connectives are also called logical operators. 1/24/2024 Department of AI & DS 7
  • 8.
    Types of Propositions Thereare two types of Propositions: a. Atomic Propositions b. Compound propositions a. Atomic Proposition: Atomic propositions are the simple propositions. It consists of a single proposition symbol. These are the sentences which must be either true or false. Example: a) 2+2 is 4, it is an atomic proposition as it is a true fact. b) "The Sun is cold" is also a proposition as it is a false fact. b. Compound proposition: Compound propositions are constructed by combining simpler or atomic propositions, using parenthesis and logical connectives. Example: a) "It is raining today, and street is wet." b) "Ankit is a doctor, and his clinic is in Mumbai." 1/24/2024 Department of AI & DS 8
  • 9.
    Semantic Knowledge Representation (predicatelogic) • Semantic networks are alternative of predicate logic for knowledge representation. • If-Then rule or IS-A relation (Inheritance). • Pros: These networks are simple and easily understandable. • Cons: Human-like memory (Which has 1015 neurons and links) to store the information. • Example: Statements: a. Jerry is a cat. b. Jerry is a mammal c. Jerry is owned by Priya. d. Jerry is brown colored. e. All Mammals are animal. 1/24/2024 Department of AI & DS 9
  • 10.
  • 11.
    Rule of Inference •What is Inference? 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 are the templates for generating valid arguments. (formal sentence). • Terminologies: • 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. 1/24/2024 Department of AI & DS 11
  • 12.
    Rule of Inference 1/24/2024Department of AI & DS 12 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.
  • 13.
    Resolution • The Resolutionrule state that if P∨Q and ¬ P∧R is true, then Q∨R will also be true. It can be represented as: 1/24/2024 Department of AI & DS 13
  • 14.
    Proof of Resolution •Resolution is a single inference rule which can efficiently operate on the conjunctive normal form or clausal form. • Unification is a key concept in proofs by resolutions. • 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. • Rule is also called the binary resolution rule because it only resolves exactly two literals. 1/24/2024 Department of AI & DS 14
  • 15.
    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) 4. Draw resolution graph (unification). 1/24/2024 Department of AI & DS 15
  • 16.
    Example: John likesall kind of food Step 1: Conversion of Facts into FOL. Step 2: Conversion of FOL into CNF In First order logic resolution, it is required to convert the FOL into CNF as CNF form makes easier for resolution proofs. Step 3: Negate the statement to be proved. • In this statement, we will apply negation to the conclusion statements, which will be written as Step 4: Draw Resolution Graph 1/24/2024 Department of AI & DS 16
  • 17.
    Horn clauses anddefinite clauses 1/24/2024 Department of AI & DS 17 • Definite clause: A clause which is a disjunction of literals with exactly one positive literal is known as a definite clause or strict horn clause. • Horn clause: A clause which is a disjunction of literals with at most one positive literal is known as horn clause. Hence all the definite clauses are horn clauses. Example: (¬ p V ¬ q V k) It has only one positive literal k. It is equivalent to p ∧ q → k.
  • 18.
    Topics to becovered in next session 26 • First Order Logic (FOL) Thank you!!! 1/24/2024 Department of AI & DS 18