Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat: factor out backtracking code from solve_by_elim #2920

Closed
wants to merge 12 commits into from

Conversation

semorrison
Copy link
Contributor

Following up from discussion on zulip.

No change in functionality, this is just a refactor.


Open in Gitpod

@urkud urkud added the t-meta Tactics, attributes or user commands label Mar 16, 2023
Mathlib/Tactic/SolveByElim.lean Outdated Show resolved Hide resolved
Mathlib/Tactic/SolveByElim.lean Outdated Show resolved Hide resolved
Copy link
Contributor

@kmill kmill left a comment

Choose a reason for hiding this comment

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

The only thing I might have suggested is that acc could be an Array, but that's not a good idea since the program is actually taking advantage of sharing (from the g.firstContinuation line).

The backtracking API seems reasonable enough and it doesn't seem like you're really jumping through any hoops to use it, so I approve.

bors d+

Mathlib/Tactic/Backtracking.lean Outdated Show resolved Hide resolved
@bors
Copy link

bors bot commented Apr 1, 2023

✌️ semorrison can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@semorrison
Copy link
Contributor Author

bors merge

@github-actions github-actions bot added the ready-to-merge This PR has been sent to bors. label Apr 1, 2023
bors bot pushed a commit that referenced this pull request Apr 1, 2023
Following up from discussion on [zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/.60mono.60.20changes.3F).

No change in functionality, this is just a refactor.



Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: thorimur <68410468+thorimur@users.noreply.github.com>
@bors
Copy link

bors bot commented Apr 1, 2023

Build failed:

  • Build

@semorrison
Copy link
Contributor Author

bors merge

bors bot pushed a commit that referenced this pull request Apr 2, 2023
Following up from discussion on [zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/.60mono.60.20changes.3F).

No change in functionality, this is just a refactor.



Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: thorimur <68410468+thorimur@users.noreply.github.com>
@bors
Copy link

bors bot commented Apr 2, 2023

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title feat: factor out backtracking code from solve_by_elim [Merged by Bors] - feat: factor out backtracking code from solve_by_elim Apr 2, 2023
@bors bors bot closed this Apr 2, 2023
@bors bors bot deleted the refactor_solve_by_elim branch April 2, 2023 08:53
MonadMaverick pushed a commit that referenced this pull request Apr 9, 2023
Following up from discussion on [zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/.60mono.60.20changes.3F).

No change in functionality, this is just a refactor.



Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: thorimur <68410468+thorimur@users.noreply.github.com>
MonadMaverick pushed a commit that referenced this pull request Apr 9, 2023
Following up from discussion on [zulip](https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/.60mono.60.20changes.3F).

No change in functionality, this is just a refactor.



Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: thorimur <68410468+thorimur@users.noreply.github.com>
bors bot pushed a commit that referenced this pull request Apr 21, 2023
We had some unfortunate spaghetti code in `solve_by_elim`. When @hrmacbeth had requested additional features for `apply_rules`, the easiest way to provide them was to re-use `solve_by_elim`'s parsing and lemma handling. (See #856.) However `apply_rules` doesn't to backtracking, and `solve_by_elim` is all about it. At the time, `solve_by_elim` didn't have clean separation between its "lemma application" and "backtracking" considerations, so the solution was to add some hacks the prevented the backtracking from actually occurring, in the backtracking code...

Since #2920, those considerations have been cleanly separated out. Thus it's possible to greatly simplify how we don't backtrack when we don't want to (in `apply_rules`). This PR does that.



Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
kbuzzard pushed a commit that referenced this pull request Apr 22, 2023
We had some unfortunate spaghetti code in `solve_by_elim`. When @hrmacbeth had requested additional features for `apply_rules`, the easiest way to provide them was to re-use `solve_by_elim`'s parsing and lemma handling. (See #856.) However `apply_rules` doesn't to backtracking, and `solve_by_elim` is all about it. At the time, `solve_by_elim` didn't have clean separation between its "lemma application" and "backtracking" considerations, so the solution was to add some hacks the prevented the backtracking from actually occurring, in the backtracking code...

Since #2920, those considerations have been cleanly separated out. Thus it's possible to greatly simplify how we don't backtrack when we don't want to (in `apply_rules`). This PR does that.



Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
semorrison added a commit that referenced this pull request May 10, 2023
We had some unfortunate spaghetti code in `solve_by_elim`. When @hrmacbeth had requested additional features for `apply_rules`, the easiest way to provide them was to re-use `solve_by_elim`'s parsing and lemma handling. (See #856.) However `apply_rules` doesn't to backtracking, and `solve_by_elim` is all about it. At the time, `solve_by_elim` didn't have clean separation between its "lemma application" and "backtracking" considerations, so the solution was to add some hacks the prevented the backtracking from actually occurring, in the backtracking code...

Since #2920, those considerations have been cleanly separated out. Thus it's possible to greatly simplify how we don't backtrack when we don't want to (in `apply_rules`). This PR does that.



Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
hrmacbeth pushed a commit that referenced this pull request May 10, 2023
We had some unfortunate spaghetti code in `solve_by_elim`. When @hrmacbeth had requested additional features for `apply_rules`, the easiest way to provide them was to re-use `solve_by_elim`'s parsing and lemma handling. (See #856.) However `apply_rules` doesn't to backtracking, and `solve_by_elim` is all about it. At the time, `solve_by_elim` didn't have clean separation between its "lemma application" and "backtracking" considerations, so the solution was to add some hacks the prevented the backtracking from actually occurring, in the backtracking code...

Since #2920, those considerations have been cleanly separated out. Thus it's possible to greatly simplify how we don't backtrack when we don't want to (in `apply_rules`). This PR does that.



Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
hrmacbeth pushed a commit that referenced this pull request May 11, 2023
We had some unfortunate spaghetti code in `solve_by_elim`. When @hrmacbeth had requested additional features for `apply_rules`, the easiest way to provide them was to re-use `solve_by_elim`'s parsing and lemma handling. (See #856.) However `apply_rules` doesn't to backtracking, and `solve_by_elim` is all about it. At the time, `solve_by_elim` didn't have clean separation between its "lemma application" and "backtracking" considerations, so the solution was to add some hacks the prevented the backtracking from actually occurring, in the backtracking code...

Since #2920, those considerations have been cleanly separated out. Thus it's possible to greatly simplify how we don't backtrack when we don't want to (in `apply_rules`). This PR does that.



Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
delegated ready-to-merge This PR has been sent to bors. t-meta Tactics, attributes or user commands
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants