如何证明10%Z<;Int.max_在Coq中未签名,并且来自COMCERT的Int类型

如何证明10%Z<;Int.max_在Coq中未签名,并且来自COMCERT的Int类型,coq,compcert,Coq,Compcert,我想证明一个Z类型值小于Int.max_unsigned 引理检验:10%Z

我想证明一个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
背后的复杂性,谢谢。