Definition
An expression (or term) is a syntactic construct in a formal language that can be evaluated or reduced to a value. In Type Theory and programming languages, expressions are the basic units of computation.
Components
Expressions are typically built from:
- Variables: , ,
- Constants: , ,
- Applications: ,
- Abstractions:
- Constructors: ,
Classification
Expressions can be classified by their structure:
- Closed expressions: Contain no free variables
- Open expressions: Contain free variables
- Well-typed expressions: Have a valid type in a given context
- Normal forms: Cannot be reduced further
Typing
In typed languages, expressions are assigned types. A typing judgment has the form:
This states that in context , expression has type .
Evaluation
Expressions are evaluated according to reduction rules:
- β-reduction:
- η-expansion:
- Pattern matching and case analysis
Related Concepts
- Free Variable: Variables not bound in an expression
- Type Theory: The formal system for typed expressions
- Lambda Calculus: The foundational calculus of expressions
- Function Type: Types of function expressions
- Computation Rule: Rules for evaluating expressions