Skip to content

chore: simplify show _ from by _ to show _ by _#41493

Open
kbuzzard wants to merge 2 commits into
leanprover-community:masterfrom
kbuzzard:kbuzzard-show-from-by-cleanup
Open

chore: simplify show _ from by _ to show _ by _#41493
kbuzzard wants to merge 2 commits into
leanprover-community:masterfrom
kbuzzard:kbuzzard-show-from-by-cleanup

Conversation

@kbuzzard

@kbuzzard kbuzzard commented Jul 8, 2026

Copy link
Copy Markdown
Member

show X from t proves X using the term t; show X by tac proves X using the tactic tac.

show X from by tac is thus a redundant lengthening of show X by tac.

This replaces all 21 occurrences of show _ from by _ in the library with show _ by _.


Open in Gitpod

(Note: there are also 10 suffices _ from by _ occurrences -- should I change them in this PR too?)

The term-mode `show t from e` elaborator and the `show t by tac` elaborator
are both provided by the core `show` term syntax, so `show t from by tac` is
exactly equivalent to the more direct `show t by tac`. This replaces all 20
occurrences of the former idiom with the latter across the library.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kbuzzard kbuzzard added the WIP Work in progress label Jul 8, 2026
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

PR summary b331e6c19f

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff (regex)

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

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

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

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean)

Lean-aware diff — post-build, computed from the Lean environment (commit b331e6c).

  • +0 new declarations
  • −0 removed declarations

No declaration differences.


No changes to strong technical debt.

No changes to weak technical debt.

Current commit b331e6c19f
Reference commit ae588ec23e

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/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).

@felixpernegger felixpernegger left a comment

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.

A quick search that suffices foo from by also appears a couple of times, which culd also be shortened. (I didnt read the description fully...)

And I think you missed one occurence in Mathlib/Topology/Algebra/Monoid.lean (which goes over multiple lines, this is the only from by pattern doing that

`show t from by tac` split across two lines (`from` at end of one line,
`by` at the start of the next) in `Topology/Algebra/Monoid.lean` was missed
by the single-line search; convert it to `show t by tac` as well.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kbuzzard

kbuzzard commented Jul 8, 2026

Copy link
Copy Markdown
Member Author

Thanks! I've added that change.

@grunweg

grunweg commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

I'll be happy to review the suffices change also, but that can also be a separate PR.

@grunweg

grunweg commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

The diff so far LGTM; is there a reason this PR is still labelled WIP?

@kbuzzard kbuzzard removed the WIP Work in progress label Jul 8, 2026
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.

3 participants