Zulip Chat Archive

Stream: lean4

Topic: Does "have" work in Lean4


James Caldwell (Mar 08 2023 at 22:44):

I'm looking for a tactic that allows me to make an assertion - a cut tactic. Seems like "have" is not a tactic - must be something similar.

Mario Carneiro (Mar 08 2023 at 22:46):

it is a tactic and a term

Mario Carneiro (Mar 08 2023 at 22:46):

the answer to your question is have

James Caldwell (Mar 08 2023 at 22:47):

OK - thanks. I hate being so dense.

Martin Dvořák (Mar 09 2023 at 10:12):

I prefer the tactic have that comes from Mathlib.Tactic.Have which is afaik different from the one in the core.

Mario Carneiro (Mar 09 2023 at 10:16):

the have from mathlib is an addition to the one from core, it doesn't do anything to the original

Mario Carneiro (Mar 09 2023 at 10:17):

the original is have : ty := e or have : ty := by tac, the one from mathlib is have : ty which produces a subgoal which can be proved by . tac

Martin Dvořák (Mar 09 2023 at 10:27):

Can I use the new have with a proof term without writing exact please?

Mario Carneiro (Mar 09 2023 at 11:02):

that's have : ty := e

Mario Carneiro (Mar 09 2023 at 11:02):

you don't need mathlib for that

Martin Dvořák (Mar 09 2023 at 11:03):

I mean, if the Mathlib's have is imported, does the := notation still work?

Mario Carneiro (Mar 09 2023 at 11:12):

Mario Carneiro said:

the have from mathlib is an addition to the one from core, it doesn't do anything to the original

Martin Dvořák (Mar 09 2023 at 11:13):

You mean; the elaborator automatically finds out which of them I am using?

Mario Carneiro (Mar 09 2023 at 11:22):

They are different tactics with different syntax. (Unlike lean 3, in lean 4 the whole tactic parse can be used to distinguish different tactics. They don't have to start with unique words; this is only conventional.)

Mario Carneiro (Mar 09 2023 at 11:24):

the mathlib tactic has the syntax "have" name? [: expr]? while the lean tactic has the syntax "have" name? [: expr?] := expr


Last updated: Dec 20 2023 at 11:08 UTC