减法的Coq证明不可通勤
我想证明,减法在Coq中并没有通勤,但我被卡住了。我相信我想在Coq中证明的陈述将被写成所有AB:nat,AB->a-BB-a的减法的Coq证明不可通勤,coq,coq-tactic,Coq,Coq Tactic,我想证明,减法在Coq中并没有通勤,但我被卡住了。我相信我想在Coq中证明的陈述将被写成所有AB:nat,AB->a-BB-a的 这是我到目前为止的证据 Theorem subtraction_does_not_commute : forall a b : nat, a <> b -> a - b <> b - a. Proof. intros a b C. unfold not; intro H. apply C. 定理减法不通勤: 对于所有AB
这是我到目前为止的证据
Theorem subtraction_does_not_commute :
forall a b : nat, a <> b -> a - b <> b - a.
Proof.
intros a b C.
unfold not; intro H.
apply C.
定理减法不通勤:
对于所有AB:nat,AB->a-BB-a。
证明。
简介a b C。
不展开;介绍H。
应用C。
我想我可以用C:ab
来反驳目标a=b
解决这个问题的一个方法是对a
使用归纳法。然而,如果你开始证明
intros a b C; induction a.
您将陷入困境,因为上下文将有以下假设:
C : S a <> b
IHa : a <> b -> a - b <> b - a
或者,使用omega
策略,我们可以得到一行证明:
Require Import Omega.
Lemma subtraction_does_not_commute :
forall a b : nat, a <> b -> a - b <> b - a.
Proof. intros; omega. Qed.
需要导入欧米茄。
引理减法不通勤:
对于所有AB:nat,AB->a-BB-a。
证明。介绍;欧米茄。Qed。
我建议你先证明aa-bb-a
的引理。您将需要使用归纳法。但是直接证明它没有特别困难。使用omega
,您不再需要归纳法了。当然,谢谢!忘了在这种情况下,我们是在普雷斯伯格算法领域。非常感谢你,工作非常漂亮。Total noob问题我如何找到可用的定义和定理列表,如Nat.sub_such和Nat.sub_0_r?@MikeHarris需要导入Coq.Arith.Arith.
,然后搜索(S u-S)。
或搜索(-0)。
。除了通配符\uu
,Coq的搜索还可以理解搜索(?a+?b=?b+?a)。
——这应该可以找到Nat.add\u comm
。有关更多信息,请参阅。
Require Import Omega.
Lemma subtraction_does_not_commute :
forall a b : nat, a <> b -> a - b <> b - a.
Proof. intros; omega. Qed.