Definition to_Sctx (a:ShareTree) : nonEmptyTree a -> Sctx.
revert a.
refine (fix f (a:ShareTree)  {struct a} : nonEmptyTree a -> Sctx :=
match a as a' return nonEmptyTree a' -> Sctx with
| Leaf true => fun H => Hole
| Leaf false => fun H => False_rec _ _
| Node l r => fun H =>
match nonEmpty_dec l, nonEmpty_dec r with
| left  Hl, left Hr => NodeB (f l Hl) (f r Hr)
| left  Hl, right _  => NodeL (f l Hl) r
| right _ , left  Hr => NodeR l (f r Hr)
| right Hl, right Hr => False_rec _ _
end
end).
simpl in H; discriminate.
simpl in H; intuition.
Defined.

Lemma relativ_to_Sctx : forall a x H,
relativ_tree a x = fill (to_Sctx a H) x.