Let us denote by FNi (for Free Names) the generic symbols of the ith-parameter type, that is the symbols of the signature of Spi that do not appear in the signature of any Spij.
Then, such declaration is well-formed in an environment if each Pari is well-formed and moreover the following conditions hold:
The body of a generic spec has to be well formed in the current environment enriched by the parameter names, that are assumed to have the signatures described by the corresponding qualifying specs Spi.
Moreover, the body must be unambiguous. Following the principle that generic symbols are just place holders, such symbols cannot be confused with generic symbols declared (with the same profile, if it is a function or a predicate) in the qualifying specification of some other parameter. Thus, if a symbol name (with the same profile, if it is a function or a predicate) belongs to FNi and FNj for i/=j, then it must be referred to using its source as well as its name.
This requires the following changes to the abstract syntax as well
The body of a generic spec can be any kind of expression not only an
extension of a union (as in the current proposal), but notice that if
the parameters have to be (persistently) extended, then this has to be
explicitly stated in the body.
where the referenced constructs is well formed only
within the body of a generic specification with the SPEC-NAME part
corresponding to the name of (one of) the formal parameters, whose signature
includes in its varying part that symbol name.
SORT ::= ... | referenced-sort SORT-NAME SPEC-NAME
FUN-NAME ::= ... | referenced-fun FUN-NAME SPEC-NAME
PRED-NAME ::= ... | referenced-pred PRED-NAME SPEC-NAME
An acceptable fitting parameter corresponding to a formal parameter of type par-type Sp^i fixed-names Sp^i_1...Sp^i_k^i consists of