简体   繁体   English

Coall证明的abc:nat,b> = c-> a + b-c = a +(b-c)

[英]Coq proof of forall a b c: nat, b >= c -> a + b - c = a + (b - c)

Does anybody know of a proof in any of the standard libraries of Coq of the following theorem? 有人知道以下定理的Coq的任何标准库中的证明吗? If there is one, I couldn´t find it. 如果有一个,我找不到。

forall abc: nat, b >= c -> a + b - c = a + (b - c) forall abc:nat,b> = c-> a + b-c = a +(b-c)

Thanks in advance, Marcus. 在此先感谢Marcus。

It is unlikely that somewhat specific formulations would be in the standard library. 标准库中不太可能包含某些特定的配方。 In particular, for regular Presburger arithmetic, there is a powerful tactic that is complete, namely omega : 特别是对于常规的Presburger算术,有一个很完整的强大策略,即omega

Require Import Omega.

Theorem t : forall a b c: nat, b >= c -> a + b - c = a + (b - c).
Proof.
  intros. omega.
Qed.

There is a very similar lemma in the Coq standard library (checked with version 8.5pl3), it's called Coq标准库中有一个非常类似的引理(已在8.5pl3版本中进行了检查),称为

Nat.add_sub_assoc
     : forall n m p : nat, p <= m -> n + (m - p) = n + m - p

Here is how it can be used: 使用方法如下:

Require Import Coq.Arith.Arith.

Goal forall a b c: nat, b >= c -> a + b - c = a + (b - c).
  intros a b c H.
  apply (eq_sym (Nat.add_sub_assoc _ _ _ H)).
Qed.

You can use Coq's search facilities to discover it: 您可以使用Coq的搜索工具来发现它:

Require Import Coq.Arith.Arith.
Search (_ + _ - _).

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

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