fact
stringlengths 2
32.6k
| type
stringclasses 10
values | library
stringclasses 5
values | imports
stringclasses 205
values | filename
stringclasses 216
values | symbolic_name
stringlengths 1
67
| index_level
int64 0
10.5k
|
---|---|---|---|---|---|---|
Σ (a : context_decl) (Γ : list context_decl) (X : All_local_env (wf_decl_pred Σ) (a :: Γ)) : on_local_decl (wf_decl_pred Σ) Γ a * All_local_env (wf_decl_pred Σ) Γ. Proof. inv X; intuition; red; simpl; eauto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | All_local_env_wf_decl_inv | 10,300 |
forall Σ (mfix : mfixpoint term) (idx : nat) (narg : nat) (fn : term), unfold_fix mfix idx = Some (narg, fn) -> WfAst.wf Σ (tFix mfix idx) -> WfAst.wf Σ fn. Proof. intros Σ mfix idx narg fn Hf Hwf. unfold unfold_fix in Hf. inv Hwf. destruct nth_error eqn:eqnth; try congruence. pose proof (nth_error_all eqnth X) as [ _ wfd]. injection Hf. intros <- <-. apply wf_subst; auto. clear wfd Hf eqnth. assert(forall n, WfAst.wf Σ (tFix mfix n)). constructor; auto. unfold fix_subst. generalize #|mfix|; intros. induction n; auto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | unfold_fix_wf | 10,301 |
Σ: forall (mfix : mfixpoint term) (idx : nat) (narg : nat) (fn : term), unfold_cofix mfix idx = Some (narg, fn) -> WfAst.wf Σ (tCoFix mfix idx) -> WfAst.wf Σ fn. Proof. intros mfix idx narg fn Hf Hwf. unfold unfold_cofix in Hf. inv Hwf. destruct nth_error eqn:eqnth; try congruence. pose proof (nth_error_all eqnth X) as [_ wfd]. injection Hf. intros <- <-. apply wf_subst; auto. clear wfd Hf eqnth. assert(forall n, WfAst.wf Σ (tCoFix mfix n)). constructor; auto. unfold cofix_subst. generalize #|mfix|; intros. induction n; auto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | unfold_cofix_wf | 10,302 |
Σ Γ t u : red1 Σ Γ t u -> isLambda t -> isLambda u. Proof. induction 1 using red1_ind_all; simpl; try discriminate; auto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | red1_isLambda | 10,303 |
{A} {P Q} {l l' : list A} : OnOne2 P l l' -> (forall x y, P x y -> Q x -> Q y) -> All Q l -> All Q l'. Proof. intros Hl H. induction Hl; intros H'; inv H'; constructor; eauto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | OnOne2_All_All | 10,304 |
{A B} (P : B -> Type) (l : list A) (f : nat -> A -> B) : Alli (fun i x => P (f i x)) 0 l -> All P (mapi f l). Proof. unfold mapi. generalize 0. induction 1; constructor; auto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | All_mapi | 10,305 |
{A} (P : nat -> A -> Type) n (l : list A) : (forall n x, P n x) -> Alli P n l. Proof. intros H. induction l in n |- *; constructor; auto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | Alli_id | 10,306 |
{A} {P : A -> Type} {Q : nat -> A -> Type} {l n} : All P l -> (forall n x, P x -> Q n x) -> Alli Q n l. Proof. intro H. revert n. induction H; constructor; eauto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | All_Alli | 10,307 |
{cf} {univs retro} k (Σ : global_declarations) k' (Σ' : global_declarations) P : on_global_decls cumul_gen P univs retro ((k :: Σ) ++ [k'] ++ Σ') -> k.1 = k'.1 -> False. Proof. intros H eq. depelim H. destruct o as [f ? ? ?]. eapply Forall_app in f as [_ f]. depelim f. cbn in *. subst. contradiction. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | on_global_decls_extends_not_fresh | 10,308 |
{cf : checker_flags} (Σ : global_env) k d (Σ' : global_env) P : on_global_env cumul_gen P Σ' -> lookup_env Σ k = Some d -> extends Σ Σ' -> lookup_env Σ' k = Some d. Proof. intro H; eapply lookup_env_extends_NoDup, NoDup_on_global_decls, H. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | lookup_env_extends | 10,309 |
k decls : In k (map fst decls) -> #| lookup_globals decls k | >= 1. Proof. induction decls; cbn => //. case_eq (k == a.1). - intros e _. cbn. lia. - intros e []. + rewrite H in e. rewrite eqb_refl in e. inversion e. + now apply IHdecls. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | In_lookup_globals | 10,310 |
(Σ : global_env) (Σ' : global_env) : NoDup (map fst (declarations Σ')) -> extends Σ Σ' -> NoDup (map fst (declarations Σ)). Proof. intros Hl [_ Hex _]. destruct Σ, Σ'; cbn in *. clear - Hl Hex. induction declarations0; cbn in *; econstructor. - intros H. specialize (Hex a.1). destruct Hex as [decls Hdecls]. pose proof (NoDup_length_lookup_globals _ Hl a.1). rewrite eqb_refl in Hdecls. apply In_lookup_globals in H. rewrite Hdecls in H0. rewrite length_app in H0. cbn in H0. destruct lookup_global; lia. - eapply IHdeclarations0. intros. specialize (Hex c). destruct Hex as [decls Hdecls]. case_eq (c == a.1). + intros e. exists (decls ++ [a.2]). rewrite Hdecls e. now rewrite <- app_assoc. + intros e. exists decls. now rewrite Hdecls e. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | NoDup_extends | 10,311 |
{cf : checker_flags} (Σ : global_env) k d (Σ' : global_env) P : on_global_env cumul_gen P Σ' -> In (k, InductiveDecl d) (declarations Σ) -> extends Σ Σ' -> In (k,InductiveDecl d) (declarations Σ'). Proof. intros; apply lookup_global_Some_iff_In_NoDup. - destruct X; eapply NoDup_on_global_decls; eauto. - eapply lookup_env_extends; eauto. destruct X; eapply lookup_global_Some_iff_In_NoDup; eauto. eapply NoDup_extends; eauto. now eapply NoDup_on_global_decls. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | declared_env_extends | 10,312 |
{cf} {Σ : global_env} T {Σ' : global_env} P : on_global_env cumul_gen P Σ' -> WfAst.wf Σ T -> extends Σ Σ' -> WfAst.wf Σ' T. Proof. intros wfΣ'. induction 1 using term_wf_forall_list_ind; try solve [econstructor; eauto; solve_all]. - intros. destruct H. destruct X0. unfold declared_minductive in H. eapply declared_env_extends in H; tea. econstructor; repeat split; eauto; solve_all. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_extends | 10,313 |
{cf} {Σ : global_env} T {Σ' : global_env} P : on_global_env cumul_gen P Σ' -> wf_decl Σ T -> extends Σ Σ' -> wf_decl Σ' T. Proof. intros wf [] ext. red. destruct decl_body; split; cbn in *; eauto using wf_extends. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_decl_extends | 10,314 |
{cf:checker_flags} {Σ : global_env} ind (mdecl : mutual_inductive_body) (idecl : one_inductive_body) : on_global_env cumul_gen wf_decl_pred Σ -> declared_inductive Σ ind mdecl idecl -> WfAst.wf Σ (ind_type idecl). Proof. intros. destruct H as [Hmdecl Hidecl]. red in Hmdecl. eapply lookup_global_Some_iff_In_NoDup in Hmdecl; eauto. 2: destruct X; now eapply NoDup_on_global_decls. destruct (lookup_on_global_env X Hmdecl) as [Σ' [wfΣ' [ext prf]]]; eauto. apply onInductives in prf. eapply nth_error_alli in Hidecl; eauto. eapply onArity in Hidecl. destruct Hidecl. eapply wf_extends in w; tea; typeclasses eauto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | declared_inductive_wf | 10,315 |
Σ Γ t : WfAst.wf Σ (it_mkProd_or_LetIn Γ t) -> All (wf_decl Σ) Γ * WfAst.wf Σ t. Proof. revert t. induction Γ; [simpl; auto with wf|]. intros t XX. destruct a, decl_body; simpl in *. apply IHΓ in XX as []. depelim w; simpl in *; split; auto with wf. apply IHΓ in XX as []. depelim w. simpl in *. split; auto. constructor; auto with wf. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_it_mkProd_or_LetIn | 10,316 |
{cf:checker_flags} {Σ : global_env} {ind mdecl idecl} : on_global_env cumul_gen wf_decl_pred Σ -> declared_inductive Σ ind mdecl idecl -> All (wf_decl Σ) (ind_indices idecl). Proof. intros. destruct H as [Hmdecl Hidecl]. red in Hmdecl. eapply lookup_global_Some_iff_In_NoDup in Hmdecl; eauto. 2: destruct X; now eapply NoDup_on_global_decls. destruct (lookup_on_global_env X Hmdecl) as [Σ' [wfΣ' [ext prf]]]; eauto. apply onInductives in prf. eapply nth_error_alli in Hidecl; eauto. pose proof (onArity Hidecl). rewrite Hidecl.(ind_arity_eq) in X0. destruct X0 as [_ Hs]; cbn in Hs; wf. eapply wf_it_mkProd_or_LetIn in Hs as [? H]. eapply wf_it_mkProd_or_LetIn in H as []. solve_all. eapply wf_decl_extends; tea; typeclasses eauto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | declared_inductive_wf_indices | 10,317 |
{cf:checker_flags} {Σ} {mdecl} {u: list sort} {args} : sorts_local_ctx (fun Σ : global_env_ext => wf_decl_pred Σ) Σ (arities_context (ind_bodies mdecl),,, ind_params mdecl) args u -> All (wf_decl Σ) args. Proof. induction args as [|[na [b|] ty] args] in u |- * ; constructor. - constructor; now destruct X as (?&?&?). - eapply IHargs; now apply X. - destruct u => //; constructor; cbnr; now destruct X as (?&?&?). - destruct u => //; eapply IHargs; now apply X. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | sorts_local_ctx_All_wf_decl | 10,318 |
{cf:checker_flags} {Σ} {ind} {mdecl idecl} : on_global_env cumul_gen wf_decl_pred Σ -> declared_inductive Σ ind mdecl idecl -> All (fun ctor => All (wf_decl Σ) ctor.(cstr_args)) (ind_ctors idecl). Proof. intros. destruct H as [Hmdecl Hidecl]. red in Hmdecl. eapply lookup_global_Some_iff_In_NoDup in Hmdecl; eauto. 2: destruct X; now eapply NoDup_on_global_decls. destruct (lookup_on_global_env X Hmdecl) as [Σ' [wfΣ' [ext prf]]]; eauto. apply onInductives in prf. eapply nth_error_alli in Hidecl; eauto. pose proof (onConstructors Hidecl). red in X0. solve_all. apply on_cargs in X0. eapply sorts_local_ctx_All_wf_decl in X0. solve_all. eapply wf_decl_extends; tea; typeclasses eauto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | declared_inductive_wf_ctors | 10,319 |
Σ ctx : TemplateEnvTyping.All_local_env (wf_decl_pred Σ) ctx -> All (wf_decl Σ) ctx. Proof. induction 1; constructor; auto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | All_local_env_wf_decls | 10,320 |
{cf:checker_flags} {Σ : global_env_ext} {kn mdecl} : on_global_decl cumul_gen (fun Σ : global_env_ext => wf_decl_pred Σ) Σ kn (InductiveDecl mdecl) -> All (wf_decl Σ) (ind_params mdecl). Proof. intros prf. apply onParams in prf. red in prf. now apply All_local_env_wf_decls in prf. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | on_global_inductive_wf_params | 10,321 |
ctx T : match destArity ctx T with | Some (ctx', s) => it_mkProd_or_LetIn ctx T = it_mkProd_or_LetIn ctx' (tSort s) | None => True end. Proof. induction T in ctx |- *; simpl; try easy. - specialize (IHT2 (ctx,, vass na T1)). now destruct destArity. - specialize (IHT3 (ctx,, vdef na T1 T2)). now destruct destArity. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | destArity_spec | 10,322 |
ctx ctx' t : destArity ctx (it_mkProd_or_LetIn ctx' t) = destArity (ctx ,,, ctx') t. Proof. induction ctx' in ctx, t |- *; simpl; auto. rewrite IHctx'. destruct a as [na [b|] ty]; reflexivity. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | destArity_it_mkProd_or_LetIn | 10,323 |
ctx s ctx' s' : it_mkProd_or_LetIn ctx (tSort s) = it_mkProd_or_LetIn ctx' (tSort s') -> ctx = ctx' /\ s = s'. Proof. move/(f_equal (destArity [])). rewrite !destArity_it_mkProd_or_LetIn /=. now rewrite !app_context_nil_l => [= -> ->]. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | it_mkProd_or_LetIn_inj | 10,324 |
ind mdecl idecl params uinst pctx : build_case_predicate_context ind mdecl idecl params uinst = Some pctx <~> case_predicate_context ind mdecl idecl params uinst pctx. Proof. unfold build_case_predicate_context. unfold instantiate_params. destruct instantiate_params_subst as [[ictx p]|] eqn:ipars => /= //. 2:{ split => //. intros H. depelim H. eapply instantiate_params_substP in i. rewrite ipars in i. discriminate. } move: (destArity_spec [] (subst0 ictx p)). destruct destArity as [[idctx inds]|] eqn:da => //. simpl. intros eqs. split. eapply instantiate_params_substP in ipars. intros [= <-]. econstructor. eauto. eauto. intros H. depelim H. subst sty. eapply instantiate_params_substP in i. rewrite ipars in i. noconf i. rewrite eqs in e. eapply it_mkProd_or_LetIn_inj in e as [<- <-]. reflexivity. split => // [] [] s ty ictxt inds. move/instantiate_params_substP. rewrite ipars /= => [=] <- <- H. rewrite H destArity_it_mkProd_or_LetIn in da. noconf da. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | case_predicate_contextP | 10,325 |
Σ s k Γ : All (wf_decl Σ) Γ -> All (WfAst.wf Σ) s -> All (wf_decl Σ) (subst_context s k Γ). Proof. intros wfΓ. induction wfΓ in s |- *. - intros. constructor. - rewrite subst_context_snoc. constructor; auto. destruct p. destruct x as [? [] ?]; constructor; simpl in *; wf. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_subst_context | 10,326 |
Σ Γ Δ : All (wf_decl Σ) Γ -> All (wf_decl Σ) Δ -> All (wf_decl Σ) (smash_context Δ Γ). Proof. intros wfΓ; induction wfΓ in Δ |- *; intros wfΔ; simpl; auto. destruct x as [? [] ?]; simpl. apply IHwfΓ. eapply wf_subst_context; auto. constructor; auto. apply p. eapply IHwfΓ. apply All_app_inv; auto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_smash_context | 10,327 |
n acc Γ : All (WfAst.wf Σ) acc -> All (WfAst.wf Σ) (reln acc n Γ). Proof using Type. induction Γ in acc, n |- * => wfacc /= //. destruct a as [? [|] ?] => //. now eapply IHΓ. eapply IHΓ. constructor; auto. constructor. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_reln | 10,328 |
l l' : All (wf_decl Σ) l' -> All (wf_decl Σ) (map2 set_binder_name l l'). Proof using Type. induction 1 in l |- *; destruct l; simpl; constructor. apply p. apply IHX. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_map2_set_binder_name | 10,329 |
n k Γ d : lift_context n k (d :: Γ) = lift_context n k Γ ,, lift_decl n (#|Γ| + k) d. Proof using Type. unfold lift_context. now rewrite fold_context_k_snoc0. Qed. | Definition | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | lift_context_snoc0 | 10,330 |
n k Γ d : lift_context n k (Γ ,, d) = lift_context n k Γ ,, lift_decl n (#|Γ| + k) d. Proof using Type. unfold snoc. apply lift_context_snoc0. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | lift_context_snoc | 10,331 |
n k Γ : All (wf_decl Σ) Γ -> All (wf_decl Σ) (lift_context n k Γ). Proof using Type. intros wfΓ. induction wfΓ in n, k |- *. - intros. constructor. - rewrite lift_context_snoc0. constructor; auto. destruct p. destruct x as [? [] ?]; constructor; simpl in *; wf. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_lift_context | 10,332 |
u Γ : All (wf_decl Σ) Γ -> All (wf_decl Σ) (subst_instance u Γ). Proof using Type. induction 1; constructor; auto. destruct x as [na [b|] ty]; simpl in *. destruct p. now split; apply wf_subst_instance. destruct p. now split; auto; apply wf_subst_instance. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_subst_instance_context | 10,333 |
Γ n : All (wf_decl Σ) Γ -> All (WfAst.wf Σ) (extended_subst Γ n). Proof using Type. induction 1 in n |- *. - simpl; constructor. - destruct x as [na [b|] ty]; simpl; constructor; auto. 2:constructor. eapply wf_subst; auto. eapply wf_lift. apply p. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_extended_subst | 10,334 |
ind mdecl idecl p : declared_inductive Σ ind mdecl idecl -> All (wf_decl Σ) mdecl.(ind_params) -> All (wf_decl Σ) (ind_indices idecl) -> All (WfAst.wf Σ) p.(pparams) -> All (wf_decl Σ) (case_predicate_context ind mdecl idecl p). Proof using Type. intros decl wfparams wfindty wfpars. unfold case_predicate_context. destruct p. apply wf_map2_set_binder_name. unfold pre_case_predicate_context_gen. cbn [Ast.pparams Ast.puinst]. unfold inst_case_context. eapply wf_subst_context => //. 2:now eapply All_rev. apply wf_subst_instance_context. rewrite /ind_predicate_context. constructor. split; try constructor. simpl. eapply wf_mkApps. now econstructor. apply wf_reln. constructor. eapply wf_subst_context. now apply wf_lift_context. now apply wf_extended_subst. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_case_predicate_context | 10,335 |
Σ' Γ j : lift_typing (fun Σ _ t T => WfAst.wf Σ t * WfAst.wf Σ T) Σ' Γ j -> wf_decl_pred Σ' Γ j. Proof. intros (Xtm & s & (Xty & _) & _). split; tas. destruct j_term => //. now destruct Xtm. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | lift_typing_wf_pred | 10,336 |
P Γ j : lift_typing_conj P (fun _ t T => WfAst.wf Σ t * WfAst.wf Σ T) Γ j -> wf_decl_pred Σ Γ j. Proof. intro H. eapply lift_typing_wf_pred. apply lift_typing_impl with (1 := H). move => ??[]//. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | lift_typing2_wf_pred | 10,337 |
Forall_decls_typing (fun (Σ : global_env_ext) (_ : context) (t T : term) => WfAst.wf Σ t * WfAst.wf Σ T) Σ -> on_global_env cumul_gen wf_decl_pred Σ. Proof using Type. apply on_global_env_impl; intros ??? _. apply lift_typing_wf_pred. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | Forall_decls_on_global_wf | 10,338 |
mind u mdecl : All (WfAst.wf Σ) (inds mind u mdecl.(ind_bodies)). Proof using Type. unfold inds. induction #|ind_bodies mdecl|; constructor; auto. now constructor. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_inds | 10,339 |
{Σ' : global_env_ext} {kn mdecl} : forall (oib : on_inductive cumul_gen wf_decl_pred Σ' kn mdecl), All (wf_decl Σ') (ind_params mdecl). Proof using Type. intros oib. apply onParams in oib. red in oib. induction (ind_params mdecl) as [|[? [] ?] ?]; simpl in oib; inv oib; constructor; try red in X0; try red in X1; try red; simpl; intuition auto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | on_inductive_wf_params | 10,340 |
{ind mdecl idecl} : on_global_env cumul_gen wf_decl_pred Σ -> declared_inductive Σ ind mdecl idecl -> All (wf_decl Σ) (ind_params mdecl). Proof using Type. intros. destruct H as [Hmdecl Hidecl]. red in Hmdecl. eapply lookup_global_Some_iff_In_NoDup in Hmdecl; eauto. 2: destruct X; now eapply NoDup_on_global_decls. destruct (lookup_on_global_env X Hmdecl) as [Σ' [wfΣ' [ext prf]]]; eauto. eapply on_global_inductive_wf_params in prf. solve_all. eapply wf_decl_extends; tea; typeclasses eauto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | declared_inductive_wf_params | 10,341 |
(ind : inductive) (i : nat) (u : list Level.t) (mdecl : mutual_inductive_body) (idecl : one_inductive_body) (cdecl : constructor_body) : on_global_env cumul_gen wf_decl_pred Σ -> declared_constructor Σ (ind, i) mdecl idecl cdecl -> WfAst.wf Σ (cstr_type cdecl). Proof using Type. intros X isdecl. destruct isdecl as [[Hmdecl Hidecl] Hcdecl]. red in Hmdecl. eapply lookup_global_Some_iff_In_NoDup in Hmdecl; eauto. 2: destruct X; now eapply NoDup_on_global_decls. destruct (lookup_on_global_env X Hmdecl) as [Σ' [wfΣ' [ext prf]]]; eauto. red in prf. apply onInductives in prf. eapply nth_error_alli in Hidecl; eauto. simpl in *. pose proof (onConstructors Hidecl) as h. unfold on_constructors in h. eapply All2_nth_error_Some in Hcdecl. 2: eassumption. destruct Hcdecl as [cs [Hnth [? ? [? ?]]]]. eapply wf_extends; tea; typeclasses eauto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | declared_constructor_wf | 10,342 |
{ind mdecl idecl cdecl p br} : on_global_env cumul_gen wf_decl_pred Σ -> declared_constructor Σ ind mdecl idecl cdecl -> All (WfAst.wf Σ) (pparams p) -> All (fun ctor => All (wf_decl Σ) (cstr_args ctor)) (ind_ctors idecl) -> All (wf_decl Σ) (case_branch_context (fst ind) mdecl cdecl p br). Proof using Type. intros ong decli wfpars. intros Hforall. destruct decli as [decli hcstr]. eapply nth_error_all in Hforall; tea. cbn in Hforall. unfold case_branch_context, case_branch_context_gen. eapply wf_map2_set_binder_name. apply wf_subst_context; auto. apply wf_subst_instance_context. rewrite /cstr_branch_context. unfold expand_lets_ctx, expand_lets_k_ctx. eapply wf_subst_context. eapply wf_lift_context. eapply wf_subst_context => //. eapply wf_inds. apply wf_extended_subst. eapply declared_inductive_wf_params in decli => //. now eapply All_rev. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_case_branch_context_gen | 10,343 |
ind mdecl idecl p brs : on_global_env cumul_gen wf_decl_pred Σ -> declared_inductive Σ ind mdecl idecl -> All (WfAst.wf Σ) (pparams p) -> All (fun ctor => All (wf_decl Σ) (cstr_args ctor)) (ind_ctors idecl) -> All (fun ctx => All (wf_decl Σ) ctx) (case_branches_contexts ind mdecl idecl p brs). Proof using Type. intros ong decli wfpars. unfold case_branches_contexts. intros Hforall. induction Hforall in brs |- *; destruct brs; cbn; constructor; auto. unfold case_branch_context_gen. eapply wf_map2_set_binder_name. apply wf_subst_context; auto. apply wf_subst_instance_context. 2:now eapply All_rev. rewrite /cstr_branch_context. unfold expand_lets_ctx, expand_lets_k_ctx. eapply wf_subst_context. eapply wf_lift_context. eapply wf_subst_context => //. eapply wf_inds. apply wf_extended_subst. now eapply declared_inductive_wf_params in decli. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_case_branches_context | 10,344 |
Σ idecl := { wf_ind_type : WfAst.wf Σ (ind_type idecl); wf_ind_indices : All (WfAst.wf_decl Σ) (ind_indices idecl); wf_ind_ctors : All (fun cdecl => WfAst.wf Σ (cstr_type cdecl)) (ind_ctors idecl); wf_ind_ctor_args : All (fun cs => All (wf_decl Σ) (cstr_args cs)) idecl.(ind_ctors); wf_ind_ctors_indices : All (fun cdecl => All (WfAst.wf Σ) (cstr_indices cdecl)) (ind_ctors idecl); wf_ind_projs : All (fun pdecl => WfAst.wf Σ pdecl.(proj_type)) (ind_projs idecl) }. | Record | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_inductive_body | 10,345 |
ind npars p : All (WfAst.wf Σ) (projs ind npars p). Proof using Type. unfold projs. induction p; constructor; wf. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_projs | 10,346 |
{kn mdecl} : on_global_decl cumul_gen wf_decl_pred Σ kn (InductiveDecl mdecl) -> All (wf_inductive_body Σ) mdecl.(ind_bodies). Proof using Type. cbn. intros oni. have wfpars : All (wf_decl Σ) (ind_params mdecl). { now eapply on_inductive_wf_params in oni. } eapply onInductives in oni. solve_all. induction oni; constructor; auto. clear oni IHoni. destruct p. have wfargs : All (fun cs => All (wf_decl Σ) (cstr_args cs)) hd.(ind_ctors). { unfold on_constructors in onConstructors. clear -onConstructors. induction onConstructors; constructor; auto. apply on_cargs in r. eapply sorts_local_ctx_All_wf_decl; tea. } split => //. - now destruct onArity. - rewrite ind_arity_eq in onArity . destruct onArity as [_ ona]. eapply wf_it_mkProd_or_LetIn in ona as [_ ona]. now eapply wf_it_mkProd_or_LetIn in ona as []. - unfold on_constructors in onConstructors. clear -onConstructors. induction onConstructors; constructor; auto. destruct r. eapply on_ctype. - unfold on_constructors in onConstructors. clear -onConstructors. induction onConstructors; constructor; auto. destruct r. rewrite cstr_eq in on_ctype. destruct on_ctype as [_ wf]. eapply wf_it_mkProd_or_LetIn in wf as [_ wf]. eapply wf_it_mkProd_or_LetIn in wf as [_ wf]. rewrite /cstr_concl in wf. eapply wf_mkApps_inv in wf. now apply All_app in wf as []. - rename onProjections into on_projs. destruct (ind_projs hd) eqn:eqprojs. constructor. destruct (ind_ctors hd) as [|? [|]] eqn:Heq; try contradiction. destruct on_projs. rewrite eqprojs in on_projs. solve_all. eapply Alli_All; tea. intros. red in H. destruct (nth_error (smash_context _ _) _) eqn:Heq'; try contradiction. simpl in Heq. inv wfargs. clear X0. destruct H as [onna ->]. eapply wf_subst. eapply wf_inds. eapply wf_subst. eapply wf_projs. eapply wf_lift. eapply All_app_inv in wfpars; [|eapply X]. eapply (wf_smash_context _ _ []) in wfpars. 2:constructor. eapply nth_error_all in Heq'; eauto. apply Heq'. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | on_global_inductive_wf_bodies | 10,347 |
(A B C : Type) (P : B -> A -> A -> Type) (Q : C -> A -> Type) (i : list B) (j : list C) (R : B -> Type) (l l' : list A) : OnOne2All P i l l' -> All2 Q j l -> All R i -> (forall x y a b, R x -> P x a b -> Q y a -> Q y b) -> All2 Q j l'. Proof. induction 1 in j |- *; intros. depelim X. depelim X0. constructor; eauto. depelim X0. depelim X1. constructor; auto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | OnOne2All_All2_All2 | 10,348 |
Γ M N : on_global_env cumul_gen wf_decl_pred Σ -> All (wf_decl Σ) Γ -> WfAst.wf Σ M -> red1 Σ Γ M N -> WfAst.wf Σ N. Proof using Type. intros wfΣ wfΓ wfM H. induction H using red1_ind_all in wfM, wfΓ |- *. all: inv wfM. all: try solve[ constructor; intuition auto with wf ]. all:auto. - inv X. inv X0. eauto with wf. - auto with wf. - apply wf_lift. unfold option_map in H. destruct nth_error eqn:Heq; try discriminate. eapply nth_error_all in wfΓ; eauto. unfold wf_decl in *. apply some_inj in H; rewrite H in wfΓ; apply wfΓ. - unfold iota_red. eapply wf_mkApps_inv in X2. apply wf_subst. eapply All_rev. now eapply All_skipn. rewrite /expand_lets /expand_lets_k. apply wf_subst. apply wf_extended_subst. rewrite /bctx. eapply (wf_case_branch_context_gen (ind := (ci_ind ci, c))); tea. eapply declared_inductive_wf_ctors; tea. apply H0. eapply wf_lift. solve_all. now eapply All2_nth_error_Some_r in X3 as [cb [? []]]; tea. - eapply unfold_fix_wf in H; eauto. eapply wf_mkApps; auto. - econstructor; eauto. apply wf_mkApps_napp in X2 as [Hcof Hargs]; auto. eapply unfold_cofix_wf in H; eauto. apply wf_mkApps; intuition auto. - constructor; auto. apply wf_mkApps_napp in X as [Hcof Hargs]; auto. eapply unfold_cofix_wf in H; eauto. apply wf_mkApps; intuition auto. - apply wf_subst_instance. unfold declared_constant in H. eapply lookup_global_Some_iff_In_NoDup in H; eauto. 2: destruct wfΣ; now eapply NoDup_on_global_decls. eapply lookup_on_global_env in H as [Σ' [onΣ' [ext prf]]]; eauto. destruct decl; simpl in *. subst cst_body0; simpl in *; unfold on_constant_decl in prf; cbn in prf; destruct prf as [prfbod prftyp]. unfold j_term in prfbod. intuition eauto using wf_extends with typeclass_instances. - apply wf_mkApps_inv in X. eapply nth_error_all in X; eauto. - simpl in *. econstructor; eauto. cbn. now rewrite -(OnOne2_length X). cbn. clear H1. induction X; constructor; inv X1; intuition auto. - econstructor; eauto; simpl in *. apply IHred1; eauto. apply All_app_inv => //. apply wf_case_predicate_context; auto. eapply declared_inductive_wf_params in isdecl; eauto. eapply declared_inductive_wf_indices; eauto; wf. - econstructor; eauto. - econstructor; eauto. assert (wf := wf_case_branches_context _ _ _ _ brs wfΣ isdecl X1). forward wf. eapply declared_inductive_wf_ctors; eauto; wf. solve_all. eapply OnOne2All_All2_All2; tea. cbn. intuition auto. now rewrite b0 in a1. apply b2 => //. apply All_app_inv => //. - now eapply wf_mkApps. - constructor; auto. induction X; auto; congruence. clear H X0 H0. induction X; inv X1; constructor; intuition auto; try congruence. - constructor. induction X; inv X0; constructor; intuition auto. - constructor; auto. induction X; inv X0; constructor; intuition auto; congruence. - constructor; auto. solve_all. pose proof X0 as H'. revert X0. apply (OnOne2_All_All X). clear X. intros [na bo ty ra] [nb bb tb rb] [[r ih] e] [? ?]. simpl in *. inversion e. subst. clear e. intuition eauto. eapply ih. 2: assumption. solve_all. apply All_app_inv. 2: assumption. unfold fix_context. apply All_rev. eapply All_mapi. eapply All_Alli. 1: exact H'. cbn. unfold wf_decl. simpl. intros ? [? ? ? ?] ?. simpl in *. intuition eauto with wf. - constructor; auto. induction X; inv X0; constructor; intuition auto; congruence. - constructor; auto. solve_all. pose proof X0 as H'. revert X0. apply (OnOne2_All_All X). clear X. intros [na bo ty ra] [nb bb tb rb] [[r ih] e] [? ?]. simpl in *. inversion e. subst. clear e. intuition eauto. eapply ih. 2: assumption. solve_all. apply All_app_inv. 2: assumption. unfold fix_context. apply All_rev. eapply All_mapi. eapply All_Alli. 1: exact H'. cbn. unfold wf_decl. simpl. intros ? [? ? ? ?] ?. simpl in *. intuition eauto with wf. - constructor; eauto. eapply (OnOne2_All_All X); tea; intuition eauto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_red1 | 10,349 |
n k t : WfAst.wf Σ (lift n k t) -> WfAst.wf Σ t. Proof using Type. induction t in n, k |- * using term_forall_list_rect; simpl in *; intros Hwf; inv Hwf; try constructor; eauto; repeat (unfold snd, on_snd in *; simpl in *; solve_all). - destruct t; try reflexivity. discriminate. - destruct l; simpl in *; congruence. - eapply All2_map_right_inv in X5. econstructor; eauto; solve_all. now rewrite length_map in H1. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_lift_wf | 10,350 |
(p : projection) (mdecl : mutual_inductive_body) (idecl : one_inductive_body) cdecl pdecl : declared_projection Σ p mdecl idecl cdecl pdecl -> on_global_env cumul_gen wf_decl_pred Σ -> WfAst.wf Σ pdecl.(proj_type). Proof using Type. intros isdecl X. destruct isdecl as [[[Hmdecl Hidecl] Hcdecl] Hpdecl]. eapply lookup_global_Some_iff_In_NoDup in Hmdecl; eauto. 2: destruct X; now eapply NoDup_on_global_decls. destruct (lookup_on_global_env X Hmdecl) as [Σ' [wfΣ' [ext prf]]]; eauto. assert (wfpars := on_inductive_wf_params prf). eapply on_global_inductive_wf_bodies in prf => //. eapply nth_error_all in Hidecl; eauto. intuition auto. destruct Hidecl. eapply nth_error_all in wf_ind_projs0; eauto. intuition auto. eauto using wf_extends with typeclass_instances. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | declared_projection_wf | 10,351 |
cst decl : on_global_env cumul_gen wf_decl_pred Σ -> declared_constant Σ cst decl -> option_default (WfAst.wf Σ) (cst_body decl) unit * WfAst.wf Σ (cst_type decl). Proof using Type. intros wΣ h. unfold declared_constant in h. eapply lookup_global_Some_iff_In_NoDup in h; eauto. 2: destruct wΣ; now eapply NoDup_on_global_decls. destruct (lookup_on_global_env wΣ h) as [Σ' [wΣ' [ext h']]]. simpl in h'. destruct h'. split. 1: destruct cst_body => //=; cbn in o. all: intuition eauto using wf_extends with typeclass_instances. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | declared_constant_wf | 10,352 |
(Σ' : global_env_ext) Γ (wfΓ : wf_local Σ' Γ) : All_local_env_over (typing Σ') (fun (Γ : context) (_ : wf_local Σ' Γ) (t T : term) (_ : Σ';;; Γ |- t : T) => WfAst.wf Σ' t * WfAst.wf Σ' T) Γ wfΓ -> forall t, WfAst.wf Σ' t -> WfAst.wf Σ' (it_mkProd_or_LetIn Γ t). Proof using Type. induction 1; simpl. - trivial. - intros t0 Ht0. apply IHX. constructor. apply Hs. assumption. - intros t0 Ht0. apply IHX. constructor. apply Hc. apply Hc. assumption. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_it_mkProd_or_LetIn_inv | 10,353 |
{d t} : wf_decl Σ d -> WfAst.wf Σ t -> WfAst.wf Σ (mkLambda_or_LetIn d t). Proof using Type. destruct d as [? [|] ?]; simpl; wf; unfold wf_decl, mkLambda_or_LetIn in *; simpl in *. constructor; intuition auto. constructor; intuition auto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_Lambda_or_LetIn | 10,354 |
{Γ t} : All (wf_decl Σ) Γ -> WfAst.wf Σ t -> WfAst.wf Σ (it_mkLambda_or_LetIn Γ t). Proof using Type. intros wfΓ wft; induction wfΓ in t, wft |- *; simpl. - trivial. - apply IHwfΓ. now apply wf_Lambda_or_LetIn. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | wf_it_mkLambda_or_LetIn | 10,355 |
{A B} {P : nat -> A -> B -> Type} {Q : A -> B -> Type} n l l' : All2i P n l l' -> (forall i x y, P i x y -> Q x y) -> All2 Q l l'. Proof. induction 1; constructor; eauto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | All2i_All2 | 10,356 |
ind mdecl cdecl : #|cstr_branch_context ind mdecl cdecl| = #|cdecl.(cstr_args)|. Proof. rewrite /cstr_branch_context. now len. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | cstr_branch_context_length | 10,357 |
env_prop (fun Σ Γ t T => WfAst.wf Σ t * WfAst.wf Σ T) (fun Σ Γ j => wf_decl_pred Σ Γ j) (fun Σ Γ wfΓ => All (wf_decl Σ) Γ). Proof using Type. apply typing_ind_env; intros; auto with wf; specialize_goal; unfold wf_decl_pred in *; try solve [split; try constructor; intuition auto with wf]. - now eapply lift_typing2_wf_pred. - apply All_local_env_over_2 in X. eapply All_local_env_wf_decls. eapply All_local_env_impl with (1 := X) => Γ' j. apply lift_typing2_wf_pred. - split; wf. apply wf_lift. apply (nth_error_all H X). - split. constructor; auto. wf. clear -X1. induction X1; constructor; now auto. destruct X0 as [_ X0]. clear X H H0. induction X1; auto. apply IHX1. apply wf_subst. now destruct p0. destruct p. now inv w. - split. wf. apply wf_subst_instance. apply declared_constant_wf in H; tas. apply H. - split. wf. apply wf_subst_instance. eapply declared_inductive_wf; eauto. - split. wf. unfold type_of_constructor. apply wf_subst; auto with wf. apply wf_inds. apply wf_subst_instance. eapply declared_constructor_wf; eauto. - destruct X3 as [wfret wps]. destruct X6 as [wfc wfapps]. eapply wf_mkApps_inv in wfapps. eapply All_app in wfapps as [wfp wfindices]. assert (All (wf_decl Σ) predctx). { now apply All_app in X4 as [? ?]. } split; [econstructor; simpl; eauto; solve_all|]. eapply All2i_All2; tea; repeat intuition auto. apply wf_mkApps. subst ptm. wf. apply wf_it_mkLambda_or_LetIn; auto. apply All_app_inv; auto. - split. wf. apply wf_subst. solve_all. constructor. wf. apply wf_mkApps_inv in b. apply All_rev. solve_all. eapply declared_projection_wf in isdecl; eauto. now eapply wf_subst_instance. - subst types. clear H. split. + constructor. solve_all; destruct a0, b; cbn in *; assumption. + eapply All_nth_error in X1 as []; eauto. - subst types. split. + constructor. solve_all; destruct a0, b; cbn in *; assumption. + eapply All_nth_error in X1 as []; eauto. - split => //. + constructor; intuition auto. solve_all. + constructor => //. constructor => //. constructor; intuition auto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | typing_wf_gen | 10,358 |
Σ (wfΣ : wf Σ.1) Γ (wfΓ : wf_local Σ Γ) : All (wf_decl Σ.1) Γ. Proof using Type. eapply (env_prop_wf_local typing_wf_gen); eauto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | typing_all_wf_decl | 10,359 |
Σ (wfΣ : wf Σ) : on_global_env cumul_gen wf_decl_pred Σ. Proof using Type. eapply (env_prop_sigma typing_wf_gen _ wfΣ). Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | typing_wf_sigma | 10,360 |
Σ (wfΣ : wf Σ.1) Γ t T : Σ ;;; Γ |- t : T -> WfAst.wf Σ.1 t * WfAst.wf Σ.1 T. Proof using Type. intros. eapply typing_wf_gen in X; intuition eauto with wf. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | typing_wf | 10,361 |
{Σ : global_env} {mind mdecl} {wfΣ : wf Σ} : declared_minductive Σ mind mdecl -> All (wf_decl Σ) (ind_params mdecl) * All (@wf_inductive_body Σ) (ind_bodies mdecl). Proof using Type. intros declm. pose proof (typing_wf_gen (Env.empty_ext Σ) wfΣ _ localenv_nil _ _ (type_Prop _)) as [X _]. eapply lookup_global_Some_iff_In_NoDup in declm; eauto. 2: destruct X; now eapply NoDup_on_global_decls. destruct (lookup_on_global_env X declm) as [? [? [ext ?]]]; eauto. split. eapply on_global_inductive_wf_params in o0. solve_all. eauto using wf_decl_extends with typeclass_instances. eapply on_global_inductive_wf_bodies in o0. solve_all. destruct X0; split; solve_all; eauto using wf_extends, wf_decl_extends with typeclass_instances. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | declared_minductive_wf | 10,362 |
{Σ : global_env} {wfΣ : wf Σ} {ind mdecl idecl p} : declared_inductive Σ ind mdecl idecl -> All (WfAst.wf Σ) p.(pparams) -> All (wf_decl Σ) (case_predicate_context ind mdecl idecl p). Proof using Type. intros decli. destruct (declared_minductive_wf (proj1 decli)) as [wfp wfb]. intros wfpars. eapply wf_case_predicate_context => //. destruct decli as [declm hi]. eapply nth_error_all in wfb; tea. apply wfb. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | declared_inductive_wf_case_predicate_context | 10,363 |
{Σ} {wfΣ : wf Σ} {ind mdecl idecl cdecl p br} : declared_constructor Σ ind mdecl idecl cdecl -> All (WfAst.wf Σ) (pparams p) -> All (wf_decl Σ) (case_branch_context (fst ind) mdecl cdecl p br). Proof using Type. intros. eapply wf_case_branch_context_gen; tea => //. now apply typing_wf_sigma. destruct (declared_minductive_wf (proj1 (proj1 H))). destruct H as [[hm hnth] hnth']. eapply nth_error_all in a0; tea. now eapply wf_ind_ctor_args. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | declared_constructor_wf_case_branch_context | 10,364 |
Σ t u : WfAst.wf Σ (mkApp t u) -> exists f args, mkApp t u = tApp f args /\ ~~ isApp f. Proof using Type. induction t; simpl; try solve [eexists _, _; split; reflexivity]. intros wf. eapply wf_inv in wf as [[[appt _] wft] wfargs]. eapply All_app in wfargs as [wfargs wfu]. depelim wfu. forward IHt. eapply wf_mkApp; intuition auto. destruct IHt as [f [ar [eqf isap]]]. eexists _, _; split; auto. rewrite appt //. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | mkApp_ex_wf | 10,365 |
f u : (decompose_app (mkApp f u)).2 <> []. Proof using Type. induction f; simpl; auto; try congruence. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | decompose_app_mkApp | 10,366 |
f u f' u' : ~~ isApp f' -> mkApp f u = tApp f' u' -> mkApps f [u] = mkApps f' u'. Proof using Type. intros. rewrite -(mkApp_mkApps f u []). simpl. rewrite H0. rewrite -(mkApps_tApp f') // ?H //. destruct u' => //. eapply (f_equal decompose_app) in H0. simpl in H0. pose proof (decompose_app_mkApp f u). rewrite H0 /= in H1. congruence. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | mkApps_tApp' | 10,367 |
Σ x y : WfAst.wf Σ x -> WfAst.wf Σ y -> decompose_app x = decompose_app y -> x = y. Proof using Type. intros wfx; revert y. induction wfx using term_wf_forall_list_ind; intros [] wfy; eapply wf_inv in wfy; simpl in wfy; simpl; try intros [= ?]; try intuition congruence. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | eq_decompose_app | 10,368 |
t u : ∑ f args, mkApp t u = tApp f args. Proof using Type. induction t; simpl; try solve [eexists _, _; reflexivity]. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | mkApp_ex | 10,369 |
Σ t : WfAst.wf Σ t -> forall f l, decompose_app t = (f, l) -> strip_casts t = mkApps (strip_casts f) (map strip_casts l). Proof using Type. intros wf. induction wf using term_wf_forall_list_ind; simpl; intros; auto; noconf H; try noconf H0; rewrite ?map_map_compose ?compose_on_snd ?compose_map_def ?length_map; f_equal; solve_all; eauto. - now noconf H1. - now noconf H1. - now noconf H2. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | strip_casts_decompose_app | 10,370 |
f args : ~~ isApp f -> ~~ is_empty args -> tApp f args = mkApps f args. Proof using Type. intros. destruct args, f; try discriminate; auto. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | mkApps_tApp | 10,371 |
Σ f u : ~~ isApp f -> WfAst.wf Σ f -> All (WfAst.wf Σ) u -> strip_casts (mkApps f u) = mkApps (strip_casts f) (map strip_casts u). Proof using Type. intros nisapp wf wf'. destruct u. simpl. auto. rewrite -(mkApps_tApp f (t :: u)) //. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | strip_casts_mkApps_napp_wf | 10,372 |
f u : mkApp f u = mkApps f [u]. Proof using Type. reflexivity. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | mkApp_mkApps | 10,373 |
Σ f l hd args : WfAst.wf Σ f -> decompose_app (mkApps f l) = (hd, args) -> ∑ n, ~~ isApp hd /\ l = skipn n args /\ f = mkApps hd (firstn n args). Proof using Type. destruct (isApp f) eqn:Heq. revert l args hd. induction f; try discriminate. intros. simpl in X. move/wf_inv: X => /= [[[isAppf Hargs] wff] wfargs]. rewrite mkApps_tApp ?isAppf in H => //. destruct args => //. rewrite -mkApps_app in H. rewrite decompose_app_mkApps ?isAppf in H; auto. noconf H. exists #|args|; split; auto. now rewrite isAppf. rewrite skipn_all_app. rewrite firstn_app. rewrite firstn_all2. lia. rewrite Nat.sub_diag firstn_O app_nil_r. split; auto. rewrite mkApps_tApp ?isAppf //. now destruct args. intros wff fl. rewrite decompose_app_mkApps in fl; auto. now apply negbT. inversion fl. subst; exists 0. split; auto. now eapply negbT. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | decompose_app_inv | 10,374 |
{A} (x : A) n l : [x] = skipn n l -> exists l', l = l' ++ [x] /\ n = #|l'|. Proof using Type. induction l in n |- *. rewrite skipn_nil //. destruct n. simpl. destruct l => //. intros eq. noconf eq. exists []; split; auto. rewrite skipn_S. intros Hx. destruct (IHl _ Hx) as [l' [-> ->]]. exists (a :: l'); split; reflexivity. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | eq_tip_skipn | 10,375 |
Σ f u : WfAst.wf Σ f -> WfAst.wf Σ u -> strip_casts (mkApp f u) = mkApp (strip_casts f) (strip_casts u). Proof using Type. intros wf wf'. assert (wfa : WfAst.wf Σ (mkApp f u)). now apply wf_mkApp. destruct (mkApp_ex_wf Σ f u wfa) as [f' [args [eq isapp]]]. eapply (f_equal decompose_app) in eq. simpl in eq. epose proof (strip_casts_decompose_app Σ _ wfa _ _ eq). rewrite H. rewrite mkApp_mkApps in eq. destruct (decompose_app_inv Σ _ _ _ _ wf eq) as [n [ng [stripeq stripf]]]. apply eq_tip_skipn in stripeq. destruct stripeq as [l' [eqargs eqn]]. subst n args. rewrite firstn_app_left // in stripf. subst f. eapply wf_mkApps_napp in wf as [wff' wfl] => //. rewrite (strip_casts_mkApps_napp_wf Σ) //. now rewrite mkApp_mkApps -mkApps_app map_app. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | strip_casts_mkApp_wf | 10,376 |
Σ f u : WfAst.wf Σ f -> All (WfAst.wf Σ) u -> strip_casts (mkApps f u) = mkApps (strip_casts f) (map strip_casts u). Proof using Type. intros wf wf'. induction wf' in f, wf |- *. simpl. auto. rewrite -mkApps_mkApp IHwf'. apply wf_mkApp; auto with wf. rewrite (strip_casts_mkApp_wf Σ) //. now rewrite mkApps_mkApp. Qed. | Lemma | template-coq | Require Import ssreflect ssrbool. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst WfAst Typing. From Equations Require Import Equations. | template-coq\theories\TypingWf.v | strip_casts_mkApps_wf | 10,377 |
{A} {ua : UnivSubst A} u x xs : subst_instance u (x :: xs) = subst_instance u x :: subst_instance u xs. Proof. reflexivity. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Environment. From MetaCoq.Template Require Import Ast AstUtils Induction. | template-coq\theories\UnivSubst.v | subst_instance_cons | 10,378 |
u c n k : lift n k (subst_instance u c) = subst_instance u (lift n k c). Proof. unfold subst_instance; cbn. induction c in k |- * using term_forall_list_ind; simpl; auto; rewrite ?map_map_compose, ?compose_on_snd, ?compose_map_def, ?length_map, ?map_predicate_map_predicate, ?map_predicate_subst_instance_predicate, ?map_branch_map_branch; f_equal; eauto; solve_all; eauto. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Environment. From MetaCoq.Template Require Import Ast AstUtils Induction. | template-coq\theories\UnivSubst.v | subst_instance_lift | 10,379 |
u f a : subst_instance u (mkApps f a) = mkApps (subst_instance u f) (map (subst_instance u) a). Proof. unfold subst_instance; cbn. induction a in f |- *; auto. simpl map. simpl. destruct f; try reflexivity. simpl; now rewrite map_app. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Environment. From MetaCoq.Template Require Import Ast AstUtils Induction. | template-coq\theories\UnivSubst.v | subst_instance_mkApps | 10,380 |
u ctx t : subst_instance u (it_mkProd_or_LetIn ctx t) = it_mkProd_or_LetIn (subst_instance u ctx) (subst_instance u t). Proof. induction ctx in u, t |- *; simpl; try congruence. rewrite IHctx. unfold mkProd_or_LetIn; cbn. f_equal. destruct (decl_body a); eauto. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Environment. From MetaCoq.Template Require Import Ast AstUtils Induction. | template-coq\theories\UnivSubst.v | subst_instance_it_mkProd_or_LetIn | 10,381 |
u ctx : #|subst_instance u ctx| = #|ctx|. Proof. unfold subst_instance, subst_instance_context, map_context; simpl. now rewrite length_map. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Environment. From MetaCoq.Template Require Import Ast AstUtils Induction. | template-coq\theories\UnivSubst.v | subst_instance_length | 10,382 |
u c N k : subst (map (subst_instance u) N) k (subst_instance u c) = subst_instance u (subst N k c). Proof. unfold subst_instance; cbn. induction c in k |- * using term_forall_list_ind; simpl; auto; rewrite ?map_map_compose, ?compose_on_snd, ?compose_map_def, ?length_map, ?map_predicate_map_predicate, ?map_branch_map_branch; simpl; try solve [f_equal; eauto; solve_all; eauto]. - elim (Nat.leb k n). rewrite nth_error_map. destruct (nth_error N (n - k)). simpl. apply subst_instance_lift. reflexivity. reflexivity. - rewrite subst_instance_mkApps. f_equal; auto. rewrite map_map_compose. solve_all. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Environment. From MetaCoq.Template Require Import Ast AstUtils Induction. | template-coq\theories\UnivSubst.v | subst_instance_subst | 10,383 |
u ctx k : map (subst_instance u) (to_extended_list_k ctx k) = to_extended_list_k ctx k. Proof. pose proof (to_extended_list_k_spec ctx k). solve_all. now destruct H as [n [-> _]]. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Environment. From MetaCoq.Template Require Import Ast AstUtils Induction. | template-coq\theories\UnivSubst.v | map_subst_instance_to_extended_list_k | 10,384 |
u t : closedu 0 t -> subst_instance u t = t. Proof. unfold subst_instance; cbn. induction t in |- * using term_forall_list_ind; simpl; auto; intros H'; rewrite -> ?map_map_compose, ?compose_on_snd, ?compose_map_def, ?length_map, ?map_predicate_map_predicate, ?map_branch_map_branch; try f_equal; eauto with substu; unfold test_def, test_predicate in *; try solve [f_equal; eauto; repeat (rtoProp; solve_all; eauto with substu)]. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Environment. From MetaCoq.Template Require Import Ast AstUtils Induction. | template-coq\theories\UnivSubst.v | closedu_subst_instance | 10,385 |
(u : Instance.t) (Hcl : closedu_instance 0 u) t : closedu #|u| t -> closedu 0 (subst_instance u t). Proof. induction t in |- * using term_forall_list_ind; simpl; auto; intros H'; rewrite -> ?map_map_compose, ?compose_on_snd, ?compose_map_def, ?length_map, ?forallb_map, ?map_predicate_map_predicate; try f_equal; auto with substu; unfold test_def, test_predicate in *; simpl; try solve [f_equal; eauto; repeat (rtoProp; solve_all); intuition auto with substu]. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Environment. From MetaCoq.Template Require Import Ast AstUtils Induction. | template-coq\theories\UnivSubst.v | subst_instance_closedu | 10,386 |
t k u := match u with | tRel n => match Nat.compare k n with | Datatypes.Eq => t | Gt => tRel n | Lt => tRel (Nat.pred n) end | tEvar ev args => tEvar ev (List.map (csubst t k) args) | tLambda na T M => tLambda na (csubst t k T) (csubst t (S k) M) | tApp u v => mkApps (csubst t k u) (map (csubst t k) v) | tProd na A B => tProd na (csubst t k A) (csubst t (S k) B) | tLetIn na b ty b' => tLetIn na (csubst t k b) (csubst t k ty) (csubst t (S k) b') | tCase ind p c brs => let k' := #|pcontext p| + k in let brs' := map_branches_k (csubst t) k brs in tCase ind (map_predicate id (csubst t k) (csubst t k') p) (csubst t k c) brs' | tProj p c => tProj p (csubst t k c) | tFix mfix idx => let k' := List.length mfix + k in let mfix' := List.map (map_def (csubst t k) (csubst t k')) mfix in tFix mfix' idx | tCoFix mfix idx => let k' := List.length mfix + k in let mfix' := List.map (map_def (csubst t k) (csubst t k')) mfix in tCoFix mfix' idx | tCast c kd c' => tCast (csubst t k c) kd (csubst t k c') | tArray l v d ty => tArray l (List.map (csubst t k) v) (csubst t k d) (csubst t k ty) | x => x end. | Fixpoint | template-coq | From Coq Require Import CRelationClasses. From MetaCoq.Utils Require Import utils MCList. From MetaCoq.Common Require Import config Environment Reflect. From MetaCoq.Template Require Import Ast AstUtils LiftSubst UnivSubst WfAst TypingWf Typing. Require Import ssreflect ssrbool. Require Import Equations.Prop.DepElim. From Equations Require Import Equations. | template-coq\theories\WcbvEval.v | csubst | 10,387 |
defs body : term := fold_left (fun bod term => csubst term 0 bod) defs body. | Definition | template-coq | From Coq Require Import CRelationClasses. From MetaCoq.Utils Require Import utils MCList. From MetaCoq.Common Require Import config Environment Reflect. From MetaCoq.Template Require Import Ast AstUtils LiftSubst UnivSubst WfAst TypingWf Typing. Require Import ssreflect ssrbool. Require Import Equations.Prop.DepElim. From Equations Require Import Equations. | template-coq\theories\WcbvEval.v | substl | 10,388 |
(mfix : mfixpoint term) (idx : nat) := match List.nth_error mfix idx with | Some d => Some (d.(rarg), substl (fix_subst mfix) d.(dbody)) | None => None end. | Definition | template-coq | From Coq Require Import CRelationClasses. From MetaCoq.Utils Require Import utils MCList. From MetaCoq.Common Require Import config Environment Reflect. From MetaCoq.Template Require Import Ast AstUtils LiftSubst UnivSubst WfAst TypingWf Typing. Require Import ssreflect ssrbool. Require Import Equations.Prop.DepElim. From Equations Require Import Equations. | template-coq\theories\WcbvEval.v | cunfold_fix | 10,389 |
(mfix : mfixpoint term) (idx : nat) := match List.nth_error mfix idx with | Some d => Some (d.(rarg), substl (cofix_subst mfix) d.(dbody)) | None => None end. | Definition | template-coq | From Coq Require Import CRelationClasses. From MetaCoq.Utils Require Import utils MCList. From MetaCoq.Common Require Import config Environment Reflect. From MetaCoq.Template Require Import Ast AstUtils LiftSubst UnivSubst WfAst TypingWf Typing. Require Import ssreflect ssrbool. Require Import Equations.Prop.DepElim. From Equations Require Import Equations. | template-coq\theories\WcbvEval.v | cunfold_cofix | 10,390 |
t := match t with | tInd _ _ | tConstruct _ _ _ | tFix _ _ | tCoFix _ _ | tLambda _ _ _ | tSort _ | tProd _ _ _ | tInt _ | tFloat _ => true | _ => false end. | Definition | template-coq | From Coq Require Import CRelationClasses. From MetaCoq.Utils Require Import utils MCList. From MetaCoq.Common Require Import config Environment Reflect. From MetaCoq.Template Require Import Ast AstUtils LiftSubst UnivSubst WfAst TypingWf Typing. Require Import ssreflect ssrbool. Require Import Equations.Prop.DepElim. From Equations Require Import Equations. | template-coq\theories\WcbvEval.v | atom | 10,391 |
t := match t with | tSort _ | tProd _ _ _ => true | _ => false end. | Definition | template-coq | From Coq Require Import CRelationClasses. From MetaCoq.Utils Require Import utils MCList. From MetaCoq.Common Require Import config Environment Reflect. From MetaCoq.Template Require Import Ast AstUtils LiftSubst UnivSubst WfAst TypingWf Typing. Require Import ssreflect ssrbool. Require Import Equations.Prop.DepElim. From Equations Require Import Equations. | template-coq\theories\WcbvEval.v | isArityHead | 10,392 |
t := match t with | tEvar _ _ => true | _ => false end. | Definition | template-coq | From Coq Require Import CRelationClasses. From MetaCoq.Utils Require Import utils MCList. From MetaCoq.Common Require Import config Environment Reflect. From MetaCoq.Template Require Import Ast AstUtils LiftSubst UnivSubst WfAst TypingWf Typing. Require Import ssreflect ssrbool. Require Import Equations.Prop.DepElim. From Equations Require Import Equations. | template-coq\theories\WcbvEval.v | isEvar | 10,393 |
t := match t with | tFix _ _ => true | _ => false end. | Definition | template-coq | From Coq Require Import CRelationClasses. From MetaCoq.Utils Require Import utils MCList. From MetaCoq.Common Require Import config Environment Reflect. From MetaCoq.Template Require Import Ast AstUtils LiftSubst UnivSubst WfAst TypingWf Typing. Require Import ssreflect ssrbool. Require Import Equations.Prop.DepElim. From Equations Require Import Equations. | template-coq\theories\WcbvEval.v | isFix | 10,394 |
t := match fst (decompose_app t) with | tFix _ _ => true | _ => false end. | Definition | template-coq | From Coq Require Import CRelationClasses. From MetaCoq.Utils Require Import utils MCList. From MetaCoq.Common Require Import config Environment Reflect. From MetaCoq.Template Require Import Ast AstUtils LiftSubst UnivSubst WfAst TypingWf Typing. Require Import ssreflect ssrbool. Require Import Equations.Prop.DepElim. From Equations Require Import Equations. | template-coq\theories\WcbvEval.v | isFixApp | 10,395 |
t := match t with | tCoFix _ _ => true | _ => false end. | Definition | template-coq | From Coq Require Import CRelationClasses. From MetaCoq.Utils Require Import utils MCList. From MetaCoq.Common Require Import config Environment Reflect. From MetaCoq.Template Require Import Ast AstUtils LiftSubst UnivSubst WfAst TypingWf Typing. Require Import ssreflect ssrbool. Require Import Equations.Prop.DepElim. From Equations Require Import Equations. | template-coq\theories\WcbvEval.v | isCoFix | 10,396 |
t := match t with | tConstruct _ _ _ => true | _ => false end. | Definition | template-coq | From Coq Require Import CRelationClasses. From MetaCoq.Utils Require Import utils MCList. From MetaCoq.Common Require Import config Environment Reflect. From MetaCoq.Template Require Import Ast AstUtils LiftSubst UnivSubst WfAst TypingWf Typing. Require Import ssreflect ssrbool. Require Import Equations.Prop.DepElim. From Equations Require Import Equations. | template-coq\theories\WcbvEval.v | isConstruct | 10,397 |
t := match t with | tInt _ | tFloat _ | tArray _ _ _ _ => true | _ => false end. | Definition | template-coq | From Coq Require Import CRelationClasses. From MetaCoq.Utils Require Import utils MCList. From MetaCoq.Common Require Import config Environment Reflect. From MetaCoq.Template Require Import Ast AstUtils LiftSubst UnivSubst WfAst TypingWf Typing. Require Import ssreflect ssrbool. Require Import Equations.Prop.DepElim. From Equations Require Import Equations. | template-coq\theories\WcbvEval.v | isPrim | 10,398 |
t := isConstruct (decompose_app t).1. | Definition | template-coq | From Coq Require Import CRelationClasses. From MetaCoq.Utils Require Import utils MCList. From MetaCoq.Common Require Import config Environment Reflect. From MetaCoq.Template Require Import Ast AstUtils LiftSubst UnivSubst WfAst TypingWf Typing. Require Import ssreflect ssrbool. Require Import Equations.Prop.DepElim. From Equations Require Import Equations. | template-coq\theories\WcbvEval.v | isConstructApp | 10,399 |