Zulip Chat Archive

Stream: lean4

Topic: Extract type and value from name for proof


Thomas Murrills (Mar 03 2023 at 00:45):

If I want to read off the type and proof from a theorem, I can do that using getConstInfo, then extract the .type and value?. Is this the best way to do it when constructing a proof on the meta level? My intuition is that axioms should also be usable to construct a proof, but they don't seem to have a value.

Eric Wieser (Mar 03 2023 at 00:47):

You shouldn't be using the proof of the theorem, you should refer to it by name

Thomas Murrills (Mar 03 2023 at 00:50):

Ah, via .const?

Kyle Miller (Mar 03 2023 at 00:51):

Yeah, but it seems like it's usually written as mkConst (like in mkConst ``propext []). There are a number of helper functions for it to fill in universe metavariables too.

Kyle Miller (Mar 03 2023 at 00:52):

like mkConstWithFreshMVarLevels

Kyle Miller (Mar 03 2023 at 00:53):

There's also mkAppM, which makes sure everything fully typechecks (and fills in implicit arguments, well most of them, see the docstring) when you give it some arguments, like mkAppM ``Subsingleton.elim #[lhs, rhs]

Thomas Murrills (Mar 03 2023 at 00:55):

Ah, I see, thanks! (I saw that I had a ConstantInfo and immediately forgot all about .const and friends, asking myself “how do I use this??” 🙃 But I didn’t know about the universe mvar helpers, that’s very useful!)

Jannis Limperg (Mar 03 2023 at 09:53):

Kyle Miller said:

it seems like it's usually written as mkConst

This is a relic from the dark days before @[computed_field], when the Expr constructors were forbidden. Now .const is again the preferred spelling.


Last updated: Dec 20 2023 at 11:08 UTC