If * Gen* is allowed to change the input then a way must be found to
remember the original input. Correspondence theory is beyond the scope
of this paper, however a simple example of an OT where * Gen* modifies
the input is provided by the problem described in §2.2 (from
[3]). Suppose we modify * Gen* here so that its output
includes a representation of the original input. One way to do this
would be to adopt the convention that input symbols are marked with a
following 0 and output symbols are marked with a following 1. With
this convention * Gen* becomes:

macro(gen, {[(a x [a,0,b,1])*,(b x [b,0,a,1])*], [(a x [a,0,a,1])*,(b x [b,0,b,1])*]})

Then the constraint against the symbol ` a` needs to be recast as a
constraint against ` [a,1]`.^{10} And, whereas above *
add_violation* was previously written to ignore brackets, for this
case it will need to ignore output symbols (marked with a 1). This
approach is easily implementable and with sufficient use of
permutation, an approximation can be achieved for any predetermined
bound on input length.