## Remove unused events

This CIF to CIF transformation removes unused events from the specification. As these removed events are defined but not used, removing them does not alter the behavior modeled by the CIF specification.

### Supported specifications

This transformation supports a subset of CIF specifications. The following restrictions apply:

- Component definitions and component instantiations are not supported.

### Preprocessing

No preprocessing is currently performed by this CIF to CIF transformation. To increase the subset of specifications that can be transformed, apply the following CIF to CIF transformations (in the given order):

- Eliminate component definition/instantiation

### Implementation details

An event is considered to be unused in a CIF specification if it only occurs as an event declaration.

    event a;
    event b;

    automaton A:
      location:
        initial;
        edge a;
    end

As event `b` is defined but not mentioned elsewhere in the specification it is removed. Event `a` is mentioned on an edge. It is therefore considered used and preserved as you can see in the resulting specification:

    event a;

    automaton A:
      location:
        initial;
        edge a;
    end

Take note that the implicit alphabet of an automaton is defined by the events on the edges and not by the declared events, see the lesson on the alphabet. For instance, consider the following specification:

    automaton A:
      event a;
      event b;
      location:
        initial;
        edge a;
    end

Event `b` is only defined but not mentioned elsewhere. Therefore, it is not part of the implicit alphabet of automaton `A`. It is thus considered unused and removed.

The result is therefore:

    automaton A:
      event a;
      location:
        initial;
        edge a;
    end

### Renaming

n/a

### Size considerations

Since information is removed from the specification, the specification can only become smaller as a result of this transformation.

### Optimality

n/a

### Annotations

This transformation does not process or add any annotations. If unused events have annotations, then by removing the unused events their annotations are removed as well.