如何在 Coq 的列表末尾进行归纳

How to do induction on the end of a list in Coq

按照标准方式,我对这样的列表进行了归纳

但我想要:

对我来说,x在列表中的位置很重要。

我试过写类似的东西,但没有成功。

在这种情况下,你需要证明自己的归纳原理。但在这里你很幸运,因为你需要的已经在 Coq 的标准库中:

Require Import List.

Check rev_ind.
(*
rev_ind
     : forall (A : Type) (P : list A -> Prop),
       P nil ->
       (forall (x : A) (l : list A), P l -> P (l ++ x :: nil)) ->
       forall l : list A, P l
*)