Skip to content

chore: deprime induction for localizations and quotients#23676

Closed
Parcly-Taxel wants to merge 11 commits intomasterfrom
deprime-localization-quot
Closed

chore: deprime induction for localizations and quotients#23676
Parcly-Taxel wants to merge 11 commits intomasterfrom
deprime-localization-quot

Conversation

@Parcly-Taxel
Copy link
Copy Markdown
Collaborator

All these removed instances of induction' generate only one subgoal. In some cases obtain can be used.

The relevant instances were identified by adding the following to Mathlib.Tactic.Cases

diff --git a/Mathlib/Tactic/Cases.lean b/Mathlib/Tactic/Cases.lean
index 4a60db6c551..08c06520879 100644
--- a/Mathlib/Tactic/Cases.lean
+++ b/Mathlib/Tactic/Cases.lean
@@ -122,6 +122,16 @@ elab (name := induction') "induction' " tgts:(Parser.Tactic.elimTarget,+)
         g.assign result.elimApp
         let subgoals ← ElimApp.evalNames elimInfo result.alts withArg
           (generalized := fvarIds) (toClear := targetFVarIds) (toTag := toTag)
+        let body ← inferType targets[0]!
+        let names : Array Format := if withArg.1.getArgs.size > 1 then
+          (withArg.1.getArgs[1]!).getArgs.map Syntax.prettyPrint else Array.empty
+        let gens : Array Format := if genArg.1.getArgs.size > 1 then
+          (genArg.1.getArgs[1]!).getArgs.map Syntax.prettyPrint else Array.empty
+        let inductor : Format := if usingArg.1.getArgs.size > 1 then
+          Syntax.prettyPrint usingArg.1.getArgs[1]! else "~"
+        if subgoals.toList.length ≤ 1 then
+          logInfoAt tgts m!"{body.getAppFn.setPPExplicit true} {inductor} {gens} {names} \
+            {subgoals.toList.length}"
         setGoals <| (subgoals ++ result.others).toList ++ gs
 
 /-- The `cases'` tactic is similar to the `cases` tactic in Lean 4 core, but the syntax for giving

and then examining the output.

@Parcly-Taxel Parcly-Taxel added the tech debt Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip label Apr 4, 2025
@Parcly-Taxel Parcly-Taxel requested a review from eric-wieser April 4, 2025 19:01
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 4, 2025

PR summary 7deb334c5f

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/declarations_diff.sh <optional_commit>

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

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


No changes to technical debt.

You can run this locally as

./scripts/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).

@grunweg grunweg added the awaiting-author A reviewer has asked the author a question or requested changes. label May 2, 2025
@grunweg
Copy link
Copy Markdown
Contributor

grunweg commented May 2, 2025

Coming here from PR triage: it looks like there is disagreement with some of these changes. (Some of this might be blocked on core improvements, other on zulip discussion - or the author reverting the controversial changes.)

@Parcly-Taxel Parcly-Taxel removed the awaiting-author A reviewer has asked the author a question or requested changes. label May 3, 2025
@Parcly-Taxel Parcly-Taxel requested a review from eric-wieser May 3, 2025 07:47
@Parcly-Taxel
Copy link
Copy Markdown
Collaborator Author

Parcly-Taxel commented May 3, 2025

Coming here from PR triage: it looks like there is disagreement with some of these changes. (Some of this might be blocked on core improvements, other on zulip discussion - or the author reverting the controversial changes.)

Resolved, using the new induction syntax.

@Parcly-Taxel Parcly-Taxel changed the title chore: deprime induction' for localizations and quotients chore: deprime induction for localizations and quotients Jun 2, 2025
@Parcly-Taxel Parcly-Taxel removed the request for review from eric-wieser June 2, 2025 00:56
@leanprover-community-bot-assistant leanprover-community-bot-assistant added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 6, 2025
@leanprover-community-bot-assistant
Copy link
Copy Markdown
Collaborator

This pull request has conflicts, please merge master and resolve them.

@github-actions github-actions bot removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jun 7, 2025
Parcly-Taxel added a commit that referenced this pull request Jun 8, 2025
Most replacements that are also in #23676 have been copied over, but some have been optimised further.
@Parcly-Taxel Parcly-Taxel deleted the deprime-localization-quot branch June 12, 2025 09:59
mathlib-bors bot pushed a commit that referenced this pull request Sep 3, 2025
)

Most replacements that are also in #23676 have been copied over, but some have been optimised further.

Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>
CBirkbeck pushed a commit to CBirkbeck/mathlib4 that referenced this pull request Sep 8, 2025
…nprover-community#25774)

Most replacements that are also in leanprover-community#23676 have been copied over, but some have been optimised further.

Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>
yuanyi-350 pushed a commit to yuanyi-350/yuanyi_mathlib4 that referenced this pull request Sep 10, 2025
…nprover-community#25774)

Most replacements that are also in leanprover-community#23676 have been copied over, but some have been optimised further.

Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>
robertmaxton42 pushed a commit to robertmaxton42/mathlib4 that referenced this pull request Sep 11, 2025
…nprover-community#25774)

Most replacements that are also in leanprover-community#23676 have been copied over, but some have been optimised further.

Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>
joelriou pushed a commit to joelriou/mathlib4 that referenced this pull request Oct 2, 2025
…nprover-community#25774)

Most replacements that are also in leanprover-community#23676 have been copied over, but some have been optimised further.

Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tech debt Tracking cross-cutting technical debt, see e.g. the "Technical debt counters" stream on zulip

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants