In
mathematical logic
Mathematical logic is the study of Logic#Formal logic, formal logic within mathematics. Major subareas include model theory, proof theory, set theory, and recursion theory (also known as computability theory). Research in mathematical logic com ...
,
category theory
Category theory is a general theory of mathematical structures and their relations. It was introduced by Samuel Eilenberg and Saunders Mac Lane in the middle of the 20th century in their foundational work on algebraic topology. Category theory ...
, and
computer science
Computer science is the study of computation, information, and automation. Computer science spans Theoretical computer science, theoretical disciplines (such as algorithms, theory of computation, and information theory) to Applied science, ...
, kappa calculus is a
formal system
A formal system is an abstract structure and formalization of an axiomatic system used for deducing, using rules of inference, theorems from axioms.
In 1921, David Hilbert proposed to use formal systems as the foundation of knowledge in ma ...
for defining
first-order
functions.
Unlike
lambda calculus
In mathematical logic, the lambda calculus (also written as ''λ''-calculus) is a formal system for expressing computability, computation based on function Abstraction (computer science), abstraction and function application, application using var ...
, kappa calculus has no
higher-order function In mathematics and computer science, a higher-order function (HOF) is a function that does at least one of the following:
* takes one or more functions as arguments (i.e. a procedural parameter, which is a parameter of a procedure that is itself ...
s; its functions are
not
first class objects. Kappa-calculus can be
regarded as "a reformulation of the first-order fragment of typed
lambda calculus".
Because its functions are not first-class objects, evaluation of kappa
calculus
expressions does not require
closures.
Definition
''The definition below has been adapted from the diagrams on pages 205 and 207 of Hasegawa.''
Grammar
Kappa calculus consists of ''types'' and ''expressions,'' given by the
grammar below:
:
:
In other words,
* 1 is a type
* If
and
are types then
is a type.
* Every variable is an expression
* If is a type then
is an expression
* If is a type then
is an expression
* If is a type and e is an expression then
is an expression
* If
and
are expressions then
is an expression
* If x is a variable, is a type, and e is an expression, then
is an expression
The
and the subscripts of , , and
are
sometimes omitted when they can be unambiguously determined from the
context.
Juxtaposition is often used as an abbreviation for a combination of
and composition:
:
Typing rules
''The presentation here uses sequents (
) rather than hypothetical judgments in order to ease comparison with the simply typed lambda calculus. This requires the additional Var rule, which does not appear in Hasegawa''
In kappa calculus an expression has two types: the type of its ''source'' and the type of its ''target''. The notation
is used to indicate that expression e has source type
and target type
.
Expressions in kappa calculus are assigned types according to the following rules:
:
In other words,
* Var: assuming
lets you conclude that
* Id: for any type ,
* Bang: for any type ,
* Comp: if the target type of
matches the source type of
they may be composed to form an expression
with the source type of
and target type of
* Lift: if
, then
* Kappa: if we can conclude that
under the assumption that
, then we may conclude ''without that assumption'' that
Equalities
Kappa calculus obeys the following equalities:
* Neutrality: If
then
and
* Associativity: If
,
, and
, then
.
* Terminality: If
and
then
* Lift-Reduction: