Proof Assistant Projects
Collection
Digesting proof assistant libraries for AI ingestion.
•
79 items
•
Updated
•
2
fact
stringlengths 6
2.88k
| type
stringclasses 17
values | library
stringclasses 2
values | imports
listlengths 0
16
| filename
stringclasses 89
values | symbolic_name
stringlengths 1
36
| docstring
stringclasses 1
value |
|---|---|---|---|---|---|---|
lowlevel_sub(arr : 'a array) (start : int) (len : int) : 'a array :=
let l := length arr in
match Int.equal l 0 with
| true => empty
| false =>
let newarr:=make len (get arr 0) in
lowlevel_blit arr start newarr 0 len;
newarr
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
lowlevel_sub
| |
init(l : int) (f : int -> 'a) : 'a array :=
let rec init_aux (dst : 'a array) (pos : int) (len : int) (f : int->'a) :=
match Int.equal len 0 with
| true => ()
| false =>
set dst pos (f pos);
init_aux dst (Int.add pos 1) (Int.sub len 1) f
end
in
match Int.le l 0 with
| true => empty
| false =>
let arr:=make l (f 0) in
init_aux arr 1 (Int.sub l 1) f;
arr
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
init
| |
make_matrix(sx : int) (sy : int) (v : 'a) : 'a array array :=
let initr _ := make sy v in
init sx initr.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
make_matrix
| |
copy(a : 'a array) : 'a array :=
lowlevel_sub a 0 (length a).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
copy
| |
append(a1 : 'a array) (a2 : 'a array) : 'a array :=
match Int.equal (length a1) 0 with
| true => copy a2
| false => match Int.equal (length a2) 0 with
| true => copy a1
| false =>
let newarr:=make (Int.add (length a1) (length a2)) (get a1 0) in
lowlevel_blit a1 0 newarr 0 (length a1);
lowlevel_blit a2 0 newarr (length a1) (length a2);
newarr
end
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
append
| |
sub(a : 'a array) (ofs : int) (len : int) : 'a array :=
Control.assert_valid_argument "Array.sub ofs<0" (Int.ge ofs 0);
Control.assert_valid_argument "Array.sub len<0" (Int.ge len 0);
Control.assert_bounds "Array.sub" (Int.le ofs (Int.sub (length a) len));
lowlevel_sub a ofs len.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
sub
| |
fill(a : 'a array) (ofs : int) (len : int) (v : 'a) : unit :=
Control.assert_valid_argument "Array.fill ofs<0" (Int.ge ofs 0);
Control.assert_valid_argument "Array.fill len<0" (Int.ge len 0);
Control.assert_bounds "Array.fill" (Int.le ofs (Int.sub (length a) len));
lowlevel_fill a ofs len v.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
fill
| |
blit(a1 : 'a array) (ofs1 : int) (a2 : 'a array) (ofs2 : int) (len : int) : unit :=
Control.assert_valid_argument "Array.blit ofs1<0" (Int.ge ofs1 0);
Control.assert_valid_argument "Array.blit ofs2<0" (Int.ge ofs2 0);
Control.assert_valid_argument "Array.blit len<0" (Int.ge len 0);
Control.assert_bounds "Array.blit ofs1+len>len a1" (Int.le ofs1 (Int.sub (length a1) len));
Control.assert_bounds "Array.blit ofs2+len>len a2" (Int.le ofs2 (Int.sub (length a2) len));
lowlevel_blit a1 ofs1 a2 ofs2 len.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
blit
| |
reciter_aux (f : 'a -> unit) (a : 'a array) (pos : int) (len : int) : unit :=
match Int.equal len 0 with
| true => ()
| false => f (get a pos); iter_aux f a (Int.add pos 1) (Int.sub len 1)
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
rec
| |
iter(f : 'a -> unit) (a : 'a array) : unit :=
iter_aux f a 0 (length a).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
iter
| |
reciter2_aux (f : 'a -> 'b -> unit) (a : 'a array) (b : 'b array) (pos : int) (len : int) : unit :=
match Int.equal len 0 with
| true => ()
| false => f (get a pos) (get b pos); iter2_aux f a b (Int.add pos 1) (Int.sub len 1)
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
rec
| |
reciter2 (f : 'a -> 'b -> unit) (a : 'a array) (b : 'b array) : unit :=
Control.assert_valid_argument "Array.iter2" (Int.equal (length a) (length b));
iter2_aux f a b 0 (length a).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
rec
| |
map(f : 'a -> 'b) (a : 'a array) : 'b array :=
init (length a) (fun i => f (get a i)).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
map
| |
map2(f : 'a -> 'b -> 'c) (a : 'a array) (b : 'b array) : 'c array :=
Control.assert_valid_argument "Array.map2" (Int.equal (length a) (length b));
init (length a) (fun i => f (get a i) (get b i)).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
map2
| |
reciteri_aux (f : int -> 'a -> unit) (a : 'a array) (pos : int) (len : int) : unit :=
match Int.equal len 0 with
| true => ()
| false => f pos (get a pos); iteri_aux f a (Int.add pos 1) (Int.sub len 1)
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
rec
| |
iteri(f : int -> 'a -> unit) (a : 'a array) : unit :=
iteri_aux f a 0 (length a).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
iteri
| |
mapi(f : int -> 'a -> 'b) (a : 'a array) : 'b array :=
init (length a) (fun i => f i (get a i)).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
mapi
| |
recto_list_aux (a : 'a array) (pos : int) (len : int) : 'a list :=
match Int.equal len 0 with
| true => []
| false => get a pos :: to_list_aux a (Int.add pos 1) (Int.sub len 1)
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
rec
| |
to_list(a : 'a array) : 'a list :=
to_list_aux a 0 (length a).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
to_list
| |
recof_list_aux (ls : 'a list) (dst : 'a array) (pos : int) : unit :=
match ls with
| [] => ()
| hd::tl =>
set dst pos hd;
of_list_aux tl dst (Int.add pos 1)
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
rec
| |
of_list(ls : 'a list) : 'a array :=
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
of_list
| |
recfold_left_aux (f : 'a -> 'b -> 'a) (x : 'a) (a : 'b array) (pos : int) (len : int) : 'a :=
match Int.equal len 0 with
| true => x
| false => fold_left_aux f (f x (get a pos)) a (Int.add pos 1) (Int.sub len 1)
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
rec
| |
fold_left(f : 'a -> 'b -> 'a) (x : 'a) (a : 'b array) : 'a :=
fold_left_aux f x a 0 (length a).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
fold_left
| |
recfold_right_aux (f : 'a -> 'b -> 'b) (a : 'a array) (x : 'b) (pos : int) (len : int) : 'b :=
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
rec
| |
fold_right(f : 'a -> 'b -> 'b) (a : 'a array) (x : 'b) : 'b :=
fold_right_aux f a x (Int.sub (length a) 1) (length a).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
fold_right
| |
recexist_aux (p : 'a -> bool) (a : 'a array) (pos : int) (len : int) : bool :=
match Int.equal len 0 with
| true => false
| false => match p (get a pos) with
| true => true
| false => exist_aux p a (Int.add pos 1) (Int.sub len 1)
end
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
rec
| |
exist(p : 'a -> bool) (a : 'a array) : bool :=
exist_aux p a 0 (length a).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
exist
| |
recfor_all_aux (p : 'a -> bool) (a : 'a array) (pos : int) (len : int) : bool :=
match Int.equal len 0 with
| true => true
| false => match p (get a pos) with
| true => for_all_aux p a (Int.add pos 1) (Int.sub len 1)
| false => false
end
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
rec
| |
for_all(p : 'a -> bool) (a : 'a array) : bool :=
for_all_aux p a 0 (length a).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
for_all
| |
mem(eq : 'a -> 'a -> bool) (x : 'a) (a : 'a array) : bool :=
exist (eq x) a.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
mem
| |
recfor_all2_aux (p : 'a -> 'b -> bool) (a : 'a array) (b : 'b array) (pos : int) (len : int) : bool :=
if Int.equal len 0
then true
else if p (get a pos) (get b pos)
then for_all2_aux p a b (Int.add pos 1) (Int.sub len 1)
else false.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
rec
| |
for_all2(p : 'a -> 'b -> bool) (a : 'a array) (b : 'b array) : bool :=
let lena := length a in
let lenb := length b in
if Int.equal lena lenb
then for_all2_aux p a b 0 lena
else Control.throw_invalid_argument "Array.for_all2".
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
for_all2
| |
equal(p : 'a -> 'b -> bool) (a : 'a array) (b : 'b array) : bool :=
let lena := length a in
let lenb := length b in
if Int.equal lena lenb
then for_all2_aux p a b 0 lena
else false.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
equal
| |
rev(ar : 'a array) : 'a array :=
let len := length ar in
init len (fun i => get ar (Int.sub (Int.sub len i) 1)).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int",
"Require Ltac2.Control",
"Require Ltac2.Bool",
"Require Ltac2.Message"
] |
Ltac2/Array.v
|
rev
| |
andx y :=
match x with
| true => y
| false => false
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init"
] |
Ltac2/Bool.v
|
and
| |
orx y :=
match x with
| true => true
| false => y
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init"
] |
Ltac2/Bool.v
|
or
| |
implx y :=
match x with
| true => y
| false => true
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init"
] |
Ltac2/Bool.v
|
impl
| |
negx :=
match x with
| true => false
| false => true
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init"
] |
Ltac2/Bool.v
|
neg
| |
xorx y :=
match x with
| true
=> match y with
| true => false
| false => true
end
| false
=> match y with
| true => true
| false => false
end
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init"
] |
Ltac2/Bool.v
|
xor
| |
equalx y :=
match x with
| true
=> match y with
| true => true
| false => false
end
| false
=> match y with
| true => false
| false => true
end
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init"
] |
Ltac2/Bool.v
|
equal
| |
Notationx(self) "&&" y(thunk(self)) : 2 :=
match x with
| true => y ()
| false => false
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init"
] |
Ltac2/Bool.v
|
Notation
| |
Notationx(self) "||" y(thunk(self)) : 3 :=
match x with
| true => true
| false => y ()
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init"
] |
Ltac2/Bool.v
|
Notation
| |
equal(x : char) (y : char) : bool := Int.equal (to_int x) (to_int y).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int"
] |
Ltac2/Char.v
|
equal
| |
compare(x : char) (y : char) : int := Int.compare (to_int x) (to_int y).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Int"
] |
Ltac2/Char.v
|
compare
| |
Typet := constant.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init"
] |
Ltac2/Constant.v
|
Type
| |
Typerelevance_var.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
Type
| |
Typerelevance := [ Relevant | Irrelevant | RelevanceVar (relevance_var) ].
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
Type
| |
Typet := Binder.relevance.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
Type
| |
Typecase.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
Type
| |
Typecase_invert
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
Type
| |
Typekind := [
| Rel (int)
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
Type
| |
reckind_nocast c :=
match kind c with
| Cast c _ _ => kind_nocast c
| k => k
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
rec
| |
is_closed(c : constr) : bool := closedn 0 c.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
is_closed
| |
occur_between:= noccur_between.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
occur_between
| |
noccurn(n : int) (c : constr) : bool := noccur_between n 1 c.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
noccurn
| |
occurn(n : int) (c : constr) : bool := noccur_between n 1 c.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
occurn
| |
constructor(ind : inductive) (i : int) : constructor :=
Ind.get_constructor (Ind.data ind) i.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
constructor
| |
iter(f : constr -> unit) (c : constr) : unit :=
match kind c with
| Rel _ | Meta _ | Var _ | Sort _ | Constant _ _ | Ind _ _
| Constructor _ _ | Uint63 _ | Float _ | String _ => ()
| Cast c _ t => f c; f t
| Prod b c => f (Binder.type b); f c
| Lambda b c => f (Binder.type b); f c
| LetIn b t c => f (Binder.type b); f t; f c
| App c l => f c; Array.iter f l
| Evar _ l => Array.iter f l
| Case _ x iv y bl =>
match x with (x,_) => f x end;
iter_invert f iv;
f y;
Array.iter f bl
| Proj _p _ c => f c
| Fix _ _ tl bl =>
Array.iter (fun b => f (Binder.type b)) tl;
Array.iter f bl
| CoFix _ tl bl =>
Array.iter (fun b => f (Binder.type b)) tl;
Array.iter f bl
| Array _u t def ty =>
f ty; Array.iter f t; f def
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
iter
| |
iter_with_binders(g : 'a -> binder -> 'a) (f : 'a -> constr -> unit) (n : 'a) (c : constr) : unit :=
match kind c with
| Rel _ | Meta _ | Var _ | Sort _ | Constant _ _ | Ind _ _
| Constructor _ _ | Uint63 _ | Float _ | String _ => ()
| Cast c _ t => f n c; f n t
| Prod b c => f n (Binder.type b); f (g n b) c
| Lambda b c => f n (Binder.type b); f (g n b) c
| LetIn b t c => f n (Binder.type b); f n t; f (g n b) c
| App c l => f n c; Array.iter (f n) l
| Evar _ l => Array.iter (f n) l
| Case _ x iv y bl =>
match x with (x,_) => f n x end;
iter_invert (f n) iv;
f n y;
Array.iter (f n) bl
| Proj _p _ c => f n c
| Fix _ _ tl bl =>
Array.iter (fun b => f n (Binder.type b)) tl;
let n := Array.fold_left g n tl in
Array.iter (f n) bl
| CoFix _ tl bl =>
Array.iter (fun b => f n (Binder.type b)) tl;
let n := Array.fold_left g n tl in
Array.iter (f n) bl
| Array _u t def ty =>
f n ty;
Array.iter (f n) t;
f n def
end.
Local Ltac2 binder_map (f : constr -> constr) (b : binder) : binder :=
Binder.unsafe_make (Binder.name b) (Binder.relevance b) (f (Binder.type b)).
Local Ltac2 map_invert (f : constr -> constr) (iv : case_invert) : case_invert :=
match iv with
| NoInvert => NoInvert
| CaseInvert indices => CaseInvert (Array.map f indices)
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
iter_with_binders
| |
map(f : constr -> constr) (c : constr) : constr :=
match kind c with
| Rel _ | Meta _ | Var _ | Sort _ | Constant _ _ | Ind _ _
| Constructor _ _ | Uint63 _ | Float _ | String _ => c
| Cast c k t =>
let c := f c
with t := f t in
make (Cast c k t)
| Prod b c =>
let b := binder_map f b
with c := f c in
make (Prod b c)
| Lambda b c =>
let b := binder_map f b
with c := f c in
make (Lambda b c)
| LetIn b t c =>
let b := binder_map f b
with t := f t
with c := f c in
make (LetIn b t c)
| App c l =>
let c := f c
with l := Array.map f l in
make (App c l)
| Evar e l =>
let l := Array.map f l in
make (Evar e l)
| Case info x iv y bl =>
let x := match x with (x,x') => (f x, x') end
with iv := map_invert f iv
with y := f y
with bl := Array.map f bl in
make (Case info x iv y bl)
| Proj p r c =>
let c := f c in
make (Proj p r c)
| Fix structs which tl bl =>
let tl := Array.map (binder_map f) tl
with bl := Array.map f bl in
make (Fix structs which tl bl)
| CoFix which tl bl =>
let tl := Array.map (binder_map f) tl
with bl := Array.map f bl in
make (CoFix which tl bl)
| Array u t def ty =>
let ty := f ty
with t := Array.map f t
with def := f def in
make (Array u t def ty)
...
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
map
| |
map_with_binders(lift : 'a -> binder -> 'a) (f : 'a -> constr -> constr) (n : 'a) (c : constr) : constr :=
match kind c with
| Rel _ | Meta _ | Var _ | Sort _ | Constant _ _ | Ind _ _
| Constructor _ _ | Uint63 _ | Float _ | String _ => c
| Cast c k t =>
let c := f n c
with t := f n t in
make (Cast c k t)
| Prod b c =>
let b := binder_map (f n) b
with c := f (lift n b) c in
make (Prod b c)
| Lambda b c =>
let b := binder_map (f n) b
with c := f (lift n b) c in
make (Lambda b c)
| LetIn b t c =>
let b := binder_map (f n) b
with t := f n t
with c := f (lift n b) c in
make (LetIn b t c)
| App c l =>
let c := f n c
with l := Array.map (f n) l in
make (App c l)
| Evar e l =>
let l := Array.map (f n) l in
make (Evar e l)
| Case info x iv y bl =>
let x := match x with (x,x') => (f n x, x') end
with iv := map_invert (f n) iv
with y := f n y
with bl := Array.map (f n) bl in
make (Case info x iv y bl)
| Proj p r c =>
let c := f n c in
make (Proj p r c)
| Fix structs which tl bl =>
let tl := Array.map (binder_map (f n)) tl in
let n_bl := Array.fold_left lift n tl in
let bl := Array.map (f n_bl) bl in
make (Fix structs which tl bl)
| CoFix which tl bl =>
let tl := Array.map (binder_map (f n)) tl in
let n_bl := Array.fold_left lift n tl in
let bl := Array.map (f n_bl) bl in
make (CoFix which tl bl)
| Array u t def ty =>
let ty := f n ty
with t := Array.map (f n) t
...
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
map_with_binders
| |
Typet.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
Type
| |
Abbreviationopen_constr_flags_with_tc :=
set_nf_evars false (set_allow_evars true constr_flags).
Local Ltac2 open_constr_flags_with_tc_kn () := open_constr_flags_with_tc.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
Abbreviation
| |
Abbreviationopen_constr_flags_no_tc :=
set_use_typeclasses false open_constr_flags_with_tc.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
Abbreviation
| |
Abbreviationopen_constr_flags := open_constr_flags_with_tc.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
Abbreviation
| |
Typeexpected_type.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
Type
| |
pretype(c : preterm) : constr :=
Pretype.pretype Pretype.Flags.constr_flags Pretype.expected_without_type_constraint c.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
pretype
| |
decompose_app_list(c : constr) :=
match Unsafe.kind c with
| Unsafe.App f cl => (f, Array.to_list cl)
| _ => (c,[])
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
decompose_app_list
| |
decompose_app(c : constr) :=
match Unsafe.kind c with
| Unsafe.App f cl => (f, cl)
| _ => (c,[| |])
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
decompose_app
| |
is_evar(c: constr) :=
match Unsafe.kind c with
| Unsafe.Evar _ _ => true
| _ => false
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
is_evar
| |
is_var(c: constr) :=
match Unsafe.kind c with
| Unsafe.Var _ => true
| _ => false
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
is_var
| |
is_fix(c: constr) :=
match Unsafe.kind c with
| Unsafe.Fix _ _ _ _ => true
| _ => false
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
is_fix
| |
is_cofix(c: constr) :=
match Unsafe.kind c with
| Unsafe.CoFix _ _ _ => true
| _ => false
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
is_cofix
| |
is_ind(c: constr) :=
match Unsafe.kind c with
| Unsafe.Ind _ _ => true
| _ => false
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
is_ind
| |
is_constructor(c: constr) :=
match Unsafe.kind c with
| Unsafe.Constructor _ _ => true
| _ => false
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
is_constructor
| |
is_proj(c: constr) :=
match Unsafe.kind c with
| Unsafe.Proj _ _ _ => true
| _ => false
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
is_proj
| |
is_const(c: constr) :=
match Unsafe.kind c with
| Unsafe.Constant _ _ => true
| _ => false
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
is_const
| |
is_float(c: constr) :=
match Unsafe.kind c with
| Unsafe.Float _ => true
| _ => false
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
is_float
| |
is_uint63(c: constr) :=
match Unsafe.kind c with
| Unsafe.Uint63 _ => true
| _ => false
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
is_uint63
| |
is_string(c: constr) :=
match Unsafe.kind c with
| Unsafe.String _ => true
| _ => false
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
is_string
| |
is_array(c: constr) :=
match Unsafe.kind c with
| Unsafe.Array _ _ _ _ => true
| _ => false
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
is_array
| |
is_sort(c: constr) :=
match Unsafe.kind c with
| Unsafe.Sort _ => true
| _ => false
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Ind Ltac2.Array"
] |
Ltac2/Constr.v
|
is_sort
| |
Typet := constructor.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init"
] |
Ltac2/Constructor.v
|
Type
| |
once_plus(run : unit -> 'a) (handle : exn -> 'a) : 'a :=
once (fun () => plus run handle).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Message"
] |
Ltac2/Control.v
|
once_plus
| |
throw_invalid_argument(msg : string) :=
Control.throw (Invalid_argument (Some (Message.of_string msg))).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Message"
] |
Ltac2/Control.v
|
throw_invalid_argument
| |
throw_out_of_bounds(msg : string) :=
Control.throw (Out_of_bounds (Some (Message.of_string msg))).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Message"
] |
Ltac2/Control.v
|
throw_out_of_bounds
| |
assert_valid_argument(msg : string) (test : bool) :=
match test with
| true => ()
| false => throw_invalid_argument msg
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Message"
] |
Ltac2/Control.v
|
assert_valid_argument
| |
assert_bounds(msg : string) (test : bool) :=
match test with
| true => ()
| false => throw_out_of_bounds msg
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Message"
] |
Ltac2/Control.v
|
assert_bounds
| |
assert_trueb :=
if b then () else throw Assertion_failure.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Message"
] |
Ltac2/Control.v
|
assert_true
| |
assert_falseb :=
if b then throw Assertion_failure else ().
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Message"
] |
Ltac2/Control.v
|
assert_false
| |
backtrack_tactic_failure(msg : string) :=
Control.zero (Tactic_failure (Some (Message.of_string msg))).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Message"
] |
Ltac2/Control.v
|
backtrack_tactic_failure
| |
once_plus_bt(run : unit -> 'a) (handle : exn -> exninfo -> 'a) : 'a :=
once (fun _ => plus_bt run handle).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Message"
] |
Ltac2/Control.v
|
once_plus_bt
| |
clear_exn_info(e : exn) : exn :=
match e with
| Init.Internal err => Init.Internal (clear_err_info err)
| e => e
end.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Message"
] |
Ltac2/Control.v
|
clear_exn_info
| |
Typet := evar.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init"
] |
Ltac2/Evar.v
|
Type
| |
Typet := float.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init"
] |
Ltac2/Float.v
|
Type
| |
Type('k, 'v) t.
|
Ltac2
|
Ltac2
|
[
"From Ltac2 Require Import Init",
"From Ltac2 Require FSet"
] |
Ltac2/FMap.v
|
Type
| |
Typet.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Control",
"Require Ltac2.List"
] |
Ltac2/Fresh.v
|
Type
| |
of_goal() := of_ids (List.map (fun (id, _, _) => id) (Control.hyps ())).
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Control",
"Require Ltac2.List"
] |
Ltac2/Fresh.v
|
of_goal
| |
in_goalid := Fresh.fresh (Free.of_goal ()) id.
|
Ltac2
|
Ltac2
|
[
"Require Import Ltac2.Init",
"Require Ltac2.Control",
"Require Ltac2.List"
] |
Ltac2/Fresh.v
|
in_goal
| |
Type'a tag.
|
Ltac2
|
Ltac2
|
[
"From Ltac2 Require Import Init"
] |
Ltac2/FSet.v
|
Type
|
Structured dataset of definitions and theorems from the Coq standard library.
| Column | Type | Description |
|---|---|---|
| fact | string | Declaration body (without type keyword) |
| type | string | Definition, Lemma, Theorem, Fixpoint, Inductive, Class, Instance, Ltac, Ltac2, etc. |
| library | string | Top-level module (Corelib, Ltac2) |
| imports | list | Require/Import statements |
| filename | string | Source file path |
| symbolic_name | string | Declaration identifier |
| Type | Count |
|---|---|
| Definition | 688 |
| Lemma | 553 |
| Ltac2 | 550 |
| Ltac | 124 |
| Fixpoint | 75 |
| Axiom | 74 |
| Theorem | 62 |
| Class | 48 |
| Inductive | 48 |
| Instance | 45 |