Skip to content

feat: config options for fail_if_no_progress - #3757

Closed
thorimur wants to merge 51 commits into
masterfrom
fail_if_no_progress
Closed

thorimur wants to merge 51 commits into
masterfrom
fail_if_no_progress

Conversation

@thorimur

@thorimur thorimur commented May 1, 2023 •

Copy link
Copy Markdown
Contributor

This PR creates config options for fail_if_no_progress that allow the user to tweak what exactly counts as "progress". This includes whether to use defeq or BEq, what transparency to use, and which parts of the goal and local context to check.

It also splits off the comparison functionality into Mathlib.Lean.Meta.Compare, which provides fully configurable comparison functions for common complex metaprogramming types not specific to fail_if_no_progress. These types are Expr, LocalDecl, LocalContext, MetavarDecl, MVarId, and List MVarId.


See zulip for a couple review questions.

Status update: this PR is now basically done, save for some extra tests which should probably be included.

Open in Gitpod

@thorimur thorimur added WIP Work in progress t-meta Tactics, attributes or user commands labels May 1, 2023
@alexjbest

Copy link
Copy Markdown
Member

@thorimur what's the status of this, is there anything I can do to help move it forward?

@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 Jun 2, 2023
@thorimur
thorimur force-pushed the fail_if_no_progress branch from f37e947 to c181194 Compare June 5, 2023 00:01
@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 Jun 5, 2023
@kim-em kim-em added the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Jun 20, 2023
thorimur added 3 commits July 9, 2023 01:33
* evaluates tactics given instead of running them on the main goal
* uses config to specify/restrict progress check
@thorimur
thorimur force-pushed the fail_if_no_progress branch from c181194 to ab5540e Compare July 9, 2023 05:34
@thorimur thorimur removed the awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. label Jul 9, 2023
Comment thread Mathlib/Tactic/FailIfNoProgress.lean Outdated
Comment on lines +128 to +129
def runAndFailIfNoProgress (goal : MVarId) (tacs : TacticM Unit)
(cfg : FailIfNoProgress.Config := {}) : TacticM (List MVarId) := do

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 seems a weird type signature. Perhaps that return type should be MetaM (List MVarId)?

Possibly also tacs should be a MVarId \to MetaM (List MVarId)?

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.

Does this make sense? My objections are:

  • This is all operating in MetaM anyway, using run. (maybe TermElabM, whatever)
  • TacticM shouldn't ever be returning List MVarId: that's what its state is for!
  • I want a purely MetaM level version of all this anyway.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right! Looking back I actually don't know why I even defined runAndFailIfNoProgress. I replaced it with MVarId.failIfNoProgress, MVarId.failIfNoProgress', and MVarId.failIfNoProgress1 in analogy to the corresponding liftMetaTactics, all in MetaM.

Comment thread Mathlib/Tactic/FailIfNoProgress.lean Resolved
@@ -1,12 +1,18 @@
import Mathlib.Tactic.FailIfNoProgress
import Mathlib.Data.List.Basic

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'm not going to insist, but it seems the ratio of configuration options to tests is high! We could add more exhaustive tests, or perhaps just try next time to resist the temptation to add so many knobs that we can't even be bothered testing them. :-)

@kim-em kim-em added awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. and removed awaiting-review labels Aug 27, 2023
@ghost ghost added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Sep 10, 2023
@bors
bors Bot changed the base branch from master to ScottCarnahan/BinomialRing2 September 17, 2023 03:23
@kim-em
kim-em changed the base branch from ScottCarnahan/BinomialRing2 to master September 17, 2023 12:18
@ghost ghost removed the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Oct 22, 2023
Comment thread Mathlib/Lean/Meta/Compare.lean Outdated

/-- Returns `true` if using `BEq` (`.beq`) and `false` if using `isDefEq` (`.defEq`). -/
def EqKind.isBEq : EqKind → Bool
| .beq => true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[lint-style] reported by reviewdog 🐶

Suggested change
| .beq => true
| .beq => true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm surprised this is part of the linter. There's currently an RFC about this: leanprover/lean4#2580.

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'm not sure the RFC has much traction. :-)

@thorimur thorimur added WIP Work in progress and removed awaiting-author Reply -awaiting-author to remove the label on your PR once you have addressed all comments. labels Oct 22, 2023
@ghost ghost added the merge-conflict The PR has a merge conflict with master, and needs manual merging. (this label is managed by a bot) label Nov 22, 2023
@joneugster
joneugster marked this pull request as draft September 19, 2026 16:47
@mathlib-bors

mathlib-bors Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

This pull request is now in draft mode. No active bors state needed cleanup.

While this PR remains draft, bors will ignore commands on this PR. Mark it ready for review before using commands like bors r+ or bors try.

@joneugster

Copy link
Copy Markdown
Member

Mathlib has moved to PRs from forks. This PR is still from a branch of the main repository and will soon be closed! Please migrate the content to a fork and reopen a PR from there if you wish to do so. See Zulip topic for more instructions. Thank you for contributing to mathlib!

@joneugster joneugster added the will-close-soon Unless something changes, we will close this PR soon label Sep 19, 2026
@joneugster joneugster closed this Oct 24, 2026
@YaelDillies
YaelDillies deleted the fail_if_no_progress branch October 24, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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 will-close-soon Unless something changes, we will close this PR soon WIP Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants