【问题标题】:Introduce previously proved theorem as hypothesis引入先前证明的定理作为假设
【发布时间】:2013-02-15 23:40:51
【问题描述】:

假设我已经在 coq 中证明了某个定理,稍后我想将其作为假设引入另一个定理的证明中。有没有简洁的方法来做到这一点?

当我想做一些事例证明之类的事情时,我通常会需要这样做。而且我发现这样做的一种方法是assert定理的陈述,然后立即证明它,但这似乎有点麻烦。例如,我倾向于写如下内容:

Require Import Arith.EqNat.

Definition Decide P := P \/ ~P.

Theorem decide_eq_nat: forall x y: nat, Decide (x = y).
Proof.
  intros x y. remember (beq_nat x y) as b eqn:E. destruct b.
    left. apply beq_nat_eq. assumption.
    right. apply beq_nat_false. symmetry. assumption. Qed.

Theorem silly: forall x y: nat, x = y \/ x <> y.
Proof.
  intros x y.
  assert (Decide (x = y)) as [E|N] by apply decide_eq_nat.
    left. assumption.
    right. assumption. Qed.

但是有没有比输入整个 assert [statement] by apply [theorem] 更简单的方法?

【问题讨论】:

    标签: coq


    【解决方案1】:

    您可以使用pose proof theorem_name as X.,其中X 是您要介绍的名称。


    如果你要马上销毁它,你也可以:destruct (decide_eq_nat x y).

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多