Zulip Chat Archive
Stream: Is there code for X?
Topic: Extracting "properties" of the type
Jan Idziak (Apr 19 2024 at 09:51):
Newbie question about types.
In the NNG it is easy to understand how the MyNat type is constructed and what are the axioms (rules) that we can use.
Is a programmatic way with some kind of elaboration to extract the type information directly from lean.
Something like #typedefinitio MyNat to extract:
- constructor like inductive
- axioms like add_zero
- operators definitions: like +: N -> N -> N
Would appreciate any help or pointers on this topic!
Jireh Loreaux (Apr 19 2024 at 16:01):
You can use #whatsnew in
before the type declaration to get the automatic stuff declared with the inductive type.
Jireh Loreaux (Apr 19 2024 at 16:03):
As for things declared on the type (like it's Add
instance, you'll need to look it up manually to some extent. You can look at docs#Nat and then click on the "instances" arrow below it to see which instances are available.
Jireh Loreaux (Apr 19 2024 at 16:05):
You can also do #synth Add Nat
Jireh Loreaux (Apr 19 2024 at 16:06):
Note that Add
is not part of the definition of the type Nat
, which is the reason this has a separate procedure.
Last updated: May 02 2025 at 03:31 UTC