Skip to content

Filter & Sort Counterexamples by Binders#272

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

Filter & Sort Counterexamples by Binders#272
rcosta358 wants to merge 2 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 under liquidjava-example/src/main/java/testSuite/ (Correct* / Error*)
  • 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.

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