Skip to content

Fixed clue constraints in Z3 for Zebralogic#28

Open
ashmitkx wants to merge 1 commit into
microsoft:mainfrom
ashmitkx:main
Open

Fixed clue constraints in Z3 for Zebralogic#28
ashmitkx wants to merge 1 commit into
microsoft:mainfrom
ashmitkx:main

Conversation

@ashmitkx
Copy link
Copy Markdown
Collaborator

ZebraLogicProblem.__init__() was not adding the clue constraints to the z3 solver. Fixed the issue.

Copilot AI review requested due to automatic review settings June 3, 2026 08:10
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 during ZebraLogicProblem.__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:
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

Successfully merging this pull request may close these issues.

2 participants