Eta Reduction (Explained Using Python)

Eta reduction simplifies a function by removing an unnecessary parameter when the function only passes that parameter to another function.

Python Example: Before Eta Reduction

def wrapper(x):
    return f(x)

- Takes input x - Immediately passes x to f - Does nothing else

Python Example: After Eta Reduction

wrapper = f

The wrapper function is now simplified — it behaves exactly like f.

Lambda Calculus Version

λx. f x   ⇒η   f

Condition: x must not appear inside 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.

Examples

# 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

Why Eta Reduction Exists

- Removes redundant functions - Simplifies code or expressions - Makes functions cleaner and easier to read

Example Comparison

# Before eta reduction
def wrapper(y):
    return add_one(y)

# After eta reduction
wrapper = add_one

Both versions behave the same.

Key Rule

Eta reduction can only be applied when the function’s parameter is immediately passed to another function, and nothing else is done with it.