Skip to content

Commit 4a8ce6c

Browse files
Merge pull request #255 from SkyLabsAI/gmalecha/rocq-style
Proposals for some coding conventions
2 parents a8d9e8a + 9f9fbe3 commit 4a8ce6c

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Repository Guide
2+
3+
This repository hosts a collection of Rocq (Coq) packages as well as Rocq-related tools.
4+
5+
## Rocq Style
6+
7+
Follow the conventions in [ROCQ_STYLE.md](ROCQ_STYLE.md).
8+
9+
## OCaml Style
10+
11+
Always use `dune b @fmt` to re-format OCaml code according to the coding convention.

ROCQ_STYLE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Rocq Style
2+
3+
- **Always** use attributes to track command modifiers. For example.
4+
- `#[local]`, NOT `Local`,
5+
- `#[global]`, NOT `Global`,
6+
- `#[export]`, NOT `Export`,
7+
- `#[program]`, NOT `Program`, and
8+
- `#[universes(polymorphic=yes)]` instead of `Polymorphic`
9+
- `#[universes(polymorphic=yes,cumulative=yes)]` instead of `Polymorphic Cumulative`
10+
11+
- Top-level definitions should have
12+
- Type ascriptions on all arguments except for variables of type `Type`.
13+
- A return type annotation
14+
15+
- When working in a section that requires a lot of `Proof using xxx` lines. Use `Set Default Proof Using` rather than replicating the line.
16+
- Prefer `Set Default Proof Using "Type*"`.
17+
18+
- `Arguments` commands **MUST** have a locality defined, e.g. `#[local] Arguments`.
19+
20+
- Avoid explicit qualifications when possible. For example,
21+
- use `length` rather than `Datatypes.length`.
22+
- AGENT: When editing code that is meant to be simple, semantics-preserving refactoring, the need for additional qualification should be called out explicitly.

0 commit comments

Comments
 (0)