leanprover / leanprover/lean4

omega does not look through abbreviations in types

Open
#5,733 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug P-medium
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

I would expect this to work

example (x : Fin 3) : x ≠ x + 1 := by omega

abbrev Foo := Fin 3

/--
error: omega could not prove the goal:
No usable constraints found. You may need to unfold definitions so `omega` can see linear arithmetic facts about `Nat` and `Int`, which may also involve multiplication, division, and modular remainder by constants.
-/
#guard_msgs in
example (x : Foo) : x ≠ x + 1 := by omega

without this, I get penalized for introducing nice names for some of my abstractions. Most other parts of the system can look through abbreviations (e.g. name resolution, type class inference), so omega should maybe too.

Probably just a matter of calling whnfR in the right place.

Versions

"4.12.0-nightly-2024-10-15"

Additional Information

Wanted to use this in https://github.com/teorth/equational_theories/pull/599.

Impact

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the omega tactic and run the reproducer in the issue, comparing the direct Fin 3 example with the Foo abbreviation example. Investigate the mentioned whnfR path for type handling. Done means omega proves the abbreviated-type goal while preserving the existing direct example behavior.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.