0% found this document useful (0 votes)
14 views

AI UNIT - 3

Uploaded by

shaikasif7543
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

AI UNIT - 3

Uploaded by

shaikasif7543
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 91

UNIT - III

LOGIC CONCEPTS
Introduction
➢Logic was considered to be a branch of
philosophy.
➢Logic helps in investigating and classifying the
structure of statements and arguments through
the study of formal systems of inference.
➢Logic is concerned with the principles of
drawing valid inferences from a given set of true
statements.
➢Formal logic deals with the study of inference
with purely formal content also known as
symbolic logic.
Symbolic logic is divided into two branches
1. Propositional logic
2. Predicate logic

A proposition refers to a declarative statement that is


either true or false (but not both) in a given context.

The predicate logic is a logical extension of propositional


Logic which deals with the Validity, Satisfiability and
Unsatisfiability (inconsistency) of a formula along with
the inference rules for derivation of a new formula.
An extension to symbolic logic is mathematical
logic which is concerned with the
• study of proof theory,
• set theory,
• model theory and
• recursion theory.
Logic systems should possess properties such as
1. Consistency
2. Soundness
3. Completeness
1. Consistency implies that none of the
theorems of the system should
contradict each other

2. Soundness means that the inference


rules shall never allow a false inference
from true premises

3. Completeness means that there are no


true sentences in the system that
cannot be proved in the system.
Propositional Calculus
1. Truth Table
In PC, a truth table is used to provide operational
definitions of important logical operators, it also
elaborates all possible truth values of a formula.
The logical constants in PC are true and false and
these are represented as T and F in a truth table.
Following are the truth table for all logical connectives:
2. Equivalence Law

If and only if the truth values of both are the


same for all possible assignments of logical
constants (T or F) to the symbols appearing in
the formulae.

Equivalence relations (or laws) are used to


reduce or simplify a given well-formed
formula or to derive a new formula from the
existing formula
we can see that column for ¬A∨ B and A→B, are identical hence A is Equivalent to B
Propositional logic

Propositional logic deals with the validity,


satisfiability (consistency), and unsatisfiability
(inconsistency) of a formula and the
derivation of a new formula using
equivalence laws.
Example: show that the following is a valid
argument:
If it is humid then it will rain and since it is humid
today it will rain

Solution: let us symbolize each part of the above


english sentence by propositional atoms as follows:
A: It is humid
B: It will rain
If it is humid then it will rain and since it is humid
today it will rain

It can be written as:


1. Find the truth table of

2. prove that P → Q is equivalent to ¬ Q → ¬ P,


and Q→ P is equivalent to ¬ P → ¬ Q.
prove that P → Q is equivalent to ¬ Q → ¬ P, and Q→ P
is equivalent to ¬ P → ¬ Q.
Tautology/Contradiction/Contingency.
A tautology is a proposition that is always true.
Ex. p∨¬p

A contradiction is a proposition that is always


false.
Ex. p∧¬p

A contingency is a proposition that is neither a


tautology nor a contradiction.
Ex. p∨q → ¬r
Example: Prove that the statement (p⟶q) (∼q⟶∼p) is a tautology.
Loaded:
 18.71%
Solution: Make the truth table of the above statement:

p q p→q ~q ~p ~q⟶∼p (p→q)⟷( ~q⟶~p)


T T T F F T T
T F F T F F T
F T T F T T T
F F T T T T T

As the final column contains all T's, so it is a tautology.


Contradiction:
A statement that is always false is known as a contradiction.
Example: Show that the statement p ∧∼p is a contradiction.
Solution:
Since, the last column contains all F's, so it's a contradiction.

p ∼p p ∧∼p
T F F
F T F
Contingency:
A statement that can be either true or false depending
on the truth values of its variables is called a
contingency.

p q p →q p∧q (p →q)⟶ (p∧q )

T T T T T
T F F F T
F T T F F
F F T F F
Use of truth table approach in some situations
proves to be a wastage of time.

Some other methods that are concerned with


proofs and deductions are as follows:

1.Natural Deduction system


2.Axiomatic system
3.Semantic tableau method
4.Resolution refutation method
Natural Deduction System
It mimics the pattern of natural reasoning.
This system is based on a set of deductive inference
rules.
Axiomatic System
Semantic Tableaux System in PL
● Earlier approaches require
− construction of proof of a formula from given set of
formulae and are called direct methods.
● In semantic tableaux,
− the set of rules are applied systematically on a
formula or set of formulae to establish its consistency
or inconsistency.
● Semantic tableau
− binary tree constructed by using semantic rules
with a formula as a root
● Assume be any two formulae.
From the above semantic tableau we observe that there are two paths in it of which one
Path is closed, while the other is open. This shows that the formula is satisfiable
The semantic tableau is contradictory, S is unsatisfiable.
Predicate Logic
Propositional logic has many limitations.
For example, the facts
John is a boy,
Paul is a boy,
Peter is a boy
Can by symbolized by A,B and C in propositional
logic
But we cannot draw any conclusions about the
similarities between A, B, and C.
Alternatively, if we represent thest facts as boy(John), boy(Paul),
boy(Peter)
then these statements give information that John, Paul, Peter are
all boys.

These facts can be easily generated from a general statement


boy(X),
Where the variable x IS BOUND WITH John, Paul , Peter.
These facts are called instances of boy(X)
Where boy(X) is called a predicate statement or expression.

Here boy is a predicate symbol and X is its argument.

When a variable X gets bound to its actual value, the predicate


2. First order Predicate logic
Predicate logic in artificial intelligence, also known as first-
order logic or first order predicate logic in AI
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.
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.

There are two types of quantifier:

Universal Quantifier, (for all, everyone, everything):


The Universal quantifier is represented by a symbol ∀

Existential quantifier, (for some, at least one). It is


denoted by the logical operator ∃,

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.
In this question the predicate is "fly(bird)."
And since there are all birds who fly so it will be represented as
follows.
∀x bird(x) →fly(x).
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:
∀x man(x) → respects (x, parent).
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:
∃x boys(x) → play(x, cricket).
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:
¬∀ (x) [ student(x) → like(x, Mathematics) ∧
like(x, Science)].
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:
∃(x) [ student(x) → failed (x, Mathematics) ∧∀
(y) [¬(x==y) ∧ student(y) → ¬failed (x, Mathematics)]
3.Interpretations of Formulae in FOL
•In propositional logic, an interpretation simply refers to an
assignment of truth values to atoms.
•Since variables are involved in FOL, we need to do more than a
simple assignment of values.
•An interpretation of a formula in FOL consists of a non empty
domain D and involves to each predicate atom.

The following results hold true for any interpretation I over a


domain D:
4.Satisfiability and Unsatisfiability in FOL

•A predicate logic sentence w is satisfiable if there


exists some interpretation in which w is true.

•A predicate logic sentence is unsatisfiable (i.e., it is


a contradiction) if it is not satifsiable (in other words,
there exists no interpretation in which it is true). As
before, we note that any sentence w is valid just in
case ¬w is unsatisfiable.

•A predicate logic sentence w is valid if it is true in all


interpretations. In other words, it is true regardless of
what the constant, function, and predicate symbols
“mean”.
5.Transformation of a Formula into Prenex Normal Form

A formula is said to be in closed form if all the variables


appearing in it are quantified and there are no free
variables.
Choice of clauses to be Resolved
If the choice of clauses that need to be resolved at each step is made in a
systematic way, the resolution algorithm
Will surely find a contradiction, if one exists.
The steps are as follows

You might also like