Library ut_typ

Typing rules for standard PTS.
Require Import ut_term.

Require Import ut_red.

Require Import ut_env.

Require Import base.

Require Import List.

Require Import Peano_dec.

Require Import Compare_dec.

Require Import Lt Le Gt Plus Minus.


Module ut_typ_mod (X:term_sig) (Y:pts_sig X) (TM: ut_term_mod X) (EM: ut_env_mod X TM) (RM: ut_red_mod X TM).
Interactive Module ut_typ_mod started


  Import X Y TM EM RM.
Warning: Notation _ →' _ was already used in scope UT_scope



Typing judgements:
Reserved Notation "Γ ⊢ t : T" (at level 80, t, T at level 30, no associativity) .

Reserved Notation "Γ ⊣ " (at level 80, no associativity).


Inductive wf : Env -> Prop :=
 | wf_nil : nil
 | wf_cons : forall Γ A s, Γ A : !s -> A::Γ
where "Γ ⊣" := (wf Γ) : UT_scope
with typ : Env -> Term -> Term -> Prop :=
 | cSort : forall Γ s t, Ax s t -> Γ -> Γ !s : !t
 | cVar : forall Γ A v, Γ -> A v Γ -> Γ #v : A
 | cPi : forall Γ A B s t u, Rel s t u -> Γ A : !s -> A::Γ B : !t ->
   Γ Π(A), B : !u
 | cLa : forall Γ A B M s1 s2 s3, Rel s1 s2 s3 -> Γ A : !s1 ->
   A::Γ B : !s2 -> A::Γ M : B -> Γ λ[A], M : Π(A), B
 | cApp : forall Γ M N A B , Γ M : Π(A), B -> Γ N : A -> Γ M · N : B[←N]
 | Cnv : forall Γ M A B s, A B -> Γ M : A -> Γ B : !s -> Γ M : B
where "Γ ⊢ t : T" := (typ Γ t T) : UT_scope.
wf, typ are defined
wf_ind is defined
typ_ind is defined



Hint Constructors wf typ.
Warning: the hint: eapply wf_cons will only be used by eauto
Warning: the hint: eapply cPi will only be used by eauto
Warning: the hint: eapply cLa will only be used by eauto
Warning: the hint: eapply cApp will only be used by eauto
Warning: the hint: eapply Cnv will only be used by eauto



Open Scope UT_scope.


Scheme typ_ind' := Induction for typ Sort Prop
      with wf_ind' := Induction for wf Sort Prop.
wf_ind' is defined
typ_ind' is defined
typ_ind', wf_ind' are recursively defined



Combined Scheme typ_induc from typ_ind', wf_ind'.
typ_induc is defined
typ_induc is recursively defined



Basic properties of PTS. Context Validity: if a judgment is valid, its context is well-formed.
Lemma wf_typ : forall Γ t T, Γ t : T -> Γ .
1 subgoals, subgoal 1 (ID 47)
  
  ============================
   forall (Γ : Env) (t T : Term), Γ ⊢ t : T -> Γ ⊣

(dependent evars:)


induction 1; eauto.
No more subgoals.
(dependent evars:)


Qed.
wf_typ is defined



Hint Resolve wf_typ.
Warning: the hint: eapply wf_typ will only be used by eauto



Inversion Lemmas , one for each kind of term from a typing derivation of some particular term, we can infer informations about its type and subterms.

Lemma gen_sort : forall Γ s T, Γ !s : T -> exists t, T !t /\ Ax s t.
1 subgoals, subgoal 1 (ID 150)
  
  ============================
   forall (Γ : Env) (s : Sorts) (T : Term),
   Γ ⊢ !s : T -> exists t : Sorts, (T ≡ !t) /\ Ax s t

(dependent evars:)


intros.
1 subgoals, subgoal 1 (ID 154)
  
  Γ : Env
  s : Sorts
  T : Term
  H : Γ ⊢ !s : T
  ============================
   exists t : Sorts, (T ≡ !t) /\ Ax s t

(dependent evars:)

remember !s as S.
1 subgoals, subgoal 1 (ID 161)
  
  Γ : Env
  s : Sorts
  T : Term
  S : Term
  HeqS : S = !s
  H : Γ ⊢ S : T
  ============================
   exists t : Sorts, (T ≡ !t) /\ Ax s t

(dependent evars:)

revert s HeqS.
1 subgoals, subgoal 1 (ID 163)
  
  Γ : Env
  T : Term
  S : Term
  H : Γ ⊢ S : T
  ============================
   forall s : Sorts, S = !s -> exists t : Sorts, (T ≡ !t) /\ Ax s t

(dependent evars:)

induction H; intros; subst; try discriminate.
2 subgoals, subgoal 1 (ID 254)
  
  Γ : Env
  s : Sorts
  t : Sorts
  H : Ax s t
  H0 : Γ ⊣
  s0 : Sorts
  HeqS : !s = !s0
  ============================
   exists t0 : Sorts, (!t ≡ !t0) /\ Ax s0 t0

subgoal 2 (ID 270) is:
 exists t : Sorts, (B ≡ !t) /\ Ax s0 t
(dependent evars:)


injection HeqS; intros; subst; clear HeqS.
2 subgoals, subgoal 1 (ID 302)
  
  Γ : Env
  t : Sorts
  H0 : Γ ⊣
  s0 : Sorts
  H : Ax s0 t
  ============================
   exists t0 : Sorts, (!t ≡ !t0) /\ Ax s0 t0

subgoal 2 (ID 270) is:
 exists t : Sorts, (B ≡ !t) /\ Ax s0 t
(dependent evars:)

exists t; intuition.
1 subgoals, subgoal 1 (ID 270)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall s0 : Sorts,
           B = !s0 -> exists t : Sorts, (!s ≡ !t) /\ Ax s0 t
  s0 : Sorts
  H0 : Γ ⊢ !s0 : A
  IHtyp1 : forall s : Sorts, !s0 = !s -> exists t : Sorts, (A ≡ !t) /\ Ax s t
  ============================
   exists t : Sorts, (B ≡ !t) /\ Ax s0 t

(dependent evars:)


destruct (IHtyp1 s0) as (t & ? & ?); trivial.
1 subgoals, subgoal 1 (ID 327)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall s0 : Sorts,
           B = !s0 -> exists t : Sorts, (!s ≡ !t) /\ Ax s0 t
  s0 : Sorts
  H0 : Γ ⊢ !s0 : A
  IHtyp1 : forall s : Sorts, !s0 = !s -> exists t : Sorts, (A ≡ !t) /\ Ax s t
  t : Sorts
  H2 : A ≡ !t
  H3 : Ax s0 t
  ============================
   exists t0 : Sorts, (B ≡ !t0) /\ Ax s0 t0

(dependent evars:)

exists t; split.
2 subgoals, subgoal 1 (ID 331)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall s0 : Sorts,
           B = !s0 -> exists t : Sorts, (!s ≡ !t) /\ Ax s0 t
  s0 : Sorts
  H0 : Γ ⊢ !s0 : A
  IHtyp1 : forall s : Sorts, !s0 = !s -> exists t : Sorts, (A ≡ !t) /\ Ax s t
  t : Sorts
  H2 : A ≡ !t
  H3 : Ax s0 t
  ============================
   B ≡ !t

subgoal 2 (ID 332) is:
 Ax s0 t
(dependent evars:)


eauto.
1 subgoals, subgoal 1 (ID 332)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall s0 : Sorts,
           B = !s0 -> exists t : Sorts, (!s ≡ !t) /\ Ax s0 t
  s0 : Sorts
  H0 : Γ ⊢ !s0 : A
  IHtyp1 : forall s : Sorts, !s0 = !s -> exists t : Sorts, (A ≡ !t) /\ Ax s t
  t : Sorts
  H2 : A ≡ !t
  H3 : Ax s0 t
  ============================
   Ax s0 t

(dependent evars: ?345 using ,)

trivial.
No more subgoals.
(dependent evars: ?345 using ,)


Qed.
gen_sort is defined



Lemma gen_var : forall Γ x A, Γ #x : A -> exists A', A A' /\ A' x Γ .
1 subgoals, subgoal 1 (ID 432)
  
  ============================
   forall (Γ : Env) (x : Vars) (A : Term),
   Γ ⊢ #x : A -> exists A' : Term, (A ≡ A') /\ A' ↓ x ⊂ Γ

(dependent evars:)


intros.
1 subgoals, subgoal 1 (ID 436)
  
  Γ : Env
  x : Vars
  A : Term
  H : Γ ⊢ #x : A
  ============================
   exists A' : Term, (A ≡ A') /\ A' ↓ x ⊂ Γ

(dependent evars:)

remember #x as X.
1 subgoals, subgoal 1 (ID 443)
  
  Γ : Env
  x : Vars
  A : Term
  X : Term
  HeqX : X = #x
  H : Γ ⊢ X : A
  ============================
   exists A' : Term, (A ≡ A') /\ A' ↓ x ⊂ Γ

(dependent evars:)

revert x HeqX.
1 subgoals, subgoal 1 (ID 445)
  
  Γ : Env
  A : Term
  X : Term
  H : Γ ⊢ X : A
  ============================
   forall x : Vars, X = #x -> exists A' : Term, (A ≡ A') /\ A' ↓ x ⊂ Γ

(dependent evars:)

induction H; intros; subst; try discriminate.
2 subgoals, subgoal 1 (ID 538)
  
  Γ : Env
  A : Term
  v : nat
  H : Γ ⊣
  H0 : A ↓ v ⊂ Γ
  x : Vars
  HeqX : #v = #x
  ============================
   exists A' : Term, (A ≡ A') /\ A' ↓ x ⊂ Γ

subgoal 2 (ID 552) is:
 exists A' : Term, (B ≡ A') /\ A' ↓ x ⊂ Γ
(dependent evars:)


injection HeqX; intros; subst; clear HeqX.
2 subgoals, subgoal 1 (ID 584)
  
  Γ : Env
  A : Term
  H : Γ ⊣
  x : Vars
  H0 : A ↓ x ⊂ Γ
  ============================
   exists A' : Term, (A ≡ A') /\ A' ↓ x ⊂ Γ

subgoal 2 (ID 552) is:
 exists A' : Term, (B ≡ A') /\ A' ↓ x ⊂ Γ
(dependent evars:)


exists A; intuition.
1 subgoals, subgoal 1 (ID 552)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall x : Vars,
           B = #x -> exists A' : Term, (!s ≡ A') /\ A' ↓ x ⊂ Γ
  x : Vars
  H0 : Γ ⊢ #x : A
  IHtyp1 : forall x0 : Vars,
           #x = #x0 -> exists A' : Term, (A ≡ A') /\ A' ↓ x0 ⊂ Γ
  ============================
   exists A' : Term, (B ≡ A') /\ A' ↓ x ⊂ Γ

(dependent evars:)


destruct (IHtyp1 x) as (A' & ? & ?); trivial.
1 subgoals, subgoal 1 (ID 609)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall x : Vars,
           B = #x -> exists A' : Term, (!s ≡ A') /\ A' ↓ x ⊂ Γ
  x : Vars
  H0 : Γ ⊢ #x : A
  IHtyp1 : forall x0 : Vars,
           #x = #x0 -> exists A' : Term, (A ≡ A') /\ A' ↓ x0 ⊂ Γ
  A' : Term
  H2 : A ≡ A'
  H3 : A' ↓ x ⊂ Γ
  ============================
   exists A'0 : Term, (B ≡ A'0) /\ A'0 ↓ x ⊂ Γ

(dependent evars:)

exists A'; split.
2 subgoals, subgoal 1 (ID 613)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall x : Vars,
           B = #x -> exists A' : Term, (!s ≡ A') /\ A' ↓ x ⊂ Γ
  x : Vars
  H0 : Γ ⊢ #x : A
  IHtyp1 : forall x0 : Vars,
           #x = #x0 -> exists A' : Term, (A ≡ A') /\ A' ↓ x0 ⊂ Γ
  A' : Term
  H2 : A ≡ A'
  H3 : A' ↓ x ⊂ Γ
  ============================
   B ≡ A'

subgoal 2 (ID 614) is:
 A' ↓ x ⊂ Γ
(dependent evars:)

eauto.
1 subgoals, subgoal 1 (ID 614)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall x : Vars,
           B = #x -> exists A' : Term, (!s ≡ A') /\ A' ↓ x ⊂ Γ
  x : Vars
  H0 : Γ ⊢ #x : A
  IHtyp1 : forall x0 : Vars,
           #x = #x0 -> exists A' : Term, (A ≡ A') /\ A' ↓ x0 ⊂ Γ
  A' : Term
  H2 : A ≡ A'
  H3 : A' ↓ x ⊂ Γ
  ============================
   A' ↓ x ⊂ Γ

(dependent evars: ?627 using ,)

trivial.
No more subgoals.
(dependent evars: ?627 using ,)


Qed.
gen_var is defined



Lemma gen_pi : forall Γ A B T, Γ Π(A),B : T -> exists s1, exists s2, exists s3,
    T !s3 /\ Rel s1 s2 s3 /\ Γ A : !s1 /\ A::Γ B : !s2 .
1 subgoals, subgoal 1 (ID 718)
  
  ============================
   forall (Γ : Env) (A B T : Term),
   Γ ⊢ Π (A), B : T ->
   exists s1 s2 s3 : Sorts,
     (T ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A : !s1) /\ A :: Γ ⊢ B : !s2

(dependent evars:)


intros.
1 subgoals, subgoal 1 (ID 723)
  
  Γ : Env
  A : Term
  B : Term
  T : Term
  H : Γ ⊢ Π (A), B : T
  ============================
   exists s1 s2 s3 : Sorts,
     (T ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A : !s1) /\ A :: Γ ⊢ B : !s2

(dependent evars:)

remember (Π(A),B) as P.
1 subgoals, subgoal 1 (ID 730)
  
  Γ : Env
  A : Term
  B : Term
  T : Term
  P : Term
  HeqP : P = Π (A), B
  H : Γ ⊢ P : T
  ============================
   exists s1 s2 s3 : Sorts,
     (T ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A : !s1) /\ A :: Γ ⊢ B : !s2

(dependent evars:)

revert A B HeqP.
1 subgoals, subgoal 1 (ID 732)
  
  Γ : Env
  T : Term
  P : Term
  H : Γ ⊢ P : T
  ============================
   forall A B : Term,
   P = Π (A), B ->
   exists s1 s2 s3 : Sorts,
     (T ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A : !s1) /\ A :: Γ ⊢ B : !s2

(dependent evars:)

induction H; intros; subst; try discriminate.
2 subgoals, subgoal 1 (ID 830)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  H : Rel s t u
  H0 : Γ ⊢ A : !s
  H1 : A :: Γ ⊢ B : !t
  IHtyp1 : forall A0 B : Term,
           A = Π (A0), B ->
           exists s1 s2 s3 : Sorts,
             (!s ≡ !s3) /\
             Rel s1 s2 s3 /\ (Γ ⊢ A0 : !s1) /\ A0 :: Γ ⊢ B : !s2
  IHtyp2 : forall A0 B0 : Term,
           B = Π (A0), B0 ->
           exists s1 s2 s3 : Sorts,
             (!t ≡ !s3) /\
             Rel s1 s2 s3 /\ (A :: Γ ⊢ A0 : !s1) /\ A0 :: A :: Γ ⊢ B0 : !s2
  A0 : Term
  B0 : Term
  HeqP : Π (A), B = Π (A0), B0
  ============================
   exists s1 s2 s3 : Sorts,
     (!u ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A0 : !s1) /\ A0 :: Γ ⊢ B0 : !s2

subgoal 2 (ID 845) is:
 exists s1 s2 s3 : Sorts,
   (B ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A0 : !s1) /\ A0 :: Γ ⊢ B0 : !s2
(dependent evars:)


clear IHtyp1 IHtyp2.
2 subgoals, subgoal 1 (ID 866)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  H : Rel s t u
  H0 : Γ ⊢ A : !s
  H1 : A :: Γ ⊢ B : !t
  A0 : Term
  B0 : Term
  HeqP : Π (A), B = Π (A0), B0
  ============================
   exists s1 s2 s3 : Sorts,
     (!u ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A0 : !s1) /\ A0 :: Γ ⊢ B0 : !s2

subgoal 2 (ID 845) is:
 exists s1 s2 s3 : Sorts,
   (B ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A0 : !s1) /\ A0 :: Γ ⊢ B0 : !s2
(dependent evars:)

injection HeqP; intros; subst; clear HeqP.
2 subgoals, subgoal 1 (ID 890)
  
  Γ : Env
  s : Sorts
  t : Sorts
  u : Sorts
  H : Rel s t u
  A0 : Term
  B0 : Term
  H0 : Γ ⊢ A0 : !s
  H1 : A0 :: Γ ⊢ B0 : !t
  ============================
   exists s1 s2 s3 : Sorts,
     (!u ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A0 : !s1) /\ A0 :: Γ ⊢ B0 : !s2

subgoal 2 (ID 845) is:
 exists s1 s2 s3 : Sorts,
   (B ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A0 : !s1) /\ A0 :: Γ ⊢ B0 : !s2
(dependent evars:)


exists s; exists t; exists u; intuition.
1 subgoals, subgoal 1 (ID 845)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall A B0 : Term,
           B = Π (A), B0 ->
           exists s1 s2 s3 : Sorts,
             (!s ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A : !s1) /\ A :: Γ ⊢ B0 : !s2
  A0 : Term
  B0 : Term
  H0 : Γ ⊢ Π (A0), B0 : A
  IHtyp1 : forall A1 B : Term,
           Π (A0), B0 = Π (A1), B ->
           exists s1 s2 s3 : Sorts,
             (A ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A1 : !s1) /\ A1 :: Γ ⊢ B : !s2
  ============================
   exists s1 s2 s3 : Sorts,
     (B ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A0 : !s1) /\ A0 :: Γ ⊢ B0 : !s2

(dependent evars:)


destruct (IHtyp1 A0 B0) as (a & b & c & ? & ? & ? & ?); trivial.
1 subgoals, subgoal 1 (ID 945)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall A B0 : Term,
           B = Π (A), B0 ->
           exists s1 s2 s3 : Sorts,
             (!s ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A : !s1) /\ A :: Γ ⊢ B0 : !s2
  A0 : Term
  B0 : Term
  H0 : Γ ⊢ Π (A0), B0 : A
  IHtyp1 : forall A1 B : Term,
           Π (A0), B0 = Π (A1), B ->
           exists s1 s2 s3 : Sorts,
             (A ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A1 : !s1) /\ A1 :: Γ ⊢ B : !s2
  a : Sorts
  b : Sorts
  c : Sorts
  H2 : A ≡ !c
  H3 : Rel a b c
  H4 : Γ ⊢ A0 : !a
  H5 : A0 :: Γ ⊢ B0 : !b
  ============================
   exists s1 s2 s3 : Sorts,
     (B ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A0 : !s1) /\ A0 :: Γ ⊢ B0 : !s2

(dependent evars:)

exists a; exists b; exists c; split.
2 subgoals, subgoal 1 (ID 953)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall A B0 : Term,
           B = Π (A), B0 ->
           exists s1 s2 s3 : Sorts,
             (!s ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A : !s1) /\ A :: Γ ⊢ B0 : !s2
  A0 : Term
  B0 : Term
  H0 : Γ ⊢ Π (A0), B0 : A
  IHtyp1 : forall A1 B : Term,
           Π (A0), B0 = Π (A1), B ->
           exists s1 s2 s3 : Sorts,
             (A ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A1 : !s1) /\ A1 :: Γ ⊢ B : !s2
  a : Sorts
  b : Sorts
  c : Sorts
  H2 : A ≡ !c
  H3 : Rel a b c
  H4 : Γ ⊢ A0 : !a
  H5 : A0 :: Γ ⊢ B0 : !b
  ============================
   B ≡ !c

subgoal 2 (ID 954) is:
 Rel a b c /\ (Γ ⊢ A0 : !a) /\ A0 :: Γ ⊢ B0 : !b
(dependent evars:)


eauto.
1 subgoals, subgoal 1 (ID 954)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall A B0 : Term,
           B = Π (A), B0 ->
           exists s1 s2 s3 : Sorts,
             (!s ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A : !s1) /\ A :: Γ ⊢ B0 : !s2
  A0 : Term
  B0 : Term
  H0 : Γ ⊢ Π (A0), B0 : A
  IHtyp1 : forall A1 B : Term,
           Π (A0), B0 = Π (A1), B ->
           exists s1 s2 s3 : Sorts,
             (A ≡ !s3) /\ Rel s1 s2 s3 /\ (Γ ⊢ A1 : !s1) /\ A1 :: Γ ⊢ B : !s2
  a : Sorts
  b : Sorts
  c : Sorts
  H2 : A ≡ !c
  H3 : Rel a b c
  H4 : Γ ⊢ A0 : !a
  H5 : A0 :: Γ ⊢ B0 : !b
  ============================
   Rel a b c /\ (Γ ⊢ A0 : !a) /\ A0 :: Γ ⊢ B0 : !b

(dependent evars: ?967 using ,)

intuition.
No more subgoals.
(dependent evars: ?967 using ,)


Qed.
gen_pi is defined



Lemma gen_la : forall Γ A M T, Γ λ[A],M : T -> exists s1, exists s2, exists s3, exists B,
    T Π(A), B /\ Rel s1 s2 s3 /\ Γ A : !s1 /\ A::Γ M : B /\ A::Γ B : !s2.
1 subgoals, subgoal 1 (ID 1067)
  
  ============================
   forall (Γ : Env) (A M T : Term),
   Γ ⊢ λ [A], M : T ->
   exists (s1 s2 s3 : Sorts) (B : Term),
     (T ≡ Π (A), B) /\
     Rel s1 s2 s3 /\ (Γ ⊢ A : !s1) /\ (A :: Γ ⊢ M : B) /\ A :: Γ ⊢ B : !s2

(dependent evars:)


intros.
1 subgoals, subgoal 1 (ID 1072)
  
  Γ : Env
  A : Term
  M : Term
  T : Term
  H : Γ ⊢ λ [A], M : T
  ============================
   exists (s1 s2 s3 : Sorts) (B : Term),
     (T ≡ Π (A), B) /\
     Rel s1 s2 s3 /\ (Γ ⊢ A : !s1) /\ (A :: Γ ⊢ M : B) /\ A :: Γ ⊢ B : !s2

(dependent evars:)

remember (λ[A],M) as L.
1 subgoals, subgoal 1 (ID 1079)
  
  Γ : Env
  A : Term
  M : Term
  T : Term
  L : Term
  HeqL : L = λ [A], M
  H : Γ ⊢ L : T
  ============================
   exists (s1 s2 s3 : Sorts) (B : Term),
     (T ≡ Π (A), B) /\
     Rel s1 s2 s3 /\ (Γ ⊢ A : !s1) /\ (A :: Γ ⊢ M : B) /\ A :: Γ ⊢ B : !s2

(dependent evars:)

revert A M HeqL.
1 subgoals, subgoal 1 (ID 1081)
  
  Γ : Env
  T : Term
  L : Term
  H : Γ ⊢ L : T
  ============================
   forall A M : Term,
   L = λ [A], M ->
   exists (s1 s2 s3 : Sorts) (B : Term),
     (T ≡ Π (A), B) /\
     Rel s1 s2 s3 /\ (Γ ⊢ A : !s1) /\ (A :: Γ ⊢ M : B) /\ A :: Γ ⊢ B : !s2

(dependent evars:)

induction H; intros ; subst; try discriminate.
2 subgoals, subgoal 1 (ID 1182)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  H : Rel s1 s2 s3
  H0 : Γ ⊢ A : !s1
  H1 : A :: Γ ⊢ B : !s2
  H2 : A :: Γ ⊢ M : B
  IHtyp1 : forall A0 M : Term,
           A = λ [A0], M ->
           exists (s2 s3 s4 : Sorts) (B : Term),
             (!s1 ≡ Π (A0), B) /\
             Rel s2 s3 s4 /\
             (Γ ⊢ A0 : !s2) /\ (A0 :: Γ ⊢ M : B) /\ A0 :: Γ ⊢ B : !s3
  IHtyp2 : forall A0 M : Term,
           B = λ [A0], M ->
           exists (s1 s3 s4 : Sorts) (B : Term),
             (!s2 ≡ Π (A0), B) /\
             Rel s1 s3 s4 /\
             (A :: Γ ⊢ A0 : !s1) /\
             (A0 :: A :: Γ ⊢ M : B) /\ A0 :: A :: Γ ⊢ B : !s3
  IHtyp3 : forall A0 M0 : Term,
           M = λ [A0], M0 ->
           exists (s1 s2 s3 : Sorts) (B0 : Term),
             (B ≡ Π (A0), B0) /\
             Rel s1 s2 s3 /\
             (A :: Γ ⊢ A0 : !s1) /\
             (A0 :: A :: Γ ⊢ M0 : B0) /\ A0 :: A :: Γ ⊢ B0 : !s2
  A0 : Term
  M0 : Term
  HeqL : λ [A], M = λ [A0], M0
  ============================
   exists (s0 s4 s5 : Sorts) (B0 : Term),
     (Π (A), B ≡ Π (A0), B0) /\
     Rel s0 s4 s5 /\
     (Γ ⊢ A0 : !s0) /\ (A0 :: Γ ⊢ M0 : B0) /\ A0 :: Γ ⊢ B0 : !s4

subgoal 2 (ID 1194) is:
 exists (s1 s2 s3 : Sorts) (B0 : Term),
   (B ≡ Π (A0), B0) /\
   Rel s1 s2 s3 /\
   (Γ ⊢ A0 : !s1) /\ (A0 :: Γ ⊢ M0 : B0) /\ A0 :: Γ ⊢ B0 : !s2
(dependent evars:)


clear IHtyp1 IHtyp2 IHtyp3.
2 subgoals, subgoal 1 (ID 1215)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  H : Rel s1 s2 s3
  H0 : Γ ⊢ A : !s1
  H1 : A :: Γ ⊢ B : !s2
  H2 : A :: Γ ⊢ M : B
  A0 : Term
  M0 : Term
  HeqL : λ [A], M = λ [A0], M0
  ============================
   exists (s0 s4 s5 : Sorts) (B0 : Term),
     (Π (A), B ≡ Π (A0), B0) /\
     Rel s0 s4 s5 /\
     (Γ ⊢ A0 : !s0) /\ (A0 :: Γ ⊢ M0 : B0) /\ A0 :: Γ ⊢ B0 : !s4

subgoal 2 (ID 1194) is:
 exists (s1 s2 s3 : Sorts) (B0 : Term),
   (B ≡ Π (A0), B0) /\
   Rel s1 s2 s3 /\
   (Γ ⊢ A0 : !s1) /\ (A0 :: Γ ⊢ M0 : B0) /\ A0 :: Γ ⊢ B0 : !s2
(dependent evars:)

injection HeqL; intros; subst; clear HeqL.
2 subgoals, subgoal 1 (ID 1240)
  
  Γ : Env
  B : Term
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  H : Rel s1 s2 s3
  A0 : Term
  M0 : Term
  H0 : Γ ⊢ A0 : !s1
  H1 : A0 :: Γ ⊢ B : !s2
  H2 : A0 :: Γ ⊢ M0 : B
  ============================
   exists (s0 s4 s5 : Sorts) (B0 : Term),
     (Π (A0), B ≡ Π (A0), B0) /\
     Rel s0 s4 s5 /\
     (Γ ⊢ A0 : !s0) /\ (A0 :: Γ ⊢ M0 : B0) /\ A0 :: Γ ⊢ B0 : !s4

subgoal 2 (ID 1194) is:
 exists (s1 s2 s3 : Sorts) (B0 : Term),
   (B ≡ Π (A0), B0) /\
   Rel s1 s2 s3 /\
   (Γ ⊢ A0 : !s1) /\ (A0 :: Γ ⊢ M0 : B0) /\ A0 :: Γ ⊢ B0 : !s2
(dependent evars:)


exists s1; exists s2; exists s3; exists B; intuition.
1 subgoals, subgoal 1 (ID 1194)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall A M : Term,
           B = λ [A], M ->
           exists (s1 s2 s3 : Sorts) (B : Term),
             (!s ≡ Π (A), B) /\
             Rel s1 s2 s3 /\
             (Γ ⊢ A : !s1) /\ (A :: Γ ⊢ M : B) /\ A :: Γ ⊢ B : !s2
  A0 : Term
  M0 : Term
  H0 : Γ ⊢ λ [A0], M0 : A
  IHtyp1 : forall A1 M : Term,
           λ [A0], M0 = λ [A1], M ->
           exists (s1 s2 s3 : Sorts) (B : Term),
             (A ≡ Π (A1), B) /\
             Rel s1 s2 s3 /\
             (Γ ⊢ A1 : !s1) /\ (A1 :: Γ ⊢ M : B) /\ A1 :: Γ ⊢ B : !s2
  ============================
   exists (s1 s2 s3 : Sorts) (B0 : Term),
     (B ≡ Π (A0), B0) /\
     Rel s1 s2 s3 /\
     (Γ ⊢ A0 : !s1) /\ (A0 :: Γ ⊢ M0 : B0) /\ A0 :: Γ ⊢ B0 : !s2

(dependent evars:)


destruct (IHtyp1 A0 M0) as (a & b & c & D &? &? & ? & ? & ?); trivial.
1 subgoals, subgoal 1 (ID 1310)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall A M : Term,
           B = λ [A], M ->
           exists (s1 s2 s3 : Sorts) (B : Term),
             (!s ≡ Π (A), B) /\
             Rel s1 s2 s3 /\
             (Γ ⊢ A : !s1) /\ (A :: Γ ⊢ M : B) /\ A :: Γ ⊢ B : !s2
  A0 : Term
  M0 : Term
  H0 : Γ ⊢ λ [A0], M0 : A
  IHtyp1 : forall A1 M : Term,
           λ [A0], M0 = λ [A1], M ->
           exists (s1 s2 s3 : Sorts) (B : Term),
             (A ≡ Π (A1), B) /\
             Rel s1 s2 s3 /\
             (Γ ⊢ A1 : !s1) /\ (A1 :: Γ ⊢ M : B) /\ A1 :: Γ ⊢ B : !s2
  a : Sorts
  b : Sorts
  c : Sorts
  D : Term
  H2 : A ≡ Π (A0), D
  H3 : Rel a b c
  H4 : Γ ⊢ A0 : !a
  H5 : A0 :: Γ ⊢ M0 : D
  H6 : A0 :: Γ ⊢ D : !b
  ============================
   exists (s1 s2 s3 : Sorts) (B0 : Term),
     (B ≡ Π (A0), B0) /\
     Rel s1 s2 s3 /\
     (Γ ⊢ A0 : !s1) /\ (A0 :: Γ ⊢ M0 : B0) /\ A0 :: Γ ⊢ B0 : !s2

(dependent evars:)


exists a; exists b; exists c; exists D; split.
2 subgoals, subgoal 1 (ID 1320)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall A M : Term,
           B = λ [A], M ->
           exists (s1 s2 s3 : Sorts) (B : Term),
             (!s ≡ Π (A), B) /\
             Rel s1 s2 s3 /\
             (Γ ⊢ A : !s1) /\ (A :: Γ ⊢ M : B) /\ A :: Γ ⊢ B : !s2
  A0 : Term
  M0 : Term
  H0 : Γ ⊢ λ [A0], M0 : A
  IHtyp1 : forall A1 M : Term,
           λ [A0], M0 = λ [A1], M ->
           exists (s1 s2 s3 : Sorts) (B : Term),
             (A ≡ Π (A1), B) /\
             Rel s1 s2 s3 /\
             (Γ ⊢ A1 : !s1) /\ (A1 :: Γ ⊢ M : B) /\ A1 :: Γ ⊢ B : !s2
  a : Sorts
  b : Sorts
  c : Sorts
  D : Term
  H2 : A ≡ Π (A0), D
  H3 : Rel a b c
  H4 : Γ ⊢ A0 : !a
  H5 : A0 :: Γ ⊢ M0 : D
  H6 : A0 :: Γ ⊢ D : !b
  ============================
   B ≡ Π (A0), D

subgoal 2 (ID 1321) is:
 Rel a b c /\ (Γ ⊢ A0 : !a) /\ (A0 :: Γ ⊢ M0 : D) /\ A0 :: Γ ⊢ D : !b
(dependent evars:)

eauto.
1 subgoals, subgoal 1 (ID 1321)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall A M : Term,
           B = λ [A], M ->
           exists (s1 s2 s3 : Sorts) (B : Term),
             (!s ≡ Π (A), B) /\
             Rel s1 s2 s3 /\
             (Γ ⊢ A : !s1) /\ (A :: Γ ⊢ M : B) /\ A :: Γ ⊢ B : !s2
  A0 : Term
  M0 : Term
  H0 : Γ ⊢ λ [A0], M0 : A
  IHtyp1 : forall A1 M : Term,
           λ [A0], M0 = λ [A1], M ->
           exists (s1 s2 s3 : Sorts) (B : Term),
             (A ≡ Π (A1), B) /\
             Rel s1 s2 s3 /\
             (Γ ⊢ A1 : !s1) /\ (A1 :: Γ ⊢ M : B) /\ A1 :: Γ ⊢ B : !s2
  a : Sorts
  b : Sorts
  c : Sorts
  D : Term
  H2 : A ≡ Π (A0), D
  H3 : Rel a b c
  H4 : Γ ⊢ A0 : !a
  H5 : A0 :: Γ ⊢ M0 : D
  H6 : A0 :: Γ ⊢ D : !b
  ============================
   Rel a b c /\ (Γ ⊢ A0 : !a) /\ (A0 :: Γ ⊢ M0 : D) /\ A0 :: Γ ⊢ D : !b

(dependent evars: ?1334 using ,)

intuition.
No more subgoals.
(dependent evars: ?1334 using ,)


Qed.
gen_la is defined



Lemma gen_app : forall Γ M N T, Γ M · N : T -> exists A, exists B, T B[← N] /\ Γ M : Π(A),B /\ Γ N : A.
1 subgoals, subgoal 1 (ID 1437)
  
  ============================
   forall (Γ : Env) (M N T : Term),
   Γ ⊢ M · N : T ->
   exists A B : Term, (T ≡ B [ ← N]) /\ (Γ ⊢ M : Π (A), B) /\ Γ ⊢ N : A

(dependent evars:)


intros.
1 subgoals, subgoal 1 (ID 1442)
  
  Γ : Env
  M : Term
  N : Term
  T : Term
  H : Γ ⊢ M · N : T
  ============================
   exists A B : Term, (T ≡ B [ ← N]) /\ (Γ ⊢ M : Π (A), B) /\ Γ ⊢ N : A

(dependent evars:)

remember (M·N) as A.
1 subgoals, subgoal 1 (ID 1449)
  
  Γ : Env
  M : Term
  N : Term
  T : Term
  A : Term
  HeqA : A = M · N
  H : Γ ⊢ A : T
  ============================
   exists A0 B : Term, (T ≡ B [ ← N]) /\ (Γ ⊢ M : Π (A0), B) /\ Γ ⊢ N : A0

(dependent evars:)

revert M N HeqA.
1 subgoals, subgoal 1 (ID 1451)
  
  Γ : Env
  T : Term
  A : Term
  H : Γ ⊢ A : T
  ============================
   forall M N : Term,
   A = M · N ->
   exists A0 B : Term, (T ≡ B [ ← N]) /\ (Γ ⊢ M : Π (A0), B) /\ Γ ⊢ N : A0

(dependent evars:)

induction H; intros; subst; try discriminate.
2 subgoals, subgoal 1 (ID 1555)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  H : Γ ⊢ M : Π (A), B
  H0 : Γ ⊢ N : A
  IHtyp1 : forall M0 N : Term,
           M = M0 · N ->
           exists A0 B0 : Term,
             (Π (A), B ≡ B0 [ ← N]) /\ (Γ ⊢ M0 : Π (A0), B0) /\ Γ ⊢ N : A0
  IHtyp2 : forall M N0 : Term,
           N = M · N0 ->
           exists A0 B : Term,
             (A ≡ B [ ← N0]) /\ (Γ ⊢ M : Π (A0), B) /\ Γ ⊢ N0 : A0
  M0 : Term
  N0 : Term
  HeqA : M · N = M0 · N0
  ============================
   exists A0 B0 : Term,
     (B [ ← N] ≡ B0 [ ← N0]) /\ (Γ ⊢ M0 : Π (A0), B0) /\ Γ ⊢ N0 : A0

subgoal 2 (ID 1564) is:
 exists A0 B0 : Term, (B ≡ B0 [ ← N]) /\ (Γ ⊢ M0 : Π (A0), B0) /\ Γ ⊢ N : A0
(dependent evars:)


clear IHtyp1 IHtyp2.
2 subgoals, subgoal 1 (ID 1585)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  H : Γ ⊢ M : Π (A), B
  H0 : Γ ⊢ N : A
  M0 : Term
  N0 : Term
  HeqA : M · N = M0 · N0
  ============================
   exists A0 B0 : Term,
     (B [ ← N] ≡ B0 [ ← N0]) /\ (Γ ⊢ M0 : Π (A0), B0) /\ Γ ⊢ N0 : A0

subgoal 2 (ID 1564) is:
 exists A0 B0 : Term, (B ≡ B0 [ ← N]) /\ (Γ ⊢ M0 : Π (A0), B0) /\ Γ ⊢ N : A0
(dependent evars:)

injection HeqA; intros; subst; clear HeqA.
2 subgoals, subgoal 1 (ID 1608)
  
  Γ : Env
  A : Term
  B : Term
  M0 : Term
  N0 : Term
  H : Γ ⊢ M0 : Π (A), B
  H0 : Γ ⊢ N0 : A
  ============================
   exists A0 B0 : Term,
     (B [ ← N0] ≡ B0 [ ← N0]) /\ (Γ ⊢ M0 : Π (A0), B0) /\ Γ ⊢ N0 : A0

subgoal 2 (ID 1564) is:
 exists A0 B0 : Term, (B ≡ B0 [ ← N]) /\ (Γ ⊢ M0 : Π (A0), B0) /\ Γ ⊢ N : A0
(dependent evars:)


exists A; exists B; intuition.
1 subgoals, subgoal 1 (ID 1564)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall M N : Term,
           B = M · N ->
           exists A B : Term,
             (!s ≡ B [ ← N]) /\ (Γ ⊢ M : Π (A), B) /\ Γ ⊢ N : A
  M0 : Term
  N : Term
  H0 : Γ ⊢ M0 · N : A
  IHtyp1 : forall M N0 : Term,
           M0 · N = M · N0 ->
           exists A0 B : Term,
             (A ≡ B [ ← N0]) /\ (Γ ⊢ M : Π (A0), B) /\ Γ ⊢ N0 : A0
  ============================
   exists A0 B0 : Term,
     (B ≡ B0 [ ← N]) /\ (Γ ⊢ M0 : Π (A0), B0) /\ Γ ⊢ N : A0

(dependent evars:)


destruct (IHtyp1 M0 N) as (K & L & ? & ?& ?); trivial.
1 subgoals, subgoal 1 (ID 1648)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall M N : Term,
           B = M · N ->
           exists A B : Term,
             (!s ≡ B [ ← N]) /\ (Γ ⊢ M : Π (A), B) /\ Γ ⊢ N : A
  M0 : Term
  N : Term
  H0 : Γ ⊢ M0 · N : A
  IHtyp1 : forall M N0 : Term,
           M0 · N = M · N0 ->
           exists A0 B : Term,
             (A ≡ B [ ← N0]) /\ (Γ ⊢ M : Π (A0), B) /\ Γ ⊢ N0 : A0
  K : Term
  L : Term
  H2 : A ≡ L [ ← N]
  H3 : Γ ⊢ M0 : Π (K), L
  H4 : Γ ⊢ N : K
  ============================
   exists A0 B0 : Term,
     (B ≡ B0 [ ← N]) /\ (Γ ⊢ M0 : Π (A0), B0) /\ Γ ⊢ N : A0

(dependent evars:)

exists K; exists L; split.
2 subgoals, subgoal 1 (ID 1654)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall M N : Term,
           B = M · N ->
           exists A B : Term,
             (!s ≡ B [ ← N]) /\ (Γ ⊢ M : Π (A), B) /\ Γ ⊢ N : A
  M0 : Term
  N : Term
  H0 : Γ ⊢ M0 · N : A
  IHtyp1 : forall M N0 : Term,
           M0 · N = M · N0 ->
           exists A0 B : Term,
             (A ≡ B [ ← N0]) /\ (Γ ⊢ M : Π (A0), B) /\ Γ ⊢ N0 : A0
  K : Term
  L : Term
  H2 : A ≡ L [ ← N]
  H3 : Γ ⊢ M0 : Π (K), L
  H4 : Γ ⊢ N : K
  ============================
   B ≡ L [ ← N]

subgoal 2 (ID 1655) is:
 (Γ ⊢ M0 : Π (K), L) /\ Γ ⊢ N : K
(dependent evars:)


eauto.
1 subgoals, subgoal 1 (ID 1655)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H1 : Γ ⊢ B : !s
  IHtyp2 : forall M N : Term,
           B = M · N ->
           exists A B : Term,
             (!s ≡ B [ ← N]) /\ (Γ ⊢ M : Π (A), B) /\ Γ ⊢ N : A
  M0 : Term
  N : Term
  H0 : Γ ⊢ M0 · N : A
  IHtyp1 : forall M N0 : Term,
           M0 · N = M · N0 ->
           exists A0 B : Term,
             (A ≡ B [ ← N0]) /\ (Γ ⊢ M : Π (A0), B) /\ Γ ⊢ N0 : A0
  K : Term
  L : Term
  H2 : A ≡ L [ ← N]
  H3 : Γ ⊢ M0 : Π (K), L
  H4 : Γ ⊢ N : K
  ============================
   (Γ ⊢ M0 : Π (K), L) /\ Γ ⊢ N : K

(dependent evars: ?1668 using ,)

intuition.
No more subgoals.
(dependent evars: ?1668 using ,)


Qed.
gen_app is defined



Weakening Property: if a judgement is valid, we can insert a well-typed term in the context, it will remain valid. This is where the type checking for inserting items in a context is done.
Theorem weakening: (forall Δ M T, Δ M : T -> forall Γ A s n Δ', ins_in_env Γ A n Δ Δ' -> Γ A : !s ->
                 Δ' M 1 # n : T 1 # n ) /\
(forall Γ, Γ -> forall Δ Γ' n A , ins_in_env Δ A n Γ Γ' -> forall s, Δ A : !s -> Γ' ).
1 subgoals, subgoal 1 (ID 1777)
  
  ============================
   (forall (Δ : Env) (M T : Term),
    Δ ⊢ M : T ->
    forall (Γ : Env) (A : Term) (s : Sorts) (n : nat) (Δ' : Env),
    ins_in_env Γ A n Δ Δ' -> Γ ⊢ A : !s -> Δ' ⊢ M ↑ 1 # n : T ↑ 1 # n) /\
   (forall Γ : Env,
    Γ ⊣ ->
    forall (Δ Γ' : Env) (n : nat) (A : Term),
    ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣)

(dependent evars:)


apply typ_induc; simpl in *; intros.
8 subgoals, subgoal 1 (ID 1806)
  
  Γ : Env
  s : Sorts
  t : Sorts
  a : Ax s t
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  Γ0 : Env
  A : Term
  s0 : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A n Γ Δ'
  H1 : Γ0 ⊢ A : !s0
  ============================
   Δ' ⊢ !s : !t

subgoal 2 (ID 1819) is:
 Δ' ⊢ (if le_gt_dec n v then #(S v) else #v) : A ↑ 1 # n
subgoal 3 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 4 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 5 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 6 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 7 (ID 1898) is:
 Γ' ⊣
subgoal 8 (ID 1910) is:
 Γ' ⊣
(dependent evars:)


eauto.
7 subgoals, subgoal 1 (ID 1819)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  ============================
   Δ' ⊢ (if le_gt_dec n v then #(S v) else #v) : A ↑ 1 # n

subgoal 2 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 3 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 4 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 5 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 6 (ID 1898) is:
 Γ' ⊣
subgoal 7 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using ,)


destruct (le_gt_dec n v).
8 subgoals, subgoal 1 (ID 2117)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  l : n <= v
  ============================
   Δ' ⊢ #(S v) : A ↑ 1 # n

subgoal 2 (ID 2118) is:
 Δ' ⊢ #v : A ↑ 1 # n
subgoal 3 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 4 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 5 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 6 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 7 (ID 1898) is:
 Γ' ⊣
subgoal 8 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using ,)


constructor.
9 subgoals, subgoal 1 (ID 2121)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  l : n <= v
  ============================
   Δ' ⊣

subgoal 2 (ID 2122) is:
 A ↑ 1 # n ↓ S v ⊂ Δ'
subgoal 3 (ID 2118) is:
 Δ' ⊢ #v : A ↑ 1 # n
subgoal 4 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 5 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 6 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 7 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 8 (ID 1898) is:
 Γ' ⊣
subgoal 9 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using ,)

eapply H; eauto.
8 subgoals, subgoal 1 (ID 2122)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  l : n <= v
  ============================
   A ↑ 1 # n ↓ S v ⊂ Δ'

subgoal 2 (ID 2118) is:
 Δ' ⊢ #v : A ↑ 1 # n
subgoal 3 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 4 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 5 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 6 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 7 (ID 1898) is:
 Γ' ⊣
subgoal 8 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using ,)

destruct i as (AA & ?& ?).
8 subgoals, subgoal 1 (ID 2144)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  AA : Term
  H2 : A = AA ↑ (S v)
  H3 : AA ↓ v ∈ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  l : n <= v
  ============================
   A ↑ 1 # n ↓ S v ⊂ Δ'

subgoal 2 (ID 2118) is:
 Δ' ⊢ #v : A ↑ 1 # n
subgoal 3 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 4 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 5 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 6 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 7 (ID 1898) is:
 Γ' ⊣
subgoal 8 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using ,)

exists AA; split.
9 subgoals, subgoal 1 (ID 2148)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  AA : Term
  H2 : A = AA ↑ (S v)
  H3 : AA ↓ v ∈ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  l : n <= v
  ============================
   A ↑ 1 # n = AA ↑ (S (S v))

subgoal 2 (ID 2149) is:
 AA ↓ S v ∈ Δ'
subgoal 3 (ID 2118) is:
 Δ' ⊢ #v : A ↑ 1 # n
subgoal 4 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 5 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 6 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 7 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 8 (ID 1898) is:
 Γ' ⊣
subgoal 9 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using ,)

rewrite H2.
9 subgoals, subgoal 1 (ID 2150)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  AA : Term
  H2 : A = AA ↑ (S v)
  H3 : AA ↓ v ∈ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  l : n <= v
  ============================
   AA ↑ (S v) ↑ 1 # n = AA ↑ (S (S v))

subgoal 2 (ID 2149) is:
 AA ↓ S v ∈ Δ'
subgoal 3 (ID 2118) is:
 Δ' ⊢ #v : A ↑ 1 # n
subgoal 4 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 5 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 6 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 7 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 8 (ID 1898) is:
 Γ' ⊣
subgoal 9 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using ,)


change (S (S v)) with (1+ S v).
9 subgoals, subgoal 1 (ID 2152)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  AA : Term
  H2 : A = AA ↑ (S v)
  H3 : AA ↓ v ∈ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  l : n <= v
  ============================
   AA ↑ (S v) ↑ 1 # n = AA ↑ (1 + S v)

subgoal 2 (ID 2149) is:
 AA ↓ S v ∈ Δ'
subgoal 3 (ID 2118) is:
 Δ' ⊢ #v : A ↑ 1 # n
subgoal 4 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 5 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 6 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 7 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 8 (ID 1898) is:
 Γ' ⊣
subgoal 9 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using ,)

rewrite liftP3; simpl; intuition.
8 subgoals, subgoal 1 (ID 2149)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  AA : Term
  H2 : A = AA ↑ (S v)
  H3 : AA ↓ v ∈ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  l : n <= v
  ============================
   AA ↓ S v ∈ Δ'

subgoal 2 (ID 2118) is:
 Δ' ⊢ #v : A ↑ 1 # n
subgoal 3 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 4 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 5 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 6 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 7 (ID 1898) is:
 Γ' ⊣
subgoal 8 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using ,)

eapply ins_item_ge.
10 subgoals, subgoal 1 (ID 2204)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  AA : Term
  H2 : A = AA ↑ (S v)
  H3 : AA ↓ v ∈ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  l : n <= v
  ============================
   ins_in_env ?2202 ?2200 ?2201 ?2203 Δ'

subgoal 2 (ID 2205) is:
 ?2201 <= v
subgoal 3 (ID 2206) is:
 AA ↓ v ∈ ?2203
subgoal 4 (ID 2118) is:
 Δ' ⊢ #v : A ↑ 1 # n
subgoal 5 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 6 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 7 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 8 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 9 (ID 1898) is:
 Γ' ⊣
subgoal 10 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 open, ?2201 open, ?2202 open, ?2203 open,)

apply H0.
9 subgoals, subgoal 1 (ID 2205)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  AA : Term
  H2 : A = AA ↑ (S v)
  H3 : AA ↓ v ∈ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  l : n <= v
  ============================
   n <= v

subgoal 2 (ID 2206) is:
 AA ↓ v ∈ Γ
subgoal 3 (ID 2118) is:
 Δ' ⊢ #v : A ↑ 1 # n
subgoal 4 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 5 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 6 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 7 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 8 (ID 1898) is:
 Γ' ⊣
subgoal 9 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using ,)

trivial.
8 subgoals, subgoal 1 (ID 2206)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  AA : Term
  H2 : A = AA ↑ (S v)
  H3 : AA ↓ v ∈ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  l : n <= v
  ============================
   AA ↓ v ∈ Γ

subgoal 2 (ID 2118) is:
 Δ' ⊢ #v : A ↑ 1 # n
subgoal 3 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 4 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 5 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 6 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 7 (ID 1898) is:
 Γ' ⊣
subgoal 8 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using ,)

trivial.
7 subgoals, subgoal 1 (ID 2118)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  g : n > v
  ============================
   Δ' ⊢ #v : A ↑ 1 # n

subgoal 2 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 3 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 4 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 5 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 6 (ID 1898) is:
 Γ' ⊣
subgoal 7 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using ,)


constructor.
8 subgoals, subgoal 1 (ID 2209)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  g : n > v
  ============================
   Δ' ⊣

subgoal 2 (ID 2210) is:
 A ↑ 1 # n ↓ v ⊂ Δ'
subgoal 3 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 4 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 5 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 6 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 7 (ID 1898) is:
 Γ' ⊣
subgoal 8 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using ,)

eapply H; eauto.
7 subgoals, subgoal 1 (ID 2210)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  g : n > v
  ============================
   A ↑ 1 # n ↓ v ⊂ Δ'

subgoal 2 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 3 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 4 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 5 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 6 (ID 1898) is:
 Γ' ⊣
subgoal 7 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using ,)

eapply ins_item_lift_lt.
9 subgoals, subgoal 1 (ID 2225)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  g : n > v
  ============================
   ins_in_env ?2223 ?2222 n ?2224 Δ'

subgoal 2 (ID 2226) is:
 n > v
subgoal 3 (ID 2227) is:
 A ↓ v ⊂ ?2224
subgoal 4 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 5 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 6 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 7 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 8 (ID 1898) is:
 Γ' ⊣
subgoal 9 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 open, ?2223 open, ?2224 open,)

apply H0.
8 subgoals, subgoal 1 (ID 2226)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  g : n > v
  ============================
   n > v

subgoal 2 (ID 2227) is:
 A ↓ v ⊂ Γ
subgoal 3 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 4 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 5 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 6 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 7 (ID 1898) is:
 Γ' ⊣
subgoal 8 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using ,)

trivial.
7 subgoals, subgoal 1 (ID 2227)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ Γ' : Env) (n : nat) (A : Term),
      ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H0 : ins_in_env Γ0 A0 n Γ Δ'
  H1 : Γ0 ⊢ A0 : !s
  g : n > v
  ============================
   A ↓ v ⊂ Γ

subgoal 2 (ID 1837) is:
 Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u
subgoal 3 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 4 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 5 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 6 (ID 1898) is:
 Γ' ⊣
subgoal 7 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using ,)

trivial.
6 subgoals, subgoal 1 (ID 1837)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  r : Rel s t u
  t0 : Γ ⊢ A : !s
  H : forall (Γ0 : Env) (A0 : Term) (s0 : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s0 -> Δ' ⊢ A ↑ 1 # n : !s
  t1 : A :: Γ ⊢ B : !t
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n (A :: Γ) Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ B ↑ 1 # n : !t
  Γ0 : Env
  A0 : Term
  s0 : Sorts
  n : nat
  Δ' : Env
  H1 : ins_in_env Γ0 A0 n Γ Δ'
  H2 : Γ0 ⊢ A0 : !s0
  ============================
   Δ' ⊢ Π (A ↑ 1 # n), B ↑ 1 # (S n) : !u

subgoal 2 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 3 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 4 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 5 (ID 1898) is:
 Γ' ⊣
subgoal 6 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using ,)


econstructor.
8 subgoals, subgoal 1 (ID 2233)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  r : Rel s t u
  t0 : Γ ⊢ A : !s
  H : forall (Γ0 : Env) (A0 : Term) (s0 : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s0 -> Δ' ⊢ A ↑ 1 # n : !s
  t1 : A :: Γ ⊢ B : !t
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n (A :: Γ) Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ B ↑ 1 # n : !t
  Γ0 : Env
  A0 : Term
  s0 : Sorts
  n : nat
  Δ' : Env
  H1 : ins_in_env Γ0 A0 n Γ Δ'
  H2 : Γ0 ⊢ A0 : !s0
  ============================
   Rel ?2231 ?2232 u

subgoal 2 (ID 2234) is:
 Δ' ⊢ A ↑ 1 # n : !?2231
subgoal 3 (ID 2235) is:
 A ↑ 1 # n :: Δ' ⊢ B ↑ 1 # (S n) : !?2232
subgoal 4 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 5 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 6 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 7 (ID 1898) is:
 Γ' ⊣
subgoal 8 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 open, ?2232 open,)

apply r.
7 subgoals, subgoal 1 (ID 2234)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  r : Rel s t u
  t0 : Γ ⊢ A : !s
  H : forall (Γ0 : Env) (A0 : Term) (s0 : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s0 -> Δ' ⊢ A ↑ 1 # n : !s
  t1 : A :: Γ ⊢ B : !t
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n (A :: Γ) Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ B ↑ 1 # n : !t
  Γ0 : Env
  A0 : Term
  s0 : Sorts
  n : nat
  Δ' : Env
  H1 : ins_in_env Γ0 A0 n Γ Δ'
  H2 : Γ0 ⊢ A0 : !s0
  ============================
   Δ' ⊢ A ↑ 1 # n : !s

subgoal 2 (ID 2235) is:
 A ↑ 1 # n :: Δ' ⊢ B ↑ 1 # (S n) : !t
subgoal 3 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 4 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 5 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 6 (ID 1898) is:
 Γ' ⊣
subgoal 7 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using ,)

eauto.
6 subgoals, subgoal 1 (ID 2235)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  r : Rel s t u
  t0 : Γ ⊢ A : !s
  H : forall (Γ0 : Env) (A0 : Term) (s0 : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s0 -> Δ' ⊢ A ↑ 1 # n : !s
  t1 : A :: Γ ⊢ B : !t
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n (A :: Γ) Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ B ↑ 1 # n : !t
  Γ0 : Env
  A0 : Term
  s0 : Sorts
  n : nat
  Δ' : Env
  H1 : ins_in_env Γ0 A0 n Γ Δ'
  H2 : Γ0 ⊢ A0 : !s0
  ============================
   A ↑ 1 # n :: Δ' ⊢ B ↑ 1 # (S n) : !t

subgoal 2 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 3 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 4 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 5 (ID 1898) is:
 Γ' ⊣
subgoal 6 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using ,)

eapply H0.
7 subgoals, subgoal 1 (ID 2254)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  r : Rel s t u
  t0 : Γ ⊢ A : !s
  H : forall (Γ0 : Env) (A0 : Term) (s0 : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s0 -> Δ' ⊢ A ↑ 1 # n : !s
  t1 : A :: Γ ⊢ B : !t
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n (A :: Γ) Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ B ↑ 1 # n : !t
  Γ0 : Env
  A0 : Term
  s0 : Sorts
  n : nat
  Δ' : Env
  H1 : ins_in_env Γ0 A0 n Γ Δ'
  H2 : Γ0 ⊢ A0 : !s0
  ============================
   ins_in_env ?2251 ?2252 (S n) (A :: Γ) (A ↑ 1 # n :: Δ')

subgoal 2 (ID 2255) is:
 ?2251 ⊢ ?2252 : !?2253
subgoal 3 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 4 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 5 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 6 (ID 1898) is:
 Γ' ⊣
subgoal 7 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 open, ?2252 open, ?2253 open,)

constructor; apply H1.
6 subgoals, subgoal 1 (ID 2255)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  r : Rel s t u
  t0 : Γ ⊢ A : !s
  H : forall (Γ0 : Env) (A0 : Term) (s0 : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s0 -> Δ' ⊢ A ↑ 1 # n : !s
  t1 : A :: Γ ⊢ B : !t
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n (A :: Γ) Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ B ↑ 1 # n : !t
  Γ0 : Env
  A0 : Term
  s0 : Sorts
  n : nat
  Δ' : Env
  H1 : ins_in_env Γ0 A0 n Γ Δ'
  H2 : Γ0 ⊢ A0 : !s0
  ============================
   Γ0 ⊢ A0 : !?2253

subgoal 2 (ID 1858) is:
 Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)
subgoal 3 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 4 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 5 (ID 1898) is:
 Γ' ⊣
subgoal 6 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 open,)

apply H2.
5 subgoals, subgoal 1 (ID 1858)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  r : Rel s1 s2 s3
  t : Γ ⊢ A : !s1
  H : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ A ↑ 1 # n : !s1
  t0 : A :: Γ ⊢ B : !s2
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n (A :: Γ) Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ B ↑ 1 # n : !s2
  t1 : A :: Γ ⊢ M : B
  H1 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n (A :: Γ) Δ' ->
       Γ0 ⊢ A0 : !s -> Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H2 : ins_in_env Γ0 A0 n Γ Δ'
  H3 : Γ0 ⊢ A0 : !s
  ============================
   Δ' ⊢ λ [A ↑ 1 # n], M ↑ 1 # (S n) : Π (A ↑ 1 # n), B ↑ 1 # (S n)

subgoal 2 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 3 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 4 (ID 1898) is:
 Γ' ⊣
subgoal 5 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using ,)


econstructor.
8 subgoals, subgoal 1 (ID 2266)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  r : Rel s1 s2 s3
  t : Γ ⊢ A : !s1
  H : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ A ↑ 1 # n : !s1
  t0 : A :: Γ ⊢ B : !s2
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n (A :: Γ) Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ B ↑ 1 # n : !s2
  t1 : A :: Γ ⊢ M : B
  H1 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n (A :: Γ) Δ' ->
       Γ0 ⊢ A0 : !s -> Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H2 : ins_in_env Γ0 A0 n Γ Δ'
  H3 : Γ0 ⊢ A0 : !s
  ============================
   Rel ?2263 ?2264 ?2265

subgoal 2 (ID 2267) is:
 Δ' ⊢ A ↑ 1 # n : !?2263
subgoal 3 (ID 2268) is:
 A ↑ 1 # n :: Δ' ⊢ B ↑ 1 # (S n) : !?2264
subgoal 4 (ID 2269) is:
 A ↑ 1 # n :: Δ' ⊢ M ↑ 1 # (S n) : B ↑ 1 # (S n)
subgoal 5 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 6 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 7 (ID 1898) is:
 Γ' ⊣
subgoal 8 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 open, ?2264 open, ?2265 open,)

apply r.
7 subgoals, subgoal 1 (ID 2267)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  r : Rel s1 s2 s3
  t : Γ ⊢ A : !s1
  H : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ A ↑ 1 # n : !s1
  t0 : A :: Γ ⊢ B : !s2
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n (A :: Γ) Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ B ↑ 1 # n : !s2
  t1 : A :: Γ ⊢ M : B
  H1 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n (A :: Γ) Δ' ->
       Γ0 ⊢ A0 : !s -> Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H2 : ins_in_env Γ0 A0 n Γ Δ'
  H3 : Γ0 ⊢ A0 : !s
  ============================
   Δ' ⊢ A ↑ 1 # n : !s1

subgoal 2 (ID 2268) is:
 A ↑ 1 # n :: Δ' ⊢ B ↑ 1 # (S n) : !s2
subgoal 3 (ID 2269) is:
 A ↑ 1 # n :: Δ' ⊢ M ↑ 1 # (S n) : B ↑ 1 # (S n)
subgoal 4 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 5 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 6 (ID 1898) is:
 Γ' ⊣
subgoal 7 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using ,)

eapply H; eauto.
6 subgoals, subgoal 1 (ID 2268)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  r : Rel s1 s2 s3
  t : Γ ⊢ A : !s1
  H : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ A ↑ 1 # n : !s1
  t0 : A :: Γ ⊢ B : !s2
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n (A :: Γ) Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ B ↑ 1 # n : !s2
  t1 : A :: Γ ⊢ M : B
  H1 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n (A :: Γ) Δ' ->
       Γ0 ⊢ A0 : !s -> Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H2 : ins_in_env Γ0 A0 n Γ Δ'
  H3 : Γ0 ⊢ A0 : !s
  ============================
   A ↑ 1 # n :: Δ' ⊢ B ↑ 1 # (S n) : !s2

subgoal 2 (ID 2269) is:
 A ↑ 1 # n :: Δ' ⊢ M ↑ 1 # (S n) : B ↑ 1 # (S n)
subgoal 3 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 4 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 5 (ID 1898) is:
 Γ' ⊣
subgoal 6 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using ,)

eapply H0; eauto.
5 subgoals, subgoal 1 (ID 2269)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  r : Rel s1 s2 s3
  t : Γ ⊢ A : !s1
  H : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ A ↑ 1 # n : !s1
  t0 : A :: Γ ⊢ B : !s2
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n (A :: Γ) Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ B ↑ 1 # n : !s2
  t1 : A :: Γ ⊢ M : B
  H1 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n (A :: Γ) Δ' ->
       Γ0 ⊢ A0 : !s -> Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H2 : ins_in_env Γ0 A0 n Γ Δ'
  H3 : Γ0 ⊢ A0 : !s
  ============================
   A ↑ 1 # n :: Δ' ⊢ M ↑ 1 # (S n) : B ↑ 1 # (S n)

subgoal 2 (ID 1874) is:
 Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n
subgoal 3 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 4 (ID 1898) is:
 Γ' ⊣
subgoal 5 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using ,)

eapply H1; eauto.
4 subgoals, subgoal 1 (ID 1874)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  t : Γ ⊢ M : Π (A), B
  H : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' ->
      Γ0 ⊢ A0 : !s -> Δ' ⊢ M ↑ 1 # n : Π (A ↑ 1 # n), B ↑ 1 # (S n)
  t0 : Γ ⊢ N : A
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ N ↑ 1 # n : A ↑ 1 # n
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H1 : ins_in_env Γ0 A0 n Γ Δ'
  H2 : Γ0 ⊢ A0 : !s
  ============================
   Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : B [ ← N] ↑ 1 # n

subgoal 2 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 3 (ID 1898) is:
 Γ' ⊣
subgoal 4 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using ,)


change n with (0+n).
4 subgoals, subgoal 1 (ID 2303)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  t : Γ ⊢ M : Π (A), B
  H : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' ->
      Γ0 ⊢ A0 : !s -> Δ' ⊢ M ↑ 1 # n : Π (A ↑ 1 # n), B ↑ 1 # (S n)
  t0 : Γ ⊢ N : A
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ N ↑ 1 # n : A ↑ 1 # n
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H1 : ins_in_env Γ0 A0 n Γ Δ'
  H2 : Γ0 ⊢ A0 : !s
  ============================
   Δ' ⊢ M ↑ 1 # (0 + n) · N ↑ 1 # (0 + n) : B [ ← N] ↑ 1 # (0 + n)

subgoal 2 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 3 (ID 1898) is:
 Γ' ⊣
subgoal 4 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using ,)

rewrite substP1.
4 subgoals, subgoal 1 (ID 2304)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  t : Γ ⊢ M : Π (A), B
  H : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' ->
      Γ0 ⊢ A0 : !s -> Δ' ⊢ M ↑ 1 # n : Π (A ↑ 1 # n), B ↑ 1 # (S n)
  t0 : Γ ⊢ N : A
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ N ↑ 1 # n : A ↑ 1 # n
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H1 : ins_in_env Γ0 A0 n Γ Δ'
  H2 : Γ0 ⊢ A0 : !s
  ============================
   Δ' ⊢ M ↑ 1 # (0 + n) · N ↑ 1 # (0 + n)
   : (B ↑ 1 # (S (0 + n))) [ ← N ↑ 1 # n]

subgoal 2 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 3 (ID 1898) is:
 Γ' ⊣
subgoal 4 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using ,)

simpl.
4 subgoals, subgoal 1 (ID 2305)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  t : Γ ⊢ M : Π (A), B
  H : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' ->
      Γ0 ⊢ A0 : !s -> Δ' ⊢ M ↑ 1 # n : Π (A ↑ 1 # n), B ↑ 1 # (S n)
  t0 : Γ ⊢ N : A
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ N ↑ 1 # n : A ↑ 1 # n
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H1 : ins_in_env Γ0 A0 n Γ Δ'
  H2 : Γ0 ⊢ A0 : !s
  ============================
   Δ' ⊢ M ↑ 1 # n · N ↑ 1 # n : (B ↑ 1 # (S n)) [ ← N ↑ 1 # n]

subgoal 2 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 3 (ID 1898) is:
 Γ' ⊣
subgoal 4 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using ,)


econstructor.
5 subgoals, subgoal 1 (ID 2312)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  t : Γ ⊢ M : Π (A), B
  H : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' ->
      Γ0 ⊢ A0 : !s -> Δ' ⊢ M ↑ 1 # n : Π (A ↑ 1 # n), B ↑ 1 # (S n)
  t0 : Γ ⊢ N : A
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ N ↑ 1 # n : A ↑ 1 # n
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H1 : ins_in_env Γ0 A0 n Γ Δ'
  H2 : Γ0 ⊢ A0 : !s
  ============================
   Δ' ⊢ M ↑ 1 # n : Π (?2311), B ↑ 1 # (S n)

subgoal 2 (ID 2313) is:
 Δ' ⊢ N ↑ 1 # n : ?2311
subgoal 3 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 4 (ID 1898) is:
 Γ' ⊣
subgoal 5 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using , ?2311 open,)

eapply H; eauto.
4 subgoals, subgoal 1 (ID 2313)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  t : Γ ⊢ M : Π (A), B
  H : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' ->
      Γ0 ⊢ A0 : !s -> Δ' ⊢ M ↑ 1 # n : Π (A ↑ 1 # n), B ↑ 1 # (S n)
  t0 : Γ ⊢ N : A
  H0 : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ N ↑ 1 # n : A ↑ 1 # n
  Γ0 : Env
  A0 : Term
  s : Sorts
  n : nat
  Δ' : Env
  H1 : ins_in_env Γ0 A0 n Γ Δ'
  H2 : Γ0 ⊢ A0 : !s
  ============================
   Δ' ⊢ N ↑ 1 # n : A ↑ 1 # n

subgoal 2 (ID 1891) is:
 Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n
subgoal 3 (ID 1898) is:
 Γ' ⊣
subgoal 4 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using , ?2311 using , ?2314 using , ?2315 using , ?2316 using ,)

eapply H0; eauto.
3 subgoals, subgoal 1 (ID 1891)
  
  Γ : Env
  M : Term
  A : Term
  B : Term
  s : Sorts
  b : A ≡ B
  t : Γ ⊢ M : A
  H : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ M ↑ 1 # n : A ↑ 1 # n
  t0 : Γ ⊢ B : !s
  H0 : forall (Γ0 : Env) (A : Term) (s0 : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A n Γ Δ' -> Γ0 ⊢ A : !s0 -> Δ' ⊢ B ↑ 1 # n : !s
  Γ0 : Env
  A0 : Term
  s0 : Sorts
  n : nat
  Δ' : Env
  H1 : ins_in_env Γ0 A0 n Γ Δ'
  H2 : Γ0 ⊢ A0 : !s0
  ============================
   Δ' ⊢ M ↑ 1 # n : B ↑ 1 # n

subgoal 2 (ID 1898) is:
 Γ' ⊣
subgoal 3 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using , ?2311 using , ?2314 using , ?2315 using , ?2316 using , ?2324 using , ?2325 using , ?2326 using ,)


apply Cnv with (A 1 # n) s; intuition.
4 subgoals, subgoal 1 (ID 2335)
  
  Γ : Env
  M : Term
  A : Term
  B : Term
  s : Sorts
  b : A ≡ B
  t : Γ ⊢ M : A
  H : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ M ↑ 1 # n : A ↑ 1 # n
  t0 : Γ ⊢ B : !s
  H0 : forall (Γ0 : Env) (A : Term) (s0 : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A n Γ Δ' -> Γ0 ⊢ A : !s0 -> Δ' ⊢ B ↑ 1 # n : !s
  Γ0 : Env
  A0 : Term
  s0 : Sorts
  n : nat
  Δ' : Env
  H1 : ins_in_env Γ0 A0 n Γ Δ'
  H2 : Γ0 ⊢ A0 : !s0
  ============================
   Δ' ⊢ M ↑ 1 # n : A ↑ 1 # n

subgoal 2 (ID 2336) is:
 Δ' ⊢ B ↑ 1 # n : !s
subgoal 3 (ID 1898) is:
 Γ' ⊣
subgoal 4 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using , ?2311 using , ?2314 using , ?2315 using , ?2316 using , ?2324 using , ?2325 using , ?2326 using ,)


eapply H; eauto.
3 subgoals, subgoal 1 (ID 2336)
  
  Γ : Env
  M : Term
  A : Term
  B : Term
  s : Sorts
  b : A ≡ B
  t : Γ ⊢ M : A
  H : forall (Γ0 : Env) (A0 : Term) (s : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s -> Δ' ⊢ M ↑ 1 # n : A ↑ 1 # n
  t0 : Γ ⊢ B : !s
  H0 : forall (Γ0 : Env) (A : Term) (s0 : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ0 A n Γ Δ' -> Γ0 ⊢ A : !s0 -> Δ' ⊢ B ↑ 1 # n : !s
  Γ0 : Env
  A0 : Term
  s0 : Sorts
  n : nat
  Δ' : Env
  H1 : ins_in_env Γ0 A0 n Γ Δ'
  H2 : Γ0 ⊢ A0 : !s0
  ============================
   Δ' ⊢ B ↑ 1 # n : !s

subgoal 2 (ID 1898) is:
 Γ' ⊣
subgoal 3 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using , ?2311 using , ?2314 using , ?2315 using , ?2316 using , ?2324 using , ?2325 using , ?2326 using , ?2392 using , ?2393 using , ?2394 using ,)

eapply H0; eauto.
2 subgoals, subgoal 1 (ID 1898)
  
  Δ : Env
  Γ' : Env
  n : nat
  A : Term
  H : ins_in_env Δ A n nil Γ'
  s : Sorts
  H0 : Δ ⊢ A : !s
  ============================
   Γ' ⊣

subgoal 2 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using , ?2311 using , ?2314 using , ?2315 using , ?2316 using , ?2324 using , ?2325 using , ?2326 using , ?2392 using , ?2393 using , ?2394 using , ?2402 using , ?2403 using , ?2404 using ,)


inversion H; subst; clear H.
2 subgoals, subgoal 1 (ID 2472)
  
  A : Term
  s : Sorts
  H0 : nil ⊢ A : !s
  ============================
   A :: nil ⊣

subgoal 2 (ID 1910) is:
 Γ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using , ?2311 using , ?2314 using , ?2315 using , ?2316 using , ?2324 using , ?2325 using , ?2326 using , ?2392 using , ?2393 using , ?2394 using , ?2402 using , ?2403 using , ?2404 using ,)


apply wf_cons with s; trivial.
1 subgoals, subgoal 1 (ID 1910)
  
  Γ : Env
  A : Term
  s : Sorts
  t : Γ ⊢ A : !s
  H : forall (Γ0 : Env) (A0 : Term) (s0 : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s0 -> Δ' ⊢ A ↑ 1 # n : !s
  Δ : Env
  Γ' : Env
  n : nat
  A0 : Term
  H0 : ins_in_env Δ A0 n (A :: Γ) Γ'
  s0 : Sorts
  H1 : Δ ⊢ A0 : !s0
  ============================
   Γ' ⊣

(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using , ?2311 using , ?2314 using , ?2315 using , ?2316 using , ?2324 using , ?2325 using , ?2326 using , ?2392 using , ?2393 using , ?2394 using , ?2402 using , ?2403 using , ?2404 using ,)


inversion H0; subst; clear H0.
2 subgoals, subgoal 1 (ID 2566)
  
  Γ : Env
  A : Term
  s : Sorts
  t : Γ ⊢ A : !s
  H : forall (Γ0 : Env) (A0 : Term) (s0 : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s0 -> Δ' ⊢ A ↑ 1 # n : !s
  A0 : Term
  s0 : Sorts
  H1 : A :: Γ ⊢ A0 : !s0
  ============================
   A0 :: A :: Γ ⊣

subgoal 2 (ID 2567) is:
 A ↑ 1 # n0 :: Δ' ⊣
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using , ?2311 using , ?2314 using , ?2315 using , ?2316 using , ?2324 using , ?2325 using , ?2326 using , ?2392 using , ?2393 using , ?2394 using , ?2402 using , ?2403 using , ?2404 using ,)


apply wf_cons with s0; trivial.
1 subgoals, subgoal 1 (ID 2567)
  
  Γ : Env
  A : Term
  s : Sorts
  t : Γ ⊢ A : !s
  H : forall (Γ0 : Env) (A0 : Term) (s0 : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s0 -> Δ' ⊢ A ↑ 1 # n : !s
  Δ : Env
  A0 : Term
  s0 : Sorts
  H1 : Δ ⊢ A0 : !s0
  n0 : nat
  Δ' : Env
  H6 : ins_in_env Δ A0 n0 Γ Δ'
  ============================
   A ↑ 1 # n0 :: Δ' ⊣

(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using , ?2311 using , ?2314 using , ?2315 using , ?2316 using , ?2324 using , ?2325 using , ?2326 using , ?2392 using , ?2393 using , ?2394 using , ?2402 using , ?2403 using , ?2404 using ,)


apply wf_cons with s; trivial.
1 subgoals, subgoal 1 (ID 2569)
  
  Γ : Env
  A : Term
  s : Sorts
  t : Γ ⊢ A : !s
  H : forall (Γ0 : Env) (A0 : Term) (s0 : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s0 -> Δ' ⊢ A ↑ 1 # n : !s
  Δ : Env
  A0 : Term
  s0 : Sorts
  H1 : Δ ⊢ A0 : !s0
  n0 : nat
  Δ' : Env
  H6 : ins_in_env Δ A0 n0 Γ Δ'
  ============================
   Δ' ⊢ A ↑ 1 # n0 : !s

(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using , ?2311 using , ?2314 using , ?2315 using , ?2316 using , ?2324 using , ?2325 using , ?2326 using , ?2392 using , ?2393 using , ?2394 using , ?2402 using , ?2403 using , ?2404 using ,)

change !s with !s 1 # n0.
1 subgoals, subgoal 1 (ID 2571)
  
  Γ : Env
  A : Term
  s : Sorts
  t : Γ ⊢ A : !s
  H : forall (Γ0 : Env) (A0 : Term) (s0 : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s0 -> Δ' ⊢ A ↑ 1 # n : !s
  Δ : Env
  A0 : Term
  s0 : Sorts
  H1 : Δ ⊢ A0 : !s0
  n0 : nat
  Δ' : Env
  H6 : ins_in_env Δ A0 n0 Γ Δ'
  ============================
   Δ' ⊢ A ↑ 1 # n0 : !s ↑ 1 # n0

(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using , ?2311 using , ?2314 using , ?2315 using , ?2316 using , ?2324 using , ?2325 using , ?2326 using , ?2392 using , ?2393 using , ?2394 using , ?2402 using , ?2403 using , ?2404 using ,)


eapply H.
2 subgoals, subgoal 1 (ID 2575)
  
  Γ : Env
  A : Term
  s : Sorts
  t : Γ ⊢ A : !s
  H : forall (Γ0 : Env) (A0 : Term) (s0 : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s0 -> Δ' ⊢ A ↑ 1 # n : !s
  Δ : Env
  A0 : Term
  s0 : Sorts
  H1 : Δ ⊢ A0 : !s0
  n0 : nat
  Δ' : Env
  H6 : ins_in_env Δ A0 n0 Γ Δ'
  ============================
   ins_in_env ?2572 ?2573 n0 Γ Δ'

subgoal 2 (ID 2576) is:
 ?2572 ⊢ ?2573 : !?2574
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using , ?2311 using , ?2314 using , ?2315 using , ?2316 using , ?2324 using , ?2325 using , ?2326 using , ?2392 using , ?2393 using , ?2394 using , ?2402 using , ?2403 using , ?2404 using , ?2572 open, ?2573 open, ?2574 open,)

apply H6.
1 subgoals, subgoal 1 (ID 2576)
  
  Γ : Env
  A : Term
  s : Sorts
  t : Γ ⊢ A : !s
  H : forall (Γ0 : Env) (A0 : Term) (s0 : Sorts) (n : nat) (Δ' : Env),
      ins_in_env Γ0 A0 n Γ Δ' -> Γ0 ⊢ A0 : !s0 -> Δ' ⊢ A ↑ 1 # n : !s
  Δ : Env
  A0 : Term
  s0 : Sorts
  H1 : Δ ⊢ A0 : !s0
  n0 : nat
  Δ' : Env
  H6 : ins_in_env Δ A0 n0 Γ Δ'
  ============================
   Δ ⊢ A0 : !?2574

(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using , ?2311 using , ?2314 using , ?2315 using , ?2316 using , ?2324 using , ?2325 using , ?2326 using , ?2392 using , ?2393 using , ?2394 using , ?2402 using , ?2403 using , ?2404 using , ?2572 using , ?2573 using , ?2574 open,)

apply H1.
No more subgoals.
(dependent evars: ?1924 using ?1931 , ?1925 using ?1930 , ?1930 using , ?1931 using , ?2044 using , ?2045 using , ?2046 using , ?2047 using , ?2123 using , ?2124 using , ?2125 using , ?2126 using , ?2200 using , ?2201 using , ?2202 using , ?2203 using , ?2211 using , ?2212 using , ?2213 using , ?2214 using , ?2222 using , ?2223 using , ?2224 using , ?2231 using , ?2232 using , ?2236 using , ?2237 using , ?2238 using , ?2251 using , ?2252 using , ?2253 using , ?2263 using , ?2264 using , ?2265 using , ?2270 using , ?2271 using , ?2272 using , ?2280 using , ?2281 using , ?2282 using , ?2291 using , ?2292 using , ?2293 using , ?2311 using , ?2314 using , ?2315 using , ?2316 using , ?2324 using , ?2325 using , ?2326 using , ?2392 using , ?2393 using , ?2394 using , ?2402 using , ?2403 using , ?2404 using , ?2572 using , ?2573 using , ?2574 using ,)


Qed.
weakening is defined



Theorem thinning :
   forall Γ M T A s,
      Γ M : T ->
   Γ A : !s ->
   A::Γ M 1 : T 1.
1 subgoals, subgoal 1 (ID 2584)
  
  ============================
   forall (Γ : Env) (M T A : Term) (s : Sorts),
   Γ ⊢ M : T -> Γ ⊢ A : !s -> A :: Γ ⊢ M ↑ 1 : T ↑ 1

(dependent evars:)


intros.
1 subgoals, subgoal 1 (ID 2591)
  
  Γ : Env
  M : Term
  T : Term
  A : Term
  s : Sorts
  H : Γ ⊢ M : T
  H0 : Γ ⊢ A : !s
  ============================
   A :: Γ ⊢ M ↑ 1 : T ↑ 1

(dependent evars:)


destruct weakening.
1 subgoals, subgoal 1 (ID 2598)
  
  Γ : Env
  M : Term
  T : Term
  A : Term
  s : Sorts
  H : Γ ⊢ M : T
  H0 : Γ ⊢ A : !s
  H1 : forall (Δ : Env) (M T : Term),
       Δ ⊢ M : T ->
       forall (Γ : Env) (A : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ A n Δ Δ' -> Γ ⊢ A : !s -> Δ' ⊢ M ↑ 1 # n : T ↑ 1 # n
  H2 : forall Γ : Env,
       Γ ⊣ ->
       forall (Δ Γ' : Env) (n : nat) (A : Term),
       ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  ============================
   A :: Γ ⊢ M ↑ 1 : T ↑ 1

(dependent evars:)


eapply H1.
3 subgoals, subgoal 1 (ID 2603)
  
  Γ : Env
  M : Term
  T : Term
  A : Term
  s : Sorts
  H : Γ ⊢ M : T
  H0 : Γ ⊢ A : !s
  H1 : forall (Δ : Env) (M T : Term),
       Δ ⊢ M : T ->
       forall (Γ : Env) (A : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ A n Δ Δ' -> Γ ⊢ A : !s -> Δ' ⊢ M ↑ 1 # n : T ↑ 1 # n
  H2 : forall Γ : Env,
       Γ ⊣ ->
       forall (Δ Γ' : Env) (n : nat) (A : Term),
       ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  ============================
   ?2599 ⊢ M : T

subgoal 2 (ID 2604) is:
 ins_in_env ?2600 ?2601 0 ?2599 (A :: Γ)
subgoal 3 (ID 2605) is:
 ?2600 ⊢ ?2601 : !?2602
(dependent evars: ?2599 open, ?2600 open, ?2601 open, ?2602 open,)

apply H.
2 subgoals, subgoal 1 (ID 2604)
  
  Γ : Env
  M : Term
  T : Term
  A : Term
  s : Sorts
  H : Γ ⊢ M : T
  H0 : Γ ⊢ A : !s
  H1 : forall (Δ : Env) (M T : Term),
       Δ ⊢ M : T ->
       forall (Γ : Env) (A : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ A n Δ Δ' -> Γ ⊢ A : !s -> Δ' ⊢ M ↑ 1 # n : T ↑ 1 # n
  H2 : forall Γ : Env,
       Γ ⊣ ->
       forall (Δ Γ' : Env) (n : nat) (A : Term),
       ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  ============================
   ins_in_env ?2600 ?2601 0 Γ (A :: Γ)

subgoal 2 (ID 2605) is:
 ?2600 ⊢ ?2601 : !?2602
(dependent evars: ?2599 using , ?2600 open, ?2601 open, ?2602 open,)

constructor.
1 subgoals, subgoal 1 (ID 2605)
  
  Γ : Env
  M : Term
  T : Term
  A : Term
  s : Sorts
  H : Γ ⊢ M : T
  H0 : Γ ⊢ A : !s
  H1 : forall (Δ : Env) (M T : Term),
       Δ ⊢ M : T ->
       forall (Γ : Env) (A : Term) (s : Sorts) (n : nat) (Δ' : Env),
       ins_in_env Γ A n Δ Δ' -> Γ ⊢ A : !s -> Δ' ⊢ M ↑ 1 # n : T ↑ 1 # n
  H2 : forall Γ : Env,
       Γ ⊣ ->
       forall (Δ Γ' : Env) (n : nat) (A : Term),
       ins_in_env Δ A n Γ Γ' -> forall s : Sorts, Δ ⊢ A : !s -> Γ' ⊣
  ============================
   Γ ⊢ A : !?2602

(dependent evars: ?2599 using , ?2600 using , ?2601 using , ?2602 open,)

apply H0.
No more subgoals.
(dependent evars: ?2599 using , ?2600 using , ?2601 using , ?2602 using ,)


Qed.
thinning is defined



Theorem thinning_n : forall n Δ Δ',
   trunc n Δ Δ' ->
   forall M T , Δ' M : T -> Δ ->
               Δ M n : T n.
1 subgoals, subgoal 1 (ID 2622)
  
  ============================
   forall (n : nat) (Δ Δ' : list Term),
   trunc n Δ Δ' -> forall M T : Term, Δ' ⊢ M : T -> Δ ⊣ -> Δ ⊢ M ↑ n : T ↑ n

(dependent evars:)


intro n; induction n; intros.
2 subgoals, subgoal 1 (ID 2636)
  
  Δ : list Term
  Δ' : list Term
  H : trunc 0 Δ Δ'
  M : Term
  T : Term
  H0 : Δ' ⊢ M : T
  H1 : Δ ⊣
  ============================
   Δ ⊢ M ↑ 0 : T ↑ 0

subgoal 2 (ID 2643) is:
 Δ ⊢ M ↑ (S n) : T ↑ (S n)
(dependent evars:)


inversion H; subst; clear H.
2 subgoals, subgoal 1 (ID 2703)
  
  Δ' : list Term
  M : Term
  T : Term
  H0 : Δ' ⊢ M : T
  H1 : Δ' ⊣
  ============================
   Δ' ⊢ M ↑ 0 : T ↑ 0

subgoal 2 (ID 2643) is:
 Δ ⊢ M ↑ (S n) : T ↑ (S n)
(dependent evars:)


rewrite 2! lift0; trivial.
1 subgoals, subgoal 1 (ID 2643)
  
  n : nat
  IHn : forall Δ Δ' : list Term,
        trunc n Δ Δ' ->
        forall M T : Term, Δ' ⊢ M : T -> Δ ⊣ -> Δ ⊢ M ↑ n : T ↑ n
  Δ : list Term
  Δ' : list Term
  H : trunc (S n) Δ Δ'
  M : Term
  T : Term
  H0 : Δ' ⊢ M : T
  H1 : Δ ⊣
  ============================
   Δ ⊢ M ↑ (S n) : T ↑ (S n)

(dependent evars:)


inversion H; subst; clear H.
1 subgoals, subgoal 1 (ID 2770)
  
  n : nat
  IHn : forall Δ Δ' : list Term,
        trunc n Δ Δ' ->
        forall M T : Term, Δ' ⊢ M : T -> Δ ⊣ -> Δ ⊢ M ↑ n : T ↑ n
  Δ' : list Term
  M : Term
  T : Term
  H0 : Δ' ⊢ M : T
  Γ : list Term
  x : Term
  H3 : trunc n Γ Δ'
  H1 : x :: Γ ⊣
  ============================
   x :: Γ ⊢ M ↑ (S n) : T ↑ (S n)

(dependent evars:)


change (S n) with (1+n).
1 subgoals, subgoal 1 (ID 2772)
  
  n : nat
  IHn : forall Δ Δ' : list Term,
        trunc n Δ Δ' ->
        forall M T : Term, Δ' ⊢ M : T -> Δ ⊣ -> Δ ⊢ M ↑ n : T ↑ n
  Δ' : list Term
  M : Term
  T : Term
  H0 : Δ' ⊢ M : T
  Γ : list Term
  x : Term
  H3 : trunc n Γ Δ'
  H1 : x :: Γ ⊣
  ============================
   x :: Γ ⊢ M ↑ (1 + n) : T ↑ (1 + n)

(dependent evars:)


replace (M (1+n)) with ((M n )↑ 1) by (apply lift_lift).
1 subgoals, subgoal 1 (ID 2776)
  
  n : nat
  IHn : forall Δ Δ' : list Term,
        trunc n Δ Δ' ->
        forall M T : Term, Δ' ⊢ M : T -> Δ ⊣ -> Δ ⊢ M ↑ n : T ↑ n
  Δ' : list Term
  M : Term
  T : Term
  H0 : Δ' ⊢ M : T
  Γ : list Term
  x : Term
  H3 : trunc n Γ Δ'
  H1 : x :: Γ ⊣
  ============================
   x :: Γ ⊢ M ↑ n ↑ 1 : T ↑ (1 + n)

(dependent evars:)


replace (T (1+n)) with ((T n) 1) by (apply lift_lift).
1 subgoals, subgoal 1 (ID 2781)
  
  n : nat
  IHn : forall Δ Δ' : list Term,
        trunc n Δ Δ' ->
        forall M T : Term, Δ' ⊢ M : T -> Δ ⊣ -> Δ ⊢ M ↑ n : T ↑ n
  Δ' : list Term
  M : Term
  T : Term
  H0 : Δ' ⊢ M : T
  Γ : list Term
  x : Term
  H3 : trunc n Γ Δ'
  H1 : x :: Γ ⊣
  ============================
   x :: Γ ⊢ M ↑ n ↑ 1 : T ↑ n ↑ 1

(dependent evars:)


inversion H1; subst; clear H1.
1 subgoals, subgoal 1 (ID 2831)
  
  n : nat
  IHn : forall Δ Δ' : list Term,
        trunc n Δ Δ' ->
        forall M T : Term, Δ' ⊢ M : T -> Δ ⊣ -> Δ ⊢ M ↑ n : T ↑ n
  Δ' : list Term
  M : Term
  T : Term
  H0 : Δ' ⊢ M : T
  Γ : list Term
  x : Term
  H3 : trunc n Γ Δ'
  s : Sorts
  H2 : Γ ⊢ x : !s
  ============================
   x :: Γ ⊢ M ↑ n ↑ 1 : T ↑ n ↑ 1

(dependent evars:)


apply thinning with s; trivial.
1 subgoals, subgoal 1 (ID 2832)
  
  n : nat
  IHn : forall Δ Δ' : list Term,
        trunc n Δ Δ' ->
        forall M T : Term, Δ' ⊢ M : T -> Δ ⊣ -> Δ ⊢ M ↑ n : T ↑ n
  Δ' : list Term
  M : Term
  T : Term
  H0 : Δ' ⊢ M : T
  Γ : list Term
  x : Term
  H3 : trunc n Γ Δ'
  s : Sorts
  H2 : Γ ⊢ x : !s
  ============================
   Γ ⊢ M ↑ n : T ↑ n

(dependent evars:)


eapply IHn.
3 subgoals, subgoal 1 (ID 2835)
  
  n : nat
  IHn : forall Δ Δ' : list Term,
        trunc n Δ Δ' ->
        forall M T : Term, Δ' ⊢ M : T -> Δ ⊣ -> Δ ⊢ M ↑ n : T ↑ n
  Δ' : list Term
  M : Term
  T : Term
  H0 : Δ' ⊢ M : T
  Γ : list Term
  x : Term
  H3 : trunc n Γ Δ'
  s : Sorts
  H2 : Γ ⊢ x : !s
  ============================
   trunc n Γ ?2834

subgoal 2 (ID 2836) is:
 ?2834 ⊢ M : T
subgoal 3 (ID 2837) is:
 Γ ⊣
(dependent evars: ?2834 open,)

apply H3.
2 subgoals, subgoal 1 (ID 2836)
  
  n : nat
  IHn : forall Δ Δ' : list Term,
        trunc n Δ Δ' ->
        forall M T : Term, Δ' ⊢ M : T -> Δ ⊣ -> Δ ⊢ M ↑ n : T ↑ n
  Δ' : list Term
  M : Term
  T : Term
  H0 : Δ' ⊢ M : T
  Γ : list Term
  x : Term
  H3 : trunc n Γ Δ'
  s : Sorts
  H2 : Γ ⊢ x : !s
  ============================
   Δ' ⊢ M : T

subgoal 2 (ID 2837) is:
 Γ ⊣
(dependent evars: ?2834 using ,)

trivial.
1 subgoals, subgoal 1 (ID 2837)
  
  n : nat
  IHn : forall Δ Δ' : list Term,
        trunc n Δ Δ' ->
        forall M T : Term, Δ' ⊢ M : T -> Δ ⊣ -> Δ ⊢ M ↑ n : T ↑ n
  Δ' : list Term
  M : Term
  T : Term
  H0 : Δ' ⊢ M : T
  Γ : list Term
  x : Term
  H3 : trunc n Γ Δ'
  s : Sorts
  H2 : Γ ⊢ x : !s
  ============================
   Γ ⊣

(dependent evars: ?2834 using ,)

eauto.
No more subgoals.
(dependent evars: ?2834 using , ?2838 using , ?2839 using ,)


Qed.
thinning_n is defined



Substitution Property: if a judgment is valid and we replace a variable by a well-typed term of the same type, it will remain valid.
Lemma sub_trunc : forall Δ a A n Γ Γ', sub_in_env Δ a A n Γ Γ' -> trunc n Γ' Δ.
1 subgoals, subgoal 1 (ID 2920)
  
  ============================
   forall (Δ : Env) (a A : Term) (n : nat) (Γ Γ' : Env),
   sub_in_env Δ a A n Γ Γ' -> trunc n Γ' Δ

(dependent evars:)


induction 1.
2 subgoals, subgoal 1 (ID 2934)
  
  Δ : Env
  a : Term
  A : Term
  ============================
   trunc 0 Δ Δ

subgoal 2 (ID 2943) is:
 trunc (S n) (B [n ← a] :: Δ') Δ
(dependent evars:)


apply trunc_O.
1 subgoals, subgoal 1 (ID 2943)
  
  Δ : Env
  a : Term
  A : Term
  Δ0 : Env
  Δ' : Env
  n : nat
  B : Term
  H : sub_in_env Δ a A n Δ0 Δ'
  IHsub_in_env : trunc n Δ' Δ
  ============================
   trunc (S n) (B [n ← a] :: Δ') Δ

(dependent evars:)


apply trunc_S.
1 subgoals, subgoal 1 (ID 2944)
  
  Δ : Env
  a : Term
  A : Term
  Δ0 : Env
  Δ' : Env
  n : nat
  B : Term
  H : sub_in_env Δ a A n Δ0 Δ'
  IHsub_in_env : trunc n Δ' Δ
  ============================
   trunc n Δ' Δ

(dependent evars:)

trivial.
No more subgoals.
(dependent evars:)


Qed.
sub_trunc is defined



Theorem substitution : (forall Γ M T , Γ M : T -> forall Δ P A, Δ P : A ->
 forall Γ' n , sub_in_env Δ P A n Γ Γ' -> Γ -> Γ' M [ n P ] : T [ n P ] ) /\
                       (forall Γ , Γ -> forall Δ P A n Γ' , Δ P : A ->
  sub_in_env Δ P A n Γ Γ' -> Γ' ).
1 subgoals, subgoal 1 (ID 2967)
  
  ============================
   (forall (Γ : Env) (M T : Term),
    Γ ⊢ M : T ->
    forall (Δ : Env) (P A : Term),
    Δ ⊢ P : A ->
    forall (Γ' : Env) (n : nat),
    sub_in_env Δ P A n Γ Γ' -> Γ ⊣ -> Γ' ⊢ M [n ← P] : T [n ← P]) /\
   (forall Γ : Env,
    Γ ⊣ ->
    forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
    Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣)

(dependent evars:)


apply typ_induc; simpl; intros.
8 subgoals, subgoal 1 (ID 2997)
  
  Γ : Env
  s : Sorts
  t : Sorts
  a : Ax s t
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  Δ : Env
  P : Term
  A : Term
  H0 : Δ ⊢ P : A
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A n Γ Γ'
  H2 : Γ ⊣
  ============================
   Γ' ⊢ !s : !t

subgoal 2 (ID 3011) is:
 Γ'
 ⊢ match lt_eq_lt_dec v n with
   | inleft (left _) => #v
   | inleft (right _) => P ↑ n
   | inright _ => #(v - 1)
   end : A [n ← P]
subgoal 3 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars:)


eauto.
7 subgoals, subgoal 1 (ID 3011)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  ============================
   Γ'
   ⊢ match lt_eq_lt_dec v n with
     | inleft (left _) => #v
     | inleft (right _) => P ↑ n
     | inright _ => #(v - 1)
     end : A [n ← P]

subgoal 2 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 3 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 4 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 5 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 6 (ID 3094) is:
 Γ' ⊣
subgoal 7 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using ,)


destruct lt_eq_lt_dec as [ [] | ].
9 subgoals, subgoal 1 (ID 3410)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : v < n
  ============================
   Γ' ⊢ #v : A [n ← P]

subgoal 2 (ID 3411) is:
 Γ' ⊢ P ↑ n : A [n ← P]
subgoal 3 (ID 3412) is:
 Γ' ⊢ #(v - 1) : A [n ← P]
subgoal 4 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 5 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 6 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 7 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 8 (ID 3094) is:
 Γ' ⊣
subgoal 9 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using ,)


constructor.
10 subgoals, subgoal 1 (ID 3415)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : v < n
  ============================
   Γ' ⊣

subgoal 2 (ID 3416) is:
 A [n ← P] ↓ v ⊂ Γ'
subgoal 3 (ID 3411) is:
 Γ' ⊢ P ↑ n : A [n ← P]
subgoal 4 (ID 3412) is:
 Γ' ⊢ #(v - 1) : A [n ← P]
subgoal 5 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 6 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 7 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 8 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 9 (ID 3094) is:
 Γ' ⊣
subgoal 10 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using ,)

eapply H; eauto.
9 subgoals, subgoal 1 (ID 3416)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : v < n
  ============================
   A [n ← P] ↓ v ⊂ Γ'

subgoal 2 (ID 3411) is:
 Γ' ⊢ P ↑ n : A [n ← P]
subgoal 3 (ID 3412) is:
 Γ' ⊢ #(v - 1) : A [n ← P]
subgoal 4 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 5 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 6 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 7 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 8 (ID 3094) is:
 Γ' ⊣
subgoal 9 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using ,)

eapply nth_sub_item_inf.
11 subgoals, subgoal 1 (ID 3477)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : v < n
  ============================
   sub_in_env ?3475 P ?3474 n ?3476 Γ'

subgoal 2 (ID 3478) is:
 n > v
subgoal 3 (ID 3479) is:
 A ↓ v ⊂ ?3476
subgoal 4 (ID 3411) is:
 Γ' ⊢ P ↑ n : A [n ← P]
subgoal 5 (ID 3412) is:
 Γ' ⊢ #(v - 1) : A [n ← P]
subgoal 6 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 7 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 8 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 9 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 10 (ID 3094) is:
 Γ' ⊣
subgoal 11 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 open, ?3475 open, ?3476 open,)

apply H1.
10 subgoals, subgoal 1 (ID 3478)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : v < n
  ============================
   n > v

subgoal 2 (ID 3479) is:
 A ↓ v ⊂ Γ
subgoal 3 (ID 3411) is:
 Γ' ⊢ P ↑ n : A [n ← P]
subgoal 4 (ID 3412) is:
 Γ' ⊢ #(v - 1) : A [n ← P]
subgoal 5 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 6 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 7 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 8 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 9 (ID 3094) is:
 Γ' ⊣
subgoal 10 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using ,)

intuition.
9 subgoals, subgoal 1 (ID 3479)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : v < n
  ============================
   A ↓ v ⊂ Γ

subgoal 2 (ID 3411) is:
 Γ' ⊢ P ↑ n : A [n ← P]
subgoal 3 (ID 3412) is:
 Γ' ⊢ #(v - 1) : A [n ← P]
subgoal 4 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 5 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 6 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 7 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 8 (ID 3094) is:
 Γ' ⊣
subgoal 9 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using ,)

trivial.
8 subgoals, subgoal 1 (ID 3411)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  e : v = n
  ============================
   Γ' ⊢ P ↑ n : A [n ← P]

subgoal 2 (ID 3412) is:
 Γ' ⊢ #(v - 1) : A [n ← P]
subgoal 3 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using ,)


destruct i as (AA & ?& ?).
8 subgoals, subgoal 1 (ID 3490)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H3 : A = AA ↑ (S v)
  H4 : AA ↓ v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  e : v = n
  ============================
   Γ' ⊢ P ↑ n : A [n ← P]

subgoal 2 (ID 3412) is:
 Γ' ⊢ #(v - 1) : A [n ← P]
subgoal 3 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using ,)

subst.
8 subgoals, subgoal 1 (ID 3499)
  
  Γ : Env
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  H4 : AA ↓ n ∈ Γ
  ============================
   Γ' ⊢ P ↑ n : AA ↑ (S n) [n ← P]

subgoal 2 (ID 3412) is:
 Γ' ⊢ #(v - 1) : A [n ← P]
subgoal 3 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using ,)

rewrite substP3; intuition.
8 subgoals, subgoal 1 (ID 3500)
  
  Γ : Env
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  H4 : AA ↓ n ∈ Γ
  ============================
   Γ' ⊢ P ↑ n : AA ↑ n

subgoal 2 (ID 3412) is:
 Γ' ⊢ #(v - 1) : A [n ← P]
subgoal 3 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using ,)


rewrite <- (nth_sub_eq H1 H4).
8 subgoals, subgoal 1 (ID 3552)
  
  Γ : Env
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  H4 : AA ↓ n ∈ Γ
  ============================
   Γ' ⊢ P ↑ n : A0 ↑ n

subgoal 2 (ID 3412) is:
 Γ' ⊢ #(v - 1) : A [n ← P]
subgoal 3 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using ,)

eapply thinning_n.
10 subgoals, subgoal 1 (ID 3554)
  
  Γ : Env
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  H4 : AA ↓ n ∈ Γ
  ============================
   trunc n Γ' ?3553

subgoal 2 (ID 3555) is:
 ?3553 ⊢ P : A0
subgoal 3 (ID 3556) is:
 Γ' ⊣
subgoal 4 (ID 3412) is:
 Γ' ⊢ #(v - 1) : A [n ← P]
subgoal 5 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 6 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 7 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 8 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 9 (ID 3094) is:
 Γ' ⊣
subgoal 10 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 open,)

eapply sub_trunc.
10 subgoals, subgoal 1 (ID 3560)
  
  Γ : Env
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  H4 : AA ↓ n ∈ Γ
  ============================
   sub_in_env ?3553 ?3557 ?3558 n ?3559 Γ'

subgoal 2 (ID 3555) is:
 ?3553 ⊢ P : A0
subgoal 3 (ID 3556) is:
 Γ' ⊣
subgoal 4 (ID 3412) is:
 Γ' ⊢ #(v - 1) : A [n ← P]
subgoal 5 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 6 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 7 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 8 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 9 (ID 3094) is:
 Γ' ⊣
subgoal 10 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 open, ?3557 open, ?3558 open, ?3559 open,)

apply H1.
9 subgoals, subgoal 1 (ID 3555)
  
  Γ : Env
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  H4 : AA ↓ n ∈ Γ
  ============================
   Δ ⊢ P : A0

subgoal 2 (ID 3556) is:
 Γ' ⊣
subgoal 3 (ID 3412) is:
 Γ' ⊢ #(v - 1) : A [n ← P]
subgoal 4 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 5 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 6 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 7 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 8 (ID 3094) is:
 Γ' ⊣
subgoal 9 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using ,)

trivial.
8 subgoals, subgoal 1 (ID 3556)
  
  Γ : Env
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  H4 : AA ↓ n ∈ Γ
  ============================
   Γ' ⊣

subgoal 2 (ID 3412) is:
 Γ' ⊢ #(v - 1) : A [n ← P]
subgoal 3 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using ,)


eapply H; eauto.
7 subgoals, subgoal 1 (ID 3412)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   Γ' ⊢ #(v - 1) : A [n ← P]

subgoal 2 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 3 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 4 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 5 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 6 (ID 3094) is:
 Γ' ⊣
subgoal 7 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using ,)

constructor.
8 subgoals, subgoal 1 (ID 3620)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   Γ' ⊣

subgoal 2 (ID 3621) is:
 A [n ← P] ↓ v - 1 ⊂ Γ'
subgoal 3 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using ,)

eapply H; eauto.
7 subgoals, subgoal 1 (ID 3621)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  i : A ↓ v ⊂ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   A [n ← P] ↓ v - 1 ⊂ Γ'

subgoal 2 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 3 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 4 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 5 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 6 (ID 3094) is:
 Γ' ⊣
subgoal 7 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using ,)

destruct i as (AA & ? &?).
7 subgoals, subgoal 1 (ID 3689)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H3 : A = AA ↑ (S v)
  H4 : AA ↓ v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   A [n ← P] ↓ v - 1 ⊂ Γ'

subgoal 2 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 3 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 4 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 5 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 6 (ID 3094) is:
 Γ' ⊣
subgoal 7 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using ,)

subst.
7 subgoals, subgoal 1 (ID 3692)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   AA ↑ (S v) [n ← P] ↓ v - 1 ⊂ Γ'

subgoal 2 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 3 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 4 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 5 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 6 (ID 3094) is:
 Γ' ⊣
subgoal 7 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using ,)


rewrite substP3; intuition.
7 subgoals, subgoal 1 (ID 3693)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   AA ↑ v ↓ v - 1 ⊂ Γ'

subgoal 2 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 3 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 4 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 5 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 6 (ID 3094) is:
 Γ' ⊣
subgoal 7 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using ,)

exists AA; split.
8 subgoals, subgoal 1 (ID 3757)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   AA ↑ v = AA ↑ (S (v - 1))

subgoal 2 (ID 3758) is:
 AA ↓ v - 1 ∈ Γ'
subgoal 3 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using ,)

replace (S (v-1)) with v.
9 subgoals, subgoal 1 (ID 3762)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   AA ↑ v = AA ↑ v

subgoal 2 (ID 3759) is:
 v = S (v - 1)
subgoal 3 (ID 3758) is:
 AA ↓ v - 1 ∈ Γ'
subgoal 4 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 5 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 6 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 7 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 8 (ID 3094) is:
 Γ' ⊣
subgoal 9 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using ,)

trivial.
8 subgoals, subgoal 1 (ID 3759)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   v = S (v - 1)

subgoal 2 (ID 3758) is:
 AA ↓ v - 1 ∈ Γ'
subgoal 3 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using ,)


rewrite minus_Sn_m.
9 subgoals, subgoal 1 (ID 3764)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   v = S v - 1

subgoal 2 (ID 3765) is:
 1 <= v
subgoal 3 (ID 3758) is:
 AA ↓ v - 1 ∈ Γ'
subgoal 4 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 5 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 6 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 7 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 8 (ID 3094) is:
 Γ' ⊣
subgoal 9 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using ,)

intuition.
8 subgoals, subgoal 1 (ID 3765)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   1 <= v

subgoal 2 (ID 3758) is:
 AA ↓ v - 1 ∈ Γ'
subgoal 3 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using ,)

destruct v.
9 subgoals, subgoal 1 (ID 3792)
  
  Γ : Env
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ 0 ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < 0
  ============================
   1 <= 0

subgoal 2 (ID 3797) is:
 1 <= S v
subgoal 3 (ID 3758) is:
 AA ↓ v - 1 ∈ Γ'
subgoal 4 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 5 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 6 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 7 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 8 (ID 3094) is:
 Γ' ⊣
subgoal 9 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using ,)

apply lt_n_O in l; elim l.
8 subgoals, subgoal 1 (ID 3797)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ S v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < S v
  ============================
   1 <= S v

subgoal 2 (ID 3758) is:
 AA ↓ v - 1 ∈ Γ'
subgoal 3 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using ,)

intuition.
7 subgoals, subgoal 1 (ID 3758)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   AA ↓ v - 1 ∈ Γ'

subgoal 2 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 3 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 4 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 5 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 6 (ID 3094) is:
 Γ' ⊣
subgoal 7 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using ,)


eapply nth_sub_sup.
9 subgoals, subgoal 1 (ID 3822)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   sub_in_env ?3818 ?3820 ?3821 ?3817 ?3819 Γ'

subgoal 2 (ID 3823) is:
 ?3817 <= v - 1
subgoal 3 (ID 3824) is:
 AA ↓ S (v - 1) ∈ ?3819
subgoal 4 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 5 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 6 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 7 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 8 (ID 3094) is:
 Γ' ⊣
subgoal 9 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 open, ?3818 open, ?3819 open, ?3820 open, ?3821 open,)

apply H1.
8 subgoals, subgoal 1 (ID 3823)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   n <= v - 1

subgoal 2 (ID 3824) is:
 AA ↓ S (v - 1) ∈ Γ
subgoal 3 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using ,)

destruct v.
9 subgoals, subgoal 1 (ID 3833)
  
  Γ : Env
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ 0 ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < 0
  ============================
   n <= 0 - 1

subgoal 2 (ID 3838) is:
 n <= S v - 1
subgoal 3 (ID 3824) is:
 AA ↓ S (v - 1) ∈ Γ
subgoal 4 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 5 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 6 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 7 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 8 (ID 3094) is:
 Γ' ⊣
subgoal 9 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using ,)

apply lt_n_O in l; elim l.
8 subgoals, subgoal 1 (ID 3838)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ S v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < S v
  ============================
   n <= S v - 1

subgoal 2 (ID 3824) is:
 AA ↓ S (v - 1) ∈ Γ
subgoal 3 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using ,)

simpl.
8 subgoals, subgoal 1 (ID 3841)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ S v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < S v
  ============================
   n <= v - 0

subgoal 2 (ID 3824) is:
 AA ↓ S (v - 1) ∈ Γ
subgoal 3 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using ,)

rewrite <- minus_n_O.
8 subgoals, subgoal 1 (ID 3842)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ S v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < S v
  ============================
   n <= v

subgoal 2 (ID 3824) is:
 AA ↓ S (v - 1) ∈ Γ
subgoal 3 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using ,)


intuition.
7 subgoals, subgoal 1 (ID 3824)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   AA ↓ S (v - 1) ∈ Γ

subgoal 2 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 3 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 4 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 5 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 6 (ID 3094) is:
 Γ' ⊣
subgoal 7 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using ,)

rewrite <- pred_of_minus.
7 subgoals, subgoal 1 (ID 3860)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   AA ↓ S (pred v) ∈ Γ

subgoal 2 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 3 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 4 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 5 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 6 (ID 3094) is:
 Γ' ⊣
subgoal 7 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using ,)

rewrite <- (S_pred v n l).
7 subgoals, subgoal 1 (ID 3861)
  
  Γ : Env
  v : nat
  w : Γ ⊣
  H : forall (Δ : Env) (P A : Term) (n : nat) (Γ' : Env),
      Δ ⊢ P : A -> sub_in_env Δ P A n Γ Γ' -> Γ' ⊣
  AA : Term
  H4 : AA ↓ v ∈ Γ
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H1 : sub_in_env Δ P A0 n Γ Γ'
  H2 : Γ ⊣
  l : n < v
  ============================
   AA ↓ v ∈ Γ

subgoal 2 (ID 3030) is:
 Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u
subgoal 3 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 4 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 5 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 6 (ID 3094) is:
 Γ' ⊣
subgoal 7 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using ,)

trivial.
6 subgoals, subgoal 1 (ID 3030)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  r : Rel s t u
  t0 : Γ ⊢ A : !s
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ A [n ← P] : !s
  t1 : A :: Γ ⊢ B : !t
  H0 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n (A :: Γ) Γ' -> A :: Γ ⊣ -> Γ' ⊢ B [n ← P] : !t
  Δ : Env
  P : Term
  A0 : Term
  H1 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H2 : sub_in_env Δ P A0 n Γ Γ'
  H3 : Γ ⊣
  ============================
   Γ' ⊢ Π (A [n ← P]), B [(S n) ← P] : !u

subgoal 2 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 3 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 4 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 5 (ID 3094) is:
 Γ' ⊣
subgoal 6 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using ,)


econstructor.
8 subgoals, subgoal 1 (ID 3867)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  r : Rel s t u
  t0 : Γ ⊢ A : !s
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ A [n ← P] : !s
  t1 : A :: Γ ⊢ B : !t
  H0 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n (A :: Γ) Γ' -> A :: Γ ⊣ -> Γ' ⊢ B [n ← P] : !t
  Δ : Env
  P : Term
  A0 : Term
  H1 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H2 : sub_in_env Δ P A0 n Γ Γ'
  H3 : Γ ⊣
  ============================
   Rel ?3865 ?3866 u

subgoal 2 (ID 3868) is:
 Γ' ⊢ A [n ← P] : !?3865
subgoal 3 (ID 3869) is:
 A [n ← P] :: Γ' ⊢ B [(S n) ← P] : !?3866
subgoal 4 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 open, ?3866 open,)

apply r.
7 subgoals, subgoal 1 (ID 3868)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  r : Rel s t u
  t0 : Γ ⊢ A : !s
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ A [n ← P] : !s
  t1 : A :: Γ ⊢ B : !t
  H0 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n (A :: Γ) Γ' -> A :: Γ ⊣ -> Γ' ⊢ B [n ← P] : !t
  Δ : Env
  P : Term
  A0 : Term
  H1 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H2 : sub_in_env Δ P A0 n Γ Γ'
  H3 : Γ ⊣
  ============================
   Γ' ⊢ A [n ← P] : !s

subgoal 2 (ID 3869) is:
 A [n ← P] :: Γ' ⊢ B [(S n) ← P] : !t
subgoal 3 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 4 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 5 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 6 (ID 3094) is:
 Γ' ⊣
subgoal 7 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using ,)

eapply H; eauto.
6 subgoals, subgoal 1 (ID 3869)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  r : Rel s t u
  t0 : Γ ⊢ A : !s
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ A [n ← P] : !s
  t1 : A :: Γ ⊢ B : !t
  H0 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n (A :: Γ) Γ' -> A :: Γ ⊣ -> Γ' ⊢ B [n ← P] : !t
  Δ : Env
  P : Term
  A0 : Term
  H1 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H2 : sub_in_env Δ P A0 n Γ Γ'
  H3 : Γ ⊣
  ============================
   A [n ← P] :: Γ' ⊢ B [(S n) ← P] : !t

subgoal 2 (ID 3052) is:
 Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]
subgoal 3 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 4 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 5 (ID 3094) is:
 Γ' ⊣
subgoal 6 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using ,)

eapply H0; eauto.
5 subgoals, subgoal 1 (ID 3052)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  r : Rel s1 s2 s3
  t : Γ ⊢ A : !s1
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ A [n ← P] : !s1
  t0 : A :: Γ ⊢ B : !s2
  H0 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n (A :: Γ) Γ' -> A :: Γ ⊣ -> Γ' ⊢ B [n ← P] : !s2
  t1 : A :: Γ ⊢ M : B
  H1 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n (A :: Γ) Γ' ->
       A :: Γ ⊣ -> Γ' ⊢ M [n ← P] : B [n ← P]
  Δ : Env
  P : Term
  A0 : Term
  H2 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H3 : sub_in_env Δ P A0 n Γ Γ'
  H4 : Γ ⊣
  ============================
   Γ' ⊢ λ [A [n ← P]], M [(S n) ← P] : Π (A [n ← P]), B [(S n) ← P]

subgoal 2 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 3 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 4 (ID 3094) is:
 Γ' ⊣
subgoal 5 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using ,)


econstructor.
8 subgoals, subgoal 1 (ID 3911)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  r : Rel s1 s2 s3
  t : Γ ⊢ A : !s1
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ A [n ← P] : !s1
  t0 : A :: Γ ⊢ B : !s2
  H0 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n (A :: Γ) Γ' -> A :: Γ ⊣ -> Γ' ⊢ B [n ← P] : !s2
  t1 : A :: Γ ⊢ M : B
  H1 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n (A :: Γ) Γ' ->
       A :: Γ ⊣ -> Γ' ⊢ M [n ← P] : B [n ← P]
  Δ : Env
  P : Term
  A0 : Term
  H2 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H3 : sub_in_env Δ P A0 n Γ Γ'
  H4 : Γ ⊣
  ============================
   Rel ?3908 ?3909 ?3910

subgoal 2 (ID 3912) is:
 Γ' ⊢ A [n ← P] : !?3908
subgoal 3 (ID 3913) is:
 A [n ← P] :: Γ' ⊢ B [(S n) ← P] : !?3909
subgoal 4 (ID 3914) is:
 A [n ← P] :: Γ' ⊢ M [(S n) ← P] : B [(S n) ← P]
subgoal 5 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 6 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 7 (ID 3094) is:
 Γ' ⊣
subgoal 8 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 open, ?3909 open, ?3910 open,)

apply r.
7 subgoals, subgoal 1 (ID 3912)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  r : Rel s1 s2 s3
  t : Γ ⊢ A : !s1
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ A [n ← P] : !s1
  t0 : A :: Γ ⊢ B : !s2
  H0 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n (A :: Γ) Γ' -> A :: Γ ⊣ -> Γ' ⊢ B [n ← P] : !s2
  t1 : A :: Γ ⊢ M : B
  H1 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n (A :: Γ) Γ' ->
       A :: Γ ⊣ -> Γ' ⊢ M [n ← P] : B [n ← P]
  Δ : Env
  P : Term
  A0 : Term
  H2 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H3 : sub_in_env Δ P A0 n Γ Γ'
  H4 : Γ ⊣
  ============================
   Γ' ⊢ A [n ← P] : !s1

subgoal 2 (ID 3913) is:
 A [n ← P] :: Γ' ⊢ B [(S n) ← P] : !s2
subgoal 3 (ID 3914) is:
 A [n ← P] :: Γ' ⊢ M [(S n) ← P] : B [(S n) ← P]
subgoal 4 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 5 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 6 (ID 3094) is:
 Γ' ⊣
subgoal 7 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using ,)

eapply H; eauto.
6 subgoals, subgoal 1 (ID 3913)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  r : Rel s1 s2 s3
  t : Γ ⊢ A : !s1
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ A [n ← P] : !s1
  t0 : A :: Γ ⊢ B : !s2
  H0 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n (A :: Γ) Γ' -> A :: Γ ⊣ -> Γ' ⊢ B [n ← P] : !s2
  t1 : A :: Γ ⊢ M : B
  H1 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n (A :: Γ) Γ' ->
       A :: Γ ⊣ -> Γ' ⊢ M [n ← P] : B [n ← P]
  Δ : Env
  P : Term
  A0 : Term
  H2 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H3 : sub_in_env Δ P A0 n Γ Γ'
  H4 : Γ ⊣
  ============================
   A [n ← P] :: Γ' ⊢ B [(S n) ← P] : !s2

subgoal 2 (ID 3914) is:
 A [n ← P] :: Γ' ⊢ M [(S n) ← P] : B [(S n) ← P]
subgoal 3 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 4 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 5 (ID 3094) is:
 Γ' ⊣
subgoal 6 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using ,)

eapply H0; eauto.
5 subgoals, subgoal 1 (ID 3914)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  r : Rel s1 s2 s3
  t : Γ ⊢ A : !s1
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ A [n ← P] : !s1
  t0 : A :: Γ ⊢ B : !s2
  H0 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n (A :: Γ) Γ' -> A :: Γ ⊣ -> Γ' ⊢ B [n ← P] : !s2
  t1 : A :: Γ ⊢ M : B
  H1 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n (A :: Γ) Γ' ->
       A :: Γ ⊣ -> Γ' ⊢ M [n ← P] : B [n ← P]
  Δ : Env
  P : Term
  A0 : Term
  H2 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H3 : sub_in_env Δ P A0 n Γ Γ'
  H4 : Γ ⊣
  ============================
   A [n ← P] :: Γ' ⊢ M [(S n) ← P] : B [(S n) ← P]

subgoal 2 (ID 3069) is:
 Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]
subgoal 3 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 4 (ID 3094) is:
 Γ' ⊣
subgoal 5 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using ,)

eapply H1; eauto.
4 subgoals, subgoal 1 (ID 3069)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  t : Γ ⊢ M : Π (A), B
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' ->
      Γ ⊣ -> Γ' ⊢ M [n ← P] : Π (A [n ← P]), B [(S n) ← P]
  t0 : Γ ⊢ N : A
  H0 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ N [n ← P] : A [n ← P]
  Δ : Env
  P : Term
  A0 : Term
  H1 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H2 : sub_in_env Δ P A0 n Γ Γ'
  H3 : Γ ⊣
  ============================
   Γ' ⊢ M [n ← P] · N [n ← P] : B [ ← N] [n ← P]

subgoal 2 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 3 (ID 3094) is:
 Γ' ⊣
subgoal 4 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using ,)


rewrite subst_travers.
4 subgoals, subgoal 1 (ID 3970)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  t : Γ ⊢ M : Π (A), B
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' ->
      Γ ⊣ -> Γ' ⊢ M [n ← P] : Π (A [n ← P]), B [(S n) ← P]
  t0 : Γ ⊢ N : A
  H0 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ N [n ← P] : A [n ← P]
  Δ : Env
  P : Term
  A0 : Term
  H1 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H2 : sub_in_env Δ P A0 n Γ Γ'
  H3 : Γ ⊣
  ============================
   Γ' ⊢ M [n ← P] · N [n ← P] : (B [(n + 1) ← P]) [ ← N [n ← P]]

subgoal 2 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 3 (ID 3094) is:
 Γ' ⊣
subgoal 4 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using ,)

econstructor.
5 subgoals, subgoal 1 (ID 3977)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  t : Γ ⊢ M : Π (A), B
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' ->
      Γ ⊣ -> Γ' ⊢ M [n ← P] : Π (A [n ← P]), B [(S n) ← P]
  t0 : Γ ⊢ N : A
  H0 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ N [n ← P] : A [n ← P]
  Δ : Env
  P : Term
  A0 : Term
  H1 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H2 : sub_in_env Δ P A0 n Γ Γ'
  H3 : Γ ⊣
  ============================
   Γ' ⊢ M [n ← P] : Π (?3976), B [(n + 1) ← P]

subgoal 2 (ID 3978) is:
 Γ' ⊢ N [n ← P] : ?3976
subgoal 3 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 4 (ID 3094) is:
 Γ' ⊣
subgoal 5 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 open,)


replace (n+1) with (S n) by (rewrite plus_comm; trivial).
5 subgoals, subgoal 1 (ID 3982)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  t : Γ ⊢ M : Π (A), B
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' ->
      Γ ⊣ -> Γ' ⊢ M [n ← P] : Π (A [n ← P]), B [(S n) ← P]
  t0 : Γ ⊢ N : A
  H0 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ N [n ← P] : A [n ← P]
  Δ : Env
  P : Term
  A0 : Term
  H1 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H2 : sub_in_env Δ P A0 n Γ Γ'
  H3 : Γ ⊣
  ============================
   Γ' ⊢ M [n ← P] : Π (?3976), B [(S n) ← P]

subgoal 2 (ID 3978) is:
 Γ' ⊢ N [n ← P] : ?3976
subgoal 3 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 4 (ID 3094) is:
 Γ' ⊣
subgoal 5 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 open,)

eapply H; eauto.
4 subgoals, subgoal 1 (ID 3978)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  t : Γ ⊢ M : Π (A), B
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' ->
      Γ ⊣ -> Γ' ⊢ M [n ← P] : Π (A [n ← P]), B [(S n) ← P]
  t0 : Γ ⊢ N : A
  H0 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ N [n ← P] : A [n ← P]
  Δ : Env
  P : Term
  A0 : Term
  H1 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H2 : sub_in_env Δ P A0 n Γ Γ'
  H3 : Γ ⊣
  ============================
   Γ' ⊢ N [n ← P] : A [n ← P]

subgoal 2 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 3 (ID 3094) is:
 Γ' ⊣
subgoal 4 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 using , ?3985 using , ?3986 using ,)


replace (n+1) with (S n) by (rewrite plus_comm; trivial).
4 subgoals, subgoal 1 (ID 4000)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  t : Γ ⊢ M : Π (A), B
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' ->
      Γ ⊣ -> Γ' ⊢ M [n ← P] : Π (A [n ← P]), B [(S n) ← P]
  t0 : Γ ⊢ N : A
  H0 : forall (Δ : Env) (P A0 : Term),
       Δ ⊢ P : A0 ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ N [n ← P] : A [n ← P]
  Δ : Env
  P : Term
  A0 : Term
  H1 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H2 : sub_in_env Δ P A0 n Γ Γ'
  H3 : Γ ⊣
  ============================
   Γ' ⊢ N [n ← P] : A [n ← P]

subgoal 2 (ID 3087) is:
 Γ' ⊢ M [n ← P] : B [n ← P]
subgoal 3 (ID 3094) is:
 Γ' ⊣
subgoal 4 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 using , ?3985 using , ?3986 using ,)

eapply H0; eauto.
3 subgoals, subgoal 1 (ID 3087)
  
  Γ : Env
  M : Term
  A : Term
  B : Term
  s : Sorts
  b : A ≡ B
  t : Γ ⊢ M : A
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ M [n ← P] : A [n ← P]
  t0 : Γ ⊢ B : !s
  H0 : forall (Δ : Env) (P A : Term),
       Δ ⊢ P : A ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A n Γ Γ' -> Γ ⊣ -> Γ' ⊢ B [n ← P] : !s
  Δ : Env
  P : Term
  A0 : Term
  H1 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H2 : sub_in_env Δ P A0 n Γ Γ'
  H3 : Γ ⊣
  ============================
   Γ' ⊢ M [n ← P] : B [n ← P]

subgoal 2 (ID 3094) is:
 Γ' ⊣
subgoal 3 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 using , ?3985 using , ?3986 using , ?4003 using , ?4004 using ,)


econstructor.
5 subgoals, subgoal 1 (ID 4024)
  
  Γ : Env
  M : Term
  A : Term
  B : Term
  s : Sorts
  b : A ≡ B
  t : Γ ⊢ M : A
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ M [n ← P] : A [n ← P]
  t0 : Γ ⊢ B : !s
  H0 : forall (Δ : Env) (P A : Term),
       Δ ⊢ P : A ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A n Γ Γ' -> Γ ⊣ -> Γ' ⊢ B [n ← P] : !s
  Δ : Env
  P : Term
  A0 : Term
  H1 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H2 : sub_in_env Δ P A0 n Γ Γ'
  H3 : Γ ⊣
  ============================
   ?4022 ≡ B [n ← P]

subgoal 2 (ID 4025) is:
 Γ' ⊢ M [n ← P] : ?4022
subgoal 3 (ID 4026) is:
 Γ' ⊢ B [n ← P] : !?4023
subgoal 4 (ID 3094) is:
 Γ' ⊣
subgoal 5 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 using , ?3985 using , ?3986 using , ?4003 using , ?4004 using , ?4022 open, ?4023 open,)

apply Betac_subst2.
5 subgoals, subgoal 1 (ID 4028)
  
  Γ : Env
  M : Term
  A : Term
  B : Term
  s : Sorts
  b : A ≡ B
  t : Γ ⊢ M : A
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ M [n ← P] : A [n ← P]
  t0 : Γ ⊢ B : !s
  H0 : forall (Δ : Env) (P A : Term),
       Δ ⊢ P : A ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A n Γ Γ' -> Γ ⊣ -> Γ' ⊢ B [n ← P] : !s
  Δ : Env
  P : Term
  A0 : Term
  H1 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H2 : sub_in_env Δ P A0 n Γ Γ'
  H3 : Γ ⊣
  ============================
   ?4027 ≡ B

subgoal 2 (ID 4025) is:
 Γ' ⊢ M [n ← P] : ?4027 [n ← P]
subgoal 3 (ID 4026) is:
 Γ' ⊢ B [n ← P] : !?4023
subgoal 4 (ID 3094) is:
 Γ' ⊣
subgoal 5 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 using , ?3985 using , ?3986 using , ?4003 using , ?4004 using , ?4022 using ?4027 , ?4023 open, ?4027 open,)

apply b.
4 subgoals, subgoal 1 (ID 4025)
  
  Γ : Env
  M : Term
  A : Term
  B : Term
  s : Sorts
  b : A ≡ B
  t : Γ ⊢ M : A
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ M [n ← P] : A [n ← P]
  t0 : Γ ⊢ B : !s
  H0 : forall (Δ : Env) (P A : Term),
       Δ ⊢ P : A ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A n Γ Γ' -> Γ ⊣ -> Γ' ⊢ B [n ← P] : !s
  Δ : Env
  P : Term
  A0 : Term
  H1 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H2 : sub_in_env Δ P A0 n Γ Γ'
  H3 : Γ ⊣
  ============================
   Γ' ⊢ M [n ← P] : A [n ← P]

subgoal 2 (ID 4026) is:
 Γ' ⊢ B [n ← P] : !?4023
subgoal 3 (ID 3094) is:
 Γ' ⊣
subgoal 4 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 using , ?3985 using , ?3986 using , ?4003 using , ?4004 using , ?4022 using ?4027 , ?4023 open, ?4027 using ,)

eapply H; eauto.
3 subgoals, subgoal 1 (ID 4026)
  
  Γ : Env
  M : Term
  A : Term
  B : Term
  s : Sorts
  b : A ≡ B
  t : Γ ⊢ M : A
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ M [n ← P] : A [n ← P]
  t0 : Γ ⊢ B : !s
  H0 : forall (Δ : Env) (P A : Term),
       Δ ⊢ P : A ->
       forall (Γ' : Env) (n : nat),
       sub_in_env Δ P A n Γ Γ' -> Γ ⊣ -> Γ' ⊢ B [n ← P] : !s
  Δ : Env
  P : Term
  A0 : Term
  H1 : Δ ⊢ P : A0
  Γ' : Env
  n : nat
  H2 : sub_in_env Δ P A0 n Γ Γ'
  H3 : Γ ⊣
  ============================
   Γ' ⊢ B [n ← P] : !?4023

subgoal 2 (ID 3094) is:
 Γ' ⊣
subgoal 3 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 using , ?3985 using , ?3986 using , ?4003 using , ?4004 using , ?4022 using ?4027 , ?4023 open, ?4027 using , ?4029 using , ?4030 using ,)

eapply H0; eauto.
2 subgoals, subgoal 1 (ID 3094)
  
  Δ : Env
  P : Term
  A : Term
  n : nat
  Γ' : Env
  H : Δ ⊢ P : A
  H0 : sub_in_env Δ P A n nil Γ'
  ============================
   Γ' ⊣

subgoal 2 (ID 3106) is:
 Γ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 using , ?3985 using , ?3986 using , ?4003 using , ?4004 using , ?4022 using ?4027 , ?4023 using , ?4027 using , ?4029 using , ?4030 using , ?4042 using , ?4043 using ,)


inversion H0.
1 subgoals, subgoal 1 (ID 3106)
  
  Γ : Env
  A : Term
  s : Sorts
  t : Γ ⊢ A : !s
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ A [n ← P] : !s
  Δ : Env
  P : Term
  A0 : Term
  n : nat
  Γ' : Env
  H0 : Δ ⊢ P : A0
  H1 : sub_in_env Δ P A0 n (A :: Γ) Γ'
  ============================
   Γ' ⊣

(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 using , ?3985 using , ?3986 using , ?4003 using , ?4004 using , ?4022 using ?4027 , ?4023 using , ?4027 using , ?4029 using , ?4030 using , ?4042 using , ?4043 using ,)


inversion H1; subst; clear H1.
2 subgoals, subgoal 1 (ID 4207)
  
  A : Term
  s : Sorts
  P : Term
  Γ' : Env
  t : Γ' ⊢ A : !s
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ'0 : Env) (n : nat),
      sub_in_env Δ P A0 n Γ' Γ'0 -> Γ' ⊣ -> Γ'0 ⊢ A [n ← P] : !s
  H0 : Γ' ⊢ P : A
  ============================
   Γ' ⊣

subgoal 2 (ID 4208) is:
 A [n0 ← P] :: Δ' ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 using , ?3985 using , ?3986 using , ?4003 using , ?4004 using , ?4022 using ?4027 , ?4023 using , ?4027 using , ?4029 using , ?4030 using , ?4042 using , ?4043 using ,)

eauto.
1 subgoals, subgoal 1 (ID 4208)
  
  Γ : Env
  A : Term
  s : Sorts
  t : Γ ⊢ A : !s
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ A [n ← P] : !s
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Δ' : Env
  n0 : nat
  H6 : sub_in_env Δ P A0 n0 Γ Δ'
  ============================
   A [n0 ← P] :: Δ' ⊣

(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 using , ?3985 using , ?3986 using , ?4003 using , ?4004 using , ?4022 using ?4027 , ?4023 using , ?4027 using , ?4029 using , ?4030 using , ?4042 using , ?4043 using , ?4209 using , ?4210 using ,)


econstructor.
1 subgoals, subgoal 1 (ID 4276)
  
  Γ : Env
  A : Term
  s : Sorts
  t : Γ ⊢ A : !s
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ A [n ← P] : !s
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Δ' : Env
  n0 : nat
  H6 : sub_in_env Δ P A0 n0 Γ Δ'
  ============================
   Δ' ⊢ A [n0 ← P] : !?4275

(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 using , ?3985 using , ?3986 using , ?4003 using , ?4004 using , ?4022 using ?4027 , ?4023 using , ?4027 using , ?4029 using , ?4030 using , ?4042 using , ?4043 using , ?4209 using , ?4210 using , ?4275 open,)

eapply H.
3 subgoals, subgoal 1 (ID 4279)
  
  Γ : Env
  A : Term
  s : Sorts
  t : Γ ⊢ A : !s
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ A [n ← P] : !s
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Δ' : Env
  n0 : nat
  H6 : sub_in_env Δ P A0 n0 Γ Δ'
  ============================
   ?4277 ⊢ P : ?4278

subgoal 2 (ID 4280) is:
 sub_in_env ?4277 P ?4278 n0 Γ Δ'
subgoal 3 (ID 4281) is:
 Γ ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 using , ?3985 using , ?3986 using , ?4003 using , ?4004 using , ?4022 using ?4027 , ?4023 using , ?4027 using , ?4029 using , ?4030 using , ?4042 using , ?4043 using , ?4209 using , ?4210 using , ?4275 using , ?4277 open, ?4278 open,)

apply H0.
2 subgoals, subgoal 1 (ID 4280)
  
  Γ : Env
  A : Term
  s : Sorts
  t : Γ ⊢ A : !s
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ A [n ← P] : !s
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Δ' : Env
  n0 : nat
  H6 : sub_in_env Δ P A0 n0 Γ Δ'
  ============================
   sub_in_env Δ P A0 n0 Γ Δ'

subgoal 2 (ID 4281) is:
 Γ ⊣
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 using , ?3985 using , ?3986 using , ?4003 using , ?4004 using , ?4022 using ?4027 , ?4023 using , ?4027 using , ?4029 using , ?4030 using , ?4042 using , ?4043 using , ?4209 using , ?4210 using , ?4275 using , ?4277 using , ?4278 using ,)

trivial.
1 subgoals, subgoal 1 (ID 4281)
  
  Γ : Env
  A : Term
  s : Sorts
  t : Γ ⊢ A : !s
  H : forall (Δ : Env) (P A0 : Term),
      Δ ⊢ P : A0 ->
      forall (Γ' : Env) (n : nat),
      sub_in_env Δ P A0 n Γ Γ' -> Γ ⊣ -> Γ' ⊢ A [n ← P] : !s
  Δ : Env
  P : Term
  A0 : Term
  H0 : Δ ⊢ P : A0
  Δ' : Env
  n0 : nat
  H6 : sub_in_env Δ P A0 n0 Γ Δ'
  ============================
   Γ ⊣

(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 using , ?3985 using , ?3986 using , ?4003 using , ?4004 using , ?4022 using ?4027 , ?4023 using , ?4027 using , ?4029 using , ?4030 using , ?4042 using , ?4043 using , ?4209 using , ?4210 using , ?4275 using , ?4277 using , ?4278 using ,)

eauto.
No more subgoals.
(dependent evars: ?3120 using ?3127 , ?3121 using ?3126 , ?3126 using , ?3127 using , ?3286 using , ?3287 using , ?3288 using , ?3289 using , ?3417 using , ?3418 using , ?3419 using , ?3420 using , ?3474 using , ?3475 using , ?3476 using , ?3553 using , ?3557 using , ?3558 using , ?3559 using , ?3561 using , ?3562 using , ?3563 using , ?3564 using , ?3622 using , ?3623 using , ?3624 using , ?3625 using , ?3817 using , ?3818 using , ?3819 using , ?3820 using , ?3821 using , ?3865 using , ?3866 using , ?3870 using , ?3871 using , ?3883 using , ?3884 using , ?3894 using , ?3908 using , ?3909 using , ?3910 using , ?3915 using , ?3916 using , ?3928 using , ?3929 using , ?3939 using , ?3949 using , ?3950 using , ?3960 using , ?3976 using , ?3985 using , ?3986 using , ?4003 using , ?4004 using , ?4022 using ?4027 , ?4023 using , ?4027 using , ?4029 using , ?4030 using , ?4042 using , ?4043 using , ?4209 using , ?4210 using , ?4275 using , ?4277 using , ?4278 using , ?4282 using , ?4283 using ,)


Qed.
substitution is defined



Well-formation of contexts: if a context is valid, every term inside is well-typed by a sort.
Lemma wf_item : forall Γ A n, A n Γ ->
   forall Γ', Γ -> trunc (S n) Γ Γ' -> exists s, Γ' A : !s.
1 subgoals, subgoal 1 (ID 4355)
  
  ============================
   forall (Γ : list Term) (A : Term) (n : nat),
   A ↓ n ∈ Γ ->
   forall Γ' : list Term,
   Γ ⊣ -> trunc (S n) Γ Γ' -> exists s : Sorts, Γ' ⊢ A : !s

(dependent evars:)


induction 1; intros.
2 subgoals, subgoal 1 (ID 4376)
  
  A : Term
  Γ : list Term
  Γ' : list Term
  H : A :: Γ ⊣
  H0 : trunc 1 (A :: Γ) Γ'
  ============================
   exists s : Sorts, Γ' ⊢ A : !s

subgoal 2 (ID 4379) is:
 exists s : Sorts, Γ' ⊢ A : !s
(dependent evars:)


inversion H0; subst; clear H0.
2 subgoals, subgoal 1 (ID 4452)
  
  A : Term
  Γ : list Term
  Γ' : list Term
  H : A :: Γ ⊣
  H5 : trunc 0 Γ Γ'
  ============================
   exists s : Sorts, Γ' ⊢ A : !s

subgoal 2 (ID 4379) is:
 exists s : Sorts, Γ' ⊢ A : !s
(dependent evars:)


inversion H5; subst; clear H5.
2 subgoals, subgoal 1 (ID 4508)
  
  A : Term
  Γ' : list Term
  H : A :: Γ' ⊣
  ============================
   exists s : Sorts, Γ' ⊢ A : !s

subgoal 2 (ID 4379) is:
 exists s : Sorts, Γ' ⊢ A : !s
(dependent evars:)


inversion H; subst.
2 subgoals, subgoal 1 (ID 4556)
  
  A : Term
  Γ' : list Term
  H : A :: Γ' ⊣
  s : Sorts
  H1 : Γ' ⊢ A : !s
  ============================
   exists s0 : Sorts, Γ' ⊢ A : !s0

subgoal 2 (ID 4379) is:
 exists s : Sorts, Γ' ⊢ A : !s
(dependent evars:)


exists s; trivial.
1 subgoals, subgoal 1 (ID 4379)
  
  A : Term
  Γ : list Term
  n : nat
  y : Term
  H : A ↓ n ∈ Γ
  IHitem : forall Γ' : list Term,
           Γ ⊣ -> trunc (S n) Γ Γ' -> exists s : Sorts, Γ' ⊢ A : !s
  Γ' : list Term
  H0 : y :: Γ ⊣
  H1 : trunc (S (S n)) (y :: Γ) Γ'
  ============================
   exists s : Sorts, Γ' ⊢ A : !s

(dependent evars:)


inversion H1; subst; clear H1.
1 subgoals, subgoal 1 (ID 4631)
  
  A : Term
  Γ : list Term
  n : nat
  y : Term
  H : A ↓ n ∈ Γ
  IHitem : forall Γ' : list Term,
           Γ ⊣ -> trunc (S n) Γ Γ' -> exists s : Sorts, Γ' ⊢ A : !s
  Γ' : list Term
  H0 : y :: Γ ⊣
  H6 : trunc (S n) Γ Γ'
  ============================
   exists s : Sorts, Γ' ⊢ A : !s

(dependent evars:)


inversion H0; subst.
1 subgoals, subgoal 1 (ID 4679)
  
  A : Term
  Γ : list Term
  n : nat
  y : Term
  H : A ↓ n ∈ Γ
  IHitem : forall Γ' : list Term,
           Γ ⊣ -> trunc (S n) Γ Γ' -> exists s : Sorts, Γ' ⊢ A : !s
  Γ' : list Term
  H0 : y :: Γ ⊣
  H6 : trunc (S n) Γ Γ'
  s : Sorts
  H2 : Γ ⊢ y : !s
  ============================
   exists s0 : Sorts, Γ' ⊢ A : !s0

(dependent evars:)


apply IHitem; trivial.
1 subgoals, subgoal 1 (ID 4680)
  
  A : Term
  Γ : list Term
  n : nat
  y : Term
  H : A ↓ n ∈ Γ
  IHitem : forall Γ' : list Term,
           Γ ⊣ -> trunc (S n) Γ Γ' -> exists s : Sorts, Γ' ⊢ A : !s
  Γ' : list Term
  H0 : y :: Γ ⊣
  H6 : trunc (S n) Γ Γ'
  s : Sorts
  H2 : Γ ⊢ y : !s
  ============================
   Γ ⊣

(dependent evars:)

eauto.
No more subgoals.
(dependent evars: ?4682 using , ?4683 using ,)


Qed.
wf_item is defined



Lemma wf_item_lift : forall Γ A n ,Γ -> A n Γ ->
  exists s, Γ A : !s.
1 subgoals, subgoal 1 (ID 4748)
  
  ============================
   forall (Γ : Env) (A : Term) (n : nat),
   Γ ⊣ -> A ↓ n ⊂ Γ -> exists s : Sorts, Γ ⊢ A : !s

(dependent evars:)


intros.
1 subgoals, subgoal 1 (ID 4753)
  
  Γ : Env
  A : Term
  n : nat
  H : Γ ⊣
  H0 : A ↓ n ⊂ Γ
  ============================
   exists s : Sorts, Γ ⊢ A : !s

(dependent evars:)


destruct H0 as (u & ? & ?).
1 subgoals, subgoal 1 (ID 4761)
  
  Γ : Env
  A : Term
  n : nat
  H : Γ ⊣
  u : Term
  H0 : A = u ↑ (S n)
  H1 : u ↓ n ∈ Γ
  ============================
   exists s : Sorts, Γ ⊢ A : !s

(dependent evars:)


subst.
1 subgoals, subgoal 1 (ID 4764)
  
  Γ : Env
  n : nat
  H : Γ ⊣
  u : Term
  H1 : u ↓ n ∈ Γ
  ============================
   exists s : Sorts, Γ ⊢ u ↑ (S n) : !s

(dependent evars:)


assert (exists Γ' , trunc (S n) Γ Γ') by (apply item_trunc with u; trivial).
1 subgoals, subgoal 1 (ID 4768)
  
  Γ : Env
  n : nat
  H : Γ ⊣
  u : Term
  H1 : u ↓ n ∈ Γ
  H0 : exists Γ' : list Term, trunc (S n) Γ Γ'
  ============================
   exists s : Sorts, Γ ⊢ u ↑ (S n) : !s

(dependent evars:)


destruct H0 as (Γ' & ?).
1 subgoals, subgoal 1 (ID 4773)
  
  Γ : Env
  n : nat
  H : Γ ⊣
  u : Term
  H1 : u ↓ n ∈ Γ
  Γ' : list Term
  H0 : trunc (S n) Γ Γ'
  ============================
   exists s : Sorts, Γ ⊢ u ↑ (S n) : !s

(dependent evars:)


destruct (wf_item Γ u n H1 Γ' H H0) as (t & ?).
1 subgoals, subgoal 1 (ID 4780)
  
  Γ : Env
  n : nat
  H : Γ ⊣
  u : Term
  H1 : u ↓ n ∈ Γ
  Γ' : list Term
  H0 : trunc (S n) Γ Γ'
  t : Sorts
  H2 : Γ' ⊢ u : !t
  ============================
   exists s : Sorts, Γ ⊢ u ↑ (S n) : !s

(dependent evars:)


exists t.
1 subgoals, subgoal 1 (ID 4782)
  
  Γ : Env
  n : nat
  H : Γ ⊣
  u : Term
  H1 : u ↓ n ∈ Γ
  Γ' : list Term
  H0 : trunc (S n) Γ Γ'
  t : Sorts
  H2 : Γ' ⊢ u : !t
  ============================
   Γ ⊢ u ↑ (S n) : !t

(dependent evars:)

change !t with (!t ↑(S n)).
1 subgoals, subgoal 1 (ID 4784)
  
  Γ : Env
  n : nat
  H : Γ ⊣
  u : Term
  H1 : u ↓ n ∈ Γ
  Γ' : list Term
  H0 : trunc (S n) Γ Γ'
  t : Sorts
  H2 : Γ' ⊢ u : !t
  ============================
   Γ ⊢ u ↑ (S n) : !t ↑ (S n)

(dependent evars:)


eapply thinning_n.
3 subgoals, subgoal 1 (ID 4786)
  
  Γ : Env
  n : nat
  H : Γ ⊣
  u : Term
  H1 : u ↓ n ∈ Γ
  Γ' : list Term
  H0 : trunc (S n) Γ Γ'
  t : Sorts
  H2 : Γ' ⊢ u : !t
  ============================
   trunc (S n) Γ ?4785

subgoal 2 (ID 4787) is:
 ?4785 ⊢ u : !t
subgoal 3 (ID 4788) is:
 Γ ⊣
(dependent evars: ?4785 open,)

apply H0.
2 subgoals, subgoal 1 (ID 4787)
  
  Γ : Env
  n : nat
  H : Γ ⊣
  u : Term
  H1 : u ↓ n ∈ Γ
  Γ' : list Term
  H0 : trunc (S n) Γ Γ'
  t : Sorts
  H2 : Γ' ⊢ u : !t
  ============================
   Γ' ⊢ u : !t

subgoal 2 (ID 4788) is:
 Γ ⊣
(dependent evars: ?4785 using ,)

trivial.
1 subgoals, subgoal 1 (ID 4788)
  
  Γ : Env
  n : nat
  H : Γ ⊣
  u : Term
  H1 : u ↓ n ∈ Γ
  Γ' : list Term
  H0 : trunc (S n) Γ Γ'
  t : Sorts
  H2 : Γ' ⊢ u : !t
  ============================
   Γ ⊣

(dependent evars: ?4785 using ,)

trivial.
No more subgoals.
(dependent evars: ?4785 using ,)


Qed.
wf_item_lift is defined



Type Correction: if a judgment is valid, the type is either welltyped itself, or syntacticaly a sort. This distinction comes from the fact that we abstracted the typing of sorts with Ax and that they may be some untyped sorts (also called top-sorts).
Theorem TypeCorrect : forall Γ M T, Γ M : T ->
 (exists s, T = !s) \/ (exists s, Γ T : !s).
1 subgoals, subgoal 1 (ID 4801)
  
  ============================
   forall (Γ : Env) (M T : Term),
   Γ ⊢ M : T -> (exists s : Sorts, T = !s) \/ (exists s : Sorts, Γ ⊢ T : !s)

(dependent evars:)


intros; induction H.
6 subgoals, subgoal 1 (ID 4840)
  
  Γ : Env
  s : Sorts
  t : Sorts
  H : Ax s t
  H0 : Γ ⊣
  ============================
   (exists s0 : Sorts, !t = !s0) \/ (exists s0 : Sorts, Γ ⊢ !t : !s0)

subgoal 2 (ID 4845) is:
 (exists s : Sorts, A = !s) \/ (exists s : Sorts, Γ ⊢ A : !s)
subgoal 3 (ID 4857) is:
 (exists s0 : Sorts, !u = !s0) \/ (exists s0 : Sorts, Γ ⊢ !u : !s0)
subgoal 4 (ID 4873) is:
 (exists s : Sorts, Π (A), B = !s) \/ (exists s : Sorts, Γ ⊢ Π (A), B : !s)
subgoal 5 (ID 4883) is:
 (exists s : Sorts, B [ ← N] = !s) \/ (exists s : Sorts, Γ ⊢ B [ ← N] : !s)
subgoal 6 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars:)


left; exists t; reflexivity.
5 subgoals, subgoal 1 (ID 4845)
  
  Γ : Env
  A : Term
  v : nat
  H : Γ ⊣
  H0 : A ↓ v ⊂ Γ
  ============================
   (exists s : Sorts, A = !s) \/ (exists s : Sorts, Γ ⊢ A : !s)

subgoal 2 (ID 4857) is:
 (exists s0 : Sorts, !u = !s0) \/ (exists s0 : Sorts, Γ ⊢ !u : !s0)
subgoal 3 (ID 4873) is:
 (exists s : Sorts, Π (A), B = !s) \/ (exists s : Sorts, Γ ⊢ Π (A), B : !s)
subgoal 4 (ID 4883) is:
 (exists s : Sorts, B [ ← N] = !s) \/ (exists s : Sorts, Γ ⊢ B [ ← N] : !s)
subgoal 5 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars:)


apply wf_item_lift in H0.
6 subgoals, subgoal 1 (ID 4901)
  
  Γ : Env
  A : Term
  v : nat
  H : Γ ⊣
  H0 : exists s : Sorts, Γ ⊢ A : !s
  ============================
   (exists s : Sorts, A = !s) \/ (exists s : Sorts, Γ ⊢ A : !s)

subgoal 2 (ID 4902) is:
 Γ ⊣
subgoal 3 (ID 4857) is:
 (exists s0 : Sorts, !u = !s0) \/ (exists s0 : Sorts, Γ ⊢ !u : !s0)
subgoal 4 (ID 4873) is:
 (exists s : Sorts, Π (A), B = !s) \/ (exists s : Sorts, Γ ⊢ Π (A), B : !s)
subgoal 5 (ID 4883) is:
 (exists s : Sorts, B [ ← N] = !s) \/ (exists s : Sorts, Γ ⊢ B [ ← N] : !s)
subgoal 6 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars:)

right; trivial.
5 subgoals, subgoal 1 (ID 4902)
  
  Γ : Env
  A : Term
  v : nat
  H : Γ ⊣
  H0 : A ↓ v ⊂ Γ
  ============================
   Γ ⊣

subgoal 2 (ID 4857) is:
 (exists s0 : Sorts, !u = !s0) \/ (exists s0 : Sorts, Γ ⊢ !u : !s0)
subgoal 3 (ID 4873) is:
 (exists s : Sorts, Π (A), B = !s) \/ (exists s : Sorts, Γ ⊢ Π (A), B : !s)
subgoal 4 (ID 4883) is:
 (exists s : Sorts, B [ ← N] = !s) \/ (exists s : Sorts, Γ ⊢ B [ ← N] : !s)
subgoal 5 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars:)

trivial.
4 subgoals, subgoal 1 (ID 4857)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  H : Rel s t u
  H0 : Γ ⊢ A : !s
  H1 : A :: Γ ⊢ B : !t
  IHtyp1 : (exists s0 : Sorts, !s = !s0) \/ (exists s0 : Sorts, Γ ⊢ !s : !s0)
  IHtyp2 : (exists s : Sorts, !t = !s) \/
           (exists s : Sorts, A :: Γ ⊢ !t : !s)
  ============================
   (exists s0 : Sorts, !u = !s0) \/ (exists s0 : Sorts, Γ ⊢ !u : !s0)

subgoal 2 (ID 4873) is:
 (exists s : Sorts, Π (A), B = !s) \/ (exists s : Sorts, Γ ⊢ Π (A), B : !s)
subgoal 3 (ID 4883) is:
 (exists s : Sorts, B [ ← N] = !s) \/ (exists s : Sorts, Γ ⊢ B [ ← N] : !s)
subgoal 4 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars:)


left; exists u; trivial.
3 subgoals, subgoal 1 (ID 4873)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  H : Rel s1 s2 s3
  H0 : Γ ⊢ A : !s1
  H1 : A :: Γ ⊢ B : !s2
  H2 : A :: Γ ⊢ M : B
  IHtyp1 : (exists s : Sorts, !s1 = !s) \/ (exists s : Sorts, Γ ⊢ !s1 : !s)
  IHtyp2 : (exists s : Sorts, !s2 = !s) \/
           (exists s : Sorts, A :: Γ ⊢ !s2 : !s)
  IHtyp3 : (exists s : Sorts, B = !s) \/ (exists s : Sorts, A :: Γ ⊢ B : !s)
  ============================
   (exists s : Sorts, Π (A), B = !s) \/ (exists s : Sorts, Γ ⊢ Π (A), B : !s)

subgoal 2 (ID 4883) is:
 (exists s : Sorts, B [ ← N] = !s) \/ (exists s : Sorts, Γ ⊢ B [ ← N] : !s)
subgoal 3 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars:)


right; exists s3; apply cPi with s1 s2; trivial.
2 subgoals, subgoal 1 (ID 4883)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  H : Γ ⊢ M : Π (A), B
  H0 : Γ ⊢ N : A
  IHtyp1 : (exists s : Sorts, Π (A), B = !s) \/
           (exists s : Sorts, Γ ⊢ Π (A), B : !s)
  IHtyp2 : (exists s : Sorts, A = !s) \/ (exists s : Sorts, Γ ⊢ A : !s)
  ============================
   (exists s : Sorts, B [ ← N] = !s) \/ (exists s : Sorts, Γ ⊢ B [ ← N] : !s)

subgoal 2 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars:)


destruct IHtyp1.
3 subgoals, subgoal 1 (ID 4921)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  H : Γ ⊢ M : Π (A), B
  H0 : Γ ⊢ N : A
  H1 : exists s : Sorts, Π (A), B = !s
  IHtyp2 : (exists s : Sorts, A = !s) \/ (exists s : Sorts, Γ ⊢ A : !s)
  ============================
   (exists s : Sorts, B [ ← N] = !s) \/ (exists s : Sorts, Γ ⊢ B [ ← N] : !s)

subgoal 2 (ID 4923) is:
 (exists s : Sorts, B [ ← N] = !s) \/ (exists s : Sorts, Γ ⊢ B [ ← N] : !s)
subgoal 3 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars:)

destruct H1; discriminate.
2 subgoals, subgoal 1 (ID 4923)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  H : Γ ⊢ M : Π (A), B
  H0 : Γ ⊢ N : A
  H1 : exists s : Sorts, Γ ⊢ Π (A), B : !s
  IHtyp2 : (exists s : Sorts, A = !s) \/ (exists s : Sorts, Γ ⊢ A : !s)
  ============================
   (exists s : Sorts, B [ ← N] = !s) \/ (exists s : Sorts, Γ ⊢ B [ ← N] : !s)

subgoal 2 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars:)

destruct H1 as (u & ?).
2 subgoals, subgoal 1 (ID 4940)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  H : Γ ⊢ M : Π (A), B
  H0 : Γ ⊢ N : A
  u : Sorts
  H1 : Γ ⊢ Π (A), B : !u
  IHtyp2 : (exists s : Sorts, A = !s) \/ (exists s : Sorts, Γ ⊢ A : !s)
  ============================
   (exists s : Sorts, B [ ← N] = !s) \/ (exists s : Sorts, Γ ⊢ B [ ← N] : !s)

subgoal 2 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars:)


apply gen_pi in H1 as (s1 & s2 & s3 & h); decompose [and] h; clear h.
2 subgoals, subgoal 1 (ID 4972)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  H : Γ ⊢ M : Π (A), B
  H0 : Γ ⊢ N : A
  u : Sorts
  IHtyp2 : (exists s : Sorts, A = !s) \/ (exists s : Sorts, Γ ⊢ A : !s)
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  H1 : !u ≡ !s3
  H3 : Rel s1 s2 s3
  H2 : Γ ⊢ A : !s1
  H5 : A :: Γ ⊢ B : !s2
  ============================
   (exists s : Sorts, B [ ← N] = !s) \/ (exists s : Sorts, Γ ⊢ B [ ← N] : !s)

subgoal 2 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars:)


right; exists s2.
2 subgoals, subgoal 1 (ID 4976)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  H : Γ ⊢ M : Π (A), B
  H0 : Γ ⊢ N : A
  u : Sorts
  IHtyp2 : (exists s : Sorts, A = !s) \/ (exists s : Sorts, Γ ⊢ A : !s)
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  H1 : !u ≡ !s3
  H3 : Rel s1 s2 s3
  H2 : Γ ⊢ A : !s1
  H5 : A :: Γ ⊢ B : !s2
  ============================
   Γ ⊢ B [ ← N] : !s2

subgoal 2 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars:)


change (!s2) with (!s2 [← N]).
2 subgoals, subgoal 1 (ID 4978)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  H : Γ ⊢ M : Π (A), B
  H0 : Γ ⊢ N : A
  u : Sorts
  IHtyp2 : (exists s : Sorts, A = !s) \/ (exists s : Sorts, Γ ⊢ A : !s)
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  H1 : !u ≡ !s3
  H3 : Rel s1 s2 s3
  H2 : Γ ⊢ A : !s1
  H5 : A :: Γ ⊢ B : !s2
  ============================
   Γ ⊢ B [ ← N] : !s2 [ ← N]

subgoal 2 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars:)

eapply substitution.
5 subgoals, subgoal 1 (ID 4991)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  H : Γ ⊢ M : Π (A), B
  H0 : Γ ⊢ N : A
  u : Sorts
  IHtyp2 : (exists s : Sorts, A = !s) \/ (exists s : Sorts, Γ ⊢ A : !s)
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  H1 : !u ≡ !s3
  H3 : Rel s1 s2 s3
  H2 : Γ ⊢ A : !s1
  H5 : A :: Γ ⊢ B : !s2
  ============================
   ?4990 ⊢ B : !s2

subgoal 2 (ID 4994) is:
 ?4992 ⊢ N : ?4993
subgoal 3 (ID 4995) is:
 sub_in_env ?4992 N ?4993 0 ?4990 Γ
subgoal 4 (ID 4996) is:
 ?4990 ⊣
subgoal 5 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars: ?4983 using ?4990 , ?4984 using ?4992 , ?4985 using ?4993 , ?4990 open, ?4992 open, ?4993 open,)

apply H5.
4 subgoals, subgoal 1 (ID 4994)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  H : Γ ⊢ M : Π (A), B
  H0 : Γ ⊢ N : A
  u : Sorts
  IHtyp2 : (exists s : Sorts, A = !s) \/ (exists s : Sorts, Γ ⊢ A : !s)
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  H1 : !u ≡ !s3
  H3 : Rel s1 s2 s3
  H2 : Γ ⊢ A : !s1
  H5 : A :: Γ ⊢ B : !s2
  ============================
   ?4992 ⊢ N : ?4993

subgoal 2 (ID 4995) is:
 sub_in_env ?4992 N ?4993 0 (A :: Γ) Γ
subgoal 3 (ID 4996) is:
 A :: Γ ⊣
subgoal 4 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars: ?4983 using ?4990 , ?4984 using ?4992 , ?4985 using ?4993 , ?4990 using , ?4992 open, ?4993 open,)

apply H0.
3 subgoals, subgoal 1 (ID 4995)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  H : Γ ⊢ M : Π (A), B
  H0 : Γ ⊢ N : A
  u : Sorts
  IHtyp2 : (exists s : Sorts, A = !s) \/ (exists s : Sorts, Γ ⊢ A : !s)
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  H1 : !u ≡ !s3
  H3 : Rel s1 s2 s3
  H2 : Γ ⊢ A : !s1
  H5 : A :: Γ ⊢ B : !s2
  ============================
   sub_in_env Γ N A 0 (A :: Γ) Γ

subgoal 2 (ID 4996) is:
 A :: Γ ⊣
subgoal 3 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars: ?4983 using ?4990 , ?4984 using ?4992 , ?4985 using ?4993 , ?4990 using , ?4992 using , ?4993 using ,)

constructor.
2 subgoals, subgoal 1 (ID 4996)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  H : Γ ⊢ M : Π (A), B
  H0 : Γ ⊢ N : A
  u : Sorts
  IHtyp2 : (exists s : Sorts, A = !s) \/ (exists s : Sorts, Γ ⊢ A : !s)
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  H1 : !u ≡ !s3
  H3 : Rel s1 s2 s3
  H2 : Γ ⊢ A : !s1
  H5 : A :: Γ ⊢ B : !s2
  ============================
   A :: Γ ⊣

subgoal 2 (ID 4894) is:
 (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)
(dependent evars: ?4983 using ?4990 , ?4984 using ?4992 , ?4985 using ?4993 , ?4990 using , ?4992 using , ?4993 using ,)


eauto.
1 subgoals, subgoal 1 (ID 4894)
  
  Γ : Env
  M : Term
  A : Term
  B : Term
  s : Sorts
  H : A ≡ B
  H0 : Γ ⊢ M : A
  H1 : Γ ⊢ B : !s
  IHtyp1 : (exists s : Sorts, A = !s) \/ (exists s : Sorts, Γ ⊢ A : !s)
  IHtyp2 : (exists s0 : Sorts, !s = !s0) \/ (exists s0 : Sorts, Γ ⊢ !s : !s0)
  ============================
   (exists s0 : Sorts, B = !s0) \/ (exists s0 : Sorts, Γ ⊢ B : !s0)

(dependent evars: ?4983 using ?4990 , ?4984 using ?4992 , ?4985 using ?4993 , ?4990 using , ?4992 using , ?4993 using , ?4998 using ,)


right; exists s; trivial.
No more subgoals.
(dependent evars: ?4983 using ?4990 , ?4984 using ?4992 , ?4985 using ?4993 , ?4990 using , ?4992 using , ?4993 using , ?4998 using ,)


Qed.
TypeCorrect is defined



Equivalence with traditional presentation of PTS
Reserved Notation "Γ ⊢' t : T"
  (at level 80, t, T at level 30, no associativity) .


Inductive legacy_typ : Env -> Term -> Term -> Prop :=
 | lcSort : forall s t, Ax s t -> nil ⊢' !s : !t
 | lcVar : forall Γ A s, Γ ⊢' A : !s -> A :: Γ ⊢' #0 : A 1
 | lcWeak : forall Γ M T A s, Γ ⊢' M : T -> Γ ⊢' A : !s ->
                              A :: Γ ⊢' M 1 : T 1
 | lcPi : forall Γ A B s t u, Rel s t u -> Γ ⊢' A : !s ->
   A :: Γ ⊢' B : !t -> Γ ⊢' Π(A), B : !u
 | lcLa : forall Γ A B M s t u, Rel s t u -> Γ ⊢' A : !s ->
   A :: Γ ⊢' B : !t -> A :: Γ ⊢' M : B -> Γ ⊢' λ[A],M : Π(A),B
 | lcApp : forall Γ A B M N, Γ ⊢' M : Π(A),B -> Γ ⊢' N : A ->
   Γ ⊢' M · N : B [ N]
 | lCnv : forall Γ M A B s, Γ ⊢' M : A -> Γ ⊢' B : !s ->
   A B -> Γ ⊢' M : B
where "Γ ⊢' M : T" := (legacy_typ Γ M T) : UT_scope.
legacy_typ is defined
legacy_typ_ind is defined



Lemma legacy2typ : forall Γ M T, Γ ⊢' M : T -> (Γ M : T /\ Γ ).
1 subgoals, subgoal 1 (ID 5063)
  
  ============================
   forall (Γ : Env) (M T : Term), Γ ⊢' M : T -> (Γ ⊢ M : T) /\ Γ ⊣

(dependent evars:)


Proof.
1 subgoals, subgoal 1 (ID 5063)
  
  ============================
   forall (Γ : Env) (M T : Term), Γ ⊢' M : T -> (Γ ⊢ M : T) /\ Γ ⊣

(dependent evars:)


induction 1; intros.
7 subgoals, subgoal 1 (ID 5105)
  
  s : Sorts
  t : Sorts
  H : Ax s t
  ============================
   (nil ⊢ !s : !t) /\ nil ⊣

subgoal 2 (ID 5110) is:
 (A :: Γ ⊢ #0 : A ↑ 1) /\ A :: Γ ⊣
subgoal 3 (ID 5120) is:
 (A :: Γ ⊢ M ↑ 1 : T ↑ 1) /\ A :: Γ ⊣
subgoal 4 (ID 5132) is:
 (Γ ⊢ Π (A), B : !u) /\ Γ ⊣
subgoal 5 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 6 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 7 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars:)


split; now constructor.
6 subgoals, subgoal 1 (ID 5110)
  
  Γ : Env
  A : Term
  s : Sorts
  H : Γ ⊢' A : !s
  IHlegacy_typ : (Γ ⊢ A : !s) /\ Γ ⊣
  ============================
   (A :: Γ ⊢ #0 : A ↑ 1) /\ A :: Γ ⊣

subgoal 2 (ID 5120) is:
 (A :: Γ ⊢ M ↑ 1 : T ↑ 1) /\ A :: Γ ⊣
subgoal 3 (ID 5132) is:
 (Γ ⊢ Π (A), B : !u) /\ Γ ⊣
subgoal 4 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 5 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 6 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars:)


destruct IHlegacy_typ.
6 subgoals, subgoal 1 (ID 5181)
  
  Γ : Env
  A : Term
  s : Sorts
  H : Γ ⊢' A : !s
  H0 : Γ ⊢ A : !s
  H1 : Γ ⊣
  ============================
   (A :: Γ ⊢ #0 : A ↑ 1) /\ A :: Γ ⊣

subgoal 2 (ID 5120) is:
 (A :: Γ ⊢ M ↑ 1 : T ↑ 1) /\ A :: Γ ⊣
subgoal 3 (ID 5132) is:
 (Γ ⊢ Π (A), B : !u) /\ Γ ⊣
subgoal 4 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 5 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 6 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars:)


split.
7 subgoals, subgoal 1 (ID 5183)
  
  Γ : Env
  A : Term
  s : Sorts
  H : Γ ⊢' A : !s
  H0 : Γ ⊢ A : !s
  H1 : Γ ⊣
  ============================
   A :: Γ ⊢ #0 : A ↑ 1

subgoal 2 (ID 5184) is:
 A :: Γ ⊣
subgoal 3 (ID 5120) is:
 (A :: Γ ⊢ M ↑ 1 : T ↑ 1) /\ A :: Γ ⊣
subgoal 4 (ID 5132) is:
 (Γ ⊢ Π (A), B : !u) /\ Γ ⊣
subgoal 5 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 6 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 7 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars:)


  constructor.
8 subgoals, subgoal 1 (ID 5187)
  
  Γ : Env
  A : Term
  s : Sorts
  H : Γ ⊢' A : !s
  H0 : Γ ⊢ A : !s
  H1 : Γ ⊣
  ============================
   A :: Γ ⊣

subgoal 2 (ID 5188) is:
 A ↑ 1 ↓ 0 ⊂ A :: Γ
subgoal 3 (ID 5184) is:
 A :: Γ ⊣
subgoal 4 (ID 5120) is:
 (A :: Γ ⊢ M ↑ 1 : T ↑ 1) /\ A :: Γ ⊣
subgoal 5 (ID 5132) is:
 (Γ ⊢ Π (A), B : !u) /\ Γ ⊣
subgoal 6 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 7 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 8 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars:)


  econstructor; now apply H0.
7 subgoals, subgoal 1 (ID 5188)
  
  Γ : Env
  A : Term
  s : Sorts
  H : Γ ⊢' A : !s
  H0 : Γ ⊢ A : !s
  H1 : Γ ⊣
  ============================
   A ↑ 1 ↓ 0 ⊂ A :: Γ

subgoal 2 (ID 5184) is:
 A :: Γ ⊣
subgoal 3 (ID 5120) is:
 (A :: Γ ⊢ M ↑ 1 : T ↑ 1) /\ A :: Γ ⊣
subgoal 4 (ID 5132) is:
 (Γ ⊢ Π (A), B : !u) /\ Γ ⊣
subgoal 5 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 6 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 7 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using ,)


  now exists A; split.
6 subgoals, subgoal 1 (ID 5184)
  
  Γ : Env
  A : Term
  s : Sorts
  H : Γ ⊢' A : !s
  H0 : Γ ⊢ A : !s
  H1 : Γ ⊣
  ============================
   A :: Γ ⊣

subgoal 2 (ID 5120) is:
 (A :: Γ ⊢ M ↑ 1 : T ↑ 1) /\ A :: Γ ⊣
subgoal 3 (ID 5132) is:
 (Γ ⊢ Π (A), B : !u) /\ Γ ⊣
subgoal 4 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 5 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 6 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using ,)


econstructor; now apply H0.
5 subgoals, subgoal 1 (ID 5120)
  
  Γ : Env
  M : Term
  T : Term
  A : Term
  s : Sorts
  H : Γ ⊢' M : T
  H0 : Γ ⊢' A : !s
  IHlegacy_typ1 : (Γ ⊢ M : T) /\ Γ ⊣
  IHlegacy_typ2 : (Γ ⊢ A : !s) /\ Γ ⊣
  ============================
   (A :: Γ ⊢ M ↑ 1 : T ↑ 1) /\ A :: Γ ⊣

subgoal 2 (ID 5132) is:
 (Γ ⊢ Π (A), B : !u) /\ Γ ⊣
subgoal 3 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 4 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 5 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using , ?6281 using ,)


destruct IHlegacy_typ1, IHlegacy_typ2.
5 subgoals, subgoal 1 (ID 6292)
  
  Γ : Env
  M : Term
  T : Term
  A : Term
  s : Sorts
  H : Γ ⊢' M : T
  H0 : Γ ⊢' A : !s
  H1 : Γ ⊢ M : T
  H2 : Γ ⊣
  H3 : Γ ⊢ A : !s
  H4 : Γ ⊣
  ============================
   (A :: Γ ⊢ M ↑ 1 : T ↑ 1) /\ A :: Γ ⊣

subgoal 2 (ID 5132) is:
 (Γ ⊢ Π (A), B : !u) /\ Γ ⊣
subgoal 3 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 4 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 5 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using , ?6281 using ,)


split.
6 subgoals, subgoal 1 (ID 6294)
  
  Γ : Env
  M : Term
  T : Term
  A : Term
  s : Sorts
  H : Γ ⊢' M : T
  H0 : Γ ⊢' A : !s
  H1 : Γ ⊢ M : T
  H2 : Γ ⊣
  H3 : Γ ⊢ A : !s
  H4 : Γ ⊣
  ============================
   A :: Γ ⊢ M ↑ 1 : T ↑ 1

subgoal 2 (ID 6295) is:
 A :: Γ ⊣
subgoal 3 (ID 5132) is:
 (Γ ⊢ Π (A), B : !u) /\ Γ ⊣
subgoal 4 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 5 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 6 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using , ?6281 using ,)


  eapply weakening.
8 subgoals, subgoal 1 (ID 6308)
  
  Γ : Env
  M : Term
  T : Term
  A : Term
  s : Sorts
  H : Γ ⊢' M : T
  H0 : Γ ⊢' A : !s
  H1 : Γ ⊢ M : T
  H2 : Γ ⊣
  H3 : Γ ⊢ A : !s
  H4 : Γ ⊣
  ============================
   ?6307 ⊢ M : T

subgoal 2 (ID 6311) is:
 ins_in_env ?6309 ?6310 0 ?6307 (A :: Γ)
subgoal 3 (ID 6313) is:
 ?6309 ⊢ ?6310 : !?6312
subgoal 4 (ID 6295) is:
 A :: Γ ⊣
subgoal 5 (ID 5132) is:
 (Γ ⊢ Π (A), B : !u) /\ Γ ⊣
subgoal 6 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 7 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 8 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 open, ?6309 open, ?6310 open, ?6312 open,)


  now apply H1.
7 subgoals, subgoal 1 (ID 6311)
  
  Γ : Env
  M : Term
  T : Term
  A : Term
  s : Sorts
  H : Γ ⊢' M : T
  H0 : Γ ⊢' A : !s
  H1 : Γ ⊢ M : T
  H2 : Γ ⊣
  H3 : Γ ⊢ A : !s
  H4 : Γ ⊣
  ============================
   ins_in_env ?6309 ?6310 0 Γ (A :: Γ)

subgoal 2 (ID 6313) is:
 ?6309 ⊢ ?6310 : !?6312
subgoal 3 (ID 6295) is:
 A :: Γ ⊣
subgoal 4 (ID 5132) is:
 (Γ ⊢ Π (A), B : !u) /\ Γ ⊣
subgoal 5 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 6 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 7 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 using , ?6309 open, ?6310 open, ?6312 open,)


  now constructor.
6 subgoals, subgoal 1 (ID 6313)
  
  Γ : Env
  M : Term
  T : Term
  A : Term
  s : Sorts
  H : Γ ⊢' M : T
  H0 : Γ ⊢' A : !s
  H1 : Γ ⊢ M : T
  H2 : Γ ⊣
  H3 : Γ ⊢ A : !s
  H4 : Γ ⊣
  ============================
   Γ ⊢ A : !?6312

subgoal 2 (ID 6295) is:
 A :: Γ ⊣
subgoal 3 (ID 5132) is:
 (Γ ⊢ Π (A), B : !u) /\ Γ ⊣
subgoal 4 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 5 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 6 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 using , ?6309 using , ?6310 using , ?6312 open,)


  now apply H3.
5 subgoals, subgoal 1 (ID 6295)
  
  Γ : Env
  M : Term
  T : Term
  A : Term
  s : Sorts
  H : Γ ⊢' M : T
  H0 : Γ ⊢' A : !s
  H1 : Γ ⊢ M : T
  H2 : Γ ⊣
  H3 : Γ ⊢ A : !s
  H4 : Γ ⊣
  ============================
   A :: Γ ⊣

subgoal 2 (ID 5132) is:
 (Γ ⊢ Π (A), B : !u) /\ Γ ⊣
subgoal 3 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 4 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 5 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 using , ?6309 using , ?6310 using , ?6312 using ,)


econstructor; now apply H3.
4 subgoals, subgoal 1 (ID 5132)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  H : Rel s t u
  H0 : Γ ⊢' A : !s
  H1 : A :: Γ ⊢' B : !t
  IHlegacy_typ1 : (Γ ⊢ A : !s) /\ Γ ⊣
  IHlegacy_typ2 : (A :: Γ ⊢ B : !t) /\ A :: Γ ⊣
  ============================
   (Γ ⊢ Π (A), B : !u) /\ Γ ⊣

subgoal 2 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 3 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 4 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 using , ?6309 using , ?6310 using , ?6312 using , ?6317 using ,)


destruct IHlegacy_typ1, IHlegacy_typ2.
4 subgoals, subgoal 1 (ID 6328)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  H : Rel s t u
  H0 : Γ ⊢' A : !s
  H1 : A :: Γ ⊢' B : !t
  H2 : Γ ⊢ A : !s
  H3 : Γ ⊣
  H4 : A :: Γ ⊢ B : !t
  H5 : A :: Γ ⊣
  ============================
   (Γ ⊢ Π (A), B : !u) /\ Γ ⊣

subgoal 2 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 3 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 4 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 using , ?6309 using , ?6310 using , ?6312 using , ?6317 using ,)


split; trivial.
4 subgoals, subgoal 1 (ID 6330)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  H : Rel s t u
  H0 : Γ ⊢' A : !s
  H1 : A :: Γ ⊢' B : !t
  H2 : Γ ⊢ A : !s
  H3 : Γ ⊣
  H4 : A :: Γ ⊢ B : !t
  H5 : A :: Γ ⊣
  ============================
   Γ ⊢ Π (A), B : !u

subgoal 2 (ID 5148) is:
 (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣
subgoal 3 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 4 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 using , ?6309 using , ?6310 using , ?6312 using , ?6317 using ,)


now apply cPi with (s:=s) (t:=t).
3 subgoals, subgoal 1 (ID 5148)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s : Sorts
  t : Sorts
  u : Sorts
  H : Rel s t u
  H0 : Γ ⊢' A : !s
  H1 : A :: Γ ⊢' B : !t
  H2 : A :: Γ ⊢' M : B
  IHlegacy_typ1 : (Γ ⊢ A : !s) /\ Γ ⊣
  IHlegacy_typ2 : (A :: Γ ⊢ B : !t) /\ A :: Γ ⊣
  IHlegacy_typ3 : (A :: Γ ⊢ M : B) /\ A :: Γ ⊣
  ============================
   (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣

subgoal 2 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 3 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 using , ?6309 using , ?6310 using , ?6312 using , ?6317 using ,)


destruct IHlegacy_typ1, IHlegacy_typ2, IHlegacy_typ3.
3 subgoals, subgoal 1 (ID 9629)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s : Sorts
  t : Sorts
  u : Sorts
  H : Rel s t u
  H0 : Γ ⊢' A : !s
  H1 : A :: Γ ⊢' B : !t
  H2 : A :: Γ ⊢' M : B
  H3 : Γ ⊢ A : !s
  H4 : Γ ⊣
  H5 : A :: Γ ⊢ B : !t
  H6 : A :: Γ ⊣
  H7 : A :: Γ ⊢ M : B
  H8 : A :: Γ ⊣
  ============================
   (Γ ⊢ λ [A], M : Π (A), B) /\ Γ ⊣

subgoal 2 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 3 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 using , ?6309 using , ?6310 using , ?6312 using , ?6317 using ,)


split; trivial.
3 subgoals, subgoal 1 (ID 9631)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s : Sorts
  t : Sorts
  u : Sorts
  H : Rel s t u
  H0 : Γ ⊢' A : !s
  H1 : A :: Γ ⊢' B : !t
  H2 : A :: Γ ⊢' M : B
  H3 : Γ ⊢ A : !s
  H4 : Γ ⊣
  H5 : A :: Γ ⊢ B : !t
  H6 : A :: Γ ⊣
  H7 : A :: Γ ⊢ M : B
  H8 : A :: Γ ⊣
  ============================
   Γ ⊢ λ [A], M : Π (A), B

subgoal 2 (ID 5158) is:
 (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣
subgoal 3 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 using , ?6309 using , ?6310 using , ?6312 using , ?6317 using ,)


now apply cLa with (s1:=s) (s2:=t) (s3:=u).
2 subgoals, subgoal 1 (ID 5158)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  N : Term
  H : Γ ⊢' M : Π (A), B
  H0 : Γ ⊢' N : A
  IHlegacy_typ1 : (Γ ⊢ M : Π (A), B) /\ Γ ⊣
  IHlegacy_typ2 : (Γ ⊢ N : A) /\ Γ ⊣
  ============================
   (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣

subgoal 2 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 using , ?6309 using , ?6310 using , ?6312 using , ?6317 using ,)


destruct IHlegacy_typ1, IHlegacy_typ2.
2 subgoals, subgoal 1 (ID 16110)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  N : Term
  H : Γ ⊢' M : Π (A), B
  H0 : Γ ⊢' N : A
  H1 : Γ ⊢ M : Π (A), B
  H2 : Γ ⊣
  H3 : Γ ⊢ N : A
  H4 : Γ ⊣
  ============================
   (Γ ⊢ M · N : B [ ← N]) /\ Γ ⊣

subgoal 2 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 using , ?6309 using , ?6310 using , ?6312 using , ?6317 using ,)


split; trivial.
2 subgoals, subgoal 1 (ID 16112)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  N : Term
  H : Γ ⊢' M : Π (A), B
  H0 : Γ ⊢' N : A
  H1 : Γ ⊢ M : Π (A), B
  H2 : Γ ⊣
  H3 : Γ ⊢ N : A
  H4 : Γ ⊣
  ============================
   Γ ⊢ M · N : B [ ← N]

subgoal 2 (ID 5170) is:
 (Γ ⊢ M : B) /\ Γ ⊣
(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 using , ?6309 using , ?6310 using , ?6312 using , ?6317 using ,)


now apply cApp with (A := A).
1 subgoals, subgoal 1 (ID 5170)
  
  Γ : Env
  M : Term
  A : Term
  B : Term
  s : Sorts
  H : Γ ⊢' M : A
  H0 : Γ ⊢' B : !s
  H1 : A ≡ B
  IHlegacy_typ1 : (Γ ⊢ M : A) /\ Γ ⊣
  IHlegacy_typ2 : (Γ ⊢ B : !s) /\ Γ ⊣
  ============================
   (Γ ⊢ M : B) /\ Γ ⊣

(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 using , ?6309 using , ?6310 using , ?6312 using , ?6317 using ,)


destruct IHlegacy_typ1, IHlegacy_typ2.
1 subgoals, subgoal 1 (ID 18331)
  
  Γ : Env
  M : Term
  A : Term
  B : Term
  s : Sorts
  H : Γ ⊢' M : A
  H0 : Γ ⊢' B : !s
  H1 : A ≡ B
  H2 : Γ ⊢ M : A
  H3 : Γ ⊣
  H4 : Γ ⊢ B : !s
  H5 : Γ ⊣
  ============================
   (Γ ⊢ M : B) /\ Γ ⊣

(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 using , ?6309 using , ?6310 using , ?6312 using , ?6317 using ,)


split; trivial.
1 subgoals, subgoal 1 (ID 18333)
  
  Γ : Env
  M : Term
  A : Term
  B : Term
  s : Sorts
  H : Γ ⊢' M : A
  H0 : Γ ⊢' B : !s
  H1 : A ≡ B
  H2 : Γ ⊢ M : A
  H3 : Γ ⊣
  H4 : Γ ⊢ B : !s
  H5 : Γ ⊣
  ============================
   Γ ⊢ M : B

(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 using , ?6309 using , ?6310 using , ?6312 using , ?6317 using ,)


now apply Cnv with (A := A) (s:= s).
No more subgoals.
(dependent evars: ?5191 using , ?6281 using , ?6300 using ?6307 , ?6301 using ?6309 , ?6302 using ?6310 , ?6303 using ?6312 , ?6307 using , ?6309 using , ?6310 using , ?6312 using , ?6317 using ,)


Qed.
legacy2typ is defined



Reserved Notation "Γ ⊣' " (at level 80, no associativity).


Inductive legacy_wf : Env -> Prop :=
 | lwf_nil : nil ⊣'
 | lwf_cons : forall Γ A s, Γ ⊢' A : !s -> A::Γ ⊣'
where "Γ ⊣'" := (legacy_wf Γ) : UT_scope.
legacy_wf is defined
legacy_wf_ind is defined



Lemma wf_ltyp : forall Γ M T, Γ ⊢' M : T -> Γ ⊣'.
1 subgoals, subgoal 1 (ID 21707)
  
  ============================
   forall (Γ : Env) (M T : Term), Γ ⊢' M : T -> Γ ⊣'

(dependent evars:)


Proof.
1 subgoals, subgoal 1 (ID 21707)
  
  ============================
   forall (Γ : Env) (M T : Term), Γ ⊢' M : T -> Γ ⊣'

(dependent evars:)


induction 1; intros; trivial.
3 subgoals, subgoal 1 (ID 21749)
  
  s : Sorts
  t : Sorts
  H : Ax s t
  ============================
   nil ⊣'

subgoal 2 (ID 21754) is:
 A :: Γ ⊣'
subgoal 3 (ID 21764) is:
 A :: Γ ⊣'
(dependent evars:)


now constructor.
2 subgoals, subgoal 1 (ID 21754)
  
  Γ : Env
  A : Term
  s : Sorts
  H : Γ ⊢' A : !s
  IHlegacy_typ : Γ ⊣'
  ============================
   A :: Γ ⊣'

subgoal 2 (ID 21764) is:
 A :: Γ ⊣'
(dependent evars:)


now apply lwf_cons with (s:=s).
1 subgoals, subgoal 1 (ID 21764)
  
  Γ : Env
  M : Term
  T : Term
  A : Term
  s : Sorts
  H : Γ ⊢' M : T
  H0 : Γ ⊢' A : !s
  IHlegacy_typ1 : Γ ⊣'
  IHlegacy_typ2 : Γ ⊣'
  ============================
   A :: Γ ⊣'

(dependent evars:)


now apply lwf_cons with (s:=s).
No more subgoals.
(dependent evars:)


Qed.
wf_ltyp is defined



Lemma legacy_extend : forall Γ M T, Γ ⊣' -> nil ⊢' M : T ->
  Γ ⊢' (M (length Γ)) : (T (length Γ)).
1 subgoals, subgoal 1 (ID 22786)
  
  ============================
   forall (Γ : Env) (M T : Term),
   Γ ⊣' -> nil ⊢' M : T -> Γ ⊢' M ↑ (length Γ) : T ↑ (length Γ)

(dependent evars:)


Proof.
1 subgoals, subgoal 1 (ID 22786)
  
  ============================
   forall (Γ : Env) (M T : Term),
   Γ ⊣' -> nil ⊢' M : T -> Γ ⊢' M ↑ (length Γ) : T ↑ (length Γ)

(dependent evars:)


intros Γ; induction Γ; intros; simpl.
2 subgoals, subgoal 1 (ID 22803)
  
  M : Term
  T : Term
  H : nil ⊣'
  H0 : nil ⊢' M : T
  ============================
   nil ⊢' M ↑ 0 : T ↑ 0

subgoal 2 (ID 22804) is:
 a :: Γ ⊢' M ↑ (S (length Γ)) : T ↑ (S (length Γ))
(dependent evars:)


rewrite !lift0.
2 subgoals, subgoal 1 (ID 22806)
  
  M : Term
  T : Term
  H : nil ⊣'
  H0 : nil ⊢' M : T
  ============================
   nil ⊢' M : T

subgoal 2 (ID 22804) is:
 a :: Γ ⊢' M ↑ (S (length Γ)) : T ↑ (S (length Γ))
(dependent evars:)


assumption.
1 subgoals, subgoal 1 (ID 22804)
  
  a : Term
  Γ : list Term
  IHΓ : forall M T : Term,
        Γ ⊣' -> nil ⊢' M : T -> Γ ⊢' M ↑ (length Γ) : T ↑ (length Γ)
  M : Term
  T : Term
  H : a :: Γ ⊣'
  H0 : nil ⊢' M : T
  ============================
   a :: Γ ⊢' M ↑ (S (length Γ)) : T ↑ (S (length Γ))

(dependent evars:)


replace (M (S (length Γ))) with (M (length Γ)) 1 by apply lift_lift.
1 subgoals, subgoal 1 (ID 22812)
  
  a : Term
  Γ : list Term
  IHΓ : forall M T : Term,
        Γ ⊣' -> nil ⊢' M : T -> Γ ⊢' M ↑ (length Γ) : T ↑ (length Γ)
  M : Term
  T : Term
  H : a :: Γ ⊣'
  H0 : nil ⊢' M : T
  ============================
   a :: Γ ⊢' M ↑ (length Γ) ↑ 1 : T ↑ (S (length Γ))

(dependent evars:)


replace (T (S (length Γ))) with (T (length Γ)) 1 by apply lift_lift.
1 subgoals, subgoal 1 (ID 22819)
  
  a : Term
  Γ : list Term
  IHΓ : forall M T : Term,
        Γ ⊣' -> nil ⊢' M : T -> Γ ⊢' M ↑ (length Γ) : T ↑ (length Γ)
  M : Term
  T : Term
  H : a :: Γ ⊣'
  H0 : nil ⊢' M : T
  ============================
   a :: Γ ⊢' M ↑ (length Γ) ↑ 1 : T ↑ (length Γ) ↑ 1

(dependent evars:)


inversion H; subst; clear H.
1 subgoals, subgoal 1 (ID 22869)
  
  a : Term
  Γ : list Term
  IHΓ : forall M T : Term,
        Γ ⊣' -> nil ⊢' M : T -> Γ ⊢' M ↑ (length Γ) : T ↑ (length Γ)
  M : Term
  T : Term
  H0 : nil ⊢' M : T
  s : Sorts
  H2 : Γ ⊢' a : !s
  ============================
   a :: Γ ⊢' M ↑ (length Γ) ↑ 1 : T ↑ (length Γ) ↑ 1

(dependent evars:)


apply lcWeak with (s:=s); trivial.
1 subgoals, subgoal 1 (ID 22870)
  
  a : Term
  Γ : list Term
  IHΓ : forall M T : Term,
        Γ ⊣' -> nil ⊢' M : T -> Γ ⊢' M ↑ (length Γ) : T ↑ (length Γ)
  M : Term
  T : Term
  H0 : nil ⊢' M : T
  s : Sorts
  H2 : Γ ⊢' a : !s
  ============================
   Γ ⊢' M ↑ (length Γ) : T ↑ (length Γ)

(dependent evars:)


apply IHΓ; trivial.
1 subgoals, subgoal 1 (ID 22872)
  
  a : Term
  Γ : list Term
  IHΓ : forall M T : Term,
        Γ ⊣' -> nil ⊢' M : T -> Γ ⊢' M ↑ (length Γ) : T ↑ (length Γ)
  M : Term
  T : Term
  H0 : nil ⊢' M : T
  s : Sorts
  H2 : Γ ⊢' a : !s
  ============================
   Γ ⊣'

(dependent evars:)


now apply wf_ltyp in H2.
No more subgoals.
(dependent evars:)


Qed.
legacy_extend is defined



Lemma legacy_var : forall Γ A v, Γ ⊣' -> A v Γ -> Γ ⊢' #v : A.
1 subgoals, subgoal 1 (ID 23213)
  
  ============================
   forall (Γ : Env) (A : Term) (v : nat), Γ ⊣' -> A ↓ v ⊂ Γ -> Γ ⊢' #v : A

(dependent evars:)


Proof.
1 subgoals, subgoal 1 (ID 23213)
  
  ============================
   forall (Γ : Env) (A : Term) (v : nat), Γ ⊣' -> A ↓ v ⊂ Γ -> Γ ⊢' #v : A

(dependent evars:)


intros Γ; induction Γ; intros; simpl.
2 subgoals, subgoal 1 (ID 23230)
  
  A : Term
  v : nat
  H : nil ⊣'
  H0 : A ↓ v ⊂ nil
  ============================
   nil ⊢' #v : A

subgoal 2 (ID 23231) is:
 a :: Γ ⊢' #v : A
(dependent evars:)


destruct H0 as ( x & ? & ?).
2 subgoals, subgoal 1 (ID 23239)
  
  A : Term
  v : nat
  H : nil ⊣'
  x : Term
  H0 : A = x ↑ (S v)
  H1 : x ↓ v ∈ nil
  ============================
   nil ⊢' #v : A

subgoal 2 (ID 23231) is:
 a :: Γ ⊢' #v : A
(dependent evars:)


now inversion H1.
1 subgoals, subgoal 1 (ID 23231)
  
  a : Term
  Γ : list Term
  IHΓ : forall (A : Term) (v : nat), Γ ⊣' -> A ↓ v ⊂ Γ -> Γ ⊢' #v : A
  A : Term
  v : nat
  H : a :: Γ ⊣'
  H0 : A ↓ v ⊂ a :: Γ
  ============================
   a :: Γ ⊢' #v : A

(dependent evars:)


inversion H; subst; clear H.
1 subgoals, subgoal 1 (ID 23323)
  
  a : Term
  Γ : list Term
  IHΓ : forall (A : Term) (v : nat), Γ ⊣' -> A ↓ v ⊂ Γ -> Γ ⊢' #v : A
  A : Term
  v : nat
  H0 : A ↓ v ⊂ a :: Γ
  s : Sorts
  H2 : Γ ⊢' a : !s
  ============================
   a :: Γ ⊢' #v : A

(dependent evars:)


destruct H0 as (x & ? & ?).
1 subgoals, subgoal 1 (ID 23334)
  
  a : Term
  Γ : list Term
  IHΓ : forall (A : Term) (v : nat), Γ ⊣' -> A ↓ v ⊂ Γ -> Γ ⊢' #v : A
  A : Term
  v : nat
  x : Term
  H : A = x ↑ (S v)
  H0 : x ↓ v ∈ a :: Γ
  s : Sorts
  H2 : Γ ⊢' a : !s
  ============================
   a :: Γ ⊢' #v : A

(dependent evars:)


inversion H0; subst; clear H0.
2 subgoals, subgoal 1 (ID 23423)
  
  a : Term
  Γ : list Term
  IHΓ : forall (A : Term) (v : nat), Γ ⊣' -> A ↓ v ⊂ Γ -> Γ ⊢' #v : A
  s : Sorts
  H2 : Γ ⊢' a : !s
  ============================
   a :: Γ ⊢' #0 : a ↑ 1

subgoal 2 (ID 23424) is:
 a :: Γ ⊢' #(S n) : x ↑ (S (S n))
(dependent evars:)


  subst.
2 subgoals, subgoal 1 (ID 23423)
  
  a : Term
  Γ : list Term
  IHΓ : forall (A : Term) (v : nat), Γ ⊣' -> A ↓ v ⊂ Γ -> Γ ⊢' #v : A
  s : Sorts
  H2 : Γ ⊢' a : !s
  ============================
   a :: Γ ⊢' #0 : a ↑ 1

subgoal 2 (ID 23424) is:
 a :: Γ ⊢' #(S n) : x ↑ (S (S n))
(dependent evars:)


  now apply lcVar with (s:=s).
1 subgoals, subgoal 1 (ID 23424)
  
  a : Term
  Γ : list Term
  IHΓ : forall (A : Term) (v : nat), Γ ⊣' -> A ↓ v ⊂ Γ -> Γ ⊢' #v : A
  x : Term
  s : Sorts
  H2 : Γ ⊢' a : !s
  n : nat
  H5 : x ↓ n ∈ Γ
  ============================
   a :: Γ ⊢' #(S n) : x ↑ (S (S n))

(dependent evars:)


replace (x (S (S n))) with (x (S n)) 1 by apply lift_lift.
1 subgoals, subgoal 1 (ID 23733)
  
  a : Term
  Γ : list Term
  IHΓ : forall (A : Term) (v : nat), Γ ⊣' -> A ↓ v ⊂ Γ -> Γ ⊢' #v : A
  x : Term
  s : Sorts
  H2 : Γ ⊢' a : !s
  n : nat
  H5 : x ↓ n ∈ Γ
  ============================
   a :: Γ ⊢' #(S n) : x ↑ (S n) ↑ 1

(dependent evars:)


change (#(S n)) with (#n)↑1.
1 subgoals, subgoal 1 (ID 23736)
  
  a : Term
  Γ : list Term
  IHΓ : forall (A : Term) (v : nat), Γ ⊣' -> A ↓ v ⊂ Γ -> Γ ⊢' #v : A
  x : Term
  s : Sorts
  H2 : Γ ⊢' a : !s
  n : nat
  H5 : x ↓ n ∈ Γ
  ============================
   a :: Γ ⊢' #n ↑ 1 : x ↑ (S n) ↑ 1

(dependent evars:)


apply lcWeak with (s := s); trivial.
1 subgoals, subgoal 1 (ID 23737)
  
  a : Term
  Γ : list Term
  IHΓ : forall (A : Term) (v : nat), Γ ⊣' -> A ↓ v ⊂ Γ -> Γ ⊢' #v : A
  x : Term
  s : Sorts
  H2 : Γ ⊢' a : !s
  n : nat
  H5 : x ↓ n ∈ Γ
  ============================
   Γ ⊢' #n : x ↑ (S n)

(dependent evars:)


apply IHΓ.
2 subgoals, subgoal 1 (ID 23739)
  
  a : Term
  Γ : list Term
  IHΓ : forall (A : Term) (v : nat), Γ ⊣' -> A ↓ v ⊂ Γ -> Γ ⊢' #v : A
  x : Term
  s : Sorts
  H2 : Γ ⊢' a : !s
  n : nat
  H5 : x ↓ n ∈ Γ
  ============================
   Γ ⊣'

subgoal 2 (ID 23740) is:
 x ↑ (S n) ↓ n ⊂ Γ
(dependent evars:)


  now apply wf_ltyp in H2.
1 subgoals, subgoal 1 (ID 23740)
  
  a : Term
  Γ : list Term
  IHΓ : forall (A : Term) (v : nat), Γ ⊣' -> A ↓ v ⊂ Γ -> Γ ⊢' #v : A
  x : Term
  s : Sorts
  H2 : Γ ⊢' a : !s
  n : nat
  H5 : x ↓ n ∈ Γ
  ============================
   x ↑ (S n) ↓ n ⊂ Γ

(dependent evars:)


now exists x; split.
No more subgoals.
(dependent evars:)


Qed.
legacy_var is defined



Lemma typ2legacy : (forall Γ M T, Γ M : T -> Γ ⊢' M : T ) /\
  (forall Γ, Γ -> Γ ⊣').
1 subgoals, subgoal 1 (ID 24608)
  
  ============================
   (forall (Γ : Env) (M T : Term), Γ ⊢ M : T -> Γ ⊢' M : T) /\
   (forall Γ : Env, Γ ⊣ -> Γ ⊣')

(dependent evars:)


Proof.
1 subgoals, subgoal 1 (ID 24608)
  
  ============================
   (forall (Γ : Env) (M T : Term), Γ ⊢ M : T -> Γ ⊢' M : T) /\
   (forall Γ : Env, Γ ⊣ -> Γ ⊣')

(dependent evars:)


apply typ_induc; intros.
8 subgoals, subgoal 1 (ID 24622)
  
  Γ : Env
  s : Sorts
  t : Sorts
  a : Ax s t
  w : Γ ⊣
  H : Γ ⊣'
  ============================
   Γ ⊢' !s : !t

subgoal 2 (ID 24628) is:
 Γ ⊢' #v : A
subgoal 3 (ID 24639) is:
 Γ ⊢' Π (A), B : !u
subgoal 4 (ID 24653) is:
 Γ ⊢' λ [A], M : Π (A), B
subgoal 5 (ID 24662) is:
 Γ ⊢' M · N : B [ ← N]
subgoal 6 (ID 24672) is:
 Γ ⊢' M : B
subgoal 7 (ID 24615) is:
 nil ⊣'
subgoal 8 (ID 24677) is:
 A :: Γ ⊣'
(dependent evars:)


change !s with (!s (length Γ)); change !t with (!t (length Γ)).
8 subgoals, subgoal 1 (ID 24683)
  
  Γ : Env
  s : Sorts
  t : Sorts
  a : Ax s t
  w : Γ ⊣
  H : Γ ⊣'
  ============================
   Γ ⊢' !s ↑ (length Γ) : !t ↑ (length Γ)

subgoal 2 (ID 24628) is:
 Γ ⊢' #v : A
subgoal 3 (ID 24639) is:
 Γ ⊢' Π (A), B : !u
subgoal 4 (ID 24653) is:
 Γ ⊢' λ [A], M : Π (A), B
subgoal 5 (ID 24662) is:
 Γ ⊢' M · N : B [ ← N]
subgoal 6 (ID 24672) is:
 Γ ⊢' M : B
subgoal 7 (ID 24615) is:
 nil ⊣'
subgoal 8 (ID 24677) is:
 A :: Γ ⊣'
(dependent evars:)


apply legacy_extend; trivial.
8 subgoals, subgoal 1 (ID 24685)
  
  Γ : Env
  s : Sorts
  t : Sorts
  a : Ax s t
  w : Γ ⊣
  H : Γ ⊣'
  ============================
   nil ⊢' !s : !t

subgoal 2 (ID 24628) is:
 Γ ⊢' #v : A
subgoal 3 (ID 24639) is:
 Γ ⊢' Π (A), B : !u
subgoal 4 (ID 24653) is:
 Γ ⊢' λ [A], M : Π (A), B
subgoal 5 (ID 24662) is:
 Γ ⊢' M · N : B [ ← N]
subgoal 6 (ID 24672) is:
 Γ ⊢' M : B
subgoal 7 (ID 24615) is:
 nil ⊣'
subgoal 8 (ID 24677) is:
 A :: Γ ⊣'
(dependent evars:)


now constructor.
7 subgoals, subgoal 1 (ID 24628)
  
  Γ : Env
  A : Term
  v : nat
  w : Γ ⊣
  H : Γ ⊣'
  i : A ↓ v ⊂ Γ
  ============================
   Γ ⊢' #v : A

subgoal 2 (ID 24639) is:
 Γ ⊢' Π (A), B : !u
subgoal 3 (ID 24653) is:
 Γ ⊢' λ [A], M : Π (A), B
subgoal 4 (ID 24662) is:
 Γ ⊢' M · N : B [ ← N]
subgoal 5 (ID 24672) is:
 Γ ⊢' M : B
subgoal 6 (ID 24615) is:
 nil ⊣'
subgoal 7 (ID 24677) is:
 A :: Γ ⊣'
(dependent evars:)


now apply legacy_var.
6 subgoals, subgoal 1 (ID 24639)
  
  Γ : Env
  A : Term
  B : Term
  s : Sorts
  t : Sorts
  u : Sorts
  r : Rel s t u
  t0 : Γ ⊢ A : !s
  H : Γ ⊢' A : !s
  t1 : A :: Γ ⊢ B : !t
  H0 : A :: Γ ⊢' B : !t
  ============================
   Γ ⊢' Π (A), B : !u

subgoal 2 (ID 24653) is:
 Γ ⊢' λ [A], M : Π (A), B
subgoal 3 (ID 24662) is:
 Γ ⊢' M · N : B [ ← N]
subgoal 4 (ID 24672) is:
 Γ ⊢' M : B
subgoal 5 (ID 24615) is:
 nil ⊣'
subgoal 6 (ID 24677) is:
 A :: Γ ⊣'
(dependent evars:)


now apply lcPi with (s:=s) (t:=t) (u:=u).
5 subgoals, subgoal 1 (ID 24653)
  
  Γ : Env
  A : Term
  B : Term
  M : Term
  s1 : Sorts
  s2 : Sorts
  s3 : Sorts
  r : Rel s1 s2 s3
  t : Γ ⊢ A : !s1
  H : Γ ⊢' A : !s1
  t0 : A :: Γ ⊢ B : !s2
  H0 : A :: Γ ⊢' B : !s2
  t1 : A :: Γ ⊢ M : B
  H1 : A :: Γ ⊢' M : B
  ============================
   Γ ⊢' λ [A], M : Π (A), B

subgoal 2 (ID 24662) is:
 Γ ⊢' M · N : B [ ← N]
subgoal 3 (ID 24672) is:
 Γ ⊢' M : B
subgoal 4 (ID 24615) is:
 nil ⊣'
subgoal 5 (ID 24677) is:
 A :: Γ ⊣'
(dependent evars:)


now apply lcLa with (s:=s1) (t:=s2) (u:=s3).
4 subgoals, subgoal 1 (ID 24662)
  
  Γ : Env
  M : Term
  N : Term
  A : Term
  B : Term
  t : Γ ⊢ M : Π (A), B
  H : Γ ⊢' M : Π (A), B
  t0 : Γ ⊢ N : A
  H0 : Γ ⊢' N : A
  ============================
   Γ ⊢' M · N : B [ ← N]

subgoal 2 (ID 24672) is:
 Γ ⊢' M : B
subgoal 3 (ID 24615) is:
 nil ⊣'
subgoal 4 (ID 24677) is:
 A :: Γ ⊣'
(dependent evars:)


now apply lcApp with (A:=A).
3 subgoals, subgoal 1 (ID 24672)
  
  Γ : Env
  M : Term
  A : Term
  B : Term
  s : Sorts
  b : A ≡ B
  t : Γ ⊢ M : A
  H : Γ ⊢' M : A
  t0 : Γ ⊢ B : !s
  H0 : Γ ⊢' B : !s
  ============================
   Γ ⊢' M : B

subgoal 2 (ID 24615) is:
 nil ⊣'
subgoal 3 (ID 24677) is:
 A :: Γ ⊣'
(dependent evars:)


now apply lCnv with (A:=A) (s:=s).
2 subgoals, subgoal 1 (ID 24615)
  
  ============================
   nil ⊣'

subgoal 2 (ID 24677) is:
 A :: Γ ⊣'
(dependent evars:)


now constructor.
1 subgoals, subgoal 1 (ID 24677)
  
  Γ : Env
  A : Term
  s : Sorts
  t : Γ ⊢ A : !s
  H : Γ ⊢' A : !s
  ============================
   A :: Γ ⊣'

(dependent evars:)


now apply lwf_cons with (s:=s).
No more subgoals.
(dependent evars:)


Qed.
typ2legacy is defined



End ut_typ_mod.
Module ut_typ_mod is defined



Index
This page has been generated by coqdoc