Lesson plan

Typing environment

In type theory, a typing environment (or typing context) represents the association between variable names and data types. More formally, an environment \Gamma is a set or ordered list of pairs \langle x,\tau \rangle , usually written as x:\tau , where x is a variable and \tau its type. The judgement : \Gamma \vdash e:\tau is read as " e has type \tau in context \Gamma ". For each function body type checks: : \Gamma = \{(f,\tau_1\times...\times\tau_n \to \tau_0)|(f,xs,(\tau_1,...,\tau_n),t_f,\tau_0)\in e\} 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.

Back to article

Article summary

In type theory, a typing environment (or typing context) represents the association between variable names and data types. More formally, an environment \Gamma is a set or ordered list of pairs \langle x,\tau \rangle , usually written as x:\tau , where x is a variable and \tau its type. The judgement : \Gamma \vdash e:\tau is read as " e has type \tau in context \Gamma ". For each function body type checks: : \Gamma = \{(f,\tau_1\times...\times\tau_n \to \tau_0)|(f,xs,(\tau_1,...,\tau_n),t_f,\tau_0)\in e\} 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.

Key claims

No claims recorded.

Discussion questions

  1. Summarise the article in your own words. Which single claim would you verify first, and why?
  2. Which claim in this article is most likely to be revised as the sources update? How would you check its current status?
  3. If two sources disagreed about one of these facts, what would you need in order to trust one over the other?

Bibliography

No sources recorded.

Key claims and bibliography are generated from the same tracked claims and sources as the article page.