Eta reduction simplifies a function by removing an unnecessary parameter when the function only passes that parameter to another function.
def wrapper(x):
return f(x)
- Takes input x
- Immediately passes x to f
- Does nothing else
wrapper = f
The wrapper function is now simplified — it behaves exactly like f.
λx. f x ⇒η f
Eta reduction is only valid if the parameter x does nothing else except pass to f.
If x appears inside f or is used for extra computation, eta reduction is not allowed.
# Safe eta reduction
λx. f x ⇒η f
# Python equivalent
def wrapper(x):
return f(x)
wrapper = f
# Not allowed (x used inside f)
λx. f(x + 1) # ❌ cannot eta reduce
- Removes redundant functions - Simplifies code or expressions - Makes functions cleaner and easier to read
# Before eta reduction
def wrapper(y):
return add_one(y)
# After eta reduction
wrapper = add_one
Both versions behave the same.
Eta reduction can only be applied when the function’s parameter is immediately passed to another function, and nothing else is done with it.