Zulip Chat Archive

Stream: mathlib4

Topic: unary function to (n=1)-ary


Martin Dvořák (Oct 03 2023 at 14:54):

Do we have them already?

def nary1_of_unary {α β : Type _} (f : α  β) : (Fin 1  α)  β :=
  fun a => f (a 0)

def nary2_of_binary {α β : Type _} (f : α  α  β) : (Fin 2  α)  β :=
  fun a => f (a 0) (a 1)

Eric Wieser (Oct 03 2023 at 15:23):

We have something like this in the model theory library

Eric Wieser (Oct 03 2023 at 15:24):

I think there are helper constructors like docs#FirstOrder.Language.Structure.mk 2

Martin Dvořák (Oct 03 2023 at 15:27):

If you mean this one
https://github.com/leanprover-community/mathlib4/blob/68c7277eb809a743588fe39cd21737944bf8e6c6/Mathlib/ModelTheory/Basic.lean#L115-L116
it didn't help me.

Eric Wieser (Oct 03 2023 at 15:28):

I mean https://leanprover-community.github.io/mathlib4_docs/Mathlib/ModelTheory/Basic.html#FirstOrder.Language.Structure.mk%E2%82%82

Martin Dvořák (Oct 03 2023 at 16:25):

I could almost use FirstOrder.Language.funMap₂ if I worked with different (arguably more complicated) types.

However, as I pointed out elsewhere, I don't want to tie my code to the FirstOrder.Language from model theory.


Last updated: Dec 20 2023 at 11:08 UTC