Zulip Chat Archive

Stream: lean4

Topic: Name structure constructor


Marcus Rossel (Nov 18 2021 at 21:34):

Is there a way to given a structure's constructor a different name than mk? (Aside from declaring it with inductive and losing all the structure niceties)

Kyle Miller (Nov 18 2021 at 22:05):

Yes https://leanprover.github.io/lean4/doc/struct.html https://leanprover.github.io/lean4/doc/declarations.html#structures-and-records

structure Point (α : Type u) where
  create ::
  x : α
  y : α

Chris B (Nov 18 2021 at 22:05):

structure A := myCtor ::
(field1 : Nat)
(field2 : Char)

Chris B (Nov 18 2021 at 22:05):

Beat me to it.


Last updated: Dec 20 2023 at 11:08 UTC