-
Notifications
You must be signed in to change notification settings - Fork 31
Structure Guidelines
Andrej Dudenhefner edited this page Jun 14, 2022
·
8 revisions
The directory structure of theories is organized as follows
-
ProblemClass-
ProblemFamily.v,ProblemFamily_undec.v -
ReductionsForeignProblem_to_Problem.vHaltTM_1_chain_Problem.v
-
Util,Misc,Shared, ...
-
In the above
-
ProblemClassis a general class of Problems -
ProblemFamily.vcontains a cohesive (overlapping preliminaries) family of decision problems (Coq predicates) inProblemClass-
ProblemFamily.vshould be a minimalistic, possibly self-contained problem specification, suitable for modular reuse -
ProblemFamily.vshould be well-documented via comments and feasible to understand with minimal Coq knowledge -
ProblemFamily.vshould not contains any reasoning, dependencies to undecidability results etc.
-
-
ProblemFamily_undec.vcontains exactly the proofs ofTheorem Problem_undec : undecidable Problem.for eachProblemdefined inProblemFamily.v-
ProblemFamily_undec.vshould contain only high-level reasoning (transitive application of reduction steps) -
ProblemFamily_undec.vshould be documented via comments and feasible to understand with a basic Coq knowledge -
ProblemFamily_undec.vshould not contains auxiliary lemmas
-
-
Reductionscontains relevant reductions to problems inProblemClass-
ForeignProblem_to_Problem.vcontains the main argument to reduceForeignProblemtoProbleminProblemClass-
ForeignProblem_to_Problem.vshould (if possible) containTheorem reduction : ForeignProblem ⪯ Problem. -
ForeignProblem_to_Problem.vmay encapsulate all other lemmas and theorems necessary forreductionin aModule -
ForeignProblem_to_Problem.vshould not contain proofs ofForeignProblem' ⪯ Problem'where eitherForeignProblem'differs fromForeignProblemorProblem'differs fromProblem -
ForeignProblem_to_Problem.vshould (if possible) not depend on any otherForeignProblem'_to_Problem'.vfor parallel compilation of atomic reduction steps
-
-
HaltTM_1_chain_Problem.vis optional and contains the conjunction of reduction steps from Turing machine haltingHaltTM 1toProblem-
HaltTM_1_chain_Problem.vshould (if possible) containTheorem HaltTM_1_chain_Problem : HaltTM 1 ⪯ Problem_1 /\ ... /\ Problem_n ⪯ Problem. -
HaltTM_1_chain_Problem.vshould be documented via comments and feasible to understand with a basic Coq knowledge -
HaltTM_1_chain_Problem.vshould not contains auxiliary lemmas -
HaltTM_1_chain_Problem.vshould not used in other arguments (it should be a compilation leaf) -
HaltTM_1_chain_Problem.vshould be used for presentations, publications, code review, etc.
-
-
-
Util,Misc,Shared, etc. contain auxiliary lemmas used for proofs inProblemClassto keep the top-level ofProblemClassclean - Intermediate files should not depend on
ProblemFamily_undec.vfiles (otherwise, this could pollute the overall context)
-
Modularity:
ProblemClassshould not contain proofs regarding inherent properties ofOtherProblemClassthat could as well be proven inOtherProblemClass. -
Specification surveyability:
ProblemFamily.vis intended to be surveyed by mathematicians with little effort. This should not be obstructed by ltac hacks, interspersed lemmas, dependencies, etc. -
Result surveyability:
ProblemFamily_undec.vis intended to be surveyed by mathematicians with little effort. Same design guidelines as forProblemFamily.vapply. This is also true forHaltTM_1_chain_Problem.v. -
Name uniformity: Names of important files and theorems should be easy to guess. For example, a file showing
HaltTM 1 ⪯ Problemshould neither be calledHalt_Prob.v,HALTTM_Problem.v, norHALTTM_1_Problem.v. The preferred name would beHaltTM_1_to_Problem.v. -
Opt-in notations: Notations (also coercions, typeclasses, hints) should not be exposed at the top level of specification. A good practice (cf. Coq
ListcontainingListNotations) is to encapsulate notations (also coercions, typeclasses, hints) in aModule. Adding hints tocoreis discouraged in favor of specialized hint databases.
-
Fast Interfaces: Whenever using
Sectionfor code structure, also useSet Default Proof Using "Type".to ensure fast interface file (vos) compilation. Avoid too manyLetdefinitions in aSectionfor compact interfaces.
-
Structured Proofs: Use
Set Default Goal Selector "!".to ensure precise goal selection and improve maintainability. -
Principled Naming: Avoid referring to automatically generated names (e.g. from
inversion). Such names often break code between Coq version changes. A good guideline is compatibility withSet Mangle Names.. - Regarding Anti-Patterns: For stable code, it is recommended to have a look at Anti-patterns and avoid them when possible.