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

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

Open
jspam opened this issue Feb 17, 2012 · 5 comments
Open

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

jspam opened this issue Feb 17, 2012 · 5 comments
Assignees

Comments

@jspam
Copy link
Member

jspam commented Feb 17, 2012

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.

jspam added a commit that referenced this issue Feb 17, 2012
@ghost ghost assigned FRONDS Feb 17, 2012
@FRONDS FRONDS closed this as completed in da7f5bd Feb 17, 2012
@jspam jspam reopened this Feb 17, 2012
@jspam
Copy link
Member Author

jspam commented Feb 17, 2012

How can you close this issue when the test I wrote for it still fails? This time it is because you didn’t set the type of the _return variable declaration (which, I think, should be the same type as the function’s return type)

@FRONDS
Copy link
Member

FRONDS commented Feb 17, 2012

Because the test fails also because the prover doesn't use the _return variable yet, and I wanted to work on other issues, so I had to commit.

@jspam
Copy link
Member Author

jspam commented Feb 17, 2012

You can commit without marking the issue as fixed by just writing "#61" somewhere in the commit message. That way the commit will be mentioned here without the issue being closed.

@FRONDS FRONDS closed this as completed in 1fb1df6 Feb 18, 2012
@jspam jspam reopened this Feb 18, 2012
@jspam
Copy link
Member Author

jspam commented Feb 18, 2012

The base type of the array type is not set, see note on 1fb1df6#L0R1148 line 1148

@jspam
Copy link
Member Author

jspam commented Feb 18, 2012

Fixed in e1f9c3a, for some reason GitHub is not displaying this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants