Section ScanSection.
(* The algorithm is defined as follows: - if the heap is h1 :+ h2, then recurse over h1 and h2 and concatenate the results. - if the heap is x :-> v, then return [x] - otherwise, return [] *)
(* Structure to control the flow of the algorithm *)
Structure tagged_heap := Tag {untag : heap}.
Local Coercion untag : tagged_heap >-> heap.
Definition default_tag := Tag.
Definition ptr_tag := default_tag.
Canonical Structure union_tag h := ptr_tag h.
Definition axiom h s :=
def h -> uniq s /\ forall x, x \in s -> x \in dom h.
(* Main structure *)
Structure form s := Form {heap_of : tagged_heap; _ : axiom heap_of s}.
Local Coercion heap_of : form >-> tagged_heap.

Lemma union_pf s1 s2 (h1 : form s1) (h2 : form s2) :
axiom (union_tag (h1 :+ h2)) (s1 ++ s2).