我在实现简单功能时遇到问题,我很确定答案是“护航模式”,但我只是不知道如何在这种特殊情况下应用它。这是一个完整的例子:
Require Import Coq.Lists.List.
Definition index_map_spec (domain range: nat) :=
forall n : nat, n < domain -> {v : nat | v < range}.
Lemma lt_pred_l {n m} (H: S n < m): n < m.
Proof. auto with arith. Defined.
Fixpoint natrange_f_spec
(n:nat)
{i o: nat}
(nd: n<i)
(f_spec: index_map_spec i o)
: list nat
:=
match n return list nat with
| 0 => nil
| S n' => cons n' (natrange_f_spec n' (lt_pred_l nd) f_spec)
end.
我得到的错误是:
The term "nd" has type "n < i" while it is expected to have type
"S ?578 < ?579".
所以基本上我想以某种方式匹配 'n' 对于 (n=S p) 它会重写 (n