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
|
---|---|---|---|---|---|---|
(Γ : context) x := match x with | tRel i => match option_map decl_body (nth_error Γ i) with | Some None => true | _ => false end | _ => 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 | isAssRel | 10,400 |
Σ x := match x with | tConst c u => match lookup_env Σ c with | Some (ConstantDecl {| cst_body := None |}) => true | _ => false end | _ => 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 | isAxiom | 10,401 |
t (args : list term) := match t with | tFix mfix idx => match cunfold_fix mfix idx with | Some (narg, fn) => #|args| <? narg | None => false end | _ => 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 | isStuckFix | 10,402 |
f l : atom (mkApps f l) -> (l = []) /\ atom f. Proof. revert f; induction l using rev_ind. simpl. intuition auto. simpl. intros. rewrite -AstUtils.mkApp_mkApps in H. unfold mkApp in H. destruct (mkApps f l); discriminate. Qed. | Lemma | 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_mkApps | 10,403 |
mdecl cdecl := (mdecl.(ind_npars) + context_assumptions cdecl.(cstr_args))%nat. | 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 | cstr_arity | 10,404 |
term -> term -> Type := | eval_beta f na t b a a' l res : eval f (tLambda na t b) -> eval a a' -> eval (mkApps (csubst a' 0 b) l) res -> eval (tApp f (a :: l)) res | eval_zeta na b0 b0' t b1 res : eval b0 b0' -> eval (csubst b0' 0 b1) res -> eval (tLetIn na b0 t b1) res | eval_delta c decl body (isdecl : declared_constant Σ c decl) u res : decl.(cst_body) = Some body -> eval (subst_instance u body) res -> eval (tConst c u) res | eval_iota ci mdecl idecl cdecl discr c u args p brs br res : eval discr (mkApps (tConstruct ci.(ci_ind) c u) args) -> nth_error brs c = Some br -> declared_constructor Σ (ci.(ci_ind), c) mdecl idecl cdecl -> let bctx := case_branch_context ci.(ci_ind) mdecl cdecl p br in #|args| = (ci.(ci_npar) + context_assumptions bctx)%nat -> eval (iota_red ci.(ci_npar) args bctx br) res -> eval (tCase ci p discr brs) res | eval_proj proj discr args u a res mdecl idecl cdecl pdecl : declared_projection Σ proj mdecl idecl cdecl pdecl -> eval discr (mkApps (tConstruct proj.(proj_ind) 0 u) args) -> #|args| = cstr_arity mdecl cdecl -> nth_error args (proj.(proj_npars) + proj.(proj_arg)) = Some a -> eval a res -> eval (tProj proj discr) res | eval_fix f mfix idx fixargsv args argsv narg fn res : ~~ isApp f -> eval f (mkApps (tFix mfix idx) fixargsv) -> All2 eval args argsv -> cunfold_fix mfix idx = Some (narg, fn) -> #|fixargsv| < narg < #|fixargsv| + #|args| -> eval (mkApps fn (fixargsv ++ argsv)) res -> eval (mkApps f args) res | eval_fix_value f mfix idx fixargsv args argsv narg fn : ~~ isApp f -> eval f (mkApps (tFix mfix idx) fixargsv) -> All2 eval args argsv -> cunfold_fix mfix idx = Some (narg, fn) -> #|fixargsv ++ argsv| <= narg -> eval (mkApps f args) (mkApps (tFix mfix idx) (fixargsv ++ argsv)) | eval_cofix_case ip mfix idx p discr args narg fn brs res : cunfold_cofix mfix idx = Some (narg, fn) -> eval discr (mkApps (tCoFix mfix idx) args) -> eval (tCase ip p (mkApps fn args) brs) res -> eval (tCase ip p discr brs) res | eval_cofix_proj p mfix idx discr args narg fn res : cunfold_cofix mfix idx = Some (narg, fn) -> eval discr (mkApps (tCoFix mfix idx) args) -> eval (tProj p (mkApps fn args)) res -> eval (tProj p discr) res | eval_construct ind c u mdecl idecl cdecl f args args' : declared_constructor Σ (ind, c) mdecl idecl cdecl -> ~~ isApp f -> args <> [] -> eval f (tConstruct ind c u) -> #|args| <= cstr_arity mdecl cdecl -> All2 eval args args' -> eval (mkApps f args) (mkApps (tConstruct ind c u) args') | eval_app_cong f f' a a' : ~~ isApp f -> a <> [] -> eval f f' -> ~~ (isLambda f' || isFixApp f' || isArityHead f' || isConstructApp f' || isPrim f') -> All2 eval a a' -> eval (tApp f a) (mkApps f' a') | eval_tArray u v v' def def' ty : eval def def' -> All2 eval v v' -> eval (tArray u v def ty) (tArray u v' def' ty) | eval_atom t : atom t -> eval t t. | Inductive | 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 | eval | 10,405 |
forall P : term -> term -> Type, (forall (f : term) (na : aname) t b a a' l res, eval f (tLambda na t b) -> P f (tLambda na t b) -> eval a a' -> P a a' -> eval (mkApps (csubst a' 0 b) l) res -> P (mkApps (csubst a' 0 b) l) res -> P (tApp f (a :: l)) res) -> (forall (na : aname) (b0 b0' t b1 res : term), eval b0 b0' -> P b0 b0' -> eval (csubst b0' 0 b1) res -> P (csubst b0' 0 b1) res -> P (tLetIn na b0 t b1) res) -> (forall c (decl : constant_body) (body : term), declared_constant Σ c decl -> forall (u : Instance.t) (res : term), cst_body decl = Some body -> eval (subst_instance u body) res -> P (subst_instance u body) res -> P (tConst c u) res) -> (forall ci mdecl idecl cdecl (discr : term) (c : nat) (u : Instance.t) (args : list term) (p : predicate term) (brs : list (branch term)) br (res : term), let ind := ci.(ci_ind) in let npar := ci.(ci_npar) in eval discr (mkApps (tConstruct ind c u) args) -> P discr (mkApps (tConstruct ind c u) args) -> nth_error brs c = Some br -> declared_constructor Σ (ci.(ci_ind), c) mdecl idecl cdecl -> let bctx := case_branch_context ci.(ci_ind) mdecl cdecl p br in #|args| = (ci.(ci_npar) + context_assumptions bctx)%nat -> eval (iota_red npar args bctx br) res -> P (iota_red npar args bctx br) res -> P (tCase ci p discr brs) res) -> (forall proj (discr : term) (args : list term) (u : Instance.t) a mdecl idecl cdecl pdecl res, declared_projection Σ proj mdecl idecl cdecl pdecl -> eval discr (mkApps (tConstruct proj.(proj_ind) 0 u) args) -> P discr (mkApps (tConstruct proj.(proj_ind) 0 u) args) -> #|args| = cstr_arity mdecl cdecl -> nth_error args (proj.(proj_npars) + proj.(proj_arg)) = Some a -> eval a res -> P a res -> P (tProj proj discr) res) -> (forall (f : term) (mfix : mfixpoint term) (idx : nat) (fixargsv args argsv : list term) (narg : nat) (fn res : term), ~~ isApp f -> eval f (mkApps (tFix mfix idx) fixargsv) -> P f (mkApps (tFix mfix idx) fixargsv) -> All2 eval args argsv -> All2 P args argsv -> cunfold_fix mfix idx = Some (narg, fn) -> #|fixargsv| < narg < #|fixargsv| + #|args| -> eval (mkApps fn (fixargsv ++ argsv)) res -> P (mkApps fn (fixargsv ++ argsv)) res -> P (mkApps f args) res) -> (forall (f : term) (mfix : mfixpoint term) (idx : nat) (fixargsv args argsv : list term) (narg : nat) (fn : term), ~~ isApp f -> eval f (mkApps (tFix mfix idx) fixargsv) -> P f (mkApps (tFix mfix idx) fixargsv) -> All2 eval args argsv -> All2 P args argsv -> cunfold_fix mfix idx = Some (narg, fn) -> #|fixargsv ++ argsv| <= narg -> P (mkApps f args) (mkApps (tFix mfix idx) (fixargsv ++ argsv))) -> (forall (ip : case_info) (mfix : mfixpoint term) (idx : nat) (p : predicate term) discr (args : list term) (narg : nat) (fn : term) (brs : list (branch term)) (res : term), cunfold_cofix mfix idx = Some (narg, fn) -> eval discr (mkApps (tCoFix mfix idx) args) -> P discr (mkApps (tCoFix mfix idx) args) -> eval (tCase ip p (mkApps fn args) brs) res -> P (tCase ip p (mkApps fn args) brs) res -> P (tCase ip p discr brs) res) -> (forall (p : projection) (mfix : mfixpoint term) (idx : nat) discr (args : list term) (narg : nat) (fn res : term), cunfold_cofix mfix idx = Some (narg, fn) -> eval discr (mkApps (tCoFix mfix idx) args) -> P discr (mkApps (tCoFix mfix idx) args) -> eval (tProj p (mkApps fn args)) res -> P (tProj p (mkApps fn args)) res -> P (tProj p discr) res) -> (forall ind c u mdecl idecl cdecl f args args', declared_constructor Σ (ind, c) mdecl idecl cdecl -> ~~ isApp f -> args <> [] -> eval f (tConstruct ind c u) -> P f (tConstruct ind c u) -> #|args| <= cstr_arity mdecl cdecl -> All2 eval args args' -> All2 P args args' -> P (mkApps f args) (mkApps (tConstruct ind c u) args')) -> (forall f f' a a', ~~ isApp f -> a <> [] -> eval f f' -> P f f' -> ~~ (isLambda f' || isFixApp f' || isArityHead f' || isConstructApp f' || isPrim f') -> All2 eval a a' -> All2 P a a' -> P (tApp f a) (mkApps f' a')) -> (forall u v v' def def' ty, eval def def' -> P def def' -> All2 eval v v' -> All2 P v v' -> P (tArray u v def ty) (tArray u v' def' ty)) -> (forall t : term, atom t -> P t t) -> forall t t0 : term, eval t t0 -> P t t0. Proof. intros P Hbeta Hlet Hcst Hcase Hproj Hfix Hstuckfix Hcofixcase Hcofixproj Happcstr Happcong Harr Hatom. fix eval_evals_ind 3. destruct 1; try solve [match goal with [ H : _ |- _ ] => match type of H with forall t t0, eval t t0 -> _ => fail 1 | _ => eapply H end end; eauto]. - eauto. - eauto. - eapply Hfix; eauto. clear -a eval_evals_ind. revert args argsv a. fix aux 3; destruct 1; constructor; auto. - eapply Hstuckfix; eauto. clear -a eval_evals_ind. revert args argsv a. fix aux 3; destruct 1; constructor; auto. - eapply Happcstr; eauto. clear l n. revert args args' a. fix aux 3; destruct 1; constructor; auto. - eapply Happcong; auto. clear i0 n. revert a a' a0. fix aux 3; destruct 1; constructor; auto. - eapply Harr; eauto. exact (map_All2 eval_evals_ind a). Defined. | 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 | eval_evals_ind | 10,406 |
(value : term -> Type) : term -> Type := | atomic_atom t : atom t -> atomic_value value t | atomic_array u v def ty : All value v -> value def -> atomic_value value (tArray u v def ty). | Inductive | 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 | atomic_value | 10,407 |
term -> Type := | value_atom t : atomic_value value t -> value t | value_app f args : value_head #|args| f -> args <> [] -> All value args -> value (mkApps f args). | Inductive | 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 | value | 10,408 |
forall P : term -> Type, (forall t, atom t -> P t) -> (forall u v def ty, All value v -> All P v -> value def -> P def -> P (tArray u v def ty)) -> (forall f args, value_head #|args| f -> args <> [] -> All value args -> All P args -> P (mkApps f args)) -> forall t : term, value t -> P t. Proof. intros P ???. fix value_values_ind 2. destruct 1. - destruct a. * apply X; auto. * apply X0; eauto. eapply make_All_All; tea. - eapply X1; auto; tea. eapply make_All_All; tea. Defined. | Lemma | 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 | value_values_ind | 10,409 |
{nargs t} : value_head nargs t -> ~~ isApp t. Proof using Type. destruct 1; auto. Qed. | Lemma | 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 | value_head_nApp | 10,410 |
{t args} : isStuckFix t args -> ~~ isApp t. Proof using Type. destruct t; auto. Qed. | Lemma | 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 | isStuckfix_nApp | 10,411 |
{t} : atom t -> ~~ isApp t. Proof using Type. destruct t; auto. Qed. | Lemma | 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_nApp | 10,412 |
t l : ~~ isApp t -> value (mkApps t l) -> ((l = []) × atomic t) + ([× l <> [], value_head #|l| t & All value l]). Proof using Type. intros H H'. generalize_eq x (mkApps t l). revert t H. induction H' using value_values_ind. intros. subst. - eapply atom_mkApps in H. left. intuition auto. now constructor. - intros. left. destruct l using rev_case; cbn in H0. subst t. split => //. constructor 2; auto. solve_discr'. elim (app_tip_nil l x). congruence. - intros * isapp appeq. move: (value_head_nApp X) => Ht. right. apply mkApps_eq_inj in appeq => //. intuition subst; auto => //. Qed. | Lemma | 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 | value_mkApps_inv | 10,413 |
t l : value (mkApps t l) -> ~~ isApp t -> All value l. Proof using Type. intros val not_app. now apply value_mkApps_inv in val as [(-> & ?)|[]]. Qed. | Lemma | 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 | value_mkApps_values | 10,414 |
f args : ~~ isApp f -> isFixApp (mkApps f args) = isFixApp f. Proof using Type. move=> Hf. rewrite /isFixApp !decompose_app_mkApps // /=. change f with (mkApps f []) at 2. rewrite !decompose_app_mkApps // /=. Qed. | Lemma | 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_mkApps | 10,415 |
f args : ~~ isApp f -> isConstructApp (mkApps f args) = isConstructApp f. Proof using Type. move=> Hf. rewrite /isConstructApp !decompose_app_mkApps // /=. change f with (mkApps f []) at 2. rewrite !decompose_app_mkApps // /=. Qed. | Lemma | 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_mkApps | 10,416 |
{A} (l : list A) : (l = []) + (l <> []). Proof using Type. destruct l; intuition congruence. Qed. | Lemma | 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 | is_nil | 10,417 |
{A} {P} {l l' : list A} : All2 P l l' -> l <> [] -> l' <> []. Proof using Type. induction 1; congruence. Qed. | Lemma | 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 | All2_nil | 10,418 |
{A} {P} {l l' : list A} : All2 P l l' -> l' <> [] -> l <> []. Proof using Type. induction 1; congruence. Qed. | Lemma | 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 | All2_nil_rev | 10,419 |
e e' : eval e e' -> value e'. Proof using Type. intros eve. induction eve using eval_evals_ind; simpl; intros; auto using value. - apply All2_right in X0. destruct (is_nil (fixargsv ++ argsv)). { rewrite e /=. now apply value_atom; constructor. } eapply value_app => //. + econstructor; tea. + apply All_app_inv => //. now eapply value_mkApps_values. - apply All2_right in X0. eapply value_app; auto. econstructor; tea. rewrite -(All2_length X) //. now eapply All2_nil. - eapply All2_right in X0. depelim IHeve. destruct t; simpl in * |- *; try depelim a0; cbn in *; try congruence; try solve [eapply value_app => //; [now constructor|now eapply All2_nil]]. rewrite -mkApps_app. eapply value_app. rewrite !negb_or in H1. pose proof (value_head_nApp v). rewrite isConstructApp_mkApps // isFixApp_mkApps // in H1. destruct v. * rewrite /isConstructApp /= in H1. rtoProp; intuition auto. * constructor. * constructor => //. * rewrite /isFixApp /= in H1. rtoProp; intuition auto. * eapply All2_nil in X; tea. destruct args; cbn; congruence. * eapply All_app_inv; tea. - eapply All2_right in X0. constructor. constructor 2; auto. - now do 2 constructor. Qed. | Lemma | 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 | eval_to_value | 10,420 |
n t : value_head n t -> (~~ (isLambda t || isArityHead t)). Proof using Type. now destruct 1; simpl. Qed. | Lemma | 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 | value_head_spec | 10,421 |
n t : value_head n t -> eval t t. Proof using Type. destruct 1. - now constructor. - now eapply eval_atom. - now eapply eval_atom. - now eapply eval_atom. Qed. | Lemma | 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 | value_head_final | 10,422 |
e : value e -> eval e e. Proof using Type. induction 1 using value_values_ind; simpl; auto using value. - now constructor. - constructor; eauto. eapply All_All2; tea; eauto. - assert (All2 eval args args). { clear -X1; induction X1; constructor; auto. } destruct X. * eapply eval_construct; tea => //. now constructor. * rewrite -{1}mkApps_tApp => //. destruct args => //. eapply eval_app_cong => //. now constructor. * rewrite -{1}mkApps_tApp => //. destruct args => //. eapply eval_app_cong => //. now constructor. * eapply eval_fix_value with (fixargsv := []). 4:tea. auto. now constructor. exact X2. now cbn. Qed. | Lemma | 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 | value_final | 10,423 |
t t' : atom t -> eval t t' -> t = t'. Proof using Type. intros Ha H; depind H; try solve_discr'; try now easy. - eapply atom_mkApps in Ha; intuition subst. depelim a. apply atom_mkApps in H2 as (-> & ?). cbn in *. lia. - eapply atom_mkApps in Ha; intuition subst. depelim a. apply atom_mkApps in H1 as (-> & ?). cbn in *. reflexivity. - eapply atom_mkApps in Ha as [-> ato]. rewrite (IHeval ato). now depelim a. Qed. | Lemma | 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 | eval_atom_inj | 10,424 |
mfix idx narg fn t args : cunfold_fix mfix idx = Some (narg, fn) -> eval t (mkApps (tFix mfix idx) args) -> args = [] \/ #|args| <= narg. Proof using Type. intros uf ev. apply eval_to_value in ev. apply value_mkApps_inv in ev as [(-> & ?)|[eqargs vh eva]]; try easy. depelim vh. rewrite uf in e. noconf e. intuition auto. Qed. | Lemma | 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 | eval_to_stuck_fix_inv | 10,425 |
{n b ty t v} : eval (tLetIn n b ty t) v -> ∑ b', eval b b' * eval (csubst b' 0 t) v. Proof using Type. intros H; depind H; try solve_discr'; try now easy. - depelim a. eapply eval_to_stuck_fix_inv in H; [|easy]. exfalso. destruct H; subst; cbn in *; lia. - depelim a. now rewrite app_nil_r. Qed. | Lemma | 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 | eval_LetIn | 10,426 |
{c u v} : eval (tConst c u) v -> ∑ decl, declared_constant Σ c decl * match cst_body decl with | Some body => eval (subst_instance u body) v | None => False end. Proof using Type. intros H; depind H; try solve_discr'; try now easy. - exists decl. intuition auto. now rewrite e. - depelim a. eapply eval_to_stuck_fix_inv in H; [|easy]. exfalso. destruct H; subst; cbn in *; lia. - depelim a. apply IHeval. now rewrite app_nil_r. Qed. | Lemma | 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 | eval_Const | 10,427 |
f f' l l' : ~~ isApp f -> eval f f' -> value_head #|l| f' -> All2 eval l l' -> eval (mkApps f l) (mkApps f' l'). Proof using Type. revert l'. induction l using rev_ind; intros l' appf evf vf' evl. depelim evl. intros. eapply evf. eapply All2_app_inv_l in evl as [? [? [? ?]]]. intuition auto. subst. depelim b. depelim b. cbn in vf'; destruct vf'. - eapply eval_construct; tea. apply app_tip_nil. now eapply All2_app. - rewrite -mkApps_tApp => //. rewrite is_empty_app /= andb_false_r //. eapply eval_app_cong; auto. eapply All2_app; auto. - rewrite -mkApps_tApp => //. rewrite is_empty_app /= andb_false_r //. eapply eval_app_cong; auto. eapply All2_app; auto. - eapply eval_fix_value with (fixargsv := []) (argsv := x0 ++ [y]). 4:tea. all: move=> //. eapply All2_app; auto. cbn. len. len in l0. cbn in l0. now rewrite -(All2_length a). Qed. | Lemma | 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 | eval_mkApps_cong | 10,428 |
{Σ} : term -> Type := | wf_tRel n : wf (tRel n) | wf_tVar id : wf (tVar id) | wf_tEvar n l : All wf l -> wf (tEvar n l) | wf_tSort u : wf (tSort u) | wf_tCast t k t' : wf t -> wf t' -> wf (tCast t k t') | wf_tProd na t b : wf t -> wf b -> wf (tProd na t b) | wf_tLambda na t b : wf t -> wf b -> wf (tLambda na t b) | wf_tLetIn na t b b' : wf t -> wf b -> wf b' -> wf (tLetIn na t b b') | wf_tApp t u : isApp t = false -> u <> nil -> wf t -> All wf u -> wf (tApp t u) | wf_tConst k u : wf (tConst k u) | wf_tInd i u : wf (tInd i u) | wf_tConstruct i k u : wf (tConstruct i k u) | wf_tCase ci p c brs mdecl idecl : declared_inductive Σ ci.(ci_ind) mdecl idecl -> ci.(ci_npar) = mdecl.(ind_npars) -> wf_nactx p.(pcontext) (ind_predicate_context ci.(ci_ind) mdecl idecl) -> #|pparams p| = context_assumptions (ind_params mdecl) -> All wf (pparams p) -> wf (preturn p) -> wf c -> All2 (fun cdecl br => wf_nactx br.(bcontext) (cstr_branch_context ci.(ci_ind) mdecl cdecl) × wf (bbody br)) idecl.(ind_ctors) brs -> wf (tCase ci p c brs) | wf_tProj p t : wf t -> wf (tProj p t) | wf_tFix mfix k : All (fun def => wf def.(dtype) × wf def.(dbody)) mfix -> wf (tFix mfix k) | wf_tCoFix mfix k : All (fun def => wf def.(dtype) × wf def.(dbody)) mfix -> wf (tCoFix mfix k) | wf_tInt i : wf (tInt i) | wf_tFloat f : wf (tFloat f) | wf_tString s : wf (tString s) | wf_tArray u arr def ty : All wf arr -> wf def -> wf ty -> wf (tArray u arr def ty). | Inductive | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | wf | 10,429 |
Σ (t : term) : Type := match t with | tRel _ | tVar _ | tSort _ => unit | tInt _ | tFloat _ | tString _ => unit | tArray u arr def ty => All (wf Σ) arr * wf Σ def * wf Σ ty | tEvar n l => All (wf Σ) l | tCast t k t' => wf Σ t * wf Σ t' | tProd na t b => wf Σ t * wf Σ b | tLambda na t b => wf Σ t * wf Σ b | tLetIn na t b b' => wf Σ t * wf Σ b * wf Σ b' | tApp t u => (isApp t = false) * (u <> nil) * wf Σ t * All (wf Σ) u | tConst c _ => unit | tInd ind _ => unit | tConstruct ind k _ => unit | tCase ci p c brs => ∑ mdecl idecl, [× declared_inductive Σ ci.(ci_ind) mdecl idecl, ci.(ci_npar) = mdecl.(ind_npars), wf_nactx p.(pcontext) (ind_predicate_context ci.(ci_ind) mdecl idecl), #|pparams p| = context_assumptions (ind_params mdecl), All (wf Σ) (pparams p), wf Σ (preturn p), wf Σ c & All2 (fun cdecl br => wf_nactx br.(bcontext) (cstr_branch_context ci.(ci_ind) mdecl cdecl) × wf Σ (bbody br)) idecl.(ind_ctors) brs] | tProj p t => wf Σ t | tFix mfix k => All (fun def => wf Σ def.(dtype) * wf Σ def.(dbody)) mfix | tCoFix mfix k => All (fun def => wf Σ def.(dtype) * wf Σ def.(dbody)) mfix end. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | wf_Inv | 10,430 |
{Σ t} (w : wf Σ t) : wf_Inv Σ t. Proof. induction w; simpl; eauto; intuition eauto; try constructor. Defined. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | wf_inv | 10,431 |
Σ (P : term -> Prop) : (forall t, wf Σ t -> P t) -> forall l, All (wf Σ) l -> Forall P l. Proof. intros IH. fix lift_to_list 1. destruct l; constructor. apply IH. now inversion_clear X. apply lift_to_list. now inversion_clear X. Defined. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | lift_to_list | 10,432 |
Σ (P : term -> Type) : forall l, All (fun t => wf Σ t -> P t) l -> All (wf Σ) l -> All P l. Proof. induction 1. constructor. inversion_clear 1. constructor; auto. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | lift_to_wf_list | 10,433 |
Σ : forall P : term -> Type, (forall n : nat, P (tRel n)) -> (forall i : ident, P (tVar i)) -> (forall (n : nat) (l : list term), All P l -> P (tEvar n l)) -> (forall s, P (tSort s)) -> (forall t : term, P t -> forall (c : cast_kind) (t0 : term), P t0 -> P (tCast t c t0)) -> (forall (n : aname) (t : term), P t -> forall t0 : term, P t0 -> P (tProd n t t0)) -> (forall (n : aname) (t : term), P t -> forall t0 : term, P t0 -> P (tLambda n t t0)) -> (forall (n : aname) (t : term), P t -> forall t0 : term, P t0 -> forall t1 : term, P t1 -> P (tLetIn n t t0 t1)) -> (forall t : term, isApp t = false -> wf Σ t -> P t -> forall l : list term, l <> nil -> All (wf Σ) l -> All P l -> P (tApp t l)) -> (forall s (u : list Level.t), P (tConst s u)) -> (forall (i : inductive) (u : list Level.t), P (tInd i u)) -> (forall (i : inductive) (n : nat) (u : list Level.t), P (tConstruct i n u)) -> (forall (ci : case_info) (p : predicate term) mdecl idecl, declared_inductive Σ ci.(ci_ind) mdecl idecl -> ci.(ci_npar) = mdecl.(ind_npars) -> #|pparams p| = context_assumptions (ind_params mdecl) -> wf_nactx p.(pcontext) (ind_predicate_context ci.(ci_ind) mdecl idecl) -> tCasePredProp P P p -> forall t : term, P t -> forall l : list (branch term), All2 (fun cdecl br => wf_nactx br.(bcontext) (cstr_branch_context ci.(ci_ind) mdecl cdecl) × P (bbody br)) idecl.(ind_ctors) l -> P (tCase ci p t l)) -> (forall (s : projection) (t : term), P t -> P (tProj s t)) -> (forall (m : mfixpoint term) (n : nat), tFixProp P P m -> P (tFix m n)) -> (forall (m : mfixpoint term) (n : nat), tFixProp P P m -> P (tCoFix m n)) -> (forall i, P (tInt i)) -> (forall f, P (tFloat f)) -> (forall s, P (tString s)) -> (forall u arr def ty, All P arr -> P def -> P ty -> P (tArray u arr def ty)) -> forall t : term, wf Σ t -> P t. Proof. intros P H2 H3 H4 H5 H6 H7 H8 H9 H10 H11 H12 H13 H14 H15 H16 H17 H18 H19 H20 Harr. intros until t. revert t. apply (term_forall_list_rect (fun t => wf Σ t -> P t)); intros; try solve [match goal with H : _ |- _ => apply H end; auto]. - apply H4. inv X0. eauto using lift_to_wf_list. - inv X1; auto. - inv X1; auto. - inv X1; auto. - inv X2; auto. - inv X1; auto. apply H10; auto. eauto using lift_to_wf_list. - destruct X. inv X2; eapply H14; eauto. + split; auto. solve_all. + red in X1. solve_all. - inv X0; auto. - inv X0; auto. apply H16. red. red in X. solve_all. - inv X0; auto. apply H17. red. red in X. solve_all. - inv X2; auto. eapply Harr; eauto using lift_to_wf_list. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | term_wf_forall_list_ind | 10,434 |
Σ d := option_default (wf Σ) (decl_body d) unit × wf Σ (decl_type d). | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | wf_decl | 10,435 |
Σ : context -> judgment -> Type := (fun _ j => option_default (wf Σ) (j_term j) unit × wf Σ (j_typ j)). | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | wf_decl_pred | 10,436 |
Σ u a : wf Σ u -> wf Σ a -> wf Σ (mkApp u a). Proof. intros H H'. inversion_clear H; try constructor; simpl; auto; try congruence; try constructor; auto. solve_all. apply All_app_inv; auto. all:econstructor; eauto. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | wf_mkApp | 10,437 |
Σ u a : wf Σ u -> All (wf Σ) a -> wf Σ (mkApps u a). Proof. intros H H'. induction a; simpl; auto. inversion_clear H; try constructor; simpl; auto; try congruence; try constructor; auto. intro. destruct u0; simpl in *; congruence. solve_all. apply All_app_inv; auto. all:econstructor; eauto. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | wf_mkApps | 10,438 |
n k t : isApp t = false -> isApp (lift n k t) = false. Proof. induction t; auto. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | lift_isApp | 10,439 |
Σ n k t : wf Σ t -> wf Σ (lift n k t). Proof. intros wft; revert t wft k. apply (term_wf_forall_list_ind Σ (fun t => forall k, wf Σ (lift n k t))); intros; try cbn; econstructor; simpl; eauto; try solve [solve_all]. destruct l; cbn in *. auto. discriminate. now rewrite length_map. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | wf_lift | 10,440 |
Σ ts k u : All (wf Σ) ts -> wf Σ u -> wf Σ (subst ts k u). Proof. intros wfts wfu. induction wfu in k using term_wf_forall_list_ind; simpl; intros; try econstructor; cbn in *; eauto; solve_all. - unfold subst. destruct (leb_spec_Set k n). destruct nth_error eqn:Heq. apply (nth_error_all Heq) in wfts. apply wf_lift; auto. constructor. constructor. - apply wf_mkApps; auto. solve_all. - now rewrite length_map. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | wf_subst | 10,441 |
Σ t k u : wf Σ t -> wf Σ u -> wf Σ (subst1 t k u). Proof. intros wft wfu. apply wf_subst. constructor; auto. auto. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | wf_subst1 | 10,442 |
Σ t : WfAst.wf Σ t -> WfAst.wf Σ (strip_outer_cast t). Proof. induction t; auto. simpl. intros H; now inv H. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | wf_strip_outer_cast | 10,443 |
Σ t u : ~~ isApp t -> WfAst.wf Σ (mkApps t u) -> WfAst.wf Σ t * All (WfAst.wf Σ) u. Proof. induction u in t |- *; simpl. - intuition. - intros Happ H; destruct t; try solve [inv H; intuition auto]. specialize (IHu (tApp t0 (u ++ [a]))). forward IHu. induction u; trivial. discriminate. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | wf_mkApps_napp | 10,444 |
Σ t u : WfAst.wf Σ (mkApps t u) -> All (WfAst.wf Σ) u. Proof. induction u in t |- *; simpl. - intuition. - intros H; destruct t; try solve [inv H; intuition auto]. specialize (IHu (tApp t0 (args ++ [a]))). forward IHu. induction u; trivial. simpl. rewrite <- app_assoc. simpl. apply H. intuition. inv H. now apply All_app in X0. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | wf_mkApps_inv | 10,445 |
t : isLambda t = true -> ~~ isApp t. Proof. destruct t; simpl; congruence. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | isLambda_isApp | 10,446 |
Σ u c : wf Σ c -> wf Σ (subst_instance u c). Proof. induction 1 using term_wf_forall_list_ind; simpl; try solve [ cbn; constructor; auto using All_map; solve_all ]. - cbn. constructor; auto. destruct t0; simpl in *; try congruence. destruct l; simpl in *; congruence. now apply All_map. - cbn; econstructor; eauto; simpl; solve_all. now rewrite length_map. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | wf_subst_instance | 10,447 |
Σ: forall (n : nat) (args : list term), All (wf Σ) args -> wf Σ (nth n args tDummy). Proof. intros n args H. induction H in n; destruct n; simpl; try constructor; auto. Qed. | Lemma | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils Induction UnivSubst. From Equations Require Import Equations. Require Import ssreflect ssrbool. Require Import PeanoNat. Import Nat. | template-coq\theories\WfAst.v | wf_nth | 10,448 |
Type := existT_typed_term { my_projT1 : Type ; my_projT2 : my_projT1 }. | Record | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast. | ImportDefaultBehavior | ImportNeedQualified. | template-coq\theories\TemplateMonad\Common.v | typed_term | 10,449 |
(A : Type) : Type := my_Some : A -> option_instance A | my_None : option_instance A. | Inductive | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast. | ImportDefaultBehavior | ImportNeedQualified. | template-coq\theories\TemplateMonad\Common.v | option_instance | 10,450 |
{t u r} := { TemplateMonad : Type@{t} -> Type@{r} ; tmReturn : forall {A:Type@{t}}, A -> TemplateMonad A ; tmBind : forall {A B : Type@{t}}, TemplateMonad A -> (A -> TemplateMonad B) -> TemplateMonad B ; tmFail : forall {A:Type@{t}}, string -> TemplateMonad A ; tmFreshName : ident -> TemplateMonad ident ; tmLocate : qualid -> TemplateMonad (list global_reference) ; tmLocateModule : qualid -> TemplateMonad (list modpath) ; tmLocateModType : qualid -> TemplateMonad (list modpath) ; tmCurrentModPath : unit -> TemplateMonad modpath ; tmQuoteInductive : kername -> TemplateMonad mutual_inductive_body ; tmQuoteUniverses : TemplateMonad ConstraintSet.t ; tmQuoteConstant : kername -> bool -> TemplateMonad constant_body ; tmMkInductive : bool -> mutual_inductive_entry -> TemplateMonad unit ; tmExistingInstance : hint_locality -> global_reference -> TemplateMonad unit }. | Record | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast. | ImportDefaultBehavior | ImportNeedQualified. | template-coq\theories\TemplateMonad\Common.v | TMInstance@ | 10,451 |
{t u} {A B : Type@{t}} (v : TemplateMonad@{t u} A) : (A -> TemplateMonad@{t u} B) -> TemplateMonad@{t u} B := match v with | tmReturn x => fun f => f x | tmBind v k => fun f => tmOptimizedBind v (fun v => tmBind (k v) f) | tmFail msg => fun _ => tmFail msg | v => tmBind v end. | Fixpoint | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmOptimizedBind@ | 10,452 |
{t u} {A B : Type@{t}} (v : TemplateMonad@{t u} A) : (A -> TemplateMonad@{t u} B) -> TemplateMonad@{t u} B := match v with | tmReturn x => fun f => f x | tmBind v k => fun f => tmOptimize' v (fun v => tmOptimize' (k v) f) | tmFail msg => fun _ => tmFail msg | v => tmBind v end. | Fixpoint | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmOptimize'@ | 10,453 |
{t u} {A : Type@{t}} (v : TemplateMonad@{t u} A) : TemplateMonad@{t u} A := tmOptimize' v tmReturn. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmOptimize@ | 10,454 |
{t u} : Monad@{t u} TemplateMonad@{t u} := {| ret := @tmReturn ; bind := @tmBind |}. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | TemplateMonad_UnoptimizedMonad@ | 10,455 |
{t u} : Monad@{t u} TemplateMonad@{t u} := {| ret := @tmReturn ; bind := @tmOptimizedBind |}. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | TemplateMonad_OptimizedMonad@ | 10,456 |
{t u} : Monad@{t u} TemplateMonad@{t u} := Eval hnf in TemplateMonad_UnoptimizedMonad. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | TemplateMonad_Monad@ | 10,457 |
{A} (msg : A) : TemplateMonad unit := tmEval all msg >>= tmPrint. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | print_nf | 10,458 |
{A} (msg : string) : TemplateMonad A := tmEval all msg >>= tmFail. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | fail_nf | 10,459 |
(mind : mutual_inductive_body) : TemplateMonad unit := tmMkInductive false (mind_body_to_entry mind). | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmMkInductive' | 10,460 |
id := tmAxiomRed id None. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmAxiom | 10,461 |
id {A} t := @tmDefinitionRed_ false id None A t. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmDefinition | 10,462 |
{A} (a : A) := tmQuoteRecTransp a true. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmQuoteRec | 10,463 |
(q : qualid) : TemplateMonad global_reference := l <- tmLocate q ;; match l with | [] => tmFail ("Constant [" ^ q ^ "] not found") | x :: _ => tmReturn x end. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmLocate1 | 10,464 |
(q : qualid) : TemplateMonad modpath := l <- tmLocateModule q ;; match l with | [] => tmFail ("Module [" ^ q ^ "] not found") | x :: _ => tmReturn x end. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmLocateModule1 | 10,465 |
(q : qualid) : TemplateMonad modpath := l <- tmLocateModType q ;; match l with | [] => tmFail ("ModType [" ^ q ^ "] not found") | x :: _ => tmReturn x end. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmLocateModType1 | 10,466 |
{A} (t : A) := tmQuote t >>= tmPrint. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmTestQuote | 10,467 |
(s : ident) := (MPfile ["Common"; "TemplateMonad"; "Template"; "MetaCoq"], s). | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | Common_kn | 10,468 |
(t : term) := t' <- tmUnquote t ;; t'' <- tmEval (unfold (Common_kn "my_projT2")) (my_projT2 t') ;; tmPrint t''. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmTestUnquote | 10,469 |
id {A} (t : A) := tmQuote t >>= tmDefinition id. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmQuoteDefinition | 10,470 |
id rd {A} (t : A) := tmEval rd t >>= tmQuoteDefinition id. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmQuoteDefinitionRed | 10,471 |
id {A} (t : A) := tmQuoteRec t >>= tmDefinition id. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmQuoteRecDefinition | 10,472 |
(id : ident) (tm : term) : TemplateMonad unit := t' <- tmUnquote tm ;; t'' <- tmEval (unfold (Common_kn "my_projT2")) (my_projT2 t') ;; tmDefinitionRed id (Some (unfold (Common_kn "my_projT1"))) t'' ;; tmReturn tt. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmMkDefinition | 10,473 |
Common.TMInstance := {| Common.TemplateMonad := TemplateMonad ; Common.tmReturn:=@tmReturn ; Common.tmBind:=@tmBind ; Common.tmFail:=@tmFail ; Common.tmFreshName:=@tmFreshName ; Common.tmLocate:=@tmLocate ; Common.tmLocateModule:=@tmLocateModule ; Common.tmLocateModType:=@tmLocateModType ; Common.tmCurrentModPath:=@tmCurrentModPath ; Common.tmQuoteInductive:=@tmQuoteInductive ; Common.tmQuoteUniverses:=@tmQuoteUniverses ; Common.tmQuoteConstant:=@tmQuoteConstant ; Common.tmMkInductive:=@tmMkInductive ; Common.tmExistingInstance:=@tmExistingInstance |}. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | TypeInstanceUnoptimized | 10,474 |
Common.TMInstance := {| Common.TemplateMonad := TemplateMonad ; Common.tmReturn:=@tmReturn ; Common.tmBind:=@tmOptimizedBind ; Common.tmFail:=@tmFail ; Common.tmFreshName:=@tmFreshName ; Common.tmLocate:=@tmLocate ; Common.tmLocateModule:=@tmLocateModule ; Common.tmLocateModType:=@tmLocateModType ; Common.tmCurrentModPath:=@tmCurrentModPath ; Common.tmQuoteInductive:=@tmQuoteInductive ; Common.tmQuoteUniverses:=@tmQuoteUniverses ; Common.tmQuoteConstant:=@tmQuoteConstant ; Common.tmMkInductive:=@tmMkInductive ; Common.tmExistingInstance:=@tmExistingInstance |}. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | TypeInstanceOptimized | 10,475 |
Common.TMInstance := Eval hnf in TypeInstanceUnoptimized. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | TypeInstance | 10,476 |
{U t u} : TemplateMonad@{t u} sort := p <- @tmQuote Prop (Type@{U} -> True);; match p with | tProd _ (tSort s) _ => ret s | _ => tmFail "Anomaly: tmQuote (Type -> True) should be (tProd _ (tSort _) _)!"%bs end. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmQuoteSort@ | 10,477 |
{U t u} : TemplateMonad@{t u} Universe.t := s <- @tmQuoteSort@{U t u};; match s with | sType u => ret u | _ => tmFail "Sort does not carry a universe (is not Type)"%bs end. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmQuoteUniverse@ | 10,478 |
{U t u} : TemplateMonad@{t u} Level.t := u <- tmQuoteUniverse@{U t u};; match Universe.get_is_level u with | Some l => ret l | None => tmFail "Universe is not a level"%bs end. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmQuoteLevel@ | 10,479 |
{a b t u} {A : Type@{a}} {B : Type@{b}} (qtmFix' : Ast.term) (f : (A -> TemplateMonad@{t u} B) -> (A -> TemplateMonad@{t u} B)) : A -> TemplateMonad@{t u} B := f (fun a => tmFix <- tmUnquoteTyped (Ast.term -> ((A -> TemplateMonad@{t u} B) -> (A -> TemplateMonad@{t u} B)) -> A -> TemplateMonad@{t u} B) qtmFix';; tmFix qtmFix' f a). | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmFix'@ | 10,480 |
{a b t u} {A : Type@{a}} {B : Type@{b}} (f : (A -> TemplateMonad@{t u} B) -> (A -> TemplateMonad@{t u} B)) : A -> TemplateMonad@{t u} B := f (fun a => (qA <- tmQuote A;; qB <- tmQuote B;; qa <- tmQuoteLevel@{a _ _};; qb <- tmQuoteLevel@{b _ _};; qt <- tmQuoteLevel@{t _ _};; qu <- tmQuoteLevel@{u _ _};; let self := tConst (MPfile ["Core"; "TemplateMonad"; "Template"; "MetaCoq"], "tmFix'")%bs [qa;qb;qt;qu] in @tmFix'@{a b t u} A B (mkApps self [qA; qB]) f a)). | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils Common. Import MCMonadNotation. | template-coq\theories\TemplateMonad\Core.v | tmFix@ | 10,481 |
Common.TMInstance := {| Common.TemplateMonad := TM ; Common.tmReturn:=@tmReturn ; Common.tmBind:=@tmBind ; Common.tmFail:=@tmFail ; Common.tmFreshName:=@tmFreshName ; Common.tmLocate:=@tmLocate ; Common.tmLocateModule:=@tmLocateModule ; Common.tmLocateModType:=@tmLocateModType ; Common.tmCurrentModPath:=fun _ => @tmCurrentModPath ; Common.tmQuoteInductive:=@tmQuoteInductive ; Common.tmQuoteUniverses:=@tmQuoteUniverses ; Common.tmQuoteConstant:=@tmQuoteConstant ; Common.tmMkInductive:=@tmInductive ; Common.tmExistingInstance:=@tmExistingInstance |}. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils TemplateMonad.Common. | template-coq\theories\TemplateMonad\Extractable.v | TypeInstance | 10,482 |
(nm : ident) (type : option Ast.term) (term : Ast.term) := tmDefinition_ true nm type term. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils TemplateMonad.Common. | template-coq\theories\TemplateMonad\Extractable.v | tmOpaqueDefinition | 10,483 |
(nm : ident) (type : option Ast.term) (term : Ast.term) := tmDefinition_ false nm type term. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils TemplateMonad.Common. | template-coq\theories\TemplateMonad\Extractable.v | tmDefinition | 10,484 |
(mind : mutual_inductive_body) : TM unit := tmInductive false (mind_body_to_entry mind). | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils TemplateMonad.Common. | template-coq\theories\TemplateMonad\Extractable.v | tmInductive' | 10,485 |
(i : ident) (rd : reductionStrategy) (ty : Ast.term) := tmBind (tmEval rd ty) (fun ty => tmLemma i ty). | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils TemplateMonad.Common. | template-coq\theories\TemplateMonad\Extractable.v | tmLemmaRed | 10,486 |
(i : ident) (rd : reductionStrategy) (ty : Ast.term) := tmBind (tmEval rd ty) (fun ty => tmAxiom i ty). | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils TemplateMonad.Common. | template-coq\theories\TemplateMonad\Extractable.v | tmAxiomRed | 10,487 |
(opaque : bool) (i : ident) (rd : reductionStrategy) (ty : option Ast.term) (body : Ast.term) := match ty with | None => tmDefinition_ opaque i None body | Some ty => tmBind (tmEval rd ty) (fun ty => tmDefinition_ opaque i (Some ty) body) end. | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils TemplateMonad.Common. | template-coq\theories\TemplateMonad\Extractable.v | tmDefinitionRed | 10,488 |
(rd : reductionStrategy) (type : Ast.term) : TM (option Ast.term) := tmBind (tmEval rd type) (fun type => tmInferInstance type). | Definition | template-coq | From MetaCoq.Utils Require Import utils. From MetaCoq.Template Require Import Ast AstUtils TemplateMonad.Common. | template-coq\theories\TemplateMonad\Extractable.v | tmInferInstanceRed | 10,489 |