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
(m : mfixpoint term) : context := List.rev (mapi (fun i d => vass d.(dname) (lift0 i d.(dtype))) m).
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
fix_context
10,100
(na : aname) (decl : context_decl) : context_decl := {| decl_name := na; decl_type := decl_type decl; decl_body := decl_body decl |}.
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
rename_decl
10,101
(ind : inductive) (oib : one_inductive_body) (pred : predicate term) : option context := (* Decompose the type.
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
build_return_context
10,102
(Γ : list ident) (Γ' : context) : list ident := let fix aux Γids Γ := match Γ with | [] => Γids | decl :: Γ => aux (fresh_name Γids (binder_name (decl_name decl)) (Some (decl_type decl)) :: Γids) Γ end in aux Γ (MCList.rev Γ').
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
fresh_names
10,103
{A} (f : A -> t) (g : A -> t) (def : def A) := string_of_name (binder_name (dname def)) ^ " { struct " ^ string_of_nat (rarg def) ^ " }" ^ " : " ^ f (dtype def) ^ " := " ^ nl ^ g (dbody def).
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_def
10,104
(print_term : list ident -> bool -> term -> t) Γ (defs : mfixpoint term) := let ctx' := fix_context defs in print_list (print_def (print_term Γ true) (print_term (fresh_names Σ Γ ctx') true)) (nl ^ " with ") defs.
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_defs
10,105
(s : sort) := match s with | sProp => "Prop" | sSProp => "SProp" | sType l => if with_universes then ("Type(" ++ MCString.string_of_list string_of_level_expr (LevelExprSet.elements l) ++ ")")%bs else "Type" end.
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_sort
10,106
(Γ : list ident) (top : bool) (t : term) {struct t} : Tree.t := match t with | tRel n => match nth_error Γ n with | Some id => id | None => "UnboundRel(" ^ string_of_nat n ^ ")" end | tVar n => "Var(" ^ n ^ ")" | tEvar ev args => "Evar(" ^ string_of_nat ev ^ "[]" ^ ")" | tSort s => print_sort s | tCast c k t => parens top (print_term Γ true c ^ ":" ^ print_term Γ true t) | tProd na dom codom => let na' := (fresh_name Σ Γ na.(binder_name) (Some dom)) in if (noccur_between 0 1 codom) then parens top (print_term Γ false dom ^ " → " ^ print_term (na' :: Γ) true codom) else parens top ("∀ " ^ na' ^ " : " ^ print_term Γ false dom ^ ", " ^ print_term (na' :: Γ) true codom) | tLambda na dom body => let na' := (fresh_name Σ Γ na.(binder_name) (Some dom)) in parens top ("fun " ^ na' ^ " : " ^ print_term Γ true dom ^ " ⇒ " ^ print_term (na' :: Γ) true body) | tLetIn na def dom body => let na' := (fresh_name Σ Γ na.(binder_name) (Some dom)) in parens top ("let " ^ na' ^ " : " ^ print_term Γ true dom ^ " := " ^ print_term Γ true def ^ " in " ^ nl ^ print_term (na' :: Γ) true body) | tApp f l => parens top (print_term Γ false f ^ " " ^ print_list (print_term Γ false) " " l) | tConst c u => string_of_kername c ^ print_universe_instance u | tInd (mkInd i k) u => match lookup_ind_decl Σ i k with | Some oib => oib.(ind_name) ^ print_universe_instance u | None => "UnboundInd(" ^ string_of_inductive (mkInd i k) ^ "," ^ string_of_universe_instance u ^ ")" end | tConstruct (mkInd i k as ind) l u => match lookup_ind_decl Σ i k with | Some oib => match nth_error oib.(ind_ctors) l with | Some cb => cb.(cstr_name) ^ print_universe_instance u | None => "UnboundConstruct(" ^ string_of_inductive ind ^ "," ^ string_of_nat l ^ "," ^ string_of_universe_instance u ^ ")" end | None => "UnboundConstruct(" ^ string_of_inductive ind ^ "," ^ string_of_nat l ^ "," ^ string_of_universe_instance u ^ ")" end | tCase {| ci_ind := mkInd mind i as ind; ci_npar := pars |} p t brs => match lookup_ind_decl Σ mind i with | Some oib => match build_return_context ind oib p with | None => "Case(" ^ string_of_inductive ind ^ "," ^ string_of_nat i ^ "," ^ string_of_term t ^ "," ^ string_of_predicate string_of_term p ^ "," ^ string_of_list (pretty_string_of_branch string_of_term) brs ^ ")" | Some Γret => let Γret := fresh_names Σ Γ Γret in let ret_binders := firstn #|pcontext p| Γret in let (as_name, indices) := (hd "_" ret_binders, MCList.rev (tail ret_binders)) in let in_args := (repeat "_" #|pparams p| ++ indices)%list in let in_str := oib.(ind_name) ^ concat "" (map (fun a : bytestring.string => " " ^ a) in_args) in let fix print_branch Γ names prbr {struct names} := match names with | [] => "⇒ " ^ prbr Γ | na :: l => let na' := (fresh_name Σ Γ na.(binder_name) None) in na' ^ " " ^ print_branch (na' :: Γ) l prbr end in let brs := map (fun br => print_branch Γ (List.rev br.(bcontext)) (fun Γ => print_term Γ true br.(bbody))) brs in let brs := combine brs oib.(ind_ctors) in parens top ("match " ^ print_term Γ true t ^ " as " ^ as_name ^ " in " ^ in_str ^ " return " ^ print_term Γret true (preturn p) ^ " with " ^ nl ^ print_list (fun '(b, cb) => cb.(cstr_name) ^ " " ^ b) (nl ^ " | ") brs ^ nl ^ "end" ^ nl) end | None => "Case(" ^ string_of_inductive ind ^ "," ^ string_of_nat i ^ "," ^ string_of_term t ^ "," ^ string_of_predicate string_of_term p ^ "," ^ string_of_list (pretty_string_of_branch string_of_term) brs ^ ")" end | tProj p c => match lookup_projection Σ p with | Some (mdecl, idecl, cdecl, pdecl) => print_term Γ false c ^ ".(" ^ pdecl.(proj_name) ^ ")" | None => "UnboundProj(" ^ string_of_inductive p.(proj_ind) ^ "," ^ string_of_nat p.(proj_npars) ^ "," ^ string_of_nat p.(proj_arg) ^ "," ^ print_term Γ true c ^ ")" end | tFix l n => parens top ("let fix " ^ print_defs print_term Γ l ^ nl ^ " in " ^ List.nth_default (string_of_nat n) (map (string_of_name ∘ binder_name ∘ dname) l) n) | tCoFix l n => parens top ("let cofix " ^ print_defs print_term Γ l ^ nl ^ " in " ^ List.nth_default (string_of_nat n) (map (string_of_name ∘ binder_name ∘ dname) l) n) | tInt i => "Int(" ^ string_of_prim_int i ^ ")" | tFloat f => "Float(" ^ string_of_float f ^ ")" | tString s => "Float(" ^ string_of_pstring s ^ ")" | tArray u arr def ty => "Array(" ^ string_of_level u ^ "," ^ string_of_list string_of_term arr ^ "," ^ string_of_term def ^ "," ^ string_of_term ty ^ ")" end.
Fixpoint
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_term
10,107
Γ (c : context_decl) : ident * t := match c with | {| decl_name := na; decl_type := ty; decl_body := None |} => let na' := (fresh_name Σ Γ na.(binder_name) (Some ty)) in (na', ("(" ^ na' ^ " : " ^ print_term Γ true ty ^ ")")) | {| decl_name := na; decl_type := ty; decl_body := Some b |} => let na' := (fresh_name Σ Γ na.(binder_name) (Some ty)) in (na', ("(" ^ na' ^ " : " ^ print_term Γ true ty ^ " := " ^ print_term Γ true b ^ ")")) end.
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
pr_context_decl
10,108
Γ Δ : list ident * t := match Δ with | [] => (Γ, "" : t) | d :: decls => let '(Γ, s) := print_context Γ decls in let '(na, s') := pr_context_decl Γ d in match decls with | [] => (na :: Γ, s ^ s') | _ => (na :: Γ, s ^ " " ^ s') end end.
Fixpoint
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_context
10,109
Γ (mib : mutual_inductive_body) (c : constructor_body) : t := let '(Γargs, s) := print_context Γ c.(cstr_args) in c.(cstr_name) ^ " : " ^ s ^ "_" ^ print_list (print_term Γargs true) " " c.(cstr_indices).
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_one_cstr
10,110
(short : bool) Γ (mib : mutual_inductive_body) (oib : one_inductive_body) : t := let '(Γpars, spars) := print_context Γ mib.(ind_params) in let '(Γinds, sinds) := print_context Γpars oib.(ind_indices) in oib.(ind_name) ^ spars ^ sinds ^ print_term Γinds true (tSort oib.(ind_sort)) ^ ":=" ^ nl ^ if short then "..." else print_list (print_one_cstr Γpars mib) nl oib.(ind_ctors).
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_one_ind
10,111
Γ (mie : mutual_inductive_entry) (c : ident × term) : t := c.1 ^ " : " ^ print_term Γ true c.2.
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_one_cstr_entry
10,112
(short : bool) Γ (mie : mutual_inductive_entry) (oie : one_inductive_entry) : t := let '(Γpars, spars) := print_context Γ mie.(mind_entry_params) in oie.(mind_entry_typename) ^ spars ^ print_term Γpars true oie.(mind_entry_arity) ^ ":=" ^ nl ^ if short then "..." else print_list (print_one_cstr_entry Γpars mie) nl (combine oie.(mind_entry_consnames) oie.(mind_entry_lc)).
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_one_ind_entry
10,113
e := match e with | Monomorphic_entry ctx => Monomorphic_ctx | Polymorphic_entry uctx => Polymorphic_ctx (fst uctx, snd (snd uctx)) end.
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
universes_decl_of_universes_entry
10,114
k := match k with | Finite => "Inductive" | CoFinite => "CoInductive" | BiFinite => "Variant" end.
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_recursivity_kind
10,115
Σ with_universes (short : bool) (mib : mutual_inductive_body) : t := let Σ' := (Σ, mib.(ind_universes)) in let names := fresh_names Σ' [] (arities_context mib.(ind_bodies)) in (print_recursivity_kind mib.(ind_finite) ^ " " ^ print_list (print_one_ind Σ' with_universes short names mib) (nl ^ "with ") mib.(ind_bodies) ^ "." ^ nl).
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_mib
10,116
mie := rev_map (fun ind => vass (mkBindAnn (nNamed ind.(mind_entry_typename)) Relevant) (it_mkProd_or_LetIn mie.(mind_entry_params) ind.(mind_entry_arity))) mie.(mind_entry_inds).
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
mie_arities_context
10,117
Σ with_universes (short : bool) (mie : mutual_inductive_entry) : t := let Σ' := (Σ, universes_decl_of_universes_entry mie.(mind_entry_universes)) in let names := fresh_names Σ' [] (mie_arities_context mie) in (print_recursivity_kind mie.(mind_entry_finite) ^ " " ^ print_list (print_one_ind_entry Σ' with_universes short names mie) (nl ^ "with ") mie.(mind_entry_inds) ^ "." ^ nl).
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_mie
10,118
with_universes (short : bool) (prefix : nat) (Σ : global_env) (acc : t) : t := match prefix with | 0 => match Σ.(declarations) with [] => acc | _ => ("..." ^ nl ^ acc) end | S n => let univs := Σ.(Env.universes) in let retro := Σ.(Env.retroknowledge) in match Σ.(declarations) with | [] => acc | (kn, InductiveDecl mib) :: Σ => let Σ := {| Env.universes := univs; declarations := Σ; retroknowledge := retro |} in print_env_aux with_universes short n Σ (print_mib Σ with_universes short mib ^ acc) | (kn, ConstantDecl cb) :: Σ => let Σ' := ({| Env.universes := univs; declarations := Σ; retroknowledge := retro |}, cb.(cst_universes)) in print_env_aux with_universes short n Σ'.1 ((match cb.(cst_body) with | Some _ => "Definition " | None => "Axiom " end) ^ string_of_kername kn ^ " : " ^ print_term Σ' with_universes nil true cb.(cst_type) ^ match cb.(cst_body) with | Some b => if short then ("..." ^ nl) else (" := " ^ nl ^ print_term Σ' with_universes nil true b ^ "." ^ nl) | None => "." end ^ acc) end end.
Fixpoint
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_env_aux
10,119
with_universes (short : bool) (prefix : nat) Σ := print_env_aux with_universes short prefix Σ (Tree.string "").
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_env
10,120
with_universes (short : bool) (prefix : nat) (p : program) : t := print_env with_universes short prefix (fst p) ^ nl ^ print_term (empty_ext (fst p)) with_universes nil true (snd p).
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_program
10,121
Σ with_universes short := Tree.to_string ∘ PrintTermTree.print_mie Σ with_universes short.
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_mie
10,122
Σ with_universes short := Tree.to_string ∘ PrintTermTree.print_mib Σ with_universes short.
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_mib
10,123
Σ Γ top := Tree.to_string ∘ PrintTermTree.print_term Σ true Γ top.
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_term
10,124
(short : bool) (prefix : nat) Σ := Tree.to_string (PrintTermTree.print_env true short prefix Σ).
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_env
10,125
(short : bool) (prefix : nat) (p : program) : string := Tree.to_string (PrintTermTree.print_program true short prefix p).
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import Primitive Environment Universes. From MetaCoq.Template Require Import Ast AstUtils LiftSubst. Import bytestring.Tree.
template-coq\theories\Pretty.v
print_program
10,126
Σ Γ M1 N1 M2 : red1 Σ Γ M1 N1 -> red1 Σ Γ (tApp M1 M2) (mkApps N1 M2). Proof. 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 WfAst Induction LiftSubst From Equations Require Import Equations. Require Import ssreflect.
template-coq\theories\Reduction.v
red1_tApp_mkApps_l
10,127
Σ Γ M1 N1 M2 : red1 Σ Γ M1 N1 -> red1 Σ Γ (tApp M1 [M2]) (mkApp N1 M2). Proof. intros. change (mkApp N1 M2) with (mkApps N1 [M2]). apply app_red_l. auto. Qed.
Lemma
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils WfAst Induction LiftSubst From Equations Require Import Equations. Require Import ssreflect.
template-coq\theories\Reduction.v
red1_tApp_mkApp
10,128
Σ Γ M1 N1 M2 : WfAst.wf Σ M1 -> red1 Σ Γ M1 N1 -> red1 Σ Γ (mkApp M1 M2) (mkApp N1 M2). Proof. intros wfM1 H. destruct (isApp M1) eqn:Heq. destruct M1; try discriminate. simpl. revert wfM1. inv H. simpl. intros. rewrite mkApp_mkApps. constructor. intros. rewrite mkApp_mkApps. econstructor; eauto. inv wfM1. simpl. clear -H1. unfold is_constructor in *. destruct (nth_error args narg) eqn:Heq. eapply nth_error_app_left in Heq. now rewrite -> Heq. discriminate. intros. rewrite mkApp_mkApps. now constructor. intros. simpl. constructor. clear -X. induction X; constructor; auto. rewrite mkApp_tApp; auto. now apply red1_tApp_mkApp. Qed.
Lemma
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils WfAst Induction LiftSubst From Equations Require Import Equations. Require Import ssreflect.
template-coq\theories\Reduction.v
red1_mkApp
10,129
Σ Γ M1 N1 M2 : WfAst.wf Σ M1 -> All (WfAst.wf Σ) M2 -> red1 Σ Γ M1 N1 -> red1 Σ Γ (mkApps M1 M2) (mkApps N1 M2). Proof. induction M2 in M1, N1 |- *. simpl; auto. intros. specialize (IHM2 (mkApp M1 a) (mkApp N1 a)). inv X0. forward IHM2. apply wf_mkApp; auto. forward IHM2. auto. rewrite <- !mkApps_mkApp; auto. apply IHM2. apply red1_mkApp; auto. Qed.
Lemma
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils WfAst Induction LiftSubst From Equations Require Import Equations. Require Import ssreflect.
template-coq\theories\Reduction.v
red1_mkApps_l
10,130
Σ Γ M1 M2 N2 : WfAst.wf Σ M1 -> All (WfAst.wf Σ) M2 -> OnOne2 (red1 Σ Γ) M2 N2 -> red1 Σ Γ (mkApps M1 M2) (mkApps M1 N2). Proof. intros. induction X1 in M1, X, X0 |- *. inv X0. destruct (isApp M1) eqn:Heq. destruct M1; try discriminate. simpl. constructor. apply OnOne2_app. constructor. auto. rewrite mkApps_tApp; try congruence. rewrite mkApps_tApp; try congruence. constructor. constructor. auto. inv X0. specialize (IHX1 (mkApp M1 hd)). forward IHX1. apply wf_mkApp; auto. forward IHX1; auto. now rewrite !mkApps_mkApp in IHX1. Qed.
Lemma
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config. From MetaCoq.Template Require Import Ast AstUtils WfAst Induction LiftSubst From Equations Require Import Equations. Require Import ssreflect.
template-coq\theories\Reduction.v
red1_mkApps_r
10,131
{term} `{EqDec term} : EqDec (predicate term). Proof. intros [] []. fcase (eq_dec pparams pparams0). fcase (eq_dec puinst puinst0). fcase (eq_dec pcontext pcontext0). fcase (eq_dec preturn preturn0). Defined.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
eq_predicate
10,132
EqDec PrimString.string. Proof. intros s1 s2. destruct (PrimString.compare s1 s2) eqn:Hcmp; [left|right|right]. - by apply PString.compare_eq. - intros Heq%PString.compare_eq. rewrite Heq in Hcmp. discriminate Hcmp. - intros Heq%PString.compare_eq. rewrite Heq in Hcmp. discriminate Hcmp. Qed.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
EqDec_pstring
10,133
EqDec term. Proof. intro x; induction x using term_forall_list_rect ; intro t ; destruct t ; try (right ; discriminate). all: term_dec_tac term_dec. - induction X in args |- *. + destruct args. * left. reflexivity. * right. discriminate. + destruct args. * right. discriminate. * destruct (IHX args) ; nodec. destruct (p t) ; nodec. subst. left. inversion e. reflexivity. - destruct (IHx1 t1) ; nodec. destruct (IHx2 t2) ; nodec. subst. left. reflexivity. - destruct (IHx1 t1) ; nodec. destruct (IHx2 t2) ; nodec. subst. left. reflexivity. - destruct (IHx1 t1) ; nodec. destruct (IHx2 t2) ; nodec. subst. left. reflexivity. - destruct (IHx1 t1) ; nodec. destruct (IHx2 t2) ; nodec. destruct (IHx3 t3) ; nodec. subst. left. reflexivity. - destruct (IHx t) ; nodec. subst. induction X in args |- *. + destruct args. all: nodec. left. reflexivity. + destruct args. all: nodec. destruct (IHX args). all: nodec. destruct (p t0). all: nodec. subst. inversion e. subst. left. reflexivity. - destruct (IHx t) ; nodec. destruct p0, type_info; subst; cbn. term_dec_tac term_dec. destruct X as (?&?). destruct (s preturn0); cbn in * ; nodec. subst. assert ({pparams = pparams0} + {pparams <> pparams0}) as []; nodec. { revert pparams0. clear -a. induction a. - intros []; [left; reflexivity|right; discriminate]. - intros []; [right; discriminate|]. destruct (p t) ; nodec. destruct (IHa l0) ; nodec. subst; left; reflexivity. } subst. revert branches. clear -X0. induction X0 ; intro l0. + destruct l0. * left. reflexivity. * right. discriminate. + destruct l0. * right. discriminate. * destruct (IHX0 l0) ; nodec. destruct (p (bbody b)) ; nodec. destruct (eq_dec (bcontext x) (bcontext b)) ; nodec. destruct x, b. left. cbn in *. subst. inversion e. reflexivity. - destruct (IHx t) ; nodec. left. subst. reflexivity. - revert mfix. induction X ; intro m0. + destruct m0. * left. reflexivity. * right. discriminate. + destruct p as [p1 p2]. destruct m0. * right. discriminate. * destruct (p1 (dtype d)) ; nodec. destruct (p2 (dbody d)) ; nodec. destruct (IHX m0) ; nodec. destruct x, d ; subst. cbn in *. destruct (eq_dec dname dname0) ; nodec. subst. inversion e1. subst. destruct (eq_dec rarg rarg0) ; nodec. subst. left. reflexivity. - revert mfix. induction X ; intro m0. + destruct m0. * left. reflexivity. * right. discriminate. + destruct p as [p1 p2]. destruct m0. * right. discriminate. * destruct (p1 (dtype d)) ; nodec. destruct (p2 (dbody d)) ; nodec. destruct (IHX m0) ; nodec. destruct x, d ; subst. cbn in *. destruct (eq_dec dname dname0) ; nodec. subst. inversion e1. subst. destruct (eq_dec rarg rarg0) ; nodec. subst. left. reflexivity. - destruct (eq_dec i i0) ; nodec. subst. left. reflexivity. - destruct (eq_dec f f0) ; nodec. subst. left. reflexivity. - destruct (eq_dec s s0) ; nodec. subst. left. reflexivity. - destruct (IHx1 t1); subst; nodec. destruct (IHx2 t2); subst; nodec. destruct (eq_dec u u0); nodec; subst. revert arr0. induction X. + intros []; auto. nodec. + intros []; auto. nodec. destruct (IHX l0). noconf e. destruct (p t); nodec. subst. left; auto. nodec. Defined.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
EqDec_term
10,134
ReflectEq term := let h := EqDec_ReflectEq term in _.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
reflect_term
10,135
ReflectEq context := _.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
eqb_ctx
10,136
(x y : constant_body) := let (tyx, bodyx, univx, relx) := x in let (tyy, bodyy, univy, rely) := y in eqb tyx tyy && eqb bodyx bodyy && eqb univx univy && eqb relx rely.
Definition
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
eqb_constant_body
10,137
ReflectEq constant_body.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
reflect_constant_body
10,138
(x y : constructor_body) := x.(cstr_name) ==? y.(cstr_name) && x.(cstr_args) ==? y.(cstr_args) && x.(cstr_indices) ==? y.(cstr_indices) && x.(cstr_type) ==? y.(cstr_type) && x.(cstr_arity) ==? y.(cstr_arity).
Definition
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
eqb_constructor_body
10,139
ReflectEq constructor_body.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
reflect_constructor_body
10,140
(x y : projection_body) := x.(proj_name) ==? y.(proj_name) && x.(proj_type) ==? y.(proj_type) && x.(proj_relevance) ==? y.(proj_relevance).
Definition
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
eqb_projection_body
10,141
ReflectEq projection_body.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
reflect_projection_body
10,142
(x y : one_inductive_body) := x.(ind_name) ==? y.(ind_name) && x.(ind_indices) ==? y.(ind_indices) && x.(ind_sort) ==? y.(ind_sort) && x.(ind_type) ==? y.(ind_type) && x.(ind_kelim) ==? y.(ind_kelim) && x.(ind_ctors) ==? y.(ind_ctors) && x.(ind_projs) ==? y.(ind_projs) && x.(ind_relevance) ==? y.(ind_relevance).
Definition
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
eqb_one_inductive_body
10,143
ReflectEq one_inductive_body.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
reflect_one_inductive_body
10,144
(x y : mutual_inductive_body) := let (f, n, p, b, u, v) := x in let (f', n', p', b', u', v') := y in eqb f f' && eqb n n' && eqb b b' && eqb p p' && eqb u u' && eqb v v'.
Definition
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
eqb_mutual_inductive_body
10,145
ReflectEq mutual_inductive_body.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
reflect_mutual_inductive_body
10,146
x y := match x, y with | ConstantDecl cst, ConstantDecl cst' => eqb cst cst' | InductiveDecl mib, InductiveDecl mib' => eqb mib mib' | _, _ => false end.
Definition
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
eqb_global_decl
10,147
ReflectEq global_decl.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
reflect_global_decl
10,148
#[export] : EqDec term := _.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
term_eq_dec
10,149
#[export] : EqDec context := _.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
context_eq_dec
10,150
#[export] : EqDec constructor_body := _.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
constructor_body_eq_dec
10,151
#[export] : EqDec projection_body := _.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
projection_body_eq_dec
10,152
#[export] : EqDec one_inductive_body := _.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
one_inductive_body_eq_dec
10,153
#[export] : EqDec mutual_inductive_body := _.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
mutual_inductive_body_eq_dec
10,154
#[export] : EqDec constant_body := _.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
constant_body_eq_dec
10,155
#[export] : EqDec global_decl := _.
Instance
template-coq
From Coq Require Numbers.Cyclic.Int63.Uint63 Floats.PrimFloat Floats.FloatAxioms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import BasicAst Reflect Environment EnvironmentReflect. From MetaCoq.Template Require Import AstUtils Ast Induction. Require Import ssreflect. From Equations Require Import Equations.
template-coq\theories\ReflectAst.v
global_decl_eq_dec
10,156
p := EtaExpand.eta_expand_program p.
Definition
template-coq
From Coq Require Import List. From MetaCoq.Common Require Import config Transform. From MetaCoq.Template Require Import TemplateProgram Pretty EtaExpand All Loader. Import ListNotations. Import MCMonadNotation. Import bytestring. From Coq Require Import ssrbool.
template-coq\theories\TemplateCheckWf.v
eta_expand
10,157
(d : kername × global_decl) : TemplateMonad unit := match d.2 with | ConstantDecl cb => match cb.(cst_body) with | Some body => tmMsg ("Unquoting eta-expanded " ++ string_of_kername d.1)%bs ;; tmUnquote body ;; tmMsg ("Succeeded") | None => ret tt end | InductiveDecl idecl => ret tt end.
Definition
template-coq
From Coq Require Import List. From MetaCoq.Common Require Import config Transform. From MetaCoq.Template Require Import TemplateProgram Pretty EtaExpand All Loader. Import ListNotations. Import MCMonadNotation. Import bytestring. From Coq Require Import ssrbool.
template-coq\theories\TemplateCheckWf.v
check_def
10,158
{A} (l : list A) := match l with | [] => true | _ :: _ => false end.
Definition
template-coq
From Coq Require Import List. From MetaCoq.Common Require Import config Transform. From MetaCoq.Template Require Import TemplateProgram Pretty EtaExpand All Loader. Import ListNotations. Import MCMonadNotation. Import bytestring. From Coq Require Import ssrbool.
template-coq\theories\TemplateCheckWf.v
is_nil
10,159
(t : term) : bool := match t with | tRel i => true | tEvar ev args => List.forallb (wfterm) args | tLambda _ T M | tProd _ T M => wfterm T && wfterm M | tApp u v => wfterm u && List.forallb (wfterm) v && negb (isApp u) && negb (is_nil v) | tCast c kind t => wfterm c && wfterm t | tLetIn na b t b' => wfterm b && wfterm t && wfterm b' | tCase ind p c brs => let p' := test_predicate (fun _ => true) (wfterm) (wfterm) p in let brs' := forallb (wfterm ∘ bbody) brs in p' && wfterm c && brs' | tProj p c => wfterm c | tFix mfix idx => List.forallb (test_def wfterm wfterm) mfix | tCoFix mfix idx => List.forallb (test_def wfterm wfterm) mfix | _ => true end.
Fixpoint
template-coq
From Coq Require Import List. From MetaCoq.Common Require Import config Transform. From MetaCoq.Template Require Import TemplateProgram Pretty EtaExpand All Loader. Import ListNotations. Import MCMonadNotation. Import bytestring. From Coq Require Import ssrbool.
template-coq\theories\TemplateCheckWf.v
wfterm
10,160
d := match d with | ConstantDecl cb => wfterm cb.(cst_type) && option_default wfterm cb.(cst_body) true | InductiveDecl idecl => true end.
Definition
template-coq
From Coq Require Import List. From MetaCoq.Common Require Import config Transform. From MetaCoq.Template Require Import TemplateProgram Pretty EtaExpand All Loader. Import ListNotations. Import MCMonadNotation. Import bytestring. From Coq Require Import ssrbool.
template-coq\theories\TemplateCheckWf.v
wf_global_decl
10,161
global_declarations -> bool := forallb (wf_global_decl ∘ snd).
Definition
template-coq
From Coq Require Import List. From MetaCoq.Common Require Import config Transform. From MetaCoq.Template Require Import TemplateProgram Pretty EtaExpand All Loader. Import ListNotations. Import MCMonadNotation. Import bytestring. From Coq Require Import ssrbool.
template-coq\theories\TemplateCheckWf.v
wf_global_declarations
10,162
(g : global_env) := wf_global_declarations g.(declarations).
Definition
template-coq
From Coq Require Import List. From MetaCoq.Common Require Import config Transform. From MetaCoq.Template Require Import TemplateProgram Pretty EtaExpand All Loader. Import ListNotations. Import MCMonadNotation. Import bytestring. From Coq Require Import ssrbool.
template-coq\theories\TemplateCheckWf.v
wf_global_env
10,163
p := wf_global_env p.1 && wfterm p.2.
Definition
template-coq
From Coq Require Import List. From MetaCoq.Common Require Import config Transform. From MetaCoq.Template Require Import TemplateProgram Pretty EtaExpand All Loader. Import ListNotations. Import MCMonadNotation. Import bytestring. From Coq Require Import ssrbool.
template-coq\theories\TemplateCheckWf.v
wf_program
10,164
(g : Ast.Env.program) : TemplateMonad unit := monad_map check_def g.1.(declarations) ;; tmMsg "Wellformed global environment" ;; ret tt.
Definition
template-coq
From Coq Require Import List. From MetaCoq.Common Require Import config Transform. From MetaCoq.Template Require Import TemplateProgram Pretty EtaExpand All Loader. Import ListNotations. Import MCMonadNotation. Import bytestring. From Coq Require Import ssrbool.
template-coq\theories\TemplateCheckWf.v
check_wf
10,165
forall p : Ast.Env.program, ∥ wt_template_program p ∥.
Axiom
template-coq
From Coq Require Import List. From MetaCoq.Common Require Import config Transform. From MetaCoq.Template Require Import TemplateProgram Pretty EtaExpand All Loader. Import ListNotations. Import MCMonadNotation. Import bytestring. From Coq Require Import ssrbool.
template-coq\theories\TemplateCheckWf.v
assume_wt_template_program
10,166
(p : Ast.Env.program) : TemplateMonad unit := monad_map check_def (eta_expand (make_template_program_env p (assume_wt_template_program p))).1.(declarations) ;; tmMsg "Wellformed eta-expanded global environment" ;; ret tt.
Definition
template-coq
From Coq Require Import List. From MetaCoq.Common Require Import config Transform. From MetaCoq.Template Require Import TemplateProgram Pretty EtaExpand All Loader. Import ListNotations. Import MCMonadNotation. Import bytestring. From Coq Require Import ssrbool.
template-coq\theories\TemplateCheckWf.v
check_wf_eta
10,167
{Σ : global_declarations} {d} : EnvMap.fresh_globals (d :: Σ) -> EnvMap.fresh_globals Σ. Proof. intros H; now depelim H. Qed.
Lemma
template-coq
From Coq Require Import ssreflect ssrbool. From Equations Require Import Equations. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Kernames EnvMap. From MetaCoq.Template Require Import Ast Typing. Import MCMonadNotation.
template-coq\theories\TemplateEnvMap.v
fresh_globals_cons_inv
10,168
{cf : checker_flags} (Σ : global_env) : wf Σ -> EnvMap.fresh_globals Σ.(declarations). Proof. destruct Σ as [univs Σ]; cbn. move=> [] onu; cbn. induction 1; try destruct o; constructor; auto; constructor; eauto. Qed.
Lemma
template-coq
From Coq Require Import ssreflect ssrbool. From Equations Require Import Equations. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Kernames EnvMap. From MetaCoq.Template Require Import Ast Typing. Import MCMonadNotation.
template-coq\theories\TemplateEnvMap.v
wf_fresh_globals
10,169
{ env :> global_env; map : EnvMap.t global_decl; repr : EnvMap.repr env.(declarations) map; wf : EnvMap.fresh_globals env.(declarations) }.
Record
template-coq
From Coq Require Import ssreflect ssrbool. From Equations Require Import Equations. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Kernames EnvMap. From MetaCoq.Template Require Import Ast Typing. Import MCMonadNotation.
template-coq\theories\TemplateEnvMap.v
t
10,170
Σ kn := EnvMap.lookup kn Σ.(map).
Definition
template-coq
From Coq Require Import ssreflect ssrbool. From Equations Require Import Equations. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Kernames EnvMap. From MetaCoq.Template Require Import Ast Typing. Import MCMonadNotation.
template-coq\theories\TemplateEnvMap.v
lookup_env
10,171
(Σ : t) kn : lookup_env Σ kn = Env.lookup_env Σ kn. Proof. rewrite /lookup_env /Env.lookup_env. apply (EnvMap.lookup_spec Σ.(env).(declarations)); apply Σ. Qed.
Lemma
template-coq
From Coq Require Import ssreflect ssrbool. From Equations Require Import Equations. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Kernames EnvMap. From MetaCoq.Template Require Import Ast Typing. Import MCMonadNotation.
template-coq\theories\TemplateEnvMap.v
lookup_env_spec
10,172
Σ kn : option mutual_inductive_body := decl <- lookup_env Σ kn;; match decl with | ConstantDecl _ => None | InductiveDecl mdecl => ret mdecl end.
Definition
template-coq
From Coq Require Import ssreflect ssrbool. From Equations Require Import Equations. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Kernames EnvMap. From MetaCoq.Template Require Import Ast Typing. Import MCMonadNotation.
template-coq\theories\TemplateEnvMap.v
lookup_minductive
10,173
Σ kn : lookup_minductive Σ kn = Ast.lookup_minductive Σ kn. Proof. rewrite /lookup_minductive /Ast.lookup_minductive. rewrite lookup_env_spec //. Qed.
Lemma
template-coq
From Coq Require Import ssreflect ssrbool. From Equations Require Import Equations. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Kernames EnvMap. From MetaCoq.Template Require Import Ast Typing. Import MCMonadNotation.
template-coq\theories\TemplateEnvMap.v
lookup_minductive_spec
10,174
Σ kn : option (mutual_inductive_body * one_inductive_body) := mdecl <- lookup_minductive Σ (inductive_mind kn) ;; idecl <- nth_error mdecl.(ind_bodies) (inductive_ind kn) ;; ret (mdecl, idecl).
Definition
template-coq
From Coq Require Import ssreflect ssrbool. From Equations Require Import Equations. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Kernames EnvMap. From MetaCoq.Template Require Import Ast Typing. Import MCMonadNotation.
template-coq\theories\TemplateEnvMap.v
lookup_inductive
10,175
Σ kn : lookup_inductive Σ kn = Ast.lookup_inductive Σ kn. Proof. rewrite /lookup_inductive /Ast.lookup_inductive. rewrite lookup_minductive_spec //. Qed.
Lemma
template-coq
From Coq Require Import ssreflect ssrbool. From Equations Require Import Equations. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Kernames EnvMap. From MetaCoq.Template Require Import Ast Typing. Import MCMonadNotation.
template-coq\theories\TemplateEnvMap.v
lookup_inductive_spec
10,176
Σ kn c : option (mutual_inductive_body * one_inductive_body * constructor_body) := '(mdecl, idecl) <- lookup_inductive Σ kn ;; cdecl <- nth_error idecl.(ind_ctors) c ;; ret (mdecl, idecl, cdecl).
Definition
template-coq
From Coq Require Import ssreflect ssrbool. From Equations Require Import Equations. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Kernames EnvMap. From MetaCoq.Template Require Import Ast Typing. Import MCMonadNotation.
template-coq\theories\TemplateEnvMap.v
lookup_constructor
10,177
Σ kn : lookup_constructor Σ kn = Ast.lookup_constructor Σ kn. Proof. rewrite /lookup_constructor /Ast.lookup_constructor. rewrite lookup_inductive_spec //. Qed.
Lemma
template-coq
From Coq Require Import ssreflect ssrbool. From Equations Require Import Equations. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Kernames EnvMap. From MetaCoq.Template Require Import Ast Typing. Import MCMonadNotation.
template-coq\theories\TemplateEnvMap.v
lookup_constructor_spec
10,178
Σ (p : projection) : option (mutual_inductive_body * one_inductive_body * constructor_body * projection_body) := '(mdecl, idecl, cdecl) <- lookup_constructor Σ p.(proj_ind) 0 ;; pdecl <- nth_error idecl.(ind_projs) p.(proj_arg) ;; ret (mdecl, idecl, cdecl, pdecl).
Definition
template-coq
From Coq Require Import ssreflect ssrbool. From Equations Require Import Equations. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Kernames EnvMap. From MetaCoq.Template Require Import Ast Typing. Import MCMonadNotation.
template-coq\theories\TemplateEnvMap.v
lookup_projection
10,179
Σ kn : lookup_projection Σ kn = Ast.lookup_projection Σ kn. Proof. rewrite /lookup_projection /Ast.lookup_projection. rewrite lookup_constructor_spec //. Qed.
Lemma
template-coq
From Coq Require Import ssreflect ssrbool. From Equations Require Import Equations. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Kernames EnvMap. From MetaCoq.Template Require Import Ast Typing. Import MCMonadNotation.
template-coq\theories\TemplateEnvMap.v
lookup_projection_spec
10,180
Ast.Env.program.
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Export config Transform. From MetaCoq.Template Require Import Import Transform.
template-coq\theories\TemplateProgram.v
template_program
10,181
(TemplateEnvMap.GlobalEnvMap.t * Ast.term).
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Export config Transform. From MetaCoq.Template Require Import Import Transform.
template-coq\theories\TemplateProgram.v
template_program_env
10,182
{cf : checker_flags} (p : template_program) := let Σ := Ast.Env.empty_ext p.1 in wf_ext Σ × ∑ T, Σ ;;; [] |- p.2 : T.
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Export config Transform. From MetaCoq.Template Require Import Import Transform.
template-coq\theories\TemplateProgram.v
wt_template_program
10,183
(p : Ast.Env.program) (v : Ast.term) := ∥ WcbvEval.eval p.1 p.2 v ∥.
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Export config Transform. From MetaCoq.Template Require Import Import Transform.
template-coq\theories\TemplateProgram.v
eval_template_program
10,184
{cf : checker_flags} (p : template_program_env) := let Σ := Ast.Env.empty_ext p.1 in wf_ext Σ × ∑ T, Σ ;;; [] |- p.2 : T.
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Export config Transform. From MetaCoq.Template Require Import Import Transform.
template-coq\theories\TemplateProgram.v
wt_template_program_env
10,185
(p : template_program_env) (v : Ast.term) := ∥ WcbvEval.eval p.1 p.2 v ∥.
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Export config Transform. From MetaCoq.Template Require Import Import Transform.
template-coq\theories\TemplateProgram.v
eval_template_program_env
10,186
{cf : checker_flags} p : ∥ wt_template_program p ∥ -> EnvMap.EnvMap.fresh_globals (declarations p.1). Proof. intros [[wfΣ _]]. eapply TemplateEnvMap.wf_fresh_globals, wfΣ. Qed.
Lemma
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Export config Transform. From MetaCoq.Template Require Import Import Transform.
template-coq\theories\TemplateProgram.v
wt_template_program_fresh
10,187
{cf : checker_flags} (p : template_program) (wtp : ∥ wt_template_program p ∥) : template_program_env := (GlobalEnvMap.make p.1 (wt_template_program_fresh p wtp), p.2).
Definition
template-coq
From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Export config Transform. From MetaCoq.Template Require Import Import Transform.
template-coq\theories\TemplateProgram.v
make_template_program_env
10,188
(cmp_univ : Universe.t -> Universe.t -> Prop) : Instance.t -> Instance.t -> Prop := Forall2 (on_rel cmp_univ Universe.make').
Definition
template-coq
From Coq Require Import CMorphisms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect Environment EnvironmentTyping. From MetaCoq.Template Require Import Ast AstUtils Induction. Require Import ssreflect ssrbool. From Equations.Prop Require Import DepElim. From Equations Require Import Equations.
template-coq\theories\TermEquality.v
cmp_universe_instance
10,189
(cmp_univ : conv_pb -> Universe.t -> Universe.t -> Prop) pb v u u' := match v with | Variance.Irrelevant => True | Variance.Covariant => on_rel (cmp_univ pb) Universe.make' u u' | Variance.Invariant => on_rel (cmp_univ Conv) Universe.make' u u' end.
Definition
template-coq
From Coq Require Import CMorphisms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect Environment EnvironmentTyping. From MetaCoq.Template Require Import Ast AstUtils Induction. Require Import ssreflect ssrbool. From Equations.Prop Require Import DepElim. From Equations Require Import Equations.
template-coq\theories\TermEquality.v
cmp_universe_variance
10,190
cmp_univ pb v u u' := Forall3 (cmp_universe_variance cmp_univ pb) v u u'.
Definition
template-coq
From Coq Require Import CMorphisms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect Environment EnvironmentTyping. From MetaCoq.Template Require Import Ast AstUtils Induction. Require Import ssreflect ssrbool. From Equations.Prop Require Import DepElim. From Equations Require Import Equations.
template-coq\theories\TermEquality.v
cmp_universe_instance_variance
10,191
lookup gr napp := match gr with | IndRef ind => match lookup_inductive_gen lookup ind with | Some (mdecl, idecl) => match destArity [] idecl.(ind_type) with | Some (ctx, _) => if (context_assumptions ctx) <=? napp then match mdecl.(ind_variance) with | Some var => Variance var | None => AllEqual end else AllEqual | None => AllEqual end | None => AllEqual end | ConstructRef ind k => match lookup_constructor_gen lookup ind k with | Some (mdecl, idecl, cdecl) => if (cdecl.(cstr_arity) + mdecl.(ind_npars))%nat <=? napp then (** Fully applied constructors are always compared at the same supertype, which implies that no universe ws_cumul_pb needs to be checked here.
Definition
template-coq
From Coq Require Import CMorphisms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect Environment EnvironmentTyping. From MetaCoq.Template Require Import Ast AstUtils Induction. Require Import ssreflect ssrbool. From Equations.Prop Require Import DepElim. From Equations Require Import Equations.
template-coq\theories\TermEquality.v
global_variance_gen
10,192
cmp_univ pb v := match v with | AllEqual => cmp_universe_instance (cmp_univ Conv) | AllIrrelevant => fun l l' => #|l| = #|l'| | Variance v => fun u u' => cmp_universe_instance (cmp_univ Conv) u u' \/ cmp_universe_instance_variance cmp_univ pb v u u' end.
Definition
template-coq
From Coq Require Import CMorphisms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect Environment EnvironmentTyping. From MetaCoq.Template Require Import Ast AstUtils Induction. Require Import ssreflect ssrbool. From Equations.Prop Require Import DepElim. From Equations Require Import Equations.
template-coq\theories\TermEquality.v
cmp_opt_variance
10,193
cmp_univ pb v : RelationClasses.subrelation (cmp_opt_variance cmp_univ pb AllEqual) (cmp_opt_variance cmp_univ pb v). Proof. intros u u' H. destruct v as [| |v] => //=. 1: now apply Forall2_length in H. now left. Qed.
Lemma
template-coq
From Coq Require Import CMorphisms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect Environment EnvironmentTyping. From MetaCoq.Template Require Import Ast AstUtils Induction. Require Import ssreflect ssrbool. From Equations.Prop Require Import DepElim. From Equations Require Import Equations.
template-coq\theories\TermEquality.v
cmp_instance_opt_variance
10,194
(cmp_univ : conv_pb -> Universe.t -> Universe.t -> Prop) pb v u u' : RelationClasses.subrelation (cmp_univ Conv) (cmp_univ pb) -> on_rel (cmp_univ Conv) Universe.make' u u' -> cmp_universe_variance cmp_univ pb v u u'. Proof. destruct v => //=. intros H H1; apply H, H1. Qed.
Lemma
template-coq
From Coq Require Import CMorphisms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect Environment EnvironmentTyping. From MetaCoq.Template Require Import Ast AstUtils Induction. Require Import ssreflect ssrbool. From Equations.Prop Require Import DepElim. From Equations Require Import Equations.
template-coq\theories\TermEquality.v
cmp_universe_universe_variance
10,195
cmp_univ pb v u u' : RelationClasses.subrelation (cmp_univ Conv) (cmp_univ pb) -> #|v| = #|u| -> cmp_universe_instance (cmp_univ Conv) u u' -> cmp_universe_instance_variance cmp_univ pb v u u'. Proof. intros Hsub Hlen Hu. apply Forall2_triv in Hlen. eapply Forall2_Forall2_Forall3 in Hu; tea. apply Forall3_impl with (1 := Hu) => v1 u1 u1' [] _ H1. now apply cmp_universe_universe_variance. Qed.
Lemma
template-coq
From Coq Require Import CMorphisms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect Environment EnvironmentTyping. From MetaCoq.Template Require Import Ast AstUtils Induction. Require Import ssreflect ssrbool. From Equations.Prop Require Import DepElim. From Equations Require Import Equations.
template-coq\theories\TermEquality.v
cmp_instance_variance
10,196
cmp_univ pb v ui ui' : RelationClasses.subrelation (cmp_univ Conv) (cmp_univ pb) -> cmp_universe_instance (cmp_univ Conv) ui ui' \/ cmp_universe_instance_variance cmp_univ pb v ui ui' -> { cmp_universe_instance (cmp_univ Conv) ui ui' } + { cmp_universe_instance_variance cmp_univ pb v ui ui' }. Proof. intros subr H. elim:(eq_dec #|v| #|ui|). - right. destruct H as [|]; tas. now eapply cmp_instance_variance. - left. destruct H as [|]; tas. eapply @Forall3_Forall2_left with (Q := fun _ _ => True) in H => //. apply Forall2_length in H. now exfalso. Qed.
Lemma
template-coq
From Coq Require Import CMorphisms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect Environment EnvironmentTyping. From MetaCoq.Template Require Import Ast AstUtils Induction. Require Import ssreflect ssrbool. From Equations.Prop Require Import DepElim. From Equations Require Import Equations.
template-coq\theories\TermEquality.v
cmp_opt_variance_var_dec
10,197
Σ cmp_universe pb gr napp := cmp_opt_variance cmp_universe pb (global_variance_gen Σ gr napp).
Definition
template-coq
From Coq Require Import CMorphisms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect Environment EnvironmentTyping. From MetaCoq.Template Require Import Ast AstUtils Induction. Require Import ssreflect ssrbool. From Equations.Prop Require Import DepElim. From Equations Require Import Equations.
template-coq\theories\TermEquality.v
cmp_global_instance_gen
10,198
R R' : RelationClasses.subrelation R R' -> RelationClasses.subrelation (cmp_universe_instance R) (cmp_universe_instance R'). Proof. intros H x y xy. eapply Forall2_impl; tea; unfold on_rel; auto. Qed.
Lemma
template-coq
From Coq Require Import CMorphisms. From MetaCoq.Utils Require Import utils. From MetaCoq.Common Require Import config Reflect Environment EnvironmentTyping. From MetaCoq.Template Require Import Ast AstUtils Induction. Require Import ssreflect ssrbool. From Equations.Prop Require Import DepElim. From Equations Require Import Equations.
template-coq\theories\TermEquality.v
cmp_universe_instance_impl
10,199