Documentation

Mathlib.Data.Fin.Tuple.Curry

Currying and uncurrying of n-ary functions #

A function of n arguments can either be written as f a₁ a₂ ⋯ aₙ or f' ![a₁, a₂, ⋯, aₙ]. This file provides the currying and uncurrying operations that convert between the two, as n-ary generalizations of the binary curry and uncurry.

Main definitions #

def Function.FromTypes.uncurry {n : ℕ} {p : Fin n → Type u} {τ : Type u} (f : Function.FromTypes p τ) :
((i : Fin n) → p i) → τ

Uncurry all the arguments of Function.FromTypes p τ to get a function from a tuple.

Note this can be used on raw functions if used.

Equations
Instances For
    def Function.FromTypes.curry {n : ℕ} {p : Fin n → Type u} {τ : Type u} :
    (((i : Fin n) → p i) → τ) → Function.FromTypes p τ

    Curry all the arguments of Function.FromTypes p τ to get a function from a tuple.

    Equations
    Instances For
      @[simp]
      theorem Function.FromTypes.uncurry_apply_cons {n : ℕ} {α : Type u} {p : Fin n → Type u} {τ : Type u} (f : Function.FromTypes (Matrix.vecCons α p) τ) (a : α) (args : (i : Fin n) → p i) :
      @[simp]
      theorem Function.FromTypes.uncurry_apply_succ {n : ℕ} {p : Fin (n + 1) → Type u} {τ : Type u} (f : Function.FromTypes p τ) (args : (i : Fin (n + 1)) → p i) :
      @[simp]
      theorem Function.FromTypes.curry_apply_cons {n : ℕ} {α : Type u} {p : Fin n → Type u} {τ : Type u} (f : ((i : Fin (n + 1)) → Matrix.vecCons α p i) → τ) (a : α) :
      @[simp]
      theorem Function.FromTypes.curry_apply_succ {n : ℕ} {p : Fin (n + 1) → Type u} {τ : Type u} (f : ((i : Fin (n + 1)) → p i) → τ) (a : p 0) :
      @[simp]
      theorem Function.FromTypes.uncurry_curry {n : ℕ} {p : Fin n → Type u} {τ : Type u} (f : ((i : Fin n) → p i) → τ) :
      @[simp]
      theorem Function.FromTypes.curryEquiv_apply {n : ℕ} {τ : Type u} (p : Fin n → Type u) :
      ∀ (a : ((i : Fin n) → p i) → τ), (Function.FromTypes.curryEquiv p) a = Function.FromTypes.curry a
      @[simp]
      theorem Function.FromTypes.curryEquiv_symm_apply {n : ℕ} {τ : Type u} (p : Fin n → Type u) (f : Function.FromTypes p τ) :
      ∀ (a : (i : Fin n) → p i), (Function.FromTypes.curryEquiv p).symm f a = Function.FromTypes.uncurry f a
      def Function.FromTypes.curryEquiv {n : ℕ} {τ : Type u} (p : Fin n → Type u) :
      (((i : Fin n) → p i) → τ) ≃ Function.FromTypes p τ

      Equiv.curry for p-ary heterogeneous functions.

      Equations
      Instances For
        theorem Function.FromTypes.curry_two_eq_curry {p : Fin 2 → Type u} {τ : Type u} (f : ((i : Fin 2) → p i) → τ) :
        def Function.OfArity.uncurry {α : Type u} {β : Type u} {n : ℕ} (f : Function.OfArity α β n) :
        (Fin n → α) → β

        Uncurry all the arguments of Function.OfArity α n to get a function from a tuple.

        Note this can be used on raw functions if used.

        Equations
        Instances For
          def Function.OfArity.curry {α : Type u} {β : Type u} {n : ℕ} (f : (Fin n → α) → β) :

          Curry all the arguments of Function.OfArity α β n to get a function from a tuple.

          Equations
          Instances For
            @[simp]
            theorem Function.OfArity.uncurry_curry {α : Type u} {β : Type u} {n : ℕ} (f : (Fin n → α) → β) :
            @[simp]
            theorem Function.OfArity.curryEquiv_apply {α : Type u} {β : Type u} (n : ℕ) :
            ∀ (a : ((i : Fin n) → (fun (a : Fin n) => α) i) → β), (Function.OfArity.curryEquiv n) a = Function.FromTypes.curry a
            @[simp]
            theorem Function.OfArity.curryEquiv_symm_apply {α : Type u} {β : Type u} (n : ℕ) (f : Function.FromTypes (fun (a : Fin n) => α) β) :
            ∀ (a : Fin n → α), (Function.OfArity.curryEquiv n).symm f a = Function.FromTypes.uncurry f a
            def Function.OfArity.curryEquiv {α : Type u} {β : Type u} (n : ℕ) :
            ((Fin n → α) → β) ≃ Function.OfArity α β n

            Equiv.curry for n-ary functions.

            Equations
            Instances For
              theorem Function.OfArity.curry_two_eq_curry {α : Type u} {β : Type u} (f : (Fin 2 → α) → β) :