Info on some coq packages.
hrel
: heterogeneous relationfun_hrel
: To make a value of refines
??computable_scope
notations with scope key
C
.refines
refines: (A -> B -> Type) -> A -> B -> Type
| |
+--------------+
|
refinement relation
From here:
Refinement relation:
(* Type of refinement relations *)
R: SpecT -> ImplT -> Type
Transport lemma:
R_op: refines refinement_relation Spec Impl
Example:
Definition tup2seq (n:nat)
: n.-tuple bool -> seq bool -> Type :=
fun btup bseq => tval btup = bseq.
(Pseudo-) examples:
n.-tuple -> Vector.t n -> Type
seqmx
in CoqEALRseqmx
: https://github.com/coq-community/coqeal/blob/1.1.3/refinements/seqmx.v#L298
R ==> S
(hrel)If there are functions R: A -> B
and
S: A' -> B'
, then there exists a function
(A -> A') -> (B -> B')
.
—
Notation for hrespectful R S
.
From relscope.
R: A -> B -> Type
S: C -> D -> Type
f: A -> C
g: B -> D
is
R ==> S
which in turn is
hrespectful R S: (A->C) -> (B->D) -> Type :=
fun f g => forall (a:A) (b:B),
R a b -> S (f a) (g b)
R spec impl
means
—
spec_of: impl -> spec -> Type
: type of
specification functionsimpl_of: spec -> spec -> Type
: type of
implementation functionsfun_hrel
fun_hrel
: forall A B : Type, (B -> A) -> A -> B -> Type
Like:
fun_hrel (A:=Spec) (B:=Impl): (Impl -> Spec) -> s -> i -> Type
Coq version of quickcheck
Show
instance for printing test cases
Combinators:
elems_
: Select from a list of values
elems
notation automatically generates the default
value argumentoneOf_
: select from a list of generators
oneOf
freq_
: instruct qc to skew the distribution
nat
-value as associated
weightfreq
listOf
: Get a list of random length from a
generatorvectorOf
: Get a list of fixed length from a
generatorchoose
: select a value from a given rangesample
: sample a generatorCheck choose (0,3).
(* choose (0, 3) : G nat *)
Check List.hd 5 (sample (choose (0,3))).
(* List.hd 5 (sample (choose (0, 3))) : nat *)
Check choose.
(* choose : BinNums.N * BinNums.N -> G BinNums.N *)
Typeclasses:
Links:
HB.about
HB.check
HB.about isFinite.
(*
HB: isFinite is a factory (from "./fintype.v", line 161)
HB: isFinite operations and axioms are:
- enum_subdef
- enumP_subdef
HB: isFinite requires the following mixins:
- hasDecEq
HB: isFinite provides the following mixins:
- isFinite
*)
Links:
eta
From structures.v
.
Notation "[ 'eta' f ]" := (fun x => f x) : fun_scope (default interpretation)
mixin: operator + properties
isFinite
)structure: carrier + mixin
(Canonical) Structure instance: Zmodule
factory
builder
abbreviation
https://coq.inria.fr/refman/using/tools/coqdoc.html
(** * Level 1
H1 size section. *)
(** ** Level 2
H2 size section. *)
Increase the number of asterisks accordingly.
Enclose between <<
and >>
.
Like,
<<
let rec fact n =
if n <= 1 then 1 else n * fact (n-1)
>>
Like,
caml expression: << fact (n-1) >>
View documentation of a word: C-c C-d
View code outline in a separate buffer: C-c C-, (M-x company-coq-occur)
Fold definition: C-c C-/
Unfold definition: C-c C-\
Make current goal a separate lemma: C-c C-a C-x
Go to definition of identifier if present: M-. (doesn't play well with evil-mode)
Insert a match case line: M-Ret
grep current word in current directory sub-tree: C-c C-&
Show diff of expected and actual types upon error: C-c C-a C-d
Compare with error messages in docs: C-c C-a C-e
Show/unshow definition of a name as an overlay: M-F12:
Show documentation for a term if available: Type its name (at least partially) and do C-h
Import with:
From Ltac2 Require Import Ltac2.
Use Ltac2 mutable
when defining the tactic for the first
time.
From Ltac2 Require Import Ltac2.
(* Initial definition *)
Ltac2 mutable x_mut := 3.
Ltac2 Eval x_mut. (* - : int = 3 *)
(* Changing definition *)
Ltac2 Set x_mut := 2.
Ltac2 Eval x_mut. (* - : int = 2 *)
Attempts to modify an ltac2 tactic which was not explicitly set as
mutable
results in error.
Ltac2 x_immut := 3.
Fail Ltac2 Set x_immut := 2.
(*
The command has indeed failed with message:
The tactic x_immut is not declared as mutable
*)
Old value of a mutable tactic can be accessed while redefining it
using as
:
Ltac2 mutable f x := Int.add x 1.
Ltac2 Eval f 3.
(* - : int = 4 *)
Ltac2 Set f as oldf := fun x => Int.add 10 (oldf x).
Ltac2 Eval f 3.
(* - : int = 14 *)
Possible with ltac1:(tactic_name)
.
Ltac2 newintros () := ltac1:(intros).
Must have at least a ()
as argument.
Fail Ltac2 newintros := ltac1:(intros).
(*
The command has indeed failed with message:
Tactic definition must be a syntactical value. Consider using a thunk.
*)
Ltac2 newintros () := ltac1:(intros).
Ltac1 tactics are not available when using ltac2. Notations are helpful to reclaim use of ltac1.
Ltac2 newintros () := ltac1:(intros).
Ltac2 Notation "intros" := newintros ().
(* Use ltac1. This is the default. *)
Default Proof Mode "Classic".
(* Use ltac2. Require it first. *)
(* Importing Ltac2 implicitly sets default proof mode to ltac2. *)
From Ltac2 Require Ltac2.
Default Proof Mode "Ltac2".
mathcomp 2.0:
coq-ext-lib: has an hlist implementation
trocq: refinements, proof transfer
coinduction
param
CoRN
CoLoR
paramcoq:
Parametricity
vernacular command.Pretty output/interface:
Efforts have been made to augment Coq's stdlib. ʳ.
mathcomp has got a lot of stuff as well.
tactician enable
: makes ~/.coqrc file that always
import tactician.opam install coq-tactician-stdlib
: Optional, recompiles
standard library