Satchmo ( " " ) -
. SATCHMO: , Prolog. 9- , . 415-434. Springer-Verlag, 1988.
Prolog Satchmo . . Satchmo, RACE Attempto Controlled English:
:- op(1200, xfx, '--->').
:- unknown(_, fail).
satisfiable :-
setof(Clause, violated_instance(Clause), Clauses),
!,
satisfy_all(Clauses),
satisfiable.
satisfiable.
violated_instance((B ---> H)) :-
(B ---> H),
B,
\+ H.
satisfy_all([]).
satisfy_all([(_B ---> H) | RestClauses]) :-
H,
!,
satisfy_all(RestClauses).
satisfy_all([(_B ---> H) | RestClauses]) :-
satisfy(H),
satisfy_all(RestClauses).
satisfy((A;B)) :-
!,
(satisfy(A) ; satisfy(B)).
satisfy(Atom) :-
\+ Atom = untrue,
(
predicate_property(Atom, built_in)
->
call(Atom)
;
assume(Atom)
).
assume(Atom) :-
% nl, write(['Asserting ': Atom]),
asserta(Atom).
assume(Atom) :-
% nl, write(['Retracting ': Atom]),
retract(Atom),
!,
fail.