Skip to content

Commit cd49fea

Browse files
Name generated values after what they are instead of #fresh (#477)
Closes #373. ## What changed Every value the verifier introduces used to be called `#freshN`, so path conditions, call results and new receivers all looked the same in Expected/Found and in counterexamples. Each one is now named after where it comes from: | Origin | Name shown | |---|---| | `if` condition | `#if_condition¹¹` | | `while`/`for` condition (body and exit) | `#loop_condition¹⁴` | | `c ? a : b` condition | `#ternary_condition¹⁶` | | try/catch path (try ran / this catch ran) | `#try_branch¹⁸`, `#catch_branch²¹` | | result of a call inside an expression or used as a receiver | `#read_result²⁸` (method name + `_result`) | | value read from a field not tracked here (e.g. `a.length`, another object's field) | `#length_value⁷` (field name + `_value`) | | receiver of `new T(..).m()` | `#new_Door³⁵` | | value of an operation that is not encoded (`x == null`, `instanceof`, bitwise ops) | `#operation_result³⁰` | | size of `new int[n]` | `#array_length⁴` | The subclass-contract checks in `AuxHierarchyRefinementsPassage` also used `#fresh` for the return value and the receiver. They now use the existing `#ret_N` and `#this_N` names. How it works: the new `liquidjava.utils.GeneratedNames` builds every such name as `##<description>_<counter>`. The context counter keeps names unique. The second `#` keeps them apart from instances of program variables (`#<variable>_<counter>`), since a Java name can't start with `#`. Characters that the refinement language's `ID` token doesn't accept (e.g. `$` in `Map$Entry`, non-ASCII letters in method names) are replaced by `_`, so the names still parse and work with the SMT encoding. `GeneratedNames.isGenerated` replaces the old `#fresh_` prefix checks in three places: the counterexample ordering (`RefinementError`), unused path-binder removal (`VCBinderSimplification`) and keeping condition values in context (`RefinementTypeChecker`). `VariableFormatter` removes one `#` as it does for instances, so generated names are shown with a single `#` (`#if_condition¹¹`), as `#fresh` was, and stay distinct from program variables. ## Before / after From the new fixture `testSuite/classes/generated_names_error`: ``` before: #fresh¹¹ == ready¹⁰ && #fresh¹¹ is not a subtype of a > 0 after: #if_condition¹¹ == ready¹⁰ && #if_condition¹¹ is not a subtype of a > 0 before: #fresh¹⁴ == ready¹² && #fresh¹⁴ == true is not a subtype of a > 0 after: #loop_condition¹⁴ == ready¹² && #loop_condition¹⁴ == true is not a subtype of a > 0 before: #fresh¹⁶ == ready¹⁵ && #fresh¹⁶ == true is not a subtype of a < 0 after: #ternary_condition¹⁶ == ready¹⁵ && #ternary_condition¹⁶ == true is not a subtype of a < 0 before: !#fresh¹⁸ && !#fresh²¹ is not a subtype of a²⁵ > 0 after: !#try_branch¹⁸ && !#catch_branch²¹ is not a subtype of a²⁵ > 0 before: x²⁹ == #fresh²⁸ - 1 is not a subtype of x²⁹ > 0 after: x²⁹ == #read_result²⁸ - 1 is not a subtype of x²⁹ > 0 Counterexample: x²⁹ == 0 && #read_result²⁸ == 1 before: #fresh³² == #fresh³⁰ && #fresh³² && x³³ == 0 is not a subtype of x³³ > 0 after: #if_condition³² == #operation_result³⁰ && #if_condition³² && x³³ == 0 is not a subtype of x³³ > 0 before: found closed(#fresh³⁵) but expected opened(#fresh³⁵) after: found closed(#new_Door³⁵) but expected opened(#new_Door³⁵) ``` The Found row in the issue's screenshot, `∀#fresh²²⁰ baseline²¹⁶ || extended²¹⁷`, becomes `∀#if_condition²²⁰ baseline²¹⁶ || extended²¹⁷`. ## Tests - New fixture `liquidjava-example/src/main/java/testSuite/classes/generated_names_error/` (`GeneratedNames.java`, `Door.java`), one error for each origin that shows up in a message. - New `TestGeneratedNames`: one test checking the exact message for each of those errors (counters stripped); it fails on any missing or extra error. - Updated the expected names in `VariableFormatterTest`, `VCBinderSimplificationTest`, `VCConstraintSimplificationTest`, `RefinementErrorCounterexampleTest` and `TestCounterexamples`. - Full suite run locally: 683 tests, 0 failures. Separately: a call to a method with a refinement contract still gets its result named `#<method>_N` in `MethodsFunctionsChecker` (shown as `ready¹⁰` above). That name wasn't a `#fresh` and is left unchanged here. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent c974821 commit cd49fea

18 files changed

Lines changed: 228 additions & 51 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package testSuite.classes.generated_names_error;
2+
3+
import liquidjava.specification.StateRefinement;
4+
import liquidjava.specification.StateSet;
5+
6+
@StateSet({"opened", "closed"})
7+
public class Door {
8+
9+
@StateRefinement(to = "closed(this)")
10+
public Door() {}
11+
12+
@StateRefinement(from = "opened(this)", to = "closed(this)")
13+
public void close() {}
14+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package testSuite.classes.generated_names_error;
2+
3+
import liquidjava.specification.Refinement;
4+
5+
// Each value the verifier introduces is named after what it is, not #fresh (#373)
6+
public class GeneratedNames {
7+
8+
static void positive(@Refinement("_ > 0") int x) {}
9+
10+
@Refinement("_ > 0")
11+
static int negate(@Refinement("_ < 0") int x) {
12+
return -x;
13+
}
14+
15+
static boolean ready(int a) {
16+
return a > 0;
17+
}
18+
19+
static int read(int key) {
20+
return key;
21+
}
22+
23+
static void ifCondition(int a) {
24+
if (ready(a))
25+
positive(a); // Expect: Refinement Error
26+
}
27+
28+
static void loopCondition(int a) {
29+
while (ready(a))
30+
positive(a); // Expect: Refinement Error
31+
}
32+
33+
static int ternaryCondition(int a) {
34+
return ready(a) ? negate(a) : 1; // Expect: Refinement Error
35+
}
36+
37+
static void tryAndCatchBranches(int a) {
38+
try {
39+
a = read(a);
40+
} catch (IllegalStateException e) {
41+
a = 1;
42+
} catch (RuntimeException e) {
43+
positive(a); // Expect: Refinement Error
44+
}
45+
}
46+
47+
static void callResult(int key) {
48+
positive(read(key) - 1); // Expect: Refinement Error
49+
}
50+
51+
static void operationResult(String s) {
52+
boolean isNull = s == null;
53+
if (isNull)
54+
positive(0); // Expect: Refinement Error
55+
}
56+
57+
static void newObject() {
58+
new Door().close(); // Expect: State Refinement Error
59+
}
60+
}

‎liquidjava-verifier/src/main/java/liquidjava/diagnostics/errors/RefinementError.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
import liquidjava.rj_language.ast.formatter.VariableFormatter;
2222
import liquidjava.rj_language.opt.VCSimplificationResult;
2323
import liquidjava.smt.Counterexample;
24+
import liquidjava.utils.GeneratedNames;
2425
import liquidjava.utils.Pair;
2526
import liquidjava.utils.Utils;
26-
import liquidjava.utils.constants.Formats;
2727
import spoon.reflect.cu.SourcePosition;
2828

2929
import static liquidjava.rj_language.opt.VCSimplificationUtils.isTrue;
@@ -184,7 +184,7 @@ private List<String> originalBinders() {
184184
private static int relevance(String term, List<String> expectedTerms, List<String> foundTerms) {
185185
if (expectedTerms.contains(term))
186186
return foundTerms.contains(term) ? 1 : 0;
187-
return term.startsWith(Formats.FRESH_PREFIX) ? 3 : 2;
187+
return GeneratedNames.isGenerated(term) ? 3 : 2;
188188
}
189189

190190
// Variables and ghost applications of an expression, named as in the SMT model

‎liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/RefinementTypeChecker.java‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import liquidjava.rj_language.BuiltinFunctionPredicate;
2222
import liquidjava.rj_language.Predicate;
2323
import liquidjava.rj_language.ast.Enum;
24+
import liquidjava.utils.GeneratedNames;
2425
import liquidjava.utils.StaticConstants;
2526
import liquidjava.utils.Utils;
2627
import liquidjava.utils.constants.Formats;
@@ -210,7 +211,7 @@ public <T> void visitCtNewArray(CtNewArray<T> newArray) {
210211
// TODO only working for 1 dimension
211212
for (CtExpression<?> exp : l) {
212213
Predicate c = getExpressionRefinements(exp);
213-
String name = String.format(Formats.FRESH, context.getCounter());
214+
String name = GeneratedNames.of(GeneratedNames.ARRAY_LENGTH, context.getCounter());
214215
if (c.getVariableNames().contains(Keys.WILDCARD)) {
215216
c = c.substituteVariable(Keys.WILDCARD, name);
216217
} else {
@@ -498,7 +499,7 @@ public void visitCtIf(CtIf ifElement) {
498499
CtExpression<Boolean> exp = ifElement.getCondition();
499500
Predicate expRefs = getExpressionRefinements(exp);
500501

501-
String pathVarName = String.format(Formats.FRESH, context.getCounter());
502+
String pathVarName = GeneratedNames.of(GeneratedNames.IF_CONDITION, context.getCounter());
502503
// A value refinement constrains the result of evaluating the expression; it is not
503504
// itself the truth value selecting the branch. Calls without a wildcard likewise
504505
// provide no information about their boolean result.
@@ -610,14 +611,13 @@ private void keepFreshValues(Predicate predicate) {
610611
}
611612

612613
private void keepFreshValues(Predicate predicate, Set<String> visited) {
613-
String freshPrefix = Formats.FRESH.substring(0, Formats.FRESH.indexOf('%'));
614614
for (String name : predicate.getVariableNames()) {
615615
if (!visited.add(name))
616616
continue;
617617
RefinedVariable value = context.getVariableByName(name);
618618
if (value == null)
619619
continue;
620-
if (name.startsWith(freshPrefix))
620+
if (GeneratedNames.isGenerated(name))
621621
context.addInstanceVariable(value);
622622
keepFreshValues(value.getMainRefinement(), visited);
623623
}
@@ -821,7 +821,7 @@ private static void removeCheckMetadata(CtLoop loop) {
821821
private void recordExit(LoopTypestates states, CtExpression<Boolean> condition) {
822822
if (condition == null)
823823
return;
824-
RefinedVariable conditionIsFalse = assumeCondition(condition, false);
824+
RefinedVariable conditionIsFalse = assumeCondition(condition, false, GeneratedNames.LOOP_CONDITION);
825825
states.recordExit();
826826
if (conditionIsFalse != null)
827827
vcChecker.removePathVariable(conditionIsFalse);
@@ -953,22 +953,22 @@ private boolean mayChangeState(CtInvocation<?> invocation) {
953953
* the condition of an if, see visitCtIf). Re-assigning a variable in the body drops the conditions on it.
954954
*/
955955
private void assumeLoopCondition(CtExpression<Boolean> condition) {
956-
assumeCondition(condition, true);
956+
assumeCondition(condition, true, GeneratedNames.LOOP_CONDITION);
957957
}
958958

959959
/**
960960
* Adds a path condition saying that {@code condition} evaluated to {@code holds}, on the values it was evaluated
961-
* on. Returns the path variable, so the caller can remove it where the condition no longer applies, or null when
962-
* nothing is assumed.
961+
* on, in a path variable named after {@code kind}. Returns the path variable, so the caller can remove it where the
962+
* condition no longer applies, or null when nothing is assumed.
963963
*/
964-
private RefinedVariable assumeCondition(CtExpression<Boolean> condition, boolean holds) {
964+
private RefinedVariable assumeCondition(CtExpression<Boolean> condition, boolean holds, String kind) {
965965
// conditions with side effects (e.g. (n = read()) > 0) are not encoded, so they assume nothing
966966
if (condition == null || !condition.getElements(new TypeFilter<>(CtVariableWrite.class)).isEmpty())
967967
return null;
968968
Predicate refs = getRefinement(condition);
969969
if (isUninformativeCondition(refs, condition))
970970
return null;
971-
String pathVarName = String.format(Formats.FRESH, context.getCounter());
971+
String pathVarName = GeneratedNames.of(kind, context.getCounter());
972972
boolean valueIsCondition = refs.getVariableNames().contains(Keys.WILDCARD);
973973
refs = refs.substituteVariable(Keys.WILDCARD, pathVarName);
974974
refs = Predicate.createConjunction(refs, substituteAllVariablesForLastInstance(refs));
@@ -1006,7 +1006,7 @@ public <T> void visitCtConditional(CtConditional<T> conditional) {
10061006
}
10071007

10081008
private void scanAssuming(CtExpression<?> branch, CtExpression<Boolean> condition, boolean holds) {
1009-
RefinedVariable pathVar = assumeCondition(condition, holds);
1009+
RefinedVariable pathVar = assumeCondition(condition, holds, GeneratedNames.TERNARY_CONDITION);
10101010
scan(branch);
10111011
if (pathVar != null)
10121012
vcChecker.removePathVariable(pathVar);

‎liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/TryChecker.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import liquidjava.processor.context.Variable;
1010
import liquidjava.processor.context.VariableInstance;
1111
import liquidjava.rj_language.Predicate;
12+
import liquidjava.utils.GeneratedNames;
1213
import liquidjava.utils.constants.Formats;
1314
import spoon.reflect.code.CtCatch;
1415
import spoon.reflect.code.CtExpression;
@@ -73,7 +74,8 @@ private boolean visitBranches(CtTry tryBlock, int i, Map<Variable, VariableInsta
7374
if (i == tryBlock.getCatchers().size())
7475
return visitBranch(tryBlock, i, before, inTry);
7576

76-
String pathVarName = String.format(Formats.FRESH, context.getCounter());
77+
String branch = i == 0 ? GeneratedNames.TRY_BRANCH : GeneratedNames.CATCH_BRANCH;
78+
String pathVarName = GeneratedNames.of(branch, context.getCounter());
7779
Predicate cond = Predicate.createVar(pathVarName);
7880
RefinedVariable pathVar = context.addInstanceToContext(pathVarName, factory.Type().BOOLEAN_PRIMITIVE,
7981
new Predicate(), tryBlock);

‎liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/general_checkers/OperationsChecker.java‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import liquidjava.processor.context.Variable;
1111
import liquidjava.processor.context.VariableInstance;
1212
import liquidjava.processor.refinement_checker.TypeChecker;
13+
import liquidjava.utils.GeneratedNames;
1314
import liquidjava.utils.StaticConstants;
1415
import liquidjava.utils.Utils;
1516
import liquidjava.utils.constants.Formats;
@@ -174,7 +175,7 @@ public <T> void getUnaryOpRefinements(CtUnaryOperator<T> operator) throws LJErro
174175
operator.putMetadata(Keys.REFINEMENT, Predicate.createEquals(Predicate.createVar(Keys.WILDCARD), value));
175176
return;
176177
}
177-
String name = Formats.FRESH;
178+
String name = null;
178179
Predicate all;
179180
if (ex instanceof CtVariableWrite<T> w) {
180181
name = w.getVariable().getSimpleName();
@@ -211,9 +212,8 @@ public <T> void getUnaryOpRefinements(CtUnaryOperator<T> operator) throws LJErro
211212
type = operator.getFactory().Type().booleanPrimitiveType();
212213
}
213214
Predicate metadata = rtc.getRefinement(ex);
214-
String newName = !name.equals(Formats.FRESH)
215-
? String.format(Formats.INSTANCE, name, rtc.getContext().getCounter())
216-
: String.format(name, rtc.getContext().getCounter());
215+
String newName = name != null ? String.format(Formats.INSTANCE, name, rtc.getContext().getCounter())
216+
: GeneratedNames.valueOf(ex, rtc.getContext().getCounter());
217217
Predicate newMeta = metadata.substituteVariable(Keys.WILDCARD, newName);
218218

219219
Predicate unOp = getOperatorFromKind(operator.getKind(), operator);
@@ -254,7 +254,7 @@ private Predicate getOperationRefinements(CtBinaryOperator<?> operator, CtVariab
254254
CtExpression<?> element) throws LJError {
255255
if (element instanceof CtFieldRead<?> field) {
256256
if (field.getVariable().getSimpleName().equals("length")) {
257-
String name = String.format(Formats.FRESH, rtc.getContext().getCounter());
257+
String name = GeneratedNames.valueOf(field, rtc.getContext().getCounter());
258258
rtc.getContext().addVarToContext(name, element.getType(),
259259
rtc.getRefinement(element).substituteVariable(Keys.WILDCARD, name), field);
260260
return Predicate.createVar(name);
@@ -327,7 +327,7 @@ private Predicate getOperationRefinements(CtBinaryOperator<?> operator, CtVariab
327327
Predicate innerRefs = fi.getRenamedRefinements(rtc.getContext(), inv); // TODO REVIEW!!
328328

329329
// Substitute _ by the variable that we send
330-
String newName = String.format(Formats.FRESH, rtc.getContext().getCounter());
330+
String newName = GeneratedNames.valueOf(inv, rtc.getContext().getCounter());
331331
innerRefs = innerRefs.substituteVariable(Keys.WILDCARD, newName);
332332
rtc.getContext().addVarToContext(newName, fi.getType(), innerRefs, inv);
333333
return new Predicate(newName, inv); // Return variable that represents the invocation
@@ -341,7 +341,7 @@ private Predicate getOperationRefinements(CtBinaryOperator<?> operator, CtVariab
341341
* method without refinements
342342
*/
343343
private Predicate getUnconstrainedInvocationVariable(CtInvocation<?> inv) {
344-
String newName = String.format(Formats.FRESH, rtc.getContext().getCounter());
344+
String newName = GeneratedNames.valueOf(inv, rtc.getContext().getCounter());
345345
rtc.getContext().addVarToContext(newName, inv.getType(), new Predicate(), inv);
346346
return new Predicate(newName, inv);
347347
}
@@ -365,7 +365,7 @@ private Predicate getOperationRefinementFromExternalLib(CtInvocation<?> inv) thr
365365
Predicate innerRefs = fi.getRenamedRefinements(rtc.getContext(), inv); // TODO REVIEW!!
366366

367367
// Substitute _ by the variable that we send
368-
String newName = String.format(Formats.FRESH, rtc.getContext().getCounter());
368+
String newName = GeneratedNames.valueOf(inv, rtc.getContext().getCounter());
369369
innerRefs = innerRefs.substituteVariable(Keys.WILDCARD, newName);
370370

371371
// change this for the current instance
@@ -476,7 +476,7 @@ private Predicate createFreshValue(CtExpression<?> element, Predicate refinement
476476
}
477477

478478
private Predicate createFreshValue(CtExpression<?> element, CtTypeReference<?> type, Predicate refinement) {
479-
String newName = String.format(Formats.FRESH, rtc.getContext().getCounter());
479+
String newName = GeneratedNames.valueOf(element, rtc.getContext().getCounter());
480480
Predicate freshRefinement = refinement.substituteVariable(Keys.WILDCARD, newName);
481481
rtc.getContext().addVarToContext(newName, type, freshRefinement, element);
482482
return Predicate.createVar(newName);

‎liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/object_checkers/AuxHierarchyRefinementsPassage.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static void transferReturnRefinement(RefinedFunction superFunction, RefinedFunct
9898
if (functionRef.isBooleanTrue())
9999
function.setRefinement(superRef);
100100
else {
101-
String name = String.format(Formats.FRESH, tc.getContext().getCounter());
101+
String name = String.format(Formats.RET, tc.getContext().getCounter());
102102
tc.getContext().addVarToContext(name, superFunction.getType(), new Predicate(), method);
103103
// functionRef might be stronger than superRef
104104
// check (superRef <: functionRef)
@@ -138,7 +138,7 @@ private static void transferStateRefinements(RefinedFunction superFunction, Refi
138138
ObjectState superState = superStates.get(i);
139139
ObjectState subState = subStates.get(i);
140140

141-
String thisName = String.format(Formats.FRESH, tc.getContext().getCounter());
141+
String thisName = String.format(Formats.INSTANCE, Keys.THIS, tc.getContext().getCounter());
142142
createVariableInContext(thisName, tc, subFunction, superFunction, method);
143143

144144
Predicate superConst = matchVariableNames(thisName, superState.getFrom());

‎liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/object_checkers/AuxStateHandler.java‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import liquidjava.processor.state_machine.StateMachineBuilder;
2424
import liquidjava.processor.state_machine.StateSolver;
2525
import liquidjava.rj_language.Predicate;
26+
import liquidjava.utils.GeneratedNames;
2627
import liquidjava.utils.Utils;
2728
import liquidjava.utils.constants.Formats;
2829
import liquidjava.utils.constants.Keys;
@@ -1090,7 +1091,7 @@ public static String prepareInvocationTarget(TypeChecker tc, CtElement target2,
10901091
&& newCall.getMetadata(Keys.REFINEMENT)instanceof Predicate state) {
10911092
// `new T(args).method()`: the receiver is a fresh object in the state the constructor gives. Must come
10921093
// before the TARGET case: a constructor with refined parameters puts its (void) return value in TARGET
1093-
String name = String.format(Formats.FRESH, tc.getContext().getCounter());
1094+
String name = GeneratedNames.valueOf(newCall, tc.getContext().getCounter());
10941095
RefinedVariable receiver = tc.getContext().addInstanceToContext(name, newCall.getType(),
10951096
state.substituteVariable(Keys.THIS, name).substituteVariable(Keys.WILDCARD, name), newCall);
10961097
newCall.putMetadata(Keys.TARGET, receiver);
@@ -1105,7 +1106,7 @@ public static String prepareInvocationTarget(TypeChecker tc, CtElement target2,
11051106
&& !isReturnValue(call)) {
11061107
// `a.get().method()` where get() has no return refinement: the call's TARGET is its own receiver (a), not
11071108
// the value it returns, so the receiver is a fresh value of the call's type, in a state not known here
1108-
String name = String.format(Formats.FRESH, tc.getContext().getCounter());
1109+
String name = GeneratedNames.valueOf(call, tc.getContext().getCounter());
11091110
RefinedVariable receiver = tc.getContext().addInstanceToContext(name, call.getType(), new Predicate(),
11101111
call);
11111112
call.putMetadata(Keys.RECEIVER, receiver);

‎liquidjava-verifier/src/main/java/liquidjava/rj_language/ast/formatter/VariableFormatter.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static String format(String name) {
2828
String receiver = FieldDisplayNames.writeReceiver(name);
2929
if (receiver != null && isField(baseName))
3030
return (receiver.isEmpty() ? "" : receiver + ".") + fieldOf(baseName) + toSuperscript(counter);
31-
String prefix = isSpecialIdentifier(baseName) ? "#" : "";
31+
String prefix = isReturn(baseName) ? "#" : "";
3232
return prefix + formatField(baseName) + toSuperscript(counter);
3333
}
3434

@@ -80,8 +80,8 @@ private static String toSuperscript(String number) {
8080
return sb.toString();
8181
}
8282

83-
private static boolean isSpecialIdentifier(String id) {
84-
return id.equals("fresh") || id.equals("ret");
83+
private static boolean isReturn(String id) {
84+
return id.equals("ret");
8585
}
8686

8787
private static boolean isApplication(String name) {

‎liquidjava-verifier/src/main/java/liquidjava/rj_language/opt/VCBinderSimplification.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@
1111
import liquidjava.rj_language.Predicate;
1212
import liquidjava.rj_language.ast.LiteralBoolean;
1313
import liquidjava.rj_language.ast.Var;
14-
import liquidjava.utils.constants.Formats;
14+
import liquidjava.utils.GeneratedNames;
1515

1616
/**
1717
* Simplifies VCImplication chains by removing vacuous binder implications
1818
*/
1919
public class VCBinderSimplification implements VCSimplificationPass {
2020

21-
private static final String FRESH_PREFIX = Formats.FRESH_PREFIX;
22-
2321
private final NeededVariables needed;
2422

2523
public VCBinderSimplification() {
@@ -104,7 +102,7 @@ private boolean isRemovableBinder(VCImplication implication, Set<String> keptTru
104102
* Checks for a generated boolean path binder refined exactly by itself
105103
*/
106104
private boolean isUnusedFreshPathBinder(VCImplication implication) {
107-
if (!implication.hasNext() || !implication.getName().startsWith(FRESH_PREFIX)
105+
if (!implication.hasNext() || !GeneratedNames.isGenerated(implication.getName())
108106
|| !"boolean".equals(implication.getType().getQualifiedName()))
109107
return false;
110108

0 commit comments

Comments
 (0)