Function types of a given arity #
This provides FunctionOfArity
, such that OfArity α β 2 = α → α → β
.
Note that it is often preferable to use (Fin n → α) → β
in place of OfArity n α β
.
Main definitions #
Function.OfArity α β n
:n
-ary functionα → α → ... → β
. Defined inductively.Function.OfArity.const α b n
:n
-ary constant function equal tob
.
The type of n
-ary functions α → α → ... → β
.
Note that this is not universe polymorphic, as this would require that when n=0
we produce either
Unit → β
or ULift β
.
Equations
- Function.OfArity α β 0 = β
- Function.OfArity α β (Nat.succ n) = (α → Function.OfArity α β n)
Instances For
@[simp]
theorem
Function.ofArity_succ
(α : Type u)
(β : Type u)
(n : ℕ)
:
Function.OfArity α β (Nat.succ n) = (α → Function.OfArity α β n)
Constant n
-ary function with value a
.
Equations
- Function.OfArity.const α b 0 = b
- Function.OfArity.const α b (Nat.succ n) = fun (x : α) => Function.OfArity.const α b n
Instances For
@[simp]
theorem
Function.OfArity.const_zero
(α : Type u)
{β : Type u}
(b : β)
:
Function.OfArity.const α b 0 = b
@[simp]
theorem
Function.OfArity.const_succ
(α : Type u)
{β : Type u}
(b : β)
(n : ℕ)
:
Function.OfArity.const α b (Nat.succ n) = fun (x : α) => Function.OfArity.const α b n
theorem
Function.OfArity.const_succ_apply
(α : Type u)
{β : Type u}
(b : β)
(n : ℕ)
(x : α)
:
Function.OfArity.const α b (Nat.succ n) x = Function.OfArity.const α b n
instance
Function.OfArity.OfArity.inhabited
{α : Type u_1}
{β : Type u_1}
{n : ℕ}
[Inhabited β]
:
Inhabited (Function.OfArity α β n)
Equations
- Function.OfArity.OfArity.inhabited = { default := Function.OfArity.const α default n }