Skip to content

chore(Tactic): rewrite reduce_mod_char tactic docstring#37929

Open
Vierkantor wants to merge 2 commits intoleanprover-community:masterfrom
Vierkantor:document-reduce_mod_char-tactic
Open

chore(Tactic): rewrite reduce_mod_char tactic docstring#37929
Vierkantor wants to merge 2 commits intoleanprover-community:masterfrom
Vierkantor:document-reduce_mod_char-tactic

Conversation

@Vierkantor
Copy link
Copy Markdown
Contributor

This PR rewrites the docstrings for the reduce_mod_char tactic, to consistently match the official style guide, to make sure they are complete while not getting too long.


Open in Gitpod

This PR rewrites the docstrings for the `reduce_mod_char` tactic, to consistently match the official style guide, to make sure they are complete while not getting too long.
@Vierkantor Vierkantor added documentation Improvements or additions to documentation t-meta Tactics, attributes or user commands labels Apr 11, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 11, 2026

PR summary 062adc5c07

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

No declarations were harmed in the making of this PR! 🐙

You can run this locally as follows
## summary with just the declaration names:
./scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

/--
The tactic `reduce_mod_char` looks for numeric expressions in characteristic `p`
and reduces these to lie between `0` and `p`.
`reduce_mod_char` rewrites the main goal by looking for numeric subexpressions in characteristic `p`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer "expressions" over "subexpressions". I don't think the "sub" really adds anything useful. (Though it seems that later in the original version, they do use "subexpression")

And more generally, I like the original phrasing of this sentence.

Comment on lines +290 to +292
hypothesis in the context. (Limitations of the typeclass system mean the tactic can't search for a
`CharP R n` instance if `n` is not yet known; use
`have : CharP R n := inferInstance; reduce_mod_char!` as a workaround.)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This limitation was fixed in #25357

and reducing these to lie between `0` and `p`.

For example:
The expressions are found by pattern matching on their inferred type, unless expensive mode is
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This went from "uses the type of the subexpression" to "by pattern matching on their inferred type". The latter includes metaprogramming jargon like "pattern matching" and "inferred type", which I think makes the doc-strings harder to read for new users.

@joneugster joneugster added the awaiting-author A reviewer has asked the author a question or requested changes. label Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author A reviewer has asked the author a question or requested changes. documentation Improvements or additions to documentation t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants