使用Coq在Separation Logic中证明堆属性(子集和相等性)

时间:2018-12-22 20:28:19

标签: logic heap coq

我想证明两个引理有助于进一步证明。我已经考虑了几个小时(> = 4个小时)。我想在下面获得有关引理的一些提示或部分或完整的证明。 (这些引理与分离逻辑有关。)

Lemma imply_subset: forall (h1 h2 h: heap), 
  h_union h1 h2 = h -> disjoint h1 h2 -> h_subset h2 h.
Proof.
  Admitted.

Lemma heap_equality1: forall (h1 h2 h h11: heap),
  disjoint h1 h2 -> disjoint h11 h2 -> 
    h_union h1 h2 = h -> h_union h11 h2 = h -> h1 = h11.
Proof.
  Admitted.

下面是一些定义。

(* if heap maps a natural number (address) to
None, we say the address is not a valid address,
or it is not in the domain of the heap *)

Definition heap := nat -> option nat.

(* h1 and h2 have disjoint domain *)
Definition disjoint (h1 h2: heap) : Prop := 
  forall l, not_in_dom l h1 \/ not_in_dom l h2.

(* union of two heaps *)
Definition h_union (h1 h2: heap) : heap :=
  fun l => 
    if (in_not_in_dec l h1) then h1 l else h2 l.

(* h1 is a subset of h2 *)
Definition h_subset (h1 h2: heap) : Prop := 
  forall l n, h1 l = Some n -> h2 l = Some n.

0 个答案:

没有答案