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

refactor: avoid relying on rfl's behavior on ground terms #832

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nomeata
Copy link
Collaborator

@nomeata nomeata commented Jun 9, 2024

rfl for ground terms will reduce at transparency .all, even if the current transparency is .default. Maybe it's prudent to not rely on this corner case, and have more explicit proofs.

`rfl` for ground terms will reduce at transparency `.all`, even if the
current transparency is `.default`. Maybe it's prudent to not rely on
this corner case, and have more explicit proofs.
@fgdorais
Copy link
Collaborator

fgdorais commented Jun 10, 2024

I understand where this is coming from but I'm skeptical of simp as a replacement since that is a much more complex tactic. Maybe we need an enhanced rfl-like tactic that doesn't draw in all the simp lemmas?

I guess I mean a tactic that would locally unseal some defs but not use simp lemmas. Maybe it could even try to figure out what defs to unseal without user prompt.

@nomeata nomeata marked this pull request as draft June 10, 2024 05:44
@nomeata
Copy link
Collaborator Author

nomeata commented Jun 10, 2024

Yes, this PR is a mit premature, I should first figure out if this rfl behavior is intended or accidental.

Using simp isn't unreasonable in the sense that the other half of that proof is also rewriting. But I am more hesitant to rely on DefEqs of irreducible definitions than others :-)

Marking as draft for now.

@fgdorais fgdorais added the WIP work in progress label Jun 10, 2024
@fgdorais
Copy link
Collaborator

fgdorais commented Jun 10, 2024

I don't think these two changes are problematic by themselves. I'm mostly questioning the general strategy of replacing rfl by simp, especially now that defs by wf are irreducible by default. It seems to me that rfl is the wrong tool for reasons you mention but simp is also the wrong tool for different reasons. These are the tools we currently have and the "right tool" appears to be missing, probably because there was not much need before now.

To be more specific about my (currently purely theoretical) vision is for an eqn tactic that attempts to prove an equality using "defining equations". In most cases, these "defining equations" would simply be the actual definition (i.e. what rfl does) but in the case of irreducible defs, these would be more like specifications which have more to do with the intended meaning than the actual implementation.

Note that the equations used by eqn are not always simp lemmas. In fact, some would be really bad simp lemmas. But eqn is cannot be used to simplify a goal, so that is not a problem. In a sense, eqn would be orthogonal to simp, using overlapping but ultimately completely different set of rules.

Anyway, this discussion should probably be elsewhere.

@nomeata
Copy link
Collaborator Author

nomeata commented Jun 10, 2024

Ah, I see what you are getting at: An evaluator of ground terms that uses the equations as specified, but not necessarily as elaborated (which suffers at least for well-founded definitions).

A good approximation to that is rw [foo] or simp [foo] where foo is the function name, what's missing doing that for any function, and not applying other simp rules, I guess.

@nomeata nomeata marked this pull request as ready for review September 2, 2024 13:07
@nomeata
Copy link
Collaborator Author

nomeata commented Sep 2, 2024

I’m working on leanprover/lean4#3772 again, so I expect his will be needed soon. I’d wager that simp [last] is reasonable style, at least with the idioms and tactics with have.

@fgdorais
Copy link
Collaborator

fgdorais commented Sep 2, 2024

I still don't think simp is the right choice as a general replacement for rfl here since it doesn't have the same behavior as rfl at all. How about having rfl [foo, bar] that locally changes the reducibility of foo and bar before rfl?

Copy link
Collaborator

@fgdorais fgdorais left a comment

Choose a reason for hiding this comment

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

These two changes are fine but I would still like a better solution for the general case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WIP work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants