@@ -141,14 +141,14 @@ public CelVerifier build() {
141141 public CelVerificationResult isSatisfiable (CelAbstractSyntaxTree ast )
142142 throws CelVerificationException {
143143 Preconditions .checkArgument (ast .isChecked (), "AST must be type-checked." );
144- return checkSatisfiability (ast , false );
144+ return checkSatisfiability (ast , /* searchForCounterexample= */ false );
145145 }
146146
147147 @ Override
148148 public CelVerificationResult isAlwaysTrue (CelAbstractSyntaxTree ast )
149149 throws CelVerificationException {
150150 Preconditions .checkArgument (ast .isChecked (), "AST must be type-checked." );
151- return checkSatisfiability (ast , true );
151+ return checkSatisfiability (ast , /* searchForCounterexample= */ true );
152152 }
153153
154154 @ Override
@@ -191,12 +191,14 @@ public CelVerificationResult verifyEquivalence(
191191 case EXACT_MATCH :
192192 return CelVerificationResult .failed (
193193 "Equivalence violation detected."
194- + getCounterexampleString (ctx , translator .getTypeSystem (), result .model ));
194+ + getCounterexampleString (
195+ ctx , translator .getTypeSystem (), result .model , /* isApproximate= */ false ));
195196 case APPROXIMATE_MATCH :
196197 return CelVerificationResult .inconclusive (
197198 "Inconclusive: a divergence may exist, but it depends on approximations, missing"
198199 + " theories, or loop bounds."
199- + getCounterexampleString (ctx , translator .getTypeSystem (), result .model ));
200+ + getCounterexampleString (
201+ ctx , translator .getTypeSystem (), result .model , /* isApproximate= */ true ));
200202 case TRUNCATED :
201203 return CelVerificationResult .inconclusive (
202204 "Inconclusive: expressions are equivalent within the current loop unroll limit, but"
@@ -244,7 +246,11 @@ private CelVerificationResult checkSatisfiability(
244246 return searchForCounterexample
245247 ? CelVerificationResult .failed (
246248 "Condition is not always true."
247- + getCounterexampleString (ctx , translator .getTypeSystem (), result .model ))
249+ + getCounterexampleString (
250+ ctx ,
251+ translator .getTypeSystem (),
252+ result .model ,
253+ /* isApproximate= */ false ))
248254 : CelVerificationResult .verified ();
249255
250256 case APPROXIMATE_MATCH :
@@ -255,7 +261,9 @@ private CelVerificationResult checkSatisfiability(
255261 : "Inconclusive: a satisfying model may exist, but it depends on"
256262 + " approximations, missing theories, or loop bounds." ;
257263 return CelVerificationResult .inconclusive (
258- prefix + getCounterexampleString (ctx , translator .getTypeSystem (), result .model ));
264+ prefix
265+ + getCounterexampleString (
266+ ctx , translator .getTypeSystem (), result .model , /* isApproximate= */ true ));
259267
260268 case TRUNCATED :
261269 return CelVerificationResult .inconclusive (
@@ -349,8 +357,8 @@ private Solver newSolver(Context ctx) {
349357 }
350358
351359 private static String getCounterexampleString (
352- Context ctx , CelZ3TypeSystem typeSystem , Model model ) {
353- return CelZ3CounterexampleGenerator .generate (ctx , typeSystem , model );
360+ Context ctx , CelZ3TypeSystem typeSystem , Model model , boolean isApproximate ) {
361+ return CelZ3CounterexampleGenerator .generate (ctx , typeSystem , model , isApproximate );
354362 }
355363
356364 CelVerifierZ3Impl (
0 commit comments