Artificial Intelligence and Prolog
Copyright © 2020 Jiri Kriz,

12    Property-based Shell, Structured-based Diagnosis


12.1    Property-based Shell

The domain knowledge is represented by structuring the domain in objects with properties:

-- question : Q
-- answers : A
-- reasons : R 
-- explanation : E .

The meaning is:

Name of the object.
Question to the user (or a test).
A = [ 1: A1, 2: A2... ]:
Ai = a possible answer of the user (or the resultat of a test).
R = [ i: Gi, j: Gj, ...]:
Gi = a possible justification for G, if Ai applies. If i was the answer and Gi = true, then G is proven.
R = [ G1, G2, ...]:
G1, G2, ... are possible reasons for G, if there is no 'question' attribute Q.
Explanation (text), if G is proven

The attributes 'question' und 'answers' are optional; the attribute 'reasons' is mandatory; the attribute 'explanation' is mandatory for proven goals.

Implement the predicate

solve( G, X) /* X is the reason for the Goal G */

according to the lecture notes. The user should be asked at most once to any question.

Solution 12.1

12.2    Structured-based Diagnosis

The predicate 'solve' from the example 12.1 can be used for struktured-based diagnosis. The inferenz proceeds from symptoms to diagnoses. The interpretation of the objects in the diagnosis realm is:

object :
symptom or diagnosis
question or test (text)
reasons for a symptom (simpler symptoms) or diagnoses
explanation of a diagnosis (text)

Test the shell on the example of the diagnosis of a broken bike:

SymptomSimpler symptom or diagnosis
bike ride (driving properties), elektric (lamp)
ride wheels (difficult or clumsy riding), drive (noise), brakes
wheels tires (flat), operation (unbalanced = diagnosis)
tires valve (loose, missing = diagnosis), puncture = diagnose
operation chain (rusty = diagnosis), gears = diagnosis
brakescable = diagnosis, brake pads = diagnosis
electric lamp = diagnosis, cable = diagnosis, dynamo contact = diagnosis


-- question : 'What is the problem with your bike ?'
-- answers : [ 1 : 'driving properties', 2 : 'lamp' ]
-- reasons : [ 1: ride, 2 : electric ].

-- question : ...   .

-- reasons : [ air, valve, puncture ].

-- question: 'Is there a puncture in the tire?'
-- answers:  [ 1: yes, 2: no]
-- reasons:  [ 1: true]
-- explanation: 'There was puncture in the tire. Fix it.'.

Solution 12.2