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

Ai - 2

Here are the sentences in symbolic form using predicate logic: 1. ∀x(Student(x) → Clever(x)) This translates to "For all x, if x is a student, then x is clever".

Uploaded by

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

Ai - 2

Here are the sentences in symbolic form using predicate logic: 1. ∀x(Student(x) → Clever(x)) This translates to "For all x, if x is a student, then x is clever".

Uploaded by

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

UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

Course Name : AI & ML


UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• What is Proposition?
• A proposition (or a statement) is classified as a
declarative sentence to which only one of the
truth values. i.e. true or false.
• Example: New Delhi is the capital of India. (T)
• The square of 4 is 16. (T)
• The cube of 5 is 122. (F)
• Bring me coffee. (Not a proposition)
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• CONNECTIVES (PROPOSITIONAL CONNECTIVES OR LOGICAL CONNECTIVES)

• There are five basic connectives:


• (i) Negation (NOT)
• (ii) Conjunction (AND)
• (iii) Disjunction (OR)
• (iv) Implication (IF THEN )
• (v) If and Only If. (IFF)
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

P (Proposition) NOT P
T F
F T

Truth Table for NOT

P Q P AND Q
F F F
F T F
T F F
T T T

Truth Table for AND


UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

P Q P OR Q
F F F
F T T
T F T
T T T

Truth Table for OR


UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

P Q PQ
F F T
F T T
T F F
T T T

Truth Table for IF THEN


UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

P Q P<->Q
F F T
F T F
T F F
T T T

Truth Table for IF and only IF


UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• Few Definitions:
• When a statement cannot be logically broken
into smaller statements, we call it atomic.
• Let r be a propositional formula, constructed
by connecting atomic propositions p, q, s, etc.
by operators. An interpretation for r is a
function that maps v (p), v (q) and v (s) into
true or false values that together keep r true.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• A propositional formula is called satisfiable if


its value is true for some interpretation.
• A propositional formula is unsatisfiable or
contradictory if it is not satisfiable, i.e., for no
interpretation it is true.
• A propositional formula is called valid or
tautology, when it is true for all possible
interpretations.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

Example
• If P represents 'This book is good' and Q
represents 'This book is cheap',
• write the following sentences in symbolic form:
• (a) This book is good and cheap.
• (b) This book is not good but cheap.
• (c) This book is costly but good.
• (d) This book is neither good nor cheap.
• (e) This book is either good or cheap.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• Translate the following sentences into


propositional forms:
• (a) If it is not raining and I have the time, then
I will go to a movie.
• (b) It is raining and I will not go to a movie..
• (c) It is not raining.
• (d) I will not go to a movie.
• (e) I will go to a movie if only if it is not raining.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

Well Formed Formula


UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

WFF Example
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• Theorem Proving by Propositional Logic


• i) Semantic
• ii) Syntactic
• Semantic method involves forward chaining and
backward chaining method.
• Forward chaining: When all the premises are true,
check whether the conclusion is true. Under this
circumstance, we say that forward chaining holds good.
• Backward chaining: When all the consequences are
false, check whether at least one of the premises is
false.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• Approach for Syntactic Prove


• Method of Substitution
• By this method, left-hand side (or right-hand side) of the
statement to be proved is chosen and the standard formulas,
presented above, are applied selectively to prove the other
side of the statement.
• Ex : Prove the contraposition theorem.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• RULES OF INFERENCE FOR PROPOSITIONAL CALCULUS


• In logical reasoning, a certain number of propositions are
assumed to be true and based on that assumption some other
propositions are derived (deduced or inferred).
• The propositions that are assumed to be true are called
hypotheses or premises.
• The proposition derived by using the rules of inference is
called a conclusion.
• The process of deriving conclusions based on the assumption
of premises is called a valid argument.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

Check the validity of the following argument:


• If Ram has completed B.E. (Computer Science)
or MBA, then he is assured of a good job. If
Ram is assured of a good job, he is happy. Ram
is not happy. So Ram has not completed MBA.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

Resolution in Propositional Logic


• Resolution theorem:
• For any three clauses p, q and r,
• p ∨ r, q ∨ ¬ r ⇒ p ∨ q
• The resolution theorem can also be used for
theorem proving and reasoning in
propositional logic.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• Resolution algorithm
• Input: A set of clauses, called axioms and a goal.
• Output: To test whether the goal is derivable from the axioms.
• Begin
• 1. Construct a set S of axioms plus the negated goal.
• 2. Represent each element of S into conjunctive normal form (CNF) by the
following steps:
• a) Replace ‘if-then’ operator by NEGATION and OR operation by theorem 10.
• b) Bring each modified clause into the following form and then drop AND
operators connected between each square bracket. The clauses thus obtained
are in conjunctive normal form (CNF). It may be noted that pij may be in
negated or non-negated form.
[ p 11 ∨ p12 ∨ …….. ∨ p1n ] ∧
[ p21 ∨ p22∨….. …∨ p2n ] ∧
……………………………………………
[ pm1 ∨ p m2 ∨ ∨ pm n ]
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• 3. Repeat
• a) Select any two clauses from S, such that one clause
contains a negated literal and the other clause contains
its corresponding positive (non-negated) literal.
• b) Resolve these two clauses and call the resulting
clause the resolvent. Remove the parent clauses from
S.
• Until a null clause is obtained or no further progress
can be made.
• 4. If a null clause is obtained, then report: “goal is
proved”.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• Example:
• Consider the following knowledge base:
• 1. The-humidity-is-high ∨ 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
• and the goal : it-will-rain.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

Soundness and Completeness


• Soundness refers to the correctness of the
proof procedure.
• Completeness implicates that all the possible
inferences can be derived by using the
algorithm.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• Predicate Logic
• Predicate logic (also called first order
predicate logic) has a similar formalism like
propositional logic.
• It includes two more quantifiers, namely, the
essential quantifier (∀) and the existential
quantifier (∃).
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• Knowledge 1 : All boys like sweets.


• Using predicate logic, we can write the above
statement as
• ∀ X ( Boy ( X ) → Likes (X , sweets))
• Knowledge 2 : Some boys like flying kites.
• Using predicate logic, the above statement can be
represented as
• ∃X ( Boy (X) → Likes (X, Flying-kites))
• Note: The symbol ∀ can be read as 'for every', 'for
any', 'for each', 'for arbitrary'. The symbol ∃ can be
read as 'for some', for 'at least one'.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

Alphabets of FOL
• 1. Constants: a, b, c
• 2. Variables: X, Y, Z
• 3. Functions: f, g, h
• 4. Operators: Λ, ∨ , ¬ , →
• 5. Quantifiers: ∀ , ∃
• 6. Predicate: P, Q, R
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• Few Definitions:
• A term is defined recursively as being a constant, variable
or the result of application of a function to a term.
• e.g., a, x, t(x), t(g(x)) are all terms.
• Function denotes relations defined on a domain D. They
map n elements (n >0) to a single element of the
domain. “father-of”, “age-of” represent function
symbols.
• Predicate symbols denote relations or functional
mappings from the elements of a domain D to the values
true or false. Capital letters such as P,Q, MARRIED,
EQUAL are used to represent predicates.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

Express the following sentences involving


predicates in symbolic form:
• 1. All students are clever.
• 2. Some students are not successful.
• 3. Every clever student is successful.
• 4. There are some successful students who are
not clever.
• 5. Some students are clever and successful.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• The sentences of FOL are well-formed-formulas


(WFF), defined as follows:
• 1. If P (t1, t2, … , tn) is an n-ary predicate, then P is
an atomic formula.
• 2. An atomic formula is a well-formed formula
(WFF).
• 3. If P and Q are WFF then P ∧ Q, P ∨ Q, ¬ P, P →
Q are all WFF. Note that ∀X R (X) is also an WFF.
• 4. If P is a WFF and X is not a quantified variable in P,
then P remains a WFF even after quantification
• e.g., ∀X P or ∃X P are WFF.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• A predicate formula is valid if for all possible


assignments of values from any universe of
discourse to free variables, the resulting
propositions have the truth value T.
• A predicate formula is satisfiable if for some
assignment of values to predicate variables the
resulting proposition has the truth value T.
• A predicate formula is unsatisfiable if for all
possible assignments of values from any universe
of discourse to predicate variables the resulting
propositions have the truth value F.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

Rewrite the following sentences in FOL.


• 1. Coconut-crunchy is a biscuit.
• 2. Mary is a child who takes coconut-crunchy.
• 3. John loves children who take biscuits.
• 4. John loves Mary.
The above statements can be represented in FOL using two
quantifiers X & Y.
• 1. Biscuit (coconut-crunchy)
• 2. Child (mary) ∧ Takes (mary, coconut-crunchy)
• 3. ∀X ((Child (X ) ∧ ∃Y (Takes (X, Y) ∧ Biscuit (Y ))) →Loves
(john, X)
• 4. Loves (john, mary)
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• RULES OF INFERENCE FOR PREDICATE CALCULUS


• All the rules of inference for the proposition formulas are also
applicable to predicate calculus wherever necessary.
• For predicate formulas not involving connectives such as A(x),
P(x, y). We can get equivalences and rules of inference.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• Example:
Discuss the validity of the following argument:
• All graduates are educated.
• Ram is a graduate.
• Therefore. Ram is educated
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

• Robinson’s Inference Rule


• Consider predicates P, Q1, Q2 and R.
• Let us assume that with appropriate
substitution S, Q1 [S] = Q2 [S] .
• Then (P ∨ Q1) ∧ (Q2 ∨ R) with Q1 [S] = Q2 [S]
yields ( P ∨ R) [S].
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

Concept of Semi-decidability
• A sound and complete proof method is able to
prove the validity of a formula. But if the
formula is invalid, the proof procedure (by
resolution principle or otherwise) will never
terminate. This is called semi-decidablity. FOL
is semi-decidable, as it is unable to prove the
invalidity of a formula.
UNIVERSITY OF ENGINEERING & MANAGEMENT, KOLKATA

Thank You

You might also like