Let w be given.
We will
prove ∃u ∈ X, f u = w.
Apply (ReplE_impred X (λx0 : set ⇒ f x0) w Hw (∃u ∈ X, f u = w)) to the current goal.
Let u be given.
We use u to witness the existential quantifier.
Apply andI to the current goal.
An exact proof term for the current goal is HuX.
rewrite the current goal using Hweq (from right to left).
Use reflexivity.
∎