Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operation - on FBag incorrect #1574

Closed
jkeiren opened this issue Nov 14, 2019 · 3 comments
Closed

Operation - on FBag incorrect #1574

jkeiren opened this issue Nov 14, 2019 · 3 comments

Comments

@jkeiren
Copy link
Collaborator

jkeiren commented Nov 14, 2019

Consider the following excerpt from mcrl2i. This illustrates that the - operation on finite sets has unexpected effects.

mCRL2 interpreter (type h for help)
? e {true:1} - {false:1}
{false: 1, true: 1}

Note that correctness of the operation is dependant on the order of the operands.

mCRL2 interpreter (type h for help)
? e {false:1} - {true:1}
{false: 1}

The issue was observed by @wsinnema.

@jkeiren
Copy link
Collaborator Author

jkeiren commented Nov 19, 2019

The modified rewrite rule is still not correct. A test case showing this is the following:

mCRL2 interpreter (type h for help)
? e {true:1} - {false:1, true:1}
{true: 1}

The expected output is {:}.

@jkeiren jkeiren reopened this Nov 19, 2019
@mlaveaux
Copy link
Member

The generate_data_types.py script refuses to run locally (even using python2) so I can not test this, but the rule:

    <(e,d) -> -(@fbag_cons(d,p,b),@fbag_cons(e,q,c)) = @fbag_cons(d,p,-(b,c));

does not take into account that the element d with multiplicity p can still occur in the remainder c. Therefore, it should still take the difference between the left bag and the remainder c, such that rule becomes:

    <(e,d) -> -(@fbag_cons(d,p,b),@fbag_cons(e,q,c)) = -(@fbag_cons(d,p,b), c);

@jkeiren
Copy link
Collaborator Author

jkeiren commented Nov 19, 2019

@mlaveaux indeed, and I am already working on the fix.

Will commit with tests shortly.

Valo13 pushed a commit to Valo13/mCRL2 that referenced this issue Dec 12, 2019
This rewrite rule did not correctly take the ordering of elements in the FBag into account.
The fix is a result of a discussion with @mlaveaux.

Fixes mCRL2org#1574
Valo13 pushed a commit to Valo13/mCRL2 that referenced this issue Dec 12, 2019
Mea culpa; the previous fix was incorrect. Now proper tests have been added that check the correctness of the fix.

Fixes mCRL2org#1574
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants