Skip to content

Fix algorithm ST dump #7

Description

@Lipen

Currently, the code inside BinaryAlgorithm::toST(...) has a bug in it - when the algorithm is T->T, F->F (z := z), it is erroneously displayed as z := NOT z.

fun toST(outputNames: List<String>): String {
require(outputNames.size == algorithm0.size) { "Wrong number of output names" }
return outputNames.indices.joinToString("") { i ->
val name = outputNames[i]
val a0 = algorithm0[i]
val a1 = algorithm1[i]
if (a0 == a1)
"$name:=${a0.toString().toUpperCase()};"
else
"$name:=NOT $name;"
}
}

The correct behavior is to display such algorithms as z := z or, as we convert to ST, not to display them at all, as z := z is a no-op.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions