semantic.pl 965 Bytes
% == No, Emacs this is -*-Prolog-*- code, not what you thought... =============

sa_names(fzn(preds(IP), vars(IV), constrs(IC), SOLVE),
	 fzn(preds(OP), vars(OV), constrs(OC), SOLVE, ST)) :-
    sa_n_traverse(IP, OP, ST),  % predicates
    sa_n_traverse(IV, OV, ST),	% variables
    sa_n_traverse(IC, OC, ST).  % constraints

% -----------------------------------------------------------------------------

sa_n_traverse([], [], ST).
sa_n_traverse([N|Ns], [NN|NNs], ST) :-
    sa_n(N, NN, ST),
    sa_n_traverse(Ns, NNs, ST).


% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
%
% sa_n(AST_N_IN, AST_N_OUT, ST)

sa_n(var(N,T,I,A), var(N,T), ST) :-
    sa_attribs(A, AX, ST),
    st_insert(ST, N, var(N,T,I,AX)).

sa_n(constraint(_C)).

% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

sa_attribs(A, NA, IST) :-
    true.

% -----------------------------------------------------------------------------