Open samuelgruetter opened 4 years ago
Running into this as well with
Require Import Lia.
Theorem foo P k (H : forall x, x < k -> P x) n (H2 : n < k - 1) : P n.
firstorder lia.
Tracing through with Set Ltac Debug
, it eventually calls lia in the context
P : nat -> Type
k : nat
H : forall x : nat, x < k -> P x
n : nat
H2 : n < k - 1
X : n < k -> P n
============================
P n
That obviously fails, so it ends up calling lia without X in the context. This also fails, so firstorder fails. What's interesting to me is that it never tries applying H or X the goal, which would result in a subgoal that lia can solve.
Here is another minimal example of the unexpected Tactic failure: No link.
issue:
Require Import Lia.
Axiom P: Prop.
Goal forall (n : nat), (n - 0 = n -> P) -> P.
Proof.
intros n H.
Fail firstorder lia. (* Tactic failure: No link. *)
apply H. lia. (* No more subgoals. *)
Qed.
In the above, firstorder lia
does absolutely nothing before calling lia
and failing.
As a side note, the original example by @samuelgruetter (using Axiom P: (Z -> Prop) -> stmt -> Prop.
) is more related to lia
.
The issue is that firstorder
eagerly unfolds a comparison in Z
which lia
cannot handle without additional info.
Therefore, with Require Import ZifyComparison.
the tactic firstorder lia.
solves the goal.
fails with a cryptic
Error: Tactic failure: No link.
, whereas this solves the goal:I assume it fails because this goal is not first order logic?
Desired behavior: It should fail with "Not a first order logic goal" or it should solve the goal.
Coq version: 8.11.0