Zulip Chat Archive

Stream: lean4

Topic: rcases speed


Jakob von Raumer (Feb 08 2024 at 12:14):

I have a big proof goal with lots of existentially bound variables and I destruct it like this:

  rintro _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,h
  rcases h with _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,h
  rcases h with _,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,h

Is there any faster way to do this?

Johan Commelin (Feb 08 2024 at 12:17):

Do you mean faster or shorter? Maybe something with repeat?

Jakob von Raumer (Feb 08 2024 at 12:17):

Faster :sweat_smile:

Mario Carneiro (Feb 08 2024 at 14:56):

how fast is it? MWE?

Mario Carneiro (Feb 08 2024 at 14:57):

I think this will be slow because there will be many instantiate calls to create the fvars, which results in quadratic behavior. This is a really hard problem somewhat fundamental to locally nameless processing of DTT

Mario Carneiro (Feb 08 2024 at 14:58):

@Jakob von Raumer But I would be remiss to not ask for an #xy of your problem here. Why do you have so many existentials?

Geoffrey Irving (Feb 08 2024 at 15:36):

The pun is really loud here.

Jakob von Raumer (Feb 09 2024 at 09:32):

@Mario Carneiro In short, the proof terms are automatically generated and correspond to the semantics of functions, with intermediate results of operations often bound existentially

Jakob von Raumer (Feb 09 2024 at 09:34):

Thanks for the explanation anyways, seems like there's probably not really an easy way around it then

Jakob von Raumer (Feb 09 2024 at 09:34):

Will try to create an MWE

Jakob von Raumer (Feb 13 2024 at 09:20):

iterate 116 (rcases h with ⟨_,h⟩) is definitely quicker, at least


Last updated: May 02 2025 at 03:31 UTC