Skip to content

feat: port mono tactic#2323

Closed
thorimur wants to merge 24 commits intomasterfrom
mono
Closed

feat: port mono tactic#2323
thorimur wants to merge 24 commits intomasterfrom
mono

Conversation

@thorimur
Copy link
Copy Markdown
Contributor

@thorimur thorimur commented Feb 16, 2023

We port the full version of the mono attribute and tactic. This includes mono*, mono with ..., and mono using ..., as well as support for @[mono left] and @[mono right].

In particular, mono* introduces infrastructure for minimizeSubgoals, which performs backtracking to minimize the number of subgoals generated by repeated applications of an apply-like tactic, given multiple alternatives to choose from at each stage.


Open in Gitpod

@thorimur thorimur added WIP Work in progress t-meta Tactics, attributes or user commands labels Feb 16, 2023
@thorimur thorimur changed the title feat: port mono feat: port mono tactic Feb 17, 2023
@thorimur thorimur force-pushed the mono branch 3 times, most recently from 8ca03e1 to 7d1ae0f Compare March 15, 2023 02:00
@Parcly-Taxel Parcly-Taxel added awaiting-review and removed WIP Work in progress labels Mar 26, 2023
@thorimur thorimur added WIP Work in progress and removed awaiting-review labels Mar 27, 2023
@kim-em kim-em added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Apr 2, 2023
@kim-em kim-em added merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) and removed merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) labels Apr 16, 2023
@kim-em kim-em removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Apr 25, 2023
@kim-em kim-em added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Apr 28, 2023
@Parcly-Taxel
Copy link
Copy Markdown
Collaborator

Parcly-Taxel commented Apr 30, 2023

This PR, specifically support for mono with with, is apparently needed to finish #3419. Please finalise the port in due course.

@thorimur
Copy link
Copy Markdown
Contributor Author

thorimur commented Apr 30, 2023

This PR, specifically support for mono with with, is apparently needed to finish #3419. Please finalise the port in due course.

Heard, will do! :) Note: this will pass CI before it's ready for review. I will mark it ready for review when it's ready for review.

@thorimur thorimur force-pushed the mono branch 2 times, most recently from cd765c3 to 7b4b550 Compare April 30, 2023 18:35
@kim-em kim-em removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Apr 30, 2023
@Ruben-VandeVelde
Copy link
Copy Markdown
Contributor

@thorimur is this ready for review?

@thorimur
Copy link
Copy Markdown
Contributor Author

thorimur commented May 2, 2023

@thorimur is this ready for review?

Nope, as stated above, I'll put it out for review when it's ready for review. :) (Note the pervasive lack of docstrings!) I'm trying to finish it off today; I also revamped the workings of mono*, and I'm currently refactoring that so that it's not so terrible to review. (Sorry, I might wind up force-pushing your commit away so that I can do some git surgery; I'm working locally as I figure it out.)

@kim-em kim-em added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label May 3, 2023
@kim-em kim-em added the awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. label Jun 7, 2023
@kim-em kim-em added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Jul 4, 2023
@bors bors bot changed the base branch from master to ScottCarnahan/BinomialRing2 September 17, 2023 03:24
@kim-em kim-em changed the base branch from ScottCarnahan/BinomialRing2 to master September 17, 2023 12:18
@thorimur thorimur added awaiting-author A reviewer has asked the author a question or requested changes. and removed awaiting-review labels Oct 23, 2023
@jcommelin jcommelin added the mathlib-port This is a port of a theory file from mathlib. label Feb 14, 2024
@YaelDillies
Copy link
Copy Markdown
Contributor

Is this PR still relevant? It seems mono made it well and good to Lean 4 already.

@thorimur
Copy link
Copy Markdown
Contributor Author

thorimur commented Feb 15, 2024

@YaelDillies I don't think this PR should go ahead as-is: I feel like the consensus (from a porting meeting a long time ago) was that this PR simply demanded too much review/introduced too much unneeded infrastructure, the current behavior was ok, and that we had another more opinionated tactic (something involving congr?) to help with some specific monotonicity cases anyway.

However, note that lean 3 mono did not make it into mathlib4 as advertised! Currently it still just uses solve_by_elim under the hood (thus it's really closer to mono*), and actually throws errors upon seeing left/right, with, and using syntax.

I feel like there's an argument to be made for intentionally abandoning some of the syntax: mono ... with was essentially an artifact of mono's bespoke backtracking procedure. using could perhaps be incorporated into a solve_by_elim or aesop call. left and right could be useful to someone, and it makes sense to have some way to distinguish between these different sorts of lemmas based on strictness, but I'm not sure calling them "left" and "right" is really a clear, understandable abstraction. Also, @[mono left] and @[mono right] are pretty infrequent. But we should probably discuss this on Zulip (EDIT: now here)

Either way, mono currently does need fixing up, but I'm pretty sure this PR is not the way to do it. There's a chance it might be useful for reference when doing that fixup, but I'd rather reference it as a closed PR instead of an open one. :)

@thorimur thorimur closed this Feb 15, 2024
@YaelDillies YaelDillies deleted the mono branch July 31, 2025 11:35
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. awaiting-CI This PR does not pass CI yet. This label is automatically removed once it does. mathlib-port This is a port of a theory file from mathlib. merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) t-meta Tactics, attributes or user commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants