Section Fix_XY.
Variable X Y:Type.
Variable intX : registered X.
Variable intY : registered Y.
MetaCoq Run (tmGenEncode "sum_enc" (X + Y)).
Hint Resolve sum_enc_correct : Lrewrite.
(* now we must register the non-constant constructors*)
Global Instance term_inl : computableTime' (@inl X Y) (fun _ _ => (1,tt)).
Global Instance term_inr : computableTime' (@inr X Y) (fun _ _ => (1,tt)).
End Fix_XY.
Hint Resolve sum_enc_correct : Lrewrite.

Lemma size_sum X Y `{registered X} `{registered Y} (l: X + Y):
size (enc l) = match l with inl x => size (enc x) + 5 | inr x => size (enc x) + 4 end.