coq - 处理让入假设

标签 coq proof dependent-type

作为 Coq 中的一个练习,我试图证明以下函数返回一对长度相等的列表。

Require Import List.

Fixpoint split (A B:Set)(x:list (A*B)) : (list A)*(list B) :=
match x with
|nil => (nil, nil)
|cons (a,b) x1 => let (ta, tb) := split A B x1 in (a::ta, b::tb)
end.

Theorem split_eq_len : forall (A B:Set)(x:list (A*B))(y:list A)(z:list B),(split A B x)=(y,z) -> length y = length z.
Proof.
intros A B x.
elim x.
simpl.
intros y z.
intros H.
injection H.
intros H1 H2.
rewrite <- H1.
rewrite <- H2.
reflexivity.
intros hx.
elim hx.
intros a b tx H y z.
simpl.
intro.

在最后一步之后,我得到一个带有 let 的假设里面的语句,我不知道如何处理:
1 subgoals
A : Set
B : Set
x : list (A * B)
hx : A * B
a : A
b : B
tx : list (A * B)
H : forall (y : list A) (z : list B),
    split A B tx = (y, z) -> length y = length z
y : list A
z : list B
H0 : (let (ta, tb) := split A B tx in (a :: ta, b :: tb)) = (y, z)
______________________________________(1/1)
length y = length z

最佳答案

你想做destruct (split A B tx) .这将打破它,将两部分绑定(bind)到 tatb

关于coq - 处理让入假设,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30947645/

相关文章:

logic - 可以在不使用先前证明的引理的情况下证明 coq (或一般)中的定理吗?

haskell - 打字判断有种类吗?

coq proof : tactic absurd, 它是如何工作的?

linux - Coq:在加载路径中找不到库 Jessie_memory_model

coq - Coq 中的反例证明

dependent-type - Idris:有界 double 的算术

haskell - 将索引仿函数注入(inject)仿函数协积

relation - Coq:通过替换应用传递性

coq - 注释 Coq 证明

proof - 在编写作为传递链接步骤的长链的相等性证明时跟踪 "state"