Skip to content

chore(lean): clear the 106 linter warnings from the build - #14

Merged
barghouthi merged 1 commit into
qqq-wisc:mainfrom
barghouthi:chore/lean-linter-warnings
Sep 5, 2026
Merged

barghouthi merged 1 commit into
qqq-wisc:mainfrom
barghouthi:chore/lean-linter-warnings

Conversation

@barghouthi

Copy link
Copy Markdown
Collaborator

Why

Every lake build replayed cached diagnostics for 15 modules. Nothing was actually recompiling — Replayed means Lake found the cache valid and re-printed the warnings stored from the last real compile — but 106 warnings scrolling past on every invocation reads like a rebuild.

Before:

15 Replayed   0 Built   0 Compiling

plus 106 warnings.

After:

Build completed successfully (5267 jobs).

lake exe tzap-lean is likewise silent before the program's own output.

What changed

15 files, +88/−96. No sorry, no change to any statement — only to the tactic scripts proving them.

fix count
unused simp args dropped from simp/simp only lists 76
simpa … using e → simp […] where simp closed it alone 6
unreferenced binders _-prefixed (hC, hrange×3, hd) 5
dead first alternatives / never-executed tactics removed 5
tac1 <;> tac2 → single-goal form 4

Three places the linter's suggestion was wrong

Each of these was applied, failed the build, and then fixed a different way:

  1. SemanticsCheck — try (rw [pow_two]; exact hsq.symm) (×5). The linter flags exact hsq.symm as doing nothing, and it never does close a goal — but it is load-bearing: it makes the surrounding try roll back when rw [pow_two] leaves a goal behind. Rewriting to try rw [pow_two] keeps the rewrite and broke two goals. Deleting the line outright works, because the try (rw [pow_two, hsq]) / try rw [hsq] / try ring cascade below it picks those goals up.

  2. SemanticsCheck:1184 and CnotMinProof:234 — <;> → ;. Fails with No goals to be solved: the left tactic closes all goals in one branch, and ; errors on zero goals where <;> no-ops. Used all_goals for the follow-up instead.

Two notes for anyone repeating this pass:

  • The unused-simp-arg linter tests each argument individually, so removing several from one call can break it. SemanticsCheck.lean:98 needed map_one, map_neg checked together.
  • Where a list emptied out, simp [] was normalized to simp. Merge.lean:142 legitimately keeps simp only [] at hb' — both its args were unused, but the call still reduces hb'.

Verification

lake build exits 0 with zero errors and zero warnings; a second invocation is a clean no-op in ~1.3s.

Every `lake build` replayed cached diagnostics for 15 modules, which read
as a recompile even though nothing was rebuilt. The build now prints a
single line.

Mechanical: 76 unused `simp` arguments dropped, 6 `simpa ... using e`
narrowed to `simp`, 5 unreferenced binders `_`-prefixed, 5 dead `first`
alternatives removed, 4 `<;>` narrowed to single-goal form.

Three sites needed a different fix than the linter suggested:

- SemanticsCheck: `try (rw [pow_two]; exact hsq.symm)` (x5). The `exact`
  is load-bearing -- it makes the `try` roll back when `rw` leaves a
  goal -- so `try rw [pow_two]` broke two goals. Dropping the line
  outright works; the `rw [pow_two, hsq]` / `rw [hsq]` / `ring` cascade
  below picks those goals up.
- SemanticsCheck and CnotMinProof: `<;>` -> `;` fails with 'No goals to
  be solved', since the left tactic closes every goal in one branch and
  `;` errors where `<;>` no-ops. Used `all_goals` for the follow-up.
@barghouthi
barghouthi merged commit d5dcdcd into qqq-wisc:main Sep 5, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant