Definition
A formal set of rules and relations in a programming language that assigns types to expressions and enforces constraints on how those types may be combined, with the aim of detecting certain classes of errors and enabling sound reasoning about program behavior.
Principle
Principle
Define a grammar of types and typing judgments (rules) so that every expression can be associated with a type (or shown untypable); typing rules are used to enforce invariants (e.g., no applying an integer as a function) and to support optimizations and abstraction safety.
Demonstration
Demonstration
A static type system with subtyping (e.g., object-oriented languages) enforces that a value of subtype can be used where a supertype is expected; a Hindley–Milner-like system performs type inference to assign the most general polymorphic type to expressions without explicit annotations.
Misapplication
Misapplication
Assuming that a type system alone guarantees program correctness in all respects (it only guarantees properties proven by its rules, e.g., type safety) or conflating syntactic type annotations with semantic contracts (runtime checks may still be needed).
Consequence
Consequence
Applied correctly, a type system prevents whole classes of errors (type mismatches, certain memory errors), documents intended usage through types, enables earlier error detection, and opens opportunities for compiler optimizations and safer APIs.
Reversal
Reversal
An untyped or dynamically typed perspective treats types as runtime descriptors or programmer annotations only; inversion emphasizes runtime checks and flexible composition at the cost of some static guarantees.
Boundary
Boundary
Refers to language-level typing rules and their metatheory (soundness, completeness, decidability); it excludes machine-level word sizes, runtime value representations, and behavioral correctness properties not expressible in the type language unless the type system is extended (dependent types, refinement types).
Semantic Tension
Semantic Tension
Tension exists between static vs dynamic typing, and between expressive type systems (dependent/refinement types) that can encode more program properties and simpler systems that are decidable and practical; trade-offs between expressiveness, decidability, and programmer ergonomics are central.
Synthesis
Synthesis
A type system is the formal mechanism that classifies expressions by type and enforces composition rules, enabling static reasoning about programs and reducing certain classes of runtime errors while balancing expressiveness, decidability, and practicality.