Unit 3 PDF
Unit 3 PDF
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.
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.
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.
An argument is VALID if it is impossible for the premises to be true, with the conclusion
false.
Types of logic
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:
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 -> False, It rains outside -> False
Translation:
Denote:
• r = We will go swimming
Some composite sentences may always (under any interpretation) evaluate to a single truth
value:
DeMorgan’s Laws
¬ ( P ∧ Q ) ⇔ (¬ P ∨ ¬ Q )
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
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:
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.
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.
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.
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:
Rule 1:A tableau for a formula (αΛβ) is constructed by adding both α and β to the same path
(branch). This can be represented as follows:
αΛβ
α
β
Rule 2: A tableau for a formula ~ (αΛβ) is constructed by adding two alternative paths one
containing ~ αand other containing ~ β
Rule 3: A tableau for a formula (αV β) is constructed by adding two new paths one containing
αand other containing β.
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 ~ ~ α
~~α
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.
Propositional Resolution:
Resolution rule:
αvβ
¬β v γ
αvγ
Resolution refutation:
Procedure :
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)
o If we can’t apply any more, then the conclusion cannot be proved from the
axioms.
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)
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.
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.
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.
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.
A proof must always be built from a fixed set of inference rules. The propositional
logic inference rules
A => B, A
---------
B
2. And-Elimination:
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.
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.
There is a standard algorithm that given two sentences, finds their unique most general unifying
substitution.
Notice that the substitutions always involve a variable and a ground term.
The variable x cannot have two values at the same time, so this last example fails.
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
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.
Soln :
Missile(x) ⇒ Weapon(x)
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 :