Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate easier POs for non-trivial diverges clauses #3430

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -926,10 +926,13 @@ public ImmutableSet<Contract> createFunctionalOperationContracts(String name, IP
result = result.add(contract);
} else {
// create two contracts for each diamond and box modality
Map<LocationVariable, Term> boxPres = new LinkedHashMap<>(pres);
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be a copy of clauses.requires? Previously that map was used when constructing the FunctionalOperationContract.

for (LocationVariable heap : services.getTypeConverter().getHeapLDT().getAllHeaps()) {
if (clauses.requires.get(heap) != null) {
var div = tb.convertToFormula(clauses.diverges);
pres.put(heap,
tb.andSC(pres.get(heap), tb.not(tb.convertToFormula(clauses.diverges))));
tb.andSC(pres.get(heap), tb.not(div)));
boxPres.put(heap, tb.andSC(boxPres.get(heap), div));
break;
}
}
Expand All @@ -938,7 +941,7 @@ public ImmutableSet<Contract> createFunctionalOperationContracts(String name, IP
clauses.assignables, clauses.assignablesFree, clauses.accessibles, clauses.hasMod,
clauses.hasFreeMod, progVars);
contract1 = cf.addGlobalDefs(contract1, abbrvLhs);
FunctionalOperationContract contract2 = cf.func(name, pm, false, clauses.requires,
FunctionalOperationContract contract2 = cf.func(name, pm, false, boxPres,
clauses.requiresFree, clauses.measuredBy, posts, clauses.ensuresFree, axioms,
clauses.assignables, clauses.assignablesFree, clauses.accessibles, clauses.hasMod,
clauses.hasFreeMod, progVars);
Expand Down
Loading