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

fix: match discriminant reduction should not unfold irreducible defs #2162

Merged
merged 1 commit into from
Apr 11, 2023

Conversation

Kha
Copy link
Member

@Kha Kha commented Mar 22, 2023

This seems like a simple oversight to me: none of the functions special-cased in canUnfoldAtMatcher are irreducible (and it would be quite weird if they were). Likewise, Mixing [match_pattern] and [irreducible] seems inadvisable.

Fixes #2161

@Kha Kha requested a review from leodemoura March 22, 2023 10:19
@Kha
Copy link
Member Author

Kha commented Mar 22, 2023

Perhaps a cleaner approach would be to first call canUnfoldDefault and on failure apply the special casing

let d := Nat.gcd a.num 1
⟨(a.num.div d) * (b.num.div d)⟩

example : ((Foo.mul 4 1).mul 1).mul 1 = 4 := by decide
Copy link
Contributor

Choose a reason for hiding this comment

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

This fails both before and after this PR, but it goes from failing slowly to failing quickly. Is there a way to put a heartbeat limit on the test?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good idea, thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you put the heartbeat limit on the wrong test!

Copy link
Member Author

Choose a reason for hiding this comment

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

Yikes, thanks again. Now it's on both.

@Kha Kha force-pushed the 2161 branch 3 times, most recently from 4bc939d to a9eedb7 Compare March 23, 2023 09:03
@leodemoura leodemoura merged commit 8a302e6 into leanprover:master Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

decide looks inside definitions marked @[irreducible]
4 participants