首先,您的定义less_than
有点不幸,因为第二个构造函数是多余的。您应该考虑切换到更简单的:
Inductive less_than : nat -> nat -> Prop :=
| ltO : forall a, less_than O (S a)
| ltS : forall a b, less_than a b -> less_than (S a) (S b)
.
然后反转将匹配 coq 的反转,使您的证明变得微不足道:
Lemma inv_ltS: forall a b, less_than (S a) (S b) -> less_than a b.
Proof. now inversion 1. Qed.
第二个子句是多余的,因为对于每对(a, b)
st。你想要一个证明less_than a b
,你可以随时申请lt3
a
次再申请lt1
。您lt2
实际上是其他两个构造函数的结果:
Ltac inv H := inversion H; subst; clear H; try tauto.
(* there is probably an easier way to do that? *)
Lemma lt2 : forall a b, less_than a b -> less_than a (S b).
Proof.
intros a b. revert a. induction b; intros.
inv H.
inv H.
apply ltO.
apply ltS. now apply IHb.
Qed.
现在,如果您真的希望保留您的特定定义,您可以尝试以下证明:
Lemma inv_lt: forall a b, less_than (S a) (S b) -> less_than a b.
Proof.
induction b; intros.
inv H. inv H2.
inv H. apply lt2. now apply IHb.
Qed.