0% found this document useful (0 votes)
7 views23 pages

Unit 3 PDF

The document provides an introduction to logic and its significance in artificial intelligence, particularly focusing on propositional logic and its components. It discusses the definitions of validity, consistency, and logical consequence, along with various logical systems, including propositional and first-order logic. Additionally, it covers inference rules, semantic tableaux, resolution refutation, and the concepts of soundness, completeness, decidability, and monotonicity in logical systems.
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)
7 views23 pages

Unit 3 PDF

The document provides an introduction to logic and its significance in artificial intelligence, particularly focusing on propositional logic and its components. It discusses the definitions of validity, consistency, and logical consequence, along with various logical systems, including propositional and first-order logic. Additionally, it covers inference rules, semantic tableaux, resolution refutation, and the concepts of soundness, completeness, decidability, and monotonicity in logical systems.
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/ 23

UNIT3

Introduction to Logic, propositional logic

The discipline of artificial intelligence (AI) studies the question of how artifacts can be ascribed
or endowed with intelligence. In other words, AI concerns questions such as to how to
'implement intelligence into artificial systems'.

Since intelligence often seems to involve some kind of reasoning it becomes clear that logic, the
science of reasoning, may play an important role in AI.The symbolistic approach to AI one may
again have different views as to the exact role of logic in this enterprise.

The most influential figure in logical AI is John McCarthy. McCarthy was one of the founders of
AI, and consistently advocated a research methodology that uses logical techniques to formalize
the reasoning problems that AI needs to solve.

One standard characterization of logic is this:

LOGIC is the science or study of valid arguments.

An argument, in the sense understood by a logician (as opposed to the sense which simply means
a “disagreement”: recall the Monty Python sketch) is an attempt to establish a conclusion.

An argument consists of some premises and a conclusion.

Given an argument, we want to know if the argument is valid. Does the conclusion follow
logically from the premises? Is the conclusion a logical consequence of the premises? To provide
a clear analysis of the logical concepts of “validity” and “logical consequence”, and to provide
methods for classifying arguments as valid or invalid, is the central task of logic.

 A set of sentences is CONSISTENT if it is possible for them all to be simultaneously


true.

 An argument is VALID if it is impossible for the premises to be true, with the conclusion
false.

 A statement is a LOGICAL CONSEQUENCE of some assumptions or premises just in


case, if the assumptions are true of any situation, then so must be the conclusion.

Types of logic

Different types of logics possible:

1. Propositional logic

2. First-order logic
3.4.2. Propositional logic

An atomic sentence consists of a single propositional symbol, representing a Proposition that can
be true or false.

A literal is a propositional symbol or its negation. Complex sentences are constructed from
simpler sentences using logical connectives:

¬(not), ∧(and), ∨(or), → (implies), and ↔ (iff)

There are several relationships between propositions that can be expressed:

Syntax of Propositional Logic:

Formulas also are called sentences or propositions

Semantics:

A propositional symbol
• a statement about the world that is either true or false Examples:
– Pitt is located in the Oakland section of Pittsburgh
– It rains outside
– Light in the room is on
An interpretation maps symbols to one of the two values:

True (T), or False (F), depending on whether the symbol is satisfied in the world

I: Light in the room is on -> True, It rains outside -> False

I’: Light in the room is on -> False, It rains outside -> False
Translation:

Assume the following sentences:

• It is not sunny this afternoon and it is colder than yesterday.

• We will go swimming only if it is sunny.

• If we do not go swimming then we will take a canoe trip.

• If we take a canoe trip, then we will be home by sunset.

Denote:

• p = It is sunny this afternoon

• q = it is colder than yesterday

• r = We will go swimming

• s= we will take a canoe trip

• t= We will be home by sunset

It is not sunny this afternoon and it is colder than yesterday. ¬ p ∧ q

We will go swimming only if it is sunny r → p

If we do not go swimming then we will take a canoe trip ¬ r → s

If we take a canoe trip, then we will be home by sunset. s→ t


Contradiction and Tautology:

Some composite sentences may always (under any interpretation) evaluate to a single truth
value:

• Contradiction (always False) P ∧ ¬ P

• Tautology (always True) P∨¬P

DeMorgan’s Laws

¬ ( P ∧ Q ) ⇔ (¬ P ∨ ¬ Q )

Model, validity and satisfiability

A model (in logic): An interpretation is a model for a set of sentences if it assigns true to each
sentence in the set.

A sentence is satisfiable if it has a model; – There is at least one interpretation under which the

sentence can evaluate to True.

A sentence is valid if it is True in all interpretations – i.e., if its negation is not satisfiable (leads
to contradiction)

Example :
Inference rules for logic:

Logical Equivalences:

Resolution

• A powerful inference rule that yields a sound and complete inference algorithm when coupled
with a complete search algorithm:

- Where (a and γ) is called a resolvent.

Resolution Algorithm

• Proof by contradiction, i.e., show "KB and not a" is unsatisfiable:


Deleting Strategy

• Unlimited applications of resolution may generate irrelevant and redundant clauses:

Properties of Resolution Algorithm

• It’s easy to show that resolution algorithm is sound, but is it also complete?

• Resolution closure: the set of all clauses derived from the applications of resolution. Is it
finite?

• Ground resolution theorem: if a set of clauses is unsatisfiable, then their closure contains an
empty clause.

3.4.3. Lecture 20: Axiomatic system

Axiomatic systems are the oldest and simplest to describe (but not to use!) type of deductive
systems. Axiomatic systems use very few and simple rules of inference, but are based on
Axioms.

Here we will build a hierarchy of axiomatic systems for the propositional logic, by gradually
adding axioms for the logical connectives.

If we assume that the only logical connectives are ⌐ and → and all others are definable in
terms of them, then the axiomatic system comprises the following axioms and rules:
A formula A which can be derived by using the axioms and applying successively Modus
Ponens is said to be derivable in H, or a theorem of H, which we will denote by ├H A.

Using H one can derive logical consequences, too. In order to derive”If A1… An then B" we add
the premises A1… A to the set of axioms and try to derive B. If we succeed, we say that B is
derivable in H from the assumptions A1… An, denoted A1… An ├H B.
One can check that all axioms of H are tautologies and therefore, since the rule Modus Ponens is
valid, H can only derive tautologies when using these axioms as premises.

By the same argument, H can only derive valid logical consequences. Therefore, the axiomatic
system H is sound, or correct. In fact, it can be proved that H can derive all valid logical
consequences, and in particular, all tautologies, i.e., it is complete. Thus, H captures precisely the
notion of propositional logical consequence.

3.4.4. Lecture 21 and 22: Semantic tableau system in PL

The method of semantic tableaux is an efficient decision procedure for satisfiability (and by
duality validity) in propositional logic.

The principle behind semantic tableaux is very simple: search for a model (satisfying
interpretation) by decomposing the formula into sets of atoms and negations of atoms. It is easy
to check if there is an interpretation for each set: a set of atoms and negations of atoms is
satisfiable iff the set does not contain an atom p and its negation ¬p. The formula is satisfiable
iff one of these sets is satisfiable.

Construction of Semantic Tableaux:

In the method of semantic tableaux, sets of formulas label nodes of a tree, where each path in the
tree represents the formulas that must be satisfied in one possible interpretation

.
Semantic Tableaux Rules:

Let α and β be any two formulae.

Rule 1:A tableau for a formula (αΛβ) is constructed by adding both α and β to the same path
(branch). This can be represented as follows:

αΛβ
α
β

Interpretation: αΛβis true if both αand βare true

Rule 2: A tableau for a formula ~ (αΛβ) is constructed by adding two alternative paths one
containing ~ αand other containing ~ β

Interpretation: ~ (αΛβ) is true if either ~ α or ~ β is true

Rule 3: A tableau for a formula (αV β) is constructed by adding two new paths one containing
αand other containing β.

Interpretation: αV β is true if either α or β is true

Rule 4: A tableau for a formula ~ (αV β) is constructed by adding both ~ α and ~ β to the same
path. This can be expressed as follows:

~ ( αV β)


Rule 5: Semantic tableau for ~ ~ α

~~α

Rule 6: Semantic tableau for α→β

Rule 7: Semantic tableau for ~ ( α→β)

Since tableau for α has open paths, we conclude that α is consistent. The models are constructed
by assigning T to all atomic formulae appearing on open paths.

3.4.5. Resolution refutation in PL

Propositional Resolution:

Resolution rule:

αvβ
¬β v γ

αvγ

Resolution refutation:

When resolution is used to prove inconsistency, it is when resolution is used to prove


inconsistency, it is called refutation (refute=disprove)

Procedure :

 Convert all sentences to CNF

 Negate the desired conclusion (converted to CNF)

 Apply resolution rule until either

 Derive false (a contradiction)

 Can’t apply any more

Example 1.:

The above binary tree, showing resolution and resulting in the empty clause, is called a refutation

tree.

Example 2:
C={C1, C2, ..., C8} is inconsistent (by resolution refutation)

Therefore Q is provable (deducible)

Answer: YES (true)

 Resolution refutation is sound and complete

o If we derive a contradiction, then the conclusion follows from the axioms

o If we can’t apply any more, then the conclusion cannot be proved from the
axioms.

3.4.6. Predicate Logic

 The type of predicate calculus that we have been referring to is also called firstorder
predicate logic (FOPL).
 A first-order logic is one in which the quantifiers  and  can be applied to objects or
terms, but not to predicates or functions.
 So we can define the syntax of FOPL as follows. First,we define a term:
 A constant is a term.
 A variable is a term. f(x1, x2, x3, . . . , xn) is a term if x1, x2, x3, . . . , xn are all terms.
 Anything that does not meet the above description cannot be a term.
 For example, the following is not a term: x P(x). This kind of construction we call a
sentence or a well-formed formula (wff), which is defined as follows.
 In these definitions, P is a predicate, x1, x2, x3, . . . , xn are terms, and A,B are wff ’s.
The following are the acceptable forms for wff ’s:
P(x1, x2, x3, . . . , xn)

¬A, A Λ B, A V B, A→B, A↔ B, (x)A, (x)A

 An atomic formula is a wff of the form P(x1, x2, x3, . . . , xn).


 Higher order logics exist in which quantifiers can be applied to predicates and functions,
and where the following expression is an example of a wff:

Soundness

 We have seen that a logical system such as propositional logic consists of a syntax, a
semantics, and a set of rules of deduction.
 A logical system also has a set of fundamental truths, which are known as axioms.

 The axioms are the basic rules that are known to be true and from which all other
theorems within the system can be proved.

 An axiom of propositional logic, for example, is A→(B→A)

 A theorem of a logical system is a statement that can be proved by applying the rules of
deduction to the axioms in the system.

 If A is a theorem, then we write ├ A

 A logical system is described as being sound if every theorem is logically valid, or a


tautology.

 It can be proved by induction that both propositional logic and FOPL are sound.

 Completeness
 A logical system is complete if every tautology is a theorem—in other words, if every
valid statement in the logic can be proved by applying the rules of deduction to the
axioms. Both propositional logic and FOPL are complete.

 Decidability
 A logical system is decidable if it is possible to produce an algorithm that will
determine whether any wff is a theorem. In other words, if a logical system is
decidable, then a computer can be used to determine whether logical expressions in
that system are valid or not.
 We can prove that propositional logic is decidable by using the fact that it is
complete.
 We can prove that a wff A is a theorem by showing that it is a tautology. To show if a
wff is a tautology, we simply need to draw up a truth table for that wff and show that
all the lines have true as the result. This can clearly be done algorithmically because
we know that a truth table for n values has 2n lines and is therefore finite, for a finite
number of variables.
 FOPL, on the other hand, is not decidable. This is due to the fact that it is not possible
to develop an algorithm that will determine whether an arbitrary wff in FOPL is
logically valid.

 Monotonicity
 A logical system is described as being monotonic if a valid proof in the system cannot
be made invalid by adding additional premises or assumptions.
 In other words, if we find that we can prove a conclusion C by applying rules of
deduction to a premise B with assumptions A, then adding additional assumptions
A¬ and B¬ will not stop us from being able to deduce C.

 Monotonicity of a logical system can be expressed as follows:


If we can prove {A, B} ├ C, then we can also prove: {A, B, A_, B_} ├ C.

 In other words, even adding contradictory assumptions does not stop us from making
the proof in a monotonic system.

 In fact, it turns out that adding contradictory assumptions allows us to prove anything,
including invalid conclusions. This makes sense if we recall the line in the truth table
for →, which shows that false → true. By adding a contradictory assumption, we
make our assumptions false and can thus prove any conclusion.

3.4.7. Skolemization in FOPL

Inference rules for FOL


A computer program, i.e. an AI agent, cannot do proofs by somehow magically
"understanding" sentences and "thinking" about their meanings.

A proof must always be built from a fixed set of inference rules. The propositional
logic inference rules

Remember the inference rules for propositional logic:

1. Modus Ponens or Implication-Elimination:

A => B, A
---------
B

2. And-Elimination:

A1 and A2 and ... An


--------------------
Ai
3. And-Introduction:

A1, A2, ... An


--------------------
A1 and A2 and ... An

4. Or-Introduction:

Ai
------------------
A1 or A2 or ... An
5. Double-Negation Elimination:

NOT(NOT(A))
-----------
A
6. Unit Resolution:

A or B, NOT(B)
---------------
A
7. Resolution:

A or B, NOT(B) or C
-------------------
A or C
These rules are still valid for FOL.

A, B, and C are now atomic sentences (ie, a predicate or Term=Term, no negation).

Substitution

We need some way to deal with variables and the quantifiers "EXISTS" and "FORALL".
To describe inference rules involving variables and quantifiers, we need the notion of
"substitution".
Let alpha be any sentence and let theta be a substitution list:
theta = {x/fred, y/z, ...}
The notation SUBST(theta, alpha) will denote the result of applying the substitution theta to the
sentence alpha Intuitively subst(x := g, alpha) is alpha with every appearance of x replaced by g.
Notice that this is a syntactic operation on sentences. Any operation involved in a proof has to be
syntactic: it has to just manipulate and transform sentences.
Elimination and Introduction
Many inference rules tell how how to get rid of (eliminate) or introduce a connective or
quantifier into a formula.

The "universal elimination" rule lets us use a universally quantified sentence to reach a specific
conclusion, i.e. to obtain a concrete fact.

FORALL x alpha
---------------------
SUBST({x/g} alpha)
Here g may be any term, including any term that is used elsewhere in the knowledge base.

The "existential elimination" rule lets us convert an existentially quantified sentence into a form
without the quantifier.

EXISTS x alpha
---------------------
SUBST({x/k} alpha)
Here k must be a new constant symbol that does not appear anywhere else in the database. It is
serving as a new name for something we know must exist, but whose name we do not yet know.
The "existential introduction" rule lets us use a specific fact to obtain an existentially quantified
sentence:

alpha
------------------------------
EXISTS y SUBST({g/y}, alpha)
This rule can be viewed as "leaving out detail": it omits the name of the actual entity that
satisfies the sentence alpha, and just says that some such entity exists.

Skolemization:

The "existential elimination" rule is also called the Skolemization rule, after a mathematician
named Thoralf Skolem.

EXISTS x alpha
--------------------
subst({x/k}, alpha) where k is a FRESH constant
Saying that k is a "fresh" constant means that k is not used anywhere else in the knowledge base.
This means that k can be the name of a new entity that is not named and therefore not referred to
anywhere else in the knowledge base.
Example 1

∃x ∀y Loves(x, y)
is satisfiable if there is an x that makes Loves(x, y) true no matter the y.
The value of x must be the same for any y. Replace x by a fresh constant, say, S.

∀y Loves(S, y)
S is called a Skolem constant.

Example 2

∀y ∃x Loves(x, y)
is satisfiable if for each y we can find an x that makes Loves(x, y) true.
The value of x can change depending on y. Replace x by a fresh function of y, say, Lover(y).

∀y Loves(Lover(y), y)
Lover is called a Skolem function symbol
Horn clauses
Generalized modus ponens requires sentences to be in a standard form, called Horn clauses after
the mathematician Alfred Horn.
A Horn clause is a sentence of the form
q1 AND q2 AND ... AND qn -> r
Where each qi and r is an atomic sentence and all variables are universally quantified.

Conversion to Clause Form:


Procedure:
1. Eliminate implications
2. Move ¬ inwards
3. Standardize bound variables apart
4. Move quantifiers out
5. Skolemize existential variables
6. Eliminate universal quantifiers
7. Distribute ∨ over ∧
8. Flatten conjunctions and disjunctions
9. Eliminate conjunctions

Example : {∀x (∀y P(x, y)) → ¬(∀y Q(x, y) → R(x, y))}


1. Eliminate implications:

{∀x ¬(∀y P(x, y)) ∨ ¬(∀y ¬Q(x, y) ∨ R(x, y)))}


2. Move ¬ inwards

{∀x (∃y ¬P(x, y)) ∨ (∃y Q(x, y) ∧ ¬R(x, y))}


{∀x (∃y ¬P(x, y)) ∨ (∃y Q(x, y) ∧ ¬R(x, y))}
3. Standardize bound variables apart

{∀x (∃y ¬P(x, y)) ∨ (∃z Q(x, z) ∧ ¬R(x, z))}


4. Move quantifiers out

{∀x ∃y ∃z ¬P(x, y) ∨ (Q(x, z) ∧ ¬R(x, z))}\


{∀x ∃y ∃z ¬P(x, y) ∨ (Q(x, z) ∧ ¬R(x, z))}
5. Skolemize existential variables

{∀x ¬P(x, F1(x)) ∨ (Q(x, F2(x)) ∧ ¬R(x, F2(x)))}


6. Eliminate universal quantifiers

{¬P(x, F1(x)) ∨ (Q(x, F2(x)) ∧ ¬R(x, F2(x)))}


{¬P(x, F1(x)) ∨ (Q(x, F2(x)) ∧ ¬R(x, F2(x)))}
7. Distribute ∨ over ∧

{(¬P(x, F1(x)) ∨ Q(x, F2(x))) ∧ (¬P(x, F1(x)) ∨ ¬R(x, F2(x)))}


8. Flatten conjunctions and disjunctions

{(¬P(x, F1(x)) ∨ Q(x, F2(x))) ∧ (¬P(x, F1(x)) ∨ ¬R(x, F2(x)))}


After step 8 each sentence in the set is in Conjunctive Normal Form
(CNF): (_1 ∨ ・ ・ ・ ∨ _m) ∧ (_1 ∨ ・ ・ ・ ∨ _n) ∧ ・ ・ ・
{(¬P(x, F1(x)) ∨ Q(x, F2(x))) ∧ (¬P(x, F1(x)) ∨ ¬R(x, F2(x)))}
9. Eliminate conjunctions

{¬P(x, F1(x)) ∨ Q(x, F2(x)), ¬P(x, F1(x)) ∨ ¬R(x, F2(x))}

3.4.8. Resolution in FOPL

The unification algorithm

There is a standard algorithm that given two sentences, finds their unique most general unifying
substitution.

Here are some examples of unification.

Knows (John, x) = Likes (John, x)


Knows (John, Jane)
Knows(y, Leonid)
Knows(y, Mother(y))

The unification algorithm would give the following results:

UNIFY(Knows(John,x), Knows(John,Jane)) = {x/Jane}


UNIFY(Knows(John,x), Knows(y,Leonid)) = {x/Leonid, y/John}

The substitution makes the two sentences identical.

UNIFY (Knows(John,x), Knows(y,Mother(y))) = {x/John, x/Mother(John)}

Notice that the substitutions always involve a variable and a ground term.

UNIFY(Knows(John,x), Knows(x,Elizabeth)) = fail

The variable x cannot have two values at the same time, so this last example fails.

Another example that would always fail is UNIFY(x, F(x)) = fail


This fails because a variable may never occur in the term it is being unified with.

Resolution by Refutation:

A proof by contradiction is also called a refutation. The resolution rule with factoring a is a
refutation-complete

Inference system: if a set of clauses is unsatisfiable, then False is provable from it by resolution

Example Knowledge Base:

The law says that it is a crime for an American to sell weapons to hostile nations. The
country Nono, an enemy of America, has some missiles, and all of its missiles were sold to it
by Colonel West, who is American.

Prove that Col. West is a criminal

Soln :

1. it is a crime for an American to sell weapons to hostile nations:

American(x) ∧Weapon(y) ∧ Sells(x, y, z) ∧ Hostile(z) =⇒Criminal(x)

2. Nono has some missiles, i.e., ∃ x Owns (Nono, x) ∧Missile(x):

Owns (Nono,M1) and Missile(M1)

3. all of its missiles were sold to it by Colonel West

∀ x Missile(x) ∧ Owns(Nono, x) =⇒ Sells(West, x,Nono)

4. Missiles are weapons:

Missile(x) ⇒ Weapon(x)

5. An enemy of America counts as “hostile”:

Enemy(x,America) =⇒ Hostile(x)
A resolution-based inference system has just one rule to apply to build a proof.

However, at any step there may be several possible ways to apply the resolution rule.

Several resolution strategies have been developed in order to reduce the search space.

Weblinks :

1. http://homepage.cs.uiowa.edu/~tinelli/classes/145/Fall05/notes/9-
inference.pdf

2, http://www.sdsc.edu/~tbailey/teaching/cse151/lectures/chap09a.html

3. https://people.cs.pitt.edu/~milos/courses/cs2710/lectures/Class9.pdf

4. artint.info/html/ArtInt_102.html

Essay questions :

1. Explain in detail about Axiomatic system


2. Explain in detail about Semantic tableau system
3. Infer[(A→B)˄(B→C)]→(A→C) using natural deduction system
4. Prove the theorem {A, (B→(A→C))}Ⱶ B→C using Axiomatic System
5. Construct semantic tableau for a formula (A˄~B) ˄(~B→C)
6. Determine the formula (~A˅B)→(A→B) consistent or inconsistent using tableau method
7. Show that the formula ((A→(B→C))→[(A˄B)→C] is valid by giving tableau proof.
8. Show that (~U˄S) is a logical consequence of { A˅C,~C→B,~B,A→S,~U}
9. Transform the formula ∀𝑥 ∃𝑦 [𝑞(𝑥, 𝑦) → 𝑝(𝑥)] into PNF and then Skolem standard
Form

Short answer questions:

1. What are the elements of natural language?


2. Give the examples for objects , relations and functions.
3. Define propositional logic
4. What is First-order logic?
5. What is term and ground term in First-order logic.?
6. Define unification.
7. Define Skolemization.
8. What is clausal form? How is it useful?
9. Define a well-formed formula (wff).
10. List some of the rules of inference.
11. What is resolution /refutation?

You might also like