End PartialTreeboxRep_WandQFrame_Ind_Hole.
Module PartialTreeboxRep_Ind_Pred_Ind_Hole.
Fixpoint partial_treebox_rep (pt: partial_tree val) (p_root p_in: val): mpred :=
match pt with
| H => !! (p_root = p_in) && emp
| L pt1 x v t2 =>
EX p : val,
!! (Int.min_signed <= Z.of_nat x <= Int.max_signed /\ tc_val (tptr Tvoid) v) &&
data_at Tsh (tptr t_struct_tree) p p_root *
field_at Tsh t_struct_tree [StructField _key] (Vint (Int.repr (Z.of_nat x))) p *
field_at Tsh t_struct_tree [StructField _value] v p *
partial_treebox_rep pt1 (field_address t_struct_tree [StructField _left] p) p_in *
treebox_rep t2 (field_address t_struct_tree [StructField _right] p)
| R t1 x v pt2 =>
EX p : val,
!! (Int.min_signed <= Z.of_nat x <= Int.max_signed /\ tc_val (tptr Tvoid) v) &&
data_at Tsh (tptr t_struct_tree) p p_root *
field_at Tsh t_struct_tree [StructField _key] (Vint (Int.repr (Z.of_nat x))) p *
field_at Tsh t_struct_tree [StructField _value] v p *
treebox_rep t1 (field_address t_struct_tree [StructField _left] p) *
partial_treebox_rep pt2 (field_address t_struct_tree [StructField _right] p) p_in
end.

(* Specifications: *)
Lemma partial_treebox_rep_singleton_left: forall (t2: tree val) k (v p b: val),
Int.min_signed <= Z.of_nat k <= Int.max_signed ->
is_pointer_or_null v ->
data_at Tsh (tptr t_struct_tree) p b *
field_at Tsh t_struct_tree [StructField _key] (Vint (Int.repr (Z.of_nat k))) p *
field_at Tsh t_struct_tree [StructField _value] v p *
treebox_rep t2 (field_address t_struct_tree [StructField _right] p)
|-- partial_treebox_rep (L H k v t2) b (field_address t_struct_tree [StructField _left] p).
Lemma partial_treebox_rep_singleton_right: forall (t1: tree val) k (v p b: val),
Int.min_signed <= Z.of_nat k <= Int.max_signed ->
is_pointer_or_null v ->
data_at Tsh (tptr t_struct_tree) p b *
field_at Tsh t_struct_tree [StructField _key] (Vint (Int.repr (Z.of_nat k))) p *
field_at Tsh t_struct_tree [StructField _value] v p *
treebox_rep t1 (field_address t_struct_tree [StructField _left] p)
|-- partial_treebox_rep (R t1 k v H) b (field_address t_struct_tree [StructField _right] p).
Lemma partial_treebox_rep_partial_treebox_rep: forall pt12 pt23 p1 p2 p3,
partial_treebox_rep pt12 p2 p1 * partial_treebox_rep pt23 p3 p2 |-- partial_treebox_rep (partial_tree_partial_tree pt23 pt12) p3 p1.
Lemma emp_partial_treebox_rep_H: forall p,
emp |-- partial_treebox_rep H p p.
Lemma treebox_rep_partial_treebox_rep: forall t pt p q,
treebox_rep t p * partial_treebox_rep pt q p |-- treebox_rep (partial_tree_tree pt t) q.