证明coq中列表的所有元素

时间:2016-09-23 01:14:27

标签: coq

如何证明H和我的目标对于列表中的所有元素都相同?

X : Type
P : X -> Prop
l : list X
H : forall n : X, ~ (In n l /\ ~ P n)
______________________________________(1/1)
forall b : X, In b l -> P b

两个陈述~ (In n l /\ ~ P n)In b l -> P b是平等的。我在目标上尝试apply imply_to_or来简化,但无法统一。

谢谢,

1 个答案:

答案 0 :(得分:2)

首先,我们需要一些进口:

Require Import Coq.Logic.Classical_Prop.
Require Import Coq.Lists.List.

当将引理应用于目标时,我们推理“倒退”。 这意味着你需要一个具有暗示作为结果的引理, not premiss。

我们可以Search (~ ?p \/ ?c -> ?p -> ?c).来获取它,这会让你:

or_to_imply: forall P Q : Prop, ~ P \/ Q -> P -> Q

上述引理可行,但我们可以做得更好:我们可以使用tauto策略,瞧,你有一个简单的证据:

Goal forall (X : Type) (P : X -> Prop) (l : list X),
       (forall n, ~ (In n l /\ ~ P n)) ->
       forall b, In b l -> P b.
  intros X P l H b.
  specialize H with b.
  tauto.
Qed.