Skip to content

Missing deepcopy in wp.py #8

Description

@bensturgis

In the method apply of the class ExpectationTransformer of the module wp, a deepcopy is missing in line 276 around expectation. Without this deepcopy, in the subsequent substitution, changes to one occurrence of this expectation are also applied to the other occurrences.
For example, the following code produces the output (5 + 2) + (5 + 2) instead of (5 + 2) + (4 + 2).

v = VarExpr('v')
a = SubstExpr({'x': NatLitExpr(5)}, v)
b = SubstExpr({'x': NatLitExpr(4)}, v)
e = BinopExpr(Binop.PLUS, a, b)
wt = WeightingTransformer('v', e)
print(wt.apply(BinopExpr(Binop.PLUS, VarExpr('x'), NatLitExpr(2))))

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions