Page 41 - DCAP310_INTRODUCTION_TO_ARTIFICIAL_INTELLIGENCE_AND_EXPERT_SYSTEMS
P. 41
Unit 3: Representation of Knowledge
Truth Values and Truth Tables Notes
In propositional logic, the models are (truth) valuations. A truth valuation determines which
truth value the atomic propositions get. It is a function v: var ! f0; 1g, where var is the non-empty
set of atomic propositional variables. A proposition is true if it has the value 1, and false if it has
the value 0. The truth value of falsum is always 0, so v(?) = 0 for every valuation v.
Whether a complex propositional formula is true in a given model (valuation) can be calculated
by means of truth functions, that take truth values as input and give truth values as output. To
each logical connective corresponds a truth function. They are defined as follows:
f:(1) = 0 f:(0) = 1
f^(1; 1) = 1 f^(1; 0) = 0 f^(0; 1) = 0 f^(0; 0) = 0
f_(1; 1) = 1 f_(1; 0) = 1 f_(0; 1) = 1 f_(0; 0) = 0
f!(1; 1) = 1 f!(1; 0) = 0 f!(0; 1) = 1 f!(0; 0) = 1
f$(1; 1) = 1 f$(1; 0) = 0 f$(0; 1) = 0 f$(0; 0) = 1
Example: If v(p) = 1 and v(q) = 0, then the propositional formula (p ! q) ^:q is false. To see
that this is the case, firstly, we calculate the truth value of p ! q, which is f!(v(p); v(q)) = f!(1; 0) =
0, so p ! q is false. Secondly, we calculate the truth value of :q, which is f:(v(q)) = f:(0) = 1, so:q is
true.
A fact must start with a predicate (which is an atom) and end with a fullstop. The predicate may
be followed by one or more arguments which are enclosed by parentheses. The arguments can
be atoms (in this case, these atoms are treated as constants), numbers, variables or lists. Arguments
are separated by commas.
If we consider the arguments in a fact to be objects, then the predicate of the fact describes a
property of the objects. In a Prolog program, a presence of a fact indicates a statement that is true.
An absence of a fact indicates a statement that is not true.
3.1.4 Facts and Rules
A rule can be viewed as an extension of a fact with added conditions that also have to be satisfied
for it to be true. It consists of two parts. The first part is similar to a fact (a predicate with
arguments). The second part consists of other clauses (facts or rules which are separated by
commas) which must all be true for the rule itself to be true. These two parts are separated by
“:-”. You may interpret this operator as “if” in English.
A program describes the relationships of the members in a family
father(jack, susan). /* Fact 1 */
father(jack, ray). /* Fact 2 */
father(david, liza). /* Fact 3 */
father(david, john). /* Fact 4 */
father(john, peter). /* Fact 5 */
father(john, mary). /* Fact 6 */
mother(karen, susan). /* Fact 7 */
mother(karen, ray). /* Fact 8 */
mother(amy, liza). /* Fact 9 */
mother(amy, john). /* Fact 10 */
mother(susan, peter). /* Fact 11 */
mother(susan, mary). /* Fact 12 */
parent(X, Y):- father(X, Y). /* Rule 1 */
parent(X, Y):- mother(X, Y). /* Rule 2 */
grandfather(X, Y):- father(X, Z), parent(Z, Y). /* Rule 3 */
LOVELY PROFESSIONAL UNIVERSITY 35