Goal forall (H: forall n m : nat, n = m -> n = 0) x, x = tt.
intros.
dependent destruction x.
reflexivity.
Qed.
Variable A : Set.
Inductive vector : nat -> Type := vnil : vector 0 | vcons : A -> forall {n}, vector n -> vector (S n).
Goal forall n, forall v : vector (S n), vector n.
Goal forall n, forall v : vector (S n), exists v' : vector n, exists a : A, v = vcons a v'.
(* Extraction Unnamed_thm. *)
Inductive type : Type :=
| base : type
| arrow : type -> type -> type.
Notation " t --> t' " := (arrow t t') (at level 20, t' at next level).
Inductive ctx : Type :=
| empty : ctx
| snoc : ctx -> type -> ctx.
Bind Scope context_scope with ctx.
Delimit Scope context_scope with ctx.
Arguments snoc _%context_scope.
Notation " Γ , τ " := (snoc Γ τ) (at level 25, τ at next level, left associativity) : context_scope.
Fixpoint conc (Δ Γ : ctx) : ctx :=
match Δ with
| empty => Γ
| snoc Δ' x => snoc (conc Δ' Γ) x
end.
Notation " Γ  ; Δ " := (conc Δ Γ) (at level 25, left associativity) : context_scope.
Reserved Notation " Γ ⊢ τ " (at level 30, no associativity).
Generalizable All Variables.
Inductive term : ctx -> type -> Type :=
| ax : `(Γ, τ ⊢ τ)
| weak : `{Γ ⊢ τ -> Γ, τ' ⊢ τ}
| abs : `{Γ, τ ⊢ τ' -> Γ ⊢ τ --> τ'}
| app : `{Γ ⊢ τ --> τ' -> Γ ⊢ τ -> Γ ⊢ τ'}
where " Γ ⊢ τ " := (term Γ τ) : type_scope.
Hint Constructors term : lambda.
Local Open Scope context_scope.
Ltac eqns := subst ; reverse ; simplify_dep_elim ; simplify_IH_hyps.
Proof with simpl in * ; eqns ; eauto with lambda.
intros Γ Δ τ H.
dependent induction H.
destruct Δ as [|Δ τ'']...
destruct Δ as [|Δ τ'']...
destruct Δ as [|Δ τ'']...
apply abs.
specialize (IHterm Γ (Δ, τ'', τ))...
intro. eapply app...
Defined.
Proof with simpl in * ; eqns ; eauto with lambda.
intros Γ Δ τ H.
dependent induction H.
destruct Δ as [|Δ τ'']...
induction Δ'...
destruct Δ as [|Δ τ'']...
induction Δ'...
destruct Δ as [|Δ τ'']...
apply abs.
specialize (IHterm Γ (empty, τ))...
apply abs.
specialize (IHterm Γ (Δ, τ'', τ))...
intro. eapply app...
Defined.

Lemma exchange : forall Γ Δ α β τ, term (Γ, α, β ; Δ) τ -> term (Γ, β, α ; Δ) τ.