next up previous contents
Next: 3.2.6 Normalizing Up: 3.2 The bastron transformers Previous: 3.2.4 Tuple- and cons-passivating

3.2.5 Deanonymization


Deanonymization (command: deanon) transforms anonymous variables (PROLOG-like syntax: ``_''; LISP-like syntax: ``id''), domains (dom-terms), exclusions (exc- terms), and types (``$''-prefixed predicates) to named versions. For doing this new variables are generated replacing each ``_''/``id''-occurrence and providing the occurrence-binding (bnd-term) variables for dom/exc-terms and ``$''-predicates.

For example, the anonymous terms in the P-pattern of

t(A1,A2) :- P is [_,dom[a,b],exc[c],$atom],
            [P,P] is [A1,A2].
become as in
t(A1,A2) :- P is [_1,bnd[_2,dom[a,b]],bnd[_3,exc[c]],bnd[_4,$atom]],
            [P,P] is [A1,A2].
The bnd-variables effect that after further compilation, although both the goals t([true,a,b,c],[true,a,b,c]) and t([false,b,a,d],[false,b,a,d]) succeed, the goal t([true,a,b,c],[false,b,a,d]) correctly fails.

Sample dialog (only the first clause's head is affected):

rfi-p> az listn([],_) :- & tup().
rfi-p> az listn([L],E) :- & tup(E|listn(L,E)).
rfi-p> deanon
rfi-p> listing
listn([],_1) :- & tup().
listn([L],E) :- & tup(E|listn(L,E)).

Harold Boley (