[英]How do I rewrite negb true to false in Coq?
How do I rewrite
negb true
tofalse
in Coq?如何在Coq
negb true
重写为false
?
I've been searching in the libraries for a simply way to rewrite negb true
to false
. 我一直在库中寻找一种将
negb true
重写为false
的简单方法。
However, I haven't found anything useful. 但是,我还没有发现任何有用的东西。
I know of simpl.
我知道简单
simpl.
, but I prefer the more basic syntax. ,但我更喜欢基本语法。
When you search for lemmas the search engine looks in the imported modules only. 搜索引理时,搜索引擎仅查找导入的模块。
That's why you first need to 这就是为什么您首先需要
Require Import Bool.
Then 然后
Search (negb _ = false).
reveals the lemma 揭示引理
negb_false_iff: forall b : bool, negb b = false <-> b = true
You can use the lemma for rewriting if you Require Import Setoid
. 如果
Require Import Setoid
则可以使用引理进行重写。
Goal negb true = false.
rewrite negb_false_iff. reflexivity. Qed.
You, probably, don't want to use simpl
because you have negb true
in some context and simpl
messes up your goal/hypotheses, because it unfolds too much and creates large unreadable terms. 你,也许,不想使用
simpl
因为你negb true
在某些方面和simpl
弄乱了你的目标/假设,因为它展现太多,造成大量不可读的条款。 You can narrow the context in which simpl
applies by using it this way: 您可以通过以下方式使用
simpl
来缩小应用simpl
的上下文:
simpl (negb true). (* rewrites `negb true` to `false` in the goal *)
or 要么
simpl (negb true) in *. (* rewrites `negb true` in the goal and hypotheses *)
You already know that simpl
will indeed reduce negb true
to false
. 您已经知道
negb true
确实simpl
将negb true
改为false
。 This is because the two are definitionaly equivalent. 这是因为两者在定义上是等效的。
With this knowledge you could first prove the statement that you need, then rewrite with it: 有了这些知识,您可以首先证明所需的语句,然后用它重写:
assert (H: negb true = false) by reflexivity.
rewrite H.
But even better, you can use change
to do all of this in just one line: 但更好的是,您可以使用
change
在一行中完成所有这些操作:
change (negb true) with false.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.