Content uploaded by Bruce Maclennan

Author content

All content in this area was uploaded by Bruce Maclennan on Oct 28, 2013

Content may be subject to copyright.

Molecular Combinator Reference Manual

UPIM Report 2

Technical Report UT-CS-02-489

Bruce J. MacLennan

Department of Computer Science

University of Tennessee, Knoxville

www.cs.utk.edu/˜mclennan

November 5, 2002

Abstract

This report contains, in summary form, deﬁnitions, schematic reactions, and equiv-

alences of all combinators in use by this project. It will be updated as newcombinators,

equivalences, etc. are used.

This research is supported by Nanoscale Exploratory Research grant CCR-0210094 from the National

Science Foundation. It has been facilitated by a grant from the University of Tennessee, Knoxville, Center

for Information Technology Research. This report may be used for any non-proﬁt purpose provided that the

source is credited.

1

Introduction

1. Most of the combinator deﬁnitions and equivalences(beyond those peculiar to molec-

ular computation, such as , , and ) are from Curry and Feys [CFC58].

2. We follow the usual convention in combinatory logic of omitting parentheses that as-

sociate to the left. For example, means , and

means .

3. In the deﬁnitions of the operators, variables are marked with primes (e.g., ) and

parenthesized superscripts (e.g., ) to indicate shared complexes. See the descrip-

tion of the (Sharing) Primitive (Section 17).

4. Notice that the following are distinct and have different meanings: (powers of

combinators), (polyadic combinators), (sharing), (deferred combina-

tors), (leftreduction), (polyadic extension); see Other Notation (p. 14).

is also used in the usual way to denote an element in a series , .... When

subscripts and superscripts of any kind are combined, the subscripts take precedence;

thus means .

5. The size of a nonprimitive combinator is expressed in terms of the number

of , , and nodes that it contains. Since nonprimitive combinator deﬁnitions are

binary trees, if they contain no other nodes besides , , and , then the counts

satisfy , and the total nodes are .

6. A combinator is called regular if it does not affect its ﬁrst argument, thus,

Most combinators (e.g., , , , , , , , , , , ) are regular.

2

Deﬁnitions of Combinators

1 Primitive (Application Complex)

The application ( ) complex represents the application of a combinator to its argument.

The application of to , written , is represented by a molecular complex , in

which the “operator” binding site of is linked to , the “operand” binding site is linked

to , and the “result” site is linked to , the complex into which the result of will be

linked.

All (or most) of the non-terminal (interior) nodes of a combinator tree are nodes; the

terminals (leaves) are primitive combinators (e.g., and ). If the network is not a tree, but

has shared nodes or cycles, then (most of) the non-terminal nodes are and (sharing)

nodes. (We say “most” because later we may want to deﬁne additional interior node types.)

2 Combinator (Elementary Compositor)

Deﬁnition:

(1)

Reduction to

:

(2)

Size: total.

Equivalences:

(3)

(4)

(5)

Notes: If is regular (p. 2), , then

That is, is applied to the result of applying to the arguments .

3 Combinator (Permuting Compositor)

Deﬁnition:

(6)

Equivalences:

(7)

Size: total.

3

4 Combinator (Elementary Permutator)

Deﬁnition:

(8)

Equivalences:

(9)

(10)

(11)

Size: total (Def. 9).

5 Combinator (Pure Permutator)

Deﬁnition:

(12)

Equivalences:

(13)

(14)

Size: total (Def. 13).

6 Primitive (Elementary Deleter)

Reaction:

(15)

(16)

(17)

(18)

Notes: In Eq. 15, represents any primitive combinator (e.g., or ). Notice that in

Eq. 17, a deletion cancels a replication in progress. However, in Eq. 18, a deletion does not

affect a shared complex, except to cap the deleted sharing link.

Reaction Speciﬁcation:

d: D, a: A, x, y, d’: D, p: P, q: Q, q’: Q.

d a, a_1 x, a_2 y, d’ q’, p q

=> (DeleteApplication)

d x, d y, p a, a_1 q, a_2 q’.

4

d: D, u, r: R, x, p: P, p’: P, q: Q, q’: Q.

d r_1, u r_2, r x, p q, p’ q’

=> (DeleteReplicator1)

u x, p r_1, p’ r_2, r q, d q’.

d: D, u, r: R, x, p: P, p’: P, q: Q, q’: Q.

d r_2, u r_1, r x, p q, p’ q’

=> (DeleteReplicator2)

u x, p r_1, p’ r_2, r q, d q’.

d: D, u, v: V, x, p: P, q: Q.

d v_1, u v_2, v x, p q

=> (DeleteSharing1)

p v_1, u v_2, v x, d q.

d: D, u, v: V, x, p: P, q: Q.

d v_2, u v_1, v x, p q

=> (DeleteSharing2)

p v_2, u v_1, v x, d q.

d: D, pc: Prim, p: P, q: Q.

d pc, p q

=> (DeletePrimitive)

p pc, d q.

Notes: In the last (DeletePrimitive) rule, ‘Prim’ stands for any primitive com-

binator. Therefore, at least at the present time, that rule must be repeated with ‘Prim’

replaced by each primitive combinator species in use (e.g., ‘K’, ‘S’).

7

Combinator (Elementary Identiﬁcator)

Deﬁnition:

(19)

Reduction to :

(20)

Size: total (taking ).

Equivalences:

(21)

(22)

5

8 Combinator

Deﬁnition:

(23)

9 Combinator (Elementary Cancellator)

Deﬁnition:

(24)

Reaction:

(25)

Equivalences:

(26)

Reaction Speciﬁcation:

a: A, b: A, k: K, d: D, q: Q, u, x, y.

u a, a_1 b, b_1 k, b_2 x, a_2 y, d q

=> (Kreaction)

u x, d a, a_1 b, b_1 k, b_2 q, a_2 y.

10 Combinator (Inert Complex)

The (inert) combinator is used when we want to prevent reduction, generally when we

are intending to produce a static structure. For example, if the structure is

generated, then there is a risk that the reduction rules for will destroy the structure. This

is avoided by using the inert combinator, e.g. . Since it is inert, there are no

reduction or reaction rules for it. Of course, in practice, there need not be just one inert

combinator, and any molecular species that does enter into the computational reactions

could be used.

11

Primitive (Result Cap)

The result cap is inert; it is a place-holder for the “result” binding-site of any group.

12 Primitive (Argument Cap)

The argument cap is inert; it is a place-holder for the “argument” binding-site of any group

(in particular, for the “operator” and “operand” sites of an complex).

6

13 Primitive (Elementary Replicator)

Reaction:

(27)

(28)

Notes: In Eq. 27, represents any primitive combinator (e.g., or ).

Reaction Speciﬁcation:

r: R, a: A, u, v, x, y, r’: R, a’: A,

p: P, p’: P, p’’: P, q: Q, q’: Q, q’’: Q.

u r_1, v r_2, r a, a_1 x, a_2 y,

p r’_1, p’ r’_2, r’ q, p’’ a’, a’_1 q’, a’_2 q’’

=> (ReplicateApplication)

u a, v a’,

a_1 r_1, a’_1 r_2,

a_2 r’_1, a’_2 r’_2,

r x, r’ y,

p q, p’ q’, p’’ q’’.

r: R, pc: Prim, u, v, pc’: Prim, p: P, p’: P, q: Q.

u r_1, v r_2, r pc, p q, p’ pc’

=> (ReplicatePrimitive)

u pc, v pc’,

p r_1, p’ r_2, r q.

Notes: In the last (ReplicatePrimitive) rule, ‘Prim’ stands for any primitive

combinator. Therefore, at least at the present time, that rule must be repeated with ‘Prim’

replaced by each primitive combinator species in use (e.g., ‘K’, ‘S’).

14

Combinator (Elementary Formalizer, Replicating)

Deﬁnition:

(29)

Reaction:

(30)

Reaction Speciﬁcation:

a: A, a’: A, a’’: A, s: S, r: R, p: P, p’: P, q: Q,

u, x, y, z.

7

u a, a_1 a’, a’_1 a’’, a’’_1 s, a’’_2 x, a’_2 y, a_2 z,

p r_1, p’ r_2, r q

=> (Sreaction)

u a, a_1 a’, a’_1 x, a’_2 r_1,

a_2 a’’, a’’_1 y, a’’_2 r_2,

r z,

p s, p’ q.

Equivalences:

(31)

15 Combinator (Elementary Formalizer, Sharing)

Deﬁnition:

(32)

Reaction:

(33)

Reaction Speciﬁcation:

a: A, a’: A, a’’: A, s: Ssh, v: V, p: P, p’: P, q: Q,

u, x, y, z.

u a, a_1 a’, a’_1 a’’, a’’_1 s, a’’_2 x, a’_2 y, a_2 z,

p v_1, p’ v_2, v q

=> (SharingSreaction)

u a, a_1 a’, a’_1 x, a’_2 v_1,

a_2 a’’, a’’_1 y, a’’_2 v_2,

v z,

p s, p’ q.

Equivalences:

(34)

Notes: See Sec. 19 for a discussion of this deﬁnition.

16 Combinator (Polyadic Elementary Formalizer)

Deﬁnition:

(35)

8

Reduction to :

(36)

(37)

Size: total for .

Notes: can be replicating or sharing depending on whether or is used in its

recursive deﬁnition. If it is sharing, it produces the following structure:

(38)

Equivalences:

(39)

17 Primitive (Sharing Complex)

The sharing primitive ( ) is used for constructing non-tree structures, including cyclic

structures. It is produced by sharing combinators such as , , and . Note that a

complex between a combinator and its arguments will block reduction of the combinator,

so

complexes appear primarily in structured that are being treated as data.

Primes and parenthesized superscripts on variables are used to indicate informally the

sharing of structures. Thus, if there is a single sharing complex above , then the two links

to it will be called and . Notice that both will be “covered” by a sharing complex; if it

is necessary to make this explicit, the two links will be written and . If one of these

links is replaced by another sharing complex, then the original link and the two new ones

will be called , , , and so forth. Obviously such a notation cannot capture all the

possible structures of sharing complexes, but it allows the convenient expression of chains

of complexes, which is the most common case. To go beyond this, diagrams should be

used.

18 Combinator (Elementary Duplicator, Replicating)

Deﬁnition:

(40)

Equivalences:

(41)

(42)

(43)

Size: total (Def. 41 or 42).

9

19 Combinator (Elementary Duplicator, Sharing)

Deﬁnition:

(44)

Reduction to :

(45)

(46)

(47)

Notes: and are two variants, functionally equivalent to , but producing dif-

ferently ordered links to the sharing ( ) complex (see Equivalences below). In the absence

of subscripts, we will take to be , since it is a little more convenient to use. Deﬁni-

tion 47 is not very useful, because it needlessly begins replication of the ﬁrst argument of

.

Notice that either or may be taken as a primitive sharing operation, since either can

be deﬁned in terms of the other. At this time, it looks as though will be the best choice as

a primitive, so will be deﬁned by Eq. 45 or 46.

Reaction:

(48)

Reaction Speciﬁcation:

w: Wsh, a: A, a’: A, u, x, y, v: V, p: P, p’: P, q: Q.

u a, a_1 a’, a’_1 w, a’_2 x, a_2 y, p v_1, p’ v_2, v q

=> (SharingWreaction)

u a, a_1 a’, a’_1 x, a’_2 v_1, a_2 v_2, v y, p’ w, p q.

Equivalences:

(49)

(50)

(51)

Notes: The primes and superscripts on in Eq. 51 represent successive sharings of

(see Sec. 17).

20 Combinator (Pure Duplicator)

Deﬁnition:

(52)

10

Equivalences:

(53)

Size: total.

21 Combinator (Elementary Fixed-point, Replicating)

Deﬁnition:

(54)

Reduction to :

(55)

Size: total.

Equivalences:

(56)

(57)

where (58)

(59)

Notes: Deﬁnition 55 by John Tromp [LV97] may be the shortest deﬁnition in terms of

(12 combinators). Deﬁnitions by Curry and Turing are longer (18 and 20, respectively).

22 Combinator (Elementary Fixed-point, Sharing)

Deﬁnition:

where (60)

Reaction:

(61)

Reaction Speciﬁcation:

y: Ysh, a: A, v: V, x, p: P, p’: P, q: Q.

u a, a_1 y, a_2 x, p v_1, p’ v_2, v q

=> (SharingYreaction)

u v_1, v a, a_1 x, a_2 v_2, p’ y, p q.

11

Notes: The following illustrates the self-sharing cycle created by :

.

.

.

Of course, it is the complex that is shared, not , as the notation suggests.

23 Combinators (Iterators or Church Numerals)

Deﬁnition:

(62)

(63)

Size: total for .

Equivalences:

(64)

(65)

(66)

(67)

24 Combinator (Dyadic Compositor)

Deﬁnition:

(68)

Equivalences:

(69)

(70)

Size: total (Def. 69).

12

25 Combinator (Polyadic Compositor)

Deﬁnition:

(71)

Reduction to :

(72)

Size: total for .

Notes: can be replicating or sharing ( ), depending on whether or is used in

deﬁnition 72. If it is sharing, then the following structure is generated:

(73)

Equivalences:

(74)

(75)

(76)

26 Combinator ( Formalizer)

Deﬁnition:

(77)

Reduction to :

(78)

Size: total.

13

Other Notation

27 Composition

Deﬁnition:

(79)

Size: total, plus .

Equivalences:

(80)

(81)

(82)

28 Powers

Deﬁnition:

(83)

(84)

(85)

(86)

Size: total, plus , for , .

Equivalences:

(87)

(88)

(89)

29 Deferred Combinators

Deﬁnition:

(90)

(91)

(92)

Size: total, plus , for .

14

Equivalences:

(93)

(94)

Notes: If

is regular (p. 2), , then

That is, defers the action of by steps. Since , , , , and are regular:

(95)

(96)

(97)

(98)

(99)

30 Left Reduction

Deﬁnition:

(100)

(101)

(102)

Size: total, plus , for .

Equivalences:

(103)

(104)

(105)

(106)

(107)

(108)

(109)

(110)

Notes: can be called a left reduction [Mac90]. To see this, write in inﬁx form,

and assume associates to the left (so ). Then:

For regular,

(111)

15

31 Polyadic Extension

Deﬁnition:

(112)

(113)

(114)

Size: total, plus , for .

Equivalences:

(115)

(116)

Notes: If is regular,

(117)

(118)

(119)

(120)

References

[Bar84] H. P. Barendregt. The Lambda Calculus: Its Syntax and Semantics. North-

Holland, Amsterdam, revised edition, 1984.

[Bur75] William H. Burge. Recursive Programming Techniques. Addison-Wesley, Read-

ing, 1975.

[CFC58] H. B. Curry, R. Feys, and W. Craig. Combinatory Logic, Volume I. North-

Holland, Amsterdam, 1958.

[LV97] M. Li and P. M. B. Vitanyi. An Introduction to Kolmogorov Complexity and its

Applications. Springer-Verlag, New York, second edition, 1997.

[Mac84] Bruce J. MacLennan. Computable real analysis. Technical Report NPS52-84-

024, Dept. of Computer Science, Naval Postgraduate School, 1984.

[Mac90] Bruce J. MacLennan. Functional Programming: Practice and Theory. Addison-

Wesley, Reading, 1990.

16