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

Termination check failed on decreasing second arg with increasing first #15

Closed
andrey-komarov opened this issue Nov 6, 2015 · 1 comment

Comments

@andrey-komarov
Copy link

The following code fails to termination check:

\static \function
plus' (x y : Nat) : Nat <= \elim y
  | zero => x
  | suc y' => plus' (suc x) y'

However, if we remove suc from first argument, or swap arguments, termination checker accepts the definitions:

\static \function
plus'' (x y : Nat) : Nat <= \elim y
  | zero => x
  | suc y' => suc (plus'' x y')

\static \function
plus''' (x y : Nat) : Nat <= \elim x
  | zero => y
  | suc x' => plus''' x' (suc y)
@valis valis closed this as completed Nov 6, 2015
@valis
Copy link
Collaborator

valis commented Nov 6, 2015

This is expected behaviour. The current implementation of termination checker assumes that the first argument to recursive call that differs from the corresponding parameter of the function is decreasing.

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

No branches or pull requests

2 participants