(*************************************)
(* the automation of the PtUn lemmas *)
(*************************************)
(* First, the mechanism for search-and-replace for the overloaded lemas, *)
(* pattern-matching on heap expressions.                                 *)
Structure tagged_heap := Tag {untag :> heap}.
Definition right_tag := Tag.
Definition left_tag := right_tag.
Canonical found_tag i := left_tag i.
Definition partition_axiom k r (h : tagged_heap) := untag h = k \+ r.
Structure partition (k r : heap) :=
Partition {heap_of :> tagged_heap;
_ : partition_axiom k r heap_of}.

Lemma partitionE r k (f : partition k r) : untag f = k \+ r.