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

Consider excluding obviously-looping local equations from the norm simp call #55

Open
JLimperg opened this issue May 19, 2023 · 2 comments

Comments

@JLimperg
Copy link
Collaborator

Example:

import Aesop

example (n : Nat) : n > 0 → ¬ (n = n - 1) := by
  aesop

This makes simp loop because it repeatedly rewrites n ==> n - 1. We could detect equations of this form and by default exclude them from the norm simp call.

@yangky11
Copy link

Hi @JLimperg, related to this issue, I'm wondering why aesop doesn't just check whether the goal has changed after a normalization tactic and throw an error?

@JLimperg
Copy link
Collaborator Author

Whether the goal has changed is not so easy to detect. You can check for identity of metavariables, which is fast but unreliable. You can check for structural equality of the goal metavariables (contexts and types), which is O(n) in the size of the goal, but then you should also ignore things like changed FVarIds and MVarIds (as long as their types/values are still the same). Lean does not provide a suitable method, but I've now implemented one, so it might indeed be a good idea to use that. Alternatively, I could expose it as a combinator for normalization rules to use if they can't detect goal changes more efficiently (which most rules can).

The example above would not be affected either way because the rewrite rule n ==> n - 1 actually changes the goal in each iteration.

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