Page 96 - DCAP310_INTRODUCTION_TO_ARTIFICIAL_INTELLIGENCE_AND_EXPERT_SYSTEMS
P. 96
Introduction to Artificial Intelligence & Expert Systems
Notes the consequent, and the sentence to the right is called the antecedent. The reduction of p to q is
shown below:
(p ⇐ q)
Equivalence is a combination of an implication and a reduction. For example, we can express the
equivalence of p and q as shown below:
(p ⇔ q)
Note that the constituent sentences within any compound sentence can be either simple sentences
or compound sentences or a mixture of the two. For example, the following is a legal compound
sentence.
((p ∨ q) ⇒ ¬r)
One disadvantage of our notation, as written, is that the parentheses tend to build up and need
to be matched correctly. It would be nice if we could dispense with parentheses, e.g. simplifying
the preceding sentence to the one shown below:
p ∨ q ⇒ ¬r
Unfortunately, we cannot do without parentheses entirely, since then we would be unable to
render certain sentences unambiguously. For example, the sentence shown above could have
resulted from dropping parentheses from either of the following sentences:
((p ∨ q) ⇒ ¬r)
(p ∨ (q ⇒ ¬r))
The solution to this problem is the use of operator precedence. The following gives a hierarchy
of precedence for our operators.
The ¬ operator has higher precedence than ∧; ∧ has higher precedence than ∨; and ∨ has higher
precedence than ⇒, ⇐, and ⇔.
¬
∧
∨
⇒ ⇐ ⇔
In unparenthesized sentences, it is often the case that an expression is flanked by operators, one
on either side. In interpreting such sentences, the question is whether the operator associates
with the operator on its left or the one on its right. We can use precedence to make this
determination. In particular, we agree that an operand in such a situation always associates with
the operator of higher precedence. When an operand is surrounded by operators of equal
precedence, the operand will be associated to the left. The following examples show how these
rules work in various cases. The expressions on the right are the fully parenthesized versions of
the expressions on the left.
¬ p ∧ q (¬ p ∧ q)
p ∧ ¬q (p ∧ ¬q)
p ∧ q ∨ r ((p ∧ q) ∨ r)
p ∨ q ∧ r (p ∨ (q ∧ r)
p ⇒ q ⇒ r ((p ⇒ q) ⇒ r)
p ⇒ q ⇐ r ((p ⇒ q) ⇐ r)
Note that just because precedence allows us to delete parentheses in some case does not mean
that we can dispense with parentheses entirely. Consider the example shown above. Precedence
eliminates the ambiguity by dictating that the unparenthesized sentence is an implication with
90 LOVELY PROFESSIONAL UNIVERSITY