diff --git a/ext/prop-eq/Mcltt.Core.Base.html b/ext/prop-eq/Mcltt.Core.Base.html new file mode 100644 index 00000000..4ff34b83 --- /dev/null +++ b/ext/prop-eq/Mcltt.Core.Base.html @@ -0,0 +1,48 @@ + + + + + + + + + + + + + +
+
+

Mcltt.Core.Base

+ +
+#[global] Declare Scope mcltt_scope.
+#[global] Delimit Scope mcltt_scope with mcltt.
+#[global] Bind Scope mcltt_scope with Sortclass.
+ +
+#[global] Declare Custom Entry judg.
+ +
+Notation "{{ x }}" := x (at level 0, x custom judg at level 99, format "'{{' x '}}'").
+
+
+ +
+ + + diff --git a/ext/prop-eq/Mcltt.Core.Syntactic.CoreInversions.html b/ext/prop-eq/Mcltt.Core.Syntactic.CoreInversions.html new file mode 100644 index 00000000..fd1557a2 --- /dev/null +++ b/ext/prop-eq/Mcltt.Core.Syntactic.CoreInversions.html @@ -0,0 +1,228 @@ + + + + + + + + + + + + + +
+
+

Mcltt.Core.Syntactic.CoreInversions

+ +
+From Coq Require Import Setoid.
+From Mcltt Require Import LibTactics.
+From Mcltt.Core Require Import Base.
+From Mcltt.Core.Syntactic Require Export SystemOpt.
+Import Syntax_Notations.
+ +
+Corollary wf_zero_inversion : forall Γ A,
+    {{ Γ zero : A }} ->
+    {{ Γ A }}.
+Proof with mautosolve 4.
+  intros * H.
+  dependent induction H;
+    try specialize (IHwf_exp eq_refl)...
+Qed.
+ +
+#[export]
+Hint Resolve wf_zero_inversion : mcltt.
+ +
+Corollary wf_succ_inversion : forall Γ A M,
+    {{ Γ succ M : A }} ->
+    {{ Γ M : }} /\ {{ Γ A }}.
+Proof with mautosolve.
+  intros * H.
+  dependent induction H;
+    try specialize (IHwf_exp1 _ eq_refl);
+    destruct_conjs...
+Qed.
+ +
+#[export]
+Hint Resolve wf_succ_inversion : mcltt.
+ +
+Lemma wf_natrec_inversion : forall Γ A M A' MZ MS,
+    {{ Γ rec M return A' | zero -> MZ | succ -> MS end : A }} ->
+    {{ Γ MZ : A'[Id,,zero] }} /\ {{ Γ, , A' MS : A'[WkWk,,succ(#1)] }} /\ {{ Γ M : }} /\ {{ Γ A'[Id,,M] A }}.
+Proof with mautosolve.
+  intros * H.
+  pose (A0 := A).
+  dependent induction H;
+    try (specialize (IHwf_exp1 _ _ _ _ eq_refl));
+    destruct_conjs;
+    assert {{ Γ s Id : Γ }} by mauto 3;
+    repeat split...
+Qed.
+ +
+#[export]
+Hint Resolve wf_natrec_inversion : mcltt.
+ +
+Corollary wf_fn_inversion : forall {Γ A M C},
+    {{ Γ λ A M : C }} ->
+    exists B, {{ Γ, A M : B }} /\ {{ Γ Π A B C }}.
+Proof with mautosolve 4.
+  intros * H.
+  dependent induction H;
+    try specialize (IHwf_exp1 _ _ eq_refl);
+    destruct_conjs;
+    gen_presups;
+    eexists; split...
+Qed.
+ +
+#[export]
+Hint Resolve wf_fn_inversion : mcltt.
+ +
+Lemma wf_app_inversion : forall {Γ M N C},
+    {{ Γ M N : C }} ->
+    exists A B, {{ Γ M : Π A B }} /\ {{ Γ N : A }} /\ {{ Γ B[Id,,N] C }}.
+Proof with mautosolve.
+  intros * H.
+  dependent induction H;
+    try specialize (IHwf_exp1 _ _ eq_refl);
+    destruct_conjs;
+    do 2 eexists; repeat split...
+Qed.
+ +
+#[export]
+Hint Resolve wf_app_inversion : mcltt.
+ +
+Lemma wf_vlookup_inversion : forall {Γ x A},
+    {{ Γ #x : A }} ->
+    exists A', {{ #x : A' Γ }} /\ {{ Γ A' A }}.
+Proof with mautosolve 4.
+  intros * H.
+  dependent induction H;
+    [assert (exists i, {{ Γ A : Type@i }}) as [] by mauto 4 |];
+    try (specialize (IHwf_exp1 _ eq_refl));
+    destruct_conjs;
+    eexists; split...
+Qed.
+ +
+#[export]
+Hint Resolve wf_vlookup_inversion : mcltt.
+ +
+Lemma wf_exp_sub_inversion : forall {Γ M σ A},
+    {{ Γ M[σ] : A }} ->
+    exists Δ A', {{ Γ s σ : Δ }} /\ {{ Δ M : A' }} /\ {{ Γ A'[σ] A }}.
+Proof with mautosolve.
+  intros * H.
+  dependent induction H;
+    try (specialize (IHwf_exp1 _ _ eq_refl));
+    destruct_conjs;
+    gen_presups;
+    do 2 eexists; split...
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_sub_inversion : mcltt.
+ +
+
+ +
+We omit wf_conv and wf_cumu as they do not give useful inversions +
+
+ +
+Lemma wf_sub_id_inversion : forall Γ Δ,
+    {{ Γ s Id : Δ }} ->
+    {{ Γ Δ }}.
+Proof.
+  intros * H.
+  dependent induction H; mautosolve.
+Qed.
+ +
+#[export]
+Hint Resolve wf_sub_id_inversion : mcltt.
+ +
+Lemma wf_sub_weaken_inversion : forall {Γ Δ},
+    {{ Γ s Wk : Δ }} ->
+    exists Γ' A, {{ Γ Γ', A }} /\ {{ Γ' Δ }}.
+Proof.
+  intros * H.
+  dependent induction H;
+    firstorder;
+    progressive_inversion;
+    repeat eexists; mauto.
+Qed.
+ +
+#[export]
+Hint Resolve wf_sub_weaken_inversion : mcltt.
+ +
+Lemma wf_sub_compose_inversion : forall {Γ1 σ1 σ2 Γ3},
+    {{ Γ1 s σ1 σ2 : Γ3 }} ->
+    exists Γ2, {{ Γ1 s σ2 : Γ2 }} /\ {{ Γ2 s σ1 : Γ3 }}.
+Proof with mautosolve 4.
+  intros * H.
+  dependent induction H; mauto.
+  specialize (IHwf_sub _ _ eq_refl).
+  destruct_conjs.
+  eexists.
+  repeat split...
+Qed.
+ +
+#[export]
+Hint Resolve wf_sub_compose_inversion : mcltt.
+ +
+Lemma wf_sub_extend_inversion : forall {Γ σ M Δ},
+    {{ Γ s σ,,M : Δ }} ->
+    exists Δ' A', {{ Δ', A' Δ }} /\ {{ Γ s σ : Δ' }} /\ {{ Γ M : A'[σ] }}.
+Proof with mautosolve 4.
+  intros * H.
+  dependent induction H;
+    try specialize (IHwf_sub _ _ eq_refl);
+    destruct_conjs;
+    repeat eexists...
+Qed.
+ +
+#[export]
+Hint Resolve wf_sub_extend_inversion : mcltt.
+
+
+ +
+ + + diff --git a/ext/prop-eq/Mcltt.Core.Syntactic.CoreTypeInversions.html b/ext/prop-eq/Mcltt.Core.Syntactic.CoreTypeInversions.html new file mode 100644 index 00000000..bfb18b8c --- /dev/null +++ b/ext/prop-eq/Mcltt.Core.Syntactic.CoreTypeInversions.html @@ -0,0 +1,105 @@ + + + + + + + + + + + + + +
+
+

Mcltt.Core.Syntactic.CoreTypeInversions

+ +
+From Coq Require Import Setoid.
+From Mcltt Require Import LibTactics.
+From Mcltt.Core Require Import Base.
+From Mcltt.Core.Syntactic Require Export System.
+Import Syntax_Notations.
+ +
+Lemma wf_typ_inversion : forall {Γ i A},
+    {{ Γ Type@i : A }} ->
+    {{ Γ Type@(S i) A }}.
+Proof with mautosolve.
+  intros * H.
+  dependent induction H...
+Qed.
+ +
+#[export]
+Hint Resolve wf_typ_inversion : mcltt.
+ +
+Lemma wf_nat_inversion : forall Γ A,
+    {{ Γ : A }} ->
+    {{ Γ Type@0 A }}.
+Proof with mautosolve 4.
+  intros * H.
+  assert (forall i, 0 <= i) by lia.
+  dependent induction H...
+Qed.
+ +
+#[export]
+Hint Resolve wf_nat_inversion : mcltt.
+ +
+Lemma wf_pi_inversion : forall {Γ A B C},
+    {{ Γ Π A B : C }} ->
+    exists i, {{ Γ A : Type@i }} /\ {{ Γ, A B : Type@i }} /\ {{ Γ Type@i C }}.
+Proof with mautosolve 4.
+  intros * H.
+  dependent induction H;
+    try specialize (IHwf_exp1 _ _ eq_refl);
+    destruct_conjs;
+    assert {{ Γ }} by mauto 3;
+    eexists; split...
+Qed.
+ +
+#[export]
+Hint Resolve wf_pi_inversion : mcltt.
+ +
+Corollary wf_pi_inversion' : forall {Γ A B i},
+    {{ Γ Π A B : Type@i }} ->
+    {{ Γ A : Type@i }} /\ {{ Γ, A B : Type@i }}.
+Proof with mautosolve 4.
+  intros * [j [? []]]%wf_pi_inversion.
+  assert {{ Γ, A s Wk : Γ }} by mauto 4.
+  assert {{ Γ, A Type@j Type@j[Wk] }} by (econstructor; mauto 4).
+  assert {{ Γ, A Type@j[Wk] Type@i[Wk] }} by mauto 4.
+  assert {{ Γ, A Type@i[Wk] Type@i }} by (econstructor; mauto 4).
+  enough {{ Γ, A Type@j Type@i }}...
+Qed.
+ +
+#[export]
+Hint Resolve wf_pi_inversion' : mcltt.
+
+
+ +
+ + + diff --git a/ext/prop-eq/Mcltt.Core.Syntactic.Corollaries.html b/ext/prop-eq/Mcltt.Core.Syntactic.Corollaries.html new file mode 100644 index 00000000..1fbcc851 --- /dev/null +++ b/ext/prop-eq/Mcltt.Core.Syntactic.Corollaries.html @@ -0,0 +1,607 @@ + + + + + + + + + + + + + +
+
+

Mcltt.Core.Syntactic.Corollaries

+ +
+From Coq Require Import Setoid Nat.
+From Mcltt Require Import LibTactics.
+From Mcltt.Core Require Import Base.
+From Mcltt.Core.Syntactic Require Export CoreInversions.
+Import Syntax_Notations.
+ +
+Corollary sub_id_typ : forall Γ M A,
+    {{ Γ M : A }} ->
+    {{ Γ M : A [ Id ] }}.
+Proof.
+  intros.
+  gen_presups.
+  econstructor; mauto 4.
+Qed.
+ +
+#[export]
+Hint Resolve sub_id_typ : mcltt.
+ +
+Corollary invert_sub_id : forall Γ M A,
+    {{ Γ M [ Id ] : A }} ->
+    {{ Γ M : A }}.
+Proof.
+  intros * [? [? [?%wf_sub_id_inversion []]]]%wf_exp_sub_inversion.
+  mauto 4.
+Qed.
+ +
+#[export]
+Hint Resolve invert_sub_id : mcltt.
+ +
+Corollary invert_sub_id_typ : forall Γ M A,
+    {{ Γ M : A[Id] }} ->
+    {{ Γ M : A }}.
+Proof.
+  intros.
+  gen_presups.
+  assert {{ Γ A : Type@i }} by mauto.
+  autorewrite with mcltt in *; eassumption.
+Qed.
+ +
+#[export]
+Hint Resolve invert_sub_id_typ : mcltt.
+ +
+Lemma invert_compose_id : forall {Γ σ Δ},
+    {{ Γ s σ Id : Δ }} ->
+    {{ Γ s σ : Δ }}.
+Proof.
+  intros * [? []]%wf_sub_compose_inversion.
+  mauto 4.
+Qed.
+ +
+#[export]
+Hint Resolve invert_compose_id : mcltt.
+ +
+Add Parametric Morphism i Γ Δ : a_sub
+    with signature wf_exp_eq Δ {{{ Type@i }}} ==> wf_sub_eq Γ Δ ==> wf_exp_eq Γ {{{ Type@i }}} as sub_typ_cong.
+Proof.
+  intros.
+  gen_presups.
+  mauto 4.
+Qed.
+ +
+Add Parametric Morphism Γ1 Γ2 Γ3 : a_compose
+    with signature wf_sub_eq Γ2 Γ3 ==> wf_sub_eq Γ1 Γ2 ==> wf_sub_eq Γ1 Γ3 as sub_compose_cong.
+Proof. mauto. Qed.
+ +
+Lemma wf_ctx_sub_length : forall Γ Δ,
+    {{ Γ Δ }} ->
+    length Γ = length Δ.
+Proof. induction 1; simpl; auto. Qed.
+ +
+Open Scope list_scope.
+ +
+Lemma app_ctx_lookup : forall Δ T Γ n,
+    length Δ = n ->
+    {{ #n : ~(iter (S n) (fun T => {{{T [ Wk ]}}}) T) ~(Δ ++ T :: Γ) }}.
+Proof.
+  induction Δ; intros; simpl in *; subst; mauto.
+Qed.
+ +
+Lemma ctx_lookup_functional : forall n T Γ,
+    {{ #n : T Γ }} ->
+    forall T',
+      {{ #n : T' Γ }} ->
+      T = T'.
+Proof.
+  induction 1; intros; progressive_inversion; eauto.
+  erewrite IHctx_lookup; eauto.
+Qed.
+ +
+Lemma app_ctx_vlookup : forall Δ T Γ n,
+    {{ ~(Δ ++ T :: Γ) }} ->
+    length Δ = n ->
+    {{ ~(Δ ++ T :: Γ) #n : ~(iter (S n) (fun T => {{{T [ Wk ]}}}) T) }}.
+Proof.
+  intros. econstructor; auto using app_ctx_lookup.
+Qed.
+ +
+Lemma sub_q_eq : forall Δ A i Γ σ σ',
+                   {{ Δ A : Type@i }} ->
+                   {{ Γ s σ σ' : Δ }} ->
+                   {{ Γ, A[σ] s q σ q σ' : Δ, A }}.
+Proof.
+  intros. gen_presup H0.
+  econstructor; mauto 3.
+  - econstructor; mauto 4.
+  - rewrite <- @exp_eq_sub_compose_typ; mauto 4.
+Qed.
+#[export]
Hint Resolve sub_q_eq : mcltt.
+ +
+Lemma wf_subtyp_subst_eq : forall Δ A B,
+    {{ Δ A B }} ->
+    forall Γ σ σ',
+      {{ Γ s σ σ' : Δ }} ->
+      {{ Γ A [σ] B[σ'] }}.
+Proof.
+  induction 1; intros * Hσσ'; gen_presup Hσσ'.
+  - eapply wf_subtyp_refl'.
+    eapply wf_exp_eq_conv; mauto 4.
+  - etransitivity; mauto 4.
+  - autorewrite with mcltt.
+    mauto 2.
+  - autorewrite with mcltt.
+    eapply wf_subtyp_pi'; mauto.
+Qed.
+ +
+Lemma wf_subtyp_subst : forall Δ A B,
+    {{ Δ A B }} ->
+    forall Γ σ,
+      {{ Γ s σ : Δ }} ->
+      {{ Γ A [σ] B[σ] }}.
+Proof.
+  intros; mauto 2 using wf_subtyp_subst_eq.
+Qed.
+#[export]
+Hint Resolve wf_subtyp_subst_eq wf_subtyp_subst : mcltt.
+ +
+Lemma exp_typ_sub_lhs : forall {Γ σ Δ i},
+    {{ Γ s σ : Δ }} ->
+    {{ Γ Type@i[σ] : Type@(S i) }}.
+Proof.
+  intros; mauto 4.
+Qed.
+#[export]
+Hint Resolve exp_typ_sub_lhs : mcltt.
+ +
+Lemma exp_nat_sub_lhs : forall {Γ σ Δ i},
+    {{ Γ s σ : Δ }} ->
+    {{ Γ [σ] : Type@i }}.
+Proof.
+  intros; mauto 4.
+Qed.
+#[export]
+Hint Resolve exp_nat_sub_lhs : mcltt.
+ +
+Lemma exp_zero_sub_lhs : forall {Γ σ Δ},
+    {{ Γ s σ : Δ }} ->
+    {{ Γ zero[σ] : }}.
+Proof.
+  intros; mauto 4.
+Qed.
+#[export]
+Hint Resolve exp_zero_sub_lhs : mcltt.
+ +
+Lemma exp_succ_sub_lhs : forall {Γ σ Δ M},
+    {{ Γ s σ : Δ }} ->
+    {{ Δ M : }} ->
+    {{ Γ (succ M)[σ] : }}.
+Proof.
+  intros; mauto 3.
+Qed.
+#[export]
+Hint Resolve exp_succ_sub_lhs : mcltt.
+ +
+Lemma exp_succ_sub_rhs : forall {Γ σ Δ M},
+    {{ Γ s σ : Δ }} ->
+    {{ Δ M : }} ->
+    {{ Γ succ (M[σ]) : }}.
+Proof.
+  intros; mauto 3.
+Qed.
+#[export]
+Hint Resolve exp_succ_sub_rhs : mcltt.
+ +
+Lemma sub_decompose_q : forall Γ S i σ Δ Δ' τ t,
+  {{Γ S : Type@i}} ->
+  {{Δ s σ : Γ}} ->
+  {{Δ' s τ : Δ}} ->
+  {{Δ' t : S [ σ ] [ τ ]}} ->
+  {{Δ' s q σ (τ ,, t) σ τ ,, t : Γ, S}}.
+Proof.
+  intros. gen_presups.
+  simpl. autorewrite with mcltt.
+  symmetry.
+  rewrite wf_sub_eq_extend_compose; mauto 3;
+    [| mauto
+    | rewrite <- @exp_eq_sub_compose_typ; mauto 4].
+  eapply wf_sub_eq_extend_cong; eauto.
+  - rewrite wf_sub_eq_compose_assoc; mauto 3; mauto 4.
+    rewrite wf_sub_eq_p_extend; eauto; mauto 4.
+  - rewrite <- @exp_eq_sub_compose_typ; mauto 4.
+Qed.
+ +
+#[local]
+Hint Rewrite -> @sub_decompose_q using mauto 4 : mcltt.
+ +
+Lemma sub_decompose_q_typ : forall Γ S T i σ Δ Δ' τ t,
+  {{Γ, S T : Type@i}} ->
+  {{Δ s σ : Γ}} ->
+  {{Δ' s τ : Δ}} ->
+  {{Δ' t : S [ σ ] [ τ ]}} ->
+  {{Δ' T [ σ τ ,, t ] T [ q σ ] [ τ ,, t ] : Type@i}}.
+Proof.
+  intros. gen_presups.
+  autorewrite with mcltt.
+  eapply exp_eq_sub_cong_typ2'; [mauto 2 | econstructor; mauto 4 |].
+  eapply sub_eq_refl; econstructor; mauto 3.
+Qed.
+ +
+Lemma sub_eq_p_q_sigma_compose_tau_extend : forall {Δ' τ Δ M A i σ Γ},
+    {{ Δ s σ : Γ }} ->
+    {{ Δ' s τ : Δ }} ->
+    {{ Γ A : Type@i }} ->
+    {{ Δ' M : A[σ][τ] }} ->
+    {{ Δ' s Wk(q σ(τ,,M)) στ : Γ }}.
+Proof.
+  intros.
+  assert {{ Γ, A }} by mauto 3.
+  assert {{ Δ, A[σ] s q σ : Γ, A }} by mauto 2.
+  assert {{ Δ' s τ,,M : Δ, A[σ] }} by mauto 3.
+  transitivity {{{ Wk((στ),,M) }}}; [| autorewrite with mcltt; mauto 3].
+  eapply wf_sub_eq_compose_cong; [| mauto 2].
+  autorewrite with mcltt; econstructor; mauto 3.
+  assert {{ Δ' A[στ] A[σ][τ] : Type@i }} as -> by mauto 3.
+  mauto 3.
+Qed.
+ +
+#[export]
+Hint Resolve sub_eq_p_q_sigma_compose_tau_extend : mcltt.
+#[export]
+Hint Rewrite -> @sub_eq_p_q_sigma_compose_tau_extend using mauto 4 : mcltt.
+ +
+Lemma exp_eq_natrec_cong_rhs_typ : forall {Γ M M' A A' i},
+    {{ Γ, A A' : Type@i }} ->
+    {{ Γ M M' : }} ->
+    {{ Γ A[Id,,M] A'[Id,,M'] : Type@i }}.
+Proof.
+  intros.
+  gen_presups.
+  assert {{ Γ [Id] : Type@0 }} by mauto 3.
+  assert {{ Γ M M' : [Id] }} by mauto 3.
+  assert {{ Γ s Id,,M Id,,M' : Γ, }} as -> by mauto 3.
+  mauto 3.
+Qed.
+#[export]
+Hint Resolve exp_eq_natrec_cong_rhs_typ : mcltt.
+ +
+
+ +
+This works for both natrec_sub and app_sub cases +
+
+Lemma exp_eq_elim_sub_lhs_typ_gen : forall {Γ σ Δ M A B i},
+    {{ Γ s σ : Δ }} ->
+    {{ Δ, A B : Type@i }} ->
+    {{ Δ M : A }} ->
+    {{ Γ B[Id,,M][σ] B[σ,,M[σ]] : Type@i }}.
+Proof.
+  intros.
+  assert {{ Δ }} by mauto 2.
+  assert (exists j, {{ Δ A : Type@j }}) as [] by mauto 3.
+  assert {{ Δ s Id,,M : Δ, A }} by mauto 3.
+  autorewrite with mcltt.
+  assert {{ Γ M[σ] : A[σ] }} by mauto 2.
+  assert {{ Γ s σ,,M[σ] (Id,,M)σ : Δ, A }} as -> by mauto 3.
+  mauto 4.
+Qed.
+#[export]
+Hint Resolve exp_eq_elim_sub_lhs_typ_gen : mcltt.
+ +
+
+ +
+This works for both natrec_sub and app_sub cases +
+
+Lemma exp_eq_elim_sub_rhs_typ : forall {Γ σ Δ M A B i},
+    {{ Γ s σ : Δ }} ->
+    {{ Δ, A B : Type@i }} ->
+    {{ Γ M : A[σ] }} ->
+    {{ Γ B[q σ][Id,,M] B[σ,,M] : Type@i }}.
+Proof.
+  intros.
+  assert (exists j, {{ Δ A : Type@j }}) as [] by mauto 3.
+  autorewrite with mcltt.
+  assert {{ Γ s σId σ : Δ }} by mauto 3.
+  assert {{ Γ s σ,,M (σId),,M : Δ, A }} as <-; mauto 4.
+Qed.
+#[export]
+Hint Resolve exp_eq_elim_sub_rhs_typ : mcltt.
+ +
+Lemma exp_eq_sub_cong_typ2 : forall {Δ Γ A σ τ i},
+    {{ Δ A : Type@i }} ->
+    {{ Γ s σ τ : Δ }} ->
+    {{ Γ A[σ] A[τ] : Type@i }}.
+Proof with mautosolve 3.
+  intros.
+  gen_presups.
+  mauto 3.
+Qed.
+#[export]
+Hint Resolve exp_eq_sub_cong_typ2 : mcltt.
+#[export]
+Remove Hints exp_eq_sub_cong_typ2' : mcltt.
+ +
+Lemma exp_eq_nat_beta_succ_rhs_typ_gen : forall {Γ σ Δ i A M N},
+    {{ Γ s σ : Δ }} ->
+    {{ Δ, A : Type@i }} ->
+    {{ Γ M : }} ->
+    {{ Γ N : A[σ,,M] }} ->
+    {{ Γ A[WkWk,,succ #1][σ,,M,,N] A[σ,,succ M] : Type@i }}.
+Proof.
+  intros.
+  assert {{ Δ }} by mauto 3.
+  assert {{ Δ, s Wk : Δ }} by mauto 3.
+  assert {{ Δ, , A s Wk : Δ, }} by mauto 4.
+  assert {{ Δ, , A s WkWk : Δ }} by mauto 3.
+  assert {{ Δ, , A s WkWk,,succ #1 : Δ, }} by mauto 3.
+  assert {{ Γ s σ,,M : Δ, }} by mauto 4.
+  assert {{ Γ s σ,,M,,N : Δ, , A }} by mauto 3.
+  assert {{ Γ s σ,,M,,N : Δ, , A }} by mauto 3.
+  autorewrite with mcltt.
+  assert {{ Γ s (WkWk,,succ #1)(σ,,M,,N) ((WkWk)(σ,,M,,N)),,(succ #1)[σ,,M,,N] : Δ, }} as -> by mauto 4.
+  assert {{ Γ s (WkWk)(σ,,M,,N) Wk(Wk(σ,,M,,N)) : Δ }} by mauto 3.
+  assert {{ Γ s Wk(σ,,M,,N) σ,,M : Δ, }} by (autorewrite with mcltt; mauto 3).
+  assert {{ Γ s (WkWk)(σ,,M,,N) Wk(σ,,M) : Δ }} by (unshelve bulky_rewrite; constructor).
+  assert {{ Γ s (WkWk)(σ,,M,,N) σ : Δ }} by bulky_rewrite.
+  assert {{ Γ (succ #1)[σ,,M,,N] succ (#1[σ,,M,,N]) : }} by mauto 3.
+  assert {{ Γ (succ #1)[σ,,M,,N] succ (#0[σ,,M]) : }} by (bulky_rewrite; mauto 4).
+  assert {{ Γ (succ #1)[σ,,M,,N] succ M : }} by (bulky_rewrite; mauto 3).
+  assert {{ Γ s (WkWk)(σ,,M,,N),,(succ #1)[σ,,M,,N] σ,,succ M : Δ, }} by mauto 3.
+  mauto 3.
+Qed.
+#[export]
+Hint Resolve exp_eq_nat_beta_succ_rhs_typ_gen : mcltt.
+ +
+Lemma exp_pi_sub_lhs : forall {Γ σ Δ A B i},
+    {{ Γ s σ : Δ }} ->
+    {{ Δ A : Type@i }} ->
+    {{ Δ, A B : Type@i }} ->
+    {{ Γ (Π A B)[σ] : Type@i }}.
+Proof.
+  intros.
+  mauto 4.
+Qed.
+#[export]
+Hint Resolve exp_pi_sub_lhs : mcltt.
+ +
+Lemma exp_pi_sub_rhs : forall {Γ σ Δ A B i},
+    {{ Γ s σ : Δ }} ->
+    {{ Δ A : Type@i }} ->
+    {{ Δ, A B : Type@i }} ->
+    {{ Γ Π A[σ] B[q σ] : Type@i }}.
+Proof.
+  intros.
+  econstructor; mauto 3.
+Qed.
+#[export]
+Hint Resolve exp_pi_sub_rhs : mcltt.
+ +
+Lemma exp_pi_eta_rhs_body : forall {Γ A B M},
+    {{ Γ M : Π A B }} ->
+    {{ Γ, A M[Wk] #0 : B }}.
+Proof.
+  intros.
+  gen_presups.
+  assert ({{ Γ A : Type@i }} /\ {{ Γ, A B : Type@i }}) as [] by mauto 2.
+  assert {{ Γ, A s Wk : Γ }} by mauto 3.
+  assert {{ Γ, A, A[Wk] s q Wk : Γ, A }} by mauto 3.
+  assert {{ Γ, A M[Wk] : (Π A B)[Wk] }} by mauto 3.
+  assert {{ Γ, A Π A[Wk] B[q Wk] (Π A B)[Wk] : Type@i }} by (autorewrite with mcltt; mauto 3).
+  assert {{ Γ, A M[Wk] : Π A[Wk] B[q Wk] }} by mauto 3.
+  econstructor; [econstructor; revgoals; mauto 3 | mauto 3 |].
+  eapply wf_subtyp_refl'.
+  autorewrite with mcltt.
+  - transitivity {{{ B[Id] }}}; [| mauto 3].
+    eapply exp_eq_sub_cong_typ2; mauto 4.
+    transitivity {{{ Wk,,#0 }}}; [| mauto 3].
+    econstructor; mauto 3.
+    autorewrite with mcltt.
+    mauto 3.
+  - econstructor; mauto 3.
+    autorewrite with mcltt.
+    mauto 3.
+Qed.
+#[export]
+Hint Resolve exp_pi_eta_rhs_body : mcltt.
+ +
+
+ +
+This works for both var_0 and var_S cases +
+
+Lemma exp_eq_var_sub_rhs_typ_gen : forall {Γ σ Δ i A M},
+    {{ Γ s σ : Δ }} ->
+    {{ Δ A : Type@i }} ->
+    {{ Γ M : A[σ] }} ->
+    {{ Γ A[Wk][σ,,M] A[σ] : Type@i }}.
+Proof.
+  intros.
+  assert {{ Γ s σ,,M : Δ, A }} by mauto 3.
+  autorewrite with mcltt.
+  mauto 3.
+Qed.
+#[export]
+Hint Resolve exp_eq_var_sub_rhs_typ_gen : mcltt.
+ +
+Lemma exp_sub_decompose_double_q_with_id_double_extend : forall Γ A B C σ Δ M N L,
+  {{ Γ, B, C M : A }} ->
+  {{ Δ s σ : Γ }} ->
+  {{ Δ N : B[σ] }} ->
+  {{ Δ L : C[σ,,N] }} ->
+  {{ Δ M[σ,,N,,L] M[q (q σ)][Id,,N,,L] : A[σ,,N,,L] }}.
+Proof.
+  intros.
+  gen_presups.
+  assert (exists i, {{ Γ B : Type@i }}) as [] by mauto 3.
+  assert {{ Δ, B[σ] s q σ : Γ, B }} by mauto 3.
+  assert {{ Δ s Id,,N : Δ, B[σ] }} by mauto 3.
+  assert {{ Δ L : C[q σ][Id,,N] }} by (rewrite -> @exp_eq_elim_sub_rhs_typ; mauto 3).
+  assert {{ Δ L : C[q σ(Id,,N)] }} by mauto 4.
+  assert {{ Δ s Id,,N,,L : Δ, B[σ], C[q σ] }} by mauto 3.
+  assert {{ Δ s q σ(Id,,N) σ,,N : Γ, B }} by mauto 3.
+  exvar nat ltac:(fun i => assert {{ Δ C[q σ][Id,,N] C[σ,,N] : Type@i }} by mauto 3).
+  assert {{ Δ s q (q σ)(Id,,N,,L) (q σ(Id,,N)),,L : Γ, B, C }} by (eapply sub_decompose_q; mauto 3).
+  assert {{ Δ s q (q σ)(Id,,N,,L) σ,,N,,L : Γ, B, C }} by (bulky_rewrite; mauto 3).
+  exvar nat ltac:(fun i => assert {{ Δ A[q (q σ)][Id,,N,,L] A[q (q σ)(Id,,N,,L)] : Type@i }} by mauto 3).
+  exvar nat ltac:(fun i => assert {{ Δ A[q (q σ)(Id,,N,,L)] A[σ,,N,,L] : Type@i }} as <- by mauto 3).
+  assert {{ Δ M[q (q σ)][Id,,N,,L] M[q (q σ)(Id,,N,,L)] : A[q (q σ)(Id,,N,,L)] }} by mauto 4.
+  assert {{ Δ M[q (q σ)][Id,,N,,L] M[σ,,N,,L] : A[q (q σ)(Id,,N,,L)] }} by (bulky_rewrite; mauto 3).
+  symmetry; mauto 3.
+Qed.
+ +
+#[export]
+Hint Resolve exp_sub_decompose_double_q_with_id_double_extend : mcltt.
+ +
+Lemma sub_eq_q_compose : forall {Γ A i σ Δ τ Δ'},
+  {{ Γ A : Type@i }} ->
+  {{ Δ s σ : Γ }} ->
+  {{ Δ' s τ : Δ }} ->
+  {{ Δ', A[στ] s q σq τ q (στ) : Γ, A }}.
+Proof.
+  intros.
+  assert {{ Δ' }} by mauto 3.
+  assert {{ Δ' A[στ] A[σ][τ] : Type@i }} by mauto 3.
+  assert {{ Δ', A[σ][τ] }} by mauto 4.
+  assert {{ Δ', A[στ] Δ', A[σ][τ] }} as -> by mauto.
+  assert {{ Δ }} by mauto 3.
+  assert {{ Δ, A[σ] }} by mauto 3.
+  assert {{ Δ, A[σ] s Wk : Δ }} by mauto 3.
+  assert {{ Δ, A[σ] #0 : A[σ][Wk] }} by mauto 3.
+  assert {{ Δ, A[σ] #0 : A[σWk] }} by mauto 3.
+  transitivity {{{ ((σWk)q τ),,#0[q τ] }}}; [econstructor; mauto 3 |].
+  symmetry; econstructor; mauto 3; symmetry.
+  - transitivity {{{ σ(Wkq τ) }}}; [mauto 4 |].
+    assert {{ Δ' A[σ][τ] : Type@i }} by mauto 3.
+    assert {{ Δ', A[σ][τ] s Wk : Δ' }} by mauto 3.
+    transitivity {{{ σ(τWk) }}}; [| mauto 3].
+    econstructor; mauto 3.
+  - assert {{ Δ', A[σ][τ] A[(στ)Wk] A[σ(τWk)] : Type@i }} by mauto 4.
+    assert {{ Δ', A[σ][τ] A[σ(τWk)] A[σ][τWk] : Type@i }} by mauto.
+    bulky_rewrite.
+    econstructor; mauto 3.
+    assert {{ Δ', A[σ][τ] A[(στ)Wk] A[σ][τWk] : Type@i }} as <- by mauto 3.
+    assert {{ Δ', A[σ][τ] A[(στ)Wk] A[στ][Wk] : Type@i }} as -> by mauto.
+    assert {{ Δ', A[σ][τ] A[στ][Wk] A[σ][τ][Wk] : Type@i }} as -> by mauto 3.
+    mauto 4.
+Qed.
+ +
+#[export]
+Hint Resolve sub_eq_q_compose : mcltt.
+#[export]
+Hint Rewrite -> @sub_eq_q_compose using mauto 4 : mcltt.
+ +
+Lemma sub_eq_q_compose_nat : forall {Γ σ Δ τ Δ'},
+  {{ Δ s σ : Γ }} ->
+  {{ Δ' s τ : Δ }} ->
+  {{ Δ', s q σq τ q (στ) : Γ, }}.
+Proof.
+  intros.
+  assert {{ Γ : Type@0 }} by mauto 3.
+  assert {{ Δ' [στ] : Type@0 }} by mauto 3.
+  assert {{ Δ' }} by mauto 3.
+  assert {{ Δ', [στ] Δ', }} as <- by mauto 3.
+  mautosolve 2.
+Qed.
+ +
+#[export]
+Hint Resolve sub_eq_q_compose_nat : mcltt.
+#[export]
+Hint Rewrite -> @sub_eq_q_compose_nat using mauto 4 : mcltt.
+ +
+Lemma exp_eq_typ_q_sigma_then_weak_weak_extend_succ_var_1 : forall {Δ σ Γ i A},
+    {{ Δ s σ : Γ }} ->
+    {{ Γ, A : Type@i }} ->
+    {{ Δ, , A[q σ] A[q σ][WkWk,,succ #1] A[WkWk,,succ #1][q (q σ)] : Type@i }}.
+Proof.
+  intros.
+  assert {{ Δ, s q σ : Γ, }} by mauto 3.
+  assert {{ Δ, , A[q σ] s WkWk,,succ #1 : Δ, }} by mauto 3.
+  assert {{ Δ, , A[q σ] A[q σ][WkWk,,succ #1] A[q σ(WkWk,,succ #1)] : Type@i }} as -> by mauto 3.
+  assert {{ Δ, , A[q σ] s q (q σ) : Γ, , A }} by mauto 3.
+  assert {{ Δ, , A[q σ] A[WkWk,,succ #1][q (q σ)] A[(WkWk,,succ #1)q (q σ)] : Type@i }} as -> by mauto 3.
+  rewrite -> @sub_eq_q_sigma_compose_weak_weak_extend_succ_var_1; mauto 2.
+  eapply exp_eq_refl.
+  eapply exp_sub_typ; mauto 2.
+  econstructor; mauto 3.
+Qed.
+ +
+#[export]
+Hint Resolve exp_eq_typ_q_sigma_then_weak_weak_extend_succ_var_1 : mcltt.
+
+
+ +
+ + + diff --git a/ext/prop-eq/Mcltt.Core.Syntactic.CtxEq.html b/ext/prop-eq/Mcltt.Core.Syntactic.CtxEq.html new file mode 100644 index 00000000..6d2f956b --- /dev/null +++ b/ext/prop-eq/Mcltt.Core.Syntactic.CtxEq.html @@ -0,0 +1,155 @@ + + + + + + + + + + + + + +
+
+

Mcltt.Core.Syntactic.CtxEq

+ +
+From Mcltt Require Import LibTactics.
+From Mcltt.Core Require Import Base.
+From Mcltt.Core.Syntactic Require Export CtxSub.
+Import Syntax_Notations.
+ +
+Lemma ctx_eq_refl : forall {Γ}, {{ Γ }} -> {{ Γ Γ }}.
+Proof with mautosolve.
+  induction 1...
+Qed.
+ +
+#[export]
+Hint Resolve ctx_eq_refl : mcltt.
+ +
+Lemma ctx_eq_sym : forall {Γ Δ}, {{ Γ Δ }} -> {{ Δ Γ }}.
+Proof.
+  intros.
+  symmetry.
+  eassumption.
+Qed.
+ +
+#[export]
+Hint Resolve ctx_eq_sym : mcltt.
+ +
+Lemma ctxeq_exp : forall {Γ Δ M A}, {{ Γ Δ }} -> {{ Γ M : A }} -> {{ Δ M : A }}.
+Proof. mauto. Qed.
+ +
+Lemma ctxeq_exp_eq : forall {Γ Δ M M' A}, {{ Γ Δ }} -> {{ Γ M M' : A }} -> {{ Δ M M' : A }}.
+Proof. mauto. Qed.
+ +
+Lemma ctxeq_sub : forall {Γ Δ σ Γ'}, {{ Γ Δ }} -> {{ Γ s σ : Γ' }} -> {{ Δ s σ : Γ' }}.
+Proof. mauto. Qed.
+ +
+Lemma ctxeq_sub_eq : forall {Γ Δ σ σ' Γ'}, {{ Γ Δ }} -> {{ Γ s σ σ' : Γ' }} -> {{ Δ s σ σ' : Γ' }}.
+Proof. mauto. Qed.
+ +
+Lemma ctxeq_subtyp : forall {Γ Δ A B}, {{ Γ Δ }} -> {{ Γ A B }} -> {{ Δ A B }}.
+Proof. mauto. Qed.
+ +
+#[export]
+Hint Resolve ctxeq_exp ctxeq_exp_eq ctxeq_sub ctxeq_sub_eq ctxeq_subtyp : mcltt.
+ +
+Lemma ctx_eq_trans : forall {Γ0 Γ1 Γ2}, {{ Γ0 Γ1 }} -> {{ Γ1 Γ2 }} -> {{ Γ0 Γ2 }}.
+Proof with mautosolve.
+  intros * HΓ01.
+  gen Γ2.
+  induction HΓ01 as [|Γ0 ? i01 T0 T1]; mauto.
+  inversion_clear 1 as [|? Γ2' i12 ? T2].
+  clear Γ2; rename Γ2' into Γ2.
+  set (i := max i01 i12).
+  assert {{ Γ0 T0 : Type@i }} by mauto using lift_exp_max_left.
+  assert {{ Γ2 T2 : Type@i }} by mauto using lift_exp_max_right.
+  assert {{ Γ0 T0 T1 : Type@i }} by mauto using lift_exp_eq_max_left.
+  assert {{ Γ2 T1 T2 : Type@i }} by mauto using lift_exp_eq_max_right.
+  assert {{ Γ0 Γ2 }} by mauto.
+  assert {{ Γ0 T0 T2 : Type@i }} by mauto.
+  econstructor...
+Qed.
+ +
+#[export]
+Hint Resolve ctx_eq_trans : mcltt.
+ +
+#[export]
+Instance wf_ctx_PER : PER wf_ctx_eq.
+Proof.
+  split.
+  - eauto using ctx_eq_sym.
+  - eauto using ctx_eq_trans.
+Qed.
+ +
+Add Parametric Morphism : wf_exp
+  with signature wf_ctx_eq ==> eq ==> eq ==> iff as ctxeq_exp_morphism.
+Proof.
+  intros. split; mauto 3.
+Qed.
+ +
+Add Parametric Morphism : wf_exp_eq
+  with signature wf_ctx_eq ==> eq ==> eq ==> eq ==> iff as ctxeq_exp_eq_morphism.
+Proof.
+  intros. split; mauto 3.
+Qed.
+ +
+Add Parametric Morphism : wf_sub
+  with signature wf_ctx_eq ==> eq ==> eq ==> iff as ctxeq_sub_morphism.
+Proof.
+  intros. split; mauto 3.
+Qed.
+ +
+Add Parametric Morphism : wf_sub_eq
+  with signature wf_ctx_eq ==> eq ==> eq ==> eq ==> iff as ctxeq_sub_eq_morphism.
+Proof.
+  intros. split; mauto 3.
+Qed.
+ +
+Add Parametric Morphism : wf_subtyp
+  with signature wf_ctx_eq ==> eq ==> eq ==> iff as ctxeq_subtyp_morphism.
+Proof.
+  intros. split; mauto 3.
+Qed.
+
+
+ +
+ + + diff --git a/ext/prop-eq/Mcltt.Core.Syntactic.CtxSub.html b/ext/prop-eq/Mcltt.Core.Syntactic.CtxSub.html new file mode 100644 index 00000000..96ab9b85 --- /dev/null +++ b/ext/prop-eq/Mcltt.Core.Syntactic.CtxSub.html @@ -0,0 +1,249 @@ + + + + + + + + + + + + + +
+
+

Mcltt.Core.Syntactic.CtxSub

+ +
+From Mcltt Require Import LibTactics.
+From Mcltt.Core Require Import Base.
+From Mcltt.Core.Syntactic Require Export System.
+Import Syntax_Notations.
+ +
+Lemma ctx_sub_refl : forall {Γ},
+    {{ Γ }} ->
+    {{ Γ Γ }}.
+Proof with mautosolve.
+  induction 1...
+Qed.
+ +
+#[export]
+Hint Resolve ctx_sub_refl : mcltt.
+ +
+Module ctxsub_judg.
+  #[local]
+  Ltac gen_ctxsub_helper_IH ctxsub_exp_helper ctxsub_exp_eq_helper ctxsub_sub_helper ctxsub_sub_eq_helper ctxsub_subtyp_helper H :=
+  match type of H with
+  | {{ ~?Γ ~?M : ~?A }} => pose proof ctxsub_exp_helper _ _ _ H
+  | {{ ~?Γ ~?M ~?N : ~?A }} => pose proof ctxsub_exp_eq_helper _ _ _ _ H
+  | {{ ~?Γ s ~: ~?Δ }} => pose proof ctxsub_sub_helper _ _ _ H
+  | {{ ~?Γ s ~ ~: ~?Δ }} => pose proof ctxsub_sub_eq_helper _ _ _ _ H
+  | {{ ~?Γ ~?M ~?M' }} => pose proof ctxsub_subtyp_helper _ _ _ H
+  end.
+ +
+  #[local]
+  Lemma ctxsub_exp_helper : forall {Γ M A}, {{ Γ M : A }} -> forall {Δ}, {{ Δ Γ }} -> {{ Δ M : A }}
+  with
+  ctxsub_exp_eq_helper : forall {Γ M M' A}, {{ Γ M M' : A }} -> forall {Δ}, {{ Δ Γ }} -> {{ Δ M M' : A }}
+  with
+  ctxsub_sub_helper : forall {Γ Γ' σ}, {{ Γ s σ : Γ' }} -> forall {Δ}, {{ Δ Γ }} -> {{ Δ s σ : Γ' }}
+  with
+  ctxsub_sub_eq_helper : forall {Γ Γ' σ σ'}, {{ Γ s σ σ' : Γ' }} -> forall {Δ}, {{ Δ Γ }} -> {{ Δ s σ σ' : Γ' }}
+  with
+  ctxsub_subtyp_helper : forall {Γ M M'}, {{ Γ M M' }} -> forall {Δ}, {{ Δ Γ }} -> {{ Δ M M' }}.
+  Proof with mautosolve.
+    all: inversion_clear 1;
+      (on_all_hyp: gen_ctxsub_helper_IH ctxsub_exp_helper ctxsub_exp_eq_helper ctxsub_sub_helper ctxsub_sub_eq_helper ctxsub_subtyp_helper);
+      clear ctxsub_exp_helper ctxsub_exp_eq_helper ctxsub_sub_helper ctxsub_sub_eq_helper ctxsub_subtyp_helper;
+      intros * HΓΔ; destruct (presup_ctx_sub HΓΔ); mauto 4;
+      try (rename B into C); try (rename B' into C'); try (rename A0 into B); try (rename A' into B').
+
+ +
+ctxsub_exp_helper & ctxsub_exp_eq_helper recursion cases +
+
+    1,8-10: assert {{ Δ, Γ, }} by (econstructor; mautosolve);
+    assert {{ Δ, B : Type@i }} by eauto; econstructor...
+
+ +
+ctxsub_exp_helper & ctxsub_exp_eq_helper function cases +
+
+    1-3,7-11: assert {{ Δ B : Type@i }} by eauto; assert {{ Δ, B Γ, B }} by mauto;
+    try econstructor...
+
+ +
+equality type case +
+
+    2,4:idtac...
+ +
+
+ +
+ctxsub_exp_helper & ctxsub_exp_eq_helper variable cases +
+
+    1,5: assert (exists B, {{ #x : B Δ }} /\ {{ Δ B A }}); destruct_conjs; mautosolve 4.
+
+ +
+ctxsub_sub_helper & ctxsub_sub_eq_helper weakening cases +
+
+    5,6: inversion_clear HΓΔ; econstructor; mautosolve 4.
+ +
+
+ +
+eqrec related cases +
+
+    1-3:assert {{ Δ, B Γ, B }} by mauto;
+      assert {{ Γ, B B[Wk] : Type@i }} by mauto;
+      assert {{ Δ, B B[Wk] : Type@i }} by mauto;
+      assert {{ Δ, B, B[Wk] Γ, B, B[Wk] }} by (econstructor; mauto 4);
+      assert {{ Γ, B, B[Wk] Eq (B[Wk][Wk]) #1 #0 : Type@i }} by (econstructor; mauto 4);
+      assert {{ Δ, B, B[Wk] Eq (B[Wk][Wk]) #1 #0 : Type@i }} by (econstructor; mauto 4);
+      assert {{ Δ, B, B[Wk], Eq (B[Wk][Wk]) #1 #0 Γ, B, B[Wk], Eq (B[Wk][Wk]) #1 #0 }} by mauto;
+      econstructor; mauto 2.
+ +
+    -
+ +
+ctxsub_exp_eq_helper variable case +
+
+      inversion_clear HΓΔ as [|Δ0 ? ? C'].
+      assert (exists D, {{ #x : D Δ0 }} /\ {{ Δ0 D B }}) as [D [i0 ?]] by mauto.
+      destruct_conjs.
+      assert {{ Δ0, C' }} by mauto.
+      assert {{ Δ0, C' D[Wk] B[Wk] }}...
+    - eapply wf_subtyp_pi with (i := i); firstorder mauto 4.
+  Qed.
+ +
+  Corollary ctxsub_exp : forall {Γ Δ M A}, {{ Δ Γ }} -> {{ Γ M : A }} -> {{ Δ M : A }}.
+  Proof.
+    eauto using ctxsub_exp_helper.
+  Qed.
+ +
+  Corollary ctxsub_exp_eq : forall {Γ Δ M M' A}, {{ Δ Γ }} -> {{ Γ M M' : A }} -> {{ Δ M M' : A }}.
+  Proof.
+    eauto using ctxsub_exp_eq_helper.
+  Qed.
+ +
+  Corollary ctxsub_sub : forall {Γ Δ σ Γ'}, {{ Δ Γ }} -> {{ Γ s σ : Γ' }} -> {{ Δ s σ : Γ' }}.
+  Proof.
+    eauto using ctxsub_sub_helper.
+  Qed.
+ +
+  Corollary ctxsub_sub_eq : forall {Γ Δ σ σ' Γ'}, {{ Δ Γ }} -> {{ Γ s σ σ' : Γ' }} -> {{ Δ s σ σ' : Γ' }}.
+  Proof.
+    eauto using ctxsub_sub_eq_helper.
+  Qed.
+ +
+  Corollary ctxsub_subtyp : forall {Γ Δ A B}, {{ Δ Γ }} -> {{ Γ A B }} -> {{ Δ A B }}.
+  Proof.
+    eauto using ctxsub_subtyp_helper.
+  Qed.
+ +
+  #[export]
+  Hint Resolve ctxsub_exp ctxsub_exp_eq ctxsub_sub ctxsub_sub_eq ctxsub_subtyp : mcltt.
+End ctxsub_judg.
+ +
+Export ctxsub_judg.
+ +
+Lemma wf_ctx_sub_trans : forall Γ0 Γ1,
+    {{ Γ0 Γ1 }} ->
+    forall Γ2,
+    {{ Γ1 Γ2 }} ->
+    {{ Γ0 Γ2 }}.
+Proof.
+  induction 1; intros; progressive_inversion; [constructor |].
+  eapply wf_ctx_sub_extend with (i := max i i0);
+    mauto 3 using lift_exp_max_left, lift_exp_max_right.
+Qed.
+ +
+#[export]
Hint Resolve wf_ctx_sub_trans : mcltt.
+ +
+#[export]
+Instance wf_ctx_sub_trans_ins : Transitive wf_ctx_sub.
+Proof. eauto using wf_ctx_sub_trans. Qed.
+ +
+Add Parametric Morphism : wf_exp
+  with signature wf_ctx_sub --> eq ==> eq ==> Basics.impl as ctxsub_exp_morphism.
+Proof.
+  cbv. intros. mauto 3.
+Qed.
+ +
+Add Parametric Morphism : wf_exp_eq
+  with signature wf_ctx_sub --> eq ==> eq ==> eq ==> Basics.impl as ctxsub_exp_eq_morphism.
+Proof.
+  cbv. intros. mauto 3.
+Qed.
+ +
+Add Parametric Morphism : wf_sub
+  with signature wf_ctx_sub --> eq ==> eq ==> Basics.impl as ctxsub_sub_morphism.
+Proof.
+  cbv. intros. mauto 3.
+Qed.
+ +
+Add Parametric Morphism : wf_sub_eq
+  with signature wf_ctx_sub --> eq ==> eq ==> eq ==> Basics.impl as ctxsub_sub_eq_morphism.
+Proof.
+  cbv. intros. mauto 3.
+Qed.
+ +
+Add Parametric Morphism : wf_subtyp
+  with signature wf_ctx_sub --> eq ==> eq ==> Basics.impl as ctxsub_subtyp_morphism.
+Proof.
+  cbv. intros. mauto 3.
+Qed.
+
+
+ +
+ + + diff --git a/ext/prop-eq/Mcltt.Core.Syntactic.Presup.html b/ext/prop-eq/Mcltt.Core.Syntactic.Presup.html new file mode 100644 index 00000000..aca2de74 --- /dev/null +++ b/ext/prop-eq/Mcltt.Core.Syntactic.Presup.html @@ -0,0 +1,1506 @@ + + + + + + + + + + + + + +
+
+

Mcltt.Core.Syntactic.Presup

+ +
+From Mcltt Require Import LibTactics.
+From Mcltt.Core Require Import Base.
+From Mcltt.Core.Syntactic Require Export CtxEq.
+Import Syntax_Notations.
+ +
+#[local]
+Ltac gen_presup_ctx H :=
+  match type of H with
+  | {{ ~?Γ ~?Δ }} =>
+      let := fresh "HΓ" in
+      let := fresh "HΔ" in
+      pose proof presup_ctx_eq H as [ ]
+  | {{ ~?Γ ~?Δ }} =>
+      let := fresh "HΓ" in
+      let := fresh "HΔ" in
+      pose proof presup_ctx_sub H as [ ]
+  end.
+ +
+#[local]
+Ltac gen_presup_IH presup_exp_eq presup_sub_eq presup_subtyp H :=
+  match type of H with
+  | {{ ~?Γ ~?M ~?N : ~?A }} =>
+      let := fresh "HΓ" in
+      let i := fresh "i" in
+      let HM := fresh "HM" in
+      let HN := fresh "HN" in
+      let HAi := fresh "HAi" in
+      pose proof presup_exp_eq _ _ _ _ H as [ [HM [HN [i HAi]]]]
+ | {{ ~?Γ s ~ ~: ~?Δ }} =>
+      let := fresh "HΓ" in
+      let Hσ := fresh "Hσ" in
+      let Hτ := fresh "Hτ" in
+      let := fresh "HΔ" in
+      pose proof presup_sub_eq _ _ _ _ H as [ [Hσ [Hτ ]]]
+ | {{ ~?Γ ~?M ~?N }} =>
+      let := fresh "HΓ" in
+      let i := fresh "i" in
+      let HM := fresh "HM" in
+      let HN := fresh "HN" in
+      pose proof presup_subtyp _ _ _ H as [ [i [HM HN]]]
+ | {{ ~?Γ ~?M : ~?A }} =>
+      let := fresh "HΓ" in
+      let i := fresh "i" in
+      let HAi := fresh "HAi" in
+      pose proof presup_exp H as [ [i HAi]]
+ | {{ ~?Γ s ~: ~?Δ }} =>
+      let := fresh "HΓ" in
+      let := fresh "HΔ" in
+      pose proof presup_sub H as [ ]
+  | _ => gen_presup_ctx H
+  end.
+ +
+Lemma presup_exp_eq : forall {Γ M M' A}, {{ Γ M M' : A }} -> {{ Γ }} /\ {{ Γ M : A }} /\ {{ Γ M' : A }} /\ exists i, {{ Γ A : Type@i }}
+with presup_sub_eq : forall {Γ Δ σ σ'}, {{ Γ s σ σ' : Δ }} -> {{ Γ }} /\ {{ Γ s σ : Δ }} /\ {{ Γ s σ' : Δ }} /\ {{ Δ }}
+with presup_subtyp : forall {Γ M M'}, {{ Γ M M' }} -> {{ Γ }} /\ exists i, {{ Γ M : Type@i }} /\ {{ Γ M' : Type@i }}.
+Proof with mautosolve 4.
+  1: set (WkWksucc := {{{ WkWk ,, succ #1 }}}).
+  all: inversion_clear 1; (on_all_hyp: gen_presup_IH presup_exp_eq presup_sub_eq presup_subtyp);
+    clear presup_exp_eq presup_sub_eq presup_subtyp;
+    repeat split; mauto 4;
+    try (rename B into C); try (rename B' into C'); try (rename A0 into B); try (rename A' into B');
+    try (rename N into L); try (rename N' into L');
+    try (rename M0 into N); try (rename MZ into NZ); try (rename MS into NS);
+    try (rename M'0 into N'); try (rename MZ' into NZ'); try (rename MS' into NS');
+    try (rename M' into N').
+ +
+
+ +
+presup_exp_eq cases +
+
+  - assert {{ Γ s Id ,, N Id ,, N' : Γ, }} by mauto 4.
+    assert {{ Γ B[Id ,, N] B[Id ,, N'] : Type@i }} by mauto 3.
+    assert {{ Γ B[Id ,, N] B'[Id ,, N'] : Type@i }} by mauto 4.
+    assert {{ Γ NZ' : B'[Id ,, zero] }} by (eapply wf_conv; mauto 3).
+    assert {{ Γ, , B NS' : B'[WkWksucc] }} by (eapply wf_conv; mauto 3).
+    assert {{ Γ, , B' NS' : B'[WkWksucc] }} by mauto 4.
+    assert {{ Γ rec N' return B' | zero -> NZ' | succ -> NS' end : B'[Id ,, N'] }} by mauto 3.
+    eapply wf_conv...
+ +
+  - assert {{ Γ B[(Id,,N)][σ] B[(Id,,N)σ] : Type@i }} by mauto 3.
+    assert {{ Γ s (Id,,N)σ σ,,N[σ] : Δ, }} by mauto 3.
+    assert {{ Γ B[(Id,,N)σ] B[σ,,N[σ]] : Type@i }} by mauto 4.
+    eapply wf_conv...
+ +
+  - assert {{ Γ s Id,,N[σ] : Γ, }} by mauto 4.
+    assert {{ Γ, s q σ : Δ, }} by mauto 2.
+    assert {{ Γ, B[q σ] : Type@i }} by mauto 2.
+    assert {{ Γ B[q σ][(Id,,N[σ])] B[q σ(Id,,N[σ])] : Type@i }} by mauto 2.
+    assert {{ Γ s q σ(Id,,N[σ]) σ,,N[σ] : Δ, }} by mauto 3.
+    assert {{ Γ B[q σ(Id,,N[σ])] B[σ,,N[σ]] : Type@i }} by mauto 3.
+    assert {{ Γ B[q σ][Id,,N[σ]] B[σ,,N[σ]] : Type@i }} by mauto 3.
+    assert {{ Γ NZ[σ] : B[Id ,, zero][σ] }} by mauto 3.
+    assert {{ Γ [σ] : Type@0 }} by mauto 3.
+    assert {{ Γ zero : [σ] }} by mauto 3.
+    assert {{ Γ s q σ(Id ,, zero) σ ,, zero : Δ, }} by mauto 3.
+    assert {{ Γ s σ Idσ : Δ }} by mauto 3.
+    assert {{ Γ s σ ,, zero Idσ ,, zero[σ] : Δ, }} by mauto 4.
+    assert {{ Γ s Idσ ,, zero[σ] (Id ,, zero)σ : Δ, }} by mauto.
+    assert {{ Γ s Id ,, zero : Γ, }} by mauto 2.
+    assert {{ Γ s q σ(Id ,, zero) (Id ,, zero)σ : Δ, }} by mauto 3.
+    assert {{ Γ B[q σ(Id ,, zero)] B[(Id ,, zero)σ] : Type@i }} by mauto 3.
+    assert {{ Γ B[q σ][Id ,, zero] B[Id ,, zero][σ] : Type@i }} by mauto 3.
+    assert {{ Γ NZ[σ] : B[q σ][Id ,, zero] }} by mauto 4.
+    set (Γ' := {{{ Γ, , B[q σ] }}}).
+    assert {{ Γ' s q (q σ) : Δ, , B }} by mauto 2.
+    assert {{ Γ' s q σWkWksucc WkWksuccq (q σ) : Δ, }} by mauto 2.
+    assert {{ Γ' s WkWksucc : Γ, }} by mauto 2.
+    assert {{ Γ' B[WkWksucc][q (q σ)] B[q σ][WkWksucc] : Type@i }} by mauto 4.
+    assert {{ Γ' NS[q (q σ)] : B[q σ][WkWksucc] }} by mauto 4.
+    eapply wf_conv...
+ +
+  - eexists...
+ +
+  - set (recN := {{{ rec N return B | zero -> NZ | succ -> NS end }}}).
+    set (IdNrecN := {{{ Id ,, N ,, recN }}}).
+    assert {{ Γ : Type@0 }} by mauto 3.
+    assert {{ Γ recN : B[Id ,, N] }} by mauto 4.
+    assert {{ Γ, s Wk : Γ }} by mauto 2.
+    assert {{ Γ, , B s Wk : Γ, }} by mauto 2.
+    assert {{ Γ, , B s WkWk : Γ }} by mauto 2.
+    assert {{ Γ s WkWksuccIdNrecN (WkWk)IdNrecN ,, (succ #1)[IdNrecN] : Γ, }}
+      by (eapply sub_eq_extend_compose_nat; mauto 3).
+    assert {{ Γ s IdNrecN : Γ, , B }} by mauto 3.
+    assert {{ Γ s (WkWk)IdNrecN : Γ }} by mauto 2.
+    assert {{ Γ s (WkWk)IdNrecN Wk(WkIdNrecN) : Γ }} by mauto 2.
+    assert {{ Γ s Id,,N : Γ, }} by mauto 2.
+    assert {{ Γ s Wk(WkIdNrecN) Wk(Id,,N) : Γ }} by mauto 4.
+    assert {{ Γ s (WkWk)IdNrecN Id : Γ }} by mauto 4.
+    assert {{ Γ #1[IdNrecN] #0[Id ,, N] : }} by mauto 3.
+    assert {{ Γ #1[IdNrecN] N : }} by mauto 4.
+    assert {{ Γ succ #1[IdNrecN] succ N : }} by mauto 2.
+    assert {{ Γ (succ #1)[IdNrecN] succ N : }} by mauto 4.
+    assert {{ Γ s (WkWk)IdNrecN ,, (succ #1)[IdNrecN] Id ,, succ N : Γ , }} by mauto 2.
+    assert {{ Γ s WkWksuccIdNrecN : Γ, }} by mauto 3.
+    assert {{ Γ s Id,,succ N : Γ, }} by mauto 3.
+    assert {{ Γ s WkWksuccIdNrecN Id ,, succ N : Γ , }} by mauto 2.
+    assert {{ Γ B[WkWksuccIdNrecN] B[Id,,succ N] : Type@i }} by mauto 2.
+    enough {{ Γ B[WkWksucc][IdNrecN] B[Id,,succ N] : Type@i }}...
+ +
+  - eexists...
+ +
+  - mauto.
+ +
+  - mauto.
+ +
+  - assert {{ Γ B : Type@(max i i0) }} by mauto 2 using lift_exp_max_left.
+    assert {{ Γ B B' : Type@(max i i0) }} by mauto 2 using lift_exp_eq_max_left.
+    assert {{ Γ, B C : Type@(max i i0) }} by mauto 2 using lift_exp_max_right.
+    assert {{ Γ Π B C Π B' C : Type@(max i i0) }} by mauto 3.
+    assert {{ Γ, B' N' : C }} by mauto 4.
+    enough {{ Γ λ B' N' : Π B' C }}...
+ +
+  - assert {{ Γ B : Type@(max i i0) }} by mauto 2 using lift_exp_max_left.
+    assert {{ Γ, B C : Type@(max i i0) }} by mauto 2 using lift_exp_max_right...
+ +
+  - assert {{ Δ B : Type@(max i i0) }} by mauto 2 using lift_exp_max_left.
+    assert {{ Δ, B C : Type@(max i i0) }} by mauto 2 using lift_exp_max_right.
+    assert {{ Γ B[σ] : Type@(max i i0) }} by mauto 2.
+    assert {{ Γ, B[σ] C[q σ] : Type@(max i i0) }} by mauto 3.
+    assert {{ Γ Π B[σ] C[q σ] : Type@(max i i0) }} by mauto 2.
+    assert {{ Γ Π B[σ] C[q σ] Π B[σ] C[q σ] : Type@(max i i0) }} by mauto 2.
+    assert {{ Γ, B[σ] N[q σ] : C[q σ] }} by mauto 3.
+    assert {{ Γ λ B[σ] N[q σ] : Π B[σ] C[q σ] }} by mauto 3.
+    eapply wf_conv...
+ +
+  - assert {{ Δ B : Type@(max i i0) }} by mauto 2 using lift_exp_max_left.
+    assert {{ Δ, B C : Type@(max i i0) }} by mauto 2 using lift_exp_max_right.
+    enough {{ Δ Π B C : Type@(max i i0) }}...
+ +
+  - assert {{ Γ s Id Id : Γ }} by mauto 2.
+    assert {{ Γ B B[Id] : Type@i }} by mauto 3.
+    assert {{ Γ L L' : B[Id] }} by mauto 4.
+    assert {{ Γ s Id ,, L Id ,, L' : Γ, B }} by mauto 2.
+    assert {{ Γ C[Id ,, L] C[Id ,, L'] : Type@i }} by mauto 3.
+    eapply wf_conv...
+ +
+  - assert {{ Γ N[σ] : Π B[σ] C[q σ] }} by (eapply wf_conv; mauto).
+    assert {{ Δ L : B[Id] }} by mauto 4.
+    assert {{ Γ s (Id ,, L)σ Idσ ,, L[σ] : Δ, B }} by mauto 3.
+    assert {{ Γ s (Id ,, L)σ σ ,, L[σ] : Δ, B }} by mauto 3.
+    assert {{ Δ s Id ,, L : Δ, B }} by mauto 3.
+    assert {{ Γ s (Id ,, L)σ : Δ, B }} by mauto 3.
+    assert {{ Γ C[(Id ,, L)σ] C[σ ,, L[σ]] : Type@i }} by mauto 2.
+    assert {{ Γ C[Id ,, L][σ] C[σ ,, L[σ]] : Type@i }} by mauto 3.
+    eapply wf_conv...
+ +
+  - assert {{ Γ B[σ] : Type@i }} by mauto 2.
+    assert {{ Γ, B[σ] s q σ : Δ, B }} by mauto 2.
+    assert {{ Γ, B[σ] C[q σ] : Type@i }} by mauto 2.
+    assert {{ Γ N[σ] : Π B[σ] C[q σ] }} by (eapply wf_conv; mauto 2).
+    assert {{ Γ L[σ] : B[σ] }} by mauto 2.
+    assert {{ Γ s q σ(Id ,, L[σ]) σ ,, L[σ] : Δ, B }} by mauto 2.
+    assert {{ Γ s Id ,, L[σ] : Γ, B[σ] }} by mauto 2.
+    assert {{ Γ s q σ(Id ,, L[σ]) : Δ, B }} by mauto 2.
+    assert {{ Γ C[q σ(Id ,, L[σ])] C[σ ,, L[σ]] : Type@i }} by mauto 2.
+    assert {{ Γ C[q σ][(Id ,, L[σ])] C[σ ,, L[σ]] : Type@i }} by mauto 3.
+    eapply wf_conv...
+ +
+  - eexists...
+ +
+  - set (Id0 := {{{ Id ,, #0 }}}).
+    assert {{ Γ, B s Wk : Γ }} by mauto 2.
+    assert {{ Γ, B B[Wk] : Type@i }} by mauto 2.
+    assert {{ Γ, B, B[Wk] s Wk : Γ, B }} by mauto 3.
+    assert {{ Γ, B, B[Wk] s q Wk : Γ, B }} by mauto 2.
+    assert {{ Γ, B, B[Wk] C[q Wk] : Type@i }} by mauto 2.
+    assert {{ Γ, B M[Wk] : (Π B C)[Wk] }} by mauto 2.
+    assert {{ Γ, B M[Wk] : Π B[Wk] C[q Wk] }} by mauto 4.
+    assert {{ Γ, B #0 : B[Wk] }} by mauto 2.
+    assert {{ Γ, B s Id0 : Γ, B, B[Wk] }} by mauto 2.
+    assert {{ Γ, B M[Wk] #0 : C[q Wk][Id0] }} by mauto 2.
+    assert {{ Γ, B M[Wk] #0 : C[q Wk Id0] }} by (eapply wf_conv; mauto 3).
+    assert {{ Γ, B B[Wk][Id] B[Wk] : Type@i }} by mauto 2.
+    assert {{ Γ, B #0 : B[Wk][Id] }} by mauto 2.
+    assert {{ Γ, B, B[Wk] s WkWk : Γ }} by mauto 2.
+    assert {{ Γ, B s (WkWk)Id0 : Γ }} by mauto 2.
+    assert {{ Γ, B s Id WkId0 : Γ, B }} by mauto 3.
+    assert {{ Γ, B s WkId Wk(WkId0) : Γ }} by mauto 3.
+    assert {{ Γ, B s WkId (WkWk)Id0 : Γ }} by mauto 4.
+    assert {{ Γ, B, B[Wk] #0 : B[Wk][Wk] }} by mauto 3.
+    assert {{ Γ, B, B[Wk] #0 : B[WkWk] }} by (eapply wf_conv; mauto 3).
+    assert {{ Γ, B s q Wk Id0 (WkWk)Id0 ,, #0[Id0] : Γ, B }} by mauto 3.
+    assert {{ Γ, B s (WkWk)Id0 Wk(WkId0) : Γ }} by mauto 2.
+    assert {{ Γ, B s (WkWk)Id0 WkId : Γ }} by mauto 2.
+    assert {{ Γ, B #0[Id0] #0 : B[Wk][Id] }} by mauto 3.
+    assert {{ Γ, B #0 #0[Id] : B[Wk][Id] }} by mauto 3.
+    assert {{ Γ, B #0[Id0] #0[Id] : B[Wk][Id] }} by mauto 2.
+    assert {{ Γ, B #0[Id0] #0[Id] : B[WkId] }} by (eapply wf_exp_eq_conv; mauto 4).
+    assert {{ Γ, B B[WkId] B[(WkWk)Id0] : Type@i }} by mauto 3.
+    assert {{ Γ, B #0[Id0] #0[Id] : B[(WkWk)Id0] }} by mauto 3.
+    assert {{ Γ, B s (WkWk)Id0 ,, #0[Id0] WkId ,, #0[Id] : Γ, B }} by mauto 2.
+    assert {{ Γ, B s WkId ,, #0[Id] Id : Γ, B }} by mauto 4.
+    assert {{ Γ, B s q Wk Id0 Id : Γ, B }} by mauto 3.
+    assert {{ Γ, B C[q Wk Id0] C[Id] : Type@i }} by mauto 3.
+    enough {{ Γ, B M[Wk] #0 : C }}...
+ +
+  - econstructor...
+  - eapply wf_conv...
+  - assert {{ Γ s σ ,, M1[σ] : Δ, B}} by mauto.
+    assert {{ Δ , B B[Wk] : Type@i }} by mauto 4.
+    assert {{ Δ , B , B[Wk] B[Wk][Wk] : Type@i }} by mauto 4.
+    assert {{ Γ B[Wk][σ ,, M1[σ]] : Type@i}} by mauto.
+    assert {{ Γ B[Wk][σ ,, M1[σ]] B[σ] : Type@i}}.
+    {
+      transitivity {{{B[Wk (σ,,M1[σ])]}}};
+        [mauto | eapply exp_eq_sub_cong_typ2'; mauto].
+    }
+    assert {{ Γ M2[σ] : B[Wk][σ ,, M1[σ]]}}.
+    {
+      eapply wf_conv with (A:={{{B[σ]}}});
+        mauto 2.
+    }
+    assert {{ Γ s σ ,, M1[σ] ,, M2[σ] : Δ, B, B[Wk]}} by mauto 4.
+    assert {{ Δ, B, B[Wk] Eq (B[Wk][Wk]) # 1 # 0 : Type@i }} by (econstructor; mauto 4).
+ +
+    assert {{Γ B[Wk][Wk][σ,,M1[σ],,M2[σ]] B[σ] : Type@i}}.
+    {
+      transitivity {{{B[Wk][Wk (σ,,M1[σ],,M2[σ])]}}};
+        [mauto 4 | transitivity {{{B[Wk][σ,,M1[σ]]}}}];
+        [| transitivity {{{B[Wk (σ,,M1[σ])]}}};
+           [mauto 4 | ]];
+        eapply exp_eq_sub_cong_typ2';
+        mauto 4.
+    }
+
+    eapply wf_conv;
+      [econstructor | |]; mauto 3.
+    + eapply exp_sub_typ; try eassumption.
+      econstructor; mauto 2.
+      eapply wf_conv; mauto 2.
+      transitivity {{{Eq (B[σ]) (M1[σ]) (M2[σ])}}};
+        [mauto 4 | symmetry].
+      etransitivity;
+        [econstructor; mauto |].
+ +
+      econstructor; eauto.
+      * eapply wf_exp_eq_conv; mauto 4 using sub_lookup_var1.
+      * eapply wf_exp_eq_conv;
+          [eapply sub_lookup_var0 with (B:=B)| |];
+          mauto 4.
+ +
+    + assert {{ Δ s Id ,, M1 : Δ, B}} by mauto 4.
+      assert {{ Δ , B B[Wk] : Type@i }} by mauto 4.
+      assert {{ Δ , B , B[Wk] B[Wk][Wk] : Type@i }} by mauto 4.
+      assert {{ Δ B[Wk][Id,,M1] B : Type@i }}.
+      {
+        transitivity {{{B[Wk (Id,,M1)]}}};
+          [| transitivity {{{B[Id]}}}];
+          mauto 3.
+        eapply exp_eq_sub_cong_typ2'; mauto 3.
+      }
+      assert {{ Δ s Id ,, M1 ,, M2 : Δ, B , B[Wk]}}.
+      {
+        econstructor; mauto 3.
+        eapply wf_conv; mauto 2.
+      }
+      assert {{ Δ B[Wk][Wk][Id ,, M1 ,, M2] B : Type@i }}.
+      {
+        transitivity {{{B[Wk][Wk (Id ,, M1 ,, M2)]}}};
+          [| transitivity {{{B[Wk][Id ,, M1]}}}];
+          mauto 4.
+        eapply exp_eq_sub_cong_typ2'; mauto 4.
+        eapply wf_sub_eq_p_extend; mauto 4.
+      }
+      assert {{ Δ L : (Eq (B[Wk][Wk]) #1 #0) [ Id ,, M1 ,, M2]}}.
+      {
+        eapply wf_conv; mauto 2.
+        symmetry.
+        etransitivity.
+        - eapply wf_exp_eq_eq_sub; mauto.
+        - econstructor; mauto 3.
+          + eapply wf_exp_eq_conv;
+              [eapply id_sub_lookup_var1 with (B:=B) | |];
+              mauto 4.
+          + eapply wf_exp_eq_conv;
+              [eapply id_sub_lookup_var0 with (B:=B) | |];
+              mauto 4.
+      }
+      assert {{ Δ s Id ,, M1 ,, M2 ,, L : Δ, B , B[Wk], Eq (B[Wk][Wk]) #1 #0}} by mauto 4.
+ +
+      transitivity {{{ C[(Id,,M1,,M2,,L) σ ] }}};
+        [eapply exp_eq_sub_compose_typ | eapply exp_eq_sub_cong_typ2'];
+        mauto 3.
+ +
+      transitivity {{{(Id,,M1,,M2) σ ,, L[σ]}}};
+        [econstructor; mauto 3 |].
+      econstructor; mauto 3.
+      * transitivity {{{(Id,,M1) σ ,, M2[σ]}}}.
+        econstructor; mauto 4.
+        econstructor; mauto 3.
+        eapply exp_eq_refl.
+        eapply wf_conv; mauto 3.
+        eapply exp_eq_sub_cong_typ2'; mauto 3.
+      * eapply exp_eq_refl.
+        eapply wf_conv; mauto 3.
+ +
+  - assert {{ Δ s Id ,, M1 : Δ, B}} by mauto 4.
+    assert {{ Δ , B B[Wk] : Type@i }} by mauto 4.
+    assert {{ Δ , B , B[Wk] B[Wk][Wk] : Type@i }} by mauto 4.
+    assert {{ Γ B[Wk][σ ,, M1[σ]] : Type@i}} by mauto.
+    assert {{ Γ B[σ] : Type @ i }} by mauto 3.
+    assert {{ Γ M1[σ] : B[σ] }} by mauto 3.
+    assert {{ Γ M2[σ] : B[σ] }} by mauto 3.
+    assert {{ Γ B[Wk][σ ,, M1[σ]] B[σ] : Type@i}}.
+    {
+      transitivity {{{B[Wk (σ,,M1[σ])]}}};
+        [| eapply exp_eq_sub_cong_typ2']; mauto 4.
+    }
+    assert {{ Γ M2[σ] : B[Wk][σ ,, M1[σ]]}} by mauto 3.
+    assert {{ Γ s σ,, M1[σ] : Δ,B}} by mauto 3.
+    assert {{ Γ s σ ,, M1[σ] ,, M2[σ] : Δ, B, B[Wk]}} by mauto 3.
+    assert {{ Δ, B, B[Wk] Eq (B[Wk][Wk]) # 1 # 0 : Type@i }} by (econstructor; mauto 4).
+ +
+    assert {{Γ B[Wk][Wk][σ,,M1[σ],,M2[σ]] B[σ] : Type@i}}.
+    {
+      transitivity {{{B[Wk][Wk (σ,,M1[σ],,M2[σ])]}}};
+        [mauto 4 | transitivity {{{B[Wk][σ,,M1[σ]]}}}];
+        mauto 2.
+      eapply exp_eq_sub_cong_typ2';
+        mauto 4.
+    }
+    assert {{ Γ L[σ] : (Eq B M1 M2)[σ] }} by mauto 3.
+    assert {{ Γ L[σ] : Eq (B[σ]) (M1[σ]) (M2[σ]) }} by (eapply wf_conv; mauto 3).
+    assert {{ Γ #1[σ,,M1[σ],,M2[σ]] M1[σ] : B[Wk][Wk][σ,,M1[σ],,M2[σ]] }}.
+    {
+      eapply wf_exp_eq_conv;
+        [eapply sub_lookup_var1 with (B:=B) | |];
+        mauto 4.
+    }
+    assert {{ Γ #0[σ,,M1[σ],,M2[σ]] M2[σ] : B[Wk][Wk][σ,,M1[σ],,M2[σ]] }}.
+    {
+      eapply wf_exp_eq_conv;
+        [eapply sub_lookup_var0 with (B:=B) | |];
+        mauto 4.
+    }
+    assert {{ Γ L[σ] : (Eq (B[Wk][Wk]) #1 #0)[σ,,M1[σ],,M2[σ]] }}.
+    {
+      eapply wf_conv; mauto 2.
+      symmetry.
+      etransitivity.
+      - eapply wf_exp_eq_eq_sub; mauto.
+      - econstructor; mauto 3.
+    }
+    assert {{ Γ s σ,,M1[σ],,M2[σ],,L[σ] : Δ,B,B[Wk],Eq (B[Wk][Wk]) #1 #0}} by mauto 3.
+    assert {{Γ, B[σ] s q σ : Δ, B}} by mauto 4.
+    assert {{Γ, B[σ] B[σ][Wk] : Type@i}} by mauto 4.
+    assert {{Γ, B[σ], B[σ][Wk] B[σ][Wk][Wk] : Type@i}} by mauto.
+    assert {{Γ, B[σ], B[σ][Wk] Eq (B[σ][Wk][Wk]) # 1 # 0 : Type@i }} by (econstructor; mauto 3; mauto).
+    assert {{Γ, B[σ] B[Wk][q σ] B[σ][Wk] : Type@i}}.
+    {
+      transitivity {{{B[Wk q σ]}}};
+        [mauto 3 | transitivity {{{B[σ Wk]}}}];
+        [eapply exp_eq_sub_cong_typ2'; mauto 3 | mauto].
+    }
+    assert {{ Γ, B[σ], B[Wk][q σ] Γ, B[σ], B[σ][Wk]}} by (econstructor; mauto 3).
+    assert {{Γ, B[σ], B[σ][Wk] s q (q σ) : Δ, B, B[Wk]}}.
+    {
+      eapply ctxeq_sub; [| eapply sub_q]; mauto 2.
+    }
+    assert {{Γ, B[σ],B[σ][Wk] B[Wk][q σ Wk] : Type@i}} by mauto.
+    assert {{Γ, B[σ],B[σ][Wk] B[Wk][q σ Wk] B[σ][Wk][Wk] : Type@i}}.
+    {
+      transitivity {{{B[Wk][q σ][Wk]}}};
+        [mauto |].
+      eapply exp_eq_sub_cong_typ1; mauto 3.
+    }
+    assert {{Γ, B[σ],B[σ][Wk] B[Wk][Wk][q (q σ)] B[σ][Wk][Wk] : Type@i}}.
+    {
+      transitivity {{{B[Wk][Wk q (q σ)]}}};
+        [mauto 4| transitivity {{{B[Wk][q σ Wk]}}}];
+        [eapply exp_eq_sub_cong_typ2'; mauto 4 | trivial].
+    }
+    assert {{Γ, B[σ], B[σ][Wk] #1 : B[σ][Wk][Wk]}} by mauto.
+    assert {{Γ, B[σ], B[σ][Wk] Eq (B[σ][Wk][Wk]) #0 #0 : Type@i}} by (econstructor; mauto 3).
+    assert {{Γ, B[σ], B[σ][Wk] (Eq (B[Wk][Wk]) #1 #0)[q (q σ)] Eq (B[σ][Wk][Wk]) #1 #0 : Type@i}}.
+    {
+      transitivity {{{Eq (B[Wk][Wk][q (q σ)]) (#1[q (q σ)]) (#0[q (q σ)])}}};
+        [econstructor; mauto 4 |].
+      econstructor; mauto 2.
+      - eapply wf_exp_eq_conv;
+          [eapply ctxeq_exp_eq;[eassumption | eapply exp_eq_var_1_sub_q_sigma] | |];
+          mauto 2.
+      - eapply wf_exp_eq_conv.
+        econstructor; [mauto 4 | eauto | eapply wf_conv; mauto].
+        + mauto 2.
+        + mauto 4.
+    }
+    assert {{Γ, B[σ], B[σ][Wk], Eq (B[σ][Wk][Wk]) #1 #0 s q (q (q σ)) : Δ, B, B[Wk], Eq (B[Wk][Wk]) #1 #0}}.
+    {
+      eapply ctxeq_sub; [| eapply sub_q]; mauto 2.
+      econstructor; mauto 3.
+    }
+    assert {{Γ, B[σ] s Id,,#0 : Γ, B[σ], B[σ][Wk]}} by mauto 4.
+    assert {{Γ, B[σ] B[σ][Wk][Wk][Id,,#0] B[σ][Wk] : Type@i}}.
+    {
+      transitivity {{{B[σ][Wk][Wk (Id,,#0)]}}};
+        [mauto 4 |].
+      transitivity {{{B[σ][Wk][Id]}}};
+        [| mauto 3].
+      eapply exp_eq_sub_cong_typ2'; mauto 4.
+    }
+
+    assert {{Γ, B[σ] s Id,,#0,,refl (B[σ][Wk]) #0 : Γ, B[σ], B[σ][Wk], Eq (B[σ][Wk][Wk]) #1 #0}}.
+    {
+      econstructor; mauto 3.
+      eapply wf_conv;
+        [econstructor | |];
+        mauto 2.
+      - mauto 3.
+      - symmetry.
+        etransitivity; [econstructor; mauto 3 |].
+        econstructor; eauto.
+        + eapply wf_exp_eq_conv; mauto 2.
+          transitivity {{{#0[Id]}}}.
+          * eapply wf_exp_eq_conv; [econstructor | |];
+              mauto 3.
+            mauto 4.
+          * eapply wf_exp_eq_conv; mauto 4.
+        + eapply wf_exp_eq_conv;
+            [econstructor | |].
+          * mauto 3.
+          * mauto 2.
+          * mauto 4.
+          * mauto 2.
+          * etransitivity; mauto 2.
+    }
+    assert {{Γ, B[σ] s q (q σ) (Id,,#0) q σ,,#0 : Δ, B, B[Wk]}}.
+    {
+      eapply sub_eq_q_sigma_id_extend;
+        mauto 2.
+      eapply wf_conv; mauto 3.
+    }
+    assert {{Γ, B[σ] #0 : B[σ][Wk][Wk][Id,,#0]}} by (eapply wf_conv; mauto 3).
+    assert {{Γ, B[σ] #0[Id,,#0] #0 : B[σ][Wk][Id]}} by (econstructor; mauto 3).
+    assert {{Γ, B[σ] #0[Id,,#0] #0 : B[σ][Wk]}} by mauto 3.
+    assert {{Γ, B[σ] #0[Id,,#0] #0 : B[σ][Wk][Wk][Id,,#0]}} by mauto 4.
+    assert {{Γ, B[σ] (Eq (B[σ][Wk][Wk]) #0 #0)[Id,,#0] Eq (B[σ][Wk]) #0 #0 : Type@i}}.
+    {
+      etransitivity; econstructor; mauto 3.
+    }
+    assert {{Γ, B[σ] s (q (q σ) Wk) (Id,,#0,,refl (B[σ][Wk]) #0) : Δ, B, B[Wk]}}.
+    {
+      econstructor; mauto 3.
+      econstructor; mauto 3.
+    }
+    assert {{Γ, B[σ] s (q (q σ) Wk) (Id,,#0,,refl (B[σ][Wk]) #0)
+                   q (q σ) (Id,,#0) : Δ, B, B[Wk]}}.
+    {
+      transitivity {{{q (q σ) (Wk (Id,,#0,,refl (B[σ][Wk]) #0))}}};
+        [mauto 4 |].
+      econstructor; mauto 3.
+      eapply wf_sub_eq_p_extend with (A:={{{Eq (B[σ][Wk][Wk]) #0 #0}}}); mauto 2.
+ +
+      eapply wf_conv;
+        [econstructor; mauto 3 | eapply exp_sub_typ; mauto 3 |].
+ +
+      symmetry.
+      etransitivity;
+        [econstructor; mauto 3 |].
+      econstructor; mauto 3.
+    }
+    assert {{Γ, B[σ] s (q (q σ) Wk) (Id,,#0,,refl (B[σ][Wk]) #0)
+                   q σ,,#0 : Δ, B, B[Wk]}} by mauto 4.
+    assert {{Γ, B[σ] B[σ][Wk][Wk][Id,,#0] B[Wk][q σ] : Type@i}} by mauto 3.
+    assert {{Γ, B[σ] B[Wk][Wk][q σ,,#0] B[Wk][q σ] : Type@i}}.
+    {
+      transitivity {{{B[Wk][Wk (q σ,,#0)]}}};
+        [eapply exp_eq_sub_compose_typ; mauto 4 |].
+      symmetry.
+      eapply exp_eq_sub_cong_typ2'; mauto 3.
+      symmetry.
+      mauto 4.
+    }
+    assert {{Γ, B[σ] s q σ,,#0 : Δ, B, B[Wk] }} by (econstructor; mauto 3).
+    assert {{Γ, B[σ] B[Wk][Wk][q σ,,#0] : Type@i}} by mauto 3.
+    assert {{Γ, B[σ] B[Wk][Wk][q σ,,#0] B[σ][Wk] : Type@i}} by mauto 4.
+    assert {{ Γ, B[σ] #0[q σ,,#0] # 0 : B[σ][Wk] }}.
+    {
+      eapply wf_exp_eq_conv;
+        [econstructor | |];
+        mauto 2.
+      mauto 3.
+    }
+    assert {{ Γ, B[σ] #0[q σ,,#0] # 0 : B[Wk][Wk][q σ,,#0] }} by mauto 3.
+ +
+    assert {{ Γ, B[σ] s σ Wk : Δ }} by mauto 4.
+    assert {{ Γ, B[σ] # 0 : B[σ][Wk] }} by mauto 2.
+    assert {{ Γ, B[σ] B[σ][Wk] B[σ Wk] : Type@i }} by mauto 4.
+    assert {{ Γ, B[σ] # 0 : B[σ Wk] }} by mauto 3.
+ +
+    assert {{ Γ, B[σ] #1[q σ,,#0] # 0 : B[σ][Wk] }}.
+    {
+      eapply wf_exp_eq_conv with (A:={{{B[σ Wk]}}});
+        [eapply sub_lookup_var1; eauto | |];
+        mauto 2.
+    }
+    assert {{ Γ, B[σ] #1[q σ,,#0] # 0 : B[Wk][Wk][q σ,,#0] }} by mauto 3.
+ +
+    assert {{Γ, B[σ] s q (q (q σ)) (Id,,#0,,refl (B[σ][Wk]) #0)
+                   (q (q σ) (Id,,#0)),,refl (B[σ][Wk]) #0
+          : Δ, B, B[Wk], Eq (B[Wk][Wk]) # 1 # 0}}.
+    {
+      etransitivity;
+        [eapply wf_sub_eq_extend_compose; mauto 2; mauto 4 |].
+ +
+      - eapply wf_conv; mauto 3.
+        + mauto.
+        + symmetry.
+          transitivity {{{(Eq (B[Wk][Wk]) #1 #0)[q (q σ)][Wk]}}};
+            [mauto |].
+          eapply exp_eq_sub_cong_typ1; mauto 4.
+      - econstructor; mauto 3.
+ +
+        eapply wf_exp_eq_conv.
+        econstructor; mauto 3.
+        + eapply wf_conv; [econstructor | |]; mauto 3.
+        + eapply exp_sub_typ; mauto 3.
+        + etransitivity; eauto.
+          symmetry.
+          etransitivity; [| etransitivity].
+          * eapply exp_eq_sub_cong_typ2'; mauto 3.
+          * econstructor; mauto 4.
+          * econstructor; mauto 2.
+    }
+
+    assert {{ Δ, B, B[Wk]}} by mauto 3.
+    assert {{Δ, B, B[Wk] #0 : B[Wk][Wk]}} by mauto 4.
+    assert {{Δ, B, B[Wk] #1 : B[Wk][Wk]}} by mauto 4.
+    assert {{Γ, B[σ] B[Wk][Wk][q (q σ) (Id,,#0)] B[Wk][q σ] : Type@i}} by mauto 4.
+    assert {{Γ, B[σ] B[Wk][Wk][q (q σ) (Id,,#0)] B[σ][Wk] : Type@i}} by mauto 4.
+ +
+    assert {{ Γ, B[σ] #0[q (q σ) (Id,,#0)] # 0 : B[σ][Wk] }}.
+    {
+      transitivity {{{#0[q σ,,#0]}}}.
+      - symmetry.
+        eapply wf_exp_eq_conv;
+          [econstructor | |]; mauto 2.
+      - eauto.
+    }
+    assert {{ Γ, B[σ] #0[q (q σ) (Id,,#0)] # 0 : B[Wk][Wk][q (q σ) (Id,,#0)] }} by
+      (eapply wf_exp_eq_conv; mauto 3).
+ +
+    assert {{ Γ, B[σ] #1[q (q σ) (Id,,#0)] # 0 : B[σ][Wk] }}.
+    {
+      transitivity {{{#1[q σ,,#0]}}}.
+      - symmetry.
+        eapply wf_exp_eq_conv;
+          [econstructor | |]; mauto 2.
+      - eauto.
+    }
+    assert {{ Γ, B[σ] #1[q (q σ) (Id,,#0)] # 0 : B[Wk][Wk][q (q σ) (Id,,#0)] }} by
+      (eapply wf_exp_eq_conv; mauto 3).
+ +
+    assert {{Γ, B[σ] s q (q (q σ)) (Id,,#0,,refl (B[σ][Wk]) #0)
+                   q σ,,#0,,refl (B[σ][Wk]) #0 : Δ, B, B[Wk], Eq (B[Wk][Wk]) # 1 # 0}}.
+    {
+      etransitivity; eauto.
+      econstructor; mauto 3.
+      eapply exp_eq_refl.
+      eapply wf_conv; mauto 3.
+      symmetry.
+      etransitivity.
+      - econstructor; mauto 2.
+      - econstructor; mauto 2.
+    }
+
+    assert {{Γ, B[σ] s Id q σ : Δ, B}} by mauto 3.
+    assert {{Γ, B[σ] s Id q σ q σ : Δ, B}} by mauto 3.
+    assert {{Γ, B[σ] #0[q σ] #0 : B[σ Wk]}} by mauto 3.
+    assert {{Γ, B[σ] #0[q σ] #0 : B[σ][Wk]}} by mauto 3.
+    assert {{Γ, B[σ] #0[q σ] #0 : B[Wk][q σ]}} by mauto 4.
+    assert {{Γ, B[σ] s (Id,,#0) q σ : Δ, B, B[Wk]}} by (econstructor; mauto 3).
+    assert {{Γ, B[σ] s (Id,,#0) q σ q σ,,#0 : Δ, B, B[Wk]}}.
+    {
+      etransitivity.
+      - eapply wf_sub_eq_extend_compose; mauto 3.
+      - econstructor; mauto 3.
+        eapply wf_exp_eq_conv; mauto 2.
+        eapply exp_eq_sub_cong_typ2'; mauto 3.
+    }
+
+    assert {{Δ, B B[Wk][Wk][Id,,#0] B[Wk] : Type@i }}.
+    {
+      transitivity {{{B[Wk][Wk (Id,,#0)]}}}; [ |transitivity{{{B[Wk][Id]}}}].
+      - eapply exp_eq_sub_compose_typ; mauto 3.
+      - eapply exp_eq_sub_cong_typ2'; mauto 3.
+        econstructor; mauto 3.
+      - mauto 3.
+    }
+    assert {{Δ, B #0[Id ,, #0] #0 : B[Wk]}}.
+    {
+      eapply wf_exp_eq_conv;
+      [econstructor | |]; mauto 3.
+    }
+    assert {{Δ, B B[Wk][Wk][Id,,#0] : Type@i }} by (eapply exp_sub_typ; mauto 3).
+    assert {{Δ, B #0[Id ,, #0] #0 : B[Wk][Wk][Id,,#0]}} by (eapply wf_exp_eq_conv; mauto 2).
+    assert {{Δ, B #1[Id ,, #0] #0 : B[Wk]}}.
+    {
+      transitivity {{{#0[Id]}}}; mauto 3.
+      eapply wf_exp_eq_conv;
+        [econstructor | |]; mauto 3.
+      eapply wf_conv; mauto 3.
+      symmetry.
+      mauto 3.
+    }
+    assert {{Δ, B #1[Id ,, #0] #0 : B[Wk][Wk][Id,,#0]}} by (eapply wf_exp_eq_conv; mauto 2).
+ +
+    assert {{Δ, B refl (B[Wk]) #0 : (Eq (B[Wk][Wk]) #1 #0)[Id ,, #0]}}.
+    {
+      eapply wf_conv; mauto 3.
+      - mauto 4.
+      - symmetry.
+        etransitivity.
+        + econstructor; mauto 3.
+        + econstructor; mauto 3.
+    }
+
+    assert {{ Γ, B[σ] (Eq B[Wk] #0 #0)[q σ] Eq B[σ][Wk] #0 #0 : Type@i }}.
+    {
+      etransitivity;
+        [econstructor; mauto 2 |];
+        mauto 3.
+    }
+
+    assert {{ Γ, B[σ] B[Wk][Wk][(Id,,#0)q σ] B[σ][Wk] : Type@i }} by mauto 3.
+ +
+    assert {{ Γ, B[σ] #1[(Id,,#0)q σ] #0 : B[σ][Wk] }}.
+    {
+      transitivity {{{#1[q σ,,#0]}}};
+        [eapply wf_exp_eq_conv |];
+        mauto 3.
+    }
+    assert {{ Γ, B[σ] #1[(Id,,#0)q σ] #0 : B[Wk][Wk][(Id,,#0)q σ] }} by mauto 4.
+ +
+    assert {{ Γ, B[σ] #0[(Id,,#0)q σ] #0 : B[σ][Wk] }}.
+    {
+      transitivity {{{#0[q σ,,#0]}}};
+        [eapply wf_exp_eq_conv |];
+        mauto 3.
+    }
+    assert {{ Γ, B[σ] #0[(Id,,#0)q σ] #0 : B[Wk][Wk][(Id,,#0)q σ] }} by mauto 4.
+ +
+    assert {{ Γ, B[σ] (Eq B[Wk][Wk] #1 #0)[(Id,,#0)q σ] Eq B[σ][Wk] #0 #0 : Type@i }}.
+    {
+      etransitivity; econstructor; mauto 2.
+    }
+
+    assert {{Γ, B[σ] s (Id,,#0,,refl (B[Wk]) #0) q σ
+                   q σ,,#0,,refl (B[σ][Wk]) #0 : Δ, B, B[Wk], Eq (B[Wk][Wk]) # 1 # 0}}.
+    {
+      etransitivity.
+      - eapply wf_sub_eq_extend_compose; mauto 3.
+      - econstructor; mauto 2.
+        etransitivity.
+        + eapply wf_exp_eq_conv;
+            [eapply wf_exp_eq_refl_sub; mauto 3 |
+             eapply exp_sub_typ; mauto 3 |].
+          mauto 3.
+        + eapply wf_exp_eq_conv;
+            [econstructor | |];
+            mauto 2.
+          etransitivity; mauto 2.
+    }
+
+    assert {{ Δ, B s Id,,#0,,refl B[Wk] #0 : ((Δ, B), B[Wk]), Eq B[Wk][Wk] #1 #0 }} by mauto 4.
+ +
+    assert {{ Γ s Id,,M1[σ] : Γ,B[σ]}} by mauto 2.
+    assert {{ Γ B[σ][Wk][Id ,, M1[σ]] B[σ] : Type@i}}.
+    {
+      etransitivity;
+        [eapply exp_eq_sub_compose_typ; mauto 3 |];
+        transitivity {{{B[σ][Id]}}}; mauto 2.
+      symmetry.
+      eapply exp_eq_sub_cong_typ2';
+        mauto 3.
+    }
+    assert {{ Γ M2[σ] : B[σ][Wk][Id ,, M1[σ]]}} by mauto 4.
+    assert {{ Γ s Id ,, M1[σ] ,, M2[σ] : Γ, B[σ], B[σ][Wk]}} by mauto 3.
+ +
+    assert {{ Γ B[σ][Wk][Wk][Id,,M1[σ],,M2[σ]] B[σ] : Type@i }}.
+    {
+      etransitivity;
+        [eapply exp_eq_sub_compose_typ; mauto 3 |];
+        transitivity {{{B[σ][Wk][Id,,M1[σ]]}}}; mauto 3.
+      symmetry.
+      eapply exp_eq_sub_cong_typ2';
+        mauto 3.
+    }
+
+    assert {{ Γ #1[Id,,M1[σ],,M2[σ]] M1[σ] : B[σ] }}.
+    {
+      transitivity {{{#0[Id,,M1[σ]]}}};
+        [eapply wf_exp_eq_conv | eapply wf_exp_eq_conv; econstructor];
+        mauto 3.
+    }
+    assert {{ Γ #1[Id,,M1[σ],,M2[σ]] M1[σ] : B[σ][Wk][Wk][Id,,M1[σ],,M2[σ]] }} by mauto 4.
+ +
+    assert {{ Γ #0[Id,,M1[σ],,M2[σ]] M2[σ] : B[σ] }}
+      by (eapply wf_exp_eq_conv; mauto 3).
+    assert {{ Γ #0[Id,,M1[σ],,M2[σ]] M2[σ] : B[σ][Wk][Wk][Id,,M1[σ],,M2[σ]] }} by mauto 4.
+ +
+    assert {{ Γ (Eq B[σ][Wk][Wk] #1 #0)[Id ,, M1[σ] ,, M2[σ]] Eq B[σ] M1[σ] M2[σ] : Type@i }}
+      by (etransitivity; econstructor; mauto 3).
+    assert {{ Γ L[σ] : (Eq B[σ][Wk][Wk] #1 #0)[Id ,, M1[σ] ,, M2[σ]] }} by mauto 4.
+ +
+    assert {{ Γ s Id ,, M1[σ] ,, M2[σ] ,, L[σ] : Γ, B[σ], B[σ][Wk], Eq B[σ][Wk][Wk] #1 #0}} by mauto 3.
+ +
+    assert {{ (Γ, B[σ]), B[σ][Wk] B[Wk][q σWk] B[σ][Wk][Wk] : Type@i }}.
+    {
+      transitivity {{{B[Wk][q σ][Wk]}}};
+        [symmetry;
+         eapply exp_eq_sub_compose_typ; mauto 3 |].
+      eapply exp_eq_sub_cong_typ1; mauto 3.
+    }
+
+    assert {{ (Γ, B[σ]), B[σ][Wk] #0 : B[Wk][q σWk] }}
+      by (eapply wf_conv; mauto 3).
+ +
+    assert {{ ((Γ, B[σ]), B[σ][Wk]), Eq B[σ][Wk][Wk] #1 #0 s q (q σ)Wk : Δ,B,B[Wk] }} by mauto 4.
+    assert {{ ((Γ, B[σ]), B[σ][Wk]), Eq B[σ][Wk][Wk] #1 #0 (Eq B[Wk][Wk] #1 #0)[q (q σ)Wk] (Eq B[σ][Wk][Wk] #1 #0)[Wk] : Type@i }}.
+    {
+      transitivity {{{(Eq B[Wk][Wk] #1 #0)[q (q σ)][Wk]}}};
+        [symmetry;
+         eapply exp_eq_sub_compose_typ; mauto 3 |].
+      eapply exp_eq_sub_cong_typ1; mauto 3.
+    }
+
+
+    assert {{ Δ,B,B[Wk] Eq B[Wk][Wk] #1 #0 : Type@i }} by mauto 3.
+    assert {{ ((Γ, B[σ]), B[σ][Wk]), Eq B[σ][Wk][Wk] #1 #0 #0 : (Eq B[Wk][Wk] #1 #0)[q (q σ)Wk] }}.
+    {
+      eapply wf_conv; mauto 3.
+    }
+
+    assert {{ Γ s (q σ Wk) (Id,,M1[σ],,M2[σ]) : Δ, B }}
+             by (econstructor; mauto 4).
+    assert {{ Γ s (q σ Wk) (Id,,M1[σ],,M2[σ]) σ,,M1[σ] : Δ, B }}.
+    {
+      etransitivity;
+        [eapply wf_sub_eq_compose_assoc; mauto 3 |].
+      etransitivity;
+        [eapply wf_sub_eq_compose_cong;
+         [eapply wf_sub_eq_p_extend with (A:={{{B[σ][Wk]}}}) | eapply sub_eq_refl] |];
+        mauto 3.
+    }
+
+    assert {{ Γ B[Wk][(q σWk)(Id,,M1[σ],,M2[σ])] B[σ] : Type@i }}.
+    {
+      transitivity {{{B[Wk][σ,,M1[σ]]}}};
+        [eapply exp_eq_sub_cong_typ2' |]; mauto 3.
+    }
+    assert {{ Γ #0[Id,,M1[σ],,M2[σ]] M2[σ] : B[Wk][(q σWk)(Id,,M1[σ],,M2[σ])] }} by mauto 4.
+    assert {{ Γ s q (q σ) (Id,,M1[σ],,M2[σ]) σ,,M1[σ],,M2[σ] : Δ, B, B[Wk] }}.
+    {
+      etransitivity;
+        [eapply wf_sub_eq_extend_compose; mauto 4 |].
+      econstructor; mauto 2.
+    }
+    assert {{ Γ s (q (q σ)Wk)(Id,,M1[σ],,M2[σ],,L[σ]) : (Δ, B), B[Wk] }}
+      by (econstructor; mauto 4).
+    assert {{ Γ s (q (q σ) Wk) (Id,,M1[σ],,M2[σ],,L[σ]) σ,,M1[σ],,M2[σ] : Δ, B, B[Wk] }}.
+    {
+      etransitivity;
+        [eapply wf_sub_eq_compose_assoc; mauto 3 |].
+      etransitivity;
+        [eapply wf_sub_eq_compose_cong;
+         [eapply wf_sub_eq_p_extend with (A:={{{Eq B[σ][Wk][Wk] #1 #0}}}) | eapply sub_eq_refl] |];
+        mauto 3.
+    }
+
+    assert {{ Γ (Eq B[Wk][Wk] #1 #0)[σ,,M1[σ],,M2[σ]] Eq B[σ] M1[σ] M2[σ] : Type@i }}.
+    {
+      etransitivity;
+        econstructor; mauto 3.
+    }
+    assert {{ Γ (Eq B[Wk][Wk] #1 #0)[(q (q σ)Wk)(Id,,M1[σ],,M2[σ],,L[σ])] Eq B[σ] M1[σ] M2[σ] : Type@i }}.
+    {
+      transitivity {{{(Eq B[Wk][Wk] #1 #0)[σ,,M1[σ],,M2[σ]]}}};
+        [eapply exp_eq_sub_cong_typ2' |]; mauto 3.
+    }
+    assert {{ Γ #0[Id,,M1[σ],,M2[σ],,L[σ]] L[σ] : (Eq B[Wk][Wk] #1 #0)[(q (q σ)Wk)(Id,,M1[σ],,M2[σ],,L[σ])] }}.
+    {
+      eapply wf_exp_eq_conv with (A:={{{Eq B[σ] M1[σ] M2[σ]}}});
+        econstructor; mauto 3.
+    }
+    assert {{ Γ s q (q (q σ)) (Id,,M1[σ],,M2[σ],,L[σ]) σ,,M1[σ],,M2[σ],,L[σ] : Δ, B, B[Wk], Eq B[Wk][Wk] #1 #0 }}.
+    {
+      etransitivity;
+        [eapply wf_sub_eq_extend_compose; mauto 4 |].
+      econstructor; mauto 2.
+    }
+
+    assert {{Γ, B[σ] s (Id,,#0,,refl (B[Wk]) #0) q σ
+                   q (q (q σ)) (Id,,#0,,refl (B[σ][Wk]) #0)
+          : Δ, B, B[Wk], Eq (B[Wk][Wk]) # 1 # 0}} by mauto 3.
+ +
+    eapply wf_conv;
+    [econstructor | |];
+      mauto 2.
+    + eapply wf_conv; mauto 3.
+    + etransitivity;
+        [eapply exp_eq_sub_compose_typ | eapply exp_eq_sub_cong_typ2'];
+        mauto 3.
+ +
+  - eexists.
+    eapply exp_sub_typ; mauto 2.
+    assert {{ Δ s Id ,, M1 : Δ, B}} by mauto 4.
+    assert {{ Δ , B B[Wk] : Type@i }} by mauto 4.
+    assert {{ Δ , B , B[Wk] B[Wk][Wk] : Type@i }} by mauto 4.
+    assert {{ Γ B[Wk][σ ,, M1[σ]] : Type@i}} by mauto.
+    assert {{ Γ B[σ] : Type @ i }} by mauto 3.
+    assert {{ Γ M1[σ] : B[σ] }} by mauto 3.
+    assert {{ Γ M2[σ] : B[σ] }} by mauto 3.
+    assert {{ Γ B[Wk][σ ,, M1[σ]] B[σ] : Type@i}}.
+    {
+      transitivity {{{B[Wk (σ,,M1[σ])]}}};
+        [| eapply exp_eq_sub_cong_typ2']; mauto 4.
+    }
+    assert {{ Γ M2[σ] : B[Wk][σ ,, M1[σ]]}} by mauto 3.
+    assert {{ Γ s σ,, M1[σ] : Δ,B}} by mauto 3.
+    assert {{ Γ s σ ,, M1[σ] ,, M2[σ] : Δ, B, B[Wk]}} by mauto 3.
+    assert {{ Δ, B, B[Wk] Eq (B[Wk][Wk]) # 1 # 0 : Type@i }} by (econstructor; mauto 4).
+ +
+    assert {{Γ B[Wk][Wk][σ,,M1[σ],,M2[σ]] B[σ] : Type@i}}.
+    {
+      transitivity {{{B[Wk][Wk (σ,,M1[σ],,M2[σ])]}}};
+        [mauto 4 | transitivity {{{B[Wk][σ,,M1[σ]]}}}];
+        mauto 2.
+      eapply exp_eq_sub_cong_typ2';
+        mauto 4.
+    }
+    assert {{ Γ L[σ] : (Eq B M1 M2)[σ] }} by mauto 3.
+    assert {{ Γ L[σ] : Eq (B[σ]) (M1[σ]) (M2[σ]) }} by (eapply wf_conv; mauto 3).
+    assert {{ Γ L[σ] : (Eq (B[Wk][Wk]) #1 #0)[σ,,M1[σ],,M2[σ]] }}.
+    {
+      eapply wf_conv; mauto 2.
+      symmetry.
+      etransitivity.
+      - eapply wf_exp_eq_eq_sub; mauto.
+      - econstructor; mauto 3.
+        + eapply wf_exp_eq_conv;
+            [eapply sub_lookup_var1 with (B:=B) | |];
+            mauto 4.
+        + eapply wf_exp_eq_conv;
+            [eapply sub_lookup_var0 with (B:=B) | |];
+            mauto 4.
+    }
+    mauto 3.
+ +
+  - eapply wf_conv; [mauto 3 | mauto 2 |].
+    symmetry. mauto 3.
+ +
+  - assert {{ Γ s Id ,, M1 : Γ, B}} by mauto 4.
+    assert {{ Γ , B B[Wk] : Type@i }} by mauto 4.
+    assert {{ Γ , B , B[Wk] B[Wk][Wk] : Type@i }} by mauto 4.
+    assert {{ Γ B[Wk][Id,,M1] B : Type@i }}.
+    {
+      transitivity {{{B[Wk (Id,,M1)]}}};
+        [| transitivity {{{B[Id]}}}];
+        mauto 3.
+      eapply exp_eq_sub_cong_typ2'; mauto 3.
+    }
+    assert {{ Γ s Id ,, M1 ,, M2 : Γ, B , B[Wk]}}.
+    {
+      econstructor; mauto 3.
+      eapply wf_conv; mauto 2.
+    }
+    assert {{ Γ B[Wk][Wk][Id ,, M1 ,, M2] B : Type@i }}.
+    {
+      transitivity {{{B[Wk][Wk (Id ,, M1 ,, M2)]}}};
+        [| transitivity {{{B[Wk][Id ,, M1]}}}];
+        mauto 4.
+      eapply exp_eq_sub_cong_typ2'; mauto 4.
+      eapply wf_sub_eq_p_extend; mauto 4.
+    }
+    assert {{ Γ, B, B[Wk] Eq (B[Wk][Wk]) # 1 # 0 : Type@i }} by (econstructor; mauto 4).
+    assert {{ Γ #1[Id,,M1,,M2] M1 : B[Wk][Wk][Id,,M1,,M2] }}.
+    {
+      eapply wf_exp_eq_conv;
+        [eapply id_sub_lookup_var1 with (B:=B) | |];
+        mauto 4.
+    }
+    assert {{ Γ #0[Id,,M1,,M2] M2 : B[Wk][Wk][Id,,M1,,M2] }}.
+    {
+      eapply wf_exp_eq_conv;
+        [eapply id_sub_lookup_var0 with (B:=B) | |];
+        mauto 4.
+    }
+    assert {{ Γ L : (Eq (B[Wk][Wk]) #1 #0) [ Id ,, M1 ,, M2]}}.
+    {
+      eapply wf_conv; mauto 2.
+      symmetry.
+      etransitivity.
+      - eapply wf_exp_eq_eq_sub; mauto.
+      - econstructor; mauto 3.
+    }
+    assert {{ Γ s Id ,, M1 ,, M2 ,, L : Γ, B , B[Wk], Eq (B[Wk][Wk]) #1 #0}} by mauto 4.
+    assert {{ Γ Eq B' M1' M2' : Type @ i }} by mauto 4.
+    assert {{ Γ Eq B' M1' M2' Eq B M1 M2 : Type @ i }} by (symmetry; mauto 3).
+ +
+    assert {{ Γ, B Γ, B' }} by mauto 3.
+    assert {{ Γ , B B'[Wk] : Type@i }} by mauto 4.
+    assert {{ Γ , B' B'[Wk] : Type@i }} by mauto 4.
+    assert {{ Γ, B B[Wk] B'[Wk] : Type@i }} by mauto 3.
+    assert {{ Γ, B' B[Wk] B'[Wk] : Type@i }} by mauto 3.
+    assert {{ Γ, B, B[Wk] Γ, B', B'[Wk] }} by mauto 4.
+ +
+    assert {{ Γ, B', B'[Wk] Eq (B[Wk][Wk]) # 1 # 0 : Type@i }} by mauto 3.
+    assert {{ Γ, B', B'[Wk] Eq (B'[Wk][Wk]) # 1 # 0 : Type@i }} by (econstructor; mauto 4).
+    assert {{ Γ, B, B[Wk] Eq (B'[Wk][Wk]) # 1 # 0 : Type@i }} by mauto 3.
+    assert {{ (Γ, B), B[Wk] Eq B[Wk][Wk] #1 #0 Eq B'[Wk][Wk] #1 #0 : Type@i }} by (econstructor; mauto 4).
+ +
+    assert {{ Γ, B, B[Wk], Eq (B[Wk][Wk]) #1 #0 Γ, B', B'[Wk], Eq (B'[Wk][Wk]) #1 #0 }} by mauto 3.
+ +
+    assert {{ Γ, B Eq B[Wk] #0 #0 : Type@i }} by (econstructor; mauto 2).
+    assert {{ Γ, B Eq B'[Wk] #0 #0 Eq B[Wk] #0 #0 : Type@i }} by (econstructor; mauto 3).
+ +
+    assert {{ Γ, B refl B'[Wk] #0 : Eq (B[Wk]) #0 #0 }}.
+    {
+      eapply wf_conv;
+      [econstructor | |]; mauto 3.
+    }
+    assert {{ Γ, B refl B[Wk] #0 : Eq (B[Wk]) #0 #0 }} by mauto 4.
+    assert {{ Γ, B refl B[Wk] #0 refl B'[Wk] #0 : Eq (B[Wk]) #0 #0 }} by mauto 3.
+    assert {{ Γ, B s Id,,#0 : Γ, B, B[Wk] }} by mauto 3.
+    assert {{ (Γ, B), B[Wk] #1 : B[Wk][Wk] }} by mauto 4.
+    assert {{ Γ, B s Wk(Id,,#0) : Γ, B }} by (econstructor; mauto 3).
+    assert {{ Γ, B B[Wk][Wk][Id,,#0] B[Wk] : Type@i }}.
+    {
+      transitivity {{{B[Wk][Wk (Id,,#0)]}}};
+        [eapply exp_eq_sub_compose_typ |
+         transitivity {{{B[Wk][Id]}}} ];
+        mauto 3.
+      eapply exp_eq_sub_cong_typ2'; mauto 3.
+    }
+    assert {{ Γ, B #1[Id,,#0] #0 : B[Wk] }}.
+    {
+      transitivity {{{#0[Id]}}}.
+      - eapply wf_exp_eq_conv;
+          [eapply wf_exp_eq_var_S_sub with (A:={{{B[Wk]}}}) | |];
+          mauto 3.
+      - mauto 3.
+    }
+    assert {{ Γ, B #1[Id,,#0] #0 : B[Wk][Wk][Id,,#0] }} by mauto 4.
+    assert {{ Γ, B #0[Id,,#0] #0 : B[Wk] }}.
+    {
+      eapply wf_exp_eq_conv;
+        [eapply wf_exp_eq_var_0_sub with (A:={{{B[Wk]}}}) | |];
+        mauto 3.
+    }
+    assert {{ Γ, B #0[Id,,#0] #0 : B[Wk][Wk][Id,,#0] }} by mauto 4.
+    assert {{ Γ, B (Eq B[Wk][Wk] #1 #0)[Id,,#0] Eq (B[Wk]) #0 #0 : Type@i }}.
+    {
+      etransitivity; econstructor; mauto 3.
+    }
+    assert {{ Γ, B refl B'[Wk] #0 : (Eq B[Wk][Wk] #1 #0)[Id,,#0] }} by mauto 4.
+    assert {{ Γ, B refl B[Wk] #0 : (Eq B[Wk][Wk] #1 #0)[Id,,#0] }} by mauto 4.
+    assert {{ Γ, B s Id,,#0,,refl B'[Wk] #0 : Γ, B, B[Wk], Eq (B[Wk][Wk]) #1 #0 }} by mauto 4.
+    assert {{ Γ, B s Id,,#0,,refl B[Wk] #0 : Γ, B, B[Wk], Eq (B[Wk][Wk]) #1 #0 }} by mauto 4.
+ +
+    assert {{ Γ, B s Id,,#0,,refl B[Wk] #0 Id,,#0,,refl B'[Wk] #0 : Γ, B, B[Wk], Eq (B[Wk][Wk]) #1 #0 }}
+      by (econstructor; mauto 4).
+ +
+    assert {{ Γ, B C[Id,,#0,,refl B[Wk] #0] C'[Id,,#0,,refl B'[Wk] #0] : Type@j }}.
+    {
+      etransitivity;
+        [eapply exp_eq_sub_cong_typ2' |
+          eapply exp_eq_sub_cong_typ1];
+        mauto 3.
+    }
+
+    assert {{ Γ M1 M1' : B[Id] }} by (eapply wf_exp_eq_conv; mauto 3).
+    assert {{ Γ s Id,,M1 Id,,M1' : Γ, B }} by mauto 3.
+    assert {{ Γ M2 M2' : B[Wk][Id,,M1] }} by (eapply wf_exp_eq_conv; mauto 3).
+    assert {{ Γ s Id,,M1,,M2 Id,,M1',,M2' : Γ, B, B[Wk] }} by mauto 3.
+ +
+    assert {{ Γ (Eq B[Wk][Wk] #1 #0)[Id,,M1,,M2] Eq B M1 M2 : Type@i }}.
+    {
+      etransitivity;
+        econstructor; mauto 3.
+    }
+    assert {{ Γ s Id,,M1,,M2,,L Id,,M1',,M2',,L' : Γ, B, B[Wk], Eq (B[Wk][Wk]) #1 #0 }}
+      by (econstructor; mauto 4).
+ +
+    assert {{ Γ s Id ,, M1' : Γ, B}} by mauto 4.
+    assert {{ Γ B[Wk][Id,,M1'] B : Type@i }}.
+    {
+      transitivity {{{B[Wk (Id,,M1')]}}};
+        [| transitivity {{{B[Id]}}}];
+        mauto 3.
+      eapply exp_eq_sub_cong_typ2'; mauto 3.
+    }
+    assert {{ Γ M2' : B[Wk][Id,,M1'] }} by mauto 4.
+    assert {{ Γ s Id,,M1',,M2' : Γ, B, B[Wk]}} by mauto 3.
+ +
+    assert {{ Γ (Eq B[Wk][Wk] #1 #0)[Id,,M1',,M2'] Eq B M1 M2 : Type@i }}.
+    {
+      etransitivity;
+        [eapply exp_eq_sub_cong_typ2' | ];
+        cycle 1.
+      - eauto.
+      - symmetry. eauto.
+      - eauto.
+      - eauto.
+    }
+    assert {{ Γ L' : (Eq B[Wk][Wk] #1 #0)[Id,,M1',,M2'] }} by mauto 4.
+    assert {{ Γ s Id,,M1',,M2',,L' : ((Γ, B), B[Wk]), Eq B[Wk][Wk] #1 #0 }} by mauto 3.
+ +
+    eapply wf_conv;
+      [econstructor; mauto 3 | mauto 2 | ].
+    + eapply ctxeq_exp; eauto.
+      eapply wf_conv;
+        mauto 2.
+    + etransitivity;
+        [eapply exp_eq_sub_cong_typ2' |
+          eapply exp_eq_sub_cong_typ1];
+        mauto 3.
+ +
+  - eexists.
+    eapply exp_sub_typ; mauto 2.
+    assert {{ Γ s Id ,, M1 : Γ, B}} by mauto 4.
+    assert {{ Γ , B B[Wk] : Type@i }} by mauto 4.
+    assert {{ Γ , B , B[Wk] B[Wk][Wk] : Type@i }} by mauto 4.
+    assert {{ Γ B[Wk][Id,,M1] B : Type@i }}.
+    {
+      transitivity {{{B[Wk (Id,,M1)]}}};
+        [| transitivity {{{B[Id]}}}];
+        mauto 3.
+      eapply exp_eq_sub_cong_typ2'; mauto 3.
+    }
+    assert {{ Γ s Id ,, M1 ,, M2 : Γ, B , B[Wk]}}.
+    {
+      econstructor; mauto 3.
+      eapply wf_conv; mauto 2.
+    }
+    assert {{ Γ B[Wk][Wk][Id ,, M1 ,, M2] B : Type@i }}.
+    {
+      transitivity {{{B[Wk][Wk (Id ,, M1 ,, M2)]}}};
+        [| transitivity {{{B[Wk][Id ,, M1]}}}];
+        mauto 4.
+      eapply exp_eq_sub_cong_typ2'; mauto 4.
+      eapply wf_sub_eq_p_extend; mauto 4.
+    }
+    assert {{ Γ, B, B[Wk] Eq (B[Wk][Wk]) # 1 # 0 : Type@i }} by (econstructor; mauto 4).
+    assert {{ Γ L : (Eq (B[Wk][Wk]) #1 #0) [ Id ,, M1 ,, M2]}}.
+    {
+      eapply wf_conv; mauto 2.
+      symmetry.
+      etransitivity.
+      - eapply wf_exp_eq_eq_sub; mauto.
+      - econstructor; mauto 3.
+        + eapply wf_exp_eq_conv;
+            [eapply id_sub_lookup_var1 with (B:=B) | |];
+            mauto 4.
+        + eapply wf_exp_eq_conv;
+            [eapply id_sub_lookup_var0 with (B:=B) | |];
+            mauto 4.
+    }
+    mauto 3.
+ +
+  - clear HAi1 HAi2.
+    assert {{ Γ s Id ,, N : Γ, B}} by mauto 4.
+    assert {{ Γ , B B[Wk] : Type@i }} by mauto 4.
+    assert {{ Γ , B , B[Wk] B[Wk][Wk] : Type@i }} by mauto 4.
+    assert {{ Γ B[Wk][Id,,N] B : Type@i }}.
+    {
+      transitivity {{{B[Wk (Id,,N)]}}};
+        [| transitivity {{{B[Id]}}}];
+        mauto 3.
+      eapply exp_eq_sub_cong_typ2'; mauto 3.
+    }
+    assert {{ Γ s Id ,, N ,, N : Γ, B , B[Wk]}}.
+    {
+      econstructor; mauto 3.
+      eapply wf_conv; mauto 2.
+    }
+    assert {{ Γ B[Wk][Wk][Id ,, N ,, N] B : Type@i }}.
+    {
+      transitivity {{{B[Wk][Wk (Id ,, N ,, N)]}}};
+        [| transitivity {{{B[Wk][Id ,, N]}}}];
+        mauto 4.
+      eapply exp_eq_sub_cong_typ2'; mauto 4.
+      eapply wf_sub_eq_p_extend; mauto 4.
+    }
+    assert {{ Γ, B, B[Wk] Eq (B[Wk][Wk]) # 1 # 0 : Type@i }} by (econstructor; mauto 4).
+    assert {{ Γ refl B N : Eq B N N}} by mauto 3.
+    assert {{ Γ refl B N : (Eq (B[Wk][Wk]) #1 #0) [ Id ,, N ,, N]}}.
+    {
+      eapply wf_conv; mauto 2.
+      symmetry.
+      etransitivity.
+      - eapply wf_exp_eq_eq_sub; mauto.
+      - econstructor; mauto 3.
+        + eapply wf_exp_eq_conv;
+            [eapply id_sub_lookup_var1 with (B:=B) | |];
+            mauto 4.
+        + eapply wf_exp_eq_conv;
+            [eapply id_sub_lookup_var0 with (B:=B) | |];
+            mauto 4.
+    }
+    assert {{Γ, B s Id,, #0 : Γ, B, B[Wk] }} by mauto 3.
+ +
+    assert {{ Γ, B refl B[Wk] #0 : Eq (B[Wk]) #0 #0 }} by mauto 4.
+    assert {{ Γ, B s Id,,#0 : Γ, B, B[Wk] }} by mauto 3.
+    assert {{ (Γ, B), B[Wk] #1 : B[Wk][Wk] }} by mauto 4.
+    assert {{ Γ, B s Wk(Id,,#0) : Γ, B }} by (econstructor; mauto 3).
+    assert {{ Γ, B B[Wk][Wk][Id,,#0] B[Wk] : Type@i }}.
+    {
+      transitivity {{{B[Wk][Wk (Id,,#0)]}}};
+        [eapply exp_eq_sub_compose_typ |
+         transitivity {{{B[Wk][Id]}}} ];
+        mauto 3.
+      eapply exp_eq_sub_cong_typ2'; mauto 3.
+    }
+    assert {{ Γ, B #1[Id,,#0] #0 : B[Wk] }}.
+    {
+      transitivity {{{#0[Id]}}}.
+      - eapply wf_exp_eq_conv;
+          [eapply wf_exp_eq_var_S_sub with (A:={{{B[Wk]}}}) | |];
+          mauto 3.
+      - mauto 3.
+    }
+    assert {{ Γ, B #1[Id,,#0] #0 : B[Wk][Wk][Id,,#0] }} by mauto 4.
+    assert {{ Γ, B #0[Id,,#0] #0 : B[Wk] }}.
+    {
+      eapply wf_exp_eq_conv;
+        [eapply wf_exp_eq_var_0_sub with (A:={{{B[Wk]}}}) | |];
+        mauto 3.
+    }
+    assert {{ Γ, B #0[Id,,#0] #0 : B[Wk][Wk][Id,,#0] }} by mauto 4.
+    assert {{ Γ, B (Eq B[Wk][Wk] #1 #0)[Id,,#0] Eq (B[Wk]) #0 #0 : Type@i }}.
+    {
+      etransitivity; econstructor; mauto 3.
+    }
+    assert {{ Γ, B refl B[Wk] #0 : (Eq B[Wk][Wk] #1 #0)[Id,,#0] }} by mauto 4.
+    assert {{ Γ, B s Id,,#0,,refl B[Wk] #0 : Γ, B, B[Wk], Eq (B[Wk][Wk]) #1 #0 }} by mauto 4.
+ +
+    assert {{ Γ, B #0 : B[Wk][Id] }} by mauto 3.
+ +
+    assert {{ Γ B[Wk][Id(Id,,N)] B : Type@i }}.
+    {
+      transitivity {{{B[Wk][Id,,N]}}}; mauto 3.
+      eapply exp_eq_sub_cong_typ2'; mauto 3.
+    }
+    assert {{ Γ #0[Id,,N] N : B }}.
+    {
+      eapply wf_exp_eq_conv with (A:={{{B[Id]}}}); mauto 4.
+    }
+    assert {{ Γ B[Wk][Id(Id,,N)] : Type@i }} by mauto 4.
+    assert {{ Γ #0[Id,,N] N : B[Wk][Id(Id,,N)] }} by mauto 3.
+ +
+    assert {{ Γ s Id(Id,,N),,#0[Id,,N] Id,,N,,N : (Γ, B), B[Wk] }} by mauto 3.
+    assert {{ Γ s (Id,,#0)(Id,,N) Id,,N,,N : (Γ, B), B[Wk] }}.
+    {
+      etransitivity;
+        [eapply wf_sub_eq_extend_compose |];
+        mauto 2.
+    }
+
+    assert {{ Γ #1[Id,,N,,N] N : B }}.
+    {
+      transitivity {{{#0[Id,,N]}}}.
+      - eapply wf_exp_eq_conv;
+          [eapply wf_exp_eq_var_S_sub with (A:={{{B[Wk]}}}) | |];
+          mauto 4.
+      - mauto 3.
+    }
+    assert {{ Γ s Wk(Id,,N,,N) : Γ, B }} by mauto 4.
+    assert {{ Γ s Wk(Id,,N,,N) Id,,N : Γ, B }}
+      by (econstructor; mauto 4).
+    assert {{ Γ B[Wk][Wk][Id,,N,,N] B : Type@i }}.
+    {
+      transitivity {{{B[Wk][Wk (Id,,N,,N)]}}};
+        [eapply exp_eq_sub_compose_typ |];
+        mauto 3.
+    }
+    assert {{ Γ #1[Id,,N,,N] N : B[Wk][Wk][Id,,N,,N] }} by mauto 4.
+ +
+    assert {{ Γ #0[Id,,N,,N] N : B }}.
+    {
+      eapply wf_exp_eq_conv with (A:={{{B[Wk][Id,,N]}}});
+        [econstructor | |];
+        mauto 4.
+    }
+    assert {{ Γ #0[Id,,N,,N] N : B[Wk][Wk][Id,,N,,N] }} by mauto 4.
+ +
+    assert {{ Γ (Eq B[Wk][Wk] #1 #0)[(Id,,#0)(Id,,N)] Eq B N N : Type@i }}.
+    {
+      etransitivity;
+        [eapply exp_eq_sub_cong_typ2' | ]; mauto 2.
+      etransitivity;
+        econstructor; mauto 3.
+    }
+
+    assert {{ Γ (Eq B[Wk][Wk] #1 #0)[Id,,#0][Id,,N] Eq B N N : Type@i }}.
+    {
+      etransitivity; eauto.
+      eapply exp_eq_sub_compose_typ; mauto 3.
+    }
+    assert {{ Γ Eq B N N : Type@i }} by mauto 3.
+ +
+    assert {{ Γ #0[Id,,N] N : B }}.
+    {
+      eapply wf_exp_eq_conv with (A:={{{B[Id]}}});
+        [econstructor | |];
+        mauto 4.
+    }
+    assert {{ Γ #0[Id,,N] N : B[Wk][Id,,N] }} by mauto 4.
+ +
+    assert {{ Γ (refl B[Wk] #0)[Id,,N] refl B N : Eq B N N }}.
+    {
+      etransitivity.
+      - eapply wf_exp_eq_conv;
+          [eapply wf_exp_eq_refl_sub | | ]; mauto 4.
+      - eapply wf_exp_eq_conv; [econstructor | | econstructor]; mauto 3.
+    }
+
+    assert {{ Γ (refl B[Wk] #0)[Id,,N] refl B N : (Eq B[Wk][Wk] #1 #0)[(Id,,#0)(Id,,N)] }}
+             by (eapply wf_exp_eq_conv; mauto 4).
+ +
+    eapply wf_conv; mauto 3.
+    etransitivity.
+    + eapply exp_eq_sub_compose_typ; mauto 2.
+    + symmetry.
+      eapply exp_eq_sub_cong_typ2'; mauto 2.
+      symmetry.
+      etransitivity;
+        [eapply wf_sub_eq_extend_compose |];
+        mauto 2.
+ +
+  - eexists.
+    eapply exp_sub_typ; mauto 2.
+    assert {{ Γ s Id ,, N : Γ, B}} by mauto 4.
+    assert {{ Γ , B B[Wk] : Type@i }} by mauto 4.
+    assert {{ Γ , B , B[Wk] B[Wk][Wk] : Type@i }} by mauto 4.
+    assert {{ Γ B[Wk][Id,,N] B : Type@i }}.
+    {
+      transitivity {{{B[Wk (Id,,N)]}}};
+        [| transitivity {{{B[Id]}}}];
+        mauto 3.
+      eapply exp_eq_sub_cong_typ2'; mauto 3.
+    }
+    assert {{ Γ s Id ,, N ,, N : Γ, B , B[Wk]}}.
+    {
+      econstructor; mauto 3.
+      eapply wf_conv; mauto 2.
+    }
+    assert {{ Γ B[Wk][Wk][Id ,, N ,, N] B : Type@i }}.
+    {
+      transitivity {{{B[Wk][Wk (Id ,, N ,, N)]}}};
+        [| transitivity {{{B[Wk][Id ,, N]}}}];
+        mauto 4.
+      eapply exp_eq_sub_cong_typ2'; mauto 4.
+      eapply wf_sub_eq_p_extend; mauto 4.
+    }
+    assert {{ Γ, B, B[Wk] Eq (B[Wk][Wk]) # 1 # 0 : Type@i }} by (econstructor; mauto 4).
+    assert {{ Γ refl B N : Eq B N N}} by mauto 3.
+    assert {{ Γ refl B N : (Eq (B[Wk][Wk]) #1 #0) [ Id ,, N ,, N]}}.
+    {
+      eapply wf_conv; mauto 2.
+      symmetry.
+      etransitivity.
+      - eapply wf_exp_eq_eq_sub; mauto.
+      - econstructor; mauto 3.
+        + eapply wf_exp_eq_conv;
+            [eapply id_sub_lookup_var1 with (B:=B) | |];
+            mauto 4.
+        + eapply wf_exp_eq_conv;
+            [eapply id_sub_lookup_var0 with (B:=B) | |];
+            mauto 4.
+    }
+    mauto 3.
+ +
+  - assert {{ Γ s Wk(σ ,, N') σ : Δ }} by mauto 3.
+    assert {{ Γ B[Wk(σ ,, N')] B[σ] : Type@i }} by mauto 4.
+    assert {{ Δ, B }} by mauto 2.
+    assert {{ Δ, B s Wk : Δ }} by mauto 2.
+    assert {{ Γ s σ ,, N' : Δ, B }} by mauto 2.
+    assert {{ Γ B[Wk][σ ,, N'] B[σ] : Type@i }} by mauto 3.
+    enough {{ Γ #0[σ ,, N'] : B[Wk][σ ,, N'] }}...
+ +
+  - assert (exists i, {{ Δ C : Type@i }}) as [i'] by mauto 2.
+    assert {{ Γ s Wk(σ ,, N) σ : Δ }} by mauto 2.
+    assert {{ Γ C[Wk(σ ,, N)] C[σ] : Type@i' }} by mauto 4.
+    assert {{ Δ, B s Wk : Δ }} by mauto 3.
+    assert {{ Γ s σ ,, N : Δ, B }} by mauto 2.
+    assert {{ Γ C[Wk][σ ,, N] C[σ] : Type@i' }} by mauto 3.
+    assert {{ Δ, B #(S x) : C[Wk] }} by mauto 4.
+    enough {{ Γ #(S x)[σ ,, N] : C[Wk][σ ,, N] }}...
+ +
+  - assert (exists i, {{ Δ C : Type@i }}) as []...
+ +
+
+ +
+presup_sub_eq cases +
+
+  - econstructor...
+ +
+  - assert {{ Γ B[σ] B[σ'] : Type@i }} by mauto 2.
+    eapply wf_conv...
+ +
+  - assert {{ Γ N'[Id] : A[Id] }}...
+ +
+  - assert {{ Γ N[σ][τ] : B[σ][τ] }} by mauto 3.
+    eapply wf_conv...
+ +
+  - econstructor...
+ +
+  - econstructor; mauto 3.
+    eapply wf_conv...
+ +
+  - mauto.
+ +
+  - assert (exists i, {{ Γ0 A : Type@i }}) as [] by mauto 2.
+    assert {{ Γ #0[σ] : A[Wk][σ] }} by mauto 3.
+    enough {{ Γ #0[σ] : A[Wkσ] }} by mauto 4.
+    eapply wf_conv...
+ +
+
+ +
+presup_subtyp cases +
+
+  - exists (max i i0); split; mauto 3 using lift_exp_max_left, lift_exp_max_right.
+  - exists (max (S i) (S j)); split; mauto 3 using lift_exp_max_left, lift_exp_max_right.
+  - mauto.
+Qed.
+ +
+Ltac gen_presup H := gen_presup_IH @presup_exp_eq @presup_sub_eq @presup_subtyp H.
+ +
+Ltac gen_presups := (on_all_hyp: fun H => gen_presup H); invert_wf_ctx; clear_dups.
+
+
+ +
+ + + diff --git a/ext/prop-eq/Mcltt.Core.Syntactic.Syntax.html b/ext/prop-eq/Mcltt.Core.Syntactic.Syntax.html new file mode 100644 index 00000000..295e549a --- /dev/null +++ b/ext/prop-eq/Mcltt.Core.Syntactic.Syntax.html @@ -0,0 +1,321 @@ + + + + + + + + + + + + + +
+
+

Mcltt.Core.Syntactic.Syntax

+ +
+From Coq Require Import List String.
+ +
+From Mcltt.Core Require Import Base.
+ +
+
+ +
+

Concrete Syntax Tree

+ +
+
+Module Cst.
+Inductive obj : Set :=
+| typ : nat -> obj
+| nat : obj
+| zero : obj
+| succ : obj -> obj
+| natrec : obj -> string -> obj -> obj -> string -> string -> obj -> obj
+| pi : string -> obj -> obj -> obj
+| fn : string -> obj -> obj -> obj
+| app : obj -> obj -> obj
+| prop_eq : obj -> obj -> obj -> obj
+| refl : obj -> obj -> obj
+| eqrec : obj ->
+ +
+A : eq domain type +
+
+          string -> string -> string -> obj ->
+ +
+x y (z : Eq A x y). M +
+
+          string -> obj ->
+ +
+x. Pf : Mx/x, x/y, refl A x/z +
+
+          obj -> obj -> obj -> obj
+| var : string -> obj.
+End Cst.
+ +
+
+ +
+

Abstract Syntac Tree

+ +
+
+Inductive exp : Set :=
+
+ +
+Universe +
+
+| a_typ : nat -> exp
+
+ +
+Natural numbers +
+ + +
+Functions +
+
+| a_pi : exp -> exp -> exp
+| a_fn : exp -> exp -> exp
+| a_app : exp -> exp -> exp
+
+ +
+Propositional equality +
+ + +
+Variable +
+
+| a_var : nat -> exp
+
+ +
+Substitution Application +
+
+| a_sub : exp -> sub -> exp
+with sub : Set :=
+| a_id : sub
+| a_weaken : sub
+| a_compose : sub -> sub -> sub
+| a_extend : sub -> exp -> sub.
+ +
+Notation ctx := (list exp).
+Notation typ := exp.
+ +
+Fixpoint nat_to_exp n : exp :=
+  match n with
+  | 0 => a_zero
+  | S m => a_succ (nat_to_exp m)
+  end.
+Definition num_to_exp n := nat_to_exp (Nat.of_num_uint n).
+ +
+Fixpoint exp_to_nat e : option nat :=
+  match e with
+  | a_zero => Some 0
+  | a_succ e' =>
+      match exp_to_nat e' with
+      | Some n => Some (S n)
+      | None => None
+      end
+  | _ => None
+  end.
+Definition exp_to_num e :=
+  match exp_to_nat e with
+  | Some n => Some (Nat.to_num_uint n)
+  | None => None
+  end.
+ +
+
+ +
+

Syntactic Normal/Neutral Form

+ +
+
+Inductive nf : Set :=
+| nf_typ : nat -> nf
+| nf_nat : nf
+| nf_zero : nf
+| nf_succ : nf -> nf
+| nf_pi : nf -> nf -> nf
+| nf_fn : nf -> nf -> nf
+| nf_eq : nf -> nf -> nf -> nf
+| nf_refl : nf -> nf -> nf
+| nf_neut : ne -> nf
+with ne : Set :=
+| ne_natrec : nf -> nf -> nf -> ne -> ne
+| ne_app : ne -> nf -> ne
+| ne_var : nat -> ne
+| ne_eqrec : nf -> nf -> nf -> nf -> nf -> ne -> ne
+.
+ +
+Fixpoint nf_to_exp (M : nf) : exp :=
+  match M with
+  | nf_typ i => a_typ i
+  | nf_nat => a_nat
+  | nf_zero => a_zero
+  | nf_succ M => a_succ (nf_to_exp M)
+  | nf_pi A B => a_pi (nf_to_exp A) (nf_to_exp B)
+  | nf_fn A M => a_fn (nf_to_exp A) (nf_to_exp M)
+  | nf_eq A M N => a_eq (nf_to_exp A) (nf_to_exp M) (nf_to_exp N)
+  | nf_refl A M => a_refl (nf_to_exp A) (nf_to_exp M)
+  | nf_neut M => ne_to_exp M
+  end
+with ne_to_exp (M : ne) : exp :=
+  match M with
+  | ne_natrec A MZ MS M => a_natrec (nf_to_exp A) (nf_to_exp MZ) (nf_to_exp MS) (ne_to_exp M)
+  | ne_app M N => a_app (ne_to_exp M) (nf_to_exp N)
+  | ne_var x => a_var x
+  | ne_eqrec A B BR M M' N =>
+      a_eqrec (nf_to_exp A) (nf_to_exp B) (nf_to_exp BR) (nf_to_exp M) (nf_to_exp M') (ne_to_exp N)
+  end
+.
+ +
+Coercion nf_to_exp : nf >-> exp.
+Coercion ne_to_exp : ne >-> exp.
+ +
+Fact nf_eq_dec : forall (M M' : nf),
+    ({M = M'} + {M <> M'})%type
+with ne_eq_dec : forall (M M' : ne),
+    ({M = M'} + {M <> M'})%type.
+Proof.
+  all: intros; decide equality;
+    apply PeanoNat.Nat.eq_dec.
+Defined.
+ +
+Definition q σ := a_extend (a_compose σ a_weaken) (a_var 0).
+Arguments q σ/.
+ +
+#[global] Declare Custom Entry exp.
+#[global] Declare Custom Entry nf.
+ +
+#[global] Bind Scope mcltt_scope with exp.
+#[global] Bind Scope mcltt_scope with sub.
+#[global] Bind Scope mcltt_scope with nf.
+#[global] Bind Scope mcltt_scope with ne.
+Open Scope mcltt_scope.
+ +
+
+ +
+

Syntactic Notations

+ +
+
+Module Syntax_Notations.
+  Notation "{{{ x }}}" := x (at level 0, x custom exp at level 99, format "'{{{' x '}}}'") : mcltt_scope.
+
+ +
+We need to define substitution notation first to assert left associativity of level 0. +
+
+  Notation "e [ s ]" := (a_sub e s) (in custom exp at level 0, e custom exp, s custom exp at level 60, left associativity, format "e [ s ]") : mcltt_scope.
+  Notation "( x )" := x (in custom exp at level 0, x custom exp at level 60) : mcltt_scope.
+  Notation "~ x" := x (in custom exp at level 0, x constr at level 0) : mcltt_scope.
+  Notation "x" := x (in custom exp at level 0, x ident) : mcltt_scope.
+  Notation "'λ' A e" := (a_fn A e) (in custom exp at level 1, A custom exp at level 0, e custom exp at level 60) : mcltt_scope.
+  Notation "f x .. y" := (a_app .. (a_app f x) .. y) (in custom exp at level 40, f custom exp, x custom exp at next level, y custom exp at next level) : mcltt_scope.
+  Notation "'ℕ'" := a_nat (in custom exp) : mcltt_scope.
+  Notation "'Type' @ n" := (a_typ n) (in custom exp at level 0, n constr at level 0, format "'Type' @ n") : mcltt_scope.
+  Notation "'Π' A B" := (a_pi A B) (in custom exp at level 1, A custom exp at level 0, B custom exp at level 60) : mcltt_scope.
+  Notation "'zero'" := a_zero (in custom exp at level 0) : mcltt_scope.
+  Notation "'succ' e" := (a_succ e) (in custom exp at level 1, e custom exp at level 0) : mcltt_scope.
+  Notation "'rec' e 'return' A | 'zero' -> ez | 'succ' -> es 'end'" := (a_natrec A ez es e) (in custom exp at level 0, A custom exp at level 60, ez custom exp at level 60, es custom exp at level 60, e custom exp at level 60) : mcltt_scope.
+  Notation "'Eq' A M N" := (a_eq A M N) (in custom exp at level 1, A custom exp at level 30, M custom exp at level 35, N custom exp at level 40) : mcltt_scope.
+  Notation "'refl' A M" := (a_refl A M) (in custom exp at level 1, A custom exp at level 30, M custom exp at level 40) : mcltt_scope.
+  Notation "'eqrec' N 'as' 'Eq' A M1 M2 'return' B | 'refl' -> BR 'end'" := (a_eqrec A B BR M1 M2 N) (in custom exp at level 0, A custom exp at level 30, B custom exp at level 60, BR custom exp at level 60, M1 custom exp at level 35, M2 custom exp at level 40, N custom exp at level 60) : mcltt_scope.
+ +
+  Notation "'#' n" := (a_var n) (in custom exp at level 0, n constr at level 0, format "'#' n") : mcltt_scope.
+  Notation "'Id'" := a_id (in custom exp at level 0) : mcltt_scope.
+  Notation "'Wk'" := a_weaken (in custom exp at level 0) : mcltt_scope.
+ +
+  Notation "σ ∘ τ" := (a_compose σ τ) (in custom exp at level 40, right associativity, format "σ ∘ τ") : mcltt_scope.
+  Notation "σ ,, e" := (a_extend σ e) (in custom exp at level 50, left associativity, format "σ ,, e") : mcltt_scope.
+  Notation "'q' σ" := (q σ) (in custom exp at level 30) : mcltt_scope.
+ +
+  Notation "⋅" := nil (in custom exp at level 0) : mcltt_scope.
+  Notation "x , y" := (cons y x) (in custom exp at level 50, format "x , y") : mcltt_scope.
+ +
+  Notation "n{{{ x }}}" := x (at level 0, x custom nf at level 99, format "'n{{{' x '}}}'") : mcltt_scope.
+  Notation "( x )" := x (in custom nf at level 0, x custom nf at level 60) : mcltt_scope.
+  Notation "~ x" := x (in custom nf at level 0, x constr at level 0) : mcltt_scope.
+  Notation "x" := x (in custom nf at level 0, x ident) : mcltt_scope.
+  Notation "'λ' A e" := (nf_fn A e) (in custom nf at level 2, A custom nf at level 1, e custom nf at level 60) : mcltt_scope.
+  Notation "f x .. y" := (ne_app .. (ne_app f x) .. y) (in custom nf at level 40, f custom nf, x custom nf at next level, y custom nf at next level) : mcltt_scope.
+  Notation "'ℕ'" := nf_nat (in custom nf) : mcltt_scope.
+  Notation "'Type' @ n" := (nf_typ n) (in custom nf at level 0, n constr at level 0, format "'Type' @ n") : mcltt_scope.
+  Notation "'Π' A B" := (nf_pi A B) (in custom nf at level 2, A custom nf at level 1, B custom nf at level 60) : mcltt_scope.
+  Notation "'zero'" := nf_zero (in custom nf at level 0) : mcltt_scope.
+  Notation "'succ' M" := (nf_succ M) (in custom nf at level 2, M custom nf at level 1) : mcltt_scope.
+  Notation "'rec' M 'return' A | 'zero' -> MZ | 'succ' -> MS 'end'" := (ne_natrec A MZ MS M) (in custom nf at level 0, A custom nf at level 60, MZ custom nf at level 60, MS custom nf at level 60, M custom nf at level 60) : mcltt_scope.
+  Notation "'#' n" := (ne_var n) (in custom nf at level 0, n constr at level 0, format "'#' n") : mcltt_scope.
+  Notation "'⇑' M" := (nf_neut M) (in custom nf at level 0, M custom nf at level 99, format "'⇑' M") : mcltt_scope.
+  Notation "'Eq' A M N" := (nf_eq A M N) (in custom nf at level 1, A custom nf at level 30, M custom nf at level 35, N custom nf at level 40) : mcltt_scope.
+  Notation "'refl' A M" := (nf_refl A M) (in custom nf at level 1, A custom nf at level 30, M custom nf at level 40) : mcltt_scope.
+  Notation "'eqrec' N 'as' 'Eq' A M1 M2 'return' B | 'refl' -> BR 'end'" := (ne_eqrec A B BR M1 M2 N) (in custom nf at level 0, A custom nf at level 30, B custom nf at level 60, BR custom nf at level 60, M1 custom nf at level 35, M2 custom nf at level 40, N custom nf at level 60) : mcltt_scope.
+End Syntax_Notations.
+
+
+ +
+ + + diff --git a/ext/prop-eq/Mcltt.Core.Syntactic.System.Definitions.html b/ext/prop-eq/Mcltt.Core.Syntactic.System.Definitions.html new file mode 100644 index 00000000..f38dacb6 --- /dev/null +++ b/ext/prop-eq/Mcltt.Core.Syntactic.System.Definitions.html @@ -0,0 +1,753 @@ + + + + + + + + + + + + + +
+
+

Mcltt.Core.Syntactic.System.Definitions

+ +
+From Coq Require Import List Classes.RelationClasses Setoid Morphisms.
+ +
+From Mcltt Require Import LibTactics.
+From Mcltt.Core Require Import Base.
+From Mcltt.Core.Syntactic Require Export Syntax.
+Import Syntax_Notations.
+ +
+Reserved Notation "⊢ Γ" (in custom judg at level 80, Γ custom exp).
+Reserved Notation "⊢ Γ ≈ Γ'" (in custom judg at level 80, Γ custom exp, Γ' custom exp).
+Reserved Notation "Γ ⊢ M ≈ M' : A" (in custom judg at level 80, Γ custom exp, M custom exp, M' custom exp, A custom exp).
+Reserved Notation "Γ ⊢ M : A" (in custom judg at level 80, Γ custom exp, M custom exp, A custom exp).
+Reserved Notation "Γ ⊢s σ : Δ" (in custom judg at level 80, Γ custom exp, σ custom exp, Δ custom exp).
+Reserved Notation "Γ ⊢s σ ≈ σ' : Δ" (in custom judg at level 80, Γ custom exp, σ custom exp, σ' custom exp, Δ custom exp).
+Reserved Notation "⊢ Γ ⊆ Γ'" (in custom judg at level 80, Γ custom exp, Γ' custom exp).
+Reserved Notation "Γ ⊢ A ⊆ A'" (in custom judg at level 80, Γ custom exp, A custom exp, A' custom exp).
+Reserved Notation "'#' x : A ∈ Γ" (in custom judg at level 80, x constr at level 0, A custom exp, Γ custom exp at level 50).
+ +
+Generalizable All Variables.
+ +
+Inductive ctx_lookup : nat -> typ -> ctx -> Prop :=
+  | here : `({{ #0 : A[Wk] Γ , A }})
+  | there : `({{ #n : A Γ }} -> {{ #(S n) : A[Wk] Γ , B }})
+where "'#' x : A ∈ Γ" := (ctx_lookup x A Γ) (in custom judg) : type_scope.
+ +
+Inductive wf_ctx : ctx -> Prop :=
+| wf_ctx_empty : {{ }}
+| wf_ctx_extend :
+  `( {{ Γ }} ->
+     {{ Γ A : Type@i }} ->
+     {{ Γ , A }} )
+where "⊢ Γ" := (wf_ctx Γ) (in custom judg) : type_scope
+
+with wf_ctx_sub : ctx -> ctx -> Prop :=
+| wf_ctx_sub_empty : {{ }}
+| wf_ctx_sub_extend :
+  `( {{ Γ Δ }} ->
+     {{ Γ A : Type@i }} ->
+     {{ Δ A' : Type@i }} ->
+     {{ Γ A A' }} ->
+     {{ Γ , A Δ , A' }} )
+where "⊢ Γ ⊆ Γ'" := (wf_ctx_sub Γ Γ') (in custom judg) : type_scope
+
+with wf_exp : ctx -> typ -> exp -> Prop :=
+| wf_typ :
+  `( {{ Γ }} ->
+     {{ Γ Type@i : Type@(S i) }} )
+
+| wf_nat :
+  `( {{ Γ }} ->
+     {{ Γ : Type@0 }} )
+| wf_zero :
+  `( {{ Γ }} ->
+     {{ Γ zero : }} )
+| wf_succ :
+  `( {{ Γ M : }} ->
+     {{ Γ succ M : }} )
+| wf_natrec :
+  `( {{ Γ , A : Type@i }} ->
+     {{ Γ MZ : A[Id,,zero] }} ->
+     {{ Γ , , A MS : A[WkWk,,succ(#1)] }} ->
+     {{ Γ M : }} ->
+     {{ Γ rec M return A | zero -> MZ | succ -> MS end : A[Id,,M] }} )
+
+| wf_pi :
+  `( {{ Γ A : Type@i }} ->
+     {{ Γ , A B : Type@i }} ->
+     {{ Γ Π A B : Type@i }} )
+| wf_fn :
+  `( {{ Γ A : Type@i }} ->
+     {{ Γ , A M : B }} ->
+     {{ Γ λ A M : Π A B }} )
+| wf_app :
+  `( {{ Γ A : Type@i }} ->
+     {{ Γ , A B : Type@i }} ->
+     {{ Γ M : Π A B }} ->
+     {{ Γ N : A }} ->
+     {{ Γ M N : B[Id,,N] }} )
+
+| wf_vlookup :
+  `( {{ Γ }} ->
+     {{ #x : A Γ }} ->
+     {{ Γ #x : A }} )
+
+| wf_eq :
+  `( {{ Γ A : Type@i }} ->
+     {{ Γ M : A }} ->
+     {{ Γ N : A }} ->
+     {{ Γ Eq A M N : Type@i }})
+| wf_refl :
+  `( {{ Γ A : Type@i }} ->
+     {{ Γ M : A }} ->
+     {{ Γ refl A M : Eq A M M }})
+| wf_eqrec :
+  `( {{ Γ A : Type@i }} ->
+     {{ Γ M1 : A }} ->
+     {{ Γ M2 : A }} ->
+     {{ Γ N : Eq A M1 M2 }} ->
+     {{ Γ , A , A[Wk], Eq (A[Wk][Wk]) #1 #0 B : Type@j }} ->
+     {{ Γ , A BR : B [Id,,#0,,refl (A[Wk]) #0 ] }} ->
+     {{ Γ eqrec N as Eq A M1 M2 return B | refl -> BR end : B[Id,,M1,,M2,,N] }} )
+
+| wf_exp_sub :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Δ M : A }} ->
+     {{ Γ M[σ] : A[σ] }} )
+| wf_exp_subtyp :
+  `( {{ Γ M : A }} ->
+     
+ +
+We have this extra argument for soundness. + Note that we need to keep it asymmetric: + only A' is checked. If we check A as well, + we cannot even construct something like + {{ Γ Type@0[Wk] : Type@1 }} with the current + rules. Under the symmetric rule, the example requires + {{ Γ Type@1[Wk] : Type@2 }} to apply wf_exp_sub, + which requires {{ Γ Type@2[Wk] : Type@3 }}, and so on. + +
+
+     {{ Γ A' : Type@i }} ->
+     {{ Γ A A' }} ->
+     {{ Γ M : A' }} )
+where "Γ ⊢ M : A" := (wf_exp Γ A M) (in custom judg) : type_scope
+
+with wf_sub : ctx -> ctx -> sub -> Prop :=
+| wf_sub_id :
+  `( {{ Γ }} ->
+     {{ Γ s Id : Γ }} )
+| wf_sub_weaken :
+  `( {{ Γ , A }} ->
+     {{ Γ , A s Wk : Γ }} )
+| wf_sub_compose :
+  `( {{ Γ1 s σ2 : Γ2 }} ->
+     {{ Γ2 s σ1 : Γ3 }} ->
+     {{ Γ1 s σ1 σ2 : Γ3 }} )
+| wf_sub_extend :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Δ A : Type@i }} ->
+     {{ Γ M : A[σ] }} ->
+     {{ Γ s (σ ,, M) : Δ , A }} )
+| wf_sub_subtyp :
+  `( {{ Γ s σ : Δ }} ->
+     
+ +
+As in wf_exp_subtyp, this extra argument is + for soundness. We don't need to keep it asymmetric, + but do so to match with wf_exp_subtyp. + +
+
+     {{ Δ' }} ->
+     {{ Δ Δ' }} ->
+     {{ Γ s σ : Δ' }} )
+where "Γ ⊢s σ : Δ" := (wf_sub Γ Δ σ) (in custom judg) : type_scope
+
+with wf_exp_eq : ctx -> typ -> exp -> exp -> Prop :=
+| wf_exp_eq_typ_sub :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Γ Type@i[σ] Type@i : Type@(S i) }} )
+
+| wf_exp_eq_nat_sub :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Γ [σ] : Type@0 }} )
+| wf_exp_eq_zero_sub :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Γ zero[σ] zero : }} )
+| wf_exp_eq_succ_sub :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Δ M : }} ->
+     {{ Γ (succ M)[σ] succ (M[σ]) : }} )
+| wf_exp_eq_succ_cong :
+  `( {{ Γ M M' : }} ->
+     {{ Γ succ M succ M' : }} )
+| wf_exp_eq_natrec_cong :
+  `( {{ Γ , A : Type@i }} ->
+     {{ Γ , A A' : Type@i }} ->
+     {{ Γ MZ MZ' : A[Id,,zero] }} ->
+     {{ Γ , , A MS MS' : A[WkWk,,succ(#1)] }} ->
+     {{ Γ M M' : }} ->
+     {{ Γ rec M return A | zero -> MZ | succ -> MS end rec M' return A' | zero -> MZ' | succ -> MS' end : A[Id,,M] }} )
+| wf_exp_eq_natrec_sub :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Δ , A : Type@i }} ->
+     {{ Δ MZ : A[Id,,zero] }} ->
+     {{ Δ , , A MS : A[WkWk,,succ(#1)] }} ->
+     {{ Δ M : }} ->
+     {{ Γ rec M return A | zero -> MZ | succ -> MS end[σ] rec M[σ] return A[q σ] | zero -> MZ[σ] | succ -> MS[q (q σ)] end : A[σ,,M[σ]] }} )
+| wf_exp_eq_nat_beta_zero :
+  `( {{ Γ , A : Type@i }} ->
+     {{ Γ MZ : A[Id,,zero] }} ->
+     {{ Γ , , A MS : A[WkWk,,succ(#1)] }} ->
+     {{ Γ rec zero return A | zero -> MZ | succ -> MS end MZ : A[Id,,zero] }} )
+| wf_exp_eq_nat_beta_succ :
+  `( {{ Γ , A : Type@i }} ->
+     {{ Γ MZ : A[Id,,zero] }} ->
+     {{ Γ , , A MS : A[WkWk,,succ(#1)] }} ->
+     {{ Γ M : }} ->
+     {{ Γ rec (succ M) return A | zero -> MZ | succ -> MS end MS[Id,,M,,rec M return A | zero -> MZ | succ -> MS end] : A[Id,,succ M] }} )
+
+| wf_exp_eq_pi_sub :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Δ A : Type@i }} ->
+     {{ Δ , A B : Type@i }} ->
+     {{ Γ (Π A B)[σ] Π (A[σ]) (B[q σ]) : Type@i }} )
+| wf_exp_eq_pi_cong :
+  `( {{ Γ A : Type@i }} ->
+     {{ Γ A A' : Type@i }} ->
+     {{ Γ , A B B' : Type@i }} ->
+     {{ Γ Π A B Π A' B' : Type@i }} )
+| wf_exp_eq_fn_cong :
+  `( {{ Γ A : Type@i }} ->
+     {{ Γ A A' : Type@i }} ->
+     {{ Γ , A M M' : B }} ->
+     {{ Γ λ A M λ A' M' : Π A B }} )
+| wf_exp_eq_fn_sub :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Δ A : Type@i }} ->
+     {{ Δ , A M : B }} ->
+     {{ Γ (λ A M)[σ] λ A[σ] M[q σ] : (Π A B)[σ] }} )
+| wf_exp_eq_app_cong :
+  `( {{ Γ A : Type@i }} ->
+     {{ Γ , A B : Type@i }} ->
+     {{ Γ M M' : Π A B }} ->
+     {{ Γ N N' : A }} ->
+     {{ Γ M N M' N' : B[Id,,N] }} )
+| wf_exp_eq_app_sub :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Δ A : Type@i }} ->
+     {{ Δ , A B : Type@i }} ->
+     {{ Δ M : Π A B }} ->
+     {{ Δ N : A }} ->
+     {{ Γ (M N)[σ] M[σ] N[σ] : B[σ,,N[σ]] }} )
+| wf_exp_eq_pi_beta :
+  `( {{ Γ A : Type@i }} ->
+     {{ Γ , A B : Type@i }} ->
+     {{ Γ , A M : B }} ->
+     {{ Γ N : A }} ->
+     {{ Γ (λ A M) N M[Id,,N] : B[Id,,N] }} )
+| wf_exp_eq_pi_eta :
+  `( {{ Γ A : Type@i }} ->
+     {{ Γ , A B : Type@i }} ->
+     {{ Γ M : Π A B }} ->
+     {{ Γ M λ A (M[Wk] #0) : Π A B }} )
+
+| wf_exp_eq_eq_sub :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Δ A : Type@i }} ->
+     {{ Δ M : A }} ->
+     {{ Δ N : A }} ->
+     {{ Γ (Eq A M N)[σ] Eq (A[σ]) (M[σ]) (N[σ]) : Type@i }} )
+| wf_exp_eq_refl_sub :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Δ A : Type@i }} ->
+     {{ Δ M : A }} ->
+     {{ Γ (refl A M)[σ] refl (A[σ]) (M[σ]) : (Eq A M M)[σ] }} )
+| wf_exp_eq_eqrec_sub :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Δ A : Type@i }} ->
+     {{ Δ M1 : A }} ->
+     {{ Δ M2 : A }} ->
+     {{ Δ N : Eq A M1 M2 }} ->
+     {{ Δ , A , A[Wk], Eq (A[Wk][Wk]) #1 #0 B : Type@j }} ->
+     {{ Δ , A BR : B [Id,,#0,,refl (A[Wk]) #0 ] }} ->
+     {{ Γ (eqrec N as Eq A M1 M2 return B | refl -> BR end)[σ]
+           eqrec (N[σ]) as Eq (A[σ]) (M1[σ]) (M2[σ]) return B[q (q (q σ))] | refl -> BR[q σ] end
+         : B[σ,,M1[σ],,M2[σ],,N[σ]] }} )
+| wf_exp_eq_eq_cong :
+  `( {{ Γ A A' : Type@i }} ->
+     {{ Γ M M' : A }} ->
+     {{ Γ N N' : A }} ->
+     {{ Γ Eq A M N Eq A' M' N' : Type@i }})
+| wf_exp_eq_refl_cong :
+  `( {{ Γ A A' : Type@i }} ->
+     {{ Γ M M' : A }} ->
+     {{ Γ refl A M refl A' M' : Eq A M M }})
+| wf_exp_eq_eqrec_cong :
+  `( {{ Γ A : Type@i }} ->
+     {{ Γ M1 : A }} ->
+     {{ Γ M2 : A }} ->
+     {{ Γ A A' : Type@i }} ->
+     {{ Γ M1 M1' : A }} ->
+     {{ Γ M2 M2' : A }} ->
+     {{ Γ N N' : Eq A M1 M2 }} ->
+     {{ Γ , A , A[Wk], Eq (A[Wk][Wk]) #1 #0 B B' : Type@j }} ->
+     {{ Γ , A BR BR' : B [Id,,#0,,refl (A[Wk]) #0 ] }} ->
+     {{ Γ eqrec N as Eq A M1 M2 return B | refl -> BR end
+           eqrec N' as Eq A' M1' M2' return B' | refl -> BR' end
+         : B[Id,,M1,,M2,,N] }} )
+| wf_exp_eq_eqrec_beta :
+  `( {{ Γ A : Type@i }} ->
+     {{ Γ M : A }} ->
+     {{ Γ N : Eq A M M }} ->
+     {{ Γ , A , A[Wk], Eq (A[Wk][Wk]) #1 #0 B : Type@j }} ->
+     {{ Γ , A BR : B [Id,,#0,,refl (A[Wk]) #0 ] }} ->
+     {{ Γ eqrec refl A M as Eq A M M return B | refl -> BR end
+           BR[Id,,M]
+         : B[Id,,M,,M,,refl A M] }} )
+
+| wf_exp_eq_var :
+  `( {{ Γ }} ->
+     {{ #x : A Γ }} ->
+     {{ Γ #x #x : A }} )
+| wf_exp_eq_var_0_sub :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Δ A : Type@i }} ->
+     {{ Γ M : A[σ] }} ->
+     {{ Γ #0[σ ,, M] M : A[σ] }} )
+| wf_exp_eq_var_S_sub :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Δ A : Type@i }} ->
+     {{ Γ M : A[σ] }} ->
+     {{ #x : B Δ }} ->
+     {{ Γ #(S x)[σ ,, M] #x[σ] : B[σ] }} )
+| wf_exp_eq_var_weaken :
+  `( {{ Γ , B }} ->
+     {{ #x : A Γ }} ->
+     {{ Γ , B #x[Wk] #(S x) : A[Wk] }} )
+| wf_exp_eq_sub_cong :
+  `( {{ Δ M M' : A }} ->
+     {{ Γ s σ σ' : Δ }} ->
+     {{ Γ M[σ] M'[σ'] : A[σ] }} )
+| wf_exp_eq_sub_id :
+  `( {{ Γ M : A }} ->
+     {{ Γ M[Id] M : A }} )
+| wf_exp_eq_sub_compose :
+  `( {{ Γ s τ : Γ' }} ->
+     {{ Γ' s σ : Γ'' }} ->
+     {{ Γ'' M : A }} ->
+     {{ Γ M[σ τ] M[σ][τ] : A[σ τ] }} )
+| wf_exp_eq_subtyp :
+  `( {{ Γ M M' : A }} ->
+     {{ Γ A' : Type@i }} ->
+     
+ +
+This extra argument is here to be consistent with + wf_exp_subtyp. + +
+
+     {{ Γ A A' }} ->
+     {{ Γ M M' : A' }} )
+| wf_exp_eq_sym :
+  `( {{ Γ M M' : A }} ->
+     {{ Γ M' M : A }} )
+| wf_exp_eq_trans :
+  `( {{ Γ M M' : A }} ->
+     {{ Γ M' M'' : A }} ->
+     {{ Γ M M'' : A }} )
+where "Γ ⊢ M ≈ M' : A" := (wf_exp_eq Γ A M M') (in custom judg) : type_scope
+
+with wf_sub_eq : ctx -> ctx -> sub -> sub -> Prop :=
+| wf_sub_eq_id :
+  `( {{ Γ }} ->
+     {{ Γ s Id Id : Γ }} )
+| wf_sub_eq_weaken :
+  `( {{ Γ , A }} ->
+     {{ Γ , A s Wk Wk : Γ }} )
+| wf_sub_eq_compose_cong :
+  `( {{ Γ s τ τ' : Γ' }} ->
+     {{ Γ' s σ σ' : Γ'' }} ->
+     {{ Γ s σ τ σ' τ' : Γ'' }} )
+| wf_sub_eq_extend_cong :
+  `( {{ Γ s σ σ' : Δ }} ->
+     {{ Δ A : Type@i }} ->
+     {{ Γ M M' : A[σ] }} ->
+     {{ Γ s (σ ,, M) (σ' ,, M') : Δ , A }} )
+| wf_sub_eq_id_compose_right :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Γ s Id σ σ : Δ }} )
+| wf_sub_eq_id_compose_left :
+  `( {{ Γ s σ : Δ }} ->
+     {{ Γ s σ Id σ : Δ }} )
+| wf_sub_eq_compose_assoc :
+  `( {{ Γ' s σ : Γ }} ->
+     {{ Γ'' s σ' : Γ' }} ->
+     {{ Γ''' s σ'' : Γ'' }} ->
+     {{ Γ''' s (σ σ') σ'' σ (σ' σ'') : Γ }} )
+| wf_sub_eq_extend_compose :
+  `( {{ Γ' s σ : Γ'' }} ->
+     {{ Γ'' A : Type@i }} ->
+     {{ Γ' M : A[σ] }} ->
+     {{ Γ s τ : Γ' }} ->
+     {{ Γ s (σ ,, M) τ ((σ τ) ,, M[τ]) : Γ'' , A }} )
+| wf_sub_eq_p_extend :
+  `( {{ Γ' s σ : Γ }} ->
+     {{ Γ A : Type@i }} ->
+     {{ Γ' M : A[σ] }} ->
+     {{ Γ' s Wk (σ ,, M) σ : Γ }} )
+| wf_sub_eq_extend :
+  `( {{ Γ' s σ : Γ , A }} ->
+     {{ Γ' s σ ((Wk σ) ,, #0[σ]) : Γ , A }} )
+| wf_sub_eq_sym :
+  `( {{ Γ s σ σ' : Δ }} ->
+     {{ Γ s σ' σ : Δ }} )
+| wf_sub_eq_trans :
+  `( {{ Γ s σ σ' : Δ }} ->
+     {{ Γ s σ' σ'' : Δ }} ->
+     {{ Γ s σ σ'' : Δ }} )
+| wf_sub_eq_subtyp :
+  `( {{ Γ s σ σ' : Δ }} ->
+     
+ +
+This extra argument is here to be consistent with + wf_sub_subtyp. + +
+
+     {{ Δ' }} ->
+     {{ Δ Δ' }} ->
+     {{ Γ s σ σ' : Δ' }} )
+where "Γ ⊢s S1 ≈ S2 : Δ" := (wf_sub_eq Γ Δ S1 S2) (in custom judg) : type_scope
+
+with wf_subtyp : ctx -> typ -> typ -> Prop :=
+| wf_subtyp_refl :
+  
+ +
+We need this extra argument in order to prove the lemmas + in CtxSub.v independently. We can prove those and + presupposition lemmas mutually dependently, but that would + be more messy. + +
+ + The main point of this assumption gives presupposition for + RHS directly so that we can remove the extra arguments in + type checking rules immediately. + +
+
+  `( {{ Γ M' : Type@i }} ->
+     {{ Γ M M' : Type@i }} ->
+     {{ Γ M M' }} )
+| wf_subtyp_trans :
+  `( {{ Γ M M' }} ->
+     {{ Γ M' M'' }} ->
+     {{ Γ M M'' }} )
+| wf_subtyp_univ :
+  `( {{ Γ }} ->
+     i < j ->
+     {{ Γ Type@i Type@j }} )
+| wf_subtyp_pi :
+  `( {{ Γ A : Type@i }} ->
+     {{ Γ A' : Type@i }} ->
+     {{ Γ A A' : Type@i }} ->
+     {{ Γ , A B : Type@i }} ->
+     {{ Γ , A' B' : Type@i }} ->
+     {{ Γ , A' B B' }} ->
+     {{ Γ Π A B Π A' B' }} )
+where "Γ ⊢ A ⊆ A'" := (wf_subtyp Γ A A') (in custom judg) : type_scope.
+ +
+Scheme wf_ctx_mut_ind := Induction for wf_ctx Sort Prop
+with wf_ctx_sub_mut_ind := Induction for wf_ctx_sub Sort Prop
+with wf_exp_mut_ind := Induction for wf_exp Sort Prop
+with wf_exp_eq_mut_ind := Induction for wf_exp_eq Sort Prop
+with wf_sub_mut_ind := Induction for wf_sub Sort Prop
+with wf_sub_eq_mut_ind := Induction for wf_sub_eq Sort Prop
+with wf_subtyp_mut_ind := Induction for wf_subtyp Sort Prop.
+Combined Scheme syntactic_wf_mut_ind from
+  wf_ctx_mut_ind,
+  wf_ctx_sub_mut_ind,
+  wf_exp_mut_ind,
+  wf_exp_eq_mut_ind,
+  wf_sub_mut_ind,
+  wf_sub_eq_mut_ind,
+  wf_subtyp_mut_ind.
+ +
+Scheme wf_ctx_mut_ind' := Induction for wf_ctx Sort Prop
+with wf_exp_mut_ind' := Induction for wf_exp Sort Prop
+with wf_sub_mut_ind' := Induction for wf_sub Sort Prop.
+Combined Scheme syntactic_wf_mut_ind' from
+  wf_ctx_mut_ind',
+  wf_exp_mut_ind',
+  wf_sub_mut_ind'.
+ +
+Inductive wf_ctx_eq : ctx -> ctx -> Prop :=
+| wf_ctx_eq_empty : {{ }}
+| wf_ctx_eq_extend :
+  `( {{ Γ Δ }} ->
+     {{ Γ A : Type@i }} ->
+     {{ Γ A' : Type@i }} ->
+     {{ Δ A : Type@i }} ->
+     {{ Δ A' : Type@i }} ->
+     {{ Γ A A' : Type@i }} ->
+     {{ Δ A A' : Type@i }} ->
+     {{ Γ , A Δ , A' }} )
+where "⊢ Γ ≈ Γ'" := (wf_ctx_eq Γ Γ') (in custom judg) : type_scope.
+ +
+#[export]
+Hint Constructors wf_ctx wf_ctx_eq wf_ctx_sub wf_exp wf_sub wf_exp_eq wf_sub_eq wf_subtyp ctx_lookup : mcltt.
+ +
+#[export]
+Instance wf_exp_eq_PER Γ A : PER (wf_exp_eq Γ A).
+Proof.
+  split.
+  - eauto using wf_exp_eq_sym.
+  - eauto using wf_exp_eq_trans.
+Qed.
+ +
+#[export]
+Instance wf_sub_eq_PER Γ Δ : PER (wf_sub_eq Γ Δ).
+Proof.
+  split.
+  - eauto using wf_sub_eq_sym.
+  - eauto using wf_sub_eq_trans.
+Qed.
+ +
+#[export]
+Instance wf_ctx_eq_Symmetric : Symmetric wf_ctx_eq.
+Proof.
+  induction 1; mauto.
+Qed.
+ +
+#[export]
+Instance wf_subtyp_Transitive Γ : Transitive (wf_subtyp Γ).
+Proof.
+  hnf; mauto.
+Qed.
+ +
+
+ +
+Immediate & Independent Presuppositions +
+
+ +
+Lemma presup_ctx_sub : forall {Γ Δ}, {{ Γ Δ }} -> {{ Γ }} /\ {{ Δ }}.
+Proof with mautosolve.
+  induction 1; destruct_pairs...
+Qed.
+ +
+#[export]
+Hint Resolve presup_ctx_sub : mcltt.
+ +
+Lemma presup_ctx_sub_left : forall {Γ Δ}, {{ Γ Δ }} -> {{ Γ }}.
+Proof with easy.
+  intros * ?%presup_ctx_sub...
+Qed.
+ +
+#[export]
+Hint Resolve presup_ctx_sub_left : mcltt.
+ +
+Lemma presup_ctx_sub_right : forall {Γ Δ}, {{ Γ Δ }} -> {{ Δ }}.
+Proof with easy.
+  intros * ?%presup_ctx_sub...
+Qed.
+ +
+#[export]
+Hint Resolve presup_ctx_sub_right : mcltt.
+ +
+Lemma presup_subtyp_right : forall {Γ A B}, {{ Γ A B }} -> exists i, {{ Γ B : Type@i }}.
+Proof with mautosolve.
+  induction 1...
+Qed.
+ +
+#[export]
+Hint Resolve presup_subtyp_right : mcltt.
+ +
+
+ +
+Subtyping Rules without Extra Arguments +
+
+ +
+Lemma wf_exp_subtyp' : forall Γ A A' M,
+    {{ Γ M : A }} ->
+    {{ Γ A A' }} ->
+    {{ Γ M : A' }}.
+Proof.
+  intros.
+  assert (exists i, {{ Γ A' : Type@i }}) as [] by mauto.
+  econstructor; mauto.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_subtyp' : mcltt.
+#[export]
+Remove Hints wf_exp_subtyp : mcltt.
+ +
+Lemma wf_sub_subtyp' : forall Γ Δ Δ' σ,
+    {{ Γ s σ : Δ }} ->
+    {{ Δ Δ' }} ->
+    {{ Γ s σ : Δ' }}.
+Proof.
+  intros.
+  econstructor; mauto.
+Qed.
+ +
+#[export]
+Hint Resolve wf_sub_subtyp' : mcltt.
+#[export]
+Remove Hints wf_sub_subtyp : mcltt.
+ +
+Lemma wf_exp_eq_subtyp' : forall Γ A A' M M',
+    {{ Γ M M' : A }} ->
+    {{ Γ A A' }} ->
+    {{ Γ M M' : A' }}.
+Proof.
+  intros.
+  assert (exists i, {{ Γ A' : Type@i }}) as [] by mauto.
+  econstructor; mauto.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_subtyp' : mcltt.
+#[export]
+Remove Hints wf_exp_eq_subtyp : mcltt.
+ +
+Lemma wf_sub_eq_subtyp' : forall Γ Δ Δ' σ σ',
+    {{ Γ s σ σ' : Δ }} ->
+    {{ Δ Δ' }} ->
+    {{ Γ s σ σ' : Δ' }}.
+Proof.
+  intros.
+  econstructor; mauto.
+Qed.
+ +
+#[export]
+Hint Resolve wf_sub_eq_subtyp' : mcltt.
+#[export]
+Remove Hints wf_sub_eq_subtyp : mcltt.
+ +
+Add Parametric Morphism Γ T : (wf_exp_eq Γ T)
+    with signature wf_exp_eq Γ T ==> eq ==> iff as wf_exp_eq_morphism_iff1.
+Proof.
+  split; mauto.
+Qed.
+ +
+Add Parametric Morphism Γ T : (wf_exp_eq Γ T)
+    with signature eq ==> wf_exp_eq Γ T ==> iff as wf_exp_eq_morphism_iff2.
+Proof.
+  split; mauto.
+Qed.
+ +
+Add Parametric Morphism Γ Δ : (wf_sub_eq Γ Δ)
+    with signature wf_sub_eq Γ Δ ==> eq ==> iff as wf_sub_eq_morphism_iff1.
+Proof.
+  split; mauto.
+Qed.
+ +
+Add Parametric Morphism Γ Δ : (wf_sub_eq Γ Δ)
+    with signature eq ==> wf_sub_eq Γ Δ ==> iff as wf_sub_eq_morphism_iff2.
+Proof.
+  split; mauto.
+Qed.
+ +
+#[export]
+Hint Rewrite -> wf_exp_eq_typ_sub wf_exp_eq_nat_sub wf_exp_eq_eq_sub using mauto 3 : mcltt.
+ +
+#[export]
+Hint Rewrite -> wf_sub_eq_id_compose_right wf_sub_eq_id_compose_left
+                  wf_sub_eq_compose_assoc (* prefer right association *)
+                  wf_sub_eq_p_extend using mauto 4 : mcltt.
+ +
+#[export]
+Hint Rewrite -> wf_exp_eq_sub_id wf_exp_eq_pi_sub using mauto 4 : mcltt.
+ +
+#[export]
+Instance wf_exp_eq_per_elem Γ T : PERElem _ (wf_exp Γ T) (wf_exp_eq Γ T).
+Proof.
+  intros a Ha. mauto.
+Qed.
+ +
+#[export]
+Instance wf_sub_eq_per_elem Γ Δ : PERElem _ (wf_sub Γ Δ) (wf_sub_eq Γ Δ).
+Proof.
+  intros a Ha. mauto.
+Qed.
+
+
+ +
+ + + diff --git a/ext/prop-eq/Mcltt.Core.Syntactic.System.Lemmas.html b/ext/prop-eq/Mcltt.Core.Syntactic.System.Lemmas.html new file mode 100644 index 00000000..e71232b4 --- /dev/null +++ b/ext/prop-eq/Mcltt.Core.Syntactic.System.Lemmas.html @@ -0,0 +1,1569 @@ + + + + + + + + + + + + + +
+
+

Mcltt.Core.Syntactic.System.Lemmas

+ +
+From Mcltt Require Import LibTactics.
+From Mcltt.Core Require Import Base.
+From Mcltt.Core.Syntactic.System Require Import Definitions.
+Import Syntax_Notations.
+ +
+
+ +
+

Core Presuppositions

+ +
+ +

Basic inversion

+ +
+
+Lemma ctx_decomp : forall {Γ A}, {{ Γ , A }} -> {{ Γ }} /\ exists i, {{ Γ A : Type@i }}.
+Proof with now eauto.
+  inversion 1...
+Qed.
+ +
+#[export]
+Hint Resolve ctx_decomp : mcltt.
+ +
+Corollary ctx_decomp_left : forall {Γ A}, {{ Γ , A }} -> {{ Γ }}.
+Proof with easy.
+  intros * ?%ctx_decomp...
+Qed.
+ +
+Corollary ctx_decomp_right : forall {Γ A}, {{ Γ , A }} -> exists i, {{ Γ A : Type@i }}.
+Proof with easy.
+  intros * ?%ctx_decomp...
+Qed.
+ +
+#[export]
+Hint Resolve ctx_decomp_left ctx_decomp_right : mcltt.
+ +
+
+ +
+

Context Presuppositions

+ +
+
+ +
+Lemma presup_ctx_eq : forall {Γ Δ}, {{ Γ Δ }} -> {{ Γ }} /\ {{ Δ }}.
+Proof with mautosolve.
+  induction 1; destruct_pairs...
+Qed.
+ +
+Corollary presup_ctx_eq_left : forall {Γ Δ}, {{ Γ Δ }} -> {{ Γ }}.
+Proof with easy.
+  intros * ?%presup_ctx_eq...
+Qed.
+ +
+Corollary presup_ctx_eq_right : forall {Γ Δ}, {{ Γ Δ }} -> {{ Δ }}.
+Proof with easy.
+  intros * ?%presup_ctx_eq...
+Qed.
+ +
+#[export]
+Hint Resolve presup_ctx_eq presup_ctx_eq_left presup_ctx_eq_right : mcltt.
+ +
+Lemma presup_sub : forall {Γ Δ σ}, {{ Γ s σ : Δ }} -> {{ Γ }} /\ {{ Δ }}.
+Proof with mautosolve.
+  induction 1; destruct_pairs...
+Qed.
+ +
+Corollary presup_sub_left : forall {Γ Δ σ}, {{ Γ s σ : Δ }} -> {{ Γ }}.
+Proof with easy.
+  intros * ?%presup_sub...
+Qed.
+ +
+Corollary presup_sub_right : forall {Γ Δ σ}, {{ Γ s σ : Δ }} -> {{ Δ }}.
+Proof with easy.
+  intros * ?%presup_sub...
+Qed.
+ +
+#[export]
+Hint Resolve presup_sub presup_sub_left presup_sub_right : mcltt.
+ +
+
+ +
+With presup_sub, we can prove similar for exp. +
+
+ +
+Lemma presup_exp_ctx : forall {Γ M A}, {{ Γ M : A }} -> {{ Γ }}.
+Proof with mautosolve.
+  induction 1...
+Qed.
+ +
+#[export]
+Hint Resolve presup_exp_ctx : mcltt.
+ +
+
+ +
+and other presuppositions about context well-formedness. +
+
+ +
+Lemma presup_sub_eq_ctx : forall {Γ Δ σ σ'}, {{ Γ s σ σ' : Δ }} -> {{ Γ }} /\ {{ Δ }}.
+Proof with mautosolve.
+  induction 1; destruct_pairs...
+Qed.
+ +
+Corollary presup_sub_eq_ctx_left : forall {Γ Δ σ σ'}, {{ Γ s σ σ' : Δ }} -> {{ Γ }}.
+Proof with easy.
+  intros * ?%presup_sub_eq_ctx...
+Qed.
+ +
+Corollary presup_sub_eq_ctx_right : forall {Γ Δ σ σ'}, {{ Γ s σ σ' : Δ }} -> {{ Δ }}.
+Proof with easy.
+  intros * ?%presup_sub_eq_ctx...
+Qed.
+ +
+#[export]
+Hint Resolve presup_sub_eq_ctx presup_sub_eq_ctx_left presup_sub_eq_ctx_right : mcltt.
+ +
+Lemma presup_exp_eq_ctx : forall {Γ M M' A}, {{ Γ M M' : A }} -> {{ Γ }}.
+Proof with mautosolve 2.
+  induction 1...
+Qed.
+ +
+#[export]
+Hint Resolve presup_exp_eq_ctx : mcltt.
+ +
+
+ +
+

Immediate Results of Context Presuppositions

+ +
+ + Recover some rules we had before adding subtyping. + Rest are recovered after presupposition lemmas (in SystemOpt). +
+
+ +
+Lemma wf_cumu : forall Γ A i,
+    {{ Γ A : Type@i }} ->
+    {{ Γ A : Type@(S i) }}.
+Proof with mautosolve.
+  intros.
+  enough {{ Γ }}...
+Qed.
+ +
+Lemma wf_exp_eq_cumu : forall Γ A A' i,
+    {{ Γ A A' : Type@i }} ->
+    {{ Γ A A' : Type@(S i) }}.
+Proof with mautosolve.
+  intros.
+  enough {{ Γ }}...
+Qed.
+ +
+#[export]
+Hint Resolve wf_cumu wf_exp_eq_cumu : mcltt.
+ +
+Lemma wf_ctx_sub_refl : forall Γ Δ,
+    {{ Γ Δ }} ->
+    {{ Γ Δ }}.
+Proof. induction 1; mauto. Qed.
+ +
+#[export]
+Hint Resolve wf_ctx_sub_refl : mcltt.
+ +
+Lemma wf_conv : forall Γ M A i A',
+    {{ Γ M : A }} ->
+    
+ +
+The next argument will be removed in SystemOpt +
+
+    {{ Γ A' : Type@i }} ->
+    {{ Γ A A' : Type@i }} ->
+    {{ Γ M : A' }}.
+Proof. mauto. Qed.
+ +
+#[export]
+Hint Resolve wf_conv : mcltt.
+ +
+Lemma wf_sub_conv : forall Γ σ Δ Δ',
+  {{ Γ s σ : Δ }} ->
+  {{ Δ Δ' }} ->
+  {{ Γ s σ : Δ' }}.
+Proof. mauto. Qed.
+ +
+#[export]
+Hint Resolve wf_sub_conv : mcltt.
+ +
+Lemma wf_exp_eq_conv : forall Γ M M' A A' i,
+   {{ Γ M M' : A }} ->
+   
+ +
+The next argument will be removed in SystemOpt +
+
+   {{ Γ A' : Type@i }} ->
+   {{ Γ A A' : Type@i }} ->
+   {{ Γ M M' : A' }}.
+Proof. mauto. Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_conv : mcltt.
+ +
+Lemma wf_sub_eq_conv : forall Γ σ σ' Δ Δ',
+    {{ Γ s σ σ' : Δ }} ->
+    {{ Δ Δ' }} ->
+    {{ Γ s σ σ' : Δ' }}.
+Proof. mauto. Qed.
+ +
+#[export]
+Hint Resolve wf_sub_eq_conv : mcltt.
+ +
+Add Parametric Morphism Γ : (wf_sub_eq Γ)
+    with signature wf_ctx_eq ==> eq ==> eq ==> iff as wf_sub_eq_morphism_iff3.
+Proof.
+  intros Δ Δ' H **; split; [| symmetry in H]; mauto.
+Qed.
+ +
+
+ +
+We can prove some additional lemmas for type presuppositions as well. +
+
+ +
+Lemma lift_exp_ge : forall {Γ A n m},
+    n <= m ->
+    {{ Γ A : Type@n }} ->
+    {{ Γ A : Type@m }}.
+Proof with mautosolve.
+  induction 1...
+Qed.
+ +
+#[export]
+Hint Resolve lift_exp_ge : mcltt.
+ +
+Corollary lift_exp_max_left : forall {Γ A n} m,
+    {{ Γ A : Type@n }} ->
+    {{ Γ A : Type@(max n m) }}.
+Proof with mautosolve.
+  intros.
+  assert (n <= max n m) by lia...
+Qed.
+ +
+Corollary lift_exp_max_right : forall {Γ A} n {m},
+    {{ Γ A : Type@m }} ->
+    {{ Γ A : Type@(max n m) }}.
+Proof with mautosolve.
+  intros.
+  assert (m <= max n m) by lia...
+Qed.
+ +
+Lemma lift_exp_eq_ge : forall {Γ A A' n m},
+    n <= m ->
+    {{ Γ A A': Type@n }} ->
+    {{ Γ A A' : Type@m }}.
+Proof with mautosolve.
+  induction 1; subst...
+Qed.
+ +
+#[export]
+Hint Resolve lift_exp_eq_ge : mcltt.
+ +
+Corollary lift_exp_eq_max_left : forall {Γ A A' n} m,
+    {{ Γ A A' : Type@n }} ->
+    {{ Γ A A' : Type@(max n m) }}.
+Proof with mautosolve.
+  intros.
+  assert (n <= max n m) by lia...
+Qed.
+ +
+Corollary lift_exp_eq_max_right : forall {Γ A A'} n {m},
+    {{ Γ A A' : Type@m }} ->
+    {{ Γ A A' : Type@(max n m) }}.
+Proof with mautosolve.
+  intros.
+  assert (m <= max n m) by lia...
+Qed.
+ +
+
+ +
+

Additional Lemmas for Syntactic PERs

+ +
+
+ +
+Lemma exp_eq_refl : forall {Γ M A},
+    {{ Γ M : A }} ->
+    {{ Γ M M : A }}.
+Proof. mauto. Qed.
+ +
+#[export]
+Hint Resolve exp_eq_refl : mcltt.
+ +
+Lemma exp_eq_trans_typ_max : forall {Γ i i' A A' A''},
+    {{ Γ A A' : Type@i }} ->
+    {{ Γ A' A'' : Type@i' }} ->
+    {{ Γ A A'' : Type@(max i i') }}.
+Proof with mautosolve 4.
+  intros.
+  assert {{ Γ A A' : Type@(max i i') }} by eauto using lift_exp_eq_max_left.
+  assert {{ Γ A' A'' : Type@(max i i') }} by eauto using lift_exp_eq_max_right...
+Qed.
+ +
+#[export]
+Hint Resolve exp_eq_trans_typ_max : mcltt.
+ +
+Lemma sub_eq_refl : forall {Γ σ Δ},
+    {{ Γ s σ : Δ }} ->
+    {{ Γ s σ σ : Δ }}.
+Proof. mauto. Qed.
+ +
+#[export]
+Hint Resolve sub_eq_refl : mcltt.
+ +
+
+ +
+

Lemmas for exp of {{{ Type@i }}}

+ +
+
+ +
+Lemma exp_sub_typ : forall {Δ Γ A σ i},
+    {{ Δ A : Type@i }} ->
+    {{ Γ s σ : Δ }} ->
+    {{ Γ A[σ] : Type@i }}.
+Proof with mautosolve 3.
+  intros.
+  econstructor; mauto 3.
+  econstructor...
+Qed.
+ +
+#[export]
+Hint Resolve exp_sub_typ : mcltt.
+ +
+Lemma presup_ctx_lookup_typ : forall {Γ A x},
+    {{ Γ }} ->
+    {{ #x : A Γ }} ->
+    exists i, {{ Γ A : Type@i }}.
+Proof with mautosolve 4.
+  intros * .
+  induction 1; inversion_clear ;
+    [assert {{ Γ, A Type@i[Wk] Type@i : Type@(S i) }} by mauto 4
+    | assert (exists i, {{ Γ A : Type@i }}) as [] by eauto]; econstructor...
+Qed.
+ +
+#[export]
+Hint Resolve presup_ctx_lookup_typ : mcltt.
+ +
+Lemma exp_eq_sub_cong_typ1 : forall {Δ Γ A A' σ i},
+    {{ Δ A A' : Type@i }} ->
+    {{ Γ s σ : Δ }} ->
+    {{ Γ A[σ] A'[σ] : Type@i }}.
+Proof with mautosolve 3.
+  intros.
+  eapply wf_exp_eq_conv...
+Qed.
+ +
+Lemma exp_eq_sub_cong_typ2' : forall {Δ Γ A σ τ i},
+    {{ Δ A : Type@i }} ->
+    {{ Γ s σ : Δ }} ->
+    {{ Γ s σ τ : Δ }} ->
+    {{ Γ A[σ] A[τ] : Type@i }}.
+Proof with mautosolve 3.
+  intros.
+  eapply wf_exp_eq_conv...
+Qed.
+ +
+Lemma exp_eq_sub_compose_typ : forall {Ψ Δ Γ A σ τ i},
+    {{ Ψ A : Type@i }} ->
+    {{ Δ s σ : Ψ }} ->
+    {{ Γ s τ : Δ }} ->
+    {{ Γ A[σ][τ] A[στ] : Type@i }}.
+Proof with mautosolve 3.
+  intros.
+  eapply wf_exp_eq_conv...
+Qed.
+ +
+#[export]
+Hint Resolve exp_eq_sub_cong_typ1 exp_eq_sub_cong_typ2' exp_eq_sub_compose_typ : mcltt.
+ +
+Lemma exp_eq_typ_sub_sub : forall {Γ Δ Ψ σ τ i},
+    {{ Δ s σ : Ψ }} ->
+    {{ Γ s τ : Δ }} ->
+    {{ Γ Type@i[σ][τ] Type@i : Type@(S i) }}.
+Proof. mauto. Qed.
+ +
+#[export]
+Hint Resolve exp_eq_typ_sub_sub : mcltt.
+#[export]
+Hint Rewrite -> @exp_eq_sub_compose_typ @exp_eq_typ_sub_sub using mauto 4 : mcltt.
+ +
+Lemma functional_ctx_lookup : forall {Γ A A' x},
+    {{ #x : A Γ }} ->
+    {{ #x : A' Γ }} ->
+    A = A'.
+Proof with mautosolve.
+  intros * Hx Hx'; gen A'.
+  induction Hx as [|* ? IHHx]; intros; inversion_clear Hx';
+    f_equal;
+    intuition.
+Qed.
+ +
+Lemma vlookup_0_typ : forall {Γ i},
+    {{ Γ }} ->
+    {{ Γ, Type@i # 0 : Type@i }}.
+Proof with mautosolve 4.
+  intros.
+  eapply wf_conv; mauto 4.
+  econstructor...
+Qed.
+ +
+Lemma vlookup_1_typ : forall {Γ i A j},
+    {{ Γ, Type@i A : Type@j }} ->
+    {{ Γ, Type@i, A # 1 : Type@i }}.
+Proof with mautosolve 4.
+  intros.
+  assert {{ Γ, Type@i s Wk : Γ }} by mauto 4.
+  assert {{ Γ, Type@i, A s Wk : Γ, Type@i }} by mauto 4.
+  eapply wf_conv...
+Qed.
+ +
+#[export]
+Hint Resolve vlookup_0_typ vlookup_1_typ : mcltt.
+ +
+Lemma exp_sub_typ_helper : forall {Γ σ Δ M i},
+    {{ Γ s σ : Δ }} ->
+    {{ Γ M : Type@i }} ->
+    {{ Γ M : Type@i[σ] }}.
+Proof.
+  intros.
+  do 2 (econstructor; mauto 4).
+Qed.
+ +
+#[export]
+Hint Resolve exp_sub_typ_helper : mcltt.
+ +
+Lemma exp_eq_var_0_sub_typ : forall {Γ σ Δ M i},
+    {{ Γ s σ : Δ }} ->
+    {{ Γ M : Type@i }} ->
+    {{ Γ #0[σ,,M] M : Type@i }}.
+Proof with mautosolve 4.
+  intros.
+  eapply wf_exp_eq_conv; mauto 3.
+  econstructor...
+Qed.
+ +
+Lemma exp_eq_var_1_sub_typ : forall {Γ σ Δ A i M j},
+    {{ Γ s σ : Δ }} ->
+    {{ Δ A : Type@i }} ->
+    {{ Γ M : A[σ] }} ->
+    {{ #0 : Type@j[Wk] Δ }} ->
+    {{ Γ #1[σ,,M] #0[σ] : Type@j }}.
+Proof with mautosolve 4.
+  inversion 4 as [? Δ'|]; subst.
+  assert {{ Δ' }} by mauto 4.
+  assert {{ Δ', Type@j s Wk : Δ' }} by mauto 4.
+  eapply wf_exp_eq_conv...
+Qed.
+ +
+#[export]
+Hint Resolve exp_eq_var_0_sub_typ exp_eq_var_1_sub_typ : mcltt.
+#[export]
+Hint Rewrite -> @exp_eq_var_0_sub_typ @exp_eq_var_1_sub_typ : mcltt.
+ +
+Lemma exp_eq_var_0_weaken_typ : forall {Γ A i},
+    {{ Γ, A }} ->
+    {{ #0 : Type@i[Wk] Γ }} ->
+    {{ Γ, A #0[Wk] #1 : Type@i }}.
+Proof with mautosolve 3.
+  inversion_clear 1.
+  inversion 1 as [? Γ'|]; subst.
+  assert {{ Γ' }} by mauto.
+  assert {{ Γ', Type@i s Wk : Γ' }} by mauto 4.
+  assert {{ Γ', Type@i, A s Wk : Γ', Type@i }} by mauto 4.
+  eapply wf_exp_eq_conv...
+Qed.
+ +
+#[export]
+Hint Resolve exp_eq_var_0_weaken_typ : mcltt.
+ +
+Lemma sub_extend_typ : forall {Γ σ Δ M i},
+    {{ Γ s σ : Δ }} ->
+    {{ Γ M : Type@i }} ->
+    {{ Γ s σ,,M : Δ, Type@i }}.
+Proof with mautosolve 4.
+  intros.
+  econstructor...
+Qed.
+ +
+#[export]
+Hint Resolve sub_extend_typ : mcltt.
+ +
+Lemma sub_eq_extend_cong_typ : forall {Γ σ σ' Δ M M' i},
+    {{ Γ s σ : Δ }} ->
+    {{ Γ s σ σ' : Δ }} ->
+    {{ Γ M M' : Type@i }} ->
+    {{ Γ s σ,,M σ',,M' : Δ, Type@i }}.
+Proof with mautosolve 4.
+  intros.
+  econstructor; mauto 3.
+  eapply wf_exp_eq_conv...
+Qed.
+ +
+Lemma sub_eq_extend_compose_typ : forall {Γ τ Γ' σ Γ'' A i M j},
+    {{ Γ' s σ : Γ'' }} ->
+    {{ Γ'' A : Type@i }} ->
+    {{ Γ' M : Type@j }} ->
+    {{ Γ s τ : Γ' }} ->
+    {{ Γ s (σ,,M) τ (σ τ),,M[τ] : Γ'', Type@j }}.
+Proof with mautosolve 4.
+  intros.
+  econstructor...
+Qed.
+ +
+Lemma sub_eq_p_extend_typ : forall {Γ σ Γ' M i},
+    {{ Γ' s σ : Γ }} ->
+    {{ Γ' M : Type@i }} ->
+    {{ Γ' s Wk (σ,,M) σ : Γ }}.
+Proof with mautosolve 4.
+  intros.
+  assert {{ Γ Type@i : Type@(S i) }} by mauto.
+  econstructor; mauto 3.
+Qed.
+ +
+#[export]
+Hint Resolve sub_eq_extend_cong_typ sub_eq_extend_compose_typ sub_eq_p_extend_typ : mcltt.
+ +
+Lemma sub_eq_wk_var0_id : forall {Γ A i},
+    {{ Γ A : Type@i }} ->
+    {{ Γ, A s Wk,,#0 Id : Γ, A }}.
+Proof with mautosolve 4.
+  intros * ?.
+  assert {{ Γ, A }} by mauto 3.
+  assert {{ Γ, A s (WkId),,#0[Id] Id : Γ, A }} by mauto.
+  assert {{ Γ, A s Wk WkId : Γ }} by mauto.
+  enough {{ Γ, A #0 #0[Id] : A[Wk] }}...
+Qed.
+ +
+#[export]
+Hint Resolve sub_eq_wk_var0_id : mcltt.
+#[export]
+Hint Rewrite -> @sub_eq_wk_var0_id using mauto 4 : mcltt.
+ +
+Lemma exp_eq_sub_sub_compose_cong_typ : forall {Γ Δ Δ' Ψ σ τ σ' τ' A i},
+    {{ Ψ A : Type@i }} ->
+    {{ Δ s σ : Ψ }} ->
+    {{ Δ' s σ' : Ψ }} ->
+    {{ Γ s τ : Δ }} ->
+    {{ Γ s τ' : Δ' }} ->
+    {{ Γ s στ σ'τ' : Ψ }} ->
+    {{ Γ A[σ][τ] A[σ'][τ'] : Type@i }}.
+Proof with mautosolve 4.
+  intros.
+  assert {{ Γ A[σ][τ] A[στ] : Type@i }} by mauto.
+  assert {{ Γ A[στ] A[σ'τ'] : Type@i }} by mauto.
+  enough {{ Γ A[σ'τ'] A[σ'][τ'] : Type@i }}...
+Qed.
+ +
+#[export]
+Hint Resolve exp_eq_sub_sub_compose_cong_typ : mcltt.
+ +
+
+ +
+

Lemmas for exp of {{{ }}}

+ +
+
+ +
+Lemma exp_sub_nat : forall {Δ Γ M σ},
+    {{ Δ M : }} ->
+    {{ Γ s σ : Δ }} ->
+    {{ Γ M[σ] : }}.
+Proof with mautosolve 3.
+  intros.
+  econstructor; mauto 3.
+  econstructor...
+Qed.
+ +
+#[export]
+Hint Resolve exp_sub_nat : mcltt.
+ +
+Lemma exp_eq_sub_cong_nat1 : forall {Δ Γ M M' σ},
+    {{ Δ M M' : }} ->
+    {{ Γ s σ : Δ }} ->
+    {{ Γ M[σ] M'[σ] : }}.
+Proof with mautosolve 3.
+  intros.
+  eapply wf_exp_eq_conv...
+Qed.
+ +
+Lemma exp_eq_sub_cong_nat2 : forall {Δ Γ M σ τ},
+    {{ Δ M : }} ->
+    {{ Γ s σ : Δ }} ->
+    {{ Γ s σ τ : Δ }} ->
+    {{ Γ M[σ] M[τ] : }}.
+Proof with mautosolve.
+  intros.
+  eapply wf_exp_eq_conv...
+Qed.
+ +
+Lemma exp_eq_sub_compose_nat : forall {Ψ Δ Γ M σ τ},
+    {{ Ψ M : }} ->
+    {{ Δ s σ : Ψ }} ->
+    {{ Γ s τ : Δ }} ->
+    {{ Γ M[σ][τ] M[στ] : }}.
+Proof with mautosolve 4.
+  intros.
+  eapply wf_exp_eq_conv...
+Qed.
+ +
+#[export]
+Hint Resolve exp_sub_nat exp_eq_sub_cong_nat1 exp_eq_sub_cong_nat2 exp_eq_sub_compose_nat : mcltt.
+ +
+Lemma exp_eq_nat_sub_sub : forall {Γ Δ Ψ σ τ},
+    {{ Δ s σ : Ψ }} ->
+    {{ Γ s τ : Δ }} ->
+    {{ Γ [σ][τ] : Type@0 }}.
+Proof. mauto. Qed.
+ +
+#[export]
+Hint Resolve exp_eq_nat_sub_sub : mcltt.
+ +
+Lemma exp_eq_nat_sub_sub_to_nat_sub : forall {Γ Δ Ψ Ψ' σ τ σ'},
+    {{ Δ s σ : Ψ }} ->
+    {{ Γ s τ : Δ }} ->
+    {{ Γ s σ' : Ψ' }} ->
+    {{ Γ [σ][τ] [σ'] : Type@0 }}.
+Proof. mauto. Qed.
+ +
+#[export]
+Hint Resolve exp_eq_nat_sub_sub_to_nat_sub : mcltt.
+ +
+Lemma vlookup_0_nat : forall {Γ},
+    {{ Γ }} ->
+    {{ Γ, # 0 : }}.
+Proof with mautosolve 4.
+  intros.
+  eapply wf_conv; mauto 4.
+  econstructor...
+Qed.
+ +
+Lemma vlookup_1_nat : forall {Γ A i},
+    {{ Γ, A : Type@i }} ->
+    {{ Γ, , A # 1 : }}.
+Proof with mautosolve 4.
+  intros.
+  assert {{ Γ, s Wk : Γ }} by mauto 4.
+  assert {{ Γ, , A s Wk : Γ, }} by mauto 4.
+  eapply wf_conv...
+Qed.
+ +
+#[export]
+Hint Resolve vlookup_0_nat vlookup_1_nat : mcltt.
+ +
+Lemma exp_sub_nat_helper : forall {Γ σ Δ M},
+    {{ Γ s σ : Δ }} ->
+    {{ Γ M : }} ->
+    {{ Γ M : [σ] }}.
+Proof.
+  intros.
+  do 2 (econstructor; mauto 4).
+Qed.
+ +
+#[export]
+Hint Resolve exp_sub_nat_helper : mcltt.
+ +
+Lemma exp_eq_var_0_sub_nat : forall {Γ σ Δ M},
+    {{ Γ s σ : Δ }} ->
+    {{ Γ M : }} ->
+    {{ Γ #0[σ,,M] M : }}.
+Proof with mautosolve 3.
+  intros.
+  eapply wf_exp_eq_conv; mauto 3.
+  econstructor...
+Qed.
+ +
+Lemma exp_eq_var_1_sub_nat : forall {Γ σ Δ A i M},
+    {{ Γ s σ : Δ }} ->
+    {{ Δ A : Type@i }} ->
+    {{ Γ M : A[σ] }} ->
+    {{ #0 : [Wk] Δ }} ->
+    {{ Γ #1[σ,,M] #0[σ] : }}.
+Proof with mautosolve 4.
+  inversion 4 as [? Δ'|]; subst.
+  assert {{ Γ #1[σ,, M] #0[σ] : [Wk][σ] }} by mauto 4.
+  assert {{ Γ [Wk][σ] : Type@0 }}...
+Qed.
+ +
+#[export]
+Hint Resolve exp_eq_var_0_sub_nat exp_eq_var_1_sub_nat : mcltt.
+ +
+Lemma exp_eq_var_0_weaken_nat : forall {Γ A},
+    {{ Γ, A }} ->
+    {{ #0 : [Wk] Γ }} ->
+    {{ Γ, A #0[Wk] #1 : }}.
+Proof with mautosolve 4.
+  inversion 1; subst.
+  inversion 1 as [? Γ'|]; subst.
+  assert {{ Γ', , A #0[Wk] # 1 : [Wk][Wk] }} by mauto 4.
+  assert {{ Γ', , A [Wk][Wk] : Type@0 }}...
+Qed.
+ +
+#[export]
+Hint Resolve exp_eq_var_0_weaken_nat : mcltt.
+ +
+Lemma sub_extend_nat : forall {Γ σ Δ M},
+    {{ Γ s σ : Δ }} ->
+    {{ Γ M : }} ->
+    {{ Γ s σ,,M : Δ , }}.
+Proof with mautosolve 3.
+  intros.
+  econstructor...
+Qed.
+ +
+#[export]
+Hint Resolve sub_extend_nat : mcltt.
+ +
+Lemma sub_eq_extend_cong_nat : forall {Γ σ σ' Δ M M'},
+    {{ Γ s σ : Δ }} ->
+    {{ Γ s σ σ' : Δ }} ->
+    {{ Γ M M' : }} ->
+    {{ Γ s σ,,M σ',,M' : Δ , }}.
+Proof with mautosolve 4.
+  intros.
+  econstructor; mauto 3.
+  eapply wf_exp_eq_conv...
+Qed.
+ +
+Lemma sub_eq_extend_compose_nat : forall {Γ τ Γ' σ Γ'' M},
+    {{ Γ' s σ : Γ'' }} ->
+    {{ Γ' M : }} ->
+    {{ Γ s τ : Γ' }} ->
+    {{ Γ s (σ,,M) τ (σ τ),,M[τ] : Γ'' , }}.
+Proof with mautosolve 3.
+  intros.
+  econstructor...
+Qed.
+ +
+Lemma sub_eq_p_extend_nat : forall {Γ σ Γ' M},
+    {{ Γ' s σ : Γ }} ->
+    {{ Γ' M : }} ->
+    {{ Γ' s Wk (σ,,M) σ : Γ }}.
+Proof with mautosolve 3.
+  intros.
+  assert {{ Γ : Type@0 }} by mauto.
+  econstructor...
+Qed.
+ +
+#[export]
+Hint Resolve sub_eq_extend_cong_nat sub_eq_extend_compose_nat sub_eq_p_extend_nat : mcltt.
+ +
+Lemma exp_eq_sub_sub_compose_cong_nat : forall {Γ Δ Δ' Ψ σ τ σ' τ' M},
+    {{ Ψ M : }} ->
+    {{ Δ s σ : Ψ }} ->
+    {{ Δ' s σ' : Ψ }} ->
+    {{ Γ s τ : Δ }} ->
+    {{ Γ s τ' : Δ' }} ->
+    {{ Γ s στ σ'τ' : Ψ }} ->
+    {{ Γ M[σ][τ] M[σ'][τ'] : }}.
+Proof with mautosolve 4.
+  intros.
+  assert {{ Γ M[σ][τ] M[στ] : }} by mauto.
+  assert {{ Γ M[στ] M[σ'τ'] : }} by mauto.
+  enough {{ Γ M[σ'τ'] M[σ'][τ'] : }}...
+Qed.
+ +
+#[export]
+Hint Resolve exp_eq_sub_sub_compose_cong_nat : mcltt.
+ +
+
+ +
+

Other Tedious Lemmas

+ +
+
+ +
+Lemma exp_eq_sub_sub_compose_cong : forall {Γ Δ Δ' Ψ σ τ σ' τ' M A i},
+    {{ Ψ A : Type@i }} ->
+    {{ Ψ M : A }} ->
+    {{ Δ s σ : Ψ }} ->
+    {{ Δ' s σ' : Ψ }} ->
+    {{ Γ s τ : Δ }} ->
+    {{ Γ s τ' : Δ' }} ->
+    {{ Γ s στ σ'τ' : Ψ }} ->
+    {{ Γ M[σ][τ] M[σ'][τ'] : A[στ] }}.
+Proof with mautosolve 4.
+  intros.
+  assert {{ Γ A[στ] A[σ'τ'] : Type@i }} by mauto.
+  assert {{ Γ M[σ][τ] M[στ] : A[στ] }} by mauto.
+  assert {{ Γ M[στ] M[σ'τ'] : A[στ] }} by mauto.
+  assert {{ Γ M[σ'τ'] M[σ'][τ'] : A[σ'τ'] }} by mauto.
+  enough {{ Γ M[σ'τ'] M[σ'][τ'] : A[στ] }} by mauto.
+  eapply wf_exp_eq_conv...
+Qed.
+ +
+#[export]
+Hint Resolve exp_eq_sub_sub_compose_cong : mcltt.
+ +
+Lemma ctxeq_ctx_lookup : forall {Γ Δ A x},
+    {{ Γ Δ }} ->
+    {{ #x : A Γ }} ->
+    exists B i,
+      {{ #x : B Δ }} /\
+        {{ Γ A B : Type@i }} /\
+        {{ Δ A B : Type@i }}.
+Proof with mautosolve.
+  intros * HΓΔ Hx; gen Δ.
+  induction Hx as [|* ? IHHx]; inversion_clear 1 as [|? ? ? ? ? HΓΔ'];
+    [|specialize (IHHx _ HΓΔ')]; destruct_conjs; repeat eexists...
+Qed.
+ +
+#[export]
+Hint Resolve ctxeq_ctx_lookup : mcltt.
+ +
+Lemma sub_id_on_typ : forall {Γ M A i},
+    {{ Γ A : Type@i }} ->
+    {{ Γ M : A }} ->
+    {{ Γ M : A[Id] }}.
+Proof with mautosolve 4.
+  intros.
+  eapply wf_conv...
+Qed.
+ +
+#[export]
+Hint Resolve sub_id_on_typ : mcltt.
+ +
+Lemma sub_id_extend : forall {Γ M A i},
+    {{ Γ A : Type@i }} ->
+    {{ Γ M : A }} ->
+    {{ Γ s Id,,M : Γ, A }}.
+Proof with mautosolve 4.
+  intros.
+  econstructor...
+Qed.
+ +
+#[export]
+Hint Resolve sub_id_extend : mcltt.
+ +
+Lemma sub_eq_p_id_extend : forall {Γ M A i},
+    {{ Γ A : Type@i }} ->
+    {{ Γ M : A }} ->
+    {{ Γ s Wk (Id,,M) Id : Γ }}.
+Proof with mautosolve 4.
+  intros.
+  econstructor...
+Qed.
+ +
+#[export]
+Hint Resolve sub_eq_p_id_extend : mcltt.
+#[export]
+Hint Rewrite -> @sub_eq_p_id_extend using mauto 4 : mcltt.
+ +
+Lemma sub_q : forall {Γ A i σ Δ},
+    {{ Δ A : Type@i }} ->
+    {{ Γ s σ : Δ }} ->
+    {{ Γ, A[σ] s q σ : Δ, A }}.
+Proof with mautosolve 3.
+  intros.
+  assert {{ Γ A[σ] : Type@i }} by mauto 4.
+  assert {{ Γ, A[σ] s Wk : Γ }} by mauto 4.
+  assert {{ Γ, A[σ] # 0 : A[σ][Wk] }} by mauto 4.
+  econstructor; mauto 3.
+  eapply wf_conv...
+Qed.
+ +
+Lemma sub_q_typ : forall {Γ σ Δ i},
+    {{ Γ s σ : Δ }} ->
+    {{ Γ, Type@i s q σ : Δ, Type@i }}.
+Proof with mautosolve 4.
+  intros.
+  assert {{ Γ }} by mauto 3.
+  assert {{ Γ, Type@i s Wk : Γ }} by mauto 4.
+  assert {{ Γ, Type@i s σ Wk : Δ }} by mauto 4.
+  assert {{ Γ, Type@i # 0 : Type@i[Wk] }} by mauto 4.
+  assert {{ Γ, Type@i # 0 : Type@i }}...
+Qed.
+ +
+Lemma sub_q_nat : forall {Γ σ Δ},
+    {{ Γ s σ : Δ }} ->
+    {{ Γ, s q σ : Δ, }}.
+Proof with mautosolve 4.
+  intros.
+  assert {{ Γ }} by mauto 3.
+  assert {{ Γ, s Wk : Γ }} by mauto 4.
+  assert {{ Γ, s σ Wk : Δ }} by mauto 4.
+  assert {{ Γ, # 0 : [Wk] }} by mauto 4.
+  assert {{ Γ, # 0 : }}...
+Qed.
+ +
+#[export]
+Hint Resolve sub_q sub_q_typ sub_q_nat : mcltt.
+ +
+Lemma exp_eq_var_1_sub_q_sigma_nat : forall {Γ A i σ Δ},
+    {{ Δ, A : Type@i }} ->
+    {{ Γ s σ : Δ }} ->
+    {{ Γ, , A[q σ] #1[q (q σ)] #1 : }}.
+Proof with mautosolve 4.
+  intros.
+  assert {{ Γ, s q σ : Δ, }} by mauto.
+  assert {{ Γ, , A[q σ] }} by mauto 3.
+  assert {{ Δ, #0 : }} by mauto.
+  assert {{ Γ, , A[q σ] #0 : A[q σ][Wk] }} by mauto 4.
+  assert {{ Γ, , A[q σ] A[q σWk] A[q σ][Wk] : Type@i }} by mauto 4.
+  assert {{ Γ, , A[q σ] #0 : A[q σWk] }} by (eapply wf_conv; mauto 4).
+  assert {{ Γ, , A[q σ] s q σWk : Δ, }} by mauto 4.
+  assert {{ Γ, , A[q σ] #1[q (q σ)] #0[q σWk] : }} by mauto 4.
+  assert {{ Γ, , A[q σ] #0[q σWk] #0[q σ][Wk] : }} by mauto 4.
+  assert {{ Γ, s σWk : Δ }} by mauto 4.
+  assert {{ Γ, #0 : [σWk] }} by (eapply wf_conv; mauto 4).
+  assert {{ Γ, #0[q σ] #0 : }} by mauto 4.
+  assert {{ Γ, , A[q σ] #0[q σ][Wk] #0[Wk] : }} by mauto 4.
+  econstructor...
+Qed.
+ +
+#[export]
+Hint Resolve exp_eq_var_1_sub_q_sigma_nat : mcltt.
+ +
+Lemma sub_id_extend_zero : forall {Γ},
+    {{ Γ }} ->
+    {{ Γ s Id,,zero : Γ, }}.
+Proof. mauto. Qed.
+ +
+Lemma sub_weak_compose_weak_extend_succ_var_1 : forall {Γ A i},
+    {{ Γ, A : Type@i }} ->
+    {{ Γ, , A s (Wk Wk),,succ #1 : Γ, }}.
+Proof with mautosolve 4.
+  intros.
+  assert {{ Γ, , A s Wk : Γ, }} by mauto 4.
+  enough {{ Γ, , A s Wk Wk : Γ }}...
+Qed.
+ +
+Lemma sub_eq_id_extend_nat_compose_sigma : forall {Γ M σ Δ},
+    {{ Γ s σ : Δ }} ->
+    {{ Δ M : }} ->
+    {{ Γ s (Id,,M) σ σ,,M[σ] : Δ, }}.
+Proof with mautosolve 4.
+  intros.
+  assert {{ Γ s (Id,,M) σ (Id σ),,M[σ] : Δ, }} by mauto 4.
+  enough {{ Γ s (Id σ),,M[σ] σ,,M[σ] : Δ, }} by mauto 4.
+  eapply sub_eq_extend_cong_nat...
+Qed.
+ +
+Lemma sub_eq_id_extend_compose_sigma : forall {Γ M A σ Δ i},
+    {{ Γ s σ : Δ }} ->
+    {{ Δ A : Type@i }} ->
+    {{ Δ M : A }} ->
+    {{ Γ s (Id,,M) σ σ,,M[σ] : Δ, A }}.
+Proof with mautosolve 4.
+  intros.
+  assert {{ Δ s Id : Δ }} by mauto.
+  assert {{ Δ M : A[Id] }} by mauto.
+  assert {{ Γ s (Id,,M) σ (Id σ),,M[σ] : Δ, A }} by mauto 3.
+  assert {{ Γ M[σ] : A[Id][σ] }} by mauto.
+  assert {{ Γ A[Id][σ] A[Idσ] : Type@i }} by mauto.
+  assert {{ Γ M[σ] : A[Idσ] }} by mauto 4.
+  enough {{ Γ M[σ] M[σ] : A[Idσ] }}...
+Qed.
+ +
+#[export]
+Hint Resolve sub_id_extend_zero sub_weak_compose_weak_extend_succ_var_1 sub_eq_id_extend_nat_compose_sigma sub_eq_id_extend_compose_sigma : mcltt.
+ +
+Lemma sub_eq_sigma_compose_weak_id_extend : forall {Γ M A i σ Δ},
+    {{ Γ A : Type@i }} ->
+    {{ Γ s σ : Δ }} ->
+    {{ Γ M : A }} ->
+    {{ Γ s (σ Wk) (Id,,M) σ : Δ }}.
+Proof with mautosolve.
+  intros.
+  assert {{ Γ s Id,,M : Γ, A }} by mauto.
+  assert {{ Γ s (σ Wk) (Id,,M) σ (Wk (Id,,M)) : Δ }} by mauto 4.
+  assert {{ Γ s Wk (Id,,M) Id : Γ }} by mauto.
+  enough {{ Γ s σ (Wk (Id,,M)) σ Id : Δ }} by mauto.
+  econstructor...
+Qed.
+ +
+#[export]
+Hint Resolve sub_eq_sigma_compose_weak_id_extend : mcltt.
+ +
+Lemma sub_eq_q_sigma_id_extend : forall {Γ M A i σ Δ},
+    {{ Δ A : Type@i }} ->
+    {{ Γ s σ : Δ }} ->
+    {{ Γ M : A[σ] }} ->
+    {{ Γ s q σ (Id,,M) σ,,M : Δ, A }}.
+Proof with mautosolve 4.
+  intros.
+  assert {{ Γ }} by mauto 3.
+  assert {{ Γ A[σ] : Type@i }} by mauto.
+  assert {{ Γ M : A[σ] }} by mauto.
+  assert {{ Γ s Id,,M : Γ, A[σ] }} by mauto.
+  assert {{ Γ, A[σ] s Wk : Γ }} by mauto.
+  assert {{ Γ, A[σ] #0 : A[σ][Wk] }} by mauto.
+  assert {{ Γ, A[σ] #0 : A[σWk] }} by (eapply wf_conv; mauto 3).
+  assert {{ Γ s q σ (Id,,M) ((σ Wk) (Id,,M)),,#0[Id,,M] : Δ, A }} by mauto.
+  assert {{ Γ s (σ Wk) (Id,,M) σ : Δ }} by mauto.
+  assert {{ Γ M : A[σ][Id] }} by mauto 4.
+  assert {{ Γ #0[Id,,M] M : A[σ][Id] }} by mauto 3.
+  assert {{ Γ #0[Id,,M] M : A[σ] }} by mauto.
+  enough {{ Γ #0[Id,,M] M : A[(σ Wk) (Id,,M)] }} by mauto.
+  eapply wf_exp_eq_conv...
+Qed.
+ +
+#[export]
+Hint Resolve sub_eq_q_sigma_id_extend : mcltt.
+#[export]
+Hint Rewrite -> @sub_eq_q_sigma_id_extend using mauto 4 : mcltt.
+ +
+Lemma sub_eq_p_q_sigma : forall {Γ A i σ Δ},
+    {{ Δ A : Type@i }} ->
+    {{ Γ s σ : Δ }} ->
+    {{ Γ, A[σ] s Wk q σ σ Wk : Δ }}.
+Proof with mautosolve 3.
+  intros.
+  assert {{ Γ, A[σ] s Wk : Γ }} by mauto 4.
+  assert {{ Γ, A[σ] #0 : A[σ][Wk] }} by mauto 3.
+  enough {{ Γ, A[σ] #0 : A[σ Wk] }} by mauto.
+  eapply wf_conv...
+Qed.
+ +
+#[export]
+Hint Resolve sub_eq_p_q_sigma : mcltt.
+ +
+Lemma sub_eq_p_q_sigma_nat : forall {Γ σ Δ},
+    {{ Γ s σ : Δ }} ->
+    {{ Γ, s Wk q σ σ Wk : Δ }}.
+Proof with mautosolve.
+  intros.
+  assert {{ Γ, #0 : }}...
+Qed.
+ +
+#[export]
+Hint Resolve sub_eq_p_q_sigma_nat : mcltt.
+ +
+Lemma sub_eq_p_p_q_q_sigma_nat : forall {Γ A i σ Δ},
+    {{ Δ, A : Type@i }} ->
+    {{ Γ s σ : Δ }} ->
+    {{ Γ, , A[q σ] s Wk (Wk q (q σ)) (σ Wk) Wk : Δ }}.
+Proof with mautosolve 3.
+  intros.
+  assert {{ Γ, A[q σ] : Type@i }} by mauto.
+  assert {{ Γ, , A[q σ] }} by mauto 3.
+  assert {{ Δ, }} by mauto 3.
+  assert {{ Γ, , A[q σ] s Wkq (q σ) q σ Wk : Δ, }} by mauto.
+  assert {{ Γ, , A[q σ] s Wk(Wkq (q σ)) Wk (q σ Wk) : Δ }} by mauto 3.
+  assert {{ Δ, s Wk : Δ }} by mauto.
+  assert {{ Γ, s q σ : Δ, }} by mauto.
+  assert {{ Γ, , A[q σ] s Wk (q σ Wk) (Wk q σ) Wk : Δ }} by mauto 4.
+  assert {{ Γ, s Wk q σ σ Wk : Δ }} by mauto.
+  enough {{ Γ, , A[q σ] s (Wk q σ) Wk (σ Wk) Wk : Δ }}...
+Qed.
+ +
+#[export]
+Hint Resolve sub_eq_p_p_q_q_sigma_nat : mcltt.
+ +
+Lemma sub_eq_q_sigma_compose_weak_weak_extend_succ_var_1 : forall {Γ A i σ Δ},
+    {{ Δ, A : Type@i }} ->
+    {{ Γ s σ : Δ }} ->
+    {{ Γ, , A[q σ] s q σ ((Wk Wk),,succ #1) ((Wk Wk),,succ #1) q (q σ) : Δ, }}.
+Proof with mautosolve 4.
+  intros.
+  assert {{ Δ, , A }} by mauto 3.
+  assert {{ Γ, }} by mauto 3.
+  assert {{ Γ, s Wk : Γ }} by mauto 3.
+  assert {{ Γ, s σWk : Δ }} by mauto 3.
+  assert {{ Γ, A[q σ] : Type@i }} by mauto 3.
+  set (Γ' := {{{ Γ, , A[q σ] }}}).
+  set (WkWksucc := {{{ (WkWk),,succ #1 }}}).
+  assert {{ Γ' }} by mauto 2.
+  assert {{ Γ' s WkWk : Γ }} by mauto 4.
+  assert {{ Γ' s WkWksucc : Γ, }} by mauto.
+  assert {{ Γ, #0 : }} by mauto.
+  assert {{ Γ' s q σWkWksucc ((σWk)WkWksucc),,#0[WkWksucc] : Δ, }} by mautosolve 3.
+  assert {{ Γ' #1 : [Wk][Wk] }} by mauto.
+  assert {{ Γ' [Wk][Wk] : Type@0 }} by mauto 3.
+  assert {{ Γ' #1 : }} by mauto 2.
+  assert {{ Γ' succ #1 : }} by mauto.
+  assert {{ Γ' s WkWkWksucc : Γ }} by mauto 4.
+  assert {{ Γ' s WkWkWksucc WkWk : Γ }} by mauto 4.
+  assert {{ Γ s σ σ : Δ }} by mauto.
+  assert {{ Γ' s σ(WkWkWksucc) σ(WkWk) : Δ }} by mauto 3.
+  assert {{ Γ' s (σWk)WkWksucc σ(WkWk) : Δ }} by mauto 3.
+  assert {{ Γ' s σ(WkWk) (σWk)Wk : Δ }} by mauto 4.
+  assert {{ Γ' s (σWk)Wk Wk(Wkq (q σ)) : Δ }} by mauto.
+  assert {{ Δ, s Wk : Δ }} by mauto 4.
+  assert {{ Δ, , A s Wk : Δ, }} by mauto 4.
+  assert {{ Δ, , A s WkWk : Δ }} by mauto 4.
+  assert {{ Γ' s q (q σ) : Δ, , A }} by mauto.
+  assert {{ Γ' s Wk(Wkq (q σ)) (WkWk)q (q σ) : Δ }} by mauto 3.
+  assert {{ Γ' s σ(WkWk) (WkWk)q (q σ) : Δ }} by mauto 3.
+  assert {{ Γ' #0[WkWksucc] succ #1 : }} by mauto.
+  assert {{ Γ' succ #1[q (q σ)] succ #1 : }} by mauto 3.
+  assert {{ Δ, , A #1 : }} by mauto 2.
+  assert {{ Γ' succ #1 (succ #1)[q (q σ)] : }} by mauto 4.
+  assert {{ Γ' #0[WkWksucc] (succ #1)[q (q σ)] : }} by mauto 2.
+  assert {{ Γ' s (σWk)WkWksucc : Δ }} by mauto 3.
+  assert {{ Γ' s ((σWk)WkWksucc),,#0[WkWksucc] ((WkWk)q (q σ)),,(succ #1)[q (q σ)] : Δ, }} by mauto 3.
+  assert {{ Δ, , A #1 : [Wk][Wk] }} by mauto 4.
+  assert {{ Δ, , A [Wk][Wk] : Type@0 }} by mauto 3.
+  assert {{ Δ, , A succ #1 : }} by mauto.
+  enough {{ Γ' s ((WkWk)q (q σ)),,(succ #1)[q (q σ)] WkWksuccq (q σ) : Δ, }}...
+Qed.
+ +
+#[export]
+Hint Resolve sub_eq_q_sigma_compose_weak_weak_extend_succ_var_1 : mcltt.
+ +
+
+ +
+

Lemmas for wf_subtyp

+ +
+
+ +
+Fact wf_subtyp_refl : forall {Γ A i},
+    {{ Γ A : Type@i }} ->
+    {{ Γ A A }}.
+Proof. mauto. Qed.
+ +
+#[export]
+Hint Resolve wf_subtyp_refl : mcltt.
+ +
+Lemma wf_subtyp_ge : forall {Γ i j},
+    {{ Γ }} ->
+    i <= j ->
+    {{ Γ Type@i Type@j }}.
+Proof.
+  induction 2; mauto 4.
+Qed.
+ +
+#[export]
+Hint Resolve wf_subtyp_ge : mcltt.
+ +
+Lemma wf_subtyp_sub : forall {Δ A A'},
+    {{ Δ A A' }} ->
+    forall Γ σ,
+    {{ Γ s σ : Δ }} ->
+    {{ Γ A[σ] A'[σ] }}.
+Proof.
+  induction 1; intros; mauto 4.
+  - transitivity {{{ Type@i }}}; [econstructor; mauto 4 |].
+    transitivity {{{ Type@j }}}; [| econstructor; mauto 4].
+    mauto 3.
+  - transitivity {{{ Π (A[σ]) (B[q σ]) }}}; [econstructor; mauto |].
+    transitivity {{{ Π (A'[σ]) (B'[q σ]) }}}; [ | econstructor; mauto 4].
+    eapply wf_subtyp_pi with (i := i); mauto 4.
+Qed.
+ +
+#[export]
+Hint Resolve wf_subtyp_sub : mcltt.
+ +
+Lemma wf_subtyp_univ_weaken : forall {Γ i j A},
+    {{ Γ Type@i Type@j }} ->
+    {{ Γ, A }} ->
+    {{ Γ, A Type@i Type@j }}.
+Proof.
+  intros.
+  eapply wf_subtyp_sub with (σ := {{{ Wk }}}) in H.
+  - transitivity {{{ Type@i[Wk] }}}; [econstructor; mauto |].
+    etransitivity; mauto.
+  - mauto.
+Qed.
+ +
+Lemma ctx_sub_ctx_lookup : forall {Γ Δ},
+    {{ Δ Γ }} ->
+    forall {A x},
+      {{ #x : A Γ }} ->
+      exists B,
+        {{ #x : B Δ }} /\
+          {{ Δ B A }}.
+Proof with (do 2 eexists; repeat split; mautosolve).
+  induction 1; intros * Hx; progressive_inversion.
+  dependent destruction Hx.
+  - idtac...
+  - edestruct IHwf_ctx_sub as [? []]; try eassumption...
+Qed.
+ +
+#[export]
+Hint Resolve ctx_sub_ctx_lookup : mcltt.
+ +
+Lemma sub_lookup_var0 : forall Δ Γ σ M1 M2 B i,
+    {{Δ s σ : Γ}} ->
+    {{Γ B : Type@i}} ->
+    {{Δ M1 : B[σ]}} ->
+    {{Δ M2 : B[σ]}} ->
+    {{Δ #0[σ,,M1,,M2] M2 : B[σ]}}.
+Proof.
+  intros.
+  assert {{ Γ , B B[Wk] : Type@i }} by mauto.
+  assert {{ Δ s σ ,, M1 : Γ, B}} by mauto 4.
+  assert {{ Δ B[Wk][σ,,M1] : Type @ i }} by mauto 4.
+  assert {{ Δ B[Wk][σ,,M1] B[σ] : Type @ i }}.
+  {
+    transitivity {{{B[Wk (σ,,M1)]}}}.
+    - eapply exp_eq_sub_compose_typ; mauto 4.
+    - eapply exp_eq_sub_cong_typ2'; mauto 4.
+  }
+  eapply wf_exp_eq_conv;
+    [eapply wf_exp_eq_var_0_sub with (A := {{{B[Wk]}}}) | |];
+    mauto 4.
+Qed.
+ +
+Lemma id_sub_lookup_var0 : forall Γ M1 M2 B i,
+    {{Γ B : Type@i}} ->
+    {{Γ M1 : B}} ->
+    {{Γ M2 : B}} ->
+    {{Γ #0[Id,,M1,,M2] M2 : B}}.
+Proof.
+  intros.
+  eapply wf_exp_eq_conv;
+    [eapply sub_lookup_var0 | |];
+    mauto 3.
+Qed.
+ +
+Lemma sub_lookup_var1 : forall Δ Γ σ M1 M2 B i,
+    {{Δ s σ : Γ}} ->
+    {{Γ B : Type@i}} ->
+    {{Δ M1 : B[σ]}} ->
+    {{Δ M2 : B[σ]}} ->
+    {{Δ #1[σ,,M1,,M2] M1 : B[σ]}}.
+Proof.
+  intros.
+  assert {{ Γ , B B[Wk] : Type@i }} by mauto.
+  assert {{ Δ s σ ,, M1 : Γ, B}} by mauto 4.
+  assert {{ Δ B[Wk][σ,,M1] : Type @ i }} by mauto 4.
+  assert {{ Δ B[Wk][σ,,M1] B[σ] : Type @ i }}.
+  {
+    transitivity {{{B[Wk (σ,,M1)]}}}.
+    - eapply exp_eq_sub_compose_typ; mauto 4.
+    - eapply exp_eq_sub_cong_typ2'; mauto 4.
+  }
+  transitivity {{{#0[σ,,M1]}}}.
+  - eapply wf_exp_eq_conv;
+      [eapply wf_exp_eq_var_S_sub | |];
+      mauto 4.
+  - eapply wf_exp_eq_conv;
+    [eapply wf_exp_eq_var_0_sub with (A := B) | |];
+    mauto 2.
+    mauto.
+Qed.
+ +
+Lemma id_sub_lookup_var1 : forall Γ M1 M2 B i,
+    {{Γ B : Type@i}} ->
+    {{Γ M1 : B}} ->
+    {{Γ M2 : B}} ->
+    {{Γ #1[Id,,M1,,M2] M1 : B}}.
+Proof.
+  intros.
+  eapply wf_exp_eq_conv;
+    [eapply sub_lookup_var1 | |];
+    mauto 3.
+Qed.
+ +
+Lemma exp_eq_var_1_sub_q_sigma : forall {Γ A i B j σ Δ},
+    {{ Δ B : Type@j }} ->
+    {{ Δ, B A : Type@i }} ->
+    {{ Γ s σ : Δ }} ->
+    {{ Γ, B[σ], A[q σ] #1[q (q σ)] #1 : B[σ][Wk][Wk] }}.
+Proof with mautosolve 4.
+  intros.
+  assert {{ Γ, B[σ] s q σ : Δ, B }} by mauto.
+  assert {{ Γ, B[σ], A[q σ] }} by mauto 3.
+  assert {{ Δ, B B[Wk] : Type@j }} by mauto.
+  assert {{ Δ, B #0 : B[Wk] }} by mauto.
+  assert {{ Γ, B[σ], A[q σ] #0 : A[q σ][Wk] }} by mauto 4.
+  assert {{ Γ, B[σ], A[q σ] A[q σWk] A[q σ][Wk] : Type@i }} by mauto 4.
+  assert {{ Γ, B[σ], A[q σ] #0 : A[q σWk] }} by (eapply wf_conv; mauto 4).
+  assert {{ Γ, B[σ], A[q σ] s q σWk : Δ, B }} by mauto 4.
+  assert {{ Γ B[σ] : Type@j }} by mauto 3.
+  assert {{ Γ,B[σ] B[σ][Wk] : Type@j }} by mauto 4.
+  assert {{Γ, B[σ], A[q σ] B[σ][Wk][Wk] : Type@j}} by mauto 4.
+  assert {{Γ, B[σ],A[q σ] B[Wk][q σ Wk] : Type@j}} by mauto.
+  assert {{Γ, B[σ] B[Wk][q σ] B[σ][Wk] : Type@j}}.
+  {
+    transitivity {{{B[Wk q σ]}}};
+      [mauto 4 | transitivity {{{B[σ Wk]}}}];
+      [eapply exp_eq_sub_cong_typ2'; mauto 4 | mauto].
+  }
+  assert {{Γ, B[σ],A[q σ] B[Wk][q σ Wk] B[σ][Wk][Wk] : Type@j}}.
+  {
+    transitivity {{{B[Wk][q σ][Wk]}}};
+      [mauto 4 |].
+    eapply exp_eq_sub_cong_typ1; mauto 3.
+  }
+  assert {{ Γ, B[σ], A[q σ] #1[q (q σ)] #0[q σWk] : B[σ][Wk][Wk] }} by mauto 3.
+  assert {{ Γ, B[σ], A[q σ] #0[q σWk] #0[q σ][Wk] : B[σ][Wk][Wk] }} by mauto 4.
+  assert {{ Γ, B[σ] s σWk : Δ }} by mauto 4.
+  assert {{ Γ, B[σ] #0 : B[σWk] }}.
+  {
+    eapply wf_conv with (A:={{{B[σ][Wk]}}}); mauto 2; mauto 4.
+  }
+  assert {{ Γ, B[σ] #0[q σ] #0 : B[σ Wk] }} by mauto 4.
+  assert {{ Γ, B[σ], A[q σ] #0[q σ][Wk] #0[Wk] : B[σ Wk][Wk] }} by mauto 4.
+  assert {{ Γ, B[σ], A[q σ] B[σ Wk][Wk] B[σ][Wk][Wk] : Type@j}}.
+  {
+    eapply exp_eq_sub_cong_typ1; mauto 3.
+    symmetry.
+    mauto 4.
+  }
+  assert {{ Γ, B[σ], A[q σ] #0[q σ][Wk] #0[Wk] : B[σ][Wk][Wk] }} by mauto 4.
+  etransitivity; mauto 2.
+  transitivity {{{#0[q σ][Wk]}}}; mauto 3.
+Qed.
+ +
+
+ +
+

Types Presuppositions

+ +
+
+ +
+Lemma presup_exp_typ : forall {Γ M A},
+    {{ Γ M : A }} ->
+    exists i, {{ Γ A : Type@i }}.
+Proof.
+  induction 1; assert {{ Γ }} by mauto 3; destruct_conjs; mauto 3.
+  - enough {{ Γ s Id,,M : Γ, }}; mauto 3.
+  - eexists; mauto 4 using lift_exp_max_left, lift_exp_max_right.
+  - enough {{ Γ s Id,,N : Γ, A }}; mauto 3.
+  - assert {{ Γ s Id,,M1 : Γ, A }} by mauto 3.
+    assert {{ Γ, A s Wk : Γ }} by mauto 3.
+    assert {{ Γ, A A[Wk] : Type@i }} by mauto 3.
+    assert {{ Γ, A, A[Wk] s Wk : Γ, A }} by mauto 4.
+    assert {{ Γ, A, A[Wk] A[Wk][Wk] : Type@i }} by mauto 3.
+    assert {{ Γ A[Wk][Id,,M1] : Type@i }} by mauto 3.
+    assert {{ Γ A[Wk][Id,,M1] A : Type@i }}.
+    {
+      transitivity {{{ A[Wk(Id,,M1)] }}}; mauto 3.
+      transitivity {{{ A[Id] }}}; mauto 4.
+    }
+    assert {{ Γ s Id,,M1,,M2 : Γ, A, A[Wk] }} by mauto 4.
+    assert {{ Γ A[Wk][Wk][Id ,, M1 ,, M2] A : Type@i }}.
+    {
+      transitivity {{{ A[Wk][Wk(Id,,M1,,M2)] }}}; mauto 3.
+      transitivity {{{ A[Wk][Id,,M1] }}}; mauto 3.
+      eapply exp_eq_sub_cong_typ2'; mauto 4.
+    }
+    enough {{ Γ s Id,,M1,,M2,,N : Γ, A, A[Wk], Eq A[Wk][Wk] #1 #0 }} by mauto 3.
+    assert {{ Γ, A, A[Wk] Eq A[Wk][Wk] #1 #0 : Type@i }} by (econstructor; mauto 4).
+    econstructor; mauto 3.
+    eapply wf_conv; mauto 2.
+    transitivity {{{ Eq A[Wk][Wk][Id,,M1,,M2] #1[Id,,M1,,M2] #0[Id,,M1,,M2] }}}.
+    + econstructor; mauto 3 using id_sub_lookup_var0, id_sub_lookup_var1.
+    + symmetry; econstructor; mauto 4.
+Qed.
+ +
+Lemma presup_exp : forall {Γ M A},
+    {{ Γ M : A }} ->
+    {{ Γ }} /\ exists i, {{ Γ A : Type@i }}.
+Proof.
+  mauto 4 using presup_exp_typ.
+Qed.
+
+
+ +
+ + + diff --git a/ext/prop-eq/Mcltt.Core.Syntactic.System.Tactics.html b/ext/prop-eq/Mcltt.Core.Syntactic.System.Tactics.html new file mode 100644 index 00000000..8c8bd885 --- /dev/null +++ b/ext/prop-eq/Mcltt.Core.Syntactic.System.Tactics.html @@ -0,0 +1,73 @@ + + + + + + + + + + + + + +
+
+

Mcltt.Core.Syntactic.System.Tactics

+ +
+From Mcltt Require Import LibTactics.
+From Mcltt.Core Require Import Base.
+From Mcltt.Core.Syntactic.System Require Export Definitions Lemmas.
+Import Syntax_Notations.
+ +
+#[global]
+Ltac pi_univ_level_tac :=
+  match goal with
+  | |- {{ ~_ s ~_ : ~_ }} => mauto 4
+  | H : {{ ~?Δ ~?A : Type@?j }} |- {{ ~?Δ , ~?A ~?B : Type@?i }} =>
+      eapply lift_exp_max_right; mauto 4
+  | |- {{ ~?Δ ~?A : Type@?j }} =>
+      eapply lift_exp_max_left; mauto 4
+  end.
+ +
+#[export]
+Hint Rewrite -> wf_exp_eq_pi_sub using pi_univ_level_tac : mcltt.
+ +
+#[local]
+Ltac invert_wf_ctx1 H :=
+  match type of H with
+  | {{ ~_ , ~_ }} =>
+      let H' := fresh "H" in
+      pose proof H as H';
+      progressive_invert H'
+  end.
+ +
+Ltac invert_wf_ctx :=
+  (on_all_hyp: fun H => invert_wf_ctx1 H);
+  clear_dups.
+
+
+ +
+ + + diff --git a/ext/prop-eq/Mcltt.Core.Syntactic.System.html b/ext/prop-eq/Mcltt.Core.Syntactic.System.html new file mode 100644 index 00000000..004a75a2 --- /dev/null +++ b/ext/prop-eq/Mcltt.Core.Syntactic.System.html @@ -0,0 +1,40 @@ + + + + + + + + + + + + + +
+
+

Mcltt.Core.Syntactic.System

+ +
+From Mcltt.Core.Syntactic.System Require Export Definitions Lemmas Tactics.
+
+
+ +
+ + + diff --git a/ext/prop-eq/Mcltt.Core.Syntactic.SystemOpt.html b/ext/prop-eq/Mcltt.Core.Syntactic.SystemOpt.html new file mode 100644 index 00000000..56f40d36 --- /dev/null +++ b/ext/prop-eq/Mcltt.Core.Syntactic.SystemOpt.html @@ -0,0 +1,493 @@ + + + + + + + + + + + + + +
+
+

Mcltt.Core.Syntactic.SystemOpt

+ +
+From Coq Require Import Setoid.
+From Mcltt Require Import LibTactics.
+From Mcltt.Core Require Import Base.
+From Mcltt.Core.Syntactic Require Export CoreTypeInversions Presup.
+Import Syntax_Notations.
+ +
+Add Parametric Morphism i Γ : (wf_exp Γ)
+    with signature wf_exp_eq Γ {{{ Type@i }}} ==> eq ==> iff as wf_exp_morphism_iff3.
+Proof with mautosolve.
+  split; intros; gen_presups...
+Qed.
+ +
+Add Parametric Morphism i Γ : (wf_exp_eq Γ)
+    with signature wf_exp_eq Γ {{{ Type@i }}} ==> eq ==> eq ==> iff as wf_exp_eq_morphism_iff3.
+Proof with mautosolve.
+  split; intros; gen_presups...
+Qed.
+ +
+Add Parametric Morphism Γ i : (wf_subtyp Γ)
+    with signature (wf_exp_eq Γ {{{Type@i}}}) ==> eq ==> iff as wf_subtyp_morphism_iff1.
+Proof.
+  split; intros; gen_presups;
+    etransitivity; mauto 4.
+Qed.
+ +
+Add Parametric Morphism Γ j : (wf_subtyp Γ)
+    with signature eq ==> (wf_exp_eq Γ {{{Type@j}}}) ==> iff as wf_subtyp_morphism_iff2.
+Proof.
+  split; intros; gen_presups;
+    etransitivity; mauto 3.
+Qed.
+ +
+#[local]
+Ltac impl_opt_constructor :=
+  intros;
+  gen_presups;
+  mautosolve 4.
+ +
+Corollary wf_subtyp_refl' : forall Γ M M' i,
+    {{ Γ M M' : Type@i }} ->
+    {{ Γ M M' }}.
+Proof.
+  impl_opt_constructor.
+Qed.
+ +
+#[export]
+Hint Resolve wf_subtyp_refl' : mcltt.
+#[export]
+Remove Hints wf_subtyp_refl : mcltt.
+ +
+Corollary wf_conv' : forall Γ M A i A',
+    {{ Γ M : A }} ->
+    {{ Γ A A' : Type@i }} ->
+    {{ Γ M : A' }}.
+Proof.
+  impl_opt_constructor.
+Qed.
+ +
+#[export]
+Hint Resolve wf_conv' : mcltt.
+#[export]
+Remove Hints wf_conv : mcltt.
+ +
+Corollary wf_exp_eq_conv' : forall Γ M M' A A' i,
+   {{ Γ M M' : A }} ->
+   {{ Γ A A' : Type@i }} ->
+   {{ Γ M M' : A' }}.
+Proof.
+  impl_opt_constructor.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_conv' : mcltt.
+#[export]
+Remove Hints wf_exp_eq_conv : mcltt.
+ +
+Corollary wf_ctx_eq_extend' : forall {Γ Δ A A' i},
+    {{ Γ Δ }} ->
+    {{ Γ A A' : Type@i }} ->
+    {{ Γ , A Δ , A' }}.
+Proof.
+  intros.
+  assert {{ Δ A A' : Type@i }} by mauto.
+  gen_presups.
+  mautosolve 4.
+Qed.
+ +
+#[export]
+Hint Resolve wf_ctx_eq_extend' : mcltt.
+#[export]
+Remove Hints wf_ctx_eq_extend : mcltt.
+ +
+Corollary wf_nat' : forall {Γ i},
+    {{ Γ }} ->
+    {{ Γ : Type@i }}.
+Proof.
+  intros.
+  assert (0 <= i) by lia.
+  mauto.
+Qed.
+ +
+#[export]
+Hint Resolve wf_nat' : mcltt.
+#[export]
+Remove Hints wf_nat : mcltt.
+ +
+Corollary wf_natrec' : forall {Γ A MZ MS M},
+    {{ Γ MZ : A[Id,,zero] }} ->
+    {{ Γ , , A MS : A[WkWk,,succ(#1)] }} ->
+    {{ Γ M : }} ->
+    {{ Γ rec M return A | zero -> MZ | succ -> MS end : A[Id,,M] }}.
+Proof.
+  impl_opt_constructor.
+Qed.
+ +
+#[export]
+Hint Resolve wf_natrec' : mcltt.
+#[export]
+Remove Hints wf_natrec : mcltt.
+ +
+Corollary wf_pi_max : forall {Γ A i B j},
+    {{ Γ A : Type@i }} ->
+    {{ Γ , A B : Type@j }} ->
+    {{ Γ Π A B : Type@(max i j) }}.
+Proof.
+  intros.
+  assert {{ Γ A : Type@(max i j) }} by mauto using lift_exp_max_left.
+  assert {{ Γ, A B : Type@(max i j) }} by mauto using lift_exp_max_right.
+  mauto.
+Qed.
+ +
+#[export]
+Hint Resolve wf_pi_max : mcltt.
+ +
+Corollary wf_fn' : forall {Γ A M B},
+    {{ Γ , A M : B }} ->
+    {{ Γ λ A M : Π A B }}.
+Proof.
+  impl_opt_constructor.
+Qed.
+ +
+#[export]
+Hint Resolve wf_fn' : mcltt.
+#[export]
+Remove Hints wf_fn : mcltt.
+ +
+Corollary wf_app' : forall {Γ M N A B},
+    {{ Γ M : Π A B }} ->
+    {{ Γ N : A }} ->
+    {{ Γ M N : B[Id,,N] }}.
+Proof.
+  intros.
+  gen_presups.
+  exvar nat ltac:(fun i => assert ({{ Γ A : Type@i }} /\ {{ Γ, A B : Type@i }}) as [] by eauto using wf_pi_inversion').
+  mautosolve 3.
+Qed.
+ +
+#[export]
+Hint Resolve wf_app' : mcltt.
+#[export]
+Remove Hints wf_app : mcltt.
+ +
+Lemma wf_exp_eq_typ_sub' : forall Γ σ Δ i j,
+    {{ Γ s σ : Δ }} ->
+    i < j ->
+    {{ Γ Type@i[σ] Type@i : Type@j }}.
+Proof. mauto 3. Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_typ_sub' : mcltt.
+ +
+#[export]
+Hint Rewrite -> wf_exp_eq_typ_sub' using solve [lia | mauto 3] : mcltt.
+ +
+Corollary wf_exp_eq_nat_sub' : forall Γ σ Δ i,
+    {{ Γ s σ : Δ }} ->
+    {{ Γ [σ] : Type@i }}.
+Proof.
+  intros.
+  assert (0 <= i) by lia.
+  mauto.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_nat_sub' : mcltt.
+#[export]
+Remove Hints wf_exp_eq_nat_sub : mcltt.
+ +
+#[export]
+Hint Rewrite -> wf_exp_eq_nat_sub' using mautosolve 3 : mcltt.
+ +
+Corollary wf_exp_eq_natrec_cong' : forall {Γ A A' i MZ MZ' MS MS' M M'},
+    {{ Γ , A A' : Type@i }} ->
+    {{ Γ MZ MZ' : A[Id,,zero] }} ->
+    {{ Γ , , A MS MS' : A[WkWk,,succ(#1)] }} ->
+    {{ Γ M M' : }} ->
+    {{ Γ rec M return A | zero -> MZ | succ -> MS end rec M' return A' | zero -> MZ' | succ -> MS' end : A[Id,,M] }}.
+Proof.
+  impl_opt_constructor.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_natrec_cong' : mcltt.
+#[export]
+Remove Hints wf_exp_eq_natrec_cong : mcltt.
+ +
+Corollary wf_exp_eq_natrec_sub' : forall {Γ σ Δ A MZ MS M},
+    {{ Γ s σ : Δ }} ->
+    {{ Δ MZ : A[Id,,zero] }} ->
+    {{ Δ , , A MS : A[WkWk,,succ(#1)] }} ->
+    {{ Δ M : }} ->
+    {{ Γ rec M return A | zero -> MZ | succ -> MS end[σ] rec M[σ] return A[q σ] | zero -> MZ[σ] | succ -> MS[q (q σ)] end : A[σ,,M[σ]] }}.
+Proof.
+  impl_opt_constructor.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_natrec_sub' : mcltt.
+#[export]
+Remove Hints wf_exp_eq_natrec_sub : mcltt.
+ +
+Corollary wf_exp_eq_nat_beta_zero' : forall {Γ A MZ MS},
+    {{ Γ MZ : A[Id,,zero] }} ->
+    {{ Γ , , A MS : A[WkWk,,succ(#1)] }} ->
+    {{ Γ rec zero return A | zero -> MZ | succ -> MS end MZ : A[Id,,zero] }}.
+Proof.
+  impl_opt_constructor.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_nat_beta_zero' : mcltt.
+#[export]
+Remove Hints wf_exp_eq_nat_beta_zero : mcltt.
+ +
+Corollary wf_exp_eq_nat_beta_succ' : forall {Γ A MZ MS M},
+    {{ Γ MZ : A[Id,,zero] }} ->
+    {{ Γ , , A MS : A[WkWk,,succ(#1)] }} ->
+    {{ Γ M : }} ->
+    {{ Γ rec (succ M) return A | zero -> MZ | succ -> MS end MS[Id,,M,,rec M return A | zero -> MZ | succ -> MS end] : A[Id,,succ M] }}.
+Proof.
+  impl_opt_constructor.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_nat_beta_succ' : mcltt.
+#[export]
+Remove Hints wf_exp_eq_nat_beta_succ : mcltt.
+ +
+Corollary wf_exp_eq_pi_sub_max : forall {Γ σ Δ A i B j},
+    {{ Γ s σ : Δ }} ->
+    {{ Δ A : Type@i }} ->
+    {{ Δ , A B : Type@j }} ->
+    {{ Γ (Π A B)[σ] Π (A[σ]) (B[q σ]) : Type@(max i j) }}.
+Proof.
+  intros.
+  assert {{ Δ A : Type@(max i j) }} by mauto using lift_exp_max_left.
+  assert {{ Δ , A B : Type@(max i j) }} by mauto using lift_exp_max_right.
+  mauto.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_pi_sub_max : mcltt.
+ +
+Corollary wf_exp_eq_pi_cong' : forall {Γ A A' B B' i},
+    {{ Γ A A' : Type@i }} ->
+    {{ Γ , A B B' : Type@i }} ->
+    {{ Γ Π A B Π A' B' : Type@i }}.
+Proof.
+  impl_opt_constructor.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_pi_cong' : mcltt.
+#[export]
+Remove Hints wf_exp_eq_pi_cong : mcltt.
+ +
+Corollary wf_exp_eq_pi_cong_max : forall {Γ A A' i B B' j},
+    {{ Γ A A' : Type@i }} ->
+    {{ Γ , A B B' : Type@j }} ->
+    {{ Γ Π A B Π A' B' : Type@(max i j) }}.
+Proof.
+  intros.
+  assert {{ Γ A A' : Type@(max i j) }} by eauto using lift_exp_eq_max_left.
+  assert {{ Γ , A B B' : Type@(max i j) }} by eauto using lift_exp_eq_max_right.
+  mauto.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_pi_cong_max : mcltt.
+ +
+Corollary wf_exp_eq_fn_cong' : forall {Γ A A' i B M M'},
+    {{ Γ A A' : Type@i }} ->
+    {{ Γ , A M M' : B }} ->
+    {{ Γ λ A M λ A' M' : Π A B }}.
+Proof.
+  impl_opt_constructor.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_fn_cong' : mcltt.
+#[export]
+Remove Hints wf_exp_eq_fn_cong : mcltt.
+ +
+Corollary wf_exp_eq_fn_sub' : forall {Γ σ Δ A M B},
+    {{ Γ s σ : Δ }} ->
+    {{ Δ , A M : B }} ->
+    {{ Γ (λ A M)[σ] λ A[σ] M[q σ] : (Π A B)[σ] }}.
+Proof.
+  impl_opt_constructor.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_fn_sub' : mcltt.
+#[export]
+Remove Hints wf_exp_eq_fn_sub : mcltt.
+ +
+Corollary wf_exp_eq_app_cong' : forall {Γ A B M M' N N'},
+    {{ Γ M M' : Π A B }} ->
+    {{ Γ N N' : A }} ->
+    {{ Γ M N M' N' : B[Id,,N] }}.
+Proof.
+  intros.
+  gen_presups.
+  exvar nat ltac:(fun i => assert ({{ Γ A : Type@i }} /\ {{ Γ, A B : Type@i }}) as [] by eauto using wf_pi_inversion').
+  mautosolve 3.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_app_cong' : mcltt.
+#[export]
+Remove Hints wf_exp_eq_app_cong : mcltt.
+ +
+Corollary wf_exp_eq_app_sub' : forall {Γ σ Δ A B M N},
+    {{ Γ s σ : Δ }} ->
+    {{ Δ M : Π A B }} ->
+    {{ Δ N : A }} ->
+    {{ Γ (M N)[σ] M[σ] N[σ] : B[σ,,N[σ]] }}.
+Proof.
+  intros.
+  gen_presups.
+  exvar nat ltac:(fun i => assert ({{ Δ A : Type@i }} /\ {{ Δ, A B : Type@i }}) as [] by eauto using wf_pi_inversion').
+  mautosolve 3.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_app_sub' : mcltt.
+#[export]
+Remove Hints wf_exp_eq_app_sub : mcltt.
+ +
+Corollary wf_exp_eq_pi_beta' : forall {Γ A B M N},
+    {{ Γ , A M : B }} ->
+    {{ Γ N : A }} ->
+    {{ Γ (λ A M) N M[Id,,N] : B[Id,,N] }}.
+Proof.
+  intros.
+  gen_presups.
+  exvar nat ltac:(fun i => assert {{ Γ A : Type@i }} by (eapply lift_exp_max_left; mauto 3)).
+  exvar nat ltac:(fun i => assert {{ Γ, A B : Type@i }} by (eapply lift_exp_max_right; mauto 3)).
+  mautosolve 3.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_pi_beta' : mcltt.
+#[export]
+Remove Hints wf_exp_eq_pi_beta : mcltt.
+ +
+Corollary wf_exp_eq_pi_eta' : forall {Γ A B M},
+    {{ Γ M : Π A B }} ->
+    {{ Γ M λ A (M[Wk] #0) : Π A B }}.
+Proof.
+  intros.
+  gen_presups.
+  exvar nat ltac:(fun i => assert ({{ Γ A : Type@i }} /\ {{ Γ, A B : Type@i }}) as [] by eauto using wf_pi_inversion').
+  mautosolve 3.
+Qed.
+ +
+#[export]
+Hint Resolve wf_exp_eq_pi_eta' : mcltt.
+#[export]
+Remove Hints wf_exp_eq_pi_eta : mcltt.
+ +
+Lemma wf_subtyp_pi' : forall Γ A A' B B' i,
+    {{ Γ A A' : Type@i }} ->
+    {{ Γ , A' B B' }} ->
+    {{ Γ Π A B Π A' B' }}.
+Proof.
+  intros. gen_presups.
+  eapply wf_subtyp_pi with (i := max i i0);
+    mauto 3 using lift_exp_max_left, lift_exp_max_right, lift_exp_eq_max_left.
+  eapply ctxeq_exp; [ | mauto 3 using lift_exp_max_right].
+  mauto 4.
+Qed.
+ +
+#[export]
+Hint Resolve wf_subtyp_pi' : mcltt.
+#[export]
+Remove Hints wf_subtyp_pi : mcltt.
+
+
+ +
+ + + diff --git a/ext/prop-eq/Mcltt.LibTactics.html b/ext/prop-eq/Mcltt.LibTactics.html new file mode 100644 index 00000000..4e08a00d --- /dev/null +++ b/ext/prop-eq/Mcltt.LibTactics.html @@ -0,0 +1,677 @@ + + + + + + + + + + + + + +
+
+

Mcltt.LibTactics

+ +
+From Coq Require Export Equivalence Lia Morphisms Program.Equality Program.Tactics Relation_Definitions RelationClasses.
+From Equations Require Export Equations.
+ +
+Open Scope predicate_scope.
+ +
+Create HintDb mcltt discriminated.
+ +
+
+ +
+Transparency setting for generalized rewriting +
+
+#[export]
+Typeclasses Transparent arrows.
+ +
+
+ +
+

Generalization of Variables

+ +
+
+ +
+Tactic Notation "gen" ident(x) := generalize dependent x.
+Tactic Notation "gen" ident(x) ident(y) := gen x; gen y.
+Tactic Notation "gen" ident(x) ident(y) ident(z) := gen x y; gen z.
+Tactic Notation "gen" ident(x) ident(y) ident(z) ident(w) := gen x y z; gen w.
+ +
+
+ +
+

Marking-based Tactics

+ +
+
+ +
+Definition __mark__ (n : nat) A (a : A) : A := a.
+Arguments __mark__ n {A} a : simpl never.
+ +
+Ltac mark H :=
+  let t := type of H in
+  fold (__mark__ 0 t) in H.
+Ltac unmark H := unfold __mark__ in H.
+ +
+Ltac mark_all :=
+  repeat match goal with [H: ?P |- _] =>
+    try (match P with __mark__ _ _ => fail 2 end); mark H
+  end.
+Ltac unmark_all := unfold __mark__ in *.
+ +
+Ltac mark_with H n :=
+  let t := type of H in
+  fold (__mark__ n t) in H.
+Ltac mark_all_with n :=
+  repeat match goal with [H: ?P |- _] =>
+    try (match P with __mark__ _ _ => fail 2 end); mark_with H n
+  end.
+Ltac unmark_all_with n :=
+  repeat match goal with [H: ?P |- _] =>
+    match P with __mark__ ?n' _ => tryif unify n n' then unmark H else fail 1 end
+  end.
+ +
+Ltac on_all_marked_hyp tac :=
+  repeat match goal with
+    | [ H : __mark__ _ ?A |- _ ] => unmark H; tac H
+    end.
+Ltac on_all_marked_hyp_rev tac :=
+  repeat match reverse goal with
+    | [ H : __mark__ _ ?A |- _ ] => unmark H; tac H
+    end.
+Tactic Notation "on_all_marked_hyp:" tactic4(tac) := on_all_marked_hyp tac; unmark_all_with 0.
+Tactic Notation "on_all_marked_hyp_rev:" tactic4(tac) := on_all_marked_hyp_rev tac; unmark_all_with 0.
+Tactic Notation "on_all_hyp:" tactic4(tac) :=
+  mark_all_with 0; (on_all_marked_hyp: tac).
+Tactic Notation "on_all_hyp_rev:" tactic4(tac) :=
+  mark_all_with 0; (on_all_marked_hyp_rev: tac).
+ +
+
+ +
+

Simple helper

+ +
+
+ +
+Ltac destruct_logic :=
+  destruct_one_pair
+  || destruct_one_ex
+  || match goal with
+    | [ H : ?X \/ ?Y |- _ ] => destruct H
+    | [ ev : { _ } + { _ } |- _ ] => destruct ev
+    | [ ev : _ + { _ } |- _ ] => destruct ev
+    | [ ev : _ + _ |- _ ] => destruct ev
+    end.
+ +
+Ltac destruct_all := repeat destruct_logic.
+ +
+Ltac not_let_bind name :=
+  match goal with
+  | [x := _ |- _] =>
+      lazymatch name with
+      | x => fail 1
+      | _ => fail
+      end
+  | _ => idtac
+  end.
+ +
+Ltac find_dup_hyp tac non :=
+  match goal with
+  | [ H : ?X, H' : ?X |- _ ] =>
+    not_let_bind H;
+    not_let_bind H';
+    let T := type of X in
+    unify T Prop;
+    tac H H' X
+  | _ => non
+  end.
+ +
+Ltac fail_at_if_dup n :=
+  find_dup_hyp ltac:(fun H H' X => fail n "dup hypothesis" H "and" H' ":" X)
+                      ltac:(idtac).
+ +
+Ltac fail_if_dup := fail_at_if_dup ltac:(1).
+ +
+Ltac clear_dups :=
+  repeat find_dup_hyp ltac:(fun H H' _ => clear H || clear H')
+                             ltac:(idtac).
+ +
+Ltac directed tac :=
+  let ng := numgoals in
+  tac;
+  let ng' := numgoals in
+  guard ng' <= ng.
+ +
+Tactic Notation "directed" tactic2(tac) := directed tac.
+ +
+Ltac progressive_invert H :=
+  
+ +
+We use dependent destruction as it is more general than inversion +
+
+  directed dependent destruction H.
+ +
+#[local]
+Ltac progressive_invert_once H n :=
+  let T := type of H in
+  lazymatch T with
+  | __mark__ _ _ => fail
+  | forall _, _ => fail
+  | _ => idtac
+  end;
+  lazymatch type of T with
+  | Prop => idtac
+  | Type => idtac
+  end;
+  directed inversion H;
+  simplify_eqs;
+  clear_refl_eqs;
+  clear_dups;
+  try mark_with H n.
+ +
+#[global]
+Ltac progressive_inversion :=
+  clear_dups;
+  repeat match goal with
+    | H : _ |- _ =>
+        progressive_invert_once H 100
+    end;
+  unmark_all_with 100.
+ +
+Ltac clean_replace_by exp0 exp1 tac :=
+  tryif unify exp0 exp1
+  then fail
+  else
+    (let H := fresh "H" in
+     assert (exp0 = exp1) as H by ltac:(tac);
+     subst;
+     try rewrite <- H in *).
+ +
+Tactic Notation "clean" "replace" uconstr(exp0) "with" uconstr(exp1) "by" tactic3(tac) := clean_replace_by exp0 exp1 tac.
+ +
+#[global]
+Ltac find_head t :=
+  lazymatch t with
+  | ?t' _ => find_head t'
+  | _ => t
+  end.
+ +
+Ltac unify_by_head_of t head :=
+  match t with
+  | ?X _ _ _ _ _ _ _ _ _ _ => unify X head
+  | ?X _ _ _ _ _ _ _ _ _ => unify X head
+  | ?X _ _ _ _ _ _ _ _ => unify X head
+  | ?X _ _ _ _ _ _ _ => unify X head
+  | ?X _ _ _ _ _ _ => unify X head
+  | ?X _ _ _ _ _ => unify X head
+  | ?X _ _ _ _ => unify X head
+  | ?X _ _ _ => unify X head
+  | ?X _ _ => unify X head
+  | ?X _ => unify X head
+  | ?X => unify X head
+  end.
+ +
+Ltac match_by_head1 head tac :=
+  match goal with
+  | [ H : ?T |- _ ] => unify_by_head_of T head; tac H
+  end.
+Ltac match_by_head head tac := repeat (match_by_head1 head ltac:(fun H => tac H; try mark H)); unmark_all.
+ +
+Ltac inversion_by_head head := match_by_head head ltac:(fun H => inversion H).
+Ltac dir_inversion_by_head head := match_by_head head ltac:(fun H => directed inversion H).
+Ltac inversion_clear_by_head head := match_by_head head ltac:(fun H => inversion_clear H).
+Ltac dir_inversion_clear_by_head head := match_by_head head ltac:(fun H => directed inversion_clear H).
+Ltac destruct_by_head head := match_by_head head ltac:(fun H => destruct H).
+Ltac dir_destruct_by_head head := match_by_head head ltac:(fun H => directed destruct H).
+ +
+
+ +
+

McLTT automation

+ +
+
+ +
+Tactic Notation "mauto" :=
+  eauto with mcltt core.
+ +
+Tactic Notation "mauto" int_or_var(pow) :=
+  eauto pow with mcltt core.
+ +
+Tactic Notation "mauto" "using" uconstr(use) :=
+  eauto using use with mcltt core.
+ +
+Tactic Notation "mauto" "using" uconstr(use1) "," uconstr(use2) :=
+  eauto using use1, use2 with mcltt core.
+ +
+Tactic Notation "mauto" "using" uconstr(use1) "," uconstr(use2) "," uconstr(use3) :=
+  eauto using use1, use2, use3 with mcltt core.
+ +
+Tactic Notation "mauto" "using" uconstr(use1) "," uconstr(use2) "," uconstr(use3) "," uconstr(use4) :=
+  eauto using use1, use2, use3, use4 with mcltt core.
+ +
+Tactic Notation "mauto" int_or_var(pow) "using" uconstr(use) :=
+  eauto pow using use with mcltt core.
+ +
+Tactic Notation "mauto" int_or_var(pow) "using" uconstr(use1) "," uconstr(use2) :=
+  eauto pow using use1, use2 with mcltt core.
+ +
+Tactic Notation "mauto" int_or_var(pow) "using" uconstr(use1) "," uconstr(use2) "," uconstr(use3) :=
+  eauto pow using use1, use2, use3 with mcltt core.
+ +
+Tactic Notation "mauto" int_or_var(pow) "using" uconstr(use1) "," uconstr(use2) "," uconstr(use3) "," uconstr(use4) :=
+  eauto pow using use1, use2, use3, use4 with mcltt core.
+ +
+Ltac mautosolve_impl pow := unshelve solve [mauto pow]; solve [constructor].
+ +
+Tactic Notation "mautosolve" := mautosolve_impl integer:(5).
+Tactic Notation "mautosolve" int_or_var(pow) := mautosolve_impl pow.
+ +
+
+ +
+Improve type class resolution for Equivalence and PER +
+
+ +
+#[export]
+Hint Extern 1 => eassumption : typeclass_instances.
+ +
+#[export]
+Hint Extern 1 (@Reflexive _ (@predicate_equivalence _)) => simple apply @Equivalence_Reflexive : typeclass_instances.
+#[export]
+Hint Extern 1 (@Symmetric _ (@predicate_equivalence _)) => simple apply @Equivalence_Symmetric : typeclass_instances.
+#[export]
+Hint Extern 1 (@Transitive _ (@predicate_equivalence _)) => simple apply @Equivalence_Transitive : typeclass_instances.
+#[export]
+Hint Extern 1 (@Transitive _ (@predicate_implication _)) => simple apply @PreOrder_Transitive : typeclass_instances.
+ +
+
+ +
+Default setting for intuition tactic +
+
+Ltac Tauto.intuition_solver ::= auto with mcltt core solve_subterm.
+ +
+Ltac exvar T tac :=
+  lazymatch type of T with
+  | Prop =>
+      let H := fresh "H" in
+      unshelve evar (H : T);
+      [|
+        let H' := eval unfold H in H in
+          clear H; tac H']
+  | _ =>
+      let x := fresh "x" in
+      evar (x : T);
+      let x' := eval unfold x in x in
+        clear x; tac x'
+  end.
+ +
+
+ +
+this tactic traverses to the bottom of a lemma following universals and conjunctions to the bottom and apply a tactic +
+
+Ltac deepexec lem tac :=
+  let T := type of lem in
+  let T' := eval simpl in T in
+  let ST := eval unfold iff in T' in
+  match ST with
+  | _ /\ _ => deepexec constr:(proj1 lem) tac
+            || deepexec constr:(proj2 lem) tac
+  | forall _ : ?T, _ =>
+      exvar T ltac:(fun x =>
+                      lazymatch type of T with
+                      | Prop => match goal with
+                            | H : _ |- _ => unify x H; deepexec constr:(lem x) tac
+                            | _ => deepexec constr:(lem x) tac
+                            end
+                      | _ => deepexec constr:(lem x) tac
+                      end)
+  | _ => tac lem
+  end.
+ +
+
+ +
+this tactic is similar to above, but the traversal cuts off when it sees an assumption applicable to a cut-off argument C +
+
+Ltac cutexec lem C tac :=
+  let CT := type of C in
+  let T := type of lem in
+  let T' := eval simpl in T in
+  let ST := eval unfold iff in T' in
+  lazymatch ST with
+  | _ /\ _ => cutexec constr:(proj1 lem) C tac
+            || cutexec constr:(proj2 lem) C tac
+  | forall _ : ?T, _ =>
+      exvar T ltac:(fun x =>
+                      tryif unify T CT
+                      then
+                        unify x C;
+                        tac lem
+                      else
+                        lazymatch type of T with
+                         | Prop => match goal with
+                               | H : _ |- _ => unify x H; cutexec constr:(lem x) C tac
+                               | _ => cutexec constr:(lem x) C tac
+                               end
+                         | _ => cutexec constr:(lem x) C tac
+                         end)
+  | _ => tac lem
+  end.
+ +
+Ltac unify_args H P :=
+  lazymatch P with
+  | ?P' ?x =>
+      let r := unify_args H P' in
+      constr:(r x)
+  | _ => H
+  end.
+ +
+#[global]
+Ltac strong_apply H X :=
+  let H' := fresh "H" in
+  let T := type of X in
+  let R := unify_args H T in
+  cutexec R X ltac:(fun L => pose proof (L X) as H'; simpl in H'; clear X; rename H' into X).
+ +
+#[global]
+Ltac apply_equiv_left1 :=
+  let tac1 := fun H R H1 T => (let h := find_head T in unify R h; strong_apply H H1) in
+  let tac2 := fun H R G => (let h := find_head G in unify R h; apply H; simpl) in
+  match goal with
+  | H : ?R <∙> _, H1 : ?T |- _ => progress tac1 H R H1 T
+  | H : relation_equivalence ?R _, H1 : ?T |- _ => progress tac1 H R H1 T
+  | H : ?R <∙> _ |- ?G => progress tac2 H R G
+  | H : relation_equivalence ?R _ |- ?G => progress tac2 H R G
+  end.
+ +
+#[global]
+Ltac apply_equiv_left := repeat apply_equiv_left1.
+ +
+#[global]
+Ltac apply_equiv_right1 :=
+  let tac1 := fun H R H1 T => (let h := find_head T in unify R h; strong_apply H H1) in
+  let tac2 := fun H R G => (let h := find_head G in unify R h; apply H; simpl) in
+  match goal with
+  | H : _ <∙> ?R, H1 : ?T |- _ => progress tac1 H R H1 T
+  | H : relation_equivalence _ ?R, H1 : ?T |- _ => progress tac1 H R H1 T
+  | H : _ <∙> ?R |- ?G => progress tac2 H R G
+  | H : relation_equivalence _ ?R |- ?G => progress tac2 H R G
+  end.
+ +
+#[global]
+Ltac apply_equiv_right := repeat apply_equiv_right1.
+ +
+#[global]
+Ltac clear_PER :=
+  repeat match goal with
+    | H : PER _ |- _ => clear H
+    | H : Symmetric _ |- _ => clear H
+    | H : Transitive _ |- _ => clear H
+    end.
+ +
+Lemma PER_refl1 A (R : relation A) `(per : PER A R) : forall a b, R a b -> R a a.
+Proof.
+  intros.
+  etransitivity; [eassumption |].
+  symmetry. assumption.
+Qed.
+ +
+Lemma PER_refl2 A (R : relation A) `(per : PER A R) : forall a b, R a b -> R b b.
+Proof.
+  intros. symmetry in H.
+  apply PER_refl1 in H;
+    auto.
+Qed.
+ +
+#[global]
+Ltac saturate_refl :=
+  repeat match goal with
+    | H : ?R ?a ?b |- _ =>
+        tryif unify a b
+        then fail
+        else
+          directed pose proof (PER_refl1 _ _ _ _ _ H);
+        directed pose proof (PER_refl2 _ _ _ _ _ H);
+        fail_if_dup
+    end.
+ +
+#[global]
+Ltac saturate_refl_for hd :=
+  repeat match goal with
+    | H : ?R ?a ?b |- _ =>
+        unify_by_head_of R hd;
+        tryif unify a b
+        then fail
+        else
+          directed pose proof (PER_refl1 _ _ _ _ _ H);
+        directed pose proof (PER_refl2 _ _ _ _ _ H);
+        fail_if_dup
+    end.
+ +
+#[global]
+Ltac solve_refl :=
+  
+ +
+Sometimes `reflexivity` does not work as (simple) unification fails for some unknown reason. + Thus, we try Equivalence_Reflexive as well. +
+
+  solve [reflexivity || apply Equivalence_Reflexive].
+ +
+
+ +
+

Helper Instances for Generalized Rewriting

+ +
+
+#[export]
+Hint Extern 1 (subrelation (@predicate_equivalence ?Ts) _) => (let H := fresh "H" in intros ? ? H; exact H) : typeclass_instances.
+ +
+#[export]
+Hint Extern 1 (subrelation iff Basics.impl) => exact iff_impl_subrelation : typeclass_instances.
+ +
+#[export]
+Hint Extern 1 (subrelation iff (Basics.flip Basics.impl)) => exact iff_flip_impl_subrelation : typeclass_instances.
+ +
+#[export]
+Hint Extern 1 (subrelation (@relation_equivalence ?A) _) => (let H := fresh "H" in intros ? ? H; exact H) : typeclass_instances.
+ +
+#[export]
+Hint Extern 1 (subrelation (@predicate_implication ?Ts) _) => (let H := fresh "H" in intros ? ? H; exact H) : typeclass_instances.
+ +
+#[export]
+Hint Extern 1 (subrelation (@subrelation ?A) _) => (let H := fresh "H" in intros ? ? H; exact H) : typeclass_instances.
+ +
+#[export]
+Instance predicate_implication_equivalence Ts : subrelation (@predicate_equivalence Ts) (@predicate_implication Ts).
+Proof.
+  induction Ts; firstorder eauto 2.
+Qed.
+ +
+Add Parametric Morphism Ts : (@predicate_implication Ts)
+    with signature (@predicate_equivalence Ts) ==> (@predicate_equivalence Ts) ==> iff as predicate_implication_morphism.
+Proof.
+  induction Ts; split; intros; try firstorder.
+  - rewrite <- H.
+    transitivity x0; try eassumption.
+    rewrite H0; reflexivity.
+  - rewrite H.
+    transitivity y0; try eassumption.
+    rewrite <- H0; reflexivity.
+Qed.
+ +
+Add Parametric Morphism A : PER
+    with signature (@relation_equivalence A) ==> iff as PER_morphism.
+Proof.
+  split; intros []; econstructor; unfold Symmetric, Transitive in *; intuition.
+Qed.
+ +
+
+ +
+The following facility converts search of Proper from type class instances to the local context +
+
+ +
+Class PERElem (A : Type) (P : A -> Prop) (R : A -> A -> Prop) :=
+  per_elem : forall a, P a -> R a a.
+ +
+#[export]
+Instance PERProper (A : Type) (P : A -> Prop) (R : A -> A -> Prop) `(Ins : PERElem A P R) a (H : P a) :
+  Proper R a.
+Proof.
+  cbv. pose proof per_elem; auto.
+Qed.
+ +
+Ltac bulky_rewrite1 :=
+  match goal with
+  | H : _ |- _ => rewrite H
+  | _ => progress (autorewrite with mcltt)
+  end.
+ +
+Ltac bulky_rewrite := repeat (bulky_rewrite1; mauto 2).
+ +
+Ltac bulky_rewrite_in1 HT :=
+  match goal with
+  | H : _ |- _ => tryif unify H HT then fail else rewrite H in HT
+  | _ => progress (autorewrite with mcltt in HT)
+  end.
+ +
+Ltac bulky_rewrite_in HT := repeat (bulky_rewrite_in1 HT; mauto 2).
+ +
+
+ +
+This tactic provides a trivial proof for the completeness of a decision procedure. +
+
+Ltac dec_complete :=
+  lazymatch goal with
+  | |- exists _, ?L = _ =>
+      lazymatch type of L with
+      | sumbool _ _ =>
+          let Heq := fresh "Heq" in
+          destruct L eqn:Heq; eauto;
+          contradiction
+      end
+  end.
+
+
+ +
+ + + diff --git a/ext/prop-eq/coqdoc.css b/ext/prop-eq/coqdoc.css new file mode 100644 index 00000000..48096e55 --- /dev/null +++ b/ext/prop-eq/coqdoc.css @@ -0,0 +1,338 @@ +body { padding: 0px 0px; + margin: 0px 0px; + background-color: white } + +#page { display: block; + padding: 0px; + margin: 0px; + padding-bottom: 10px; } + +#header { display: block; + position: relative; + padding: 0; + margin: 0; + vertical-align: middle; + border-bottom-style: solid; + border-width: thin } + +#header h1 { padding: 0; + margin: 0;} + + +/* Contents */ + +#main{ display: block; + padding: 10px; + font-family: sans-serif; + font-size: 100%; + line-height: 100% } + +#main h1 { line-height: 95% } /* allow for multi-line headers */ + +#main a.idref:visited {color : #416DFF; text-decoration : none; } +#main a.idref:link {color : #416DFF; text-decoration : none; } +#main a.idref:hover {text-decoration : none; } +#main a.idref:active {text-decoration : none; } + +#main a.modref:visited {color : #416DFF; text-decoration : none; } +#main a.modref:link {color : #416DFF; text-decoration : none; } +#main a.modref:hover {text-decoration : none; } +#main a.modref:active {text-decoration : none; } + +#main .keyword { color : #cf1d1d } +#main { color: black } + +.section { background-color: rgb(60%,60%,100%); + padding-top: 13px; + padding-bottom: 13px; + padding-left: 3px; + margin-top: 5px; + margin-bottom: 5px; + font-size : 175% } + +h2.section { background-color: rgb(80%,80%,100%); + padding-left: 3px; + padding-top: 12px; + padding-bottom: 10px; + font-size : 130% } + +h3.section { background-color: rgb(90%,90%,100%); + padding-left: 3px; + padding-top: 7px; + padding-bottom: 7px; + font-size : 115% } + +h4.section { +/* + background-color: rgb(80%,80%,80%); + max-width: 20em; + padding-left: 5px; + padding-top: 5px; + padding-bottom: 5px; +*/ + background-color: white; + padding-left: 0px; + padding-top: 0px; + padding-bottom: 0px; + font-size : 100%; + font-weight : bold; + text-decoration : underline; + } + +#main .doc { margin: 0px; + font-family: sans-serif; + font-size: 100%; + line-height: 125%; + max-width: 40em; + color: black; + padding: 10px; + background-color: #90bdff } + +.inlinecode { + display: inline; +/* font-size: 125%; */ + color: #666666; + font-family: monospace } + +.doc .inlinecode { + display: inline; + font-size: 120%; + color: rgb(30%,30%,70%); + font-family: monospace } + +.doc .inlinecode .id { + color: rgb(30%,30%,70%); +} + +.inlinecodenm { + display: inline; + color: #444444; +} + +.doc .code { + display: inline; + font-size: 120%; + color: rgb(30%,30%,70%); + font-family: monospace } + +.comment { + display: inline; + font-family: monospace; + color: rgb(50%,50%,80%); +} + +.code { + display: block; +/* padding-left: 15px; */ + font-size: 110%; + font-family: monospace; + } + +table.infrule { + border: 0px; + margin-left: 50px; + margin-top: 10px; + margin-bottom: 10px; +} + +td.infrule { + font-family: monospace; + text-align: center; +/* color: rgb(35%,35%,70%); */ + padding: 0px; + line-height: 100%; +} + +tr.infrulemiddle hr { + margin: 1px 0 1px 0; +} + +.infrulenamecol { + color: rgb(60%,60%,60%); + font-size: 80%; + padding-left: 1em; + padding-bottom: 0.1em +} + +/* Pied de page */ + +#footer { font-size: 65%; + font-family: sans-serif; } + +/* Identifiers: ) */ + +.id { display: inline; } + +.id[title="constructor"] { + color: rgb(60%,0%,0%); +} + +.id[title="var"] { + color: rgb(40%,0%,40%); +} + +.id[title="variable"] { + color: rgb(40%,0%,40%); +} + +.id[title="definition"] { + color: rgb(0%,40%,0%); +} + +.id[title="abbreviation"] { + color: rgb(0%,40%,0%); +} + +.id[title="lemma"] { + color: rgb(0%,40%,0%); +} + +.id[title="instance"] { + color: rgb(0%,40%,0%); +} + +.id[title="projection"] { + color: rgb(0%,40%,0%); +} + +.id[title="method"] { + color: rgb(0%,40%,0%); +} + +.id[title="inductive"] { + color: rgb(0%,0%,80%); +} + +.id[title="record"] { + color: rgb(0%,0%,80%); +} + +.id[title="class"] { + color: rgb(0%,0%,80%); +} + +.id[title="keyword"] { + color : #cf1d1d; +/* color: black; */ +} + +/* Deprecated rules using the 'type' attribute of (not xhtml valid) */ + +.id[type="constructor"] { + color: rgb(60%,0%,0%); +} + +.id[type="var"] { + color: rgb(40%,0%,40%); +} + +.id[type="variable"] { + color: rgb(40%,0%,40%); +} + +.id[title="binder"] { + color: rgb(40%,0%,40%); +} + +.id[type="definition"] { + color: rgb(0%,40%,0%); +} + +.id[type="abbreviation"] { + color: rgb(0%,40%,0%); +} + +.id[type="lemma"] { + color: rgb(0%,40%,0%); +} + +.id[type="instance"] { + color: rgb(0%,40%,0%); +} + +.id[type="projection"] { + color: rgb(0%,40%,0%); +} + +.id[type="method"] { + color: rgb(0%,40%,0%); +} + +.id[type="inductive"] { + color: rgb(0%,0%,80%); +} + +.id[type="record"] { + color: rgb(0%,0%,80%); +} + +.id[type="class"] { + color: rgb(0%,0%,80%); +} + +.id[type="keyword"] { + color : #cf1d1d; +/* color: black; */ +} + +.inlinecode .id { + color: rgb(0%,0%,0%); +} + + +/* TOC */ + +#toc h2 { + padding: 10px; + background-color: rgb(60%,60%,100%); +} + +#toc li { + padding-bottom: 8px; +} + +/* Index */ + +#index { + margin: 0; + padding: 0; + width: 100%; +} + +#index #frontispiece { + margin: 1em auto; + padding: 1em; + width: 60%; +} + +.booktitle { font-size : 140% } +.authors { font-size : 90%; + line-height: 115%; } +.moreauthors { font-size : 60% } + +#index #entrance { + text-align: center; +} + +#index #entrance .spacer { + margin: 0 30px 0 30px; +} + +#index #footer { + position: absolute; + bottom: 0; +} + +.paragraph { + height: 0.75em; +} + +ul.doclist { + margin-top: 0em; + margin-bottom: 0em; +} + +.code :target { + border: 2px solid #D4D4D4; + background-color: #e5eecc; +} diff --git a/ext/prop-eq/dep.html b/ext/prop-eq/dep.html new file mode 100644 index 00000000..071d0806 --- /dev/null +++ b/ext/prop-eq/dep.html @@ -0,0 +1,305 @@ + + + + + + + + + + + + + +
+
+ + + + + + +Mcltt + +Core + + +Core + + + + +Core/Syntactic + + +Syntactic + + + + +Core/Syntactic/System + + +System + + + + + +Mcltt.Core.Syntactic.System.Definitions + + + + +Definitions + + + + + +Mcltt.Core.Syntactic.System.Lemmas + + + + +Lemmas + + + + + +Mcltt.Core.Syntactic.System.Definitions->Mcltt.Core.Syntactic.System.Lemmas + + + + + +Mcltt.Core.Syntactic.System.Tactics + + + + +Tactics + + + + + +Mcltt.Core.Syntactic.System.Lemmas->Mcltt.Core.Syntactic.System.Tactics + + + + + +Mcltt.Core.Syntactic.System + + + + +System + + + + + +Mcltt.Core.Syntactic.System.Tactics->Mcltt.Core.Syntactic.System + + + + + +Mcltt.Core.Syntactic.CoreInversions + + + + +CoreInversions + + + + + +Mcltt.Core.Syntactic.Corollaries + + + + +Corollaries + + + + + +Mcltt.Core.Syntactic.CoreInversions->Mcltt.Core.Syntactic.Corollaries + + + + + +Mcltt.Core.Syntactic.SystemOpt + + + + +SystemOpt + + + + + +Mcltt.Core.Syntactic.SystemOpt->Mcltt.Core.Syntactic.CoreInversions + + + + + +Mcltt.Core.Syntactic.CoreTypeInversions + + + + +CoreTypeInversions + + + + + +Mcltt.Core.Syntactic.CoreTypeInversions->Mcltt.Core.Syntactic.SystemOpt + + + + + +Mcltt.Core.Syntactic.System->Mcltt.Core.Syntactic.CoreTypeInversions + + + + + +Mcltt.Core.Syntactic.CtxSub + + + + +CtxSub + + + + + +Mcltt.Core.Syntactic.System->Mcltt.Core.Syntactic.CtxSub + + + + + +Mcltt.Core.Syntactic.CtxEq + + + + +CtxEq + + + + + +Mcltt.Core.Syntactic.Presup + + + + +Presup + + + + + +Mcltt.Core.Syntactic.CtxEq->Mcltt.Core.Syntactic.Presup + + + + + +Mcltt.Core.Syntactic.CtxSub->Mcltt.Core.Syntactic.CtxEq + + + + + +Mcltt.Core.Syntactic.Presup->Mcltt.Core.Syntactic.SystemOpt + + + + + +Mcltt.Core.Syntactic.Syntax + + + + +Syntax + + + + + +Mcltt.Core.Syntactic.Syntax->Mcltt.Core.Syntactic.System.Definitions + + + + + +Mcltt.Core.Base + + + + +Base + + + + + +Mcltt.Core.Base->Mcltt.Core.Syntactic.Syntax + + + + + +Mcltt.LibTactics + + + + +LibTactics + + + + + +Mcltt.LibTactics->Mcltt.Core.Syntactic.System.Definitions + + + + +
+ +
+ + + diff --git a/ext/prop-eq/images/bg_hr.png b/ext/prop-eq/images/bg_hr.png new file mode 100644 index 00000000..514aee50 Binary files /dev/null and b/ext/prop-eq/images/bg_hr.png differ diff --git a/ext/prop-eq/images/blacktocat.png b/ext/prop-eq/images/blacktocat.png new file mode 100644 index 00000000..e160053a Binary files /dev/null and b/ext/prop-eq/images/blacktocat.png differ diff --git a/ext/prop-eq/images/icon_download.png b/ext/prop-eq/images/icon_download.png new file mode 100644 index 00000000..5a793f17 Binary files /dev/null and b/ext/prop-eq/images/icon_download.png differ diff --git a/ext/prop-eq/images/sprite_download.png b/ext/prop-eq/images/sprite_download.png new file mode 100644 index 00000000..f9f8de24 Binary files /dev/null and b/ext/prop-eq/images/sprite_download.png differ diff --git a/ext/prop-eq/images/vdi_blue.png b/ext/prop-eq/images/vdi_blue.png new file mode 100644 index 00000000..1c14c947 Binary files /dev/null and b/ext/prop-eq/images/vdi_blue.png differ diff --git a/ext/prop-eq/images/vdi_grey.png b/ext/prop-eq/images/vdi_grey.png new file mode 100644 index 00000000..db1ec367 Binary files /dev/null and b/ext/prop-eq/images/vdi_grey.png differ diff --git a/ext/prop-eq/index.html b/ext/prop-eq/index.html new file mode 100644 index 00000000..708acf16 --- /dev/null +++ b/ext/prop-eq/index.html @@ -0,0 +1,146 @@ + + + + + + + McLTT: A Bottom-up Approach to Implementing A Proof +Assistant + + + + + + + + + + +

McLTT: +A Bottom-up Approach to Implementing A Proof Assistant

+

In McLTT, we build a verified, runnable typechecker for Martin-Löf +type theory. After the accomplishment of this project, we will obtain an +executable, to which we can feed a program in Martin-Löf type theory, +and this executable will check whether this program has the specified +type. McLTT is novel in that it is implemented in Coq. Moreover, we will +prove that the typechecking algorithm extracted from Coq is sound and +complete: a program passes typechecking if and only if it is a +well-typed program in MLTT. This will be the first verified proof +assistant (despite being elementary) and serves as a basis for future +extensions.

+

Online Documentation

+

We have generated a Coqdoc for +browsing our Coq proof.

+

Architecture

+

McLTT has the following architecture:

+
    | source code of McLTT
+    v
++-------+
+| lexer |          OCaml code generated by ocamllex
++-------+
+    | stream of tokens
+    v
++--------+
+| parser |         Coq code generated by Menhir
++--------+
+    | concrete syntax tree
+    v
++------------+
+| elaborator |     Coq code
++------------+
+    | abstract syntax tree
+    v
++-------------+
+| typechecker |    Coq code
+| (normalizer |
+|   included) |
++-------------+
+    | yes or no    Driver in OCaml
+    v
+

In this architecture, most code is in Coq, with accompanying theorems +to justify the implementation.

+

Dependencies

+ +

We recommend to install dependencies in the following way:

+
opam switch create coq-8.20.0 4.14.2
+opam install menhir
+opam pin add coq 8.20.0
+opam repo add coq-released https://coq.inria.fr/opam/released
+opam install coq-equations
+opam install coq-menhirlib
+opam install ppx_inline_test
+

Development

+

Use the toplevel make to build the whole project:

+
make
+

Makefile will try to find out the number of your CPU cores and +parallel as much as possible.

+

Once make finishes, you can run the binary:

+
dune exec mcltt examples/nary.mcl # or your own example
+

or more directly

+
_build/default/driver/mcltt.exe examples/nary.mcl # or your own example
+

To build Coq proof only, you can go into and only build the Coq +folder:

+
cd theories
+make
+

Branches

+

The Github repo includes the following special branches:

+
    +
  1. main: the main branch that is used to generate this +homepage and Coqdoc;
  2. +
  3. ext/*: branches in this pattern are variations of +main that implements various extensions. They are often +used to implement extensions that require non-trivial workload and are +aimed to be merged to main eventually;
  4. +
  5. gh-pages: the branch to host the homepage.
  6. +
+ + diff --git a/ext/prop-eq/indexpage.html b/ext/prop-eq/indexpage.html new file mode 100644 index 00000000..dc77d284 --- /dev/null +++ b/ext/prop-eq/indexpage.html @@ -0,0 +1,1853 @@ + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Global IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(478 entries)
Notation IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(51 entries)
Module IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(3 entries)
Library IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(14 entries)
Lemma IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(204 entries)
Constructor IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(121 entries)
Projection IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(1 entry)
Inductive IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(15 entries)
Instance IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(10 entries)
Abbreviation IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(2 entries)
Record IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(1 entry)
Definition IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(56 entries)
+
+

Global Index

+

A

+app_ctx_vlookup [lemma, in Mcltt.Core.Syntactic.Corollaries]
+app_ctx_lookup [lemma, in Mcltt.Core.Syntactic.Corollaries]
+a_extend [constructor, in Mcltt.Core.Syntactic.Syntax]
+a_compose [constructor, in Mcltt.Core.Syntactic.Syntax]
+a_weaken [constructor, in Mcltt.Core.Syntactic.Syntax]
+a_id [constructor, in Mcltt.Core.Syntactic.Syntax]
+a_sub [constructor, in Mcltt.Core.Syntactic.Syntax]
+a_var [constructor, in Mcltt.Core.Syntactic.Syntax]
+a_eqrec [constructor, in Mcltt.Core.Syntactic.Syntax]
+a_refl [constructor, in Mcltt.Core.Syntactic.Syntax]
+a_eq [constructor, in Mcltt.Core.Syntactic.Syntax]
+a_app [constructor, in Mcltt.Core.Syntactic.Syntax]
+a_fn [constructor, in Mcltt.Core.Syntactic.Syntax]
+a_pi [constructor, in Mcltt.Core.Syntactic.Syntax]
+a_natrec [constructor, in Mcltt.Core.Syntactic.Syntax]
+a_succ [constructor, in Mcltt.Core.Syntactic.Syntax]
+a_zero [constructor, in Mcltt.Core.Syntactic.Syntax]
+a_nat [constructor, in Mcltt.Core.Syntactic.Syntax]
+a_typ [constructor, in Mcltt.Core.Syntactic.Syntax]
+

B

+Base [library]
+

C

+CoreInversions [library]
+CoreTypeInversions [library]
+Corollaries [library]
+Cst [module, in Mcltt.Core.Syntactic.Syntax]
+Cst.app [constructor, in Mcltt.Core.Syntactic.Syntax]
+Cst.eqrec [constructor, in Mcltt.Core.Syntactic.Syntax]
+Cst.fn [constructor, in Mcltt.Core.Syntactic.Syntax]
+Cst.nat [constructor, in Mcltt.Core.Syntactic.Syntax]
+Cst.natrec [constructor, in Mcltt.Core.Syntactic.Syntax]
+Cst.obj [inductive, in Mcltt.Core.Syntactic.Syntax]
+Cst.obj_sind [definition, in Mcltt.Core.Syntactic.Syntax]
+Cst.obj_rec [definition, in Mcltt.Core.Syntactic.Syntax]
+Cst.obj_ind [definition, in Mcltt.Core.Syntactic.Syntax]
+Cst.obj_rect [definition, in Mcltt.Core.Syntactic.Syntax]
+Cst.pi [constructor, in Mcltt.Core.Syntactic.Syntax]
+Cst.prop_eq [constructor, in Mcltt.Core.Syntactic.Syntax]
+Cst.refl [constructor, in Mcltt.Core.Syntactic.Syntax]
+Cst.succ [constructor, in Mcltt.Core.Syntactic.Syntax]
+Cst.typ [constructor, in Mcltt.Core.Syntactic.Syntax]
+Cst.var [constructor, in Mcltt.Core.Syntactic.Syntax]
+Cst.zero [constructor, in Mcltt.Core.Syntactic.Syntax]
+ctx [abbreviation, in Mcltt.Core.Syntactic.Syntax]
+CtxEq [library]
+ctxeq_ctx_lookup [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+ctxeq_subtyp [lemma, in Mcltt.Core.Syntactic.CtxEq]
+ctxeq_sub_eq [lemma, in Mcltt.Core.Syntactic.CtxEq]
+ctxeq_sub [lemma, in Mcltt.Core.Syntactic.CtxEq]
+ctxeq_exp_eq [lemma, in Mcltt.Core.Syntactic.CtxEq]
+ctxeq_exp [lemma, in Mcltt.Core.Syntactic.CtxEq]
+CtxSub [library]
+ctxsub_judg.ctxsub_subtyp [lemma, in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_sub_eq [lemma, in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_sub [lemma, in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_exp_eq [lemma, in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_exp [lemma, in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_subtyp_helper [lemma, in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_sub_eq_helper [lemma, in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_sub_helper [lemma, in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_exp_eq_helper [lemma, in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_exp_helper [lemma, in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg [module, in Mcltt.Core.Syntactic.CtxSub]
+ctx_sub_ctx_lookup [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+ctx_decomp_right [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+ctx_decomp_left [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+ctx_decomp [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+ctx_lookup_sind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+ctx_lookup_ind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+ctx_lookup [inductive, in Mcltt.Core.Syntactic.System.Definitions]
+ctx_eq_trans [lemma, in Mcltt.Core.Syntactic.CtxEq]
+ctx_eq_sym [lemma, in Mcltt.Core.Syntactic.CtxEq]
+ctx_eq_refl [lemma, in Mcltt.Core.Syntactic.CtxEq]
+ctx_lookup_functional [lemma, in Mcltt.Core.Syntactic.Corollaries]
+ctx_sub_refl [lemma, in Mcltt.Core.Syntactic.CtxSub]
+

D

+Definitions [library]
+

E

+exp [inductive, in Mcltt.Core.Syntactic.Syntax]
+exp_eq_var_1_sub_q_sigma [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_var_1_sub_q_sigma_nat [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_sub_compose_cong [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_sub_compose_cong_nat [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_var_0_weaken_nat [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_var_1_sub_nat [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_var_0_sub_nat [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_sub_nat_helper [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_nat_sub_sub_to_nat_sub [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_nat_sub_sub [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_compose_nat [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_cong_nat2 [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_cong_nat1 [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_sub_nat [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_sub_compose_cong_typ [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_var_0_weaken_typ [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_var_1_sub_typ [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_var_0_sub_typ [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_sub_typ_helper [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_typ_sub_sub [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_compose_typ [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_cong_typ2' [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_cong_typ1 [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_sub_typ [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_trans_typ_max [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_refl [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+exp_to_num [definition, in Mcltt.Core.Syntactic.Syntax]
+exp_to_nat [definition, in Mcltt.Core.Syntactic.Syntax]
+exp_sind [definition, in Mcltt.Core.Syntactic.Syntax]
+exp_rec [definition, in Mcltt.Core.Syntactic.Syntax]
+exp_ind [definition, in Mcltt.Core.Syntactic.Syntax]
+exp_rect [definition, in Mcltt.Core.Syntactic.Syntax]
+exp_eq_typ_q_sigma_then_weak_weak_extend_succ_var_1 [lemma, in Mcltt.Core.Syntactic.Corollaries]
+exp_sub_decompose_double_q_with_id_double_extend [lemma, in Mcltt.Core.Syntactic.Corollaries]
+exp_eq_var_sub_rhs_typ_gen [lemma, in Mcltt.Core.Syntactic.Corollaries]
+exp_pi_eta_rhs_body [lemma, in Mcltt.Core.Syntactic.Corollaries]
+exp_pi_sub_rhs [lemma, in Mcltt.Core.Syntactic.Corollaries]
+exp_pi_sub_lhs [lemma, in Mcltt.Core.Syntactic.Corollaries]
+exp_eq_nat_beta_succ_rhs_typ_gen [lemma, in Mcltt.Core.Syntactic.Corollaries]
+exp_eq_sub_cong_typ2 [lemma, in Mcltt.Core.Syntactic.Corollaries]
+exp_eq_elim_sub_rhs_typ [lemma, in Mcltt.Core.Syntactic.Corollaries]
+exp_eq_elim_sub_lhs_typ_gen [lemma, in Mcltt.Core.Syntactic.Corollaries]
+exp_eq_natrec_cong_rhs_typ [lemma, in Mcltt.Core.Syntactic.Corollaries]
+exp_succ_sub_rhs [lemma, in Mcltt.Core.Syntactic.Corollaries]
+exp_succ_sub_lhs [lemma, in Mcltt.Core.Syntactic.Corollaries]
+exp_zero_sub_lhs [lemma, in Mcltt.Core.Syntactic.Corollaries]
+exp_nat_sub_lhs [lemma, in Mcltt.Core.Syntactic.Corollaries]
+exp_typ_sub_lhs [lemma, in Mcltt.Core.Syntactic.Corollaries]
+

F

+functional_ctx_lookup [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+

H

+here [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+

I

+id_sub_lookup_var1 [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+id_sub_lookup_var0 [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+invert_compose_id [lemma, in Mcltt.Core.Syntactic.Corollaries]
+invert_sub_id_typ [lemma, in Mcltt.Core.Syntactic.Corollaries]
+invert_sub_id [lemma, in Mcltt.Core.Syntactic.Corollaries]
+

L

+Lemmas [library]
+LibTactics [library]
+lift_exp_eq_max_right [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+lift_exp_eq_max_left [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+lift_exp_eq_ge [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+lift_exp_max_right [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+lift_exp_max_left [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+lift_exp_ge [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+

N

+nat_to_exp [definition, in Mcltt.Core.Syntactic.Syntax]
+ne [inductive, in Mcltt.Core.Syntactic.Syntax]
+ne_eq_dec [lemma, in Mcltt.Core.Syntactic.Syntax]
+ne_to_exp [definition, in Mcltt.Core.Syntactic.Syntax]
+ne_sind [definition, in Mcltt.Core.Syntactic.Syntax]
+ne_rec [definition, in Mcltt.Core.Syntactic.Syntax]
+ne_ind [definition, in Mcltt.Core.Syntactic.Syntax]
+ne_rect [definition, in Mcltt.Core.Syntactic.Syntax]
+ne_eqrec [constructor, in Mcltt.Core.Syntactic.Syntax]
+ne_var [constructor, in Mcltt.Core.Syntactic.Syntax]
+ne_app [constructor, in Mcltt.Core.Syntactic.Syntax]
+ne_natrec [constructor, in Mcltt.Core.Syntactic.Syntax]
+nf [inductive, in Mcltt.Core.Syntactic.Syntax]
+nf_eq_dec [lemma, in Mcltt.Core.Syntactic.Syntax]
+nf_to_exp [definition, in Mcltt.Core.Syntactic.Syntax]
+nf_sind [definition, in Mcltt.Core.Syntactic.Syntax]
+nf_rec [definition, in Mcltt.Core.Syntactic.Syntax]
+nf_ind [definition, in Mcltt.Core.Syntactic.Syntax]
+nf_rect [definition, in Mcltt.Core.Syntactic.Syntax]
+nf_neut [constructor, in Mcltt.Core.Syntactic.Syntax]
+nf_refl [constructor, in Mcltt.Core.Syntactic.Syntax]
+nf_eq [constructor, in Mcltt.Core.Syntactic.Syntax]
+nf_fn [constructor, in Mcltt.Core.Syntactic.Syntax]
+nf_pi [constructor, in Mcltt.Core.Syntactic.Syntax]
+nf_succ [constructor, in Mcltt.Core.Syntactic.Syntax]
+nf_zero [constructor, in Mcltt.Core.Syntactic.Syntax]
+nf_nat [constructor, in Mcltt.Core.Syntactic.Syntax]
+nf_typ [constructor, in Mcltt.Core.Syntactic.Syntax]
+num_to_exp [definition, in Mcltt.Core.Syntactic.Syntax]
+

P

+PERElem [record, in Mcltt.LibTactics]
+PERElem [inductive, in Mcltt.LibTactics]
+PERProper [instance, in Mcltt.LibTactics]
+per_elem [projection, in Mcltt.LibTactics]
+per_elem [constructor, in Mcltt.LibTactics]
+PER_refl2 [lemma, in Mcltt.LibTactics]
+PER_refl1 [lemma, in Mcltt.LibTactics]
+predicate_implication_equivalence [instance, in Mcltt.LibTactics]
+Presup [library]
+presup_exp [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+presup_exp_typ [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+presup_ctx_lookup_typ [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+presup_exp_eq_ctx [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+presup_sub_eq_ctx_right [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+presup_sub_eq_ctx_left [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+presup_sub_eq_ctx [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+presup_exp_ctx [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+presup_sub_right [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+presup_sub_left [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+presup_sub [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+presup_ctx_eq_right [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+presup_ctx_eq_left [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+presup_ctx_eq [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+presup_subtyp_right [lemma, in Mcltt.Core.Syntactic.System.Definitions]
+presup_ctx_sub_right [lemma, in Mcltt.Core.Syntactic.System.Definitions]
+presup_ctx_sub_left [lemma, in Mcltt.Core.Syntactic.System.Definitions]
+presup_ctx_sub [lemma, in Mcltt.Core.Syntactic.System.Definitions]
+presup_subtyp [lemma, in Mcltt.Core.Syntactic.Presup]
+presup_sub_eq [lemma, in Mcltt.Core.Syntactic.Presup]
+presup_exp_eq [lemma, in Mcltt.Core.Syntactic.Presup]
+

Q

+q [definition, in Mcltt.Core.Syntactic.Syntax]
+

S

+sub [inductive, in Mcltt.Core.Syntactic.Syntax]
+sub_lookup_var1 [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_lookup_var0 [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_q_sigma_compose_weak_weak_extend_succ_var_1 [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_p_p_q_q_sigma_nat [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_p_q_sigma_nat [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_p_q_sigma [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_q_sigma_id_extend [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_sigma_compose_weak_id_extend [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_id_extend_compose_sigma [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_id_extend_nat_compose_sigma [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_weak_compose_weak_extend_succ_var_1 [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_id_extend_zero [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_q_nat [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_q_typ [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_q [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_p_id_extend [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_id_extend [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_id_on_typ [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_p_extend_nat [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_extend_compose_nat [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_extend_cong_nat [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_extend_nat [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_wk_var0_id [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_p_extend_typ [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_extend_compose_typ [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_extend_cong_typ [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_extend_typ [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_refl [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+sub_sind [definition, in Mcltt.Core.Syntactic.Syntax]
+sub_rec [definition, in Mcltt.Core.Syntactic.Syntax]
+sub_ind [definition, in Mcltt.Core.Syntactic.Syntax]
+sub_rect [definition, in Mcltt.Core.Syntactic.Syntax]
+sub_eq_q_compose_nat [lemma, in Mcltt.Core.Syntactic.Corollaries]
+sub_eq_q_compose [lemma, in Mcltt.Core.Syntactic.Corollaries]
+sub_eq_p_q_sigma_compose_tau_extend [lemma, in Mcltt.Core.Syntactic.Corollaries]
+sub_decompose_q_typ [lemma, in Mcltt.Core.Syntactic.Corollaries]
+sub_decompose_q [lemma, in Mcltt.Core.Syntactic.Corollaries]
+sub_q_eq [lemma, in Mcltt.Core.Syntactic.Corollaries]
+sub_id_typ [lemma, in Mcltt.Core.Syntactic.Corollaries]
+Syntax [library]
+nf:eqrec _ as Eq _ _ _ return _ | refl -> _ end (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+nf:refl _ _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+nf:Eq _ _ _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+nf:⇑ _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+nf:# _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+nf:rec _ return _ | zero -> _ | succ -> _ end (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+nf:succ _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+nf:zero (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+nf:Π _ _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+nf:Type @ _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+nf:ℕ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+nf:_ _ .. _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+nf:λ _ _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+nf:_ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+nf:~ _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+nf:( _ ) (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+n{{{ _ }}} (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:_ , _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:⋅ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:q _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:_ ,, _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:_ ∘ _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:Wk (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:Id (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:# _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:eqrec _ as Eq _ _ _ return _ | refl -> _ end (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:refl _ _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:Eq _ _ _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:rec _ return _ | zero -> _ | succ -> _ end (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:succ _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:zero (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:Π _ _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:Type @ _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:ℕ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:_ _ .. _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:λ _ _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:_ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:~ _ (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:( _ ) (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+exp:_ [ _ ] (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+{{{ _ }}} (mcltt_scope) [notation, in Mcltt.Core.Syntactic.Syntax]
+Syntax_Notations [module, in Mcltt.Core.Syntactic.Syntax]
+System [library]
+SystemOpt [library]
+

T

+Tactics [library]
+there [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+typ [abbreviation, in Mcltt.Core.Syntactic.Syntax]
+

V

+vlookup_1_nat [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+vlookup_0_nat [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+vlookup_1_typ [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+vlookup_0_typ [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+

W

+wf_pi_inversion' [lemma, in Mcltt.Core.Syntactic.CoreTypeInversions]
+wf_pi_inversion [lemma, in Mcltt.Core.Syntactic.CoreTypeInversions]
+wf_nat_inversion [lemma, in Mcltt.Core.Syntactic.CoreTypeInversions]
+wf_typ_inversion [lemma, in Mcltt.Core.Syntactic.CoreTypeInversions]
+wf_sub_extend_inversion [lemma, in Mcltt.Core.Syntactic.CoreInversions]
+wf_sub_compose_inversion [lemma, in Mcltt.Core.Syntactic.CoreInversions]
+wf_sub_weaken_inversion [lemma, in Mcltt.Core.Syntactic.CoreInversions]
+wf_sub_id_inversion [lemma, in Mcltt.Core.Syntactic.CoreInversions]
+wf_exp_sub_inversion [lemma, in Mcltt.Core.Syntactic.CoreInversions]
+wf_vlookup_inversion [lemma, in Mcltt.Core.Syntactic.CoreInversions]
+wf_app_inversion [lemma, in Mcltt.Core.Syntactic.CoreInversions]
+wf_fn_inversion [lemma, in Mcltt.Core.Syntactic.CoreInversions]
+wf_natrec_inversion [lemma, in Mcltt.Core.Syntactic.CoreInversions]
+wf_succ_inversion [lemma, in Mcltt.Core.Syntactic.CoreInversions]
+wf_zero_inversion [lemma, in Mcltt.Core.Syntactic.CoreInversions]
+wf_subtyp_univ_weaken [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+wf_subtyp_sub [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+wf_subtyp_ge [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+wf_subtyp_refl [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+wf_sub_eq_conv [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+wf_exp_eq_conv [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+wf_sub_conv [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+wf_conv [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+wf_ctx_sub_refl [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+wf_exp_eq_cumu [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+wf_cumu [lemma, in Mcltt.Core.Syntactic.System.Lemmas]
+wf_sub_eq_per_elem [instance, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_per_elem [instance, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_subtyp' [lemma, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_subtyp' [lemma, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_subtyp' [lemma, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_subtyp' [lemma, in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_Transitive [instance, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_eq_Symmetric [instance, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_PER [instance, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_PER [instance, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_eq_sind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_eq_ind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_eq_extend [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_eq_empty [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_eq [inductive, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_mut_ind' [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_mut_ind' [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_mut_ind' [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_mut_ind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_mut_ind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_mut_ind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_mut_ind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_mut_ind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_sub_mut_ind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_mut_ind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_sind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_ind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_sind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_ind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_sind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_ind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_sind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_ind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_sind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_ind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_sub_sind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_sub_ind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_sind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_ind [definition, in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_pi [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_univ [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_trans [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_refl [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp [inductive, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_subtyp [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_trans [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_sym [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_extend [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_p_extend [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_extend_compose [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_compose_assoc [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_id_compose_left [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_id_compose_right [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_extend_cong [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_compose_cong [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_weaken [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_id [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq [inductive, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_trans [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_sym [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_subtyp [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_sub_compose [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_sub_id [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_sub_cong [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_var_weaken [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_var_S_sub [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_var_0_sub [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_var [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_eqrec_beta [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_eqrec_cong [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_refl_cong [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_eq_cong [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_eqrec_sub [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_refl_sub [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_eq_sub [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_pi_eta [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_pi_beta [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_app_sub [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_app_cong [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_fn_sub [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_fn_cong [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_pi_cong [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_pi_sub [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_nat_beta_succ [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_nat_beta_zero [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_natrec_sub [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_natrec_cong [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_succ_cong [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_succ_sub [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_zero_sub [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_nat_sub [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_typ_sub [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq [inductive, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_subtyp [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_extend [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_compose [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_weaken [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_id [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub [inductive, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_subtyp [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_sub [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_eqrec [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_refl [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_eq [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_vlookup [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_app [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_fn [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_pi [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_natrec [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_succ [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_zero [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_nat [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_typ [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp [inductive, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_sub_extend [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_sub_empty [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_sub [inductive, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_extend [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_empty [constructor, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx [inductive, in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_PER [instance, in Mcltt.Core.Syntactic.CtxEq]
+wf_subtyp_subst [lemma, in Mcltt.Core.Syntactic.Corollaries]
+wf_subtyp_subst_eq [lemma, in Mcltt.Core.Syntactic.Corollaries]
+wf_ctx_sub_length [lemma, in Mcltt.Core.Syntactic.Corollaries]
+wf_subtyp_pi' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_pi_eta' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_pi_beta' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_app_sub' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_app_cong' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_fn_sub' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_fn_cong' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_pi_cong_max [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_pi_cong' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_pi_sub_max [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_nat_beta_succ' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_nat_beta_zero' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_natrec_sub' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_natrec_cong' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_nat_sub' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_typ_sub' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_app' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_fn' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_pi_max [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_natrec' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_nat' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_ctx_eq_extend' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_conv' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_conv' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_subtyp_refl' [lemma, in Mcltt.Core.Syntactic.SystemOpt]
+wf_ctx_sub_trans_ins [instance, in Mcltt.Core.Syntactic.CtxSub]
+wf_ctx_sub_trans [lemma, in Mcltt.Core.Syntactic.CtxSub]
+

_

+__mark__ [definition, in Mcltt.LibTactics]
+

other

+judg:⊢ _ ≈ _ (type_scope) [notation, in Mcltt.Core.Syntactic.System.Definitions]
+judg:_ ⊢ _ ⊆ _ (type_scope) [notation, in Mcltt.Core.Syntactic.System.Definitions]
+judg:_ ⊢s _ ≈ _ : _ (type_scope) [notation, in Mcltt.Core.Syntactic.System.Definitions]
+judg:_ ⊢ _ ≈ _ : _ (type_scope) [notation, in Mcltt.Core.Syntactic.System.Definitions]
+judg:_ ⊢s _ : _ (type_scope) [notation, in Mcltt.Core.Syntactic.System.Definitions]
+judg:_ ⊢ _ : _ (type_scope) [notation, in Mcltt.Core.Syntactic.System.Definitions]
+judg:⊢ _ ⊆ _ (type_scope) [notation, in Mcltt.Core.Syntactic.System.Definitions]
+judg:⊢ _ (type_scope) [notation, in Mcltt.Core.Syntactic.System.Definitions]
+judg:# _ : _ ∈ _ (type_scope) [notation, in Mcltt.Core.Syntactic.System.Definitions]
+{{ _ }} [notation, in Mcltt.Core.Base]
+


+

Notation Index

+

S

+nf:eqrec _ as Eq _ _ _ return _ | refl -> _ end (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+nf:refl _ _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+nf:Eq _ _ _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+nf:⇑ _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+nf:# _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+nf:rec _ return _ | zero -> _ | succ -> _ end (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+nf:succ _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+nf:zero (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+nf:Π _ _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+nf:Type @ _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+nf:ℕ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+nf:_ _ .. _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+nf:λ _ _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+nf:_ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+nf:~ _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+nf:( _ ) (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+n{{{ _ }}} (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:_ , _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:⋅ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:q _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:_ ,, _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:_ ∘ _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:Wk (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:Id (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:# _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:eqrec _ as Eq _ _ _ return _ | refl -> _ end (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:refl _ _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:Eq _ _ _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:rec _ return _ | zero -> _ | succ -> _ end (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:succ _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:zero (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:Π _ _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:Type @ _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:ℕ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:_ _ .. _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:λ _ _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:_ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:~ _ (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:( _ ) (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+exp:_ [ _ ] (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+{{{ _ }}} (mcltt_scope) [in Mcltt.Core.Syntactic.Syntax]
+

other

+judg:⊢ _ ≈ _ (type_scope) [in Mcltt.Core.Syntactic.System.Definitions]
+judg:_ ⊢ _ ⊆ _ (type_scope) [in Mcltt.Core.Syntactic.System.Definitions]
+judg:_ ⊢s _ ≈ _ : _ (type_scope) [in Mcltt.Core.Syntactic.System.Definitions]
+judg:_ ⊢ _ ≈ _ : _ (type_scope) [in Mcltt.Core.Syntactic.System.Definitions]
+judg:_ ⊢s _ : _ (type_scope) [in Mcltt.Core.Syntactic.System.Definitions]
+judg:_ ⊢ _ : _ (type_scope) [in Mcltt.Core.Syntactic.System.Definitions]
+judg:⊢ _ ⊆ _ (type_scope) [in Mcltt.Core.Syntactic.System.Definitions]
+judg:⊢ _ (type_scope) [in Mcltt.Core.Syntactic.System.Definitions]
+judg:# _ : _ ∈ _ (type_scope) [in Mcltt.Core.Syntactic.System.Definitions]
+{{ _ }} [in Mcltt.Core.Base]
+


+

Module Index

+

C

+Cst [in Mcltt.Core.Syntactic.Syntax]
+ctxsub_judg [in Mcltt.Core.Syntactic.CtxSub]
+

S

+Syntax_Notations [in Mcltt.Core.Syntactic.Syntax]
+


+

Library Index

+

B

+Base
+

C

+CoreInversions
+CoreTypeInversions
+Corollaries
+CtxEq
+CtxSub
+

D

+Definitions
+

L

+Lemmas
+LibTactics
+

P

+Presup
+

S

+Syntax
+System
+SystemOpt
+

T

+Tactics
+


+

Lemma Index

+

A

+app_ctx_vlookup [in Mcltt.Core.Syntactic.Corollaries]
+app_ctx_lookup [in Mcltt.Core.Syntactic.Corollaries]
+

C

+ctxeq_ctx_lookup [in Mcltt.Core.Syntactic.System.Lemmas]
+ctxeq_subtyp [in Mcltt.Core.Syntactic.CtxEq]
+ctxeq_sub_eq [in Mcltt.Core.Syntactic.CtxEq]
+ctxeq_sub [in Mcltt.Core.Syntactic.CtxEq]
+ctxeq_exp_eq [in Mcltt.Core.Syntactic.CtxEq]
+ctxeq_exp [in Mcltt.Core.Syntactic.CtxEq]
+ctxsub_judg.ctxsub_subtyp [in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_sub_eq [in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_sub [in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_exp_eq [in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_exp [in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_subtyp_helper [in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_sub_eq_helper [in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_sub_helper [in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_exp_eq_helper [in Mcltt.Core.Syntactic.CtxSub]
+ctxsub_judg.ctxsub_exp_helper [in Mcltt.Core.Syntactic.CtxSub]
+ctx_sub_ctx_lookup [in Mcltt.Core.Syntactic.System.Lemmas]
+ctx_decomp_right [in Mcltt.Core.Syntactic.System.Lemmas]
+ctx_decomp_left [in Mcltt.Core.Syntactic.System.Lemmas]
+ctx_decomp [in Mcltt.Core.Syntactic.System.Lemmas]
+ctx_eq_trans [in Mcltt.Core.Syntactic.CtxEq]
+ctx_eq_sym [in Mcltt.Core.Syntactic.CtxEq]
+ctx_eq_refl [in Mcltt.Core.Syntactic.CtxEq]
+ctx_lookup_functional [in Mcltt.Core.Syntactic.Corollaries]
+ctx_sub_refl [in Mcltt.Core.Syntactic.CtxSub]
+

E

+exp_eq_var_1_sub_q_sigma [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_var_1_sub_q_sigma_nat [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_sub_compose_cong [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_sub_compose_cong_nat [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_var_0_weaken_nat [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_var_1_sub_nat [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_var_0_sub_nat [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_sub_nat_helper [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_nat_sub_sub_to_nat_sub [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_nat_sub_sub [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_compose_nat [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_cong_nat2 [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_cong_nat1 [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_sub_nat [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_sub_compose_cong_typ [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_var_0_weaken_typ [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_var_1_sub_typ [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_var_0_sub_typ [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_sub_typ_helper [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_typ_sub_sub [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_compose_typ [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_cong_typ2' [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_sub_cong_typ1 [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_sub_typ [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_trans_typ_max [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_refl [in Mcltt.Core.Syntactic.System.Lemmas]
+exp_eq_typ_q_sigma_then_weak_weak_extend_succ_var_1 [in Mcltt.Core.Syntactic.Corollaries]
+exp_sub_decompose_double_q_with_id_double_extend [in Mcltt.Core.Syntactic.Corollaries]
+exp_eq_var_sub_rhs_typ_gen [in Mcltt.Core.Syntactic.Corollaries]
+exp_pi_eta_rhs_body [in Mcltt.Core.Syntactic.Corollaries]
+exp_pi_sub_rhs [in Mcltt.Core.Syntactic.Corollaries]
+exp_pi_sub_lhs [in Mcltt.Core.Syntactic.Corollaries]
+exp_eq_nat_beta_succ_rhs_typ_gen [in Mcltt.Core.Syntactic.Corollaries]
+exp_eq_sub_cong_typ2 [in Mcltt.Core.Syntactic.Corollaries]
+exp_eq_elim_sub_rhs_typ [in Mcltt.Core.Syntactic.Corollaries]
+exp_eq_elim_sub_lhs_typ_gen [in Mcltt.Core.Syntactic.Corollaries]
+exp_eq_natrec_cong_rhs_typ [in Mcltt.Core.Syntactic.Corollaries]
+exp_succ_sub_rhs [in Mcltt.Core.Syntactic.Corollaries]
+exp_succ_sub_lhs [in Mcltt.Core.Syntactic.Corollaries]
+exp_zero_sub_lhs [in Mcltt.Core.Syntactic.Corollaries]
+exp_nat_sub_lhs [in Mcltt.Core.Syntactic.Corollaries]
+exp_typ_sub_lhs [in Mcltt.Core.Syntactic.Corollaries]
+

F

+functional_ctx_lookup [in Mcltt.Core.Syntactic.System.Lemmas]
+

I

+id_sub_lookup_var1 [in Mcltt.Core.Syntactic.System.Lemmas]
+id_sub_lookup_var0 [in Mcltt.Core.Syntactic.System.Lemmas]
+invert_compose_id [in Mcltt.Core.Syntactic.Corollaries]
+invert_sub_id_typ [in Mcltt.Core.Syntactic.Corollaries]
+invert_sub_id [in Mcltt.Core.Syntactic.Corollaries]
+

L

+lift_exp_eq_max_right [in Mcltt.Core.Syntactic.System.Lemmas]
+lift_exp_eq_max_left [in Mcltt.Core.Syntactic.System.Lemmas]
+lift_exp_eq_ge [in Mcltt.Core.Syntactic.System.Lemmas]
+lift_exp_max_right [in Mcltt.Core.Syntactic.System.Lemmas]
+lift_exp_max_left [in Mcltt.Core.Syntactic.System.Lemmas]
+lift_exp_ge [in Mcltt.Core.Syntactic.System.Lemmas]
+

N

+ne_eq_dec [in Mcltt.Core.Syntactic.Syntax]
+nf_eq_dec [in Mcltt.Core.Syntactic.Syntax]
+

P

+PER_refl2 [in Mcltt.LibTactics]
+PER_refl1 [in Mcltt.LibTactics]
+presup_exp [in Mcltt.Core.Syntactic.System.Lemmas]
+presup_exp_typ [in Mcltt.Core.Syntactic.System.Lemmas]
+presup_ctx_lookup_typ [in Mcltt.Core.Syntactic.System.Lemmas]
+presup_exp_eq_ctx [in Mcltt.Core.Syntactic.System.Lemmas]
+presup_sub_eq_ctx_right [in Mcltt.Core.Syntactic.System.Lemmas]
+presup_sub_eq_ctx_left [in Mcltt.Core.Syntactic.System.Lemmas]
+presup_sub_eq_ctx [in Mcltt.Core.Syntactic.System.Lemmas]
+presup_exp_ctx [in Mcltt.Core.Syntactic.System.Lemmas]
+presup_sub_right [in Mcltt.Core.Syntactic.System.Lemmas]
+presup_sub_left [in Mcltt.Core.Syntactic.System.Lemmas]
+presup_sub [in Mcltt.Core.Syntactic.System.Lemmas]
+presup_ctx_eq_right [in Mcltt.Core.Syntactic.System.Lemmas]
+presup_ctx_eq_left [in Mcltt.Core.Syntactic.System.Lemmas]
+presup_ctx_eq [in Mcltt.Core.Syntactic.System.Lemmas]
+presup_subtyp_right [in Mcltt.Core.Syntactic.System.Definitions]
+presup_ctx_sub_right [in Mcltt.Core.Syntactic.System.Definitions]
+presup_ctx_sub_left [in Mcltt.Core.Syntactic.System.Definitions]
+presup_ctx_sub [in Mcltt.Core.Syntactic.System.Definitions]
+presup_subtyp [in Mcltt.Core.Syntactic.Presup]
+presup_sub_eq [in Mcltt.Core.Syntactic.Presup]
+presup_exp_eq [in Mcltt.Core.Syntactic.Presup]
+

S

+sub_lookup_var1 [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_lookup_var0 [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_q_sigma_compose_weak_weak_extend_succ_var_1 [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_p_p_q_q_sigma_nat [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_p_q_sigma_nat [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_p_q_sigma [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_q_sigma_id_extend [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_sigma_compose_weak_id_extend [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_id_extend_compose_sigma [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_id_extend_nat_compose_sigma [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_weak_compose_weak_extend_succ_var_1 [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_id_extend_zero [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_q_nat [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_q_typ [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_q [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_p_id_extend [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_id_extend [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_id_on_typ [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_p_extend_nat [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_extend_compose_nat [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_extend_cong_nat [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_extend_nat [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_wk_var0_id [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_p_extend_typ [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_extend_compose_typ [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_extend_cong_typ [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_extend_typ [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_refl [in Mcltt.Core.Syntactic.System.Lemmas]
+sub_eq_q_compose_nat [in Mcltt.Core.Syntactic.Corollaries]
+sub_eq_q_compose [in Mcltt.Core.Syntactic.Corollaries]
+sub_eq_p_q_sigma_compose_tau_extend [in Mcltt.Core.Syntactic.Corollaries]
+sub_decompose_q_typ [in Mcltt.Core.Syntactic.Corollaries]
+sub_decompose_q [in Mcltt.Core.Syntactic.Corollaries]
+sub_q_eq [in Mcltt.Core.Syntactic.Corollaries]
+sub_id_typ [in Mcltt.Core.Syntactic.Corollaries]
+

V

+vlookup_1_nat [in Mcltt.Core.Syntactic.System.Lemmas]
+vlookup_0_nat [in Mcltt.Core.Syntactic.System.Lemmas]
+vlookup_1_typ [in Mcltt.Core.Syntactic.System.Lemmas]
+vlookup_0_typ [in Mcltt.Core.Syntactic.System.Lemmas]
+

W

+wf_pi_inversion' [in Mcltt.Core.Syntactic.CoreTypeInversions]
+wf_pi_inversion [in Mcltt.Core.Syntactic.CoreTypeInversions]
+wf_nat_inversion [in Mcltt.Core.Syntactic.CoreTypeInversions]
+wf_typ_inversion [in Mcltt.Core.Syntactic.CoreTypeInversions]
+wf_sub_extend_inversion [in Mcltt.Core.Syntactic.CoreInversions]
+wf_sub_compose_inversion [in Mcltt.Core.Syntactic.CoreInversions]
+wf_sub_weaken_inversion [in Mcltt.Core.Syntactic.CoreInversions]
+wf_sub_id_inversion [in Mcltt.Core.Syntactic.CoreInversions]
+wf_exp_sub_inversion [in Mcltt.Core.Syntactic.CoreInversions]
+wf_vlookup_inversion [in Mcltt.Core.Syntactic.CoreInversions]
+wf_app_inversion [in Mcltt.Core.Syntactic.CoreInversions]
+wf_fn_inversion [in Mcltt.Core.Syntactic.CoreInversions]
+wf_natrec_inversion [in Mcltt.Core.Syntactic.CoreInversions]
+wf_succ_inversion [in Mcltt.Core.Syntactic.CoreInversions]
+wf_zero_inversion [in Mcltt.Core.Syntactic.CoreInversions]
+wf_subtyp_univ_weaken [in Mcltt.Core.Syntactic.System.Lemmas]
+wf_subtyp_sub [in Mcltt.Core.Syntactic.System.Lemmas]
+wf_subtyp_ge [in Mcltt.Core.Syntactic.System.Lemmas]
+wf_subtyp_refl [in Mcltt.Core.Syntactic.System.Lemmas]
+wf_sub_eq_conv [in Mcltt.Core.Syntactic.System.Lemmas]
+wf_exp_eq_conv [in Mcltt.Core.Syntactic.System.Lemmas]
+wf_sub_conv [in Mcltt.Core.Syntactic.System.Lemmas]
+wf_conv [in Mcltt.Core.Syntactic.System.Lemmas]
+wf_ctx_sub_refl [in Mcltt.Core.Syntactic.System.Lemmas]
+wf_exp_eq_cumu [in Mcltt.Core.Syntactic.System.Lemmas]
+wf_cumu [in Mcltt.Core.Syntactic.System.Lemmas]
+wf_sub_eq_subtyp' [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_subtyp' [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_subtyp' [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_subtyp' [in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_subst [in Mcltt.Core.Syntactic.Corollaries]
+wf_subtyp_subst_eq [in Mcltt.Core.Syntactic.Corollaries]
+wf_ctx_sub_length [in Mcltt.Core.Syntactic.Corollaries]
+wf_subtyp_pi' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_pi_eta' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_pi_beta' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_app_sub' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_app_cong' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_fn_sub' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_fn_cong' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_pi_cong_max [in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_pi_cong' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_pi_sub_max [in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_nat_beta_succ' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_nat_beta_zero' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_natrec_sub' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_natrec_cong' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_nat_sub' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_typ_sub' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_app' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_fn' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_pi_max [in Mcltt.Core.Syntactic.SystemOpt]
+wf_natrec' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_nat' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_ctx_eq_extend' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_exp_eq_conv' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_conv' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_subtyp_refl' [in Mcltt.Core.Syntactic.SystemOpt]
+wf_ctx_sub_trans [in Mcltt.Core.Syntactic.CtxSub]
+


+

Constructor Index

+

A

+a_extend [in Mcltt.Core.Syntactic.Syntax]
+a_compose [in Mcltt.Core.Syntactic.Syntax]
+a_weaken [in Mcltt.Core.Syntactic.Syntax]
+a_id [in Mcltt.Core.Syntactic.Syntax]
+a_sub [in Mcltt.Core.Syntactic.Syntax]
+a_var [in Mcltt.Core.Syntactic.Syntax]
+a_eqrec [in Mcltt.Core.Syntactic.Syntax]
+a_refl [in Mcltt.Core.Syntactic.Syntax]
+a_eq [in Mcltt.Core.Syntactic.Syntax]
+a_app [in Mcltt.Core.Syntactic.Syntax]
+a_fn [in Mcltt.Core.Syntactic.Syntax]
+a_pi [in Mcltt.Core.Syntactic.Syntax]
+a_natrec [in Mcltt.Core.Syntactic.Syntax]
+a_succ [in Mcltt.Core.Syntactic.Syntax]
+a_zero [in Mcltt.Core.Syntactic.Syntax]
+a_nat [in Mcltt.Core.Syntactic.Syntax]
+a_typ [in Mcltt.Core.Syntactic.Syntax]
+

C

+Cst.app [in Mcltt.Core.Syntactic.Syntax]
+Cst.eqrec [in Mcltt.Core.Syntactic.Syntax]
+Cst.fn [in Mcltt.Core.Syntactic.Syntax]
+Cst.nat [in Mcltt.Core.Syntactic.Syntax]
+Cst.natrec [in Mcltt.Core.Syntactic.Syntax]
+Cst.pi [in Mcltt.Core.Syntactic.Syntax]
+Cst.prop_eq [in Mcltt.Core.Syntactic.Syntax]
+Cst.refl [in Mcltt.Core.Syntactic.Syntax]
+Cst.succ [in Mcltt.Core.Syntactic.Syntax]
+Cst.typ [in Mcltt.Core.Syntactic.Syntax]
+Cst.var [in Mcltt.Core.Syntactic.Syntax]
+Cst.zero [in Mcltt.Core.Syntactic.Syntax]
+

H

+here [in Mcltt.Core.Syntactic.System.Definitions]
+

N

+ne_eqrec [in Mcltt.Core.Syntactic.Syntax]
+ne_var [in Mcltt.Core.Syntactic.Syntax]
+ne_app [in Mcltt.Core.Syntactic.Syntax]
+ne_natrec [in Mcltt.Core.Syntactic.Syntax]
+nf_neut [in Mcltt.Core.Syntactic.Syntax]
+nf_refl [in Mcltt.Core.Syntactic.Syntax]
+nf_eq [in Mcltt.Core.Syntactic.Syntax]
+nf_fn [in Mcltt.Core.Syntactic.Syntax]
+nf_pi [in Mcltt.Core.Syntactic.Syntax]
+nf_succ [in Mcltt.Core.Syntactic.Syntax]
+nf_zero [in Mcltt.Core.Syntactic.Syntax]
+nf_nat [in Mcltt.Core.Syntactic.Syntax]
+nf_typ [in Mcltt.Core.Syntactic.Syntax]
+

P

+per_elem [in Mcltt.LibTactics]
+

T

+there [in Mcltt.Core.Syntactic.System.Definitions]
+

W

+wf_ctx_eq_extend [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_eq_empty [in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_pi [in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_univ [in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_trans [in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_refl [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_subtyp [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_trans [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_sym [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_extend [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_p_extend [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_extend_compose [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_compose_assoc [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_id_compose_left [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_id_compose_right [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_extend_cong [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_compose_cong [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_weaken [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_id [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_trans [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_sym [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_subtyp [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_sub_compose [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_sub_id [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_sub_cong [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_var_weaken [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_var_S_sub [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_var_0_sub [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_var [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_eqrec_beta [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_eqrec_cong [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_refl_cong [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_eq_cong [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_eqrec_sub [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_refl_sub [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_eq_sub [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_pi_eta [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_pi_beta [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_app_sub [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_app_cong [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_fn_sub [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_fn_cong [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_pi_cong [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_pi_sub [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_nat_beta_succ [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_nat_beta_zero [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_natrec_sub [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_natrec_cong [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_succ_cong [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_succ_sub [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_zero_sub [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_nat_sub [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_typ_sub [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_subtyp [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_extend [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_compose [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_weaken [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_id [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_subtyp [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_sub [in Mcltt.Core.Syntactic.System.Definitions]
+wf_eqrec [in Mcltt.Core.Syntactic.System.Definitions]
+wf_refl [in Mcltt.Core.Syntactic.System.Definitions]
+wf_eq [in Mcltt.Core.Syntactic.System.Definitions]
+wf_vlookup [in Mcltt.Core.Syntactic.System.Definitions]
+wf_app [in Mcltt.Core.Syntactic.System.Definitions]
+wf_fn [in Mcltt.Core.Syntactic.System.Definitions]
+wf_pi [in Mcltt.Core.Syntactic.System.Definitions]
+wf_natrec [in Mcltt.Core.Syntactic.System.Definitions]
+wf_succ [in Mcltt.Core.Syntactic.System.Definitions]
+wf_zero [in Mcltt.Core.Syntactic.System.Definitions]
+wf_nat [in Mcltt.Core.Syntactic.System.Definitions]
+wf_typ [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_sub_extend [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_sub_empty [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_extend [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_empty [in Mcltt.Core.Syntactic.System.Definitions]
+


+

Projection Index

+

P

+per_elem [in Mcltt.LibTactics]
+


+

Inductive Index

+

C

+Cst.obj [in Mcltt.Core.Syntactic.Syntax]
+ctx_lookup [in Mcltt.Core.Syntactic.System.Definitions]
+

E

+exp [in Mcltt.Core.Syntactic.Syntax]
+

N

+ne [in Mcltt.Core.Syntactic.Syntax]
+nf [in Mcltt.Core.Syntactic.Syntax]
+

P

+PERElem [in Mcltt.LibTactics]
+

S

+sub [in Mcltt.Core.Syntactic.Syntax]
+

W

+wf_ctx_eq [in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_sub [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx [in Mcltt.Core.Syntactic.System.Definitions]
+


+

Instance Index

+

P

+PERProper [in Mcltt.LibTactics]
+predicate_implication_equivalence [in Mcltt.LibTactics]
+

W

+wf_sub_eq_per_elem [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_per_elem [in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_Transitive [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_eq_Symmetric [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_PER [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_PER [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_PER [in Mcltt.Core.Syntactic.CtxEq]
+wf_ctx_sub_trans_ins [in Mcltt.Core.Syntactic.CtxSub]
+


+

Abbreviation Index

+

C

+ctx [in Mcltt.Core.Syntactic.Syntax]
+

T

+typ [in Mcltt.Core.Syntactic.Syntax]
+


+

Record Index

+

P

+PERElem [in Mcltt.LibTactics]
+


+

Definition Index

+

C

+Cst.obj_sind [in Mcltt.Core.Syntactic.Syntax]
+Cst.obj_rec [in Mcltt.Core.Syntactic.Syntax]
+Cst.obj_ind [in Mcltt.Core.Syntactic.Syntax]
+Cst.obj_rect [in Mcltt.Core.Syntactic.Syntax]
+ctx_lookup_sind [in Mcltt.Core.Syntactic.System.Definitions]
+ctx_lookup_ind [in Mcltt.Core.Syntactic.System.Definitions]
+

E

+exp_to_num [in Mcltt.Core.Syntactic.Syntax]
+exp_to_nat [in Mcltt.Core.Syntactic.Syntax]
+exp_sind [in Mcltt.Core.Syntactic.Syntax]
+exp_rec [in Mcltt.Core.Syntactic.Syntax]
+exp_ind [in Mcltt.Core.Syntactic.Syntax]
+exp_rect [in Mcltt.Core.Syntactic.Syntax]
+

N

+nat_to_exp [in Mcltt.Core.Syntactic.Syntax]
+ne_to_exp [in Mcltt.Core.Syntactic.Syntax]
+ne_sind [in Mcltt.Core.Syntactic.Syntax]
+ne_rec [in Mcltt.Core.Syntactic.Syntax]
+ne_ind [in Mcltt.Core.Syntactic.Syntax]
+ne_rect [in Mcltt.Core.Syntactic.Syntax]
+nf_to_exp [in Mcltt.Core.Syntactic.Syntax]
+nf_sind [in Mcltt.Core.Syntactic.Syntax]
+nf_rec [in Mcltt.Core.Syntactic.Syntax]
+nf_ind [in Mcltt.Core.Syntactic.Syntax]
+nf_rect [in Mcltt.Core.Syntactic.Syntax]
+num_to_exp [in Mcltt.Core.Syntactic.Syntax]
+

Q

+q [in Mcltt.Core.Syntactic.Syntax]
+

S

+sub_sind [in Mcltt.Core.Syntactic.Syntax]
+sub_rec [in Mcltt.Core.Syntactic.Syntax]
+sub_ind [in Mcltt.Core.Syntactic.Syntax]
+sub_rect [in Mcltt.Core.Syntactic.Syntax]
+

W

+wf_ctx_eq_sind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_eq_ind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_mut_ind' [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_mut_ind' [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_mut_ind' [in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_mut_ind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_mut_ind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_mut_ind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_mut_ind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_mut_ind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_sub_mut_ind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_mut_ind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_sind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_subtyp_ind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_sind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_eq_ind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_sind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_eq_ind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_sind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_sub_ind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_sind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_exp_ind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_sub_sind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_sub_ind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_sind [in Mcltt.Core.Syntactic.System.Definitions]
+wf_ctx_ind [in Mcltt.Core.Syntactic.System.Definitions]
+

_

+__mark__ [in Mcltt.LibTactics]
+


+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Global IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(478 entries)
Notation IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(51 entries)
Module IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(3 entries)
Library IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(14 entries)
Lemma IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(204 entries)
Constructor IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(121 entries)
Projection IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(1 entry)
Inductive IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(15 entries)
Instance IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(10 entries)
Abbreviation IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(2 entries)
Record IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(1 entry)
Definition IndexABCDEFGHIJKLMNOPQRSTUVWXYZ_other(56 entries)
+
+ +
+ + + diff --git a/ext/prop-eq/resources/config.js b/ext/prop-eq/resources/config.js new file mode 100644 index 00000000..72be6131 --- /dev/null +++ b/ext/prop-eq/resources/config.js @@ -0,0 +1,72 @@ +var coqdocjs = coqdocjs || {}; + +coqdocjs.repl = { + "forall": "∀", + "exists": "∃", + "~": "¬", + "/\\": "∧", + "\\/": "∨", + "->": "→", + "<-": "←", + "<->": "↔", + "=>": "⇒", + "<>": "≠", + "<=": "≤", + ">=": "≥", + "el": "∈", + "nel": "∉", + "<<=": "⊆", + "|-": "⊢", + ">>": "»", + "<<": "⊆", + "++": "⧺", + "===": "≡", + "=/=": "≢", + "=~=": "≅", + "==>": "⟹", + "lhd": "⊲", + "rhd": "⊳", + "nat": "ℕ", + "alpha": "α", + "beta": "β", + "gamma": "γ", + "delta": "δ", + "epsilon": "ε", + "eta": "η", + "iota": "ι", + "kappa": "κ", + "lambda": "λ", + "mu": "μ", + "nu": "ν", + "omega": "ω", + "phi": "ϕ", + "pi": "π", + "psi": "ψ", + "rho": "ρ", + "sigma": "σ", + "tau": "τ", + "theta": "θ", + "xi": "ξ", + "zeta": "ζ", + "Delta": "Δ", + "Gamma": "Γ", + "Pi": "Π", + "Sigma": "Σ", + "Omega": "Ω", + "Xi": "Ξ" +}; + +coqdocjs.subscr = { + "0" : "₀", + "1" : "₁", + "2" : "₂", + "3" : "₃", + "4" : "₄", + "5" : "₅", + "6" : "₆", + "7" : "₇", + "8" : "₈", + "9" : "₉", +}; + +coqdocjs.replInText = ["==>","<=>", "=>", "->", "<-", ":="]; diff --git a/ext/prop-eq/resources/coqdoc.css b/ext/prop-eq/resources/coqdoc.css new file mode 100644 index 00000000..18dad894 --- /dev/null +++ b/ext/prop-eq/resources/coqdoc.css @@ -0,0 +1,197 @@ +@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,700); + +body{ + font-family: 'Open Sans', sans-serif; + font-size: 14px; + color: #2D2D2D +} + +a { + text-decoration: none; + border-radius: 3px; + padding-left: 3px; + padding-right: 3px; + margin-left: -3px; + margin-right: -3px; + color: inherit; + font-weight: bold; +} + +#main .code a, #main .inlinecode a, #toc a { + font-weight: inherit; +} + +a[href]:hover, [clickable]:hover{ + background-color: rgba(0,0,0,0.1); + cursor: pointer; +} + +h, h1, h2, h3, h4, h5 { + line-height: 1; + color: black; + text-rendering: optimizeLegibility; + font-weight: normal; + letter-spacing: 0.1em; + text-align: left; +} + +div + br { + display: none; +} + +div:empty{ display: none;} + +#main h1 { + font-size: 2em; +} + +#main h2 { + font-size: 1.667rem; +} + +#main h3 { + font-size: 1.333em; +} + +#main h4, #main h5, #main h6 { + font-size: 1em; +} + +#toc h2 { + padding-bottom: 0; +} + +#main .doc { + margin: 0; + text-align: justify; +} + +.inlinecode, .code, #main pre { + font-family: monospace; +} + +.code > br:first-child { + display: none; +} + +.doc + .code{ + margin-top:0.5em; +} + +.block{ + display: block; + margin-top: 5px; + margin-bottom: 5px; + padding: 10px; + text-align: center; +} + +.block img{ + margin: 15px; +} + +table.infrule { + border: 0px; + margin-left: 50px; + margin-top: 10px; + margin-bottom: 10px; +} + +td.infrule { + font-family: "Droid Sans Mono", "DejaVu Sans Mono", monospace; + text-align: center; + padding: 0; + line-height: 1; +} + +tr.infrulemiddle hr { + margin: 1px 0 1px 0; +} + +.infrulenamecol { + color: rgb(60%,60%,60%); + padding-left: 1em; + padding-bottom: 0.1em +} + +.id[type="constructor"], .id[type="projection"], .id[type="method"], +.id[title="constructor"], .id[title="projection"], .id[title="method"] { + color: #A30E16; +} + +.id[type="var"], .id[type="variable"], +.id[title="var"], .id[title="variable"] { + color: inherit; +} + +.id[type="definition"], .id[type="record"], .id[type="class"], .id[type="instance"], .id[type="inductive"], .id[type="library"], +.id[title="definition"], .id[title="record"], .id[title="class"], .id[title="instance"], .id[title="inductive"], .id[title="library"] { + color: #A6650F; +} + +.id[type="lemma"], +.id[title="lemma"]{ + color: #188B0C; +} + +.id[type="keyword"], .id[type="notation"], .id[type="abbreviation"], +.id[title="keyword"], .id[title="notation"], .id[title="abbreviation"]{ + color : #2874AE; +} + +.comment { + color: #808080; +} + +/* TOC */ + +#toc h2{ + letter-spacing: 0; + font-size: 1.333em; +} + +/* Index */ + +#index { + margin: 0; + padding: 0; + width: 100%; +} + +#index #frontispiece { + margin: 1em auto; + padding: 1em; + width: 60%; +} + +.booktitle { font-size : 140% } +.authors { font-size : 90%; + line-height: 115%; } +.moreauthors { font-size : 60% } + +#index #entrance { + text-align: center; +} + +#index #entrance .spacer { + margin: 0 30px 0 30px; +} + +ul.doclist { + margin-top: 0em; + margin-bottom: 0em; +} + +#toc > * { + clear: both; +} + +#toc > a { + display: block; + float: left; + margin-top: 1em; +} + +#toc a h2{ + display: inline; +} diff --git a/ext/prop-eq/resources/coqdocjs.css b/ext/prop-eq/resources/coqdocjs.css new file mode 100644 index 00000000..3022215d --- /dev/null +++ b/ext/prop-eq/resources/coqdocjs.css @@ -0,0 +1,248 @@ +/* replace unicode */ + +.id[repl] .hidden { + font-size: 0; +} + +.id[repl]:before{ + content: attr(repl); +} + +/* folding proofs */ + +@keyframes show-proof { + 0% { + max-height: 1.2em; + opacity: 1; + } + 99% { + max-height: 1000em; + } + 100%{ + } +} + +@keyframes hide-proof { + from { + visibility: visible; + max-height: 10em; + opacity: 1; + } + to { + max-height: 1.2em; + } +} + +.proof { + cursor: pointer; +} +.proof * { + cursor: pointer; +} + +.proof { + overflow: hidden; + position: relative; + transition: opacity 1s; + display: inline-block; +} + +.proof[show="false"] { + max-height: 1.2em; + visibility: visible; + opacity: 0.3; +} + +.proof[show="false"][animate] { + animation-name: hide-proof; + animation-duration: 0.25s; +} + +.proof[show=true] { + animation-name: show-proof; + animation-duration: 10s; +} + +.proof[show="false"]:before { + position: absolute; + visibility: visible; + width: 100%; + height: 100%; + display: block; + opacity: 0; + content: "M"; +} +.proof[show="false"]:hover:before { + content: ""; +} + +.proof[show="false"] + br + br { + display: none; +} + +.proof[show="false"]:hover { + visibility: visible; + opacity: 0.5; +} + +#toggle-proofs[proof-status="no-proofs"] { + display: none; +} + +#toggle-proofs[proof-status="some-hidden"]:before { + content: "Show Proofs"; +} + +#toggle-proofs[proof-status="all-shown"]:before { + content: "Hide Proofs"; +} + + +/* page layout */ + +html, body { + height: 100%; + margin:0; + padding:0; +} + +@media only screen { /* no div with internal scrolling to allow printing of whole content */ + body { + display: flex; + flex-direction: column + } + + #content { + flex: 1; + overflow: auto; + display: flex; + flex-direction: column; + } +} + +#content:focus { + outline: none; /* prevent glow in OS X */ +} + +#main { + display: block; + padding: 16px; + padding-top: 1em; + padding-bottom: 2em; + margin-left: auto; + margin-right: auto; + flex: 1 0 auto; +} + +.libtitle { + display: none; +} + +/* header */ +#header { + width:100%; + padding: 0; + margin: 0; + display: flex; + align-items: center; + background-color: rgb(21,57,105); + color: white; + font-weight: bold; + overflow: hidden; +} + + +.button { + cursor: pointer; +} + +#header * { + text-decoration: none; + vertical-align: middle; + margin-left: 15px; + margin-right: 15px; +} + +#header > .right, #header > .left { + display: flex; + flex: 1; + align-items: center; +} +#header > .left { + text-align: left; +} +#header > .right { + flex-direction: row-reverse; +} + +#header a, #header .button { + color: white; + box-sizing: border-box; +} + +#header a { + border-radius: 0; + padding: 0.2em; +} + +#header .button { + background-color: rgb(63, 103, 156); + border-radius: 1em; + padding-left: 0.5em; + padding-right: 0.5em; + margin: 0.2em; +} + +#header a:hover, #header .button:hover { + background-color: rgb(181, 213, 255); + color: black; +} + +#header h1 { padding: 0; + margin: 0;} + +/* footer */ +#footer { + text-align: center; + opacity: 0.5; + font-size: 75%; +} + +/* hyperlinks */ + +@keyframes highlight { + 50%{ + background-color: black; + } +} + +:target * { + animation-name: highlight; + animation-duration: 1s; +} + +a[name]:empty { + float: right; +} + +/* Proviola */ + +div.code { + width: auto; + float: none; +} + +div.goal { + position: fixed; + left: 75%; + width: 25%; + top: 3em; +} + +div.doc { + clear: both; +} + +span.command:hover { + background-color: inherit; +} diff --git a/ext/prop-eq/resources/coqdocjs.js b/ext/prop-eq/resources/coqdocjs.js new file mode 100644 index 00000000..503cc870 --- /dev/null +++ b/ext/prop-eq/resources/coqdocjs.js @@ -0,0 +1,189 @@ +var coqdocjs = coqdocjs || {}; +(function(){ + +function replace(s){ + var m; + if (m = s.match(/^(.+)'/)) { + return replace(m[1])+"'"; + } else if (m = s.match(/^([A-Za-z]+)_?(\d+)$/)) { + return replace(m[1])+m[2].replace(/\d/g, function(d){ + if (coqdocjs.subscr.hasOwnProperty(d)) { + return coqdocjs.subscr[d]; + } else { + return d; + } + }); + } else if (coqdocjs.repl.hasOwnProperty(s)){ + return coqdocjs.repl[s] + } else { + return s; + } +} + +function toArray(nl){ + return Array.prototype.slice.call(nl); +} + +function replInTextNodes() { + coqdocjs.replInText.forEach(function(toReplace){ + toArray(document.getElementsByClassName("code")).concat(toArray(document.getElementsByClassName("inlinecode"))).forEach(function(elem){ + toArray(elem.childNodes).forEach(function(node){ + if (node.nodeType != Node.TEXT_NODE) return; + var fragments = node.textContent.split(toReplace); + node.textContent = fragments[fragments.length-1]; + for (var k = 0; k < fragments.length - 1; ++k) { + node.parentNode.insertBefore(document.createTextNode(fragments[k]),node); + var replacement = document.createElement("span"); + replacement.appendChild(document.createTextNode(toReplace)); + replacement.setAttribute("class", "id"); + replacement.setAttribute("type", "keyword"); + node.parentNode.insertBefore(replacement, node); + } + }); + }); + }); +} + +function replNodes() { + toArray(document.getElementsByClassName("id")).forEach(function(node){ + if (["var", "variable", "keyword", "notation", "definition", "inductive"].indexOf(node.getAttribute("type"))>=0){ + var text = node.textContent; + var replText = replace(text); + if(text != replText) { + node.setAttribute("repl", replText); + node.setAttribute("title", text); + var hidden = document.createElement("span"); + hidden.setAttribute("class", "hidden"); + while (node.firstChild) { + hidden.appendChild(node.firstChild); + } + node.appendChild(hidden); + } + } + }); +} + +function isVernacStart(l, t){ + t = t.trim(); + for(var s of l){ + if (t == s || t.startsWith(s+" ") || t.startsWith(s+".")){ + return true; + } + } + return false; +} + +function isProofStart(n){ + return isVernacStart(["Proof"], n.textContent) && !isVernacStart(["Default", "Suggest"], n.previousSibling.previousSibling.textContent) || + (isVernacStart(["Next"], n.textContent) && isVernacStart(["Obligation"], n.nextSibling.nextSibling.textContent)); +} + +function isProofEnd(s){ + return isVernacStart(["Qed", "Admitted", "Defined", "Abort"], s); +} + +function proofStatus(){ + var proofs = toArray(document.getElementsByClassName("proof")); + if(proofs.length) { + for(var proof of proofs) { + if (proof.getAttribute("show") === "false") { + return "some-hidden"; + } + } + return "all-shown"; + } + else { + return "no-proofs"; + } +} + +function updateView(){ + document.getElementById("toggle-proofs").setAttribute("proof-status", proofStatus()); +} + +function foldProofs() { + var hasCommands = true; + var nodes = document.getElementsByClassName("command"); + if(nodes.length == 0) { + hasCommands = false; + console.log("no command tags found") + nodes = document.getElementsByClassName("id"); + } + toArray(nodes).forEach(function(node){ + if(isProofStart(node)) { + var proof = document.createElement("span"); + proof.setAttribute("class", "proof"); + + node.parentNode.insertBefore(proof, node); + if(proof.previousSibling.nodeType === Node.TEXT_NODE) + proof.appendChild(proof.previousSibling); + while(node && !isProofEnd(node.textContent)) { + proof.appendChild(node); + node = proof.nextSibling; + } + if (proof.nextSibling) proof.appendChild(proof.nextSibling); // the Qed + if (!hasCommands && proof.nextSibling) proof.appendChild(proof.nextSibling); // the dot after the Qed + + proof.addEventListener("click", function(proof){return function(e){ + if (e.target.parentNode.tagName.toLowerCase() === "a") + return; + proof.setAttribute("show", proof.getAttribute("show") === "true" ? "false" : "true"); + proof.setAttribute("animate", ""); + updateView(); + };}(proof)); + proof.setAttribute("show", "false"); + } + }); +} + +function toggleProofs(){ + var someProofsHidden = proofStatus() === "some-hidden"; + toArray(document.getElementsByClassName("proof")).forEach(function(proof){ + proof.setAttribute("show", someProofsHidden); + proof.setAttribute("animate", ""); + }); + updateView(); +} + +function repairDom(){ + // pull whitespace out of command + toArray(document.getElementsByClassName("command")).forEach(function(node){ + while(node.firstChild && node.firstChild.textContent.trim() == ""){ + console.log("try move"); + node.parentNode.insertBefore(node.firstChild, node); + } + }); + toArray(document.getElementsByClassName("id")).forEach(function(node){ + node.setAttribute("type", node.getAttribute("title")); + }); + toArray(document.getElementsByClassName("idref")).forEach(function(ref){ + toArray(ref.childNodes).forEach(function(child){ + if (["var", "variable"].indexOf(child.getAttribute("type")) > -1) + ref.removeAttribute("href"); + }); + }); + +} + +function fixTitle(){ + var url = "/" + window.location.pathname; + var basename = url.substring(url.lastIndexOf('/')+1, url.lastIndexOf('.')); + if (basename === "dep") {document.title = "Table of Contents";} + else if (basename === "indexpage") {document.title = "Index";} + else {document.title = basename;} +} + +function postprocess(){ + repairDom(); + replInTextNodes() + replNodes(); + foldProofs(); + document.getElementById("toggle-proofs").addEventListener("click", toggleProofs); + updateView(); +} + +fixTitle(); +document.addEventListener('DOMContentLoaded', postprocess); + +coqdocjs.toggleProofs = toggleProofs; +})(); diff --git a/ext/prop-eq/resources/depgraph.css b/ext/prop-eq/resources/depgraph.css new file mode 100644 index 00000000..c63ac641 --- /dev/null +++ b/ext/prop-eq/resources/depgraph.css @@ -0,0 +1,26 @@ +svg.depgraph { + max-width: 100%; +} + +svg.depgraph > text:first-of-type { + font-weight: bold; +} + +.text-highlight-edges text { + opacity: 1 !important; + stroke-width: 3; + font-weight: bold; + fill: indigo; +} + +.edge-highlight path { + opacity: 1; + stroke-width: 3; + stroke: blue; +} + +.edge-highlight polygon { + opacity: 1; + stroke-width: 3; + stroke: blue; +} diff --git a/ext/prop-eq/resources/depgraph.js b/ext/prop-eq/resources/depgraph.js new file mode 100644 index 00000000..d74b71d5 --- /dev/null +++ b/ext/prop-eq/resources/depgraph.js @@ -0,0 +1,47 @@ +function makeEdgesInteractive(evt) { + let svg = evt.target; + let viewBox = svg.viewBox.baseVal; + let edges = document.getElementsByClassName('edge'); + + Array.from(edges).forEach((edge) => { + edge.addEventListener('click', clickEdge); + }); + + function clickEdge() { + let edge = this; + if (edge.classList.contains("edge-highlight")) { + edge.classList.remove("edge-highlight"); + edge.classList.remove("text-highlight-edges"); + } else { + edge.classList.add("edge-highlight"); + edge.classList.add("text-highlight-edges"); + animateEdge(edge); + } + } + + function animateEdge(edge) { + let path = edge.querySelector('path'); + let polygon = edge.querySelector('polygon'); + let width = viewBox.width; + let length = path.getTotalLength(); + let timeUnit = length / width; + // Clear any previous transition + path.style.transition = path.style.WebkitTransition = 'none'; + // Set up the starting positions + path.style.strokeDasharray = length + ' ' + length; + path.style.strokeDashoffset = length; + // Trigger a layout so styles are calculated & the browser + // picks up the starting position before animating + path.getBoundingClientRect(); + // Define the transition + path.style.transition = path.style.WebkitTransition = 'stroke-dashoffset ' + timeUnit + 's ease-in-out'; + path.style.strokeDashoffset = '0'; + + polygon.style.transition = polygon.style.WebkitTransition = 'none'; + polygon.style.opacity = '0'; + polygon.style.transition = polygon.style.WebkitTransition = 'fill-opacity ' + timeUnit/2 + 's ease-in-out ' + timeUnit + 's'; + setTimeout(() => { + polygon.style.opacity = '1'; + }, 1000 * timeUnit); + } +} diff --git a/ext/prop-eq/styling.css b/ext/prop-eq/styling.css new file mode 100644 index 00000000..e2c9f15a --- /dev/null +++ b/ext/prop-eq/styling.css @@ -0,0 +1,1360 @@ +.highlight table td { + padding:5px +} +.highlight table pre { + margin:0 +} +.highlight .cm { + color:#777772; + font-style:italic +} +.highlight .cp { + color:#797676; + font-weight:bold +} +.highlight .c1 { + color:#777772; + font-style:italic +} +.highlight .cs { + color:#797676; + font-weight:bold; + font-style:italic +} +.highlight .c, +.highlight .cd { + color:#777772; + font-style:italic +} +.highlight .err { + color:#a61717; + background-color:#e3d2d2 +} +.highlight .gd { + color:#000000; + background-color:#ffdddd +} +.highlight .ge { + color:#000000; + font-style:italic +} +.highlight .gr { + color:#aa0000 +} +.highlight .gh { + color:#797676 +} +.highlight .gi { + color:#000000; + background-color:#ddffdd +} +.highlight .go { + color:#888888 +} +.highlight .gp { + color:#555555 +} +.highlight .gs { + font-weight:bold +} +.highlight .gu { + color:#aaaaaa +} +.highlight .gt { + color:#aa0000 +} +.highlight .kc { + color:#000000; + font-weight:bold +} +.highlight .kd { + color:#000000; + font-weight:bold +} +.highlight .kn { + color:#000000; + font-weight:bold +} +.highlight .kp { + color:#000000; + font-weight:bold +} +.highlight .kr { + color:#000000; + font-weight:bold +} +.highlight .kt { + color:#445588; + font-weight:bold +} +.highlight .k, +.highlight .kv { + color:#000000; + font-weight:bold +} +.highlight .mf { + color:#009999 +} +.highlight .mh { + color:#009999 +} +.highlight .il { + color:#009999 +} +.highlight .mi { + color:#009999 +} +.highlight .mo { + color:#009999 +} +.highlight .m, +.highlight .mb, +.highlight .mx { + color:#009999 +} +.highlight .sb { + color:#d14 +} +.highlight .sc { + color:#d14 +} +.highlight .sd { + color:#d14 +} +.highlight .s2 { + color:#d14 +} +.highlight .se { + color:#d14 +} +.highlight .sh { + color:#d14 +} +.highlight .si { + color:#d14 +} +.highlight .sx { + color:#d14 +} +.highlight .sr { + color:#009926 +} +.highlight .s1 { + color:#d14 +} +.highlight .ss { + color:#990073 +} +.highlight .s { + color:#d14 +} +.highlight .na { + color:#008080 +} +.highlight .bp { + color:#797676 +} +.highlight .nb { + color:#0086B3 +} +.highlight .nc { + color:#445588; + font-weight:bold +} +.highlight .no { + color:#008080 +} +.highlight .nd { + color:#3c5d5d; + font-weight:bold +} +.highlight .ni { + color:#800080 +} +.highlight .ne { + color:#990000; + font-weight:bold +} +.highlight .nf { + color:#990000; + font-weight:bold +} +.highlight .nl { + color:#990000; + font-weight:bold +} +.highlight .nn { + color:#555555 +} +.highlight .nt { + color:#000080 +} +.highlight .vc { + color:#008080 +} +.highlight .vg { + color:#008080 +} +.highlight .vi { + color:#008080 +} +.highlight .nv { + color:#008080 +} +.highlight .ow { + color:#000000; + font-weight:bold +} +.highlight .o { + color:#000000; + font-weight:bold +} +.highlight .w { + color:#bbbbbb +} +.highlight { + background-color:#f8f8f8 +} +html, +body, +div, +span, +applet, +object, +iframe, +h1, +h2, +h3, +h4, +h5, +h6, +p, +blockquote, +pre, +a, +abbr, +acronym, +address, +big, +cite, +code, +del, +dfn, +em, +img, +ins, +kbd, +q, +s, +samp, +small, +strike, +strong, +sub, +sup, +tt, +var, +b, +u, +i, +center, +dl, +dt, +dd, +ol, +ul, +li, +fieldset, +form, +label, +legend, +table, +caption, +tbody, +tfoot, +thead, +tr, +th, +td, +article, +aside, +canvas, +details, +embed, +figure, +figcaption, +footer, +header, +hgroup, +menu, +nav, +output, +ruby, +section, +summary, +time, +mark, +audio, +video { + margin:0; + padding:0; + border:0; + font:inherit; + vertical-align:baseline +} +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +menu, +nav, +section { + display:block +} +ol, +ul { + list-style:none +} +table { + border-collapse:collapse; + border-spacing:0 +} +body { + box-sizing:border-box; + /* color:#373737; */ + background:#f2f2f2; + font-size:16px; + font-family:'Myriad Pro', Calibri, Helvetica, Arial, sans-serif; + line-height:1.5; + -webkit-font-smoothing:antialiased +} +h1, +h2, +h3, +h4, +h5, +h6 { + margin:10px 0; + font-weight:700; + color:#222222; + font-family:'Lucida Grande', 'Calibri', Helvetica, Arial, sans-serif; + letter-spacing:-1px +} +h1 { + font-size:36px; + font-weight:700 +} +h2 { + padding-bottom:10px; + font-size:32px; + background:url("images/bg_hr.png") repeat-x bottom +} +h3 { + font-size:24px +} +h4 { + font-size:21px +} +h5 { + font-size:18px +} +h6 { + font-size:16px +} +p { + margin:10px 0 15px 0 +} +footer p { + color:#f2f2f2 +} +a { + text-decoration:none; + color:#0F79D0; + text-shadow:none; + transition:color 0.5s ease; + transition:text-shadow 0.5s ease; + -webkit-transition:color 0.5s ease; + -webkit-transition:text-shadow 0.5s ease; + -moz-transition:color 0.5s ease; + -moz-transition:text-shadow 0.5s ease; + -o-transition:color 0.5s ease; + -o-transition:text-shadow 0.5s ease; + -ms-transition:color 0.5s ease; + -ms-transition:text-shadow 0.5s ease +} +a:hover, +a:focus { + text-decoration:underline +} +footer a { + color:#F2F2F2; + text-decoration:underline +} +em, +cite { + font-style:italic +} +strong { + font-weight:bold +} +img { + position:relative; + margin:0 auto; + max-width:739px; + padding:5px; + margin:10px 0 10px 0; + border:1px solid #ebebeb; + box-shadow:0 0 5px #ebebeb; + -webkit-box-shadow:0 0 5px #ebebeb; + -moz-box-shadow:0 0 5px #ebebeb; + -o-box-shadow:0 0 5px #ebebeb; + -ms-box-shadow:0 0 5px #ebebeb +} +p img { + display:inline; + margin:0; + padding:0; + vertical-align:middle; + text-align:center; + border:none +} +pre { + color:#222; +} +pre, +code { + background-color:#fff; + font-family:Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace; + font-size:14px; + border-radius:2px; + -moz-border-radius:2px; + -webkit-border-radius:2px +} +pre { + padding:10px; + box-shadow:0 0 10px rgba(0,0,0,0.1); + overflow:auto +} +code { + padding:3px; + margin:0 3px; + box-shadow:0 0 10px rgba(0,0,0,0.1) +} +pre code { + display:block; + box-shadow:none +} +blockquote { + color:#666; + margin-bottom:20px; + padding:0 0 0 20px; + border-left:3px solid #bbb +} +ul, +ol, +dl { + margin-bottom:15px +} +ul { + list-style-position:inside; + list-style:disc; + padding-left:20px +} +ol { + list-style-position:inside; + list-style:decimal; + padding-left:20px +} +dl dt { + font-weight:bold +} +dl dd { + padding-left:20px; + font-style:italic +} +dl p { + padding-left:20px; + font-style:italic +} +hr { + height:1px; + margin-bottom:5px; + border:none; + background:url("images/bg_hr.png") repeat-x center +} +table { + /* border:1px solid #373737; */ + margin-bottom:20px; + text-align:left +} +th { + font-family:'Lucida Grande', 'Helvetica Neue', Helvetica, Arial, sans-serif; + padding:10px; + background:#373737; + color:#fff +} +td { + padding:10px; + border:1px solid #373737 +} +form { + background:#f2f2f2; + padding:20px +} +.outer { + width:100% +} +.inner { + position:relative; + max-width:850px; + padding:20px 10px; + padding-top: 60px; + margin:0 auto +} +#forkme_banner { + display:block; + position:absolute; + top:0; + right:10px; + z-index:10; + padding:10px 50px 10px 10px; + color:#fff; + background:url("images/blacktocat.png") #0090ff no-repeat 95% 50%; + font-weight:700; + box-shadow:0 0 10px rgba(0,0,0,0.5); + border-bottom-left-radius:2px; + border-bottom-right-radius:2px +} +#header_wrap { + background:#212121; + background:-moz-linear-gradient(top, #373737, #212121); + background:-webkit-linear-gradient(top, #373737, #212121); + background:-ms-linear-gradient(top, #373737, #212121); + background:-o-linear-gradient(top, #373737, #212121); + background:linear-gradient(to top, #373737, #212121) +} +#header_wrap .inner { + padding:50px 10px 30px 10px +} +.project_title { + margin:0; + color:#fff; + font-size:42px; + font-weight:700; + text-shadow:#111 0px 0px 10px +} +#project_tagline { + color:#fff; + font-size:24px; + font-weight:300; + background:none; + text-shadow:#111 0px 0px 10px +} +#downloads { + position:absolute; + width:315px; + z-index:10; + bottom:-40px; + right:0; + height:70px; + background:url("images/icon_download.png") no-repeat 0% 90% +} +.zip_download_link { + display:block; + float:right; + width:90px; + height:70px; + text-indent:-5000px; + overflow:hidden; + background:url(images/sprite_download.png) no-repeat bottom left +} +.tar_download_link { + display:block; + float:right; + width:90px; + height:70px; + text-indent:-5000px; + overflow:hidden; + background:url(images/sprite_download.png) no-repeat bottom right; + margin-left:10px +} +.zip_download_link:hover { + background:url(images/sprite_download.png) no-repeat top left +} +.tar_download_link:hover { + background:url(images/sprite_download.png) no-repeat top right +} + +.vdi_download_link { + display:block; + float:right; + width:80px; + height:70px; + text-indent:-5000px; + overflow:hidden; + background-image:url(images/vdi_grey.png); + background-size:cover; + background-repeat:no-repeat; + background-position:center center; +} +.vdi_download_link:hover { + background-image:url(images/vdi_blue.png); +} + +#main_content_wrap { + background:#f2f2f2; + border-top:1px solid #111; + border-bottom:1px solid #111 +} +#main_content { + padding-top:40px +} +#footer_wrap { + background:#212121 +} +@media screen and (max-width: 992px) { + img { + max-width:100% + } +} +@media screen and (max-width: 480px) { + body { + font-size:14px + } + #downloads { + display:none + } + .inner { + min-width:320px; + max-width:480px + } + #project_title { + font-size:32px + } + h1 { + font-size:28px + } + h2 { + font-size:24px + } + h3 { + font-size:21px + } + h4 { + font-size:18px + } + h5 { + font-size:14px + } + h6 { + font-size:12px + } + code, + pre { + font-size:11px + } +} +@media screen and (max-width: 320px) { + body { + font-size:14px + } + #downloads { + display:none + } + .inner { + min-width:240px; + max-width:320px + } + #project_title { + font-size:28px + } + h1 { + font-size:24px + } + h2 { + font-size:21px + } + h3 { + font-size:18px + } + h4 { + font-size:16px + } + h5 { + font-size:14px + } + h6 { + font-size:12px + } + code, + pre { + min-width:240px; + max-width:320px; + font-size:11px + } +} + +@font-face { + font-family: octicons-link; + src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYFBLj5K3EIaSctAq2kTYiw+ymhce7vwM9jSqO8JyVd5RH9gyTt2+J/yUmYlIR0s04n6+7Vm1ozezUeLEaUjhaDSuXHwVRgvLJn1tQ7xiuVv/ocTRF42mNgZGBgYGbwZOBiAAFGJBIMAAizAFoAAABiAGIAznjaY2BkYGAA4in8zwXi+W2+MjCzMIDApSwvXzC97Z4Ig8N/BxYGZgcgl52BCSQKAA3jCV8CAABfAAAAAAQAAEB42mNgZGBg4f3vACQZQABIMjKgAmYAKEgBXgAAeNpjYGY6wTiBgZWBg2kmUxoDA4MPhGZMYzBi1AHygVLYQUCaawqDA4PChxhmh/8ODDEsvAwHgMKMIDnGL0x7gJQCAwMAJd4MFwAAAHjaY2BgYGaA4DAGRgYQkAHyGMF8NgYrIM3JIAGVYYDT+AEjAwuDFpBmA9KMDEwMCh9i/v8H8sH0/4dQc1iAmAkALaUKLgAAAHjaTY9LDsIgEIbtgqHUPpDi3gPoBVyRTmTddOmqTXThEXqrob2gQ1FjwpDvfwCBdmdXC5AVKFu3e5MfNFJ29KTQT48Ob9/lqYwOGZxeUelN2U2R6+cArgtCJpauW7UQBqnFkUsjAY/kOU1cP+DAgvxwn1chZDwUbd6CFimGXwzwF6tPbFIcjEl+vvmM/byA48e6tWrKArm4ZJlCbdsrxksL1AwWn/yBSJKpYbq8AXaaTb8AAHja28jAwOC00ZrBeQNDQOWO//sdBBgYGRiYWYAEELEwMTE4uzo5Zzo5b2BxdnFOcALxNjA6b2ByTswC8jYwg0VlNuoCTWAMqNzMzsoK1rEhNqByEyerg5PMJlYuVueETKcd/89uBpnpvIEVomeHLoMsAAe1Id4AAAAAAAB42oWQT07CQBTGv0JBhagk7HQzKxca2sJCE1hDt4QF+9JOS0nbaaYDCQfwCJ7Au3AHj+LO13FMmm6cl7785vven0kBjHCBhfpYuNa5Ph1c0e2Xu3jEvWG7UdPDLZ4N92nOm+EBXuAbHmIMSRMs+4aUEd4Nd3CHD8NdvOLTsA2GL8M9PODbcL+hD7C1xoaHeLJSEao0FEW14ckxC+TU8TxvsY6X0eLPmRhry2WVioLpkrbp84LLQPGI7c6sOiUzpWIWS5GzlSgUzzLBSikOPFTOXqly7rqx0Z1Q5BAIoZBSFihQYQOOBEdkCOgXTOHA07HAGjGWiIjaPZNW13/+lm6S9FT7rLHFJ6fQbkATOG1j2OFMucKJJsxIVfQORl+9Jyda6Sl1dUYhSCm1dyClfoeDve4qMYdLEbfqHf3O/AdDumsjAAB42mNgYoAAZQYjBmyAGYQZmdhL8zLdDEydARfoAqIAAAABAAMABwAKABMAB///AA8AAQAAAAAAAAAAAAAAAAABAAAAAA==) format('woff'); +} + +body { + -webkit-text-size-adjust: 100%; + text-size-adjust: 100%; + color: #333; + font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; + font-size: 16px; + line-height: 1.6; + word-wrap: break-word; + /* width: 800px; */ + max-width: 99%; + box-sizing: border-box; + padding: 30px 30px 8rem 30px; + margin-left: auto; + margin-right: auto; +} + +body a { + background-color: transparent; +} + +body a:active, +body a:hover { + outline: 0; +} + +body strong { + font-weight: bold; +} + +body h1 { + font-size: 2em; + margin: 0.67em 0; +} + +body img { + border: 0; +} + +body hr { + box-sizing: content-box; + height: 0; +} + +body pre { + overflow: auto; +} + +body code, +body kbd, +body pre { + font-family: monospace, monospace; + font-size: 1em; +} + +body input { + color: inherit; + font: inherit; + margin: 0; +} + +body html input[disabled] { + cursor: default; +} + +body input { + line-height: normal; +} + +body input[type="checkbox"] { + box-sizing: border-box; + padding: 0; +} + +body table { + border-collapse: collapse; + border-spacing: 0; +} + +body td, +body th { + padding: 0; +} + +body * { + box-sizing: border-box; +} + +body input { + font: 13px / 1.4 Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; +} + +body a { + color: #4078c0; + text-decoration: none; +} + +body a:hover, +body a:active { + text-decoration: underline; +} + +body hr { + height: 0; + margin: 15px 0; + overflow: hidden; + background: transparent; + border: 0; + border-bottom: 1px solid #ddd; +} + +body hr:before { + display: table; + content: ""; +} + +body hr:after { + display: table; + clear: both; + content: ""; +} + +body h1, +body h2, +body h3, +body h4, +body h5, +body h6 { + margin-top: 15px; + margin-bottom: 15px; + line-height: 1.1; +} + +body h1 { + font-size: 30px; +} + +body h2 { + font-size: 21px; +} + +body h3 { + font-size: 16px; +} + +body h4 { + font-size: 14px; +} + +body h5 { + font-size: 12px; +} + +body h6 { + font-size: 11px; +} + +body blockquote { + margin: 0; +} + +body ul, +body ol { + padding: 0; + margin-top: 0; + margin-bottom: 0; +} + +body ol ol, +body ul ol { + list-style-type: lower-roman; +} + +body ul ul ol, +body ul ol ol, +body ol ul ol, +body ol ol ol { + list-style-type: lower-alpha; +} + +body dd { + margin-left: 0; +} + +body code { + font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-size: 12px; +} + +body pre { + margin-top: 0; + margin-bottom: 0; + font: 12px Consolas, "Liberation Mono", Menlo, Courier, monospace; +} + +body .select::-ms-expand { + opacity: 0; +} + +body .octicon { + font: normal normal normal 16px/1 octicons-link; + display: inline-block; + text-decoration: none; + text-rendering: auto; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +body .octicon-link:before { + content: '\f05c'; +} + +body:before { + display: table; + content: ""; +} + +body:after { + display: table; + clear: both; + content: ""; +} + +body>*:first-child { + margin-top: 0 !important; +} + +body>*:last-child { + margin-bottom: 0 !important; +} + +body a:not([href]) { + color: inherit; + text-decoration: none; +} + +body .anchor { + display: inline-block; + padding-right: 2px; + margin-left: -18px; +} + +body .anchor:focus { + outline: none; +} + +body h1, +body h2, +body h3, +body h4, +body h5, +body h6 { + margin-top: 1em; + margin-bottom: 16px; + font-weight: bold; + line-height: 1.4; +} + +body h1 .octicon-link, +body h2 .octicon-link, +body h3 .octicon-link, +body h4 .octicon-link, +body h5 .octicon-link, +body h6 .octicon-link { + color: #000; + vertical-align: middle; + visibility: hidden; +} + +body h1:hover .anchor, +body h2:hover .anchor, +body h3:hover .anchor, +body h4:hover .anchor, +body h5:hover .anchor, +body h6:hover .anchor { + text-decoration: none; +} + +body h1:hover .anchor .octicon-link, +body h2:hover .anchor .octicon-link, +body h3:hover .anchor .octicon-link, +body h4:hover .anchor .octicon-link, +body h5:hover .anchor .octicon-link, +body h6:hover .anchor .octicon-link { + visibility: visible; +} + +body h1 { + padding-bottom: 0.3em; + font-size: 1.75em; + line-height: 1.2; +} + +body h1 .anchor { + line-height: 1; +} + +body h2 { + padding-bottom: 0.3em; + font-size: 1.5em; + line-height: 1.225; +} + +body h2 .anchor { + line-height: 1; +} + +body h3 { + font-size: 1.25em; + line-height: 1.43; +} + +body h3 .anchor { + line-height: 1.2; +} + +body h4 { + font-size: 1em; +} + +body h4 .anchor { + line-height: 1.2; +} + +body h5 { + font-size: 1em; +} + +body h5 .anchor { + line-height: 1.1; +} + +body h6 { + font-size: 1em; + color: #777; +} + +body h6 .anchor { + line-height: 1.1; +} + +body p, +body blockquote, +body ul, +body ol, +body dl, +body table, +body pre { + margin-top: 0; + margin-bottom: 16px; +} + +body hr { + height: 4px; + padding: 0; + margin: 16px 0; + background-color: #e7e7e7; + border: 0 none; +} + +body ul, +body ol { + padding-left: 2em; +} + +body ul ul, +body ul ol, +body ol ol, +body ol ul { + margin-top: 0; + margin-bottom: 0; +} + +body li>p { + margin-top: 16px; +} + +body dl { + padding: 0; +} + +body dl dt { + padding: 0; + margin-top: 16px; + font-size: 1em; + font-style: italic; + font-weight: bold; +} + +body dl dd { + padding: 0 16px; + margin-bottom: 16px; +} + +body blockquote { + padding: 0 15px; + color: #777; + border-left: 4px solid #ddd; +} + +body blockquote>:first-child { + margin-top: 0; +} + +body blockquote>:last-child { + margin-bottom: 0; +} + +body table { + display: block; + width: 100%; + overflow: auto; + word-break: normal; + word-break: keep-all; +} + +body table th { + font-weight: bold; +} + +body table th, +body table td { + padding: 6px 13px; + border: 1px solid #ddd; +} + +body table tr { + background-color: #fff; + border-top: 1px solid #ccc; +} + +body table tr:nth-child(2n) { + background-color: #f8f8f8; +} + +body img { + max-width: 100%; + box-sizing: content-box; + background-color: #fff; +} + +body code { + padding: 0; + padding-top: 0; + padding-bottom: 0; + margin: 0; + font-size: 85%; + background-color: rgba(0,0,0,0.04); + border-radius: 3px; +} + +body code:before, +body code:after { + letter-spacing: -0.2em; + content: "\00a0"; +} + +body pre>code { + padding: 0; + margin: 0; + font-size: 100%; + word-break: normal; + white-space: pre; + background: transparent; + border: 0; +} + +body .highlight { + margin-bottom: 16px; +} + +body .highlight pre, +body pre { + padding: 16px; + overflow: auto; + font-size: 85%; + line-height: 1.45; + background-color: #f7f7f7; + border-radius: 3px; +} + +body .highlight pre { + margin-bottom: 0; + word-break: normal; +} + +body pre { + word-wrap: normal; +} + +body pre code { + display: inline; + max-width: initial; + padding: 0; + margin: 0; + overflow: initial; + line-height: inherit; + word-wrap: normal; + background-color: transparent; + border: 0; +} + +body pre code:before, +body pre code:after { + content: normal; +} + +body kbd { + display: inline-block; + padding: 3px 5px; + font-size: 11px; + line-height: 10px; + color: #555; + vertical-align: middle; + background-color: #fcfcfc; + border: solid 1px #ccc; + border-bottom-color: #bbb; + border-radius: 3px; + box-shadow: inset 0 -1px 0 #bbb; +} + +body .pl-c { + color: #969896; +} + +body .pl-c1, +body .pl-s .pl-v { + color: #0086b3; +} + +body .pl-e, +body .pl-en { + color: #795da3; +} + +body .pl-s .pl-s1, +body .pl-smi { + color: #333; +} + +body .pl-ent { + color: #63a35c; +} + +body .pl-k { + color: #a71d5d; +} + +body .pl-pds, +body .pl-s, +body .pl-s .pl-pse .pl-s1, +body .pl-sr, +body .pl-sr .pl-cce, +body .pl-sr .pl-sra, +body .pl-sr .pl-sre { + color: #183691; +} + +body .pl-v { + color: #ed6a43; +} + +body .pl-id { + color: #b52a1d; +} + +body .pl-ii { + background-color: #b52a1d; + color: #f8f8f8; +} + +body .pl-sr .pl-cce { + color: #63a35c; + font-weight: bold; +} + +body .pl-ml { + color: #693a17; +} + +body .pl-mh, +body .pl-mh .pl-en, +body .pl-ms { + color: #1d3e81; + font-weight: bold; +} + +body .pl-mq { + color: #008080; +} + +body .pl-mi { + color: #333; + font-style: italic; +} + +body .pl-mb { + color: #333; + font-weight: bold; +} + +body .pl-md { + background-color: #ffecec; + color: #bd2c00; +} + +body .pl-mi1 { + background-color: #eaffea; + color: #55a532; +} + +body .pl-mdr { + color: #795da3; + font-weight: bold; +} + +body .pl-mo { + color: #1d3e81; +} + +body kbd { + display: inline-block; + padding: 3px 5px; + font: 11px Consolas, "Liberation Mono", Menlo, Courier, monospace; + line-height: 10px; + color: #555; + vertical-align: middle; + background-color: #fcfcfc; + border: solid 1px #ccc; + border-bottom-color: #bbb; + border-radius: 3px; + box-shadow: inset 0 -1px 0 #bbb; +} + +body .task-list-item { + list-style-type: none; +} + +body .task-list-item+.task-list-item { + margin-top: 3px; +} + +body .task-list-item input { + margin: 0 0.35em 0.25em -1.6em; + vertical-align: middle; +} + +body :checked+.radio-label { + z-index: 1; + position: relative; + border-color: #4078c0; +} diff --git a/ext/prop-eq/toc.html b/ext/prop-eq/toc.html new file mode 100644 index 00000000..c9950de8 --- /dev/null +++ b/ext/prop-eq/toc.html @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + +