试图解决eqb_trans,我陷入了困境:
Theorem eqb_trans : forall n m p,
n =? m = true ->
m =? p = true ->
n =? p = true.
显然,我们应该使用eqb_true来解决它:
Theorem eqb_true : forall n m,
n =? m = true -> n = m.
--------------------------------------------
Proof.
intros n m p H1 H2. apply eqb_true in H1.
apply eqb_true with (n:=m)(m:=p) in H2.
目前,我们有:
n, m, p : nat
H1 : n = m
H2 : m = p
============================
(n =? p) = true
现在我想对目标使用eqb_true:
apply eqb_true with (m:=p).
但是在这里我们得到一个错误:
Unable to unify "?M1056 = p" with "(n =? p) = true".
为什么不起作用?如何解决?
答案 0 :(得分:2)
将引理应用于目标时,引理的结论必须与目标而不是其前提相统一。该引理的结论采用ember-deocrators
的形式,而您的目标是import { action } from '@ember/object';
。这两个无法统一,从而导致您看到错误。
要证明_ = _
,您需要与(_ =? _) = true
相反,即
eqb_trans
经过简化后,它等同于
eqb_true
答案 1 :(得分:1)
Theorem eqb_trans : forall n m p,
n =? m = true ->
m =? p = true ->
n =? p = true.
Proof.
intros n m p.
repeat rewrite Nat.eqb_eq.
intros.
rewrite H.
exact H0.
Qed.
-检查Nat.eqb_eq。
Nat.eqb_eq
: forall n m : nat, (n =? m) = true <-> n = m