Instance CompSpecs : compspecs. make_compspecs prog. Defined.
Definition Vprog : varspecs. mk_varspecs prog. Defined.
Inductive tree :=
| LEAF: forall i, 0 <= i <= Int.max_signed -> tree
| NODE: tree -> tree -> tree.
Fixpoint treerep (t: tree) (p: val) : mpred :=
match t with
| LEAF i _ => !! (p = Vint (Int.repr (i+i+1))) && emp
| NODE t1 t2 => EX p1:val, EX p2: val,
data_at Tsh (Tstruct _tree noattr) (p1,p2) p
* treerep t1 p1 * treerep t2 p2
end.
Definition POINTER_BOUNDARY : Z := 1024.
Definition valid_int_or_ptr (x: val) :=
match x with
| Vint i => Int.testbit i 0 = true
\/ Int.unsigned i < POINTER_BOUNDARY
| Vptr b z => Ptrofs.testbit z 0 = false
| _ => False
end.

(* Specifications: *)
Lemma valid_int_or_ptr_ii1:
forall i, valid_int_or_ptr (Vint (Int.repr (i + i + 1))).
Lemma valid_int_or_ptr_i2:
forall i, 0 <= i < POINTER_BOUNDARY ->
valid_int_or_ptr (Vint (Int.repr i)).
Lemma field_compatible_valid_int_or_ptr:
forall p,
field_compatible (Tstruct _tree noattr) [] p ->
valid_int_or_ptr p.
Lemma treerep_local_facts:
forall t p,
treerep t p |--
!! (valid_int_or_ptr p).