feat(library/algebra/function): define curry and uncurry functions

This commit is contained in:
Leonardo de Moura 2015-04-11 16:45:07 -07:00
parent 3edf0dffdf
commit 3df7fe120c

View file

@ -42,6 +42,18 @@ definition flip [reducible] {C : A → B → Type} (f : Πx y, C x y) : Πy x, C
definition app [reducible] {B : A → Type} (f : Πx, B x) (x : A) : B x :=
f x
definition curry [reducible] : (A × B → C) → A → B → C :=
λ f a b, f (a, b)
definition uncurry [reducible] : (A → B → C) → (A × B → C) :=
λ f p, match p with (a, b) := f a b end
theorem curry_uncurry (f : A → B → C) : curry (uncurry f) = f :=
rfl
theorem uncurry_curry (f : A × B → C) : uncurry (curry f) = f :=
funext (λ p, match p with (a, b) := rfl end)
precedence `∘'`:60
precedence `on`:1
precedence `$`:1