简体   繁体   中英

Quick Chick eqBoolArrowA_correct theorem

Passing Quick Chick course from Software foundations I am stuck at the following theorem:

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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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