Zulip Chat Archive

Stream: lean4

Topic: case names generated by congr!


Kayla Thomas (Jun 20 2023 at 04:53):

How are the case names generated by cong!? Is there a way to set them? I get things like case a.h.e'_4.

Mario Carneiro (Jun 20 2023 at 04:53):

does congr! with a b c work?

Kayla Thomas (Jun 20 2023 at 04:56):

I don't think there is anything to assign to the a b c here.

Kayla Thomas (Jun 20 2023 at 04:56):

Trying it anyway makes the name longer.

Kayla Thomas (Jun 20 2023 at 04:57):

In this case it is a congr! 1 to be more exact.

Mario Carneiro (Jun 20 2023 at 04:58):

It is difficult to say without a MWE

Mario Carneiro (Jun 20 2023 at 04:58):

what is the goal?

Kayla Thomas (Jun 20 2023 at 04:59):

D: Type
I: Interpretation D
V': VarAssignment D
vt: VarName
X: PredName
xs: List VarName
V: VarAssignment D
binders: Finset VarName
h2:  (v : VarName), ¬v  binders  V' v = V v
h1: v  xs  ¬t  binders
 Interpretation.pred_const_ I X (List.map (Function.updateIte V v (V' t)) xs) 
  Interpretation.pred_const_ I X (List.map V (List.map (fun x => if v = x then t else x) xs))

Mario Carneiro (Jun 20 2023 at 05:08):

I would not expect congr! 1 to introduce any new names here

Mario Carneiro (Jun 20 2023 at 05:09):

Oh you mean the subgoals?

Kayla Thomas (Jun 20 2023 at 05:09):

yeah

Mario Carneiro (Jun 20 2023 at 05:09):

Mathlib tactics don't try very hard to give the subgoals meaningful names. You should just use \. or next a b c => for each subgoal

Kayla Thomas (Jun 20 2023 at 05:10):

next a b c?

Mario Carneiro (Jun 20 2023 at 05:10):

that is essentially a combination of \. and rename_i, it focuses a case and names the variables introduced in that case

Mario Carneiro (Jun 20 2023 at 05:11):

in this case there probably aren't any

Kayla Thomas (Jun 20 2023 at 05:11):

Cool. That makes it easier. Thank you.

Mario Carneiro (Jun 20 2023 at 05:12):

next a b c => ... is also equivalent to case _ a b c => ..., where case foo a b c => ... selects the case named foo and case _ just selects the next case

Kayla Thomas (Jun 20 2023 at 05:12):

Oh, I didn't know you could do _.

Kayla Thomas (Jun 20 2023 at 05:16):

Thank you.


Last updated: Dec 20 2023 at 11:08 UTC