Zulip Chat Archive

Stream: new members

Topic: Unfolding opaque definitions


Robert Maxton (Apr 07 2022 at 18:08):

Please tell me there's a better way than this:

unfold has_lt.lt preorder.lt partial_order.lt linear_order.lt at tri

Robert Maxton (Apr 07 2022 at 18:09):

dsimp fails to simplify, so does norm_cast

Yaël Dillies (Apr 07 2022 at 18:10):

You can use change (docs#tactic.interactive.change)

Yaël Dillies (Apr 07 2022 at 18:10):

But with more context we coul probably give you a better solution.

Robert Maxton (Apr 07 2022 at 18:19):

nah, change was basically what I wanted in this case
in general it'd be cool if I could just unfold "everything with a field syntax" but that might have problems in the general case

Eric Rodriguez (Apr 07 2022 at 18:40):

change is brittle, it's usually nicer to have a ..._def lemma

Eric Wieser (Apr 07 2022 at 19:13):

Usually this means you should write a lemma with a proof of rfl to do the unfolding for you

Kyle Miller (Apr 07 2022 at 19:19):

@Robert Maxton I think tactic#unfold_proj might be what you're looking for (whether or not it might be the "right" thing to do).

Robert Maxton (Apr 07 2022 at 19:21):

indeed it is. it's a little overenthusiastic but I can hardly complain

Robert Maxton (Apr 07 2022 at 19:21):

thanks :p

Kyle Miller (Apr 07 2022 at 19:26):

It has some configuration options (same ones as dsimp), so for example unfold_projs at h {single_pass := tt}. With this you could do iterate 3 { unfold_projs at h {single_pass := tt} } for instance.


Last updated: Dec 20 2023 at 11:08 UTC