Jump to content

Typing environment

From Wikipedia, the free encyclopedia

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.[1]

See also

[edit]

References

[edit]
  1. ↑ "Simply Typed λ-calculus" (PDF).