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

decide +revert not reverting #6034

Closed
3 tasks done
hargoniX opened this issue Nov 11, 2024 · 10 comments
Closed
3 tasks done

decide +revert not reverting #6034

hargoniX opened this issue Nov 11, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@hargoniX
Copy link
Contributor

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

Consider:

theorem Bool.and_left (lhs rhs : Bool) (h : (lhs && rhs) = true) : lhs = true := by
  decide +revert

In this situation I would have expected the new +revert feature to just solve the goal,
given that:

theorem Bool.and_left (lhs rhs : Bool) (h : (lhs && rhs) = true) : lhs = true := by
  revert lhs rhs h
  decide

does work. However it throws:

expected type must not contain free or meta variables
  lhs = true

Expected behavior: decide +revert should close the goal

Actual behavior: decide +revert seemingly does not revert

Versions

nightly-2024-11-11

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

@hargoniX hargoniX added the bug Something isn't working label Nov 11, 2024
@kmill
Copy link
Collaborator

kmill commented Nov 11, 2024

I can't reproduce this on Lean 4.15.0, commit 281c07c
Target: arm64-apple-darwin24.1.0 macOS

What's your #version saying?

@kmill
Copy link
Collaborator

kmill commented Nov 11, 2024

The full error message includes the line "Use the '+revert' option to automatically cleanup and revert free variables." Given that you're not including it, I'm guessing that you're accidentally on an old version and there's a red squiggle on the +.

@nomeata
Copy link
Collaborator

nomeata commented Nov 11, 2024

Something is strange. On live.lean-lang.org today with

Lean 4.15.0-nightly-2024-11-11
Target: x86_64-unknown-linux-gnu

I get red squiggly lines under decide +, but it seems to work and #proof shows the full proofs. Didn’t check locally yet.

huh

Oh, and now as I switch back to that tab it's gone. Reloading makes it appear again. Maybe unrelated to the present issue.

@hargoniX
Copy link
Contributor Author

hargoniX commented Nov 12, 2024

I just built master on 5e01e62 and tried

theorem Bool.and_left (lhs rhs : Bool) (h : (lhs && rhs) = true) : lhs = true := by
  decide +revert

again and it is still erroring with the same error message for me. No error on the +revert only the error I reported. Though interestingly it only happens when I work in Std not when I work on files in e.g. tests/lean/run. Is there a bootstrapping problem or a missed update-stage0 cycle here?

@kmill
Copy link
Collaborator

kmill commented Nov 12, 2024

That's correct, there has not been a stage0 update since this feature was added, so it can't be used from within Lean yet. I generally don't do stage0 updates myself unless they are necessary -- I've just triggered the update-stage0 workflow for you.

I'm wondering if the issue template should mention that you should verify that you aren't using the stage0 compiler. You basically were using the 2024-11-3 nightly when reporting this issue.

@nomeata
Copy link
Collaborator

nomeata commented Nov 12, 2024

Is the nightly release as available through live.lean-lang.org freshly bootstrapped? Should it? Henrik did tick the box next to “I tested it on live.lean-lang.org”, and ideally that is a reliable way to test mwe's.

@kmill
Copy link
Collaborator

kmill commented Nov 12, 2024

Before doing the stage0 update, I also tried it on live.lean-lang.org @nomeata, at least with the 4.15.0-nightly-2024-11-12 edition, and I couldn't see the error.

I don't understand how live.lean-lang.org would have any staging problems. This is all being run serverside, right? so there shouldn't be any caching issues? How could the red squiggles be showing how it would look in the older version but act as if it were the newer version. Did you copy/paste the example @nomeata? or did you type the tactic in manually? I could see the the squiggles happening if you had decide + in the buffer and then finished it by adding revert in a second step.

@nomeata
Copy link
Collaborator

nomeata commented Nov 12, 2024

Right, I also couldn’t see Henrik’s error just (possibly unrelated) other strange behavior. @hargoniX, did you actually “Test your test case against the latest nightly release” as checked, or is this just evidence for my theory that these issue template checkboxes are just mostly ignored by people :-)

I wonder if the phantom red squiggly lines are a consequence of leanprover-community/lean4web#41, where the are actually both versions running on the server. Actually, this is rather likely.

(I can trigger that behavior by going directly to https://live.lean-lang.org/#project=lean-nightly&codez=C4Cwpg9gTmC2AEAhCEA2A6AhgOwCYH1UwAzYeAClRAGd4ob4AuJFVASgpCYqtoDI+dGhwC88YFACuYDs17wxE6UzEAjAJ4AoePFxgAxgEs98ANQwAbmCjAgA, or by reloading, but not by interactively writing and then switching versions.)

@hargoniX
Copy link
Contributor Author

I did indeed merely run it within my current Lean build at the time which was at the nightly commit of that day so I had naively assumed it should behave the same but forgotten about stage0.

@nomeata
Copy link
Collaborator

nomeata commented Nov 15, 2024

Fixed on nightly, right?

@nomeata nomeata closed this as completed Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants