/* The shell from 11.1 must be consulted first */
r1 # if cloth_burnt
then temperature( too_high).
r2 # if temperature( too_high)
or temperature( too_low)
then temperature( wrong).
r3 # if temperature( wrong)
and thermostat( setup_correctly)
then thermostat( faulty).
r4 # if temperature( wrong)
and not thermostat( setup_correctly)
then thermostat( adjust_correctly).
r5_1 # if no_steam
then temperature( too_low).
r5_2 # if no_steam
then steam_problem.
r6_1 # if steam_problem
then no_water.
r6_2 # if steam_problem
then nozzle_congested.
r7 # if ironing_poor
then temperature( too_low).
r8 # if iron_cold
and lamp_shines
then wait.
r9 # if iron_cold
and not lamp_shines
then no_power.
s1 # symptom( cloth_burnt).
s2 # symptom( no_steam).
s3 # symptom( ironing_poor).
s4 # symptom( iron_cold).
s5 # symptom( lamp_shines).
s6 # symptom( thermostat( setup_correctly)).
d1 # diagnosis( thermostat( faulty)).
d2 # diagnosis( thermostat( adjust_correctly)).
d3 # diagnosis( no_water).
d4 # diagnosis( nozzle_congested).
d5 # diagnosis( no_power).
d6 # diagnosis( wait).
diagnose :-
shell.
askable( P) :- S # symptom( P).
goal( G) :- D # diagnosis( G).
/* Testing
?- diagnose.
*/