假设您有一个疾病诊断的Prolog程序,该程序从许多疾病和症状之间的关系开始:
我该如何创建一个名为“has_disease(Person, Disease)”的规则,以便在人患有该疾病的所有症状时返回true?使用上面的示例,下面是一种可能的输出结果:
causes_of(symptom1, Disease) :-
Disease = disease1;
Disease = disease2.
causes_of(symptom2, Disease) :-
Disease = disease2;
Disease = disease3.
causes_of(symptom3, Disease) :-
Disease = disease4.
has_symptom(person1, symptom1).
has_symptom(person1, symptom2).
我该如何创建一个名为“has_disease(Person, Disease)”的规则,以便在人患有该疾病的所有症状时返回true?使用上面的示例,下面是一种可能的输出结果:
has_disease(person1, Disease).
Disease = disease2.