Coq and Rocq
Admitted compiles, and so does a theorem about the wrong proposition. The kernel checks
the proof; you check that the statement is the claim, that no assumption was smuggled in,
and that the compiled library passes an independent check. Coq 8.x commands and the Rocq 9
rocq subcommands are both given; use the pair the installed version provides.
Project
_CoqProjectlists the logical mapping and the files:-Q theories MyLib(or-Rfor recursive legacy mapping), optional-arg -w -arg -notation-overridden, then one.vpath per line. Generate the Makefile withcoq_makefile -f _CoqProject -o Makefile(Rocq 9:rocq makefile -f _CoqProject -o Makefile) and build withmake. A single file compiles withcoqc -Q theories MyLib theories/File.v(rocq compile). Dune projects use a(coq.theory (name MyLib))stanza instead.- Install and pin through opam (
opam install coq.8.20.0orrocq-prover), and record the version withcoqc --version(rocq --version). Library packages such ascoq-mathcomp-ssreflectorcoq-stdppchange tactic vocabulary; note which are used. - Interactive checking: VsCoq or coq-lsp in the editor,
coqtop(rocq repl) for quick experiments. Never trust a proof that was only stepped through interactively; compile the file.
Statement fidelity
- Run
Check,About,PrintandLocateon every notation and definition the statement uses. Traps:natsubtraction truncates,/andmodonnatandZfollow different rounding conventions,Propversusbool(=versus=?, bridged byreflect), implicit coercions (Print Coercions,Set Printing Coercions), notations that hide arguments (Set Printing All). Real numbers in the standard library are axiomatized, soPrint Assumptionson a real-analysis result lists their axioms. - Evaluate the statement on a concrete instance:
Compute,Eval compute in, or anExampleclosed byreflexivity. UseFailto assert that a wrong variant does not typecheck. Check hypotheses are satisfiable with a concrete witness. - Hypotheses belong in the theorem statement.
AxiomandParameterbecome genuine assumptions of everything downstream; sectionVariables are discharged into premises when the section closes. State the claim as one closed theorem so a reader sees every premise.
Search
Search (_ + _ = _ + _).,Search "comm" in Nat.,Search plus minus.,SearchPattern (_ <= _ + _).,SearchRewrite (_ + 0).; filtersinsideandoutsiderestrict modules.Locate "+"resolves a notation to its definition. LoadLiaforlia(linear integer arithmetic),Lraforlra,Ring,Field,Nia.- Tactic families:
lia,nia,lra,ring,field,congruence,autoandeautowith hint databases,firstorder,intuition; ssreflect if MathComp is in use. Name introduced variables (intros x y H) rather than relying on generated names.
Hygiene
Qedseals a proof as opaque, right for theorems.Definedkeeps it transparent, needed only when other code must compute through it (definitions built by tactics,Program, dependent types).OpaqueandTransparentadjust later;Print Opaque DependenciesandPrint Transparent Dependenciesshow the consequences. A transparent lemma inside a computation can makesimplexplode.- No
Admittedand noadmitin a finished development. Use bullets (-,+,*) or{ }for subgoals andSet Default Goal Selector "!".so a tactic that accidentally applies to several goals fails loudly. - Run the independent checker on the compiled library,
coqchk -Q theories MyLibfollowed by the module name (rocq checkin Rocq 9), with-oto print the assumptions it found. It re-verifies the.vofiles without trusting the compiler's bookkeeping.
Audit
Print Assumptions my_theorem.The answerClosed under the global contextmeans no axioms and no admitted lemmas. Otherwise it lists each axiom (for examplefunctional_extensionality_dep,Classical_Prop.classic,proof_irrelevance,Eqdep.Eq_rect_eq.eq_rect_eq, the real-number axioms) and everyAdmittedresult the proof depends on. Quote the list verbatim and say which items are standard classical or extensionality axioms and which are unfinished proofs.- Deliver the sources, the
_CoqProject, the exact build andcoqchkcommands with their output, thePrint Assumptionsoutput, and a clause-by-clause mapping from the informal claim to the formal statement.
Checklist
-
_CoqProjectand Makefile build cleanly from scratch; version recorded. - Every definition and notation in the statement inspected with
PrintorLocate. - Statement evaluated on a concrete instance; hypotheses shown satisfiable.
- No
Admitted,admit, strayAxiomorParameter. -
Print Assumptionsandcoqchkoutput recorded and explained.
Sources
- Rocq reference manual (commands,
Search,Print Assumptions,rocq makefile): https://rocq-prover.org/doc/V9.0.0/refman/ - Coq 8.20 reference manual: https://coq.inria.fr/doc/V8.20.0/refman/
- Rocq standard library: https://rocq-prover.org/doc/V9.0.0/stdlib/
- Rocq Platform and opam packages: https://github.com/rocq-prover/platform
- Software Foundations, Volume 1 (Logical Foundations): https://softwarefoundations.cis.upenn.edu/lf-current/
- Certified Programming with Dependent Types: http://adam.chlipala.net/cpdt/
- coq-lsp: https://github.com/ejgallego/coq-lsp