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

Formulas are encoded multiple times when documentation says they should not be #179

Open
vgklein opened this issue Sep 23, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@vgklein
Copy link

vgklein commented Sep 23, 2024

In the documentation of

class pysat.formula.Formula(*args, **kwargs) (see here),

the first example is

from pysat.formula import *

>>> x1, x2 = Atom('x'), Atom('x')
>>> id(x1) == id(x2)
True  # x1 and x2 refer to the same atom
>>> id(x1 & Atom('y')) == id(Atom('y') & x2)
True  # it holds if constructing complex formulas with them as subformulas

Contrary to the documentation, the last statement (id(x1 & Atom('y')) == id(Atom('y') & x2)) returns False and not True.
This could simply be an error in the documentation but could also point to a flaw in the implementation.

Versions:
python-sat 1.8.dev13
Python 3.10.3
Windows 11

@alexeyignatiev
Copy link
Collaborator

Thanks for reporting, @vgklein! Unfortunately, it seems like a bug because the formula objects are supposed to be the same and the documentation reflects the original expectations. In fact, it worked when I wrote it. I will try to investigate when I get time (this is a huge problem these days).

@alexeyignatiev alexeyignatiev added the bug Something isn't working label Sep 30, 2024
@vgklein
Copy link
Author

vgklein commented Oct 14, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants