如何证明10%Z<;Int.max_在Coq中未签名,并且来自COMCERT的Int类型
我想证明一个Z类型值小于Int.max_unsigned 引理检验:10%Z如何证明10%Z<;Int.max_在Coq中未签名,并且来自COMCERT的Int类型,coq,compcert,Coq,Compcert,我想证明一个Z类型值小于Int.max_unsigned 引理检验:10%Z
自动策略来证明。例如:
Require Import ZArith.
Open Scope Z_scope.
Lemma test: 10 < 111.
Proof.
auto with zarith.
Qed.
需要导入ZArith。
打开范围Z_范围。
引理检验:10<111。
证明。
和zarith在一起。
Qed。
这些简单的定理可以用自动策略来证明。例如:
Require Import ZArith.
Open Scope Z_scope.
Lemma test: 10 < 111.
Proof.
auto with zarith.
Qed.
需要导入ZArith。
打开范围Z_范围。
引理检验:10<111。
证明。
和zarith在一起。
Qed。
CompCert的Int.max\u unsigned
是根据许多其他概念定义的,如Int.module
,Int.wordsize
,以及用于将一些n
计算为2的幂的two-u-power\u-nat
函数。通过一个接一个地展开这些定义并观察发生了什么来理解事物是如何组织的是很有启发性的:
unfold Int.max_unsigned.
(* 10 < Int.modulus - 1 *)
unfold Int.modulus.
(* 10 < two_power_nat Int.wordsize - 1 *)
unfold Int.wordsize.
(* 10 < two_power_nat Wordsize_32.wordsize - 1 *)
CompCert的Int.max\u unsigned
是根据许多其他概念定义的,如Int.module
,Int.wordsize
,以及用于将一些n
计算为2的幂的two\u power\u nat
函数。通过一个接一个地展开这些定义并观察发生了什么来理解事物是如何组织的是很有启发性的:
unfold Int.max_unsigned.
(* 10 < Int.modulus - 1 *)
unfold Int.modulus.
(* 10 < two_power_nat Int.wordsize - 1 *)
unfold Int.wordsize.
(* 10 < two_power_nat Wordsize_32.wordsize - 1 *)
这在OP的情况下不起作用,因为CompCert库中的Int.max_unsigned
不是像111
那样的常量。看我的答案。对,需要做一个计算;自反性
。我不知道Int.max_unsigned
背后的复杂性,谢谢。这在OP的情况下不起作用,因为CompCert库中的Int.max_unsigned
不是像111
那样的常数。看我的答案。对,需要做一个计算;自反性
。没有意识到Int.max\u unsigned
背后的复杂性,谢谢。