Coq 应用具有不同字段的函数

Coq 应用具有不同字段的函数,coq,Coq,有没有一种方法可以使我们在Coq中的目标实现减退 例如: 假设: 引理 所以。。。我怎样才能解决这个问题呢?a::l1与l1不同,因此您无法使用该假设 Require Import Coq.Arith.Arith. Require Import Coq.Lists.List. Definition Prefix : forall {t1}, list t1 -> list t1 -> Prop := fun _ l1 l2 => exists l3, l1 ++ l3 =

有没有一种方法可以使我们在Coq中的目标实现减退

例如:

假设:

引理

所以。。。我怎样才能解决这个问题呢?

a::l1与l1不同,因此您无法使用该假设

Require Import Coq.Arith.Arith.
Require Import Coq.Lists.List.

Definition Prefix : forall {t1}, list t1 -> list t1 -> Prop := fun _ l1 l2 =>
  exists l3, l1 ++ l3 = l2.

Conjecture C1 : forall t1 (x1 : t1) l1 l2, Prefix (x1 :: l1) l2 -> exists l3, l2 = x1 :: l3.
Conjecture C2 : forall n1 n2 n3, n1 <= n2 -> n3 + n1 <= n3 + n2.
Conjecture C3 : forall t1 (x1 : t1) l1 l2, Prefix (x1 :: l1) (x1 :: l2) -> Prefix l1 l2.
Hint Resolve C1 C2 C3.

Lemma parte2_1_c : forall l1 l2, Prefix l1 l2 -> sum l1 <= sum l2.
Proof.
intros.
induction l1.
simpl.
SearchAbout(_<=_).
apply le_0_n.
assert (H3 : exists l3, l2 = a :: l3) by info_eauto with *.
destruct H3.
subst.
simpl in *.
Abort.
在执行归纳之前,您还引入了太多变量。这使得归纳假说不那么普遍

Lemma parte2_1_c : forall l1 l2, Prefix l1 l2 -> sum l1 <= sum l2.
Proof.
intros l1.
induction l1.
info_eauto with *.
intros.
assert (H3 : exists l3, l2 = a :: l3) by info_eauto with *.
destruct H3.
subst.
simpl in *.
info_eauto with *.
Qed.

天哪!xD我从未见过函数信息:不要太激动。eauto有点慢。我无法将:info_eauto应用于*。获取错误:语法错误:“.”或“…”,应在[subgoal_command]中的[tractic:tractic]之后。您是否包含了Require导入、推测和提示解析部分?eauto是一种自动定理证明形式。但在直觉主义的高阶依赖型逻辑中寻找证明比在经典的一阶非类型逻辑中更困难。对。注释长度必须为15个字符。
Fixpoint sum (l: list nat) : nat := match l with
  | nil => 0
  | a::t => a + sum t
  end.
Lemma parte2_1_c : forall l1 l2, Prefix l1 l2 -> sum l1 <= sum l2.
Proof.
intros.
induction l1.
simpl.
SearchAbout(_<=_).
apply le_0_n.
SearchAbout(sum).
(*must continue but do not know how to do it...*)
Require Import Coq.Arith.Arith.
Require Import Coq.Lists.List.

Definition Prefix : forall {t1}, list t1 -> list t1 -> Prop := fun _ l1 l2 =>
  exists l3, l1 ++ l3 = l2.

Conjecture C1 : forall t1 (x1 : t1) l1 l2, Prefix (x1 :: l1) l2 -> exists l3, l2 = x1 :: l3.
Conjecture C2 : forall n1 n2 n3, n1 <= n2 -> n3 + n1 <= n3 + n2.
Conjecture C3 : forall t1 (x1 : t1) l1 l2, Prefix (x1 :: l1) (x1 :: l2) -> Prefix l1 l2.
Hint Resolve C1 C2 C3.

Lemma parte2_1_c : forall l1 l2, Prefix l1 l2 -> sum l1 <= sum l2.
Proof.
intros.
induction l1.
simpl.
SearchAbout(_<=_).
apply le_0_n.
assert (H3 : exists l3, l2 = a :: l3) by info_eauto with *.
destruct H3.
subst.
simpl in *.
Abort.
Lemma parte2_1_c : forall l1 l2, Prefix l1 l2 -> sum l1 <= sum l2.
Proof.
intros l1.
induction l1.
info_eauto with *.
intros.
assert (H3 : exists l3, l2 = a :: l3) by info_eauto with *.
destruct H3.
subst.
simpl in *.
info_eauto with *.
Qed.