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

simp unfolding let even with zeta := false option #2669

Closed
1 task done
PatrickMassot opened this issue Oct 11, 2023 · 0 comments
Closed
1 task done

simp unfolding let even with zeta := false option #2669

PatrickMassot opened this issue Oct 11, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@PatrickMassot
Copy link
Contributor

Prerequisites

  • Put an X between the brackets on this line if you have done all of the following:
    • Check that your issue is not already filed.
    • Reduce the issue to a minimal, self-contained, reproducible test case. Avoid dependencies to mathlib4 or std4.

Note this issue may be related to #2281, I am not sure.

Description

simp (config :={zeta := false}) sometimes unfold let values.

Context

This is a regression compared to Lean 3 that complicates porting the sphere eversion project for instance. It was discussed on Zulip.

Steps to Reproduce

def f : Nat → Nat := fun x ↦ x - x

@[simp]
theorem f_zero (n : Nat) : f n = 0 := Nat.sub_self n

example (n : Nat) : False := by
  let g := f n
  have : g + n = n := by 
    simp (config := {zeta := false}) [Nat.zero_add]
  sorry

Expected behavior:

The simp should fail. In Lean 3 the dsimp line below is needed.

-- Lean 3 code
def f : nat → nat := fun x, x - x

@[simp]
lemma f_zero (n : ℕ) : f n = 0 := nat.sub_self n

example (n : nat) : false :=
begin
  let g := f n,
  have : g + n = n,
  { -- dsimp only [g],
    simp [nat.zero_add] },
  sorry
end

Actual behavior:

Lean 4 happily closes the goal. Of course in my example this looks like a feature, but in actual examples it prevents simp from closing the goal, by sending it to a dead end.

Versions

Lean (version 4.2.0-rc1, commit a62d2fd, Release)
Ubuntu 22.04

Impact

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

@PatrickMassot PatrickMassot added the bug Something isn't working label Oct 11, 2023
leodemoura added a commit that referenced this issue Oct 22, 2023
This commit also removes parameter `simpleReduce` from discrimination
trees, and take WHNF configuration options.
Reason: it is more dynamic now. For example, the simplifier
will be able to use different configurations for discrimination tree insertion
and retrieval. We need this feature to address issues #2669 and #2281

This commit also removes the dead Meta.Config field `zetaNonDep`.
leodemoura added a commit that referenced this issue Oct 22, 2023
leodemoura added a commit that referenced this issue Oct 25, 2023
This commit also removes parameter `simpleReduce` from discrimination
trees, and take WHNF configuration options.
Reason: it is more dynamic now. For example, the simplifier
will be able to use different configurations for discrimination tree insertion
and retrieval. We need this feature to address issues #2669 and #2281

This commit also removes the dead Meta.Config field `zetaNonDep`.
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

1 participant