如何做归纳证明
我必须证明:
Lemma bsuccOK: forall l, value (bsucc l) = S (value l).
有一个归纳证明,但我不明白该怎么做。
这是BSUCC函数:
Fixpoint bsucc (l: list bool): list bool := match l with
|[]=>[]
|r::true=>(bsucc r)::false
|r::false=>r::true
end.
Lemma bsucc_test1: bsucc [false;true;false;true] = [true;true;false;true].
Proof.
easy.
Admitted.
它为代表二进制数字的布尔值列表提供了继任者。
任何帮助将不胜感激!
I have to show that :
Lemma bsuccOK: forall l, value (bsucc l) = S (value l).
with an induction proof, but I don't understand how to do it.
Here is the bsucc function:
Fixpoint bsucc (l: list bool): list bool := match l with
|[]=>[]
|r::true=>(bsucc r)::false
|r::false=>r::true
end.
Lemma bsucc_test1: bsucc [false;true;false;true] = [true;true;false;true].
Proof.
easy.
Admitted.
It gives the successor of a list of booleans representing a binary number.
Any help would be very appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您使用哪个二进制表示?
如果首先考虑最不重要的位,则例如
4
表示为[false; false; true; true]
。这是
bsucc
和value
的定义。注意列表符号中的参数顺序,以及bsucc []
的略有更改。希望没关系。然后,通过
l
诱导,您的目标是可解决的。您也可以使用的策略是CBN
或simper
,case
,重写
和lia
(用于线性算术)。Which binary representation do you use ?
If you consider Least significant bits first, then for instance
4
is represented as[false;false;true]
.Here is a definition of
bsucc
andvalue
. Note the order of arguments in list notations, and a slight change inbsucc []
. Hope it's OK.Then, your goal is solvable, by induction on
l
. Tactics you may also use arecbn
orsimpl
,case
,rewrite
, andlia
(for linear arithmetic).感谢您,这里的答案终于找到了:
Thanks to you, here the answer I finally found: