statement
stringlengths
1
15.6k
proof
stringlengths
0
77.4k
type
stringclasses
28 values
symbolic_name
stringlengths
1
67
library
stringclasses
41 values
filename
stringclasses
383 values
imports
listlengths
0
71
deps
listlengths
0
64
docstring
stringlengths
0
6.76k
source_url
stringclasses
1 value
commit
stringclasses
1 value
subst_decl s k (d : context_decl)
:= map_decl (subst s k) d.
Definition
subst_decl
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "context_decl", "map_decl", "subst" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
subst_context_length s n Γ : #|subst_context s n Γ| = #|Γ|.
Proof. now rewrite /subst_context; len. Qed.
Lemma
subst_context_length
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "len", "subst_context" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
subst_context_nil s n : subst_context s n [] = [].
Proof. reflexivity. Qed.
Lemma
subst_context_nil
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "reflexivity", "subst_context" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
subst_context_alt s k Γ : subst_context s k Γ = mapi (fun k' d => subst_decl s (Nat.pred #|Γ| - k' + k) d) Γ.
Proof. unfold subst_context, fold_context_k. rewrite rev_mapi. rewrite List.rev_involutive. apply mapi_ext. intros. f_equal. now rewrite List.length_rev. Qed.
Lemma
subst_context_alt
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "apply", "fold_context_k", "length_rev", "mapi", "mapi_ext", "rev_involutive", "rev_mapi", "subst_context", "subst_decl", "unfold" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
subst_context_snoc s k Γ d : subst_context s k (d :: Γ) = subst_context s k Γ ,, subst_decl s (#|Γ| + k) d.
Proof. now rewrite /subst_context fold_context_k_snoc0. Qed.
Lemma
subst_context_snoc
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "fold_context_k_snoc0", "subst_context", "subst_decl" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
subst_telescope s k (Γ : context) : context
:= mapi (fun k' decl => map_decl (subst s (k' + k)) decl) Γ.
Definition
subst_telescope
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "context", "map_decl", "mapi", "subst" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
subst_instance_decl : UnivSubst context_decl
:= map_decl ∘ subst_instance.
Instance
subst_instance_decl
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "UnivSubst", "context_decl", "map_decl" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
subst_instance_context : UnivSubst context
:= map_context ∘ subst_instance.
Instance
subst_instance_context
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "UnivSubst", "context", "map_context" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
subst_instance_length u (ctx : context) : #|subst_instance u ctx| = #|ctx|.
Proof. unfold subst_instance, subst_instance_context, map_context. now rewrite length_map. Qed.
Lemma
subst_instance_length
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "context", "map_context", "subst_instance_context", "unfold" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
set_binder_name (na : aname) (x : context_decl) : context_decl
:= {| decl_name := na; decl_body := decl_body x; decl_type := decl_type x |}.
Definition
set_binder_name
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "aname", "context_decl" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
context_assumptions (Γ : context) : nat
:= match Γ with | [] => 0 | d :: Γ => match d.(decl_body) with | Some _ => context_assumptions Γ | None => S (context_assumptions Γ) end end.
Fixpoint
context_assumptions
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "context" ]
Count the number of assumptions in a context (i.e. declarations that do not contain a body).
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
is_assumption_context (Γ : context)
:= match Γ with | [] => true | d :: Γ => match d.(decl_body) with | Some _ => false | None => is_assumption_context Γ end end.
Fixpoint
is_assumption_context
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "context" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
smash_context (Γ Γ' : context) : context
:= match Γ' with | {| decl_body := Some b |} :: Γ' => smash_context (subst_context [b] 0 Γ) Γ' | {| decl_body := None |} as d :: Γ' => smash_context (Γ ++ [d]) Γ' | [] => Γ end.
Fixpoint
smash_context
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "context", "subst_context" ]
Smashing a context produces an assumption context.
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
smash_context_length Γ Γ' : #|smash_context Γ Γ'| = #|Γ| + context_assumptions Γ'.
Proof. induction Γ' as [|[na [body|] ty] tl] in Γ |- *; cbn; eauto. - now rewrite IHtl subst_context_length. - rewrite IHtl length_app. simpl. lia. Qed.
Lemma
smash_context_length
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "context_assumptions", "smash_context", "subst_context_length", "ty" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
smash_context_app Δ Γ Γ' : smash_context Δ (Γ ++ Γ') = smash_context (smash_context Δ Γ) Γ'.
Proof. revert Δ; induction Γ as [|[na [b|] ty]]; intros Δ; simpl; auto. Qed.
Lemma
smash_context_app
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "smash_context", "ty" ]
Smashing a context Γ with Δ depending on it is the same as smashing Γ and substituting all references to Γ in Δ by the expansions of let bindings.
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extended_subst (Γ : context) (n : nat) (* Δ, smash_context Γ, n |- extended_subst Γ n : Γ *)
:= match Γ with | nil => nil | cons d vs => match decl_body d with | Some b => (* Δ , vs |- b *) let s := extended_subst vs n in (* Δ , smash_context vs , n |- s : vs *) let b' := lift (context_assumptions vs + n) #|s| b in (* Δ, smash_context vs, n , vs |- b' *) let b'...
Fixpoint
extended_subst
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "context", "context_assumptions", "lift", "subst", "tRel" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extended_subst_length Γ n : #|extended_subst Γ n| = #|Γ|.
Proof. induction Γ in n |- *; simpl; auto. now destruct a as [? [?|] ?] => /=; simpl; rewrite IHΓ. Qed.
Lemma
extended_subst_length
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "extended_subst" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
expand_lets_k Γ k t
:= (subst (extended_subst Γ 0) k (lift (context_assumptions Γ) (k + #|Γ|) t)).
Definition
expand_lets_k
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "context_assumptions", "extended_subst", "lift", "subst" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
expand_lets Γ t
:= expand_lets_k Γ 0 t.
Definition
expand_lets
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "expand_lets_k" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
expand_lets_k_ctx Γ k Δ
:= (subst_context (extended_subst Γ 0) k (lift_context (context_assumptions Γ) (k + #|Γ|) Δ)).
Definition
expand_lets_k_ctx
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "context_assumptions", "extended_subst", "lift_context", "subst_context" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
expand_lets_ctx Γ Δ
:= expand_lets_k_ctx Γ 0 Δ.
Definition
expand_lets_ctx
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "expand_lets_k_ctx" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
expand_lets_k_ctx_length Γ k Δ : #|expand_lets_k_ctx Γ k Δ| = #|Δ|.
Proof. now rewrite /expand_lets_k_ctx; len. Qed.
Lemma
expand_lets_k_ctx_length
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "expand_lets_k_ctx", "len" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
expand_lets_ctx_length Γ Δ : #|expand_lets_ctx Γ Δ| = #|Δ|.
Proof. now rewrite /expand_lets_ctx; len. Qed.
Lemma
expand_lets_ctx_length
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "expand_lets_ctx", "len" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
fix_context (m : mfixpoint term) : context
:= List.rev (mapi (fun i d => vass d.(dname) (lift i 0 d.(dtype))) m).
Definition
fix_context
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "context", "lift", "mapi", "mfixpoint", "rev", "term", "vass" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
constructor_body
:= { (** Constructor name, without the module path. *) cstr_name : ident; (** Arguments of the constructor, which can depend on the inductives in the same block and the parameters of the inductive : `ind_bodies ,,, ind_params |- cstr_args`. *) cstr_args : context; (** Indices of the construc...
Record
constructor_body
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "context", "cstr_arity", "ident", "list", "term" ]
Data associated to a single inductive constructor.
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
projection_body
:= { (** Projection name, without the module path. *) proj_name : ident; (** Relevance of the projection. *) proj_relevance : relevance; (** Type of the projection, wich can depend on the parameters of the inductive and on the object we are projecting from : `ind_params ,,, x |- proj_type`. ...
Record
projection_body
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "ident", "relevance", "term" ]
Data associated to a primitive projection.
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
map_constructor_body npars arities f c
:= {| cstr_name := c.(cstr_name); cstr_args := fold_context_k (fun x => f (x + npars + arities)) c.(cstr_args); cstr_indices := map (f (npars + arities + #|c.(cstr_args)|)) c.(cstr_indices); (* Note only after positivity checking we can ensure that the indices do not mention the ind...
Definition
map_constructor_body
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "cstr_arity", "fold_context_k", "map" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
map_projection_body npars f c
:= {| proj_name := c.(proj_name); proj_relevance := c.(proj_relevance); proj_type := f (S npars) c.(proj_type) |}.
Definition
map_projection_body
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[]
Here npars should be the `context_assumptions` of the parameters context.
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
one_inductive_body
:= { (** Name of the inductive, without the module path. *) ind_name : ident; (** Indices of the inductive, which can depend on the parameters : `ind_params |- ind_indices`. *) ind_indices : context; (** Sort of the inductive. *) ind_sort : Sort.t; (** Full type of the inductive. Thi...
Record
one_inductive_body
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "allowed_eliminations", "constructor_body", "context", "ident", "list", "projection_body", "relevance", "term" ]
Data associated to a single inductive in a mutual inductive block.
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
map_one_inductive_body npars arities f m
:= match m with | Build_one_inductive_body ind_name ind_indices ind_sort ind_type ind_kelim ind_ctors ind_projs ind_relevance => Build_one_inductive_body ind_name (fold_context_k (fun x => f (npars + x)) ind_indices) ind_sort (f 0 ind_type) ind_kelim (map (map_constructo...
Definition
map_one_inductive_body
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "fold_context_k", "map", "map_constructor_body", "map_projection_body" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
mutual_inductive_body
:= { (** Whether the block is inductive, coinductive or non-recursive (Records). *) ind_finite : recursivity_kind; (** Number of parameters (including non-uniform ones), _without_ counting let-in parameters. This should be equal to `context_assumptions ind_params`. *) ind_npars : nat; (** Co...
Record
mutual_inductive_body
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "context", "list", "one_inductive_body", "recursivity_kind", "universes_decl" ]
Data associated to a block of mutually inductive types.
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
constant_body
:= { (** Type of the constant. *) cst_type : term; (** Body of the constant. For axioms this is [None]. *) cst_body : option term; (** Whether the constant is universe monomorphic or polymorphic, and if polymorphic information about its local universes. *) cst_universes : universes_decl;...
Record
constant_body
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "relevance", "term", "universes_decl" ]
Data associated to a constant (definition, lemma or axiom).
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
map_constant_body f decl
:= {| cst_type := f decl.(cst_type); cst_body := option_map f decl.(cst_body); cst_universes := decl.(cst_universes); cst_relevance := decl.(cst_relevance) |}.
Definition
map_constant_body
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "option_map" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
map_cst_type f decl : f (cst_type decl) = cst_type (map_constant_body f decl).
Proof. destruct decl; reflexivity. Qed.
Lemma
map_cst_type
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "map_constant_body", "reflexivity" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
map_cst_body f decl : option_map f (cst_body decl) = cst_body (map_constant_body f decl).
Proof. destruct decl; reflexivity. Qed.
Lemma
map_cst_body
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "map_constant_body", "option_map", "reflexivity" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
global_decl
:= | ConstantDecl : constant_body -> global_decl | InductiveDecl : mutual_inductive_body -> global_decl.
Inductive
global_decl
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "constant_body", "mutual_inductive_body" ]
A global declaration is a definition, lemma, axiom or mutual inductive.
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
global_declarations
:= list (kername * global_decl).
Definition
global_declarations
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "global_decl", "kername", "list" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
global_env
:= mk_global_env { universes : ContextSet.t; declarations : global_declarations; retroknowledge : Retroknowledge.t }.
Record
global_env
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "declarations", "global_declarations", "universes" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
universes : global_env >-> ContextSet.t.
Coercion
universes
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "global_env" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
empty_global_env
:= {| universes := ContextSet.empty; declarations := []; retroknowledge := Retroknowledge.empty |}.
Definition
empty_global_env
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "declarations", "empty", "universes" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
add_global_decl Σ decl
:= {| universes := Σ.(universes); declarations := decl :: Σ.(declarations); retroknowledge := Σ.(retroknowledge) |}.
Definition
add_global_decl
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "declarations", "universes" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
eta_global_env Σ : Σ = {| universes := Σ.(universes); declarations := Σ.(declarations); retroknowledge := Σ.(retroknowledge) |}.
Proof. now destruct Σ. Qed.
Lemma
eta_global_env
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "declarations", "universes" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
set_declarations Σ decls
:= {| universes := Σ.(universes); declarations := decls; retroknowledge := Σ.(retroknowledge) |}.
Definition
set_declarations
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "declarations", "universes" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
lookup_global (Σ : global_declarations) (kn : kername) : option global_decl
:= match Σ with | nil => None | d :: tl => if kn == d.1 then Some d.2 else lookup_global tl kn end.
Fixpoint
lookup_global
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "global_decl", "global_declarations", "kername" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
lookup_env (Σ : global_env) (kn : kername)
:= lookup_global Σ.(declarations) kn.
Definition
lookup_env
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "declarations", "global_env", "kername", "lookup_global" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
lookup_globals (Σ : global_declarations) (kn : kername) : list global_decl
:= match Σ with | nil => nil | d :: tl => let tl := lookup_globals tl kn in if kn == d.1 then d.2 :: tl else tl end.
Fixpoint
lookup_globals
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "global_decl", "global_declarations", "kername", "list" ]
version for possibly duplicative environments
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
lookup_envs (Σ : global_env) (kn : kername)
:= lookup_globals Σ.(declarations) kn.
Definition
lookup_envs
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "declarations", "global_env", "kername", "lookup_globals" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_decls_part_globals Σ Σ'
:= (forall c, ∑ decls, lookup_globals Σ' c = decls ++ lookup_globals Σ c) (only parsing).
Notation
extends_decls_part_globals
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "lookup_globals", "Σ'" ]
We define four notions of environment extension. The two configurable bits are: is universe and retroknowledge extension strict ([Logic.eq]) or loose ([⊂_cs] / [Retroknowledge.extends]); and is declaration extension strict (fully order-preserving, i.e., new declarations are added only at the fr...
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
strictly_extends_decls_part_globals Σ Σ'
:= (∑ Σ'', Σ' = Σ'' ++ Σ) (only parsing).
Notation
strictly_extends_decls_part_globals
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_decls_part Σ Σ'
:= (forall c, ∑ decls, lookup_envs Σ' c = decls ++ lookup_envs Σ c) (only parsing).
Notation
extends_decls_part
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "lookup_envs", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
strictly_extends_decls_part Σ Σ'
:= (strictly_extends_decls_part_globals Σ.(declarations) Σ'.(declarations)) (only parsing).
Notation
strictly_extends_decls_part
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "declarations", "strictly_extends_decls_part_globals", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends (Σ Σ' : global_env)
:= [× Σ.(universes) ⊂_cs Σ'.(universes), extends_decls_part Σ Σ' & Retroknowledge.extends Σ.(retroknowledge) Σ'.(retroknowledge)].
Definition
extends
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "extends_decls_part", "global_env", "universes", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_decls (Σ Σ' : global_env)
:= [× Σ.(universes) = Σ'.(universes), extends_decls_part Σ Σ' & Σ.(retroknowledge) = Σ'.(retroknowledge)].
Definition
extends_decls
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "extends_decls_part", "global_env", "universes", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_strictly_on_decls (Σ Σ' : global_env)
:= [× Σ.(universes) ⊂_cs Σ'.(universes), strictly_extends_decls_part Σ Σ' & Retroknowledge.extends Σ.(retroknowledge) Σ'.(retroknowledge)].
Definition
extends_strictly_on_decls
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "extends", "global_env", "strictly_extends_decls_part", "universes", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
strictly_extends_decls (Σ Σ' : global_env)
:= [× Σ.(universes) = Σ'.(universes), strictly_extends_decls_part Σ Σ' & Σ.(retroknowledge) = Σ'.(retroknowledge)].
Definition
strictly_extends_decls
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "global_env", "strictly_extends_decls_part", "universes", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
lookup_global_None Σ kn : ~In kn (List.map fst Σ) <-> lookup_global Σ kn = None.
Proof. move: Σ; elim => //=; try tauto. move => ??; case: eqb_spec; intuition congruence. Qed.
Lemma
lookup_global_None
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "case", "eqb_spec", "fst", "lookup_global", "map", "tauto" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
hd_error_lookup_globals Σ kn : hd_error (lookup_globals Σ kn) = lookup_global Σ kn.
Proof. move: Σ; elim => //= ?? <-. case: eqb_spec => //=. Qed.
Lemma
hd_error_lookup_globals
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "case", "eqb_spec", "lookup_global", "lookup_globals" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
lookup_globals_nil Σ kn : ~In kn (List.map fst Σ) <-> lookup_globals Σ kn = nil.
Proof. rewrite lookup_global_None-hd_error_lookup_globals. case: lookup_globals => //. Qed.
Lemma
lookup_globals_nil
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "case", "fst", "hd_error_lookup_globals", "lookup_global_None", "lookup_globals", "map" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
NoDup_length_lookup_globals Σ : NoDup (List.map fst Σ) -> forall kn, List.length (lookup_globals Σ kn) = match lookup_global Σ kn with | Some _ => 1 | None => 0 ...
Proof. move => H kn. move: Σ H; elim => //=; try lia. move => ?? H. inversion 1; subst. move: (H ltac:(assumption)). case: eqb_spec => //= ->. rewrite (proj1 (@lookup_global_None _ _)) => //= -> //=. Qed.
Lemma
NoDup_length_lookup_globals
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "case", "eqb_spec", "fst", "length", "lookup_global", "lookup_global_None", "lookup_globals", "map", "proj1", "subst" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
NoDup_lookup_globals_eq Σ : NoDup (List.map fst Σ) -> forall kn, lookup_globals Σ kn = match lookup_global Σ kn with | Some v => [v] | None => [] end.
Proof. move => H kn. move: (NoDup_length_lookup_globals Σ H kn) (hd_error_lookup_globals Σ kn). repeat destruct ?; subst. all: case: lookup_globals; cbn; try congruence. move => ? [|]; cbn; congruence. Qed.
Lemma
NoDup_lookup_globals_eq
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "NoDup_length_lookup_globals", "case", "fst", "hd_error_lookup_globals", "lookup_global", "lookup_globals", "map", "subst" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
lookup_globals_In Σ kn decl : In (kn, decl) Σ <-> In decl (lookup_globals Σ kn).
Proof. move: Σ; elim => //=; try tauto. move => [??]?; case: eqb_spec => ? //=; subst => <-; cbn in *; firstorder (subst; auto). all: (idtac + constructor); congruence. Qed.
Lemma
lookup_globals_In
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "case", "constructor", "eqb_spec", "lookup_globals", "subst", "tauto" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
lookup_global_Some_if_In Σ kn decl : lookup_global Σ kn = Some decl -> In (kn, decl) Σ.
Proof. move: Σ; elim => //=; try tauto. move => [??]?; case: eqb_spec => ? IH; inversion 1; subst; try rewrite <- IH by assumption. all: intuition try congruence; subst. Qed.
Lemma
lookup_global_Some_if_In
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "IH", "case", "eqb_spec", "lookup_global", "subst", "tauto" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
lookup_global_Some_iff_In_NoDup Σ kn decl (H : NoDup (List.map fst Σ)) : In (kn, decl) Σ <-> lookup_global Σ kn = Some decl.
Proof. rewrite -hd_error_lookup_globals lookup_globals_In. apply NoDup_length_lookup_globals with (kn:=kn) in H; move: H. case: lookup_global; case: lookup_globals => [|?[]]; cbn. all: try lia. all: intuition congruence. Qed.
Lemma
lookup_global_Some_iff_In_NoDup
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "NoDup_length_lookup_globals", "apply", "case", "fst", "hd_error_lookup_globals", "lookup_global", "lookup_globals", "lookup_globals_In", "map" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
lookup_global_extends_NoDup Σ Σ' k d : NoDup (List.map fst Σ') -> lookup_global Σ k = Some d -> extends_decls_part_globals Σ Σ' -> lookup_global Σ' k = Some d.
Proof. rewrite /= -!hd_error_lookup_globals => Hnd. move: (@NoDup_length_lookup_globals _ Hnd k); clear Hnd. rewrite -hd_error_lookup_globals. move=> H Hd eq. move: (eq k); clear eq. case => ls eq. move: eq Hd H => ->. case: ls => //= ?. case => //=. case: lookup_globals => //=. ...
Lemma
lookup_global_extends_NoDup
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "NoDup_length_lookup_globals", "case", "eq", "extends_decls_part_globals", "fst", "hd_error_lookup_globals", "lookup_global", "lookup_globals", "map", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
lookup_env_extends_NoDup Σ Σ' k d : NoDup (List.map fst Σ'.(declarations)) -> lookup_env Σ k = Some d -> extends Σ Σ' -> lookup_env Σ' k = Some d.
Proof. move => Hnd Hd; case => *. eapply lookup_global_extends_NoDup; tea. Qed.
Lemma
lookup_env_extends_NoDup
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "case", "declarations", "extends", "fst", "lookup_env", "lookup_global_extends_NoDup", "map", "tea", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
lookup_globals_app Σ Σ' kn : lookup_globals (Σ ++ Σ') kn = lookup_globals Σ kn ++ lookup_globals Σ' kn.
Proof. move: Σ. elim => //= ??. case: eqb_spec => //= -> -> //=. Qed.
Lemma
lookup_globals_app
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "case", "eqb_spec", "lookup_globals", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
strictly_extends_decls_extends_part_globals Σ Σ' : strictly_extends_decls_part_globals Σ Σ' -> extends_decls_part_globals Σ Σ'.
Proof. case => //= ? -> c. rewrite lookup_globals_app. eexists; reflexivity. Qed.
Lemma
strictly_extends_decls_extends_part_globals
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "case", "extends_decls_part_globals", "lookup_globals_app", "reflexivity", "strictly_extends_decls_part_globals", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
strictly_extends_decls_extends_part Σ Σ' : strictly_extends_decls_part Σ Σ' -> extends_decls_part Σ Σ'.
Proof. apply strictly_extends_decls_extends_part_globals. Qed.
Lemma
strictly_extends_decls_extends_part
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "apply", "extends_decls_part", "strictly_extends_decls_extends_part_globals", "strictly_extends_decls_part", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
strictly_extends_decls_extends_decls Σ Σ' : strictly_extends_decls Σ Σ' -> extends_decls Σ Σ'.
Proof. destruct Σ, Σ'; case => //= -> ? ->. rewrite /extends_decls; split; try reflexivity. now apply strictly_extends_decls_extends_part. Qed.
Instance
strictly_extends_decls_extends_decls
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "apply", "case", "extends_decls", "reflexivity", "split", "strictly_extends_decls", "strictly_extends_decls_extends_part", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
strictly_extends_decls_extends_strictly_on_decls Σ Σ' : strictly_extends_decls Σ Σ' -> extends_strictly_on_decls Σ Σ'.
Proof. destruct Σ, Σ'; intros []. cbn in *; subst. split => //=. split; [lsets|csets]. apply Retroknowledge.extends_refl. Qed.
Instance
strictly_extends_decls_extends_strictly_on_decls
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "apply", "csets", "extends_refl", "extends_strictly_on_decls", "lsets", "split", "strictly_extends_decls", "subst", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_decls_extends Σ Σ' : extends_decls Σ Σ' -> extends Σ Σ'.
Proof. destruct Σ, Σ'; intros []. cbn in *; subst. split => //=. split; [lsets|csets]. apply Retroknowledge.extends_refl. Qed.
Instance
extends_decls_extends
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "apply", "csets", "extends", "extends_decls", "extends_refl", "lsets", "split", "subst", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_strictly_on_decls_extends Σ Σ' : extends_strictly_on_decls Σ Σ' -> extends Σ Σ'.
Proof. destruct Σ, Σ'; case => //= ? ? ?. rewrite /extends; split => //=. now apply strictly_extends_decls_extends_part. Qed.
Instance
extends_strictly_on_decls_extends
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "apply", "case", "extends", "extends_strictly_on_decls", "split", "strictly_extends_decls_extends_part", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
strictly_extends_decls_extends_decls_subrel : CRelationClasses.subrelation strictly_extends_decls extends_decls
:= strictly_extends_decls_extends_decls.
Instance
strictly_extends_decls_extends_decls_subrel
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "extends_decls", "strictly_extends_decls", "strictly_extends_decls_extends_decls" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
strictly_extends_decls_extends_strictly_on_decls_subrel : CRelationClasses.subrelation strictly_extends_decls extends_strictly_on_decls
:= strictly_extends_decls_extends_strictly_on_decls.
Instance
strictly_extends_decls_extends_strictly_on_decls_subrel
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "extends_strictly_on_decls", "strictly_extends_decls", "strictly_extends_decls_extends_strictly_on_decls" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_decls_extends_subrel : CRelationClasses.subrelation extends_decls extends
:= extends_decls_extends.
Instance
extends_decls_extends_subrel
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "extends", "extends_decls", "extends_decls_extends" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_strictly_on_decls_extends_subrel : CRelationClasses.subrelation extends_strictly_on_decls extends
:= extends_strictly_on_decls_extends.
Instance
extends_strictly_on_decls_extends_subrel
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "extends", "extends_strictly_on_decls", "extends_strictly_on_decls_extends" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
strictly_extends_decls_extends_subrel : CRelationClasses.subrelation strictly_extends_decls extends
:= fun _ => _.
Instance
strictly_extends_decls_extends_subrel
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "extends", "strictly_extends_decls" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
strictly_extends_decls_refl : CRelationClasses.Reflexive strictly_extends_decls.
Proof. red. intros x. split => //; try exists [] => //. Qed.
Instance
strictly_extends_decls_refl
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "Reflexive", "red", "split", "strictly_extends_decls" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_decls_refl : CRelationClasses.Reflexive extends_decls.
Proof. red. intros x. split => //; try exists [] => //. Qed.
Instance
extends_decls_refl
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "Reflexive", "extends_decls", "red", "split" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_strictly_on_decls_refl : CRelationClasses.Reflexive extends_strictly_on_decls.
Proof. red. intros x. split; [apply incl_cs_refl | try exists [] => // | apply Retroknowledge.extends_refl]. Qed.
Lemma
extends_strictly_on_decls_refl
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "Reflexive", "apply", "extends_refl", "extends_strictly_on_decls", "incl_cs_refl", "red", "split" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_refl : CRelationClasses.Reflexive extends.
Proof. red. intros x. split; [apply incl_cs_refl | try exists [] => // | apply Retroknowledge.extends_refl]. Qed.
Lemma
extends_refl
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "Reflexive", "apply", "extends", "incl_cs_refl", "red", "split" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_decls_part_globals_refl Σ : extends_decls_part_globals Σ Σ.
Proof. now exists [] => //. Qed.
Lemma
extends_decls_part_globals_refl
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "extends_decls_part_globals" ]
easy prefers this to the local hypotheses, which is annoying #[global] Instance extends_refl : CRelationClasses.Reflexive extends. Proof. apply extends_refl. Qed.
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_decls_part_refl Σ : extends_decls_part Σ Σ.
Proof. apply extends_decls_part_globals_refl. Qed.
Lemma
extends_decls_part_refl
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "apply", "extends_decls_part", "extends_decls_part_globals_refl" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
strictly_extends_decls_part_globals_refl (Σ : global_declarations) : strictly_extends_decls_part_globals Σ Σ.
Proof. now exists [] => //. Qed.
Lemma
strictly_extends_decls_part_globals_refl
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "global_declarations", "strictly_extends_decls_part_globals" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
strictly_extends_decls_part_refl Σ : strictly_extends_decls_part Σ Σ.
Proof. apply strictly_extends_decls_part_globals_refl. Qed.
Lemma
strictly_extends_decls_part_refl
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "apply", "strictly_extends_decls_part", "strictly_extends_decls_part_globals_refl" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_decls_part_globals_trans Σ Σ' Σ'' : extends_decls_part_globals Σ Σ' -> extends_decls_part_globals Σ' Σ'' -> extends_decls_part_globals Σ Σ''.
Proof. move => H1 H2 c; move: (H1 c) (H2 c) => [? ->] [? ->]. now eexists; rewrite app_assoc. Qed.
Lemma
extends_decls_part_globals_trans
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "app_assoc", "extends_decls_part_globals", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_decls_part_trans Σ Σ' Σ'' : extends_decls_part Σ Σ' -> extends_decls_part Σ' Σ'' -> extends_decls_part Σ Σ''.
Proof. apply extends_decls_part_globals_trans. Qed.
Lemma
extends_decls_part_trans
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "apply", "extends_decls_part", "extends_decls_part_globals_trans", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
strictly_extends_decls_part_globals_trans (Σ Σ' Σ'' : global_declarations) : strictly_extends_decls_part_globals Σ Σ' -> strictly_extends_decls_part_globals Σ' Σ'' -> strictly_extends_decls_part_globals Σ Σ''.
Proof. move => [? ->] [? ->]. now eexists; rewrite app_assoc. Qed.
Lemma
strictly_extends_decls_part_globals_trans
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "app_assoc", "global_declarations", "strictly_extends_decls_part_globals", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
strictly_extends_decls_part_trans Σ Σ' Σ'' : strictly_extends_decls_part Σ Σ' -> strictly_extends_decls_part Σ' Σ'' -> strictly_extends_decls_part Σ Σ''.
Proof. apply strictly_extends_decls_part_globals_trans. Qed.
Lemma
strictly_extends_decls_part_trans
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "apply", "strictly_extends_decls_part", "strictly_extends_decls_part_globals_trans", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_trans_t
:= intros [?] [?] [?] [?] [?]; red; cbn in *; split; try solve [ etransitivity; eassumption | eapply incl_cs_trans; eassumption | eapply strictly_extends_decls_part_globals_trans; eassumption | eapply extends_decls_part_globals_trans; eassumption ].
Ltac
extends_trans_t
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "extends_decls_part_globals_trans", "incl_cs_trans", "red", "split", "strictly_extends_decls_part_globals_trans" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
strictly_extends_decls_trans : CRelationClasses.Transitive strictly_extends_decls.
Proof. extends_trans_t. Qed.
Instance
strictly_extends_decls_trans
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "Transitive", "extends_trans_t", "strictly_extends_decls" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_decls_trans : CRelationClasses.Transitive extends_decls.
Proof. extends_trans_t. Qed.
Instance
extends_decls_trans
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "Transitive", "extends_decls", "extends_trans_t" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_strictly_on_decls_trans : CRelationClasses.Transitive extends_strictly_on_decls.
Proof. extends_trans_t. Qed.
Instance
extends_strictly_on_decls_trans
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "Transitive", "extends_strictly_on_decls", "extends_trans_t" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
extends_trans : CRelationClasses.Transitive extends.
Proof. extends_trans_t. Qed.
Instance
extends_trans
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "Transitive", "extends", "extends_trans_t" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
declared_kername_set (Σ : global_declarations) : KernameSet.t
:= List.fold_right KernameSet.add KernameSet.empty (List.map fst Σ).
Definition
declared_kername_set
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "add", "empty", "fst", "global_declarations", "map" ]
Merge two lists of global_declarations, assuming that any globals sharing a name are identical
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
merge_globals (Σ Σ' : global_declarations) : global_declarations
:= let known_kns := declared_kername_set Σ in List.filter (fun '(kn, _) => negb (KernameSet.mem kn known_kns)) Σ' ++ Σ.
Definition
merge_globals
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "declared_kername_set", "global_declarations", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
merge_global_envs (Σ Σ' : global_env) : global_env
:= {| universes := ContextSet.union Σ.(universes) Σ'.(universes) ; declarations := merge_globals Σ.(declarations) Σ'.(declarations) ; retroknowledge := Retroknowledge.merge Σ.(retroknowledge) Σ'.(retroknowledge) |}.
Definition
merge_global_envs
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "declarations", "global_env", "merge", "merge_globals", "union", "universes", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
compatible_globals (Σ Σ' : global_declarations) : Prop
:= forall c, lookup_globals Σ c <> [] -> lookup_globals Σ' c <> [] -> lookup_globals Σ c = lookup_globals Σ' c.
Definition
compatible_globals
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "global_declarations", "lookup_globals", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
compatible (Σ Σ' : global_env)
:= Retroknowledge.compatible Σ.(retroknowledge) Σ'.(retroknowledge) /\ compatible_globals Σ.(declarations) Σ'.(declarations).
Definition
compatible
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "compatible_globals", "declarations", "global_env", "Σ'" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209
lookup_globals_filter p Σ c : lookup_globals (filter (fun '(kn, _) => p kn) Σ) c = if p c then lookup_globals Σ c else [].
Proof. induction Σ as [|?? IH]; cbn; rdest; cbn; try now repeat destruct ?. case: eqb_spec => ?; repeat destruct ?; subst => //=. all: rewrite ?eqb_refl. all: try case: eqb_spec => ?; subst. all: rewrite IH //=. all: try congruence. Qed.
Lemma
lookup_globals_filter
common.theories
common/theories/Environment.v
[ "Stdlib", "ssreflect", "ssrbool", "ssrfun", "Morphisms", "Setoid", "MetaRocq.Utils", "utils", "MetaRocq.Common", "BasicAst", "Primitive", "Universes", "Equations.Prop", "Classes", "EqDecInstances", "hints", "Retroknowledge", "T", "E" ]
[ "IH", "case", "eqb_refl", "eqb_spec", "lookup_globals", "rdest", "subst" ]
https://github.com/MetaCoq/metacoq
971b2cc5c8bdc011068f67fa272245d8e5b54209