-
Notifications
You must be signed in to change notification settings - Fork 432
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
default termination tactic: array_dec_dec tactic too eager, and too weak #5027
Comments
Thanks for the report. The issue is somewhere with inductive Term (α: Type): Type where
| Composite : Array (Term α) → Term α
| Atom: α → Term α
-- height of a term
mutual
def max_height' (a: Array (Term α)) (i: Nat) (m: Nat): Nat :=
if h: i < a.size then
max_height' a (i + 1) (max (height' a[i]) m)
else
m
termination_by (sizeOf a, a.size - i)
decreasing_by
. decreasing_with
(with_reducible apply Nat.lt_trans (Array.sizeOf_getElem ..))
-- sizeOf a < sizeOf a
simp_arith
. decreasing_tactic
def height' (f: Term α): Nat :=
match f with
| .Composite a => 1 + max_height' a 0 0
| .Atom _ => 1
termination_by (sizeOf f, 0)
decreasing_by
. decreasing_tactic
end And of course I assume that the lemma should be phrased with It is a bit unfortunate that we even need these lemmas here; I wish there was a way to tell omega all it needs to know about the theory of |
Using `Nat.lt_trans` is too restrictive, and using `Nat.lt_of_lt_of_le` should make this tactic prove more goals. Fixes #5027
Using `Nat.lt_trans` is too restrictive, and using `Nat.lt_of_lt_of_le` should make this tactic prove more goals. This fixes a regression probably introduced by #3991; at least in some cases before that `apply sizeOf_get` would have solved the goal here. And it’s true that this is now subsumed by `simp`, but because of the order that `macro_rules` are tried, the too restrictive variant with `Nat.lt_trans` would be tried before `simp`, without backtracking. Fixes #5027
Prerequisites
Please put an X between the brackets as you perform the following steps:
https://github.com/leanprover/lean4/issues
Avoid dependencies to Mathlib or Batteries.
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
On this example, lean produces a confusing error.
The error is this:
Adding explicit
termination_by
clauses, as in the following, does not help:Steps to Reproduce
Expected behavior:
In order of preference:
Actual behavior:
Obscure error: lean just produce a message about an 'unsolved goal` but this goal is unsolvable.
It's not clear at all from the message that this is related to termination.
Versions
Lean 4.10.0
Additional Information
NA
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
The text was updated successfully, but these errors were encountered: