leanprover / lean4

Lean 4 programming language and theorem prover
https://lean-lang.org
Apache License 2.0
4.07k stars 350 forks source link

`revert` does not respect the argument order #3028

Open eric-wieser opened 7 months ago

eric-wieser commented 7 months ago

Prerequisites

Description

The revert tactic ignores the order of its arguments

Context

[Broader context that the issue occured in. If there was any prior discussion on the Lean Zulip, link it here as well.]

Steps to Reproduce

example (a b c : Nat) : a * b * c = 1 := by
  revert c a b
  sorry

Expected behavior: Goal is ∀ (c a b : Nat), a * b * c = 1 like it was in Lean 3

Actual behavior: Goal is ∀ (a b c : Nat), a * b * c = 1, ignoring the argument order

Versions

4.4.0-rc1

Impact

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

eric-wieser commented 7 months ago

It looks like this is trivially fixed by adding (preserveOrder := true) to:

https://github.com/leanprover/lean4/blob/d4f10bc07e575de14edd08ccbcda55e6dd3fa823/src/Lean/Elab/Tactic/BuiltinTactic.lean#L296

Is the choice to not preserve order deliberate?

semorrison commented 7 months ago

I suspect this is just an oversight. Could you make the PR?