Information Technology Reference
In-Depth Information
QUERY
>
myinverseN
|| True
[ [ False True ] [ True False ] [ True True ] ]
QUERY
>
myinverseN
|| False
[ [ False False ] ]
QUERY
>
myinverseN
&& True
[ [ True True ] ]
QUERY
>
myinverseN
&& False
[ [ False False][False True ] [ True False ] ]
The principle of selecting the action is very simple and can be illustrated using the
Truth Table for 'implies' (see Table
3.1
).
The requirement is to chose a condition that can potentially give two possible
results that will make the rule (last column '
A implies B'
) either
True
or
False
.
The first is to consider a positive example where A is a
vowel
. There are only two
possibilities given in lines 1 and 2 where:
'
Aisavowel
'is
True
. E.g. 'A'
The first possibility is if '
A is a vowel'
is '
True'
. In this case there are two potential
results for '
Vowel implies Even',
which depends upon the two possible truth-values
of the statement '
BisEven'
given in lines 1 = True and 2 = False). Hence we need
to examine the negative case in which B is odd, since the rule will not be supported
if it turns out that '
A is a vowel'
:
'
Biseven
'is
False
(i.e. B is odd). E.g. #7
The two conditions { ['
Aisavowel
'is
True]
overlap when ['
Biseven
'is
False
(i.e. B is odd)] }, and this only occurs when '
A implies B
'is
False
(Line 2)
. So this
is the line that should be used to test the hypothesis where we have the pattern [
True
False
] for tests [
isvowel iseven
]. Thus 'A
isvowel
False
'. In
the function '
matchresult
' the variable?10 in the example below can be either
True
or
False
. Given a list of pairs of values (e.g. [ [?10 False ] [
True?10
] ]), two truth
tests (e.g. [ isvowel iseven]), and a value (e.g. 'A'), the tests are both applied to the
value, and the resulting pair of results is checked for a match against each pair in
the list of possibilities. Only one of the possibilities needs to match for a result to be
True
. To make clear how this matching is taking place, the alternatives are expanded
so that we have the following possibilities:
=
True
' or '#7
iseven
=
QUERY
>
matchresult
[ [?10 False ] [
True?10
]][
isvowel
iseven] '
A
'
True
Here it is
True
that '(
isvowel
'A') is True'
QUERY
>
matchresult
[ [?10 False ] [
True?10
]][
isvowel
iseven] '
B
'
False
Here it is
False
that '(
isvowel
'B') is True'
QUERY
>
matchresult
[ [?10
False
] [ True?10 ] ] [isvowel
iseven
]
#4
False
Here it is
False
that '(
iseven
#4) is False'