0
我試圖展開Mem.load可評價的參考,我得到的錯誤:錯誤:無法強迫在COQ
Error: Cannot coerce
Mem.load
to an evaluable reference.
我寫的Mem.load
完全相同的Definition
爲load1
,是展開的。
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.
我想說,我敢肯定'Mem.load'是展開的一個很好的理由,所以OP應該重新考慮他們原來的策略。 – ejgallego
完全同意! ) –