In
type theory
In mathematics, logic, and computer science, a type theory is the formal system, formal presentation of a specific type system, and in general type theory is the academic study of type systems. Some type theories serve as alternatives to set theor ...
, a type system has the property of subject reduction (also subject evaluation, type preservation or simply preservation) if
evaluation
Evaluation is a
systematic determination and assessment of a subject's merit, worth and significance, using criteria governed by a set of standards. It can assist an organization, program, design, project or any other intervention or initiative ...
of
expression
Expression may refer to:
Linguistics
* Expression (linguistics), a word, phrase, or sentence
* Fixed expression, a form of words with a specific meaning
* Idiom, a type of fixed expression
* Metaphorical expression, a particular word, phrase, ...
s does not cause their
type
Type may refer to:
Science and technology Computing
* Typing, producing text via a keyboard, typewriter, etc.
* Data type, collection of values used for computations.
* File type
* TYPE (DOS command), a command to display contents of a file.
* Ty ...
to change. Formally, if Γ ⊢ ''e''
1 : ''τ'' and ''e''
1 → ''e''
2 then Γ ⊢ ''e''
2 : ''τ''. Intuitively, this means one would not like to write a expression, in say
Haskell
Haskell () is a general-purpose, statically-typed, purely functional programming language with type inference and lazy evaluation. Designed for teaching, research and industrial applications, Haskell has pioneered a number of programming lan ...
, of type Int, and have it evaluate to a value ''v'', only to find out that ''v'' is a string.
Together with
progress
Progress is the movement towards a refined, improved, or otherwise desired state. In the context of progressivism, it refers to the proposition that advancements in technology, science, and social organization have resulted, and by extension w ...
, it is an important meta-theoretical property for establishing
type soundness
In computer science, type safety and type soundness are the extent to which a programming language discourages or prevents type errors. Type safety is sometimes alternatively considered to be a property of facilities of a computer language; that is ...
of a type system.
The opposite property, if Γ ⊢ ''e''
2 : ''τ'' and ''e''
1 → ''e''
2 then Γ ⊢ ''e''
1 : ''τ'', is called subject expansion. It often does not hold as evaluation can erase ill-typed sub-terms of an expression, resulting in a well-typed one.
References
*
*
Type theory
{{type-theory-stub