简体   繁体   English

如何证明 (forall x, P x /\\ Q x) -> (forall x, P x)

[英]How to prove (forall x, P x /\ Q x) -> (forall x, P x)

How does one prove (forall x, P x /\\ Q x) -> (forall x, P x) in Coq?如何在 Coq 中证明 (forall x, P x /\\ Q x) -> (forall x, P x)? Been trying for hours and can't figure out how to break down the antecedent to something that Coq can digest.已经尝试了几个小时,但不知道如何分解 Coq 可以消化的东西的前因。 (I'm a newb, obviously :) (我是新手,显然:)

You can do it more quickly by just applying H, but this script should be more clear.你可以通过应用 H 来更快地完成它,但是这个脚本应该更清晰。

Lemma foo : forall (A:Type) (P Q: A-> Prop), (forall x, P x /\ Q x) -> (forall x, P x).
intros.
destruct (H x). 
exact H0.
Qed.
Assume ForAll x: P(x) /\ Q(x)
   var x; 
      P(x) //because you assumed it earlier
   ForAll x: P(x)
(ForAll x: P(x) /\ Q(x)) => (ForAll x: P(x))

Intuitivly, if for all x, P(x) AND Q(x) hold, then for all x, P(x) holds.直观地说,如果对于所有 x,P(x) AND Q(x) 成立,那么对于所有 x,P(x) 成立。

尝试

elim (H x).

Actually, I figured this one out when I found this:实际上,当我发现这个时,我想出了这个:

Mathematics for Computer Scientists 2计算机科学家的数学 2

In lesson 5 he solves the exact same problem and uses "cut (P x /\\ Q x)" which re-writes the goal from "P x" to "P x /\\ Q x -> P x".在第 5 课中,他解决了完全相同的问题,并使用“cut (P x /\\ Q x)”将目标从“P x”重写为“P x /\\ Q x -> P x”。 From there you can do some manipulations and when the goal is just "P x /\\ Q x" you can apply "forall x : P x /\\ Q x" and the rest is straightforward.从那里您可以进行一些操作,当目标只是“P x /\\ Q x”时,您可以应用“forall x : P x /\\ Q x”,其余的很简单。

here is the answer:这是答案:

Lemma fa_dist_and   (A : Set) (P : A -> Prop) (Q: A -> Prop): 

(forall x, P x) /\ (forall x, Q x) <-> (forall x : A, P x /\ Q x).

Proof.

split.

intro H.

(destruct H).

intro H1.

split.

(apply H).

(apply H0).

intro H.

split.

intro H1.

(apply H).

intro H1.

(apply H).

Qed.

you can find other solved exercises in this file: https://cse.buffalo.edu/~knepley/classes/cse191/ClassNotes.pdf您可以在此文件中找到其他已解决的练习: https : //cse.buffalo.edu/~knepley/classes/cse191/ClassNotes.pdf

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM