Typing environment

From testwiki
Revision as of 23:44, 23 October 2024 by imported>TheseVGF
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

Template:Reflist

Template:Type-theory-stub