/- Copyright (c) 2024 Lean FRO. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Authors: Kim Morrison -/ prelude import Init.Core namespace Function @[inline] def curry : (α × β → φ) → α → β → φ := fun f a b => f (a, b) /-- Interpret a function with two arguments as a function on `α × β` -/ @[inline] def uncurry : (α → β → φ) → α × β → φ := fun f a => f a.1 a.2 @[simp] theorem curry_uncurry (f : α → β → φ) : curry (uncurry f) = f := rfl @[simp] theorem uncurry_curry (f : α × β → φ) : uncurry (curry f) = f := funext fun ⟨_a, _b⟩ => rfl @[simp] theorem uncurry_apply_pair {α β γ} (f : α → β → γ) (x : α) (y : β) : uncurry f (x, y) = f x y := rfl @[simp] theorem curry_apply {α β γ} (f : α × β → γ) (x : α) (y : β) : curry f x y = f (x, y) := rfl end Function