1

我正在尝试展开 Mem.load 并收到错误消息:

错误:无法强制Mem.load转换为可评估的参考。

我写的和 as 完全一样,Definition而且是可展开的。Mem.loadload1

Require Import compcert.common.AST.
Require Import compcert.common.Memory.
Require Import compcert.common.Values.
Require Import compcert.lib.Coqlib.
Require Import compcert.lib.Maps.

Local Notation "a # b" := (PMap.get b a) (at level 1).

Definition load1 (chunk: memory_chunk) (m: mem) (b: block) (ofs: Z): option val :=
  if Mem.valid_access_dec m chunk b ofs Readable
  then Some(decode_val chunk (Mem.getN (size_chunk_nat chunk) ofs (m.(Mem.mem_contents)#b)))
  else None.

Lemma mem_load_eq: forall (c : memory_chunk) (m : mem) (b : block) (ofs : Z),
(load1 c m b ofs) = (Mem.load c m b ofs).
Proof.
  intros.
  unfold load1.
  unfold Mem.load. (*I get error here when unfolding *)
Admitted.
4

1 回答 1

2

compcert.common.Memory模块定义了几个名称Mem.load,包括不透明:

Global Opaque Mem.alloc Mem.free Mem.store Mem.load Mem.storebytes Mem.loadbytes.

这意味着它不能被unfold编辑。

在试图unfold Mem.load说它是之前Transparent,之后一切都会起作用:

Transparent Mem.load.
unfold Mem.load.
于 2016-10-14T20:22:33.677 回答