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

Python xor clauses with inverted literals disallowed #777

Open
jasonfiammetta opened this issue Jan 20, 2025 · 2 comments
Open

Python xor clauses with inverted literals disallowed #777

jasonfiammetta opened this issue Jan 20, 2025 · 2 comments

Comments

@jasonfiammetta
Copy link

jasonfiammetta commented Jan 20, 2025

Is this intentional? I can't find an analogue for that limitation in the C++ code, and this regex seems to suggest it's expected. Even this old blog post uses a negative.

That parser code is quite old, perhaps the ability to use false vars was an issue that was resolved later?

@msoos
Copy link
Owner

msoos commented Jan 20, 2025

Hi,

It kind of is. You can edit the code, though, if you like, to count the negations, and change the RHS. Or you can just do it outside of the python module, and only add variables with RHS set to the value required. I'd accept a PR that fixes this of course! But I think it's not a big limitation, you just need to count the negations, and flip the RHS accordingly:

    static char const* kwlist[] = {"xor_clause", "rhs", NULL};

Let me know if you are up for writing a PR,

Mate

@jasonfiammetta
Copy link
Author

Sure, I'll get started on a PR for that, thanks for the quick response!

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