Program/Semantics.pm: optimization