簡體   English   中英

如何在Coq證明助手中證明所有x,(R x \\ /〜R x)?

[英]How to prove forall x, (R x \/ ~ R x) [in the Coq proof assistant]?

如何證明Coq中的所有forall x, (R x \\/ ~R x) 〜R forall x, (R x \\/ ~R x) 我對此很菜鳥,對這個工具不太了解。 這是我寫的:

Variables D: Set.
Variables R: D -> Prop.
Variables x:D.

Lemma tes : forall x, (R x \/ ~R x).

我試過了,但它只能在自動模式下工作。 而且,如果我打印證明,我將無法理解打印內容的含義(因此,我可以返回並嘗試不在自動模式下進行打印):

Require Import Classical.

Variables D: Set.
Variables R: D -> Prop.
Variables x:D.

Lemma tes : forall x, (R x \/ ~R x).
Proof.
intro.
tauto.
Qed.

Print tes.

tes = 
fun x0 : D =>
NNPP (R x0 \/ ~ R x0)
  (fun H : ~ (R x0 \/ ~ R x0) =>
   (fun H0 : R x0 -> False =>
    (fun H1 : ~ R x0 -> False =>
     (fun H2 : False => False_ind False H2) (H1 H0))
      (fun H1 : ~ R x0 => H (or_intror H1)))
     (fun H0 : R x0 => H (or_introl H0)))
     : forall x : D, R x \/ ~ R x

一種證明它的方法是

Print classic.
Print R.
Print x.
Check R x.
Check classic (R x).
Check fun y => classic (R y).

Definition tes2 : forall x, (R x \/ ~ R x) := fun y => classic (R y).

或使用戰術

Lemma tes3 : forall x, (R x \/ ~ R x). Proof. intro. apply classic. Qed.

Print tes3.

發現的tauto證明是

Lemma tes : forall x, (R x \/ ~R x).
Proof.
intro.
eapply NNPP.
intro.
assert (R x0 -> False).
intro.
eapply H.
eapply or_introl.
exact H0.
assert (~ R x0 -> False).
intro.
eapply H.
eapply or_intror.
exact H1.
assert False.
eapply H1.
exact H0.
eapply False_ind.
exact H2.
Qed.

intro策略建立了lambda抽象,並進行了隱含引入和通用量化引入, apply策略結合了先前證明的定理,並在第一個先決條件已經被證明, exact策略給出了確切的證明條件以及assert策略時執行了慣用法。在沒有給出該規則的任何先決條件的情況下,還會執行慣常用法。 要了解戰術如何操縱證明術語,請在應用戰術之前和之后使用“ Show Proof命令。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM