简体   繁体   English

Quick Chick eqBoolArrowA_correct 定理

[英]Quick Chick eqBoolArrowA_correct theorem

Passing Quick Chick course from Software foundations I am stuck at the following theorem:通过软件基础的 Quick Chick 课程我坚持以下定理:

Class Eq A :=
{
    eqb: A -> A -> bool;
}.


Instance eqBoolArrowA {A : Type} `{Eq A} : Eq (bool -> A) :=
{
  eqb f1 f2 :=
           (andb (eqb (f1 false) (f2 false)) (eqb (f1 true) (f2 true)))
}.

Theorem eqBoolArrowA_correct : forall (f1 f2 : bool -> bool -> nat),
                                      (eqb f1 f2) = true <-> true = true.
Proof.
  intros. split.
  - destruct (f1 =? f2).
    + intro. assumption.
    + intros H. discriminate H.
  - intros _. destruct (f1 =? f2).
    + reflexivity.
    +

Here we get:在这里我们得到:

1 subgoal (ID 164)

  f1, f2 : bool -> bool -> nat
  ============================
  false = true

Proving true = true -> (eqb f1 f2) = true seems impossible, because (eqb f1 f2) can be false, and in this case we get false = true in empty context, which is unprovable.证明true = true -> (eqb f1 f2) = true似乎是不可能的,因为(eqb f1 f2)可能为 false,在这种情况下,我们在空上下文中得到false = true ,这是无法证明的。

Is this theorem incorrect or am I missing something?这个定理是不正确的还是我遗漏了什么?

That theorem is not valid.该定理无效。

Any proposition P <-> true = true is equivalent to P , and it is not valid that eqb f1 f2 = true for all functions f1, f2 : bool -> A (at least when A has two or more inhabitants).任何命题P <-> true = true等价于P ,并且对于所有函数f1, f2 : bool -> A eqb f1 f2 = true是无效f1, f2 : bool -> A (至少当A有两个或更多居民时)。

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

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