Skip to content

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

Merged
leodemoura merged 1 commit intoleanprover:masterfrom
Kha:2161
Apr 11, 2023
Merged

fix: match discriminant reduction should not unfold irreducible defs#2162
leodemoura merged 1 commit intoleanprover:masterfrom
Kha:2161

Conversation

@Kha
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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