docs: style guides, contributor guide, and a student README - #21
Merged
Merged
Conversation
Adapted from sf-in-lean's project documentation, keeping what fits a one-author book with a course monitor as alpha tester and dropping the machinery for coordinating several contributors across branches (Zulip, CODEOWNERS, the branch-activity dashboard, the draft-PR protocol). New files: * STYLE-CODE.md — Lean and Verso conventions. Its core is a ledger of which Lean feature is first used in which chapter, derived from a sweep of the code inside `lean` blocks: it makes checkable the constraint DEVIATIONS.md states, that nothing is used before it is presented. Because the book is mostly programs rather than proofs, the ledger covers every Lean feature, not only tactics. It also documents the directive vocabulary already implemented in CSwLMeta/ (`:::exercise`, `solution!`, `:::gradeTheorem`, `:::dev`, `:::quiz`, the build variants), which had no documentation at all. * STYLE-WRITING.md — prose conventions. Absorbs the "Pedagogical decisions" section from CLAUDE.md, adds writing advice adapted from sf-in-lean, and starts a Portuguese term list. The list is deliberately short: it records decisions actually taken rather than a vocabulary invented in advance. * CONTRIBUTING.md — workflow, and who decides what. Content and structure remain the author's; the objective tasks open to a contributor are listed explicitly. Its AI policy is this project's own, not sf-in-lean's: AI never writes prose on its own initiative, translates as literally as the target language allows, and produces drafts for human revision. Other changes: * CLAUDE.md points at the two style guides instead of carrying the pedagogical section itself. * README.md stops restating conventions that are now normative elsewhere. * DEVIATIONS.md refers to GitHub issues, TODO.md having been retired in favour of them. * CSwLMeta/Save/Project.lean — the generated project's README was in Portuguese and said only "do not edit here". It is now in English, like every other document about the project, and the `student` variant carries a full setup guide: how to build, how to work an exercise, where to report a problem. That variant is what reaches the students. The pending work the retired TODO.md tracked is now in GitHub issues #3–#20; everything it recorded as done was discarded rather than filed to be closed. These documents were drafted with Claude Code (Opus 5) from decisions taken in conversation with the author, who directed the scope, rejected several proposals, and reviewed the result. The feature ledger in STYLE-CODE.md was derived by script from the chapter sources and then corrected by hand where the scan proved too narrow.
There was a problem hiding this comment.
🟡 Changes recommended
Documentation inaccuracies and scope inconsistencies should be corrected before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds project style guides, contributor workflow documentation, and English setup guidance for generated student projects while moving pending work from TODO.md to GitHub issues.
Changes:
- Adds Lean/Verso and Portuguese writing conventions.
- Updates contributor and project documentation.
- Updates generated READMEs and includes FOL teaching drafts.
File summaries
| File | Reviewed changes |
|---|---|
STYLE-WRITING.md |
Prose and Portuguese writing conventions |
STYLE-CODE.md |
Lean, Verso, variants, and feature-ledger conventions |
README.md |
Links to normative documentation |
doc/fol-semantics.md |
FOL semantics teaching notes |
doc/entailment.md |
Entailment teaching notes |
DEVIATIONS.md |
Project deviations and issue tracking |
CSwLMeta/Save/Project.lean |
Generates English student project READMEs |
CSwL/Logic/FOL.lean |
Adjusts code warning line length |
CONTRIBUTING.md |
Contributor workflow and AI policy |
CLAUDE.md |
References the style guides |
Review details
Suppressed comments (6)
README.md:72
- This repeats the inaccurate description that
CSwL/Games.leanonly gathers included sections; the file also contains chapter-level introductory prose before the includes. Please describe it as gathering sections while allowing introductory prose, so this overview agrees with the actual glue file and the normative style guide.
Mnemonic file names, never numbers. A short chapter is a single file
(`CSwL/Sets.lean`, `namespace Sets`); a chapter whose sections are long enough
to deserve their own file is a "glue" file (`CSwL/Games.lean`) that only
gathers them, via `{include 1 ...}`, from a same-named directory
STYLE-CODE.md:85
- These lines say the explanation is hidden inside the solution, but
CSwL/Morphology/SwedishPlural.lean:63-66is a comment outside thesolution!markers, so it survives the student source rewrite. The actual problem is that it is a Portuguese Lean comment; please correct this description and decide whether to promote the explanation to prose or rewrite the comment in English.
appears, and a comment at `:63-66` says why, but that comment is inside the
solution and in Portuguese, so the explanation reaches neither the student
nor the English code-comment rule.
STYLE-CODE.md:178
:::devis not currently filtered by variant:Block.devcomment.traversereturnsnoneunconditionally, and the extractor emits shown notes without consultinggetCurrVariant. Thus the existing no-urgency note inCSwL/Logic/FOL.leanappears in the student and terse HTML/generated Lean, so this guarantee is false until issue #4 is implemented.
- `:::dev` — an internal note to the authors. It renders with the heading
"Nota editorial" and must never carry anything the student should not read.
AI-generated commentary belongs here and is marked as such.
STYLE-CODE.md:124
CSwL/Games.leanis not only an include aggregator: it also contains the chapter's introductory prose at lines 12–21 before the two includes. Calling this a file that “only gathers” sections gives contributors an incorrect model of where chapter-level prose belongs.
A short chapter is a single file (`CSwL/Sets.lean`). A chapter whose sections
are long enough to deserve their own files is a "glue" file (`CSwL/Games.lean`)
that only gathers them via `{include 1 …}` from a same-named directory. Each
doc/entailment.md:111
- A complete theory is one that decides every formula—typically, for each
φ, eitherΓ ⊨ φorΓ ⊨ ¬φ; it is not generally defined by having a single model or valuation. If uniqueness is only the property of this finite example, state it as the reason completeness follows here rather than as the definition.
* **teoria completa:** \(\Gamma\) restringe as interpretações a uma única valuation, nesse exemplo.
doc/entailment.md:111
valuationis left in English inside this Portuguese note, while the surrounding logic chapters consistently usevaloração. That makes the term look like a second concept; use the established Portuguese term.
* **teoria completa:** \(\Gamma\) restringe as interpretações a uma única valuation, nesse exemplo.
- Files reviewed: 10/10 changed files
- Comments generated: 5
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+59
to
+61
| For a comment that is local to one passage and only makes sense with that | ||
| section in view, use a `:::dev` note in the Lean file itself rather than an | ||
| issue. Those render as editorial notes and never reach the student. |
Comment on lines
+117
to
+118
| problem. The other variants are read by the instructor, who has the repository | ||
| itself, and get only the note saying where they came from. |
Comment on lines
+88
to
+90
| - **`Sets.lean` uses `Setoid`, `Fintype` and `Finset` with no presentation.** | ||
| A short paragraph plus a citation for each would settle it, under the | ||
| loosening `DEVIATIONS.md` describes. |
| @@ -0,0 +1,124 @@ | |||
|
|
|||
| ### Exemplo | |||
| @@ -0,0 +1,246 @@ | |||
|
|
|||
| A grande mudança em relação à lógica proposicional é justamente esta: | |||
PL.lean — the chapter opens with the acronym PL, from the English, which is what the file and section tags already use; the Portuguese LP appeared only here. The paragraph now states the chapter's aim as making precise that one proposition follows from another, rather than as escaping the imprecision of natural language. FOL.lean — the ∀-introduction example binds `n`, so the introduced name differs from the bound variable it replaces and the tactic's effect is visible. doc/entailment.md and doc/fol-semantics.md were working notes toward this material; nothing references them.
`Block.devcomment`'s `traverse` returned `none` unconditionally and never
consulted `getCurrVariant`, so an editorial note survived into every variant.
The one note in the book — a design observation about `PredSymbol` in
`Logic/FOL.lean` — was reaching students in both the HTML and the generated
`.lean`.
The student variant now drops every dev note during traversal. Both surfaces
are produced from the per-variant traversed tree, so the one guard covers
them; the extractor needs no change. `terse`, `solutions` and `grading` keep
every note: the first is the instructor's, where a note on screen during a
class is harmless, and the other two are the authors'.
Verified by regenerating all four variants and grepping both surfaces:
VARIANT HTML LEAN
student 0 0
terse 1 1
solutions 1 1
grading 1 1
The docstrings that recorded the old behaviour as deliberate ("every variant
is a reader of the book") are rewritten, and `STYLE-CODE.md` now documents the
two independent filters — by variant in `traverse`, by urgency in
`devNoteShown`. `CONTRIBUTING.md` needs no edit: the promise it already makes,
that `:::dev` blocks never reach the student, is now true.
Closes #4.
small fixes proposed by the Co-Pilot review of the PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Project documentation adapted from sf-in-lean, plus the retirement of
TODO.mdin favour of GitHub issues.What this adds
Three new documents, and the wiring so the existing ones point at them rather
than duplicating them.
STYLE-CODE.md— Lean and Verso conventions. Its core is a ledger ofwhich Lean feature is first used in which chapter, derived from a sweep of the
code inside
```leanblocks. It makes checkable the constraintDEVIATIONS.mdalready states — nothing is used before it is presented —which until now was verified by hand. Because this book is mostly programs
rather than proofs, the ledger covers every Lean feature, not only tactics.
It also documents the directive vocabulary that
CSwLMeta/alreadyimplements (
:::exercise,solution!,:::gradeTheorem,:::dev,:::quiz, the four build variants) and that had no documentation anywhere:writing a chapter previously meant reading the elaborator.
STYLE-WRITING.md— prose conventions. Absorbs the "Pedagogicaldecisions" section out of
CLAUDE.md, adds writing advice adapted fromsf-in-lean, and starts a Portuguese term list. That list is deliberately
short: it records decisions actually taken, because prescribing a term the
book has never used against an alternative it has never used is the same
failure the section exists to catch.
CONTRIBUTING.md— workflow, and who decides what. Written for thesituation this repository is actually in: one author, with the course monitor
as alpha tester. Content and structure stay with the author; the objective
tasks open to a contributor are listed explicitly. The coordination machinery
sf-in-lean needs for several contributors across branches — Zulip, CODEOWNERS,
the branch-activity dashboard, the draft-PR protocol — is deliberately absent.
Its AI policy is this project's own rather than sf-in-lean's, which forbids
AI-written prose outright and would contradict
CLAUDE.md: here AI neverwrites prose on its own initiative, translates as literally as the target
language allows, and produces drafts for human revision.
Findings from the sweep
Writing the ledger meant reading the chapters against the rule, which turned
up things now filed as issues:
:::devnotes reach the student, in the HTML and in the generated Lean,in every variant — including the
terseproject opened in class (:::devnotes reach the student, in the HTML and in the generated Lean #4).native_decide,trivial,injectionand oneFintypeinstance are usedwithout being presented (Lean features used without being presented #7).
DEVIATIONS.mdsays belongs inDEVIATIONS.md(Two paragraphs defend an editorial choice in the book's prose #5).Two things I initially reported as violations turned out not to be, and the
ledger records why:
IntroCS's use of unpresented Lean is the constraint'sone accepted exception, and
simp/decideare presented — in a plain-texttable that a scan of
leanblocks does not see.STYLE-CODE.mdnow carriesthat caveat so the next sweep does not repeat the mistake.
One behaviour change
CSwLMeta/Save/Project.lean— the generated project'sREADME.mdwas inPortuguese and said only "não edite aqui". It is now in English, like every
other document about the project, and the
studentvariant carries a realsetup guide: how to build, how to work an exercise, where to report a problem.
That variant is what reaches the students at
emap-nlp/book.TODO.md is gone
Its 20 open items were consolidated into GitHub issues #3–#20; everything it
recorded as done was discarded rather than filed to be closed. Issue #3 is the
umbrella for the restructuring the rest of them depend on.
Note on scope
This branch also carries
0d16e25 drafts, which is unrelated teachingmaterial. The documentation work is
d9db3e5.Uncommitted and deliberately left out: prose edits in
PL.leanandFOL.lean, and working notes underdoc/.AI usage
The documents were drafted with Claude Code (Opus 5) from decisions taken in
conversation, with the author directing scope, rejecting several proposals,
and reviewing the result. The feature ledger was derived by script from the
chapter sources and corrected by hand where the scan proved too narrow. This
description was likewise AI-drafted and reviewed.