Section Exports.
Variables (K : ordType) (T : Type) (U : union_map_class K T).
Implicit Types (j : ctx U) (ts : seq (term T)).
Notation form := Syntactify.form.
Notation untag := Syntactify.untag.
(* the main lemma; notice how residuals rs1, rs2 are passed to g to compute *)

Lemma domeqX m j k rs1 rs2 ts1 (f1 : form (empx U) j ts1)
(g : rform j k ts1 m (rs1, rs2)) :
dom_eq (pprint k (rev rs1)) (pprint k rs2) ->
dom_eq (untag f1) (unpack (pivot g)).