Skip to content

Commit 8e6efe4

Browse files
committed
Move all examples into src/
1 parent f999005 commit 8e6efe4

20 files changed

+20
-20
lines changed

Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
COQ_FILES := $(wildcard *.v)
1+
COQ_FILES := $(wildcard src/*.v)
22
VO_FILES := $(COQ_FILES:.v=.vo)
33

44
all: $(VO_FILES)
55

6-
NoInit.vo: NoInit.v
7-
coqc -q -R . Top -noinit $< -o $@
8-
9-
%.vo: %.v
6+
src/%.vo: src/%.v
107
coqc -q -R . Top $< -o $@
118

9+
src/NoInit.vo: src/NoInit.v
10+
coqc -q -R . Top -noinit $< -o $@
11+
1212
clean:
13-
rm -f *.vo
13+
rm -f src/*.vo

README.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ If you have a trick you've found useful feel free to submit an issue or pull req
1111
* `lazymatch` for better error messages
1212
* `deex` tactic
1313
* `::=` to re-define Ltac
14-
* `learn` approach - see [Learn.v](Learn.v) for a self-contained example or [Clément's thesis](http://pit-claudel.fr/clement/MSc/#org036d20e) for more details
14+
* `learn` approach - see [Learn.v](src/Learn.v) for a self-contained example or [Clément's thesis](http://pit-claudel.fr/clement/MSc/#org036d20e) for more details
1515
* `unshelve` tactical, especially useful with an eapply - good example use case is constructing an object by refinement where the obligations end up being your proofs with the values as evars, when you wanted to construct the values by proof
1616
* `unfold "+"` works
1717
* `destruct matches` tactic
@@ -20,17 +20,17 @@ If you have a trick you've found useful feel free to submit an issue or pull req
2020
* strong induction is in the standard library: `Require Import Arith.` and use `induction n as [n IHn] using lt_wf_ind.`
2121
* induction on the length of a list: `Require Import Coq.Arith.Wf_nat.` and `induction xs as [xs IHxs] using (induction_ltof1 _ (@length _)); unfold ltof in IHxs.`
2222
* `debug auto`, `debug eauto`, and `debug trivial` give traces, including failed invocations. `info_auto`, `info_eauto`, and `info_trivial` are less verbose ways to debug which only report what the resulting proof includes
23-
* `constructor` and `econstructor` backtrack over the constructors over an inductive, which lets you do fun things exploring the constructors of an inductive type. See [Constructors.v](Constructors.v) for some demonstrations.
23+
* `constructor` and `econstructor` backtrack over the constructors over an inductive, which lets you do fun things exploring the constructors of an inductive type. See [Constructors.v](src/Constructors.v) for some demonstrations.
2424
* There's a way to destruct and maintain an equality: `destruct_with_eqn x`.
2525
You can also do `destruct x eqn:H` to explicitly name the equality
2626
hypothesis. This is similar to `case_eq x; intros`; I'm not sure what the
2727
practical differences are.
2828
* `rew H in t` notation to use `eq_rect` for a (safe) "type cast". Need to
29-
import `EqNotations` - see [RewNotation.v](RewNotation.v) for a working
29+
import `EqNotations` - see [RewNotation.v](src/RewNotation.v) for a working
3030
example.
31-
* `intro`-patterns can be combined in a non-trivial way: `intros [=->%lemma]` -- see [IntroPatterns.v](IntroPatterns.v).
31+
* `intro`-patterns can be combined in a non-trivial way: `intros [=->%lemma]` -- see [IntroPatterns.v](src/IntroPatterns.v).
3232
* `change` tactic supports patterns (`?var`): e.g. `repeat change (fun x => ?f x) with f` would eta-reduce all the functions (of arbitrary arity) in the goal.
33-
* One way to implement a tactic that sleeps for n seconds is in [Sleep.v](Sleep.v).
33+
* One way to implement a tactic that sleeps for n seconds is in [Sleep.v](src/Sleep.v).
3434
* Some tactics take an "[occurrence clause](https://coq.inria.fr/refman/proof-engine/tactics.html#occurrences-sets-and-occurrences-clauses)" to select where they apply. The common ones are `in *` and `in H` to apply everywhere and in a specific hypotheses, but there are actually a bunch of forms. The syntax is really silly so I'm just going to give examples and hope they help.
3535
- `in H1, H2` (just `H1` and `H2`)
3636
- `in H1, H2 |- *` (`H1`, `H2`, and the goal)
@@ -64,26 +64,26 @@ If you have a trick you've found useful feel free to submit an issue or pull req
6464
* `Program Fixpoint` may be useful when defining a nested recursive function. See [manual](https://coq.inria.fr/refman/program.html#hevea_command290) and [this StackOverflow post](https://stackoverflow.com/questions/10292421/error-in-defining-ackermann-in-coq).
6565
* [CPDT's way](http://adam.chlipala.net/cpdt/html/Cpdt.GeneralRec.html) of defining general recursive functions with `Fix` combinator.
6666
* One can pattern-match on tuples under lambdas: `Definition fst {A B} : (A * B) -> A := fun '(x,_) => x.` (works since Coq 8.6).
67-
* Records fields can be defined with `:>`, which make that field accessor a coercion. There are three ways to use this (since there are three types of coercion classes). See [Coercions.v](Coercions.v) for some concrete examples.
67+
* Records fields can be defined with `:>`, which make that field accessor a coercion. There are three ways to use this (since there are three types of coercion classes). See [Coercions.v](src/Coercions.v) for some concrete examples.
6868
- If the field is an ordinary type, the record can be used as that type (the field will implicitly be accessed). One good use case for this is whenever a record includes another record; this coercion will make the field accessors of the sub-record work for the outer record as well. (This is vaguely similar to [Go embedded structs](https://golang.org/doc/effective_go.html#embedding))
6969
- If the field has a function type, the record can be called.
7070
- If the field is a sort (eg, `Type`), then the record can be used as a type.
7171
* When a Class field (as opposed to a record) is defined with `:>`, it becomes a hint for typeclass resolution. This is useful when a class includes a "super-class" requirement as a field. For example, `Equivalence` has fields for reflexivity, symmetry, and transitivity. The reflexivity field can be used to generically take an `Equivalence` instance and get a reflexivity instance for free.
72-
* The type classes in RelationClasses are useful but can be repetitive to prove. [RelationInstances.v](RelationInstances.v) goes through a few ways of making these more convenient, and why you would want to do so (basically you can make `reflexivity`, `transitivity`, and `symmetry` more powerful).
73-
* The types of inductives can be definitions, as long as they expand to an "arity" (a function type ending in `Prop`, `Set`, or `Type`). See [ArityDefinition.v](ArityDefinition.v).
74-
* Record fields that are functions can be written in definition-style syntax with the parameters bound after the record name, eg `{| func x y := x + y; |}` (see [RecordFunction.v](RecordFunction.v) for a complete example).
72+
* The type classes in RelationClasses are useful but can be repetitive to prove. [RelationInstances.v](src/RelationInstances.v) goes through a few ways of making these more convenient, and why you would want to do so (basically you can make `reflexivity`, `transitivity`, and `symmetry` more powerful).
73+
* The types of inductives can be definitions, as long as they expand to an "arity" (a function type ending in `Prop`, `Set`, or `Type`). See [ArityDefinition.v](src/ArityDefinition.v).
74+
* Record fields that are functions can be written in definition-style syntax with the parameters bound after the record name, eg `{| func x y := x + y; |}` (see [RecordFunction.v](src/RecordFunction.v) for a complete example).
7575
* If you have a coercion `get_function : MyRecord >-> Funclass` you can use `Add Printing Coercion get_function` and then add a notation for `get_function` so your coercion can be parsed as function application but printed using some other syntax (and maybe you want that syntax to be `printing only`).
7676
* You can pass implicit arguments explicitly in a keyword-argument-like style, eg `nil (A:=nat)`. Use `About` to figure out argument names.
77-
* If you do nasty dependent pattern matches or use `inversion` on a goal and it produces equalities of `existT`'s, you may benefit from small inversions, described in this [blog post](http://gallium.inria.fr/blog/a-new-Coq-tactic-for-inversion/). While the small inversion tactic is still not available anywhere I can find, some support is built in to Coq's match return type inference; see [SmallInversions.v](SmallInversions.v) for examples of how to use that.
78-
* You can use tactics-in-terms with notations to write function-like definitions that are written in Ltac. For example, you can use this facility to write macros that inspect and transform Gallina terms, producing theorem statements and optionally their proofs automatically. A simple example is given in [DefEquality.v](DefEquality.v) of writing a function that produces an equality for unfolding a definition.
77+
* If you do nasty dependent pattern matches or use `inversion` on a goal and it produces equalities of `existT`'s, you may benefit from small inversions, described in this [blog post](http://gallium.inria.fr/blog/a-new-Coq-tactic-for-inversion/). While the small inversion tactic is still not available anywhere I can find, some support is built in to Coq's match return type inference; see [SmallInversions.v](src/SmallInversions.v) for examples of how to use that.
78+
* You can use tactics-in-terms with notations to write function-like definitions that are written in Ltac. For example, you can use this facility to write macros that inspect and transform Gallina terms, producing theorem statements and optionally their proofs automatically. A simple example is given in [DefEquality.v](src/DefEquality.v) of writing a function that produces an equality for unfolding a definition.
7979
8080
## Other Coq commands
81-
* `Search` vernacular variants; see [Search.v](Search.v) for examples.
81+
* `Search` vernacular variants; see [Search.v](src/Search.v) for examples.
8282
* `Search s -Learnt` for a search of local hypotheses excluding Learnt
8383
* `Locate` can search for notation, including partial searches.
8484
* `Optimize Heap` (undocumented) runs GC (specifically [`Gc.compact`](https://caml.inria.fr/pub/docs/manual-ocaml/libref/Gc.html))
8585
* `Optimize Proof` (undocumented) runs several simplifications on the current proof term (see [`Proofview.compact`](https://github.com/coq/coq/blob/9a4ca53a3a021cb16de7706ec79a26e49f54de49/engine/proofview.ml#L40))
86-
* `Generalizable Variable A` enables implicit generalization; `Definition id \`(x:A) := x` will implicitly add a parameter `A` before `x`. `Generalizable All Variables` enables implicit generalization for any identifier. Note that this surprisingly allows generalization without a backtick in Instances; see [InstanceGeneralization.v](InstanceGeneralization.v). [Issue #6030](https://github.com/coq/coq/issues/6030) generously requests this behavior be documented, but it should probably require enabling some option.
86+
* `Generalizable Variable A` enables implicit generalization; `Definition id \`(x:A) := x` will implicitly add a parameter `A` before `x`. `Generalizable All Variables` enables implicit generalization for any identifier. Note that this surprisingly allows generalization without a backtick in Instances; see [InstanceGeneralization.v](src/InstanceGeneralization.v). [Issue #6030](https://github.com/coq/coq/issues/6030) generously requests this behavior be documented, but it should probably require enabling some option.
8787
* `Check` supports partial terms, printing a type along with a context of evars. A cool example is `Check (id _ _)`, where the first underscore must be a function (along with other constraints on the types involved).
8888
* `Unset Intuition Negation Unfolding` will cause `intuition` to stop unfolding `not`.
8989
* Definitions can be normalized (simplified/computed) easily with `Definition bar := Eval compute in foo.`
@@ -97,5 +97,5 @@ If you have a trick you've found useful feel free to submit an issue or pull req
9797
9898
## Using Coq
9999
* You can pass `-noinit` to `coqc` or `coqtop` to avoid loading the standard library.
100-
* Ltac is provided as a plugin loaded by the standard library; to load it you need `Declare ML Module "ltac_plugin".` (see [NoInit.v](NoInit.v)).
100+
* Ltac is provided as a plugin loaded by the standard library; to load it you need `Declare ML Module "ltac_plugin".` (see [NoInit.v](src/NoInit.v)).
101101
* Numeral notations are only provided by the prelude, even if you issue `Require Import Coq.Init.Datatypes`.
File renamed without changes.

CheckEnv.v src/CheckEnv.v

File renamed without changes.

Coercions.v src/Coercions.v

File renamed without changes.

Constructors.v src/Constructors.v

File renamed without changes.

DefEquality.v src/DefEquality.v

File renamed without changes.

Function.v src/Function.v

File renamed without changes.
File renamed without changes.

Instantiate.v src/Instantiate.v

File renamed without changes.
File renamed without changes.

Learn.v src/Learn.v

File renamed without changes.

NoInit.v src/NoInit.v

File renamed without changes.
File renamed without changes.
File renamed without changes.

RewNotation.v src/RewNotation.v

File renamed without changes.

Search.v src/Search.v

File renamed without changes.

Sleep.v src/Sleep.v

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)