Set Implicit Arguments.
From Undecidability.HOU Require Import std.std calculus.calculus unification.unification.
From Undecidability.HOU Require Import third_order.pcp third_order.encoding.
Definition MPCP' '(c, C) :=
exists I, I ⊆ nats (length C) /\
hd c ++ @concat symbol (select I (heads C)) = tl c ++ concat (select I (tails C)).
(* ** Reduction Function *)
Program Instance MPCP'_to_U P : orduni 3 X :=
{
Gamma₀ :=  redctx (length (snd P));
s₀ :=  redtm (hd (fst P)) (heads (snd P));
t₀ :=  redtm (tl (fst P)) (tails (snd P));
A₀ := (alpha → alpha) → (alpha → alpha) →  alpha;
H1₀ := redtm_typing (hd (fst P)) (heads (snd P));
H2₀ := redtm_typing (tl (fst P)) (tails (snd P));
}.
Next Obligation. now simplify. Qed.
Next Obligation. now simplify. Qed.

(* ** Backward Direction *)
Lemma U3_MPCP' P:
OU 3 X (MPCP'_to_U P) -> MPCP' P.