Eliminate if updates

This CIF to CIF transformation eliminates 'if' updates on edges and in SVG input mappings.

Supported specifications

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

  • Multi-assignments and partial variable assignments are not supported. That is, the left hand sides of the assignments on edges and in SVG input mappings (the addressables) must be single variables without projections.

Preprocessing

No preprocessing, to increase the subset of CIF specifications that can be transformed, is currently performed by this CIF to CIF transformation.

Implementation details

This transformation ensures that each variable that is assigned, gets a single explicit assignment. Simply put, the 'if' update structure is replicated by an 'if' expression. For instance, the following updates:

if g:
  if g2:
    x := 5
  else
    y := 6
  end
end,
z := 7

are transformed to the following updates:

x := if g:
       if g2:
         5
       else
         x
       end
     else
       x
     end,
y := if g:
       if g2:
         y
       else
         6
       end
     else
       y
     end,
z := 7

Observe how variables x and y are assigned inside two if updates. These if updates are replicated by two if expressions.

Since for if expressions the else part is not optional, dummy x := x assignments are sometimes performed in cases where the original specification would not have assigned variable x at all. That is, variables may be assigned their old values, resulting in superfluous assignments.

Renaming

n/a

Size considerations

The 'if' structure may be replicated for multiple variables, which may result in an increase of the specification size. The increase amount is influenced by the size of the guard expressions, and the number of levels of nesting 'if' updates.

Optimality

The superfluous assignments (see the Implementation details section above), are obviously not optimal. The language however requires them.

Annotations

This transformation does not process, add, or remove any annotations.