On

The

Equivalence

Between

CM-C

and

TIM

Rafael

D.Lins

Simon

J.Thompson

Dept.

de

Inform?atica

Universidade

Federal

de

Pernambuco

Recife

Brazil

Computing

Laboratory

The

University

of

Kent

Canterbury

England

Abstract

In

this

paper

we

present

the

equivalence

between

TIM

a

machine

developed

to

implement

lazy

functional

programming

languages

and

the

set

of

Categorical

Multi-Combinators

a

rewriting

system

developed

with

similar

aims

Introduction

A

number

of

different

abstract

machines

for

the

implementation

of

lazy

functional

languages

have

been

developed

in

the

last

few

years

Many

of

these

machines

were

developed

using

different

principles

or

even

based

on

different

theories

of

functions

and

seem

to

be

unrelated

In

our

opinion

it

is

important

to

examine

the

similarities

and

differences

between

these

machines

because

this

will

provide

a

better

understanding

of

their

features

In

this

paper

we

investigate

the

relationship

between

TIM

and

the

system

of

Categorical

Multi-Combinators

Although

these

two

abstract

machines

seem

to

be

completely

unrelated

we

prove

their

equivalence

The

method

of

compilation

of

functional

languages

into

combinators

first

explored

by

Turner

in

-LSB-

-RSB-

provides

a

way

of

removing

the

variables

from

a

program

transforming

it

into

an

applicative

combination

of

constant

functions

or

combinators

Turner

used

a

set

of

combinators

based

on

Curry

's

Combinatory

Logic

To

each

combinator

there

is

associated

a

rewriting

law

In

rewriting

a

combinator

expression

Turner

rewrites

the

leftmost-outermost

reducible

subexpression

-LRB-

or

redex

-RRB-

at

each

stage

When

no

further

rewriting

can

take

place

the

expression

is

said

to

be

in

normal

form

Another

theory

of

functions

is

provided

by

Category

Theory

-LSB-

-RSB-

and

we

can

see

the

notation

used

herein

as

providing

an

alternative

set

of

combinators

The

original

system

of

Categorical

Combinators

was

developed

by

Curien

-LSB-

-RSB-

This

work

was

inspired

by

the

equivalence

of

the

theories

of

typed

calculus

and

Cartesian

Closed

Categories

as

shown

by

Lambek

-LSB-

-RSB-

and

Scott

-LSB-

-RSB-

Aiming

to

implement

lazy

functional

languages

in

an

efficient

way

using

rewriting

of

Categorical

Combinators

we

developed

a

number

of

optimisations

-LSB-

-RSB-

of

the

ve

system

the

most

refined

of

which

was

the

system

of

Linear

Categorical

Combinators

-LSB-

-RSB-

The

modifications

introduced

reduce

the

number

of

rewriting

laws

and

increase

the

efficiency

of

the

system

by

reducing

the

number

of

rewriting

steps

involved

in

taking

an

expression

to

normal

form

whilst

leaving

the

complexity

of

the

pattern

matching

algorithm

unchanged

Categorical

Multi-Combinators

are

a

generalisation

of

Linear

Categorical

Combinators

Each

rewriting

step

of

the

Multi-Combinator

code

is

equivalent

to

several

rewritings

of

Linear

Categorical

Combinators

since

an

application

of

a

function

to

several

arguments

can

be

reduced

in

a

single

step

The

core

of

the

system

of

Categorical

Multi-Combinators

consists

only

of

two

rewriting

laws

with

a

very

low

pattern-matching

complexity

and

avoids

the

generation

of

trivially

reducible

sub-expressions

Independently

there

has

been

much

interest

in

compiled

versions

of

functional

languages

which

run

much

more

quickly

on

von

Neumann

machines

than

do

interpreters

Johnsson

with

his

implementation

of

Lazy

ML

-LSB-

-RSB-

showed

that

it

is

possible

to

get

fast

implementations

of

lazy

functional

languages

Johnsson

's

implementation

model

was

described

as

the

G-Machine

-LSB-

-RSB-

The

basic

principle

of

the

G-Machine

is

to

avoid

generating

graph

nodes

when

it

is

unnecessary

Several

optimisations

to

the

G-Machine

are

suggested

in

-LSB-

-RSB-

In

-LSB-

-RSB-

there

is

an

analysis

of

these

optimisations

and

their

performance

figures

obtained

with

several

different

benchmark

programs

Categorical

Multi-Combinators

served

as

basis

for

two

compiled

machines

GMC

-LSB-

-RSB-

and

CM

CM

-LSB-

-RSB-

GMC

is

inspired

by

the

G-Machine

in

the

sense

that

it

generates

graph

lazily

The

implementation

of

GMC

has

shown

performance

close

but

slower

than

the

G-machine

CM-CM

is

a

stack

based

machine

which

served

as

a

basis

for

CMC

a

lower

level

abstract

machine

suitable

for

efficient

implementation

of

functional

languages

on

RISC

architectures

The

implementation

of

CMC

still

in

progress

has

shown

performance

figures

which

in

the

best

case

is

several

times

faster

and

in

the

worst

case

it

is

slower

than

Chalmers

LML

compiler

based

on

the

G-machine

At

the

same

time

independent

work

on

the

Ponder

abstract

machine

by

Fairbairn

and

Wray

developed

into

a

more

sophisticated

system

the

Three

Instruction

Machine

or

TIM

-LSB-

-RSB-

which

can

be

thought

of

as

a

lazy

SECD

machine

In

this

paper

we

investigate

the

relationship

between

TIM

and

the

system

of

Categorical

MultiCombinators

The

first

section

presents

the

source

language

for

generating

Categorical

Multi-Combinator

expressions

and

TIM

code

To

make

presentation

easier

we

adopted

a

slightly

different

notation

for

Categorical

Multi-Combinators

from

the

one

presented

in

-LSB-

-RSB-

The

multi-pair

combinator

is

represented

by

a

tuple

-LRB-

xn

-RRB-

we

use

the

empty

tuple

-LRB-

-RRB-

to

denote

identity

and

angle

brackets

stand

for

closures

ha

bi

-LRB-

which

we

previously

wrote

ffi

a

b

-RRB-

We

follow

this

by

explaining

the

evaluation

mechanism

in

Categorical

Multi-Combinators

-LSB-

-RSB-

and

TIM

-LSB-

-RSB-

For

further

details

on

TIM

and

indeed

on

other

machines

we

refer

readers

to

-LSB-

-RSB-

The

core

of

the

paper

is

section

in

which

we

present

two

functions

C

and

T

translating

from

TIM

to

CMC

and

vice

versa

We

show

in

and

that

each

of

the

translation

functions

respects

rewriting

in

a

sense

which

we

explain

and

in

we

show

that

T

is

a

left

inverse

of

C

and

that

C

is

a

left

inverse

of

T

modulo

rewriting

The

Source

Language

A

program

is

taken

to

be

a

sequence

of

combinator

definitions

together

with

an

expression

to

be

evaluated

which

will

involve

these

combinators

def

cn

def

combinatorn

main?expression

A

program

when

compiled

will

generate

a

script

which

is

formed

by

a

sequence

of

combinators

linked

to

their

code

thus

ae

-LSB-

-LSB-

-RSB-

-RSB-

cn

-LSB-

-LSB-

combinatorn

-RSB-

-RSB-

In

order

to

flatten

the

source

code

the

compilation

algorithms

for

Categorical

Multi-Combinators

and

TIM

will

extract

right-parenthesised

expressions

and

replace

each

of

them

by

a

unique

label

These

labels

will

also

be

part

of

the

script

and

as

with

combinators

they

have

their

name

linked

to

their

code

ae

-LSB-

-LSB-

-RSB-

-RSB-

cn

-LSB-

-LSB-

combinatorn

-RSB-

-RSB-

-LSB-

-LSB-

-RSB-

-RSB-

lm

-LSB-

-LSB-

expressionm

-RSB-

-RSB-

The

main-expression

is

compiled

separately

as

-LSB-

-LSB-

main?expression

-RSB-

-RSB-

ae

In

order

properly

to

interpret

recursion

we

assume

that

the

environment

ae

contains

the

definition

of

all

combinators

so

that

recursive

combinators

produce

recursive

references

through

the

environment

The

notation

we

use

is

with

each

label

l

there

is

associated

code

lr

and

with

each

combinator

c

there

is

associated

code

cr

we

supress

the

environment

ae

when

no

confusion

is

possible

Compiling

into

Categorical

Multi-Combinators

In

Categorical

Multi-Combinators

function

application

is

denoted

by

juxtaposition

taken

to

be

left-associative

The

compilation

algorithm

for

translating

expressions

into

Categorical

MultiCombinators

is

given

by

the

function

xj

where

each

xi

is

a

variable

and

the

corresponding

i

its

depth

in

the

environment

i.e.

the

corresponding

DeBruijn

number

Top

level

expressions

are

translated

using

an

empty

environment

so

by

R

-LSB-

-RSB-

For

a

matter

of

uniformity

combinators

will

be

represented

as

composed

with

a

dummy

frame

-LRB-

-RRB-

which

can

be

seen

as

the

identity

frame

-LRB-

T

-RRB-

R

-LSB-

-RSB-

xk

xl

-LCB-

z

-RCB-

m

a

hLm

-LRB-

-RRB-

i

-LRB-

Rxk

xla

-RRB-

-LRB-

T

-RRB-

xj

a

b

xj

a

xj

b

-LRB-

T

-RRB-

xj

-LRB-

a

b

-RRB-

li

where

li

is

a

new

unique

label

in

the

script

such

that

li

-LRB-

Rxi

xj

a

-RRB-

-LRB-

Rxi

xj

b

-RRB-

-LRB-

T

-RRB-

xj

b

b

if

b

is

a

constant

-LRB-

T

-RRB-

xj

xi

i

Combinator

names

and

labels

are

treated

as

constants

Example

of

Compilation

The

script

S

a

b

c

ac

-LRB-

bc

-RRB-

K

k

l

k

I

i

i

SKKI

forms

the

following

environment

S

R

-LSB-

-RSB-

-LSB-

-LSB-

a

b

c

-RSB-

-RSB-

K

R

-LSB-

-RSB-

-LSB-

-LSB-

k

l

k

-RSB-

-RSB-

I

R

-LSB-

-RSB-

-LSB-

-LSB-

i

i

-RSB-

-RSB-

which

by

application

of

the

compilation

rules

above

translates

to

S

-LRB-

-RRB-

-LRB-

-RRB-

i

K

-LRB-

-RRB-

-LRB-

-RRB-

i

I

-LRB-

-RRB-

-LRB-

-RRB-

i

The

expression

to

be

evaluated

is

translated

as

R

-LSB-

-RSB-

-LSB-

-LSB-

SKKI

-RSB-

-RSB-

which

generates

SKKI

as

compiled

code

Generating

TIM

Code

Now

we

present

the

compilation

algorithm

for

TIM

The

script

-LSB-

-LSB-

-RSB-

-RSB-

cn

-LSB-

-LSB-

combinatorn

-RSB-

-RSB-

main?expression

Compiles

into

TIM

code

as

ae

B

-LSB-

-LSB-

-RSB-

-RSB-

cn

B

-LSB-

-LSB-

combinatorn

-RSB-

-RSB-

C

-LSB-

-LSB-

main?expression

-RSB-

-RSB-

where

compilation

schemes

B

and

C

are

given

below

-LRB-

C.

-RRB-

B

-LSB-

-LSB-

an

body

-RSB-

-RSB-

-RRB-

-LSB-

Take

n

C

-LSB-

-LSB-

body

-RSB-

-RSB-

-LSB-

an

-RSB-

-RSB-

-LRB-

C.

-RRB-

C

-LSB-

-LSB-

-RSB-

-RSB-

-LSB-

an

-RSB-

-RRB-

-LSB-

P

-LSB-

-LSB-

-RSB-

-RSB-

-LSB-

an

-RSB-

C

-LSB-

-LSB-

-RSB-

-RSB-

-LSB-

an

-RSB-

-RSB-

-LRB-

C.

-RRB-

C

-LSB-

-LSB-

atom

-RSB-

-RSB-

-LSB-

an

-RSB-

-RRB-

E

-LSB-

-LSB-

atom

-RSB-

-RSB-

-LSB-

an

-RSB-

-LRB-

C.

-RRB-

P

-LSB-

-LSB-

am

-RSB-

-RSB-

-LSB-

an

-RSB-

-RRB-

-LSB-

Push

arg

m

-RSB-

-LRB-

C.

-RRB-

P

-LSB-

-LSB-

ci

-RSB-

-RSB-

-LSB-

an

-RSB-

-RRB-

-LSB-

Push

combinator

ci

-RSB-

-LRB-

C.

-RRB-

P

-LSB-

-LSB-

e

-RSB-

-RSB-

-LSB-

an

-RSB-

-RRB-

-LSB-

Push

label

l

-RSB-

where

l

is

a

new

-LRB-

unique

-RRB-

label

and

the

rule

side-effects

ae

thus

ae

ae

-LSB-

-LRB-

C

-LSB-

-LSB-

e

-RSB-

-RSB-

-RRB-

-RSB-

means

ae

with

entry

-LSB-

-LRB-

C

-LSB-

-LSB-

e

-RSB-

-RSB-

-RRB-

-RSB-

-LRB-

C.

-RRB-

E

-LSB-

-LSB-

am

-RSB-

-RSB-

-LSB-

an

-RSB-

-RRB-

-LSB-

Enter

arg

m

-RSB-

-LRB-

C.

-RRB-

E

-LSB-

-LSB-

ci

-RSB-

-RSB-

-LSB-

an

-RSB-

-RRB-

-LSB-

Enter

combinator

ci

-RSB-

The

used

in

rules

-LRB-

C.

-RRB-

and

-LRB-

C.

-RRB-

is

overloaded

In

rule

-LRB-

C.

-RRB-

semi-colon

is

equivalent

to

cons

-LRB-

:-RRB-

in

a

functional

language

while

in

rule

-LRB-

C.

-RRB-

semi-colon

stands

for

append

-LRB-

-RRB-

Compilation

of

an

expression

into

TIM

generates

a

flat

sequence

of

code

always

In

rules

C.

and

C.

a

variable

am

is

replaced

by

m

its

position

in

the

list

of

variables

-LSB-

an

-RSB-

Example

of

Compilation

The

script

S

a

b

c

ac

-LRB-

bc

-RRB-

K

k

l

k

I

i

i

SKKI

forms

the

following

environment

S

B

-LSB-

-LSB-

a

b

c

-RSB-

-RSB-

K

B

-LSB-

-LSB-

k

l

k

-RSB-

-RSB-

I

B

-LSB-

-LSB-

i

i

-RSB-

-RSB-

which

by

application

of

the

compilation

rules

above

translates

as

S

-LSB-

Take

Push

label

Push

arg

Enter

arg

-RSB-

K

-LSB-

Take

Enter

arg

-RSB-

I

-LSB-

Take

Enter

arg

-RSB-

-LSB-

Push

arg

Enter

arg

-RSB-

The

expression

to

be

evaluated

generates

the

following

TIM-code

C

-LSB-

-LSB-

SKKI

-RSB-

-RSB-

ae

Push

Combinator

I

Push

Combinator

K

Push

Combinator

K

Enter

Combinator

S

Executing

the

Code

In

this

section

we

show

how

Categorical

Multi-Combinators

and

TIM

execute

the

code

compiled

by

the

compliation

schemes

above

Categorical

Multi-Combinator

Rewriting

Laws

The

core

of

the

Categorical

Multi-Combinator

machine

is

presented

on

page

of

-LSB-

-RSB-

For

a

matter

of

convenience

we

will

represent

the

multi-pair

combinator

which

forms

evaluation

environments

as

-LRB-

xn

-RRB-

and

compositions

which

represent

closures

will

be

written

as

ha

bi

Using

this

notation

the

kernel

of

the

Categorical

Multi-Combinator

rewriting

laws

is

-LRB-

M

-RRB-

hn

-LRB-

xm

-RRB-

i

-RRB-

xn

-LRB-

M

-RRB-

xn

yi

-RRB-

yi

hxn

yi

-LRB-

M

-RRB-

hLn

-LRB-

y

-RRB-

-LRB-

wm

-RRB-

xnxn

xz

-RRB-

hy

-LRB-

xn

-RRB-

i

xn

xz

The

state

of

computation

of

a

Categorical

Multi-Combinator

expression

is

represented

by

the

expression

itself

Rule

-LRB-

M

-RRB-

performs

environment

look-up

this

is

the

mechanism

by

which

a

variable

fetches

its

value

in

the

corresponding

environment

-LRB-

M

-RRB-

is

responsible

for

environment

distribution

The

rule

-LRB-

M

-RRB-

performs

environment

formation

if

during

rewriting

a

label

or

a

combinator

reaches

the

leftmost

position

of

the

code

we

proceed

a

script

look-up

and

enter

the

corresponding

code

in

the

definition

environment

This

can

be

expressed

as

hl

yi

-RRB-

hlr

yi

TIM

states

The

state

of

a

TIM

computation

is

a

tuple

hCode

Current

Frame

Argument

Stack

Framesi

The

Code

part

is

a

sequence

of

TIM

instructions

The

Current

Frame

is

the

label

-LRB-

pointer

-RRB-

to

a

frame

in

Frames

which

will

be

used

for

the

evaluation

of

the

Code

Specifically

it

is

used

to

hold

the

values

of

free

variables

in

the

code

These

values

might

be

literal

values

or

closures

represented

by

code-frame

pairs

The

Argument

Stack

is

a

stack

of

values

which

are

arguments

to

functions

Frames

is

a

heap

in

which

frames

are

stored

We

use

Miranda

list

notation

to

represent

stacks

The

initial

state

of

the

machine

is

hCode

-LRB-

-RRB-

-LSB-

-RSB-

-LSB-

-RSB-

i

The

state

transition

laws

for

TIM

presented

on

page

of

-LSB-

-RSB-

are

-LRB-

s.

-RRB-

h

-LSB-

Take

n

I

-RSB-

-LRB-

an

A

-RRB-

F

i

-RRB-

hI

f

A

F

-LSB-

f

-LRB-

an

-RRB-

-RSB-

i

where

f

selects

an

unused

frame

-LRB-

s.

-RRB-

h

-LSB-

Push

arg

n

I

-RSB-

f

A

F

-LSB-

f

-LRB-

an

:-RRB-

-RSB-

i

-RRB-

hI

f

-LRB-

an

A

-RRB-

F

-LSB-

f

-LRB-

an

:-RRB-

-RSB-

i

-LRB-

s.

-RRB-

h

-LSB-

Push

label

l

I

-RSB-

f

A

F

i

-RRB-

hI

f

-LRB-

hl

fi

A

-RRB-

F

i

-LRB-

s.

-RRB-

h

-LSB-

Push

combinator

c

I

-RSB-

f

A

F

i

-RRB-

hI

f

-LRB-

hc

-LRB-

-RRB-

i

A

-RRB-

F

i

-LRB-

s.

-RRB-

h

-LSB-

Enter

arg

n

-RSB-

f

A

F

-LSB-

f

-LRB-

hc

fi

:-RRB-

-RSB-

i

-RRB-

hcr

fn

A

F

-LSB-

f

-LRB-

hc

fni

:-RRB-

-RSB-

i

-LRB-

s.

-RRB-

h

-LSB-

Enter

combinator

c

-RSB-

f

A

F

i

-RRB-

hcr

-LRB-

-RRB-

A

F

i

Note

that

in

law

-LRB-

s.

-RRB-

above

we

use

the

notation

F

-LSB-

f

-LRB-

an

-RRB-

-RSB-

to

represent

the

heap

F

updated

with

a

new

frame

f

consisting

of

to

an

In

all

other

rules

F

-LSB-

f

-LRB-

an

-RRB-

-RSB-

means

the

heap

F

contains

a

particular

frame

f

The

empty

tuple

-LRB-

-RRB-

represents

the

empty

frame

C.M-C

TIM

The

close

relationship

between

TIM

-LSB-

-RSB-

and

the

original

set

of

Categorical

Multi-Combinators

-LSB-

-RSB-

has

been

known

to

the

first

author

for

a

long

time

and

has

also

been

mentioned

by

other

people

-LSB-

-RSB-

This

equivalence

was

also

outlined

in

-LSB-

-RSB-

Our

aim

in

this

section

is

to

make

clear

the

relationship

between

TIM

-LSB-

-RSB-

and

the

original

set

of

Categorical

Multi-Combinators

-LSB-

-RSB-

We

present

two

functions

C

translating

from

TIM

to

CMC

and

T

going

in

the

reverse

direction

The

translation

functions

and

equivalence

proofs

we

supply

depend

upon

a

number

of

simple

properties

of

the

form

of

the

state

and

expressions

produced

by

rewriting

or

executing

compiled

lambda

expressions

ffl

All

lambda

expressions

rewritten

are

of

ground

-LRB-

non-functional

-RRB-

type

This

is

implicit

in

the

rewriting

rule

for

Take

in

TIM

where

it

is

assumed

that

there

are

always

sufficient

arguments

upon

the

stack

to

perform

a

function

application

when

required

ffl

All

lambda

expressions

are

assumed

to

be

lambda-lifted

before

compilation

-LRB-

c.f.

-LSB-

-RSB-

-RRB-

since

this

is

intrinsic

to

the

rewriting

rules

for

Categorical

Multi-Combinators

Examining

the

form

of

rewritten

lambda

expressions

in

CMC

it

is

safe

to

assume

that

in

any

composition

hl

ri

l

is

not

a

composition

and

that

r

is

a

multi-pair

or

tuple

-LRB-

xn

-RRB-

We

then

show

that

the

translations

given

commute

with

rewriting

First

we

show

that

if

a

TIM

state

rewrites

in

one

step

to

state

then

C

-LRB-

-RRB-

the

Categorical

Multi-Combinator

equivalent

rewrites

in

a

sequence

of

zero

or

more

steps

to

C

-LRB-

-RRB-

-LCB-

-LRB-

Property

I

-RRB-

We

then

show

that

if

a

CMC

expression

rewrites

in

one

step

to

then

T

-LRB-

-RRB-

the

TIM

equivalent

rewrites

in

a

sequence

of

zero

or

more

steps

to

T

-LRB-

-RRB-

-LCB-

-LRB-

Property

II

-RRB-

Property

I

Property

II

C

-LRB-

-RRB-

C

-LRB-

-RRB-

T

-LRB-

-RRB-

T

-LRB-

-RRB-

Finally

we

show

that

T

is

a

left

inverse

of

C

i.e.

C

then

T

is

the

identity

on

TIM

states

The

other

inverse

relationship

does

not

hold

We

exhibit

an

example

to

show

this

but

we

also

show

that

it

is

an

inverse

modulo

rewriting

Translating

TIM

into

C.M-C

The

translation

from

TIM

states

to

Categorical

Multi-Combinator

expressions

is

performed

by

the

following

functions

-LRB-

t.

-RRB-

C

-LRB-

hI

f

-LSB-

xz

-RSB-

F

-LSB-

f

-LRB-

yn

-RRB-

-RSB-

i

-RRB-

hoF

I

-LRB-

oF

oF

oF

yn

-RRB-

i

oF

oF

xz

-LRB-

t.

-RRB-

oF

-LSB-

hcn

fi

-RSB-

hoF

cn

-LRB-

oF

oF

ym

-RRB-

i

where

f

-LRB-

ym

-RRB-

in

F

-LRB-

t.

-RRB-

oF

-LSB-

Take

n

I

-RSB-

Ln

-LRB-

oF

I

-RRB-

-LRB-

t.

-RRB-

oF

-LSB-

Push

arg

n

I

-RSB-

oF

I

-LRB-

n

-RRB-

-LRB-

t.

-RRB-

oF

-LSB-

Push

label

l

I

-RSB-

oF

I

r

-LRB-

t.

-RRB-

oF

-LSB-

Push

combinator

c

I

-RSB-

oF

I

r

-LRB-

t.

-RRB-

oF

-LSB-

Enter

arg

n

-RSB-

-LRB-

n

-RRB-

-LRB-

t.

-RRB-

oF

-LSB-

Enter

combinator

c

-RSB-

As

we

can

observe

oF

in

rules

-LRB-

t.

-RRB-

to

-LRB-

t.

-RRB-

is

recursively

invoked

only

on

code

sequences

without

any

need

for

heap

information

which

is

carried

by

F

For

notational

simplicity

the

subscript

F

such

as

in

oF

which

stands

for

the

heap

of

frames

in

TIM

states

will

be

omitted

in

the

sequel

if

no

misunderstanding

can

arise

Rule

t.

above

translates

a

TIM

state

into

a

top-level

Categorical

Multi-Combinator

expression

it

is

used

to

translate

the

expression

under

evaluation

In

this

case

oF

is

ancillary

to

C

and

translates

a

code

sequence

into

Categorical

Multi-Combinator

sub-expressions

We

also

apply

oF

to

each

entry

in

the

TIM

script

in

order

to

generate

the

corresponding

C.M-C

script

thus

oF

c

-LSB-

-LSB-

-RSB-

-RSB-

l

-LSB-

-LSB-

-RSB-

-RSB-

oF

-LSB-

-LSB-

-RSB-

-RSB-

oF

-LSB-

-LSB-

-RSB-

-RSB-

Proof

of

Property

I

We

show

that

if

a

state

rewrites

to

a

state

then

C

-LRB-

-RRB-

the

Categorical

Multi-Combinator

equivalent

expression

to

rewrites

in

a

sequence

of

zero

or

more

steps

to

C

-LRB-

-RRB-

The

translation

between

TIM

states

and

C.M-C

expressions

is

performed

by

the

algorithm

above

The

following

sub-sections

prove

the

result

clause

by

clause

Multi

Reduction

Let

us

start

analysing

the

most

important

state

transition

law

of

both

machines

the

one

which

corresponds

to

reduction

in

the

Calculus

We

can

see

that

h

-LSB-

Take

n

I

-RSB-

-LRB-

an

A

-RRB-

F

i

-RRB-

hI

f

A

F

-LSB-

f

-LRB-

an

-RRB-

-RSB-

i

where

f

selects

an

unused

frame

and

hLn

-LRB-

y

-RRB-

-LRB-

wj

-RRB-

xnxn

xz

-RRB-

hy

-LRB-

xn

-RRB-

ixn

xz

perform

exactly

the

same

transformation

to

the

code

This

equivalence

can

be

shown

formally

as

follows

C

-LRB-

h

-LSB-

Take

n

I

-RSB-

f

-LSB-

xz

-RSB-

F

-LSB-

f

-LRB-

yi

-RRB-

-RSB-

i

-RRB-

t

ho

-LSB-

Take

n

I

-RSB-

-LRB-

oyi

-RRB-

i

oxz

s

k

t

C

-LRB-

hI

-LSB-

xn

xz

-RSB-

F

-LSB-

-LRB-

xn

-RRB-

-RSB-

i

-RRB-

hLn

-LRB-

oI

-RRB-

-LRB-

oyi

-RRB-

i

oxz

k

t

M

hoI

-LRB-

oxn

-RRB-

i

oxn

oxz

hoI

-LRB-

oxn

-RRB-

i

oxn

oxz

Push

arg

as

Environment

Look-up

The

operation

which

allows

a

variable

to

fetch

its

value

from

its

corresponding

environment

is

expressed

in

TIM

and

C.M-C

as

h

-LSB-

Push

arg

n

I

-RSB-

f

A

F

-LSB-

f

-LRB-

an

:-RRB-

-RSB-

i

-RRB-

hI

f

an

A

F

-LSB-

f

-LRB-

an

:-RRB-

-RSB-

i

hn

-LRB-

xm

-RRB-

i

-RRB-

xn

Consider

the

behaviour

of

the

two

rules

C

-LRB-

h

-LSB-

Push

arg

n

I

-RSB-

f

-LRB-

:-RRB-

F

-LSB-

f

-LRB-

am

-RRB-

-RSB-

i

-RRB-

t

ho

-LSB-

Push

arg

n

I

-RSB-

-LRB-

oam

-RRB-

i

s

k

t

C

-LRB-

hI

f

-LRB-

an

:-RRB-

F

-LSB-

f

-LRB-

am

-RRB-

-RSB-

i

-RRB-

hoI

-LRB-

n

-RRB-

-LRB-

oam

-RRB-

i

k

t

M

hoI

-LRB-

oam

-RRB-

i

oan

hoI

-LRB-

oam

-RRB-

i

h

-LRB-

n

-RRB-

-LRB-

oam

-RRB-

i

M

hoI

-LRB-

oam

-RRB-

i

oan

Push

label

as

Environment

Distribution

This

operation

is

performed

by

the

following

laws

in

TIM

and

C.M-C

respectively

h

-LSB-

Push

label

l

I

-RSB-

f

A

F

i

-RRB-

hI

f

hl

fi

A

F

i

xn

yi

-RRB-

yi

hxn

yihxn

yi

Right

associated

applications

are

removed

from

the

TIM

code

and

replaced

by

a

label

Push

label

l

builds

a

closure

of

the

current

frame

and

the

label

l.

Let

us

prove

the

operational

equivalence

between

the

laws

above

C

-LRB-

h

-LSB-

Push

label

l

I

-RSB-

f

-LSB-

F

-LSB-

f

-LRB-

am

-RRB-

-RSB-

i

-RRB-

t

ho

-LSB-

Push

label

l

I

-RSB-

-LRB-

oam

-RRB-

i

s

k

t

C

-LRB-

hI

f

-LSB-

hl

fi

F

-LSB-

f

-LRB-

am

-RRB-

-RSB-

i

-RRB-

hoI

-LRB-

oam

-RRB-

i

k

t

M

hoI

-LRB-

oam

-RRB-

i

o

hl

fi

hoI

-LRB-

oam

-RRB-

-LRB-

oam

-RRB-

io

k

t

hoI

-LRB-

oam

-RRB-

iho

l

-LRB-

oam

-RRB-

io

k

hoI

-LRB-

oam

-RRB-

-LRB-

oam

-RRB-

io

We

recall

that

is

the

TIM

label

corresponding

to

l.

Push

combinator

as

Script

Look-up

In

TIM

and

C.M-C

functions

are

lambda

lifted

during

compilation

so

that

each

function

corresponds

to

a

closed

expression

or

a

combinator

Whenever

a

combinator

is

applied

it

will

generate

its

own

evaluation

environment

binding

actual

parameters

to

formal

parameters

In

C.M-C

whenever

a

combinator

name

reaches

the

leftmost

outermost

position

in

the

code

we

enter

the

corresponding

code

h

-LSB-

Push

combinator

c

I

-RSB-

f

A

F

i

-RRB-

hI

f

hc

-LRB-

-RRB-

i

A

F

i

Let

us

prove

the

operational

equivalence

between

the

laws

above

C

-LRB-

h

-LSB-

Push

combinator

c

I

-RSB-

f

-LSB-

F

-LSB-

f

-LRB-

am

-RRB-

-RSB-

i

-RRB-

t

ho

-LSB-

Push

combinator

c

I

-RSB-

-LRB-

oam

-RRB-

i

s

k

t

C

-LRB-

hI

f

-LSB-

hc

-LRB-

-RRB-

i

F

-LSB-

f

-LRB-

am

-RRB-

-RSB-

i

-RRB-

hoI

-LRB-

oam

-RRB-

i

k

t

M

hoI

-LRB-

oam

-RRB-

i

o

hc

-LRB-

-RRB-

i

hoI

-LRB-

oam

-RRB-

i

-LRB-

oam

-RRB-

i

k

t

hoI

-LRB-

oam

-RRB-

i

ho

c

o

-LRB-

-RRB-

i

k

hoI

-LRB-

oam

-RRB-

i

o

-LRB-

-RRB-

i

where

is

the

TIM

combinator

corresponding

to

c

As

combinators

discharge

the

environments

they

are

composed

with

we

have

both

sides

above

operationally

equal

Enter

arg

as

Environment

Look-up

In

the

law

h

-LSB-

Enter

arg

n

-RSB-

f

A

F

-LSB-

f

-LRB-

hc

f

i

:-RRB-

-RSB-

i

-RRB-

hcr

f

A

F

-LSB-

f

-LRB-

hc

f

i

:-RRB-

-RSB-

i

Enter

performs

a

similar

transformation

to

the

code

as

Push

arg

n

above

i.e.

an

environment

look-up

Let

us

see

the

state

transition

this

law

performs

in

C.M-C

C

-LRB-

h

-LSB-

Enter

arg

n

-RSB-

f

-LSB-

F

-LSB-

f

-LRB-

hc

f

i

-RRB-

-RSB-

i

-RRB-

t

ho

-LSB-

Enter

arg

n

-RSB-

-LRB-

o

hc

f

i

-RRB-

i

s

k

t

C

-LRB-

hcr

f

-LSB-

F

-LSB-

f

-LRB-

yn

-RRB-

-RSB-

i

-RRB-

h

-LRB-

n

-RRB-

-LRB-

o

hc

f

i

-RRB-

i

k

t

M

hocr

-LRB-

oym

-RRB-

i

o

hc

f

i

k

k

t

r

-LRB-

oym

-RRB-

i

ho

c

-LRB-

oym

-RRB-

i

k

-LRB-

oym

-RRB-

i

k

r

-LRB-

oym

-RRB-

i

Enter

combinator

as

Script

Look-up

The

other

role

of

the

Enter

combinator

is

simply

to

read

the

code

for

a

function

definition

from

the

script

performing

a

lazy

linking

of

the

code

by

the

following

law

h

-LSB-

Enter

combinator

c

-RSB-

f

A

F

i

-RRB-

hcr

-LRB-

-RRB-

A

F

i

This

law

is

equivalent

to

the

following

state

transformation

in

C.M-C

C

-LRB-

h

-LSB-

Enter

combinator

c

-RSB-

f

-LSB-

F

-LSB-

f

-LRB-

am

-RRB-

-RSB-

i

-RRB-

t

ho

-LSB-

Enter

combinator

c

-RSB-

-LRB-

oam

-RRB-

i

s

k

t

C

-LRB-

hcr

-LRB-

-RRB-

-LSB-

F

-LSB-

f

-LRB-

am

:-RRB-

-RSB-

i

-RRB-

r

-LRB-

oam

-RRB-

i

k

t

hocr

-LRB-

oam

-RRB-

i

k

r

-LRB-

oam

-RRB-

i

where

r

is

the

TIM

code

associated

with

combinator

Translating

C.M-C

into

TIM

The

translation

between

Categorical

Multi-Combinator

expressions

and

TIM

states

is

performed

by

the

following

functions

-LRB-

r.

-RRB-

T

-LRB-

he

-LRB-

ym

-RRB-

i

wk

-RRB-

h?e

f

-LSB-

wk

-RSB-

F

-LSB-

f

-LRB-

ym

-RRB-

-RSB-

i

-LRB-

r.

-RRB-

Ln

-LRB-

x

-RRB-

-LSB-

Take

n

x

-RSB-

-LRB-

r.

-RRB-

n

Enter

arg

-LRB-

n

-RRB-

-LRB-

r.

-RRB-

r

Enter

combinator

c

-LRB-

r.

-RRB-

-LRB-

em

-RRB-

em

-LRB-

r.

-RRB-

hn

-LRB-

ym

-RRB-

i

yn

-LRB-

r.

-RRB-

hx

-LRB-

ym

-RRB-

i

h?x

fi

where

f

-LRB-

ym

-RRB-

-LRB-

r.

-RRB-

n

Push

arg

-LRB-

n

-RRB-

if

n

is

a

variable

-LRB-

r.

-RRB-

r

Push

combinator

c

if

c

is

a

combinator

-LRB-

r.

-RRB-

r

Push

label

l

T

translates

a

top-level

Categorical

Multi-Combinator

expression

into

a

TIM

state

and

are

ancillary

functions

which

translate

the

code

of

a

Categorical

Multi-Combinator

sub-expression

into

TIM-code

As

we

can

observe

in

rule

-LRB-

C.

-RRB-

above

for

compiling

TIM

code

each

subterm

in

an

application

is

translated

depending

on

its

position

in

the

term

is

needed

to

reflect

this

difference

which

does

not

exist

in

Categorical

Multi-Combinators

into

TIM

F

appears

as

an

unbound

variable

in

rule

-LRB-

r.

-RRB-

the

meaning

of

this

is

the

heap

built

by

the

recursive

invocation

of

on

the

subexpressions

to

which

it

is

applied

When

-LRB-

r.

-RRB-

is

applied

a

new

frame

in

the

heap

is

generated

and

we

can

see

that

the

traversal

of

the

Categorical

Multi-Combinator

expression

gives

rise

to

a

collection

of

frames

-LRB-

F

-RRB-

in

the

heap

The

corresponding

TIM

script

is

generated

by

applying

to

each

of

the

entries

of

the

C.M-C

script

thus

-LSB-

-LSB-

-RSB-

-RSB-

-LSB-

-LSB-

-RSB-

-RSB-

c

-LSB-

-LSB-

-RSB-

-RSB-

l

-LSB-

-LSB-

-RSB-

-RSB-

The

syntax

of

Categorical

Multi-Combinator

expressions

which

can

arise

from

compilation

or

rewriting

of

compiled

expressions

shows

us

that

in

rule

-LRB-

r.

-RRB-

e

can

either

be

a

variable

an

application

or

an

abstraction

-LRB-

Ln

-LRB-

a

-RRB-

or

ci

-RRB-

We

use

this

in

proving

property

II

below

Proof

of

Property

II

We

show

here

that

if

a

Categorical

Multi-Combinator

expression

rewrites

in

one

step

to

expression

then

the

TIM

state

T

-LRB-

-RRB-

rewrites

in

a

sequence

of

one

or

more

steps

to

T

-LRB-

-RRB-

The

translation

between

C.M-C

expressions

and

TIM

states

is

performed

by

the

algorithm

above

Environment

Look-up

T

-LRB-

hn

-LRB-

hy

-LRB-

xj

xl

-RRB-

i

-RRB-

wk

-RRB-

r

h?n

f

-LSB-

wk

-RSB-

F

-LSB-

f

-LRB-

h?y

f

i

:-RRB-

-RSB-

i

M

k

r

T

-LRB-

hy

-LRB-

xj

xl

-RRB-

wk

-RRB-

hEnter

arg

-LRB-

n

-RRB-

f

-LSB-

wk

-RSB-

F

-LSB-

f

-LRB-

h?y

f

i

:-RRB-

-RSB-

i

k

r

s

h?y

f

-LSB-

wk

-RSB-

F

i

h?y

f

-LSB-

wk

-RSB-

F

-LSB-

f

-LRB-

h?y

f

i

:-RRB-

-RSB-

i

The

translation

rules

give

rise

to

different

heaps

on

the

left

and

right

hand

sides

Note

however

that

the

only

difference

is

the

presence

of

an

additional

frame

f

on

the

right

hand

side

As

rewriting

is

not

affected

by

the

presence

of

this

extra

frame

we

can

say

that

the

two

expressions

above

are

equivalent

Environment

Distribution

T

-LRB-

xn

-LRB-

ym

-RRB-

:-RRB-

r

h

-LRB-

xn

-RRB-

f

-LSB-

F

-LSB-

f

-LRB-

ym

:-RRB-

-RSB-

i

M

k

r

T

-LRB-

-LRB-

ym

-RRB-

i

hxn

-LRB-

ym

-RRB-

:-RRB-

h?xn

f

-LSB-

F

-LSB-

f

-LRB-

ym

:-RRB-

-RSB-

i

k

r

f

-LSB-

-LRB-

ym

-RRB-

i

F

-LSB-

f

-LRB-

ym

:-RRB-

-RSB-

i

There

are

three

cases

to

be

considered

depending

on

the

form

of

the

expression

xn

xn

is

a

combinator

k

r

k

r

f

-LSB-

-LRB-

-RRB-

i

F

i

hPush

combinator

c

f

-LSB-

F

-LSB-

f

-LRB-

ym

:-RRB-

-RSB-

i

k

s

f

-LSB-

hc

-LRB-

-RRB-

i

F

i

h?xn

f

-LSB-

hc

-LRB-

-RRB-

i

F

-LSB-

f

-LRB-

ym

:-RRB-

-RSB-

i

-LRB-

s

s

or

s

-RRB-

f

-LSB-

hc

-LRB-

-RRB-

i

F

-LSB-

f

-LRB-

ym

:-RRB-

-RSB-

i

xn

is

a

variable

a

k

r

k

r

f

-LSB-

ya

F

i

hPush

arg

-LRB-

a

-RRB-

f

-LSB-

F

-LSB-

f

-LRB-

ym

:-RRB-

-RSB-

i

s

h?xn

f

-LSB-

ya

F

-LSB-

f

-LRB-

ym

:-RRB-

-RSB-

i

-LRB-

s

s

or

s

-RRB-

f

-LSB-

ya

F

-LSB-

f

-LRB-

ym

:-RRB-

-RSB-

i

xn

is

a

label

k

r

k

r

f

-LSB-

r

fi

F

-LSB-

f

-LRB-

ym

:-RRB-

-RSB-

i

hPush

label

l

f

-LSB-

F

-LSB-

f

-LRB-

ym

:-RRB-

-RSB-

i

k

s

f

-LSB-

hlr

fi

F

-LSB-

f

-LRB-

ym

:-RRB-

-RSB-

i

h?xn

f

-LSB-

hlr

fi

F

-LSB-

f

-LRB-

ym

:-RRB-

-RSB-

i

-LRB-

s

s

or

s

-RRB-

f

-LSB-

hlr

fi

F

-LSB-

f

-LRB-

ym

:-RRB-

-RSB-

i

Multi

Reduction

T

-LRB-

hLn

-LRB-

y

-RRB-

-LRB-

wj

-RRB-

xz

-RRB-

r

h?Ln

-LRB-

y

-RRB-

f

-LSB-

xz

-RSB-

F

-LSB-

f

-LRB-

wj

-RRB-

-RSB-

i

M

k

r

T

-LRB-

hy

-LRB-

xn

-RRB-

i

xn

xz

-RRB-

h

-LSB-

Take

n

y

-RSB-

f

-LSB-

xz

-RSB-

F

-LSB-

f

-LRB-

wj

-RRB-

-RSB-

i

k

r

s

h?y

f

-LSB-

xn

xz

-RSB-

F

-LSB-

f

-LRB-

xn

-RRB-

-RSB-

h?y

f

-LSB-

xn

xz

-RSB-

F

-LSB-

f

-LRB-

xn

-RRB-

-RSB-

i

The

heap

in

the

right

hand

side

has

an

additional

frame

f

if

compared

with

the

heap

in

the

left

hand

side

As

this

does

not

affect

rewriting

we

can

say

that

the

two

expressions

above

are

equivalent

C

and

T

We

show

that

the

two

translation

functions

C

and

T

are

related

to

each

other

In

particular

we

show

that

T

is

a

left

inverse

of

C

but

the

reverse

is

not

true

However

it

is

an

inverse

modulo

expression

rewriting

as

explained

in

section

T

ffi

C

Identity

Here

we

prove

that

T

-LRB-

Cx

-RRB-

x

when

x

is

a

TIM

state

by

structural

induction

over

the

structure

of

x.

T

-LRB-

ChI

f

-LSB-

xz

-RSB-

F

-LSB-

f

-LRB-

yn

-RRB-

-RSB-

i

-RRB-

t

T

-LRB-

ho

I

-LRB-

oyn

-RRB-

i

oxz

-RRB-

r

h

-LRB-

oI

-RRB-

f

-LSB-

-LRB-

o

-RRB-

-LRB-

oxz

-RRB-

-RSB-

F

-LSB-

f

-LRB-

-LRB-

-RRB-

-LRB-

oyn

-RRB-

-RRB-

-RSB-

i

Assuming

that

-LRB-

ox

-RRB-

x

this

equals

o

T

-LRB-

ChI

f

-LSB-

xz

-RSB-

F

-LSB-

f

-LRB-

yn

-RRB-

-RSB-

i

-RRB-

Now

we

prove

that

-LRB-

ox

-RRB-

x

by

induction

over

the

structure

of

x

-LRB-

o

-LSB-

Take

n

I

-RSB-

-RRB-

t

-LRB-

Ln

-LRB-

oI

-RRB-

-RRB-

r

-LSB-

Take

n

-LRB-

oI

-RRB-

-RSB-

by

induction

-LRB-

oI

-RRB-

I

so

o

-LSB-

Take

n

I

-RSB-

-LRB-

o

-LSB-

Push

arg

n

I

-RSB-

-RRB-

t

-LRB-

oI

-LRB-

n

-RRB-

-RRB-

r

-LSB-

-LRB-

n

-RRB-

-LRB-

oI

-RRB-

-RSB-

r

-LSB-

Push

arg

n

-LRB-

oI

-RRB-

-RSB-

by

induction

-LRB-

oI

-RRB-

I

so

o

-LSB-

Push

arg

n

I

-RSB-

-LRB-

o

-LSB-

Push

combinator

c

I

-RSB-

-RRB-

t

-LRB-

oI

r

-RRB-

r

-LSB-

r

-LRB-

oI

-RRB-

-RSB-

r

-LSB-

Push

combinator

c

-LRB-

oI

-RRB-

-RSB-

by

induction

-LRB-

oI

-RRB-

I

so

o

-LSB-

Push

combinator

c

I

-RSB-

-LRB-

o

-LSB-

Push

label

l

I

-RSB-

-RRB-

t

-LRB-

oI

r

-RRB-

r

-LSB-

r

-LRB-

oI

-RRB-

-RSB-

r

-LSB-

Push

label

l

-LRB-

oI

-RRB-

-RSB-

by

induction

-LRB-

oI

-RRB-

I

so

o

-LSB-

Push

label

l

I

-RSB-

-LRB-

o

-LSB-

Enter

arg

n

-RSB-

-RRB-

t

-LRB-

n

-RRB-

r

-LSB-

Enter

arg

n

-RSB-

-LRB-

o

-LSB-

Enter

combinator

c

-RSB-

-RRB-

t

r

r

-LSB-

Enter

combinator

c

-RSB-

-LRB-

o

-LSB-

hcn

fi

-RSB-

-RRB-

t

hocn

-LRB-

oym

-RRB-

i

where

f

-LRB-

ym

-RRB-

r

-LRB-

-LRB-

ocn

-RRB-

f

-RRB-

where

f

-LRB-

-LRB-

-RRB-

-LRB-

oym

-RRB-

-RRB-

by

induction

-LRB-

ocn

-RRB-

cn

so

o

hcn

fi

C

ffi

T

ss

Identity

We

will

show

that

C

-LRB-

T

x

-RRB-

x

where

x

is

a

Categorical

Multi-Combinator

expression

does

not

hold

but

if

C

-LRB-

T

x

-RRB-

then

x

rewrites

to

in

a

finite

sequence

of

steps

Firstly

let

us

try

to

prove

that

C

-LRB-

T

x

-RRB-

x.

C

-LRB-

T

-LRB-

he

-LRB-

ym

-RRB-

wk

-RRB-

-RRB-

r

Ch?e

f

-LSB-

wk

-RSB-

F

-LSB-

f

-LRB-

ym

-RRB-

-RSB-

i

t

-LRB-

ho

-LSB-

e

-RSB-

-LRB-

o

-LSB-

-RSB-

o

-LSB-

ym

-RSB-

-RRB-

i

o

-LSB-

-RSB-

o

-LSB-

wm

-RSB-

If

o

-LSB-

x

-RSB-

x

then

o

-LRB-

he

-LRB-

ym

-RRB-

i

wk

Now

we

will

try

to

prove

that

o

-LSB-

x

-RSB-

x

where

x

is

a

Categorical

Multi-Combinator

expression

by

induction

over

the

structure

of

x

o

-LSB-

Ln

-LRB-

I

-RRB-

-RSB-

r

o

-LSB-

Take

n

I

-RSB-

t

Ln

-LRB-

o

-LSB-

I

-RSB-

-RRB-

by

induction

o

-LSB-

I

-RSB-

I

o

Ln

-LRB-

I

-RRB-

o

-LSB-

n

-RSB-

r

o

-LSB-

Enter

arg

-LRB-

n

-RRB-

-RSB-

t

-LRB-

n

-RRB-

n

o

-LSB-

-LRB-

em

-RRB-

-RSB-

r

o

-LSB-

em

-RSB-

if

em

is

a

variable

n

r

o

-LSB-

Push

arg

-LRB-

n

-RRB-

-RSB-

t

o

-LSB-

-RSB-

n

t

em

if

em

is

the

code

linked

to

a

label

r

o

-LSB-

Push

label

l

-RSB-

t

o

-LSB-

-RSB-

r

t

em

if

em

is

the

code

linked

to

a

combinator

r

o

-LSB-

Push

combinator

c

-RSB-

t

o

-LSB-

-RSB-

r

t

em

o

-LSB-

-LRB-

hx

-LRB-

ym

-RRB-

i

-RSB-

r

o

-LSB-

h?x

fi

-RSB-

t

ho

-LSB-

f

-RSB-

-LRB-

o

-LSB-

-RSB-

o

-LSB-

ym

-RSB-

-RRB-

i

o

hx

-LRB-

ym

-RRB-

i

o

-LSB-

-LRB-

hn

-LRB-

ym

-RRB-

i

-RSB-

r

o

-LSB-

yn

-RSB-

o

yn

In

the

last

case

we

saw

that

o

-LSB-

x

-RSB-

x.

However

we

can

see

that

if

o

-LSB-

x

-RSB-

then

x

rewrites

to

in

a

finite

sequence

of

rewriting

steps

so

we

have

o?x

ss

x

and

CT

x

ss

x

as

required

Conclusions

In

this

paper

we

have

shown

the

equivalence

between

the

operational

semantics

of

the

TIM

machine

and

rewriting

of

Categorical

Multi-Combinator

expressions

every

TIM

state

is

equivalent

to

a

Categorical

Multi-Combinator

expression

and

vice

versa

equivalent

expressions

are

transformed

into

equivalent

expressions

by

rewriting

The

point

of

similarity

of

the

two

systems

which

distinguishes

them

from

others

is

their

coarse

granularity

of

computation

-LCB-

a

number

of

reductions

can

be

performed

in

a

single

step

in

both

systems

Both

perform

formation

distribution

look-up

and

deletion

of

multi-element

environments

as

single

computation

steps

The

result

shows

that

we

can

see

Categorical

Multi-Combinators

as

describing

machine

computations

at

a

high

level

of

abstraction

and

also

indicates

that

efficient

implementations

of

this

system

are

feasible

The

authors

are

currently

investigating

a

novel

abstract

machine

CMC

-LSB-

-RSB-

based

on

Categorical

Multi-Combinators

and

CM-CM

-LSB-

-RSB-

Acknowledgements

The

authors

are

most

grateful

to

Simon

Peyton

Jones

for

several

corrections

to

and

comments

on

earlier

versions

of

this

paper

Research

reported

herein

has

been

sponsored

jointly

by

the

British

Council

C.N.Pq

-LRB-

Brazil

-RRB-

grants

No

and

and

CAPES

-LRB-

Brazil

-RRB-

grant

References

-LSB-

-RSB-

P-L

Curien

Categorical

Combinators

Sequential

Algorithms

and

Functional

Programming

Research

Notes

in

Theoretical

Computer

Science

Pitman

Publishing

Ltd.

-LSB-

-RSB-

J.Fairbairn

and

S.Wray

Tim

A

simple

lazy

abstract

machine

to

execute

supercombinators

In

Proceedings

of

Third

International

Conference

on

Functional

Programming

and

Computer

Architecture

pages

-LCB-

LNCS

Springer

Verlag

-LSB-

-RSB-

T.Johnsson

Compiling

Lazy

Functional

Languages

PhD

thesis

Chalmers

Tekniska

H?ogskola

G?oteborg

Sweden

January

-LSB-

-RSB-

J.Lambek

From

lambda-calculus

to

cartesian

closed

categories

In

J.P.Seldin

and

J.R.Hindley

editors

in

To

H.B.Curry

Essays

on

Combinatory

Logic

Lambda-Calculus

and

Formalism

Academic

Press

-LSB-

-RSB-

R.D.Lins

A

new

formula

for

the

execution

of

categorical

combinators

In

Proceedings

of

International

Conference

on

Automated

Deduction

pages

-LCB-

Springer

Verlag

July

LNCS

-LSB-

-RSB-

R.D.Lins

On

the

Efficiency

of

Categorical

Combinators

in

Applicative

Languages

PhD

thesis

The

University

of

Kent

at

Canterbury

October

-LSB-

-RSB-

R.

D.

Lins

On

the

efficiency

of

categorial

combinators

as

a

rewriting

system

Software

Practice

and

Experience

-LRB-

-RRB-

-LCB-

August

-LSB-

-RSB-

R.D.Lins

Categorical

multi-combinators

In

Gilles

Kahn

editor

Functional

Programming

Languages

and

Computer

Architecture

pages

-LCB-

Springer-Verlag

September

LNCS

-LSB-

-RSB-

R.D.Lins

B.O.Lira

CMC

A

Novel

Way

to

Implement

Functional

Languages

in

preparation

-LSB-

-RSB-

R.D.Lins

S.J.Thompson

Implementing

SASL

using

categorical

multi-combinators

Software

Practice

and

Experience

-LRB-

-RRB-

-LCB-

November

-LSB-

-RSB-

R.D.Lins

S.J.Thompson

CM-CM

A

categorical

multi-combinator

machine

In

Proceedings

of

XVI

LatinoAmerican

Conference

on

Informatics

vol

-LRB-

-RRB-

pages

Assunsion

Paraguay

September

-LSB-

-RSB-

M.A.Musicante

R.D.Lins

GMC

a

graph

multi-combinator

machine

Euromicro

Journal

Microprocessing

and

Microprogramming

-LRB-

-RRB-

-LCB-

North-Holland

April

-LSB-

-RSB-

S.Peyton

Jones

The

Implementation

of

Functional

Languages

Prentice

Hall

-LSB-

-RSB-

S.Peyton

Jones

D.Lester

Implementing

Functional

Languages

A

Tutorial

Prentice

Hall

-LSB-

-RSB-

D.Scott

Relating

theories

of

the

lambda-calculus

In

J.P.Seldin

and

J.R.Hindley

editors

in

To

H.B.Curry

Essays

on

Combinatory

Logic

Lambda-Calculus

and

Formalism

Academic

Press

-LSB-

-RSB-

P.G.Soares

R.D.Lins

Implementing

the

G-machine

Technical

Report

UKC

Computing

Lab

Report

The

University

of

Kent

at

Canterbury

August

-LSB-

-RSB-

S.J.Thompson

R.D.Lins

The

Categorical

Multi-Combinator

Machine

CM-CM

to

appear

in

The

Programming

Journal

April

-LSB-

-RSB-

D.A.Turner

A

new

implementation

technique

for

applicative

languages

Software

Practice

and

Experience

-LSB-

-RSB-

G.Wraith

and

D.Bosley

November

private

communication

categorical multi-combinators
lambda calculus