-
Michael Sammler authoredMichael Sammler authored
GUIDE.md 2.22 KiB
WIP: Guide for RefinedC developers
This guide has two parts: First, a guide for writing typing rules. Second, a style guide for RefinedC development.
Rule guide
-
SimplifyHyp
andSimplifyGoal
rules should match: The information learned by theSimplifyHyp
rule should be enough to prove theSimplifyGoal
. Said another way, applying theSimplifyHyp
instance and then provingSimplifyGoal
should be equivalent to not using any of the two (except for learning more information). - If there are multiple
SimplifyHyp
orSimplifyGoal
rules for the same proposition, one must ensure that the ones with the smaller number also have the smaller priority on the typeclass.
Style guide
- Follow the std++/Iris style except when noted otherwise below. In particular, do the following:
- Only use
Lemma
, not any of the other variants likeFact
or similar. - Specify all types in Definitions, both for arguments and for the Definition itself.
- Use std++'s typeclasses to overload existing notations (e.g.
ElemOf
for∈
). - Type parameters should use captial latin letters, starting from A and should usually be implicit.
- Use
done
orby ...
to solve trivial goals. It replacesreflexivity
,trivial
,assumption
, ... - Don't use generated names of hypothesis.
- Prefer the ssreflect tactics to the Coq tactics. I.e. use
move => ...
instead ofintros ...
,have ... : ...
instead ofassert
,have ... := ...
instead ofpose proof
,move Heq: (...) => ?
instead ofremember
and so on. See https://coq.inria.fr/distrib/current/refman/proof-engine/ssreflect-proof-language.html for documentation on ssreflect. - Use std++ where possible. E.g. use
f <$> l
instead ofmap f l
. Also usenaive_solver
instead ofintuition
ortauto
. - If there is a typeclass to restrict when a typing rule applies, but it does not contain useful information for proving the typing rule, it should only be on the instance, not the lemma.
- Use
if bool_decide P then ...
instead ofif decide P then ...
. This works better for automation since one can rewrite withbool_decide P = true
in the first version, but not in the second version.