Fixed clue constraints in Z3 for Zebralogic#28
Open
ashmitkx wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes ZebraLogic verification by ensuring clue IR constraints are actually added to the Z3 solver when a ZebraLogicProblem is constructed, so satisfiability checks reflect the puzzle’s clues (not just the “one value per feature/house” structural constraints).
Changes:
- Apply
problem["clue_irs"]constraints duringZebraLogicProblem.__init__()so clue constraints are always present in the solver. - Normalize feature/value tokens to lowercase when compiling IR constraints to better match the dataset’s lowercased feature/value schema.
- Make ZebraLogic solution scoring case-insensitive when comparing candidate vs. ground-truth values.
Reviewed changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| interwhen/utils/zebralogic_verifier.py | Adds clue IRs to the solver at construction time and normalizes IR entity tokens for consistent constraint compilation. |
| interwhen/utils/zebralogic_helper.py | Compares candidate vs. solution values case-insensitively during correctness scoring. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+110
to
113
|
|
||
| # A is somewhere to the left of B | ||
| if k == "?": | ||
| for h1 in self.houses: |
Comment on lines
+127
to
130
|
|
||
| # A is somewhere to the right of B | ||
| if k == "?": | ||
| for h1 in self.houses: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ZebraLogicProblem.__init__()was not adding the clue constraints to the z3 solver. Fixed the issue.