
 
fact(bonnie, hasSex, female), 
the first rule obviously returns the certainty Cty = -1 
(bonnie has no sex male) and the second one gives 0 
(bonnie has sex female but sex of clyde is 
unknown). Thus, the resulting Cty = 0. 
3 INFERENCE EXPLAINING 
AND VISUALIZATION 
Involvement of more than one fact in a rule that 
returns “0” significantly reduces information 
capacity and usefulness of the result, because we do 
not know which fact impedes the revealing of the 
truth of the result. For ascertainment of such missing 
facts the list of the facts with zero truth value could 
be returned in this form of a list: 
ruleconsequent, 
fact1,…,factN 
(4) 
Such a list can be interpreted as a phrase in a 
subjunctive mood: “This fact can be true, if the 
following facts are true …”. In contrast to expert 
systems where the missing facts are to be established 
in a human-machine dialogue we need not to involve 
the user to the consideration process. The resulting 
lists of uncertain facts can be analyzed 
automatically. 
The following is the modified rule which defines 
that a subject and an object are of the opposite sex: 
ternary(X,oppositeSex,Y,Cty, 
 [X,oppositeSex,Y,Cond1,Cond2]) :- 
ternary(X,hasSex,male,Cty1,Cond1), 
Cty1>=0, 
ternary(Y,hasSex,female,Cty2,Cond2), 
Cty2>=0, 
Cty is min(Cty1,Cty2). 
ternary(X,oppositeSex,Y,Cty,Cond):-  
ternary(Y,oppositeSex,X,Cty,Cond). 
The fifth argument in the ternary  predicate 
contains the list of facts needed to the fact be true. 
This argument has the empty list in facts with 
certainty values 1 and -1. 
Below is one more rule that defines the 
allowability of marriage based on conditions that the 
partners have opposite sex: 
ternary(X,canMarry,Y,Cty, 
[X,canMarry,Y,Cty,Cond):- 
ternary(X,oppositeSex,Y,Cty,Cond), 
Cty>=0. 
Let us issue the Prolog goal: 
ternary(bonnie,canMarry,clyde, 
 Cty,Explanation). 
If the knowledge base contains fact(clyde, 
hasSex, male) but no fact(bonnie, hasSex, female), 
certainty Cty = 0 and the reason is following: 
[bonnie,canMarry,clyde, 
[bonnie,oppositeSex,clyde, 
[bonnie,hasSex,female]]]. 
Now we can consider the peculiarities of 
negation operation. To include the rule with 
negation into an antecedent, the certainty of this 
condition should be inverted: 
ternary(X,canMarry,Y,Cty,[X,canMarry, 
 Y,Cty,Cond1,[‘NOT’|Cond2]):- 
ternary(X,oppositeSex,Y,Cty1,Cond1), 
Cty1>=0, 
ternary(X,bloodRelative,Y,Cty2, 
Cond2), Cty2=<0, 
Cty is min(Cty1,-Cty2). 
The above example of modified rule forbids the 
marriage of blood relatives and the reason acquired 
after query processing is following: 
[bonnie,canMarry,clyde, 
[[bonnie,oppositeSex,clyde, 
[bonnie,hasSex,female], 
[NOT,bonnie,bloodRelative,clyde]]. 
By using nested rules and large number of facts 
the inference chains can be very long so the lists of 
uncertain facts get unreadable for a man. At the 
same time the list structure of data is convenient for 
interpreting by computer. Another problem of 
explaining of inference results is layerage of 
negations that can also make the explaining difficult. 
These problems could be solved by visualization of 
uncertain facts by semantic graphs like it was shown 
for knowledge visualization (Bessmertny, 2010). 
Fig. 1 demonstrates the visualization of uncertain 
facts needed for the inference “Bonnie can marry 
Clyde” to be true.  
 
Figure 1: Visualization of uncertain facts for the inference 
“Bonnie can marry Clyde”. 
NOT
bonnie,canMarry,clyde
bonnie,oppositeSex,clyde
bonnie,
bloodRelative,clyde
bonnie,hasSex,female
AboutCreatingIntelligenceSystemsinTernaryLogic
163