Let X and x be given.
Assume H1.
Let p be given.
Assume Hp.
Apply UnionE X x H1 to the current goal.
Let x be given.
Assume H2.
Apply H2 to the current goal.
An exact proof term for the current goal is Hp x.