Skip to content

Filter & Sort Counterexamples by Binders#272

Open
rcosta358 wants to merge 6 commits into
mainfrom
filter-sort-counterexamples
Open

Filter & Sort Counterexamples by Binders#272
rcosta358 wants to merge 6 commits into
mainfrom
filter-sort-counterexamples

Conversation

@rcosta358

@rcosta358 rcosta358 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR replaces the expression-based counterexample assignment filtering with VC-based that filters assignments using VC binders and sorts them by binder order.

Before

Found:
∀y. true
∀z. true
∀w¹⁷⁶. y <= w¹⁷⁶ && w¹⁷⁶ <= z

Counterexample:
z == 0
y == 0
w¹⁷⁶ == 0

After

Found:
∀y. true
∀z. true
∀w¹⁷⁶. y <= w¹⁷⁶ && w¹⁷⁶ <= z

Counterexample:
y == 0
z == 0
w¹⁷⁶ == 0

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Code refactoring

Checklist

  • Added/updated tests
  • mvn test passes locally
  • Updated docs/README if behavior or API changed

@rcosta358 rcosta358 self-assigned this Jul 14, 2026

@CatarinaGamboa CatarinaGamboa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you add some before/after examples to the summary? To explain why the change

@rcosta358

rcosta358 commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator Author

This is needed mainly to sort the counterexamples by binders, so they appear in the same order the binders appear in the error message. When there are multiple binders, the counterexamples appearing in the same order is nice for readability.

It also simplifies the code quite a bit. However, with this change enum constants and static final constants no longer appear in the counterexample, which we discussed offline. For that I think we can have a separate simplification just for the expected type to be able to simplify aliases, enums, and static final constants.

@rcosta358

Copy link
Copy Markdown
Collaborator Author

Also added the before/after example.

@rcosta358
rcosta358 force-pushed the filter-sort-counterexamples branch 2 times, most recently from c1e0b8d to 2d10334 Compare July 23, 2026 17:15
@rcosta358 rcosta358 added the error messages Related to error messages label Jul 23, 2026
@rcosta358
rcosta358 force-pushed the filter-sort-counterexamples branch from 2d10334 to 98c485e Compare July 23, 2026 17:17
@rcosta358

Copy link
Copy Markdown
Collaborator Author

Also added some tests for counterexamples.

@rcosta358
rcosta358 requested a review from CatarinaGamboa July 23, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

error messages Related to error messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants