mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +00:00
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
Make these tests use four-space indentation, and ensure that
each module is imported on its own line. (I intend to use the latter
to figure out which subdirectories' tests can be executed in parallel.)
These changes usually move code to different lines. For the debugger tests,
specify the new line numbers in .inp files and expect them in .exp files.
76 lines
1.8 KiB
Mathematica
76 lines
1.8 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% The "model_elim.app" Benchmark
|
|
% Part of the DPPD Library.
|
|
%
|
|
% This benchmark uses the Poole-Goebel model elimination theorem prover
|
|
% used by Andre de Waal and John Gallager. The FOL object theory for
|
|
% this particular benchmark represents the append program. The program
|
|
% contains no negations nor built-in's.
|
|
|
|
solve((G1, G2), []) :-
|
|
solve(G1, []),
|
|
solve(G2, []).
|
|
|
|
solve(G, A) :-
|
|
prove(G, A).
|
|
|
|
prove(G, A) :-
|
|
member(G, A).
|
|
prove(G, A) :-
|
|
neg(G, GN),
|
|
contrapositive((GN:-B)),
|
|
proveall(B, [GN | A]).
|
|
|
|
proveall([], _).
|
|
proveall([G | R], A) :-
|
|
prove(G, A),
|
|
proveall(R, A).
|
|
|
|
contrapositive((G:-B)) :-
|
|
input_clause(_, _, [G | B]).
|
|
contrapositive((G:-[B | Bs1])) :-
|
|
input_clause(_, _, [B | Bs]),
|
|
contrapositive1(G, Bs, Bs1).
|
|
|
|
contrapositive1(G, [G | Xs], Xs).
|
|
contrapositive1(G, [X | Xs], [X | Xs1]) :-
|
|
contrapositive1(G, Xs, Xs1).
|
|
|
|
member(X, [X | _]).
|
|
member(X, [_ | Xs]) :-
|
|
member(X, Xs).
|
|
|
|
neg(neg(F), pos(F)).
|
|
neg(pos(F), neg(F)).
|
|
|
|
input_clause(app1, axiom, [pos(app([], L, L))]).
|
|
|
|
input_clause(app2, axiom,
|
|
[pos(app([H | X], Y, [H | Z])),
|
|
neg(app(X, Y, Z))]).
|
|
|
|
input_clause(testp1, axiom,
|
|
[pos(q(X)), neg(p(X))]).
|
|
input_clause(testp2, axiom,
|
|
[pos(p(X)), pos(q(a)), pos(q(b))]).
|
|
|
|
% The partial deduction query
|
|
%
|
|
% :- solve(neg(app(X, Y, Z)), []).
|
|
%
|
|
% The run-time queries
|
|
%
|
|
% :- solve(neg(app([a, b], [c, d], L)), []).
|
|
% :- solve(neg(app([a, b, c, d, e, f, g, h, i, k, l, m, n, o, p],
|
|
% [q, r, s, t, u, v, w, x, y, z], L)), []).
|
|
% :- solve(neg(app(X, Y, [a, b, c, d])), []).
|
|
%
|
|
% Example solution
|
|
%
|
|
% to be inserted
|
|
%
|
|
% Michael Leuschel / K.U. Leuven / michael@cs.kuleuven.ac.be
|