Skip to content

Formalize LocSet as Set of Locations - #3962

Merged
Drodt merged 37 commits into
mainfrom
locset-as-set
Aug 17, 2026
Merged

Formalize LocSet as Set of Locations#3962
Drodt merged 37 commits into
mainfrom
locset-as-set

Conversation

@Drodt

@Drodt Drodt commented Aug 13, 2026

Copy link
Copy Markdown
Member

Intended Change

Rely on the KeY formalization of parametric Set to express LocSet. We have:

\alias Loc = Pair<Object, Field>;
\alias LocSet = Set<Loc>;

Rules are adjusted accordingly.

Additionally, this PR provides

  • Many additional rules for sets and locsets (proven sound with KeY by @unp1)
  • Additional strategies for sets and locsets, allowing easy use for other KeY instances in the future
  • Proper LDT support for parametric sorts
  • Improved and fixed matching for parametric functions with parametric sorts
  • Pair is now parametric and has some additional rules
  • SMT translation and Well-Definedness checks now consider set operations, not just LocSet

Plan

  • Fix tests.

Type of pull request

  • Bug fix (non-breaking change which fixes an issue)
  • Refactoring (behaviour should not change or only minimally change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • There are changes to the (Java) code
  • There are changes to the taclet rule base
  • There are changes to the deployment/CI infrastructure (gradle, github, ...)
  • Other:

Ensuring quality

  • I added new test case(s) for new functionality.
  • I have tested the feature as follows: Tested using existing test suite
  • I have checked that runtime performance has not deteriorated.

Additional information and contact(s)

The contributions within this pull request are licensed under GPLv2 (only) for inclusion in KeY.

@Drodt
Drodt marked this pull request as ready for review August 14, 2026 16:04
@Drodt
Drodt requested a review from unp1 August 14, 2026 16:06
@Drodt Drodt added this to the v3.1.0 milestone Aug 14, 2026

@unp1 unp1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks a lot! Great work. Only a few minor remarks/questions.

Comment thread key.core/src/main/java/de/uka/ilkd/key/ldt/ParametricLDT.java
Comment thread key.core/src/main/java/de/uka/ilkd/key/ldt/LDT.java Outdated
@unp1

unp1 commented Aug 15, 2026

Copy link
Copy Markdown
Member

Please check if you want to keep the last two commits otherwise revert
They reeanble automatic proving of setExamples.key by moving the succedent version setEquaityToElementRight to generic sets (before only for locsets). That is not the general setEqualityToElement rule, which I think you did not want to be enabled automatically). If that includes also the more targeted right version, we can simply move it back or disable it for generic sets and add a duplicate for location sets.

The second commit restricts the elementOf decomposition rules to those cases where the decomposition is necessary. Such that the decomposition rules are only applied where it makes sense and otherwise using the normal one without decomposition.

Feel free to revert both commits or to only pick what you want.

unp1 added 2 commits August 15, 2026 02:17
-Design a bit over the top as both strategies do not much, but split enables easier move of SetStrategy to ncore while keeping LocsetStrategy in core
@unp1
unp1 self-requested a review August 15, 2026 08:26

@unp1 unp1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks a lot. I approved. But please make sure you are fine with my last commit (I wanted to have it done yesterday, but decided to get some sleepp at 5 a.m.) It makes the strategies a bit more useful (comm, assoc and distribute are now set strategy internal not relying on the quantifier heuristic) as well as additional simplification rules (+ their soundness proofs). Sorry that the PR adds now more lines then before, but that is misleading, still much more deleted and the vast majorit are the saved soundness proofs.

- application of commutation, associativity now done by SetStrategy and do not longer rely on rulesets and their definition by other strategies (basically just copy and paste form FOLStrategy)
- add additional absorption laws to allow for more efficient simplification of set and locset terms; (all added rules proven correct witihin KeY)
@mattulbrich

Copy link
Copy Markdown
Member

Thanks, guys for your effort here! Sounds very reasonable and I am looking forward to having a decent set datatype in KeY!

Comment thread key.core/src/main/resources/de/uka/ilkd/key/proof/rules/locset/locSetsRules.key Outdated
@Drodt Drodt self-assigned this Aug 16, 2026
@Drodt
Drodt added this pull request to the merge queue Aug 17, 2026
Merged via the queue into main with commit 558b12f Aug 17, 2026
39 checks passed
@Drodt
Drodt deleted the locset-as-set branch August 17, 2026 06:45
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.

3 participants