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.

(* Specifications: *)
Lemma relativ_to_Sctx : forall a x H,
relativ_tree a x = fill (to_Sctx a H) x.
Lemma relativ_stupid1 : forall x y a,
nonEmptyTree x ->
x = relativ_tree a (Node x y) ->
False.
Lemma relativ_stupid2 : forall x y a,
nonEmptyTree y ->
y = relativ_tree a (Node x y) ->
False.
Lemma relativ_stupid3 : forall a1 a2 x,
nonEmptyTree x ->
relativ_tree (Node a1 a2) x = x ->
False.
(* detour finished.  now we can prove the result of interest, which is that relativization is injective on the left *)
Lemma relativ_inv2 : forall a1 a2 x,
nonEmptyTree x ->
relativ_tree a1 x = relativ_tree a2 x ->
a1 = a2.