proposition: Lemma Lambda_typing_inv Gamma s k B: Gamma ⊢ Lambda k s : B -> exists L A, rev L ++ Gamma ⊢ s : A /\ B = Arr L A /\ length L = k.
proof: Proof. induction k in Gamma, B |-*; cbn. - exists nil. exists B. intuition. - intros H; inv H. edestruct IHk as (? & ? & ?); (eauto 2). intuition. exists (A :: x). exists x0. intuition; cbn; try congruence. now rewrite <-app_assoc. Qed.
imports: List Arith Lia Morphisms FinFun Undecidability.HOU(std.std) Undecidability.HOU.calculus(prelim terms syntax semantics equivalence typing order confluence)