diff --git a/notebooks/tests/let.ipynb b/notebooks/tests/let.ipynb index 42303a03033289e6aad77e38666201985bf9731f..9315c645d8901075b345d5842f7bbeeec654e2e9 100644 --- a/notebooks/tests/let.ipynb +++ b/notebooks/tests/let.ipynb @@ -488,22 +488,10 @@ { "data": { "text/markdown": [ - "$\\mathit{TRUE}$\n", - "\n", - "**Solution:**\n", - "* $\\mathit{x} = 1$\n", - "* $\\mathit{X} = \\{0,2,4,6,8,10\\}$\n", - "* $\\mathit{y} = 2$\n", - "* $\\mathit{Y} = \\{0,2,4,6,8,10\\}$" + "$\\mathit{TRUE}$" ], "text/plain": [ - "TRUE\n", - "\n", - "Solution:\n", - "\tx = 1\n", - "\tX = {0,2,4,6,8,10}\n", - "\ty = 2\n", - "\tY = {0,2,4,6,8,10}" + "TRUE" ] }, "execution_count": 21, diff --git a/src/main/java/de/prob2/jupyter/ProBKernel.java b/src/main/java/de/prob2/jupyter/ProBKernel.java index d564bc9b03e31f07253c8d0d29d6be6e9c627783..bcff44af8b4bb9c35ddf8d36fde3bc95cae8c45d 100644 --- a/src/main/java/de/prob2/jupyter/ProBKernel.java +++ b/src/main/java/de/prob2/jupyter/ProBKernel.java @@ -445,7 +445,8 @@ public final class ProBKernel extends BaseKernel { /** * Post-process an evaluation result returned by ProB. - * Currently this only handles some special cases when evaluating Event-B formulas while local variables are defined. + * Currently this only handles some special cases when local variables are defined, + * especially in Event-B mode. * In all other cases, * the result is returned unmodified. * @@ -453,13 +454,13 @@ public final class ProBKernel extends BaseKernel { * @return the processed evaluation result */ public @NotNull AbstractEvalResult postprocessEvalResult(final @NotNull AbstractEvalResult aer) { - if (!this.getVariables().isEmpty() && this.isEventBMode() && aer instanceof EvalResult) { + if (!this.getVariables().isEmpty() && aer instanceof EvalResult) { final EvalResult result = (EvalResult)aer; final Map<String, String> solutionValues = new HashMap<>(result.getSolutions()); final String resultValue; - if (result.getValue().equals(EvalResult.TRUE.getValue()) && result.getSolutions().containsKey(CommandUtils.JUPYTER_RESULT_VARIABLE_NAME)) { + if (this.isEventBMode() && result.getValue().equals(EvalResult.TRUE.getValue()) && result.getSolutions().containsKey(CommandUtils.JUPYTER_RESULT_VARIABLE_NAME)) { // Special case for expressions rewritten to predicates by CommandUtils.insertEventBExpressionLetVariables: // extract the special result variable and use it in place of the predicate result (TRUE). resultValue = solutionValues.remove(CommandUtils.JUPYTER_RESULT_VARIABLE_NAME);