Typing environment
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 , usually written as , where is a variable and its type.
The judgement
:
is read as " has type in context ".
For each function body type checks:
:
Typing Rules Example:
\begin{array}{c}
\Gamma\vdash b:Bool, \Gamma\vdash t_1:\tau, \Gamma\vdash t_2:\tau\\
\hline
\Gamma \vdash (\text{if}(b) t_1 \text{else} t_2): \tau \\
\end{array}
In statically typed programming languages, these environments are used and maintained by typing rules to type check a given program or expression.{{Cite web| title=Simply Typed λ-calculus|url=https://www.cs.cornell.edu/courses/cs4110/2012fa/lectures/lecture19.pdf}}