Check-in [b5c5523821]

Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added a TODO comment describing the problems around applying the substitution to the body of an expanded clause, instead of appending them as unification goals.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b5c55238215e73a1ab7d610963806b1905717260
User & Date: andy 2015-04-18 18:47:15
Context
2015-04-18
19:48
Penultimate draft of the report. After spell checking and such, this will become the final draft. check-in: 98924328ad user: andy tags: trunk
18:47
Added a TODO comment describing the problems around applying the substitution to the body of an expanded clause, instead of appending them as unification goals. check-in: b5c5523821 user: andy tags: trunk
18:46
Fixed tests to support the new definition of atoms (can be constructed from numbers). check-in: 51ec69316b user: andy tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to plsrc/program.pl.

279
280
281
282
283
284
285



286
287
288
289
290
291
292
...
337
338
339
340
341
342
343





344
345
346
347
348
349
350
normalize1(and([]),true) :- !.
normalize1(or([]),false) :- !.
normalize1(and([P]),P) :- !.
normalize1(or([P]),P) :- !.
normalize1(and(Ps),and(Ps)).
normalize1(or(Ps),or(Ps)).





% call_goal
% Generate the expansion of Goal, given the current set of bound variables.
% An expansion will have the form:
%   or([
%     and([v1 = t1, v2 = t2, ..., G1, G2, ...]),
%     and([v1 = t1, v2 = t2, ..., G1, G2, ...]),
................................................................................
    % Rename variables in the definition so they do not collide.
    make_safe_def(BVars,rule(Name,Head,Body),rule(_,SHead,and(SBody))),

    % Unify SHead with Goal
    get_subst(SHead,Goal,Subst),

    % Merge substitution (list of V = T) with body





    append(Subst, SBody, FullBody).


%%% ---------------------------------------------------------------------------
%%% Execution
%%% ---------------------------------------------------------------------------








>
>
>







 







>
>
>
>
>







279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
...
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
normalize1(and([]),true) :- !.
normalize1(or([]),false) :- !.
normalize1(and([P]),P) :- !.
normalize1(or([P]),P) :- !.
normalize1(and(Ps),and(Ps)).
normalize1(or(Ps),or(Ps)).

% TODO: call_goal should be able to handle goals whose bodies aren't
% and([]). I.e., a single atomic goal, or true, should work fine.


% call_goal
% Generate the expansion of Goal, given the current set of bound variables.
% An expansion will have the form:
%   or([
%     and([v1 = t1, v2 = t2, ..., G1, G2, ...]),
%     and([v1 = t1, v2 = t2, ..., G1, G2, ...]),
................................................................................
    % Rename variables in the definition so they do not collide.
    make_safe_def(BVars,rule(Name,Head,Body),rule(_,SHead,and(SBody))),

    % Unify SHead with Goal
    get_subst(SHead,Goal,Subst),

    % Merge substitution (list of V = T) with body
    % TODO: make this apply the substitution to the body, rather than prepend.
    % The trouble with this is that we also need to return the substitution,
    % which, since we return a disjunction, we have no way of doing. Embedding
    % the substitution as a conjunction of A = B goals has the side effect of
    % constructing the substitution to be returned in each clause. 
    append(Subst, SBody, FullBody).


%%% ---------------------------------------------------------------------------
%%% Execution
%%% ---------------------------------------------------------------------------