Remove unused algebraic variables

This CIF to CIF transformation removes unused algebraic variables and their equations from the specification. As these removed algebraic variables 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):

Implementation details

An algebraic variable is considered to be unused in a CIF specification if it only occurs as an algebraic variable definition.

alg bool var1 = false;
alg bool var2 = true;

plant A:
  uncontrollable a;
  location:
    initial;
    edge a when var1;
end

As algebraic variable var2 is defined but not mentioned elsewhere in the specification it is removed. Algebraic variable var1 is mentioned in an edge guard. It is therefore considered used and preserved as you can see in the resulting specification:

alg bool var1 = false;

plant A:
  uncontrollable a;
  location:
    initial;
    edge a when var1;
end

As algebraic variables may be used to define other algebraic variables, removal of an algebraic variable may trigger more removals. For instance, consider the following specification:

alg bool var1 = false;
alg bool var2 = not var1;
alg bool var3 = var2;

plant A:
  uncontrollable a;
  location:
    initial;
    edge a when var1;
end

Algebraic variable var3 is only defined but not mentioned elsewhere. It is thus considered unused and removed. After the removal of var3, algebraic variable var2 is not mentioned elsewhere anymore. It is thus now considered unused as well and also removed. Algebraic variable var1 is considered used as before and not removed.

The result is therefore:

alg bool var1 = false;

plant A:
  uncontrollable a;
  location:
    initial;
    edge a when var1;
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, add, or remove any annotations.