Curry Typing


Curry-style typing is a more flexible approach to assigning types in lambda calculus. Unlike Church-style typing, types are not explicitly written in the expressions but are instead inferred from the context. This makes Curry typing less strict and closer to modern functional programming languages, where type inference plays a significant role.


Basic Notation

Curry-style typing is expressed using typing judgments, written as:

Γx:α

where:

Unlike Church-style typing, types are not explicitly written in the lambda expression itself. Instead, the type of each term is derived from the context.

Remark

In Curry typing, it is common to use bla,blabla notation to represent implication . For example:

Γu:(αβ), Γv:αΓ(u v):βis the same asΓu:(αβ), Γv:αΓ(u v):β

Curry Typing Rules

Curry-style typing follows a set of inference rules to determine the type of expressions.

1. Variable Typing Rule

If x has type α in the context Γ, then:

Γ,x:αx:α

This means we can directly infer the type of a variable from the context.

Example:

If Γ states that x is an integer, then:

Γ,x:intx:int

2. Function Application Rule

If u is a function of type (αβ) and v has type α, then applying u to v results in type β:

Γu:(αβ),Γv:αΓ(u v):β

Example:

If we have:

(λx.x) 5

Since λx.x has type (intint) and 5 has type int, the application results in int.


3. Function Abstraction Rule

If u has type β in context Γ,x:α, then the function λx.u has type (αβ):

Γ,x:αu:βΓ(λx.u):(αβ)

Example:

For the function:

λx.x+1

we assign:

intint

since x is inferred to be an integer.


Typing Examples

Example 1: Identity Function

λp.λq.p

Assigning Types

Final Type:

(λp.λq.p):(α(βα))
Notice!

Function λp.λq.p returns a new function!


Example 2: Function Application

λz.(zM)N

Assigning Types

Final Type:

(λz.(zM)N):(α(γδ))δ

Why Curry Typing is More Flexible

Curry-style typing is less strict than Church-style typing because:

Feature Church Typing Curry Typing
Explicit types ✅ Required ❌ Inferred
Type annotations ✏️ Written in terms 🚀 Inferred from context
Flexibility ❌ More strict ✅ More flexible
Common in Formal systems, logic Functional programming

🚀 Curry typing is more flexible and allows implicit type inference, making it practical for programming languages!