Typing environment

From HandWiki

In type theory a typing environment (or typing context) represents the association between variable names and data types. More formally an environment Γ is a set or ordered list of pairs x,τ, usually written as x:τ, where x is a variable and τ its type.

The judgement

Γe:τ

is read as "e has type τ in context Γ ".[1]

For each function body type checks:

Γ={(f,τ1×...×τnτ0)|(f,xs,(τ1,...,τn),tf,τ0)e}

Typing Rules Example: Γb:Bool,Γt1:τ,Γt2:τΓ(if(b)t1elset2):τ

In statically typed programming languages these environments are used and maintained by typing rules to type check a given program or expression.

See also

References