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] - refactor(tactic/lift): remove attribute/simp-set and swap side goal #16565

Closed
wants to merge 3 commits into from

Conversation

jcommelin
Copy link
Member

This PR accomplishes two things:

  • It simplifies the design of the lift tactic (while keeping roughly the same user interface, see below). Specifically, it does not need an attribute set to simplify expressions coming from can_lift instances.
    • This will make the tactic easier to port to Lean 4.
    • It accomplishes this by moving two fields of can_lift into out_params. So writing the instances is slightly different from before.
  • If the using h clause is left out, then lift produces a subgoal. This subgoal used to come after the main goal. But I think it is natural to make it the first goal. So that you can write
lift n to nat with k, { linarith },

instead of

lift n to nat using by { linarith } with k,

Open in Gitpod

@jcommelin jcommelin added awaiting-review The author would like community review of the PR t-meta Tactics, attributes or user commands labels Sep 20, 2022
Copy link
Collaborator

@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 change seems reasonable to me. Sticking things in out_params seems like a fine design for meta code, where you're just using the typeclass instances as a database.

@@ -335,7 +335,7 @@ def const_vadd_hom : multiplicative G →* equiv.perm P :=

variable {P}

open function
open _root_.function
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the _root_ necessary, or is it vestigial?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is necessary, for reasons I don't understand.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, it's because there's an equiv.function namespace. I didn't know that _root_ worked in open commands.

I suppose this is fine, but I checked that you can put open function near the beginning of the module. If you don't think that needs to be done, then the PR looks good to me.

Copy link
Member Author

Choose a reason for hiding this comment

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

I would prefer to keep it like this.

src/tactic/lift.lean Outdated Show resolved Hide resolved
src/tactic/lift.lean Outdated Show resolved Hide resolved
@kmill
Copy link
Collaborator

kmill commented Sep 27, 2022

Thanks!

bors r+

@github-actions github-actions bot added ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) and removed awaiting-review The author would like community review of the PR labels Sep 27, 2022
bors bot pushed a commit that referenced this pull request Sep 27, 2022
…16565)

This PR accomplishes two things:

* It simplifies the design of the `lift` tactic (while keeping roughly the same user interface, see below). Specifically, it does not need an attribute set to simplify expressions coming from `can_lift` instances.
  - This will make the tactic easier to port to Lean 4.
  - It accomplishes this by moving two fields of `can_lift` into `out_param`s. So writing the instances is slightly different from before.
* If the `using h` clause is left out, then `lift` produces a subgoal. This subgoal used to come after the main goal. But I think it is natural to make it the first goal. So that you can write
```
lift n to nat with k, { linarith },
```
instead of
```
lift n to nat using by { linarith } with k,
```
@bors
Copy link

bors bot commented Sep 27, 2022

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title refactor(tactic/lift): remove attribute/simp-set and swap side goal [Merged by Bors] - refactor(tactic/lift): remove attribute/simp-set and swap side goal Sep 27, 2022
@bors bors bot closed this Sep 27, 2022
@bors bors bot deleted the refactor-lift branch September 27, 2022 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge All that is left is for bors to build and merge this PR. (Remember you need to say `bors r+`.) t-meta Tactics, attributes or user commands
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants