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

Incorrect recursive cycles given for pre/postconditions #719

Closed
nickbattle opened this issue Apr 28, 2020 · 1 comment
Closed

Incorrect recursive cycles given for pre/postconditions #719

nickbattle opened this issue Apr 28, 2020 · 1 comment
Assignees
Labels
bug Incorrect behaviour of the tool language Issues in parser, TC, interpreter, POG or CG Mergable A fix is available on a branch to merge for release
Milestone

Comments

@nickbattle
Copy link
Contributor

The new cyclic mutual recursion checking in Overture 2.7.4 is picking up cycles that pass through the pre- and postconditions of a function. There is an interesting question about the correct behaviour here, but pre/post expressions are not part of the "body" of a function that is being described by the mutual recursion. For example:

functions
	f: nat -> nat
	f(a) ==
		a + 1
	pre g(a) > 0
	post g(a) = 0;
	
	g: nat -> nat
	g(a) ==
		if a > 0 then f(a-1) else 0;

This currently produces two cycles, [f,g,f] and [g,f,g], because of the call to g in the pre/post expressions. But the body of f is not recursive.

I will change the cycle detection to disregard pre/postconditions (the existing logic is wrong anyway, because the order of the post calls does not follow the order of the cycle, rather being all called together when the recursion unwinds).

@nickbattle nickbattle self-assigned this Apr 28, 2020
@nickbattle nickbattle added bug Incorrect behaviour of the tool language Issues in parser, TC, interpreter, POG or CG labels Apr 28, 2020
@nickbattle
Copy link
Contributor Author

Fix now available in ncb/development.

@nickbattle nickbattle added the Mergable A fix is available on a branch to merge for release label Apr 28, 2020
@idhugoid idhugoid added this to the v3.0.0 milestone Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behaviour of the tool language Issues in parser, TC, interpreter, POG or CG Mergable A fix is available on a branch to merge for release
Projects
None yet
Development

No branches or pull requests

2 participants