SKI Combinatory Logic #
This file defines the syntax and operational semantics (reduction rules) of combinatory logic, using the SKI basis.
Main definitions #
SKI
: the type of expressions in the SKI calculus,Red
: single-step reduction of SKI expressions,MRed
: multi-step reduction of SKI expressions,CommonReduct
: the relation between terms having a common reduct,
Notation #
⬝
: application between SKI terms,⇒
: single-step reduction,⇒*
: multi-step reduction,
References #
The setup of SKI combinatory logic is standard, see for example:
Application $x y ↦ xy$
Equations
- SKI.«term_⬝_» = Lean.ParserDescr.trailingNode `SKI.«term_⬝_» 100 100 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⬝ ") (Lean.ParserDescr.cat `term 101))
Instances For
Reduction relations between SKI terms #
Single-step reduction of SKI terms
- red_S
(x y z : SKI)
: (((S.app x).app y).app z).Red ((x.app z).app (y.app z))
The operational semantics of the
S
, - red_K
(x y : SKI)
: ((K.app x).app y).Red x
K
, - red_I
(x : SKI)
: (I.app x).Red x
and
I
combinators. - red_head
(x x' y : SKI)
: x.Red x' → (x.app y).Red (x'.app y)
Reduction on the head
- red_tail
(x y y' : SKI)
: y.Red y' → (x.app y).Red (x.app y')
and tail of an SKI term.
Instances For
Notation for single-step reduction
Equations
- SKI.«term_⇒_» = Lean.ParserDescr.trailingNode `SKI.«term_⇒_» 90 91 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⇒ ") (Lean.ParserDescr.cat `term 91))
Instances For
Notation for multi-step reduction (by analogy with the Kleene star)
Equations
- SKI.«term_⇒*_» = Lean.ParserDescr.trailingNode `SKI.«term_⇒*_» 90 91 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol " ⇒* ") (Lean.ParserDescr.cat `term 91))
Instances For
Equations
- SKI.MRedTrans = { trans := @SKI.MRedTrans._proof_1 }
Equations
- SKI.MRedRedTrans = { trans := @SKI.MRedRedTrans._proof_1 }
Equations
- SKI.RedMRedTrans = { trans := @SKI.RedMRedTrans._proof_1 }
Express that two terms have a reduce to a common term.