fact
stringlengths
7
3.87k
type
stringclasses
24 values
library
stringclasses
13 values
imports
listlengths
0
72
filename
stringclasses
416 values
symbolic_name
stringlengths
1
67
docstring
stringclasses
596 values
TslIdent := { tsl_ident : ident -> ident }.
Class
examples
[ "MetaRocq.Utils", "All", "utils", "MetaRocq.Template" ]
examples/add_constructor.v
TslIdent
** Auxiliary functions
prime_tsl_ident : TslIdent := {| tsl_ident := fun id => id ^ "'" |}.
Instance
examples
[ "MetaRocq.Utils", "All", "utils", "MetaRocq.Template" ]
examples/add_constructor.v
prime_tsl_ident
null
try_remove_n_lambdas (n : nat) (t : term) {struct n} : term := match n, t with | 0, _ => t | S n, tLambda _ _ t => try_remove_n_lambdas n t | S _, _ => t end.
Fixpoint
examples
[ "MetaRocq.Utils", "All", "utils", "MetaRocq.Template" ]
examples/add_constructor.v
try_remove_n_lambdas
null
tsl_constructor_body (c : constructor_body) : constructor_body := {| cstr_name := tsl_ident c.(cstr_name); cstr_args := cstr_args c; cstr_indices := cstr_indices c; cstr_type := cstr_type c; cstr_arity := cstr_arity c |}.
Definition
examples
[ "MetaRocq.Utils", "All", "utils", "MetaRocq.Template" ]
examples/add_constructor.v
tsl_constructor_body
* Plugin
remove_last_n {A} (l : list A) (n : nat) : list A := firstn (#|l| - n) l.
Definition
examples
[ "MetaRocq.Utils", "All", "utils", "MetaRocq.Template" ]
examples/add_constructor.v
remove_last_n
null
new_cstr mdecl (idc : ident) (ctor : term) : constructor_body := let '(args, concl) := decompose_prod_assum [] ctor in let (hd, indices) := decompose_app concl in {| cstr_name := idc; cstr_args := remove_last_n args #|mdecl.(ind_params)|; cstr_indices := skipn mdecl.(ind_npars) indices; cstr_type := ctor; cstr_arity := context_assumptions args |}.
Definition
examples
[ "MetaRocq.Utils", "All", "utils", "MetaRocq.Template" ]
examples/add_constructor.v
new_cstr
null
test := bool'.
Definition
examples
[ "MetaRocq.Utils", "All", "utils", "MetaRocq.Template" ]
examples/add_constructor.v
test
Here we add a silly constructor to bool.
test' : nat -> bool' -> bool -> bool' := foo.
Definition
examples
[ "MetaRocq.Utils", "All", "utils", "MetaRocq.Template" ]
examples/add_constructor.v
test
null
tm := | var : nat -> tm | lam : tm -> tm | app : tm -> tm -> tm.
Inductive
examples
[ "MetaRocq.Utils", "All", "utils", "MetaRocq.Template" ]
examples/add_constructor.v
tm
Here is a useful usecase: add a case to a syntax.
test2 := letin.
Definition
examples
[ "MetaRocq.Utils", "All", "utils", "MetaRocq.Template" ]
examples/add_constructor.v
test2
null
test3 := foo'.
Definition
examples
[ "MetaRocq.Utils", "All", "utils", "MetaRocq.Template" ]
examples/add_constructor.v
test3
null
test4 := foo''.
Definition
examples
[ "MetaRocq.Utils", "All", "utils", "MetaRocq.Template" ]
examples/add_constructor.v
test4
null
constructor (goal : Ast.term): TemplateMonad typed_term := let '(hd, iargs) := decompose_app goal in match hd with | Ast.tInd ind u => qi <- tmQuoteInductive (inductive_mind ind) ;; match nth_error qi.(Ast.Env.ind_bodies) (inductive_ind ind) with | Some oib => let cstrs := Ast.Env.ind_ctors oib in match cstrs with | [] => tmFail "no constructor in this inductive type" | hd :: _ => let args := cstr_args hd in let params := firstn qi.(ind_npars) iargs in let args := (params ++ map (fun _ => Ast.hole) args)%list in let term := Ast.tApp (Ast.tConstruct ind 0 u) args in term' <- tmEval all term ;; tmUnquote term' end | None => tmFail "anomaly" end | _ => tmFail "goal is not an inductive type" end.
Definition
examples
[ "Stdlib", "List", "Loader", "MetaRocq.Template", "All" ]
examples/constructor_tac.v
constructor
null
constructor_tac := match goal with |- ?T => let k tm := refine tm.(my_projT2) in unshelve quote_term T ltac:(fun gl => run_template_program (constructor gl) k) end.
Ltac
examples
[ "Stdlib", "List", "Loader", "MetaRocq.Template", "All" ]
examples/constructor_tac.v
constructor_tac
null
d : Ast.term.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
d
Build a definition *
id_nat : nat -> nat := fun x => x.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
id_nat
To quote existing definitions *
add (a b : nat) : nat := match a with | 0 => b | S a => S (add a b) end.
Fixpoint
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
add
Fixpoints *
add' (a b : nat) : nat := match b with | 0 => a | S b => S (add' a b) end.
Fixpoint
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
add
null
even (a : nat) : bool := match a with | 0 => true | S a => odd a end with odd (a : nat) : bool := match a with | 0 => false | S a => even a end.
Fixpoint
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
even
null
Nat_module := (MPfile ["Datatypes"; "Init"; "Corelib"], "nat").
Notation
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
Nat_module
null
prod' A B : Type := pair' { fst' : A ; snd' : B }.
Record
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
prod
null
one_i : one_inductive_entry := {| mind_entry_typename := "demoBool"; mind_entry_arity := tSort Sort.type0; mind_entry_consnames := ["demoTrue"; "demoFalse"]; mind_entry_lc := [tRel 1; tRel 1]; |}.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
one_i
Reflecting Inductives
one_i2 : one_inductive_entry := {| mind_entry_typename := "demoBool2"; mind_entry_arity := tSort Sort.type0; mind_entry_consnames := ["demoTrue2"; "demoFalse2"]; mind_entry_lc := [tRel 0; tRel 0]; |}.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
one_i2
null
mut_i : mutual_inductive_entry := {| mind_entry_record := None; mind_entry_finite := Finite; mind_entry_params := []; mind_entry_inds := [one_i; one_i2]; mind_entry_universes := Monomorphic_entry (LevelSet.empty, ConstraintSet.empty); mind_entry_template := false; mind_entry_variance := None; mind_entry_private := None; |}.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
mut_i
null
anonb := {| binder_name := nAnon; binder_relevance := Relevant |}.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
anonb
null
bnamed n := {| binder_name := nNamed n; binder_relevance := Relevant |}.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
bnamed
null
mkImpl (A B : term) : term := tProd anonb A B.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
mkImpl
null
one_list_i : one_inductive_entry := {| mind_entry_typename := "demoList"; mind_entry_arity := tSort Sort.type0; mind_entry_consnames := ["demoNil"; "demoCons"]; mind_entry_lc := [tApp (tRel 1) [tRel 0]; mkImpl (tRel 0) (mkImpl (tApp (tRel 2) [tRel 1]) (tApp (tRel 3) [tRel 2]))]; |}.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
one_list_i
null
mut_list_i : mutual_inductive_entry := {| mind_entry_record := None; mind_entry_finite := Finite; mind_entry_params := [{| decl_name := bnamed "A"; decl_body := None; decl_type := (tSort Sort.type0) |}]; mind_entry_inds := [one_list_i]; mind_entry_universes := Monomorphic_entry (LevelSet.empty, ConstraintSet.empty); mind_entry_template := false; mind_entry_variance := None; mind_entry_private := None; |}.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
mut_list_i
null
one_pt_i : one_inductive_entry := {| mind_entry_typename := "Point"; mind_entry_arity := tSort Sort.type0; mind_entry_consnames := ["mkPoint"]; mind_entry_lc := [ mkImpl (tRel 0) (mkImpl (tRel 1) (tApp (tRel 3) [tRel 2]))]; |}.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
one_pt_i
Records
mut_pt_i : mutual_inductive_entry := {| mind_entry_record := Some (Some "pp"); mind_entry_finite := BiFinite; mind_entry_params := [{| decl_name := bnamed "A"; decl_body := None; decl_type := (tSort Sort.type0) |}]; mind_entry_inds := [one_pt_i]; mind_entry_universes := Monomorphic_entry ContextSet.empty; mind_entry_template := false; mind_entry_variance := None; mind_entry_private := None; |}.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
mut_pt_i
null
demoList (A : Set) : Set := demoNil : demoList A | demoCons : A -> demoList A -> demoList A *) Notation inat := {| inductive_mind := Nat_module; inductive_ind := 0 |}.
Inductive
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
demoList
null
inat := {| inductive_mind := Nat_module; inductive_ind := 0 |}.
Notation
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
inat
Putting the above commands in monadic program
printInductive (q : qualid): TemplateMonad unit := kn <- tmLocate1 q ;; match kn with | IndRef ind => (tmQuoteInductive ind.(inductive_mind)) >>= tmPrint | _ => tmFail ("[" ^ q ^ "] is not an inductive") end.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
printInductive
null
cnat : Set := O :cnat | S : cnat -> cnat.
CoInductive
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
cnat
null
printConstant (q : qualid) b : TemplateMonad unit := kn <- tmLocate1 q ;; match kn with | ConstRef kn => (tmQuoteConstant kn b) >>= tmPrint | _ => tmFail ("[" ^ q ^ "] is not a constant") end.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
printConstant
null
six : nat.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
six
null
printConstant' (name : qualid): TemplateMonad unit := gr <- tmLocate1 name ;; match gr with | ConstRef kn => X <- tmUnquote (tConst kn []) ;; X' <- tmEval all (my_projT2 X) ;; tmPrint X' | _ => tmFail ("[" ^ name ^ "] is not a constant") end.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
printConstant
null
NonRec (A:Set) (C: A -> Set): Set := | SS : forall (f:A), C f -> NonRec A C.
Inductive
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
NonRec
null
T : Type := | toto : Type -> T.
Inductive
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
T
null
streamn : Set := scons : nat -> streamn -> streamn.
CoInductive
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
streamn
Cofixpoints
ones : streamn := scons 1 ones.
CoFixpoint
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
ones
null
kername_of_qualid (q : qualid) : TemplateMonad kername := gr <- tmLocate1 q ;; match gr with | ConstRef kn => ret kn | IndRef ind => ret ind.(inductive_mind) | ConstructRef ind _ => ret ind.(inductive_mind) | VarRef _ => tmFail ("tmLocate: " ^ q ^ " is a Var") end.
Definition
examples
[ "Stdlib", "MetaRocq.Utils", "MetaRocq.Template", "All", "utils" ]
examples/demo.v
kername_of_qualid
Cofixpoints
foo := (fun x : nat => fun x : nat => x).
Definition
examples
[ "PCUICCumulativity", "MetaRocq.Template", "PCUICSafeChecker", "All", "utils", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "Erasure", "PCUICSafeRetyping", "metarocq_tour_prelude", "PCUICTypeChecker", "PCUICAst", "TemplateMonad", "config", "PCUICErrors", "MetaRocq.SafeCheckerPlugin", "PCUICReduction", "PCUICSafeLemmata", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.ErasurePlugin", "MetaRocq.Utils", "PCUICWfEnv", "MetaRocq.Examples", "PCUICWfEnvImpl" ]
examples/metarocq_tour.v
foo
null
test (p : Ast.Env.program) : string := erase_and_print_template_program default_erasure_config [] p.
Definition
examples
[ "PCUICCumulativity", "MetaRocq.Template", "PCUICSafeChecker", "All", "utils", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "Erasure", "PCUICSafeRetyping", "metarocq_tour_prelude", "PCUICTypeChecker", "PCUICAst", "TemplateMonad", "config", "PCUICErrors", "MetaRocq.SafeCheckerPlugin", "PCUICReduction", "PCUICSafeLemmata", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.ErasurePlugin", "MetaRocq.Utils", "PCUICWfEnv", "MetaRocq.Examples", "PCUICWfEnvImpl" ]
examples/metarocq_tour.v
test
Running erasure live in Rocq
zerocst := Eval lazy in test zero.
Definition
examples
[ "PCUICCumulativity", "MetaRocq.Template", "PCUICSafeChecker", "All", "utils", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "Erasure", "PCUICSafeRetyping", "metarocq_tour_prelude", "PCUICTypeChecker", "PCUICAst", "TemplateMonad", "config", "PCUICErrors", "MetaRocq.SafeCheckerPlugin", "PCUICReduction", "PCUICSafeLemmata", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.ErasurePlugin", "MetaRocq.Utils", "PCUICWfEnv", "MetaRocq.Examples", "PCUICWfEnvImpl" ]
examples/metarocq_tour.v
zerocst
null
singleton_elim := ((fun (X : Set) (x : X) (e : x = x) => match e in eq _ x' return bool with | eq_refl => true end)).
Definition
examples
[ "PCUICCumulativity", "MetaRocq.Template", "PCUICSafeChecker", "All", "utils", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "Erasure", "PCUICSafeRetyping", "metarocq_tour_prelude", "PCUICTypeChecker", "PCUICAst", "TemplateMonad", "config", "PCUICErrors", "MetaRocq.SafeCheckerPlugin", "PCUICReduction", "PCUICSafeLemmata", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.ErasurePlugin", "MetaRocq.Utils", "PCUICWfEnv", "MetaRocq.Examples", "PCUICWfEnvImpl" ]
examples/metarocq_tour.v
singleton_elim
null
Instance default_checker_flags.
Existing
examples
[ "PCUICLiftSubst", "Equations", "MetaRocq.Template", "PCUICSafeChecker", "utils", "PCUICSN", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "PCUICTypeChecker", "Universes", "PCUICAst", "PCUICAstUtils", "config", "PCUICErrors", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.Utils", "PCUICWfEnv", "PCUICWfEnvImpl" ]
examples/metarocq_tour_prelude.v
Instance
null
Instance default_normalizing.
Existing
examples
[ "PCUICLiftSubst", "Equations", "MetaRocq.Template", "PCUICSafeChecker", "utils", "PCUICSN", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "PCUICTypeChecker", "Universes", "PCUICAst", "PCUICAstUtils", "config", "PCUICErrors", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.Utils", "PCUICWfEnv", "PCUICWfEnvImpl" ]
examples/metarocq_tour_prelude.v
Instance
null
bAnon := {| binder_name := nAnon; binder_relevance := Relevant |}.
Definition
examples
[ "PCUICLiftSubst", "Equations", "MetaRocq.Template", "PCUICSafeChecker", "utils", "PCUICSN", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "PCUICTypeChecker", "Universes", "PCUICAst", "PCUICAstUtils", "config", "PCUICErrors", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.Utils", "PCUICWfEnv", "PCUICWfEnvImpl" ]
examples/metarocq_tour_prelude.v
bAnon
null
bNamed s := {| binder_name := nNamed s; binder_relevance := Relevant |}.
Definition
examples
[ "PCUICLiftSubst", "Equations", "MetaRocq.Template", "PCUICSafeChecker", "utils", "PCUICSN", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "PCUICTypeChecker", "Universes", "PCUICAst", "PCUICAstUtils", "config", "PCUICErrors", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.Utils", "PCUICWfEnv", "PCUICWfEnvImpl" ]
examples/metarocq_tour_prelude.v
bNamed
null
tImpl X Y := tProd bAnon X (lift0 1 Y).
Definition
examples
[ "PCUICLiftSubst", "Equations", "MetaRocq.Template", "PCUICSafeChecker", "utils", "PCUICSN", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "PCUICTypeChecker", "Universes", "PCUICAst", "PCUICAstUtils", "config", "PCUICErrors", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.Utils", "PCUICWfEnv", "PCUICWfEnvImpl" ]
examples/metarocq_tour_prelude.v
tImpl
null
univ := Level.level "s".
Definition
examples
[ "PCUICLiftSubst", "Equations", "MetaRocq.Template", "PCUICSafeChecker", "utils", "PCUICSN", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "PCUICTypeChecker", "Universes", "PCUICAst", "PCUICAstUtils", "config", "PCUICErrors", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.Utils", "PCUICWfEnv", "PCUICWfEnvImpl" ]
examples/metarocq_tour_prelude.v
univ
null
gctx : global_env_ext := ({| universes := (LS.union (LevelSet.singleton Level.lzero) (LevelSet.singleton univ), ConstraintSet.empty); declarations := []; retroknowledge := Retroknowledge.empty |}, Monomorphic_ctx).
Definition
examples
[ "PCUICLiftSubst", "Equations", "MetaRocq.Template", "PCUICSafeChecker", "utils", "PCUICSN", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "PCUICTypeChecker", "Universes", "PCUICAst", "PCUICAstUtils", "config", "PCUICErrors", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.Utils", "PCUICWfEnv", "PCUICWfEnvImpl" ]
examples/metarocq_tour_prelude.v
gctx
null
kername_of_string (s : string) : kername := (MPfile [], s).
Definition
examples
[ "PCUICLiftSubst", "Equations", "MetaRocq.Template", "PCUICSafeChecker", "utils", "PCUICSN", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "PCUICTypeChecker", "Universes", "PCUICAst", "PCUICAstUtils", "config", "PCUICErrors", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.Utils", "PCUICWfEnv", "PCUICWfEnvImpl" ]
examples/metarocq_tour_prelude.v
kername_of_string
We use the environment checker to produce the proof that gctx, which is a singleton with only universe "s" declared is well-formed.
Instance normalization.
Existing
examples
[ "PCUICLiftSubst", "Equations", "MetaRocq.Template", "PCUICSafeChecker", "utils", "PCUICSN", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "PCUICTypeChecker", "Universes", "PCUICAst", "PCUICAstUtils", "config", "PCUICErrors", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.Utils", "PCUICWfEnv", "PCUICWfEnvImpl" ]
examples/metarocq_tour_prelude.v
Instance
null
assume_normalization : Normalization.
Instance
examples
[ "PCUICLiftSubst", "Equations", "MetaRocq.Template", "PCUICSafeChecker", "utils", "PCUICSN", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "PCUICTypeChecker", "Universes", "PCUICAst", "PCUICAstUtils", "config", "PCUICErrors", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.Utils", "PCUICWfEnv", "PCUICWfEnvImpl" ]
examples/metarocq_tour_prelude.v
assume_normalization
We use the environment checker to produce the proof that gctx, which is a singleton with only universe "s" declared is well-formed.
make_wf_env_ext (Σ : global_env_ext) : EnvCheck wf_env_ext wf_env_ext := '(exist Σ' pf) <- check_wf_ext optimized_abstract_env_impl Σ ;; ret Σ'.
Definition
examples
[ "PCUICLiftSubst", "Equations", "MetaRocq.Template", "PCUICSafeChecker", "utils", "PCUICSN", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "PCUICTypeChecker", "Universes", "PCUICAst", "PCUICAstUtils", "config", "PCUICErrors", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.Utils", "PCUICWfEnv", "PCUICWfEnvImpl" ]
examples/metarocq_tour_prelude.v
make_wf_env_ext
null
gctx_wf_env : wf_env_ext.
Definition
examples
[ "PCUICLiftSubst", "Equations", "MetaRocq.Template", "PCUICSafeChecker", "utils", "PCUICSN", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "PCUICTypeChecker", "Universes", "PCUICAst", "PCUICAstUtils", "config", "PCUICErrors", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.Utils", "PCUICWfEnv", "PCUICWfEnvImpl" ]
examples/metarocq_tour_prelude.v
gctx_wf_env
null
inh (Σ : wf_env_ext) Γ T := (∑ t, forall Σ0 : global_env_ext, abstract_env_ext_rel Σ Σ0 -> ∥ typing Σ0 Γ t T ∥).
Definition
examples
[ "PCUICLiftSubst", "Equations", "MetaRocq.Template", "PCUICSafeChecker", "utils", "PCUICSN", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "PCUICTypeChecker", "Universes", "PCUICAst", "PCUICAstUtils", "config", "PCUICErrors", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.Utils", "PCUICWfEnv", "PCUICWfEnvImpl" ]
examples/metarocq_tour_prelude.v
inh
There is always a proof of `forall x : Sort s, x -> x`
check_inh (Σ : wf_env_ext) Γ (wfΓ : forall Σ0 : global_env_ext, abstract_env_ext_rel Σ Σ0 -> ∥ wf_local Σ0 Γ ∥) t {T} : typing_result (inh Σ Γ T) := prf <- check_type_wf_env_fast optimized_abstract_env_impl Σ Γ wfΓ t (T := T) ;; ret (t; prf).
Definition
examples
[ "PCUICLiftSubst", "Equations", "MetaRocq.Template", "PCUICSafeChecker", "utils", "PCUICSN", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "PCUICTypeChecker", "Universes", "PCUICAst", "PCUICAstUtils", "config", "PCUICErrors", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.Utils", "PCUICWfEnv", "PCUICWfEnvImpl" ]
examples/metarocq_tour_prelude.v
check_inh
null
fill_inh t := lazymatch goal with [ wfΓ : forall _ _ , ∥ wf_local _ ?Γ ∥ |- inh ?Σ ?Γ ?T ] => let t := uconstr:(check_inh Σ Γ wfΓ t (T:=T)) in let proof := eval cbn in t in match proof with | Checked ?d => exact_no_check d | TypeError ?e => let str := eval cbn in (string_of_type_error Σ e) in fail "Failed to inhabit " T " : " str | _ => fail "Anomaly: unexpected return value: " proof end | [ |- inh _ ?Γ _ ] => fail "Missing local wellformedness assumption for" Γ end.
Ltac
examples
[ "PCUICLiftSubst", "Equations", "MetaRocq.Template", "PCUICSafeChecker", "utils", "PCUICSN", "PCUICTyping", "MetaRocq.SafeChecker", "Loader", "PCUICTypeChecker", "Universes", "PCUICAst", "PCUICAstUtils", "config", "PCUICErrors", "MetaRocq.PCUIC", "MetaRocq.Common", "MetaRocq.Utils", "PCUICWfEnv", "PCUICWfEnvImpl" ]
examples/metarocq_tour_prelude.v
fill_inh
null
banon := {| binder_name := nAnon; binder_relevance := Relevant |}.
Definition
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
banon
null
bnamed n := {| binder_name := nNamed n; binder_relevance := Relevant |}.
Definition
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
bnamed
null
Instance config.default_checker_flags.
Existing
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
Instance
null
var := nat.
Definition
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
var
null
eq_var (x y:var) : {x=y}+{x<>y}.
Lemma
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
eq_var
null
form := | Var (x:var) | Fa | Tr | Imp (f1 f2:form) | And (f1 f2:form) | Or (f1 f2:form).
Inductive
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
form
null
eq_form (f1 f2:form) : {f1=f2}+{f1<>f2}.
Lemma
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
eq_form
null
not f := Imp f Fa.
Definition
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
not
null
seq := mkS { hyps : list form; concl : form }.
Record
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
seq
null
size f := match f with | Fa | Tr => 1 | Var _ => 1 | Imp f1 f2 => S (size f1 + size f2) | And f1 f2 => S (size f1 + size f2) | Or f1 f2 => S (size f1 + size f2) end.
Fixpoint
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
size
null
hyps_size h := List.fold_right (fun h n => n + size h) 0 h.
Definition
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
hyps_size
null
seq_size s := hyps_size (hyps s) + size (concl s).
Definition
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
seq_size
null
is_leaf s := let cl := concl s in List.fold_right (fun h b => orb b (if eq_form Fa h then true else if eq_form h cl then true else false)) false (hyps s).
Definition
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
is_leaf
null
Propositional_Logic prop := { Pfalse : prop; Ptrue : prop; Pand : prop -> prop -> prop ; Por : prop -> prop -> prop ; Pimpl : prop -> prop -> prop}.
Class
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
Propositional_Logic
null
semGen A `{Propositional_Logic A} f (l:var->A) := match f with | Fa => Pfalse | Tr => Ptrue | Var x => l x | Imp a b => Pimpl (semGen A a l) (semGen A b l) | And a b => Pand (semGen A a l) (semGen A b l) | Or a b => Por (semGen A a l) (semGen A b l) end.
Fixpoint
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
semGen
null
Propositional_Logic_Prop : Propositional_Logic Prop := {| Pfalse := False; Ptrue := True; Pand := and; Por := or; Pimpl := fun A B => A -> B |}.
Instance
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
Propositional_Logic_Prop
null
sem := semGen Prop.
Definition
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
sem
null
valid s := forall l, (forall h, In h (hyps s) -> sem h l) -> sem (concl s) l.
Definition
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
valid
null
is_leaf_sound s : is_leaf s = true -> valid s.
Lemma
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
is_leaf_sound
null
subgoal := list (list seq).
Definition
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
subgoal
null
valid_subgoal (sg:subgoal) := exists2 sl, In sl sg & forall s, In s sl -> valid s.
Definition
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
valid_subgoal
null
pick_hyp {A} (h:list A) := match h with | nil => nil | a::l => (a,l)::List.map (fun p => (fst p,a::snd p)) (pick_hyp l) end.
Fixpoint
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
pick_hyp
null
on_hyp h rh cl := match h with | Imp a b => (mkS (b::rh) cl:: mkS rh a ::nil) :: nil | And a b => (mkS(a::b::rh)cl::nil)::nil | Or a b => (mkS(a::rh)cl::mkS(b::rh)cl::nil)::nil | (Var _|Tr|Fa) => nil end.
Definition
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
on_hyp
null
on_hyps s : subgoal := List.flat_map (fun p:form*list form => let (h,rh) := p in on_hyp h rh (concl s)) (pick_hyp (hyps s)).
Definition
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
on_hyps
null
decomp_step s : subgoal := match concl s with | Imp a b => (mkS (a::hyps s) b::nil)::nil | And a b => (mkS (hyps s) a::mkS (hyps s) b::nil)::nil | Or a b => (mkS(hyps s)a::nil)::(mkS(hyps s) b::nil)::on_hyps s | _ => on_hyps s end.
Definition
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
decomp_step
null
result := Valid | CounterModel | Abort.
Inductive
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
result
null
tauto_proc n s {struct n} := if is_leaf s then Valid else match n with | 0 => Abort | S n => let fix tauto_and ls := match ls with | nil => Valid | s1::ls => match tauto_proc n s1 with | Valid => tauto_and ls | s => s end end in let fix tauto_or lls := match lls with | ls::lls => match tauto_and ls with | Valid => Valid | CounterModel => tauto_or lls | Abort => Abort end | nil => CounterModel end in tauto_or (decomp_step s) end.
Fixpoint
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
tauto_proc
null
tauto_s f := tauto_proc (size f) (mkS nil f).
Definition
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
tauto_s
null
pick_hyp_def {A} (f:A) rh h : In (f,rh) (pick_hyp h) <-> exists rh1 rh2, rh=rh1++rh2 /\ h = rh1++f::rh2.
Lemma
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
pick_hyp_def
null
hyps_size_app h1 h2 : hyps_size (h1++h2) = hyps_size h1 + hyps_size h2.
Lemma
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
hyps_size_app
null
on_hyp_size h1 rh cl ls sg : In ls (on_hyp h1 rh cl) -> In sg ls -> seq_size sg < size h1 + hyps_size rh + size cl.
Lemma
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
on_hyp_size
null
on_hyps_size s ls sg : In ls (on_hyps s) -> In sg ls -> seq_size sg < seq_size s.
Lemma
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
on_hyps_size
null
decomp_step_size s ls sg : In ls (decomp_step s) -> In sg ls -> seq_size sg < seq_size s.
Lemma
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
decomp_step_size
null
on_hyp_sound f rh cl : valid_subgoal (on_hyp f rh cl) -> valid (mkS (f::rh) cl).
Lemma
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
on_hyp_sound
null
on_hyps_sound s : valid_subgoal (on_hyps s) -> valid s.
Lemma
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
on_hyps_sound
null
step_sound s : valid_subgoal (decomp_step s) -> valid s.
Lemma
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
step_sound
null
tauto_sound n s : tauto_proc n s = Valid -> valid s.
Lemma
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
tauto_sound
null
tImpl (A B : term) := tProd banon A (lift0 1 B).
Definition
examples
[ "MetaRocq.Utils", "Equations", "MetaRocq.Template", "All", "utils" ]
examples/tauto.v
tImpl
null