Section typed_heaps.
Inductive htype:=
|char
|short1
|short2.
Inductive ht_ord: htype -> htype -> Prop :=
|htype_refl x: ht_ord x x
|htype_sht1 : ht_ord char short1
|htype_sht2 : ht_ord char short2.
Instance ht_preorder: PreOrder ht_ord.
Notation THeap':= (nat -> option htype).
Definition THvalid (TH:THeap'):=
forall n, TH n = Some short1 <->
TH (S n) = Some short2.
Record THeap: Type :=
{ theap:> nat -> option htype;
th_wf1: THvalid theap}.
Instance THeap_Join': Join THeap' :=
@fun_Join _ _ (@option_Join _ (trivial_Join)).
Inductive THeap_Join: Join THeap :=
| th_join (h1 h2 h3: THeap): THeap_Join' h1 h2 h3 ->
THeap_Join h1 h2 h3.
Instance THeap_SA': @SeparationAlgebra _ THeap_Join':=
@fun_SA _ _ _ (@option_SA _ _ (trivial_SA)).

Lemma THeap_Join_valid:
forall {h1 h2 h3}, THeap_Join' h1 h2 h3 ->
THvalid h1 ->
THvalid h2 ->
THvalid h3.