次のようにコードします。
DOMAINS
name = valentin; leonid; valery; andrew; michael
faculty = physics; history; biology; geography
instrument = sax; piano; bass; drums
student = student(name, instrument, faculty)
PREDICATES
nondeterm student(name, instrument, faculty)
CLAUSES
student(michael, sax, _).
student(_, piano, physics).
student(_, drums, _) :- student(leonid, _, _); student(michael, _, _); student(valentin, _, _); student(andrew, _, _).
student(_, _, geography) :- student(michael, _, _); student(valentin, _, _); student(valery, _, _); student(andrew, _, _).
student(michael, _, _) :- student(_, _, physics); student(_, _, geography); student(_, _, biology).
student(andrew, _, _) :- student(_, _, physics); student(_, _, history); student(_, _, geography).
student(andrew, _, _) :- student(_, sax, _); student(_, bass, _); student(_, drums, _).
student(valery, _, _) :- student(_, _, geography); student(_, _, biology); student(_, _, history).
student(_, drums, _) :- student(_, _, physics); student(_, _, geography); student(_, _, biology).
student(leonid, _, _) :- student(_, sax, _); student(_, piano, _); student(_, drums, _).
GOAL
student(valentin, Instrument, Faculty).
Visual Prolog 5 を使用しています。このコードはコンパイルされますが、コンパイラはバインドされていない変数があると言います: _ 行内の変数:
student(michael, sax, _).
student(_, piano, physics).
そして、geography アトムの前の行の 2 番目の _ 変数:
student(_, _, geography) :- student(michael, _, _); student(valentin, _, _); student(valery, _, _); student(andrew, _, _).
このコードを機能させることは可能ですか?