Skip to content

Return value is not passed on to the prover in postconditions. #61

@jspam

Description

@jspam

See testIndexedReturnVariableReference in InterpreterAstNodeVisitorTest, following test program:

function Integer[] test2(Integer N, Integer[] a)
  _ensures forall Integer i, 0 <= i && i < N : _return[i] ≥ 0
{
  return a
}

Integer[] test := test2(6, {6, 4, 2, 3, 5, 1})

This test fails with an unknown validity interpreter error.

Debugging in InterpreterAstNodeVisitor::getAllSymbols(), one can see that the variable symbolStack is defined as follows:

[{edu.kit.iti.formal.pse.worthwhile.model.ast.VariableDeclaration@56fb2ac4 (name: a)=edu.kit.iti.formal.pse.worthwhile.model.CompositeValue@15, edu.kit.iti.formal.pse.worthwhile.model.ast.VariableDeclaration@ba3bff5 (name: N)=edu.kit.iti.formal.pse.worthwhile.model.IntegerValue@6}, {}]

This means that only the variables a and N are visible in the context of the postcondition, but not the return variable reference, so the return variable reference is not passed on to the prover, which promptly fails to evaluate the quantified expression.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions