(* Copyright 2010 IMDEA Software Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. *)
(******************************************************************************)
(* This file defines heaps as possibly undefined finite maps from pointer     *)
(* type to dynamic type.                                                      *)
(* Heaps are a special case of Partial Commutative Monoids (pcm)              *)
(******************************************************************************)
Set Implicit Arguments.
Unset Strict Implicit.
Unset Printing Implicit Defensive.
(*************)
(* Locations *)
(*************)
Inductive ptr := ptr_nat of nat.
Definition null := ptr_nat 0.
Definition nat_ptr (x : ptr) := let: ptr_nat y := x in y.
Definition eq_ptr (x y : ptr) : bool :=
match x, y with ptr_nat m, ptr_nat n => m == n end.

(* Specifications: *)
Lemma eq_ptrP : Equality.axiom eq_ptr.
Definition ltn_ptr (x y : ptr) :=
match x, y with ptr_nat m, ptr_nat n => m < n end.
Lemma ltn_ptr_irr : irreflexive ltn_ptr.
End NullLemmas.