Laboratoire

de

l'Informatique

du

Parall?lisme

Ecole

Normale

Sup?rieure

de

Lyon

Unit

de

recherche

associ?e

au

CNRS

n

Marking

techniques

for

extraction

Fr?ed?eric

Prost

December

Research

Report

No

Ecole

Normale

Sup?rieure

de

Lyon

Adresse

lectronique

lip@lip.ens-lyon.fr

T?l?phone

-LRB-

-RRB-

T?l?copieur

-LRB-

-RRB-

All?e

d'Italie

Lyon

Cedex

France

Marking

techniques

for

extraction

Fr?ed?eric

Prost

December

Abstract

Constructive

logic

can

be

used

to

consider

program

specifications

as

logical

formulas

The

advantage

of

this

approach

is

to

generate

programs

which

are

certified

with

respect

to

some

given

specifications

The

programs

created

in

such

a

way

are

not

efficient

because

they

may

contain

large

parts

with

no

computational

meaning

The

elimination

of

these

parts

is

an

important

issue

Many

attempts

to

solve

this

problem

have

been

already

done

We

call

this

extracting

procedure

In

this

work

we

present

a

new

way

to

understand

the

extraction

problem

This

is

the

marking

technique

This

new

point

of

view

enables

us

thanks

to

a

high

abstraction

level

to

unify

what

was

previously

done

on

the

subject

It

enables

also

to

extend

to

higher

-LCB-

order

languages

some

pruning

techniques

developed

by

Berardi

and

Boerio

which

were

only

used

in

first

and

second

order

language

R?esum?e

La

logique

constructive

peut

etre

utilis?ee

pour

produire

des

programmes

en

les

consid?erant

comme

des

formules

de

la

logique

L'avantage

d'une

telle

m?ethodologie

est

de

produire

des

programmes

dont

on

est

s

ur

qu'ils

v?erifient

certaines

sp?ecifications

Les

programmes

g?en?er?es

par

ces

m?ethodes

sont

en

g?en?eral

peu

efficaces

car

ils

comportent

de

larges

parts

qui

ne

servent

pas

au

calcul

final

Pour

les

rep?erer

et

les

effacer

de

nombreuses

techniques

ont

d?ej?a

et?e

d?evelopp?ees

On

parle

de

technique

d'extraction

Dans

ce

travail

nous

donnons

une

nouvelle

mani?ere

d'approcher

ce

probl?eme

Il

s

agit

du

marquage

Ce

nouvel

angle

de

vision

permet

gr

ace

a

un

niveau

d'abstraction

elev?e

d'unifier

les

connaissances

relatives

a

l'extraction

Il

permet

aussi

l'extension

aux

ordres

sup?erieurs

des

techniques

de

taillage

exploit?ees

par

Berardi

et

Boerio

qui

n

etaient

valables

qu'aux

premier

et

au

second

ordre

Mots-cl

es

V?erification

de

Programmes

Th?eorie

des

types

Logique

Preuves

de

programmes

Extraction

Marquage

Marking

techniques

for

extraction

Fr?ed?eric

Prost

December

Abstract

Constructive

logic

can

be

used

to

consider

program

specifications

as

logical

formulas

The

advantage

of

this

approach

is

to

generate

programs

which

are

certified

with

respect

to

some

given

specifications

The

programs

created

in

such

a

way

are

not

efficient

because

they

may

contain

large

parts

with

no

computational

meaning

The

elimination

of

these

parts

is

an

important

issue

Many

attempts

to

solve

this

problem

have

been

already

done

We

will

talk

about

extracting

procedure

In

this

work

we

present

a

new

way

to

understand

the

extraction

problem

It

is

the

marking

technique

This

new

point

of

view

enable

us

thanks

to

a

high

abstraction

level

to

unify

what

was

previously

done

on

the

subject

It

allows

also

to

extend

some

pruning

techniques

developed

by

Berardi

and

Boerio

which

were

only

used

in

first

and

second

order

language

to

higher

-LCB-

order

languages

Keywords

Logic

Programs

proof

Extraction

marking

Contents

Introduction

Miscellaneous

approaches

of

extraction

The

Turin

school

The

Pruning

The

Berardi

approach

for

the

first

order

Boerio

's

extension

for

the

second

order

Using

subtyping

for

pruning

-LSB-

-RSB-

Some

comments

on

Turin

school

C.

Paulin

's

approach

-LSB-

-RSB-

The

Calculus

of

Constructions

Extraction

in

the

Calculus

of

Constructions

Discussion

A

new

approach

of

extraction

by

marking

Motivations

and

brief

description

Application

to

a

second

order

system

Order

introduced

on

terms

by

marking

Flexibility

of

Marking

in

a

higher

order

language

Fm

Presentation

of

F

system

Informal

semantics

of

marking

in

this

system

The

Fm

language

Marking

in

the

Calculus

of

Constructions

Conclusion

and

future

works

Introduction

Methods

of

development

of

programs

from

the

proof

of

their

specifications

are

based

on

the

Curry

-LCB-

Howard

isomorphism

For

several

years

now

systems

using

this

approach

have

been

developed

Nuprl

-LSB-

-RSB-

Coq

-LSB-

-RSB-

and

PX

are

the

most

famous

examples

A

proof

showing

that

for

every

object

x

of

type

A

there

exists

y

of

type

B

that

satisfies

a

relation

R

-LRB-

x

y

-RRB-

defines

implicitly

a

computable

function

from

A

to

B

A

constructive

demonstration

of

a

proposition

of

this

kind

enables

actually

to

build

the

function

In

other

words

we

can

construct

a

program

from

a

proof

of

its

specifications

This

approach

of

programming

is

interesting

for

it

leads

to

error

-LCB-

free

programs

from

its

nature

Nevertheless

nothing

is

free

of

charge

and

the

cost

of

the

certainty

is

time

Programs

generated

in

this

way

are

inefficient

The

codes

recovered

contain

too

much

useless

terms

from

the

algorithmic

point

of

view

Indeed

a

program

just

contains

what

is

worthy

to

realize

an

algorithm

On

the

contrary

a

proof

formalizes

a

great

deal

of

information

which

is

not

needed

to

compute

the

final

result

For

example

the

description

of

the

task

to

carry

out

verifications

of

the

method

the

control

of

dependency

between

objects

are

contained

in

the

proof

but

are

not

needed

for

the

computation

of

the

result

It

seems

a

good

idea

to

delete

those

inefficient

parts

from

the

code

to

get

a

good

program

We

will

use

the

word

of

extraction

to

characterize

this

work

Several

extraction

techniques

have

been

studied

One

can

approximately

divide

those

ones

into

two

ways

The

first

point

of

view

is

to

realize

the

searched

optimization

within

the

syntax

of

the

terms

C.

Paulin

in

-LSB-

-RSB-

develops

this

approach

for

a

higher

order

system

the

Calculus

of

Construction

The

basic

idea

is

to

duplicate

the

system

One

part

is

used

for

the

logical

annotations

without

computational

meaning

and

the

second

is

used

to

express

the

parts

of

the

program

useful

for

the

computation

This

technique

works

while

the

program

developer

is

making

his

proof

One

can

easily

find

out

what

parts

are

inefficient

these

are

the

ones

which

are

typed

in

a

certain

predefined

way

The

last

step

is

to

erase

them

in

order

to

get

an

efficient

program

The

second

approach

consists

in

looking

at

the

proof

tree

and

by

an

appropriate

study

to

locate

subtrees

without

computational

meaning

This

point

of

view

has

been

initiated

by

Goad

in

-LSB-

-RSB-

and

enriched

by

Takayama

in

-LSB-

-RSB-

The

last

developments

of

this

approach

have

been

done

by

Berardi

and

Boerio

in

-LSB-

-RSB-

and

-LSB-

-RSB-

The

basic

idea

is

that

the

proof

contains

a

lot

of

information

regarding

the

corresponding

program

These

techniques

propose

to

use

these

informations

in

order

to

simplify

the

program

obtained.When

the

proof

is

done

we

seek

what

parts

of

the

tree

are

useless

and

prune

them

-LRB-

we

talk

about

Pruning

techniques

-RRB-

These

methods

have

only

been

studied

in

languages

of

order

less

than

or

equal

to

two

In

-LSB-

-RSB-

Berardi

and

Boerio

extend

the

technique

to

take

in

account

more

simplifications

by

a

mechanism

of

subtyping

By

weakening

some

typing

rules

relatively

to

the

application

they

manage

to

avoid

the

formation

of

ill

typed

terms

while

the

simplification

is

performed

We

propose

to

develop

a

new

approach

of

extraction

by

the

means

of

marks

The

idea

is

simple

We

are

going

to

annotate

the

terms

to

express

their

computational

meaning

So

we

are

going

to

introduce

in

the

typing

rules

some

constraints

regarding

the

marking

of

terms

The

aim

is

to

formalize

within

the

logic

what

was

already

done

technically

by

Berardi

-LCB-

Boerio

's

pruning

The

first

goal

is

to

unify

thanks

to

this

new

formalization

the

different

extracting

methods

already

known

Indeed

we

will

prove

that

marking

technique

is

able

to

simulate

all

of

them

This

new

level

of

abstraction

permits

to

extend

to

higher

order

language

some

result

already

obtained

in

first

and

second

order

by

Berardi

and

Boerio

The

paper

is

organized

as

follows

We

first

give

a

brief

presentation

of

the

most

widely

known

extracting

techniques

the

ones

coming

from

the

pruning

first

developed

in

the

first

order

by

Berardi

and

then

extended

by

Boerio

to

the

second

order

We

will

see

next

the

techniques

proposed

by

C.

Paulin

for

the

Calculus

of

Constructions

Finally

we

will

give

a

new

way

to

approach

both

techniques

by

our

marking

techniques

and

we

will

extend

the

previous

results

on

pruning

to

higher

order

thanks

to

marking

techniques

Miscellaneous

approaches

of

extraction

The

Turin

school

The

Pruning

All

the

techniques

developed

by

this

school

are

based

on

a

similar

way

to

optimize

terms

the

pruning

The

pruning

is

defined

as

a

relation

between

two

trees

One

says

that

a

tree

A

is

a

pruning

of

another

tree

B

if

we

can

obtain

A

by

erasing

some

subtrees

of

B.

Of

course

one

can

see

any

terms

of

a

given

formal

language

as

a

labeled

tree

One

naturally

derives

a

notion

of

pruning

with

respect

to

terms

of

a

formal

language

If

this

term

is

produced

from

a

functional

system

-LRB-

typed

or

not

-RRB-

the

pruning

can

be

seen

as

an

optimization

Indeed

to

prune

a

term

corresponds

to

delete

some

code

judged

useless

As

the

pruning

suppresses

some

subterms

one

can

expect

that

a

term

a

which

is

a

pruned

version

of

a

term

b

can

be

evaluated

in

a

easier

way

The

Turin

school

has

studied

the

behavior

of

terms

in

some

typed

systems

regarding

the

pruning

First

Berardi

gives

results

for

a

typed

system

to

the

first

order

results

that

Boerio

then

extends

to

the

second

order

In

both

cases

the

idea

is

to

suppress

the

maximum

of

subterms

while

staying

invariant

relatively

to

some

observational

equivalence

Schematically

their

paradigm

is

since

I

do

not

modify

the

input-output

function

of

a

term

I

can

suppress

a

subterm

The

Berardi

approach

for

the

first

order

In

-LSB-

-RSB-

Berardi

studies

the

effects

of

pruning

on

terms

of

a

variant

of

the

G?odel

system

T

He

shows

that

if

two

terms

have

the

same

type

and

if

one

is

a

pruned

version

of

the

other

then

they

have

the

same

input

-LCB-

output

function

Moreover

for

all

terms

the

existence

of

a

minimal

term

-LRB-

with

respect

to

the

notion

of

pruning

-RRB-

is

proved

The

modified

G?odel

system

T

Informally

this

system

is

a

simply

typed

-LCB-

calculus

having

an

atomic

type

N

for

integers

and

the

schema

of

primitive

recursion

on

N

It

contains

the

arrow

types

product

types

projections

applications

and

abstractions

-LRB-

we

will

use

the

notation

of

the

Calculus

of

Construction

for

-LCB-

abstractions

We

will

write

-LSB-

x

N

-RSB-

x

instead

of

xN

x

-RRB-

There

are

also

algebraic

constants

and

S

of

respective

types

N

and

N

N

and

the

constant

of

higher

order

for

the

primitive

recursion

recA

of

type

N

A

-LRB-

N

A

A

-RRB-

A

for

every

type

A

As

the

goal

is

to

prune

terms

we

introduce

a

type

U

and

a

constant

denoting

the

hole

which

stays

after

we

have

removed

the

useless

subterm

is

be

the

only

inhabitant

of

type

U

In

a

more

formal

way

this

system

is

defined

by

If

is

U

or

N

-LRB-

so

an

atomic

type

-RRB-

then

the

types

are

defined

by

A

j

A

A

j

A

A

The

set

of

constants

is

represented

by

an

initial

context

T

def

U

N

S

N

N

recA

N

A

-LRB-

N

A

A

-RRB-

A

If

A

is

a

type

x

a

variable

of

type

A

and

c

a

constant

of

T

the

pseudo-terms

are

defined

by

t

c

j

x

j

-LSB-

x

A

-RSB-

t

j

-LRB-

t

t

-RRB-

j

t

t

j

-LRB-

ssi

t

-RRB-

Let

t

f

be

pseudo-terms

A

B

types

c

A

x

A

c

A

x

A

x

A

t

B

f

A

B

a

A

-LSB-

x

A

-RSB-

t

A

B

-LRB-

f

a

-RRB-

B

t

-LRB-

ssi

t

-RRB-

Ai

The

reductions

are

the

following

is

the

usual

-LCB-

reduction

the

standard

conversion

ss

corresponds

to

a

projection

and

with

recs

are

the

reductions

associated

to

the

usual

rules

of

recurrence

We

will

write

for

-LSB-

-LSB-

recs

-LSB-

The

notations

n

will

have

the

usual

meaning

with

respect

to

R

denotes

the

symmetric

and

transitive

closure

of

The

pruning

Lets

A

B

be

two

types

s

a

constant

or

a

variable

x

a

variable

t

u

two

terms

We

define

by

induction

e

where

e

and

are

two

well

formed

expressions

-LRB-

i.e.

that

we

can

type

-RRB-

of

the

system

is

read

e

is

a

pruning

of

-LRB-

;-RRB-

t

for

any

term

t

-LRB-

U

-RRB-

U

A

for

any

type

A

-LRB-

atom

-RRB-

for

any

atom

ff

-LRB-

-RRB-

A

B

if

A

and

B

-LRB-

-RRB-

A

B

if

A

and

B

-LRB-

symb

-RRB-

sA

if

A

-LRB-

-LSB-

-RSB-

-RRB-

-LSB-

x

A

-RSB-

t

-LSB-

-RSB-

if

A

and

if

t

-LSB-

x

z

-RSB-

-LSB-

z

-RSB-

with

z

a

fresh

variable

-LRB-

app

-RRB-

-LRB-

t

u

-RRB-

-LRB-

-RRB-

if

t

and

u

-LRB-<>-RRB-

t

u

if

t

and

u

-LRB-

ssi

-RRB-

-LRB-

ssi

t

-RRB-

-LRB-

ssi

-RRB-

if

t

We

extend

naturally

this

notion

to

contexts

Let

and

be

two

contexts

we

say

that

iff

-LRB-

x

A

-RRB-

-RRB-

-LRB-

A

-RRB-

-LRB-

x

B

-RRB-

Definition

of

observational

equivalence

We

define

the

observational

equality

in

the

following

manner

If

A

is

a

variable

of

type

A

then

a

context

with

a

hole

A

is

a

closed

term

C

-LSB-

A

-RSB-

where

Aoccurs

exactly

once

C

-LSB-

t

-RSB-

is

the

expression

C

-LSB-

A

-RSB-

where

A

has

been

replaced

by

t

Now

if

t

and

u

are

two

terms

having

the

same

type

A

in

some

common

context

we

define

-LRB-

t

obs

u

-RRB-

-LRB-

-RRB-

-LSB-

A

-RSB-

N

binding

every

all

variables

in

t

u

C

-LSB-

t

-RSB-

R

C

-LSB-

u

-RSB-

In

fact

one

has

to

consider

C

-LSB-

A

-RSB-

as

an

observation

or

an

experience

on

the

behavior

of

t

and

u

If

no

experience

allows

to

find

any

difference

then

t

and

u

are

said

observationally

equivalent

Interactions

between

pruning

and

observational

equivalence

Theorem

-LRB-

Berardi

-RRB-

Let

t

and

u

be

two

terms

of

same

type

A

with

a

common

context

Then

t

u

-RRB-

t

obs

u

The

proof

proceeds

in

the

following

way

One

begins

to

check

the

validity

of

this

theorem

for

a

normal

-LRB-

i.e.

there

are

no

more

possible

derivation

from

this

term

-RRB-

and

closed

term

It

is

a

crucial

step

because

the

system

T

has

the

following

property

Property

The

system

T

is

Church

-LCB-

Rosser

and

strongly

normalizing

So

it

is

possible

to

associate

by

some

reduction

path

to

each

term

a

term

which

is

closed

and

normal

It

is

easy

to

see

thanks

to

the

simplicity

of

the

system

that

the

theorem

is

valid

for

a

closed

and

normal

term

More

exactly

it

has

been

showed

that

Lemma

If

t

u

and

if

u

is

closed

and

normal

and

has

an

atomic

type

then

either

t

or

t

u

After

Berardi

verifies

some

lemmas

about

commutativity

between

and

substitution

and

reductions

More

precisely

Berardi

demonstrates

Lemma

If

t

and

n

then

one

can

find

u

such

that

t

n

u

Now

the

demonstration

of

the

theorem

is

easy

Proof

Let

's

take

t

u

closed

of

type

A

N

such

that

t

u

If

e

is

the

normal

form

of

u

then

there

is

a

n

such

that

u

n

e

by

the

preceding

lemma

one

can

derive

the

existence

of

d

such

that

t

n

d

with

d

closed

and

normal

and

d

e.

From

the

first

lemma

we

can

deduce

that

d

e

-LRB-

otherwise

d

which

is

a

trivial

case

-RRB-

and

so

we

have

t

R

u

It

concludes

the

proof

in

this

case

because

it

trivially

implies

that

t

obs

u

Now

suppose

that

t

u

are

of

some

type

A

such

that

t

u.

Let

C

-LSB-

A

-RSB-

N

be

a

suitable

context

-LRB-

closing

the

terms

etc.

-RRB-

As

is

compatible

with

term

formation

it

is

clear

that

C

-LSB-

t

-RSB-

C

-LSB-

u

-RSB-

Then

one

just

have

to

apply

the

preceding

reasoning

and

get

C

-LSB-

t

-RSB-

obs

C

-LSB-

u

-RSB-

Hence

the

final

result

is

reached

Properties

of

Berardi

has

also

showed

some

properties

on

the

structure

generated

by

The

first

is

quite

straightforward

Property

is

an

order

relation

on

well

formed

terms

He

then

defines

two

important

structures

Definition

For

any

term

t

such

that

t

T

LE

-LRB-

t

-RRB-

tg

CLE

-LRB-

t

-RRB-

t

T

and

g

He

shows

the

following

proposition

Property

Let

t

be

a

term

LE

-LRB-

t

-RRB-

is

a

finite

complete

lattice

with

respect

to

CLE

-LRB-

t

-RRB-

is

a

sublattice

of

LE

-LRB-

t

-RRB-

One

can

deduce

from

this

property

and

Theorem

that

for

each

term

u

there

exists

an

optimal

version

-LRB-

with

respect

to

<=-RRB-

of

this

term

namely

the

greatest

lower

bound

of

CLE

-LRB-

u

-RRB-

To

see

what

kind

of

optimizations

are

allowed

by

pruning

we

are

going

to

develop

an

example

Example

-LRB-

C.

Paulin

-RRB-

Let

us

consider

a

program

which

takes

an

integer

n

in

input

having

two

parameters

x

y

of

integer

type

and

two

auxiliary

functions

f

g

of

respective

types

N

N

and

N

N

N

and

which

returns

an

integer

Let

a

b

be

the

initial

values

of

x

y

The

program

replaces

x

by

-LRB-

f

x

-RRB-

n

times

and

y

by

-LRB-

g

x

y

-RRB-

the

output

being

x.

To

encode

this

program

in

the

system

T

we

proceed

that

way

we

represent

the

pair

x

y

by

a

single

variable

w

of

type

N

N

then

we

define

u

-LSB-

n

N

-RSB-

-LRB-

-LRB-

rec

n

a

b

h

-RRB-

-RRB-

where

h

-LSB-

m

N

-RSB-

-LSB-

w

N

N

-RSB-

-LRB-

f

-LRB-

w

-RRB-

-RRB-

-LRB-

g

-LRB-

w

-RRB-

-LRB-

w

-RRB-

-RRB-

Then

an

optimized

version

t

u

which

does

not

contain

the

function

g

having

the

same

type

-LRB-

N

N

-RRB-

is

t

-LSB-

n

N

-RSB-

-LRB-

-LRB-

rec

n

a

-RRB-

-RRB-

where

is

-LSB-

m

N

-RSB-

-LSB-

w

N

U

-RSB-

-LRB-

f

-LRB-

w

-RRB-

-RRB-

If

we

erase

every

occurrences

of

which

is

the

term

which

denotes

the

empty

we

find

the

simpler

expression

t

-LSB-

n

N

-RSB-

-LRB-

rec

n

a

-LRB-

-LSB-

m

N

-RSB-

-LSB-

w

N

-RSB-

-LRB-

f

w

-RRB-

-RRB-

-RRB-

Discussion

Berardi

has

proposed

a

dynamic

completely

automatic

technique

to

optimize

terms

by

deleting

redundant

parts

of

it

To

realize

it

he

only

uses

the

information

carried

by

the

type

of

the

term

Everything

which

does

not

contribute

to

the

type

of

the

term

is

eliminated

that

is

to

say

replaced

by

What

is

done

from

a

logical

point

of

view

is

nothing

but

marking

inside

a

proof

tree

that

we

have

been

able

to

prove

something

but

that

the

proof

of

this

thing

is

useless

We

then

transform

the

tree

in

an

another

one

into

an

another

system

where

all

useless

terms

have

been

deleted

As

this

system

is

applied

to

the

first

order

Berardi

can

mix

the

two

steps

marking

the

tree

and

then

transformating

it

regarding

this

marking

without

trouble

At

every

moment

only

well

formed

terms

are

manipulated

Under

this

shape

this

method

is

hardly

extensible

By

studying

the

system

Boerio

had

to

switch

the

way

to

see

things

Boerio

's

extension

for

the

second

order

The

extension

of

the

preceding

results

in

-LSB-

-RSB-

can

be

situated

in

the

straight

line

of

Berardi

's

work

It

is

based

on

deleting

subtrees

judged

useless

regarding

some

criterions

-LRB-

here

observational

equality

-RRB-

But

if

the

starting

point

of

the

problem

is

the

same

it

is

not

the

case

for

the

approach

of

how

to

solve

it

This

approach

represents

a

real

contribution

by

introducing

the

notion

of

marking

The

Pruning

in

Boerio

considers

the

system

If

the

G?odel

's

system

T

allows

to

describe

the

arithmetic

of

the

first

order

is

a

propositional

calculus

of

the

second

order

More

precisely

is

a

stable

extension

of

T

which

means

that

every

true

statement

of

t

is

also

a

true

statement

in

Moreover

these

judgments

have

been

added

the

following

elements

Product

types

If

X

is

a

variable

of

type

and

T

a

type

then

-LRB-

X

-RRB-

T

is

a

type

-LRB-

one

can

note

that

instead

of

T

we

will

write

-LRB-

X

-RRB-

T

as

in

the

Calculus

of

Constructions

-RRB-

The

primitive

types

are

the

same

as

those

in

T

integers

denoted

by

N

and

U

the

type

denoting

the

hole

Abstraction

on

types

variables

If

X

is

a

type

variable

and

t

a

term

than

-LSB-

X

-RSB-

t

is

also

a

term

The

applications

for

types

If

t

is

a

term

than

-LRB-

t

T

-RRB-

is

also

a

term

The

new

typing

rules

in

this

system

are

the

following

ones

c

A

x

A

c

A

x

A

x

A

t

B

f

A

B

a

A

-LSB-

x

A

-RSB-

t

A

B

-LRB-

f

a

-RRB-

B

t

-LRB-

ssi

t

-RRB-

Ai

t

T

t

-LRB-

X

-RRB-

T

-LSB-

X

-RSB-

t

-LRB-

X

-RRB-

T

-LRB-

t

A

-RRB-

T

-LSB-

X

A

-RSB-

Where

is

an

environment

containing

all

the

constants

defined

in

the

system

T

The

differences

between

the

two

systems

can

be

summed

up

to

the

two

last

rules

added

abstraction

of

types

on

terms

and

application

of

types

to

terms

We

also

add

a

reduction

relatively

to

terms

which

are

applied

to

types

-LRB-

-LSB-

X

-RSB-

t

T

-RRB-

t

-LSB-

X

T

-RSB-

Boerio

shows

in

a

way

close

to

Berardi

that

this

system

also

verifies

the

properties

of

the

T

system

for

the

pruning

If

an

order

relation

is

introduced

with

respect

to

the

pruning

as

in

the

T

system

then

there

is

an

analogous

of

Berardi

's

theorem

if

t

u

and

both

t

u

have

the

same

type

then

t

u

where

is

an

observational

equality

defined

as

above

in

the

T

system

One

can

also

define

in

the

lattices

LE

-LRB-

t

-RRB-

CLE

-LRB-

t

-RRB-

as

above

Now

the

goal

is

to

find

explicitly

the

greatest

lower

bound

of

CLE

-LRB-

t

-RRB-

for

a

given

u

to

get

the

optimal

version

of

u

The

pruning

algorithm

In

a

simply

typed

system

it

is

not

difficult

to

delete

subterms

while

keeping

a

well

formed

term

as

the

terms

only

depend

on

terms

With

the

second

order

that

is

another

story

terms

can

depend

on

types

-LRB-

think

to

-LCB-

abstraction

on

types

-RRB-

In

particular

a

simple

algorithm

like

a

data

-LCB-

flow

analysis

recursive

one

was

enough

in

a

system

of

first

order

Here

it

is

no

longer

the

case

Instead

of

giving

in

extenso

Boerio

's

algorithm

we

will

give

general

ideas

to

understand

how

it

works

We

provide

an

example

at

the

end

of

this

section

More

precision

can

be

found

in

Boerio

's

paper

-LSB-

-RSB-

The

ground

idea

is

to

work

on

the

proof

tree

of

the

term

and

to

transform

it

into

a

new

optimized

one

Before

going

any

further

we

introduce

some

important

notions

for

the

understanding

of

the

algorithm

In

Boerio

's

interpretation

a

mark

is

a

label

given

to

an

atomic

type

a

constant

or

a

variable

One

distinguishes

two

marks

r

and

c

The

first

means

that

the

labeled

item

is

useless

and

the

second

that

it

may

be

useful

for

the

computation

After

a

correct

marking

of

the

tree

it

will

be

possible

to

replace

parts

marked

with

r

by

for

terms

and

U

for

types

The

simplified

tree

is

a

syntactical

tree

in

which

every

node

marked

with

r

is

replaced

by

or

U

Simplify

-LRB-

M

t

-RRB-

will

denote

such

a

tree

for

a

marking

M

given

on

a

term

t.

To

be

more

precise

we

give

the

following

definitions

Definition

If

t

is

a

term

such

that

t

T

then

app

c

b

r

app

r

c

APP

-LRB-

r

c

-RRB-

-LRB-

r

c

-RRB-

r

c

y

r

c

X

-LRB-

X

-RRB-

Xc

Xc

a

c

x

Xc

Xc

x

Xc

f

a

c

b

c

g

aaaaaaaaaa

QQQQQQ

QQQQQQ

Figure

FDV

-LRB-

t

-RRB-

with

an

example

of

marking

The

fully

decorated

tree

of

t

FD

-LRB-

t

-RRB-

is

the

syntax

tree

of

t

in

which

each

node

that

identifies

a

subterm

is

decorated

by

the

type

of

the

subterm

itself

The

fully

decorated

version

of

t

T

FDV

-LRB-

t

T

-RRB-

is

the

ordered

pair

FD

-LRB-

t

-RRB-

formed

by

the

context

and

FD

-LRB-

t

-RRB-

Let

Lab

be

the

set

formed

by

two

labels

r

and

c

A

marking

M

of

FDV

-LRB-

t

T

-RRB-

is

a

map

from

the

occurrences

of

atoms

of

the

types

which

decorates

the

nodes

and

those

of

atoms

in

the

types

of

the

variable

of

the

context

to

Lab

When

we

talk

of

the

marking

M

of

t

we

talk

about

the

restriction

of

the

map

to

FD

-LRB-

t

-RRB-

Example

-LRB-

Boerio

-RRB-

Let

t

be

the

following

term

t

-LRB-

-LRB-

-LRB-

-LSB-

X

P

rop

-RSB-

-LSB-

x

X

-RSB-

x

-LRB-

-RRB-

-RRB-

-LRB-

-LSB-

y

-RSB-

a

-RRB-

-RRB-

b

-RRB-

With

an

atom

a

and

b

two

variables

of

type

In

the

rest

of

this

section

we

will

call

the

marking

represented

on

Figure

by

Definition

We

call

the

simplified

tree

the

syntactic

tree

in

which

every

node

labeled

with

r

is

replaced

by

or

U

we

will

note

Simplify

-LRB-

M

t

-RRB-

such

a

tree

for

a

marking

M

given

on

a

term

t

The

algorithm

builds

an

optimum

marking

with

regards

to

some

criterions

Not

every

marking

makes

sense

regarding

the

pruning

Let

us

first

give

some

new

definitions

Definition

A

marking

M

is

canonical

if

for

each

node

V

of

FDT

-LRB-

t

-RRB-

no

atom

in

the

types

associated

to

descendent

nodes

of

V

is

marked

with

a

c

when

the

type

associated

to

V

has

all

of

its

atom

labeled

with

r.

A

marking

M

of

FDV

-LRB-

t

T

-RRB-

is

consistent

iff

the

simplified

tree

generated

is

the

syntactic

tree

of

a

well

formed

term

in

some

inferior

-LRB-

with

respect

to

pruning

relation

-RRB-

context

to

A

marking

M

is

saturated

if

it

is

both

consistent

and

canonical

Let

M

and

M

be

two

markings

of

FDV

-LRB-

t

T

-RRB-

One

will

state

that

M

M

if

for

all

c

assigned

in

M

it

is

also

assigned

in

M

In

our

example

is

saturated

If

we

apply

the

simplification

map

we

get

Simplify

-LRB-

t

-RRB-

-LRB-

-LRB-

-LRB-

-LSB-

X

P

rop

-RSB-

-LSB-

x

X

-RSB-

x

-LRB-

U

-RRB-

-RRB-

-LRB-

-LSB-

y

U

-RSB-

a

-RRB-

-RRB-

;-RRB-

It

is

possible

to

show

that

each

of

the

orders

corresponds

to

the

other

In

other

words

M

M

is

equivalent

to

Simplify

-LRB-

M

t

-RRB-

Simplify

-LRB-

M

t

-RRB-

As

we

are

not

looking

for

the

minimal

marking

which

is

obviously

the

one

that

assigns

r

to

every

node

and

hence

produces

as

the

simplified

version

but

a

marking

which

respects

the

observational

equality

one

has

to

preserve

the

final

type

of

the

term

This

observation

leads

to

the

definition

of

an

initial

marking

which

expresses

what

we

know

a

priori

The

definition

of

the

initial

marking

is

the

following

one

given

a

FDV

-LRB-

t

T

-RRB-

is

the

marking

which

associates

c

to

every

atom

of

the

type

associated

to

the

root

and

the

atoms

in

the

type

of

the

variables

inside

the

context

and

which

sets

all

the

other

atoms

to

r

The

initial

marking

of

a

term

is

canonical

but

not

consistent

The

only

remaining

task

to

find

the

right

marking

is

to

transform

this

initial

marking

to

a

consistent

one

M

superior

to

it

In

order

to

do

that

Boerio

develops

an

algorithm

named

saturation

algorithm

which

is

based

on

the

installation

of

links

between

the

atoms

of

the

fully

decorated

version

of

the

term

The

idea

of

the

saturation

procedure

is

to

build

edges

between

the

different

atoms

of

the

tree

to

enable

the

c

information

to

flow

along

those

paths

from

the

root

to

the

totality

of

the

tree

with

respect

to

some

conditions

One

can

sum

up

those

conditions

by

the

formula

If

I

have

some

contribution

to

the

final

type

I

am

marked

with

c

if

not

I

will

keep

my

r

mark

Discussion

Boerio

's

work

is

important

for

our

approach

because

it

has

showed

the

existence

of

a

correspondence

between

the

pruning

and

the

marking

But

Boerio

only

uses

this

correspondence

for

technical

reasons

It

is

just

mentioned

in

order

to

realize

an

algorithm

Actually

the

notion

of

link

introduced

is

very

interesting

Indeed

it

shows

how

the

marking

can

be

gradually

built

But

here

too

one

can

not

find

explanations

of

this

notion

he

only

uses

it

in

a

casual

way

to

build

an

optimal

marking

By

a

deeper

abstraction

of

those

two

notions

one

could

understand

the

semantique

of

the

pruning

It

would

permit

to

see

why

links

are

defined

this

way

and

why

other

options

do

not

fit

the

problem

Using

subtyping

for

pruning

-LSB-

-RSB-

In

their

precedent

works

Berardi

and

Boerio

have

developed

pruning

techniques

One

of

the

weaknesses

of

these

ones

leads

to

the

fact

that

some

optimizations

are

not

done

because

they

could

lead

to

ill

typed

function

applications

To

overcome

those

difficulties

they

have

developed

a

theory

in

which

they

introduce

the

notion

of

subtype

Now

a

function

application

will

be

well

typed

if

the

type

of

the

argument

is

not

only

equal

but

also

included

in

the

input

type

of

the

corresponding

function

This

way

more

optimizations

will

be

done

the

extension

is

conservative

Brief

presentation

This

theory

have

been

developed

on

a

first

order

language

which

is

an

extension

of

the

T

language

used

by

Berardi

We

will

note

T

the

extension

of

T

obtained

by

adding

a

special

atomic

Type

Definition

The

Types

of

T

are

defined

inductively

from

the

atomic

types

N

and

using

the

and

operator

Let

A

B

and

C

be

types

The

relation

of

inclusion

on

types

of

T

is

defined

by

the

following

rules

N

N

N

The

notion

of

-LCB-

type

is

also

defined

A

type

T

will

be

said

an

-LCB-

type

if

it

can

be

produced

by

the

following

grammar

O

jA

OjO

O

where

A

is

any

type

The

preterms

are

the

same

ones

as

in

the

T

system

The

set

of

constants

is

extended

by

a

set

of

constants

dO

for

each

-LCB-

type

O

They

denote

a

canonical

element

for

a

given

-LCB-

type

The

new

typing

rules

are

the

following

c

A

x

A

c

A

x

A

x

A

t

B

f

A

B

a

A

-LSB-

x

A

-RSB-

t

A

B

-LRB-

f

a

-RRB-

B

t

-LRB-

ssi

t

-RRB-

Ai

The

definitions

of

observational

equality

and

context

with

hole

are

the

same

as

in

the

T

system

Moreover

this

system

also

verifies

the

same

properties

as

the

T

system

it

is

Church

-LCB-

Rosser

and

strongly

normalizing

Semantics

of

the

new

system

Let

us

discuss

about

the

role

of

and

of

the

inclusion

A

One

can

consider

that

N

is

the

set

of

integers

with

standard

equality

whereas

is

the

type

of

integers

which

are

equivalent

to

each

other

It

represents

the

useless

integers

Indeed

if

a

term

is

of

type

one

knows

that

it

is

a

number

but

nothing

more

The

type

carries

just

this

information

whereas

N

brings

more

informations

allowing

to

positively

identify

the

number

From

the

last

point

of

view

the

membership

of

is

weaker

than

the

one

of

N

hence

the

preceding

inclusion

One

can

now

see

clearly

what

means

to

simplify

a

term

in

this

system

A

set

of

subtypes

and

subterms

in

a

given

term

can

be

useless

for

the

final

computation

and

then

replaced

with

-LRB-

useless

type

-RRB-

and

the

subterm

with

dO

-LRB-

useless

subterm

-RRB-

while

keeping

the

well

formation

of

the

term

Results

obtained

The

authors

develop

an

order

relation

on

the

words

of

T

in

a

similar

way

as

the

one

defined

in

T

The

only

difference

comes

from

the

following

rule

O

U

dO

u

for

u

of

any

type

U

As

in

the

precedent

systems

they

show

that

if

a

term

is

inferior

to

another

with

the

same

type

is

observationally

equivalent

to

the

previous

one

Moreover

the

structure

generated

by

this

relation

is

a

complete

lattice

and

the

subsets

formed

by

terms

of

a

common

type

are

sublattices

So

we

have

the

same

results

for

this

system

as

for

the

two

previous

ones

regarding

the

pruning

Example

-LRB-

Boerio-Berardi

-RRB-

Now

we

are

going

to

give

an

example

which

shows

that

this

new

method

is

more

powerful

than

the

previous

ones

Let

suppose

the

following

extension

of

the

constant

set

it

is

added

the

constant

set

itA

fN

A

-LRB-

A

A

-RRB-

AjAanytypeg

to

the

original

constant

set

These

constants

implement

iterations

on

natural

numbers

We

also

introduce

new

reduction

rules

which

are

-LRB-

itA

a

f

-RRB-

it

a

and

-LRB-

ita

-LRB-

succ

n

-RRB-

a

f

-RRB-

it

-LRB-

f

-LRB-

itA

n

a

f

-RRB-

-RRB-

where

a

is

of

type

A

and

f

of

type

A

A.

Consider

the

expression

t

-LSB-

n

N

-RSB-

-LSB-

v

N

N

-RSB-

-LRB-

itN?N

n

v

F

-RRB-

with

F

-LSB-

w

N

N

-RSB-

-LRB-

f

-LRB-

w

-RRB-

-RRB-

-LRB-

g

-LRB-

w

-RRB-

-RRB-

where

f

and

g

are

free

variables

of

type

N

N

t

is

of

Type

N

N

N

N

With

the

previous

versions

of

the

pruning

one

can

not

simplify

t

Now

using

the

subtyping

we

get

the

simplified

term

-LSB-

n

N

-RSB-

-LSB-

v

N

-RSB-

-LRB-

-LRB-

itN

n

v

F

-RRB-

-RRB-

with

F

-LSB-

w

N

-RSB-

-LRB-

f

-LRB-

w

-RRB-

-RRB-

-LRB-

g

d

-RRB-

Some

comments

on

Turin

school

The

pruning

presents

without

any

doubt

many

advantages

The

first

is

that

it

is

an

optimal

technique

regarding

this

kind

of

optimization

where

it

is

only

seeked

to

erase

useless

parts

of

a

term

The

second

one

is

its

automatic

aspect

the

user

has

nothing

to

do

but

to

watch

the

machine

solving

the

problem

Nevertheless

the

fact

that

those

techniques

are

only

valid

for

first

and

second

order

is

not

satisfactory

One

would

like

to

use

these

techniques

in

a

more

realistic

frame

It

would

be

fine

if

such

optimizations

were

possible

in

systems

like

Coq

or

Nuprl

Another

bad

point

is

clearly

lightened

by

the

evolutions

of

pruning

One

has

certainly

notice

that

to

extend

earlier

results

it

has

been

each

time

necessary

to

build

new

theories

The

lack

of

a

uniform

approach

suggests

to

search

what

are

the

common

points

of

the

different

pruning

techniques

C.

Paulin

's

approach

-LSB-

-RSB-

C.

Paulin

has

developed

another

approach

to

the

extraction

in

a

the

Calculus

of

Constructions

The

Calculus

of

Constructions

For

a

more

complete

presentation

refer

to

-LSB-

-RSB-

Actually

we

will

consider

a

slightly

different

version

compared

to

the

original

model

It

is

called

the

Calculus

of

Constructions

with

Realizations

Syntax

of

the

language

We

will

denote

by

the

smallest

language

containing

the

following

constructions

ffl

Three

constants

P

rop

Set

Type

ffl

An

enumerable

set

of

variables

V

ffl

Applications

-LRB-

M

N

-RRB-

with

M

N

ffl

Products

-LRB-

-LRB-

x

M

-RRB-

N

-RRB-

with

x

V

and

M

N

ffl

Abstractions

-LRB-

-LSB-

x

M

-RSB-

N

-RRB-

with

x

V

and

M

N

An

environment

is

a

list

of

bindings

xn

An

where

xi

is

a

variable

and

Ai

We

note

the

empty

list

by

-LSB-

-RSB-

One

can

emit

two

sort

of

statements

in

this

language

is

valid

where

an

environment

M

N

which

is

read

M

is

well

formed

of

type

N

in

the

environment

If

M

and

N

are

terms

of

Inference

rules

We

will

denote

by

K

one

of

the

three

constants

P

rop

Set

Type

-LSB-

-RSB-

is

valid

M

K

x

does

appear

in

is

valid

x

M

is

valid

is

valid

x

N

appears

in

N

x

N

is

valid

is

valid

P

rop

Type

Set

Type

x

P

M

K

-LRB-

-LRB-

x

P

-RRB-

M

-RRB-

K

x

P

M

N

N

Type

-LRB-

-LSB-

x

P

-RSB-

M

-RRB-

-LRB-

-LRB-

x

P

-RRB-

N

-RRB-

M

-LRB-

-LRB-

x

P

-RRB-

N

-RRB-

R

Q

P

Q

-LRB-

M

R

-RRB-

-LRB-

N

-LSB-

x

R

-RSB-

-RRB-

M

N

P

K

N

P

M

P

In

spite

of

a

uniform

presentation

which

could

let

think

that

there

are

no

distinction

between

terms

on

can

derive

some

classes

of

terms

They

are

identified

with

the

distance

between

them

and

the

constant

Type

More

precisely

we

have

Property

Let

M

be

a

well

formed

term

of

of

type

N

there

are

three

different

cases

N

Type

N

is

well

formed

of

type

Type

N

is

well

formed

of

type

P

rop

or

Set

This

property

leads

to

the

definition

of

levels

in

the

Calculus

of

Constructions

Definition

ffl

If

N

Type

then

M

is

of

level

we

talk

about

propositional

types

ffl

If

N

is

well

formed

of

type

Type

M

is

of

level

it

is

a

propositional

scheme

or

more

simply

a

proposition

if

N

P

rop

ffl

If

N

is

well

formed

of

type

P

rop

or

Set

then

M

is

of

level

and

we

say

that

M

is

a

proof

This

hierarchical

structure

is

important

to

prove

properties

and

give

well

formed

inductive

definitions

Extraction

in

the

Calculus

of

Constructions

To

determine

what

parts

of

proof

's

terms

are

useless

on

a

computational

point

of

view

C.

Paulin

duplicates

the

original

Calculus

of

Constructions

thanks

to

the

two

constants

P

rop

and

Set

The

constant

P

rop

will

be

used

for

the

building

of

logical

propositions

-LRB-

which

will

not

be

used

in

the

final

program

-RRB-

whereas

the

Set

constant

will

denote

terms

that

have

an

algorithmical

content.The

notion

of

having

an

interesting

content

-RRB-

is

introduced

in

the

following

manner

A

term

will

be

said

of

empty

content

if

ffl

This

term

is

P

rop

ffl

If

M

is

a

term

with

an

empty

content

then

-LRB-

x

N

-RRB-

M

is

also

of

empty

content

ffl

If

M

is

a

term

with

an

empty

content

then

-LSB-

x

N

-RSB-

M

is

also

of

empty

content

ffl

If

M

is

a

term

with

an

empty

content

then

-LRB-

M

N

-RRB-

is

also

of

empty

content

A

variable

that

has

a

type

of

empty

content

is

also

of

empty

content

If

a

term

is

not

of

empty

content

it

will

be

called

positive

The

extraction

technique

consist

in

erasing

all

parts

of

the

term

that

have

an

empty

content

Discussion

The

main

drawback

of

this

technique

is

its

lack

of

flexibility

Indeed

when

a

term

is

declared

positive

it

ca

n't

in

no

way

change

its

status

and

becomes

a

term

of

empty

content

This

is

regrettable

because

the

notion

of

algorithmic

content

of

a

term

appears

more

as

a

contextual

notion

than

syntactic

Consider

map

g

which

takes

an

integer

and

returns

this

integer

multiplied

by

In

absolute

terms

this

map

has

an

algorithmic

content

Now

one

can

easily

design

a

program

that

takes

a

map

from

integers

to

integers

as

argument

and

which

gives

back

the

first

projection

of

the

pair

formed

by

n

iterations

of

the

g

map

and

m

of

the

same

map

The

term

representing

this

program

will

have

two

subterms

coding

the

g

map

Nevertheless

from

the

observational

point

of

view

only

the

code

of

the

map

which

computes

the

first

projection

will

have

an

informative

content

That

way

we

have

the

case

of

a

function

which

in

absolute

has

an

algorithmic

content

but

which

can

in

some

particular

case

have

no

longer

interest

because

of

the

context

which

surrounds

it

Consider

again

the

first

example

With

some

slight

modifications

it

appears

that

the

Paulin

's

extraction

technique

one

can

not

obtain

the

results

of

pruning

's

extraction

Just

replace

the

occurrence

of

the

function

f

by

the

function

g

the

second

occurrence

of

g

is

erased

by

the

pruning

whereas

the

first

is

kept

As

it

is

impossible

to

type

g

with

both

P

rop

and

Set

Paulin

's

extraction

ca

n't

erased

it

Another

remark

about

this

method

comes

from

the

fact

that

it

is

the

user

which

determines

the

extraction

procedure

It

is

him

who

chooses

his

variables

being

of

type

Set

or

P

rop

Now

it

would

be

fine

if

the

system

was

able

to

extract

alone

subterms

without

informative

content

The

advantage

of

this

approach

is

that

it

is

valid

for

languages

of

higher

order

with

dependent

types

as

the

Calculus

of

Constructions

A

new

approach

of

extraction

by

marking

Motivations

and

brief

description

As

the

former

approaches

have

been

shown

to

be

not

satisfactory

we

have

to

find

another

approach

to

extend

the

results

obtained

The

idea

of

marking

comes

naturally

we

will

indicate

by

a

new

attribute

whether

the

term

is

useful

for

the

computation

or

not

This

idea

was

already

present

in

Boerio

's

algorithm

-LRB-

see

-LSB-

-RSB-

-RRB-

As

one

can

already

deduce

from

earlier

studies

the

marking

should

verify

some

requirements

It

has

to

be

orthogonal

to

the

typing

mechanism

as

Paulin

's

method

reveals

that

typing

and

informative

content

are

two

different

things

It

has

also

to

allow

to

rely

on

the

contextual

feature

of

the

informativity

of

a

term

Indeed

we

have

seen

that

the

typing

is

too

static

to

express

the

extraction

's

optimization

features

This

last

remark

suggests

the

creation

of

weakening

rules

which

transform

a

term

with

positive

content

into

a

new

one

with

negative

content

Moreover

one

has

to

has

clarify

the

part

of

the

constraints

introduced

to

mark

the

term

by

expressing

them

inside

the

typing

rules

Application

to

a

second

order

system

In

the

rest

of

the

paper

we

will

denote

by

m

the

smallest

language

formed

by

the

following

rules

We

define

the

sets

Label

fr

cg

const

fP

rop

Typeg

Let

V

be

a

set

of

variables

In

the

rest

of

the

paper

the

indexes

i

j

k

l

stand

indistinctly

for

r

or

c

and

we

write

N

i

for

-LRB-

N

i

-RRB-

Moreover

we

define

the

order

relation

r

c

on

the

set

Label

The

language

m

contains

ffl

Const

const

Label

ffl

V

V

Label

ffl

Applications

-LRB-

M

i

N

j

-RRB-

kwith

M

i

N

j

m

ffl

Abstractions

-LRB-

-LSB-

xi

M

j

-RSB-

Nk

-RRB-

l

with

xi

V

and

M

j

Nk

m

ffl

Products

-LRB-

-LRB-

xi

M

j

-RRB-

Nk

-RRB-

l

with

xi

V

and

M

j

Nk

m

We

will

write

x

i

for

xi

Ai

An

environment

is

a

finite

list

of

bindings

xn

in

An

where

xj

is

a

variable

Aj

m

and

ijis

an

element

of

Label

We

next

define

the

well

formation

rules

of

term

in

m

These

rules

allow

us

to

define

a

second

order

language

so

polymorphic

that

is

a

language

in

which

one

can

abstract

over

types

and

We

will

call

this

language

Judgments

are

of

two

different

kinds

If

is

an

environment

we

have

is

valid

and

M

N

where

is

an

environment

M

and

N

are

two

terms

of

m

and

this

is

to

be

read

the

term

M

is

well

formed

of

type

N

in

the

environment

Inference

Rules

We

will

take

the

convention

that

for

every

marking

variable

i

j

k

we

will

have

the

order

relation

i

Moreover

to

have

a

more

readable

paper

we

will

use

the

following

syntactic

sugars

ffl

shall

be

read

as

-LRB-

X

i

P

rop

-RRB-

ffl

Xi

shall

be

read

as

-LSB-

X

i

P

rop

-RSB-

ffl

mark

-LRB-

occ

-LRB-

x

A

-RRB-

-RRB-

will

design

the

set

of

mark

of

the

occurrences

of

the

variable

x

in

A.

sup

-LRB-

mark

-LRB-

occ

-LRB-

x

A

-RRB-

-RRB-

-RRB-

will

be

the

usual

operator

except

when

the

set

mark

-LRB-

occ

-LRB-

x

A

-RRB-

-RRB-

is

empty

In

this

case

the

value

is

not

defined

Of

course

r

is

the

good

choice

but

for

greater

generality

we

will

let

the

choice

to

the

user

-LRB-

see

theorem

-RRB-

Here

are

the

inference

rules

of

this

second

order

language

ffl

Environments

-LRB-

-RRB-

-LSB-

-RSB-

is

valid

-LRB-

-RRB-

Bi

P

ropi

x

appear

in

x

B

is

valid

-LRB-

-RRB-

is

valid

X

does

not

appear

in

X

i

P

rop

is

valid

ffl

Hypotheses

-LRB-

-RRB-

is

valid

x

i

B

appears

in

-LRB-

-RRB-

is

valid

X

i

P

rop

appears

in

P

ffl

Type

formation

-LRB-

-RRB-

Ai

P

ropi

Bj

P

ropj

-LRB-

Ai

Bj

-RRB-

j

P

ropj

-LRB-

-RRB-

X

i

P

rop

Aj

P

ropj

sup

-LRB-

mark

-LRB-

occ

-LRB-

X

A

-RRB-

-RRB-

-RRB-

-LRB-

Aj

-RRB-

j

P

ropj

ffl

Abstractions

-LRB-

-RRB-

x

i

A

M

j

N

j

N

j

P

ropj

sup

-LRB-

mark

-LRB-

occ

-LRB-

x

M

-RRB-

-RRB-

-RRB-

-LRB-

-LSB-

x

A

-RSB-

M

j

-RRB-

j

-LRB-

N

j

-RRB-

j

-LRB-

-RRB-

X

i

P

rop

tj

T

j

T

j

P

ropj

sup

-LRB-

mark

-LRB-

occ

-LRB-

X

t

-RRB-

-RRB-

-RRB-

-LRB-

tj

-RRB-

j

-LRB-

T

j

-RRB-

j

ffl

Applications

-LRB-

-RRB-

-LRB-

Ai

Bj

-RRB-

j

Ai

-LRB-

-RRB-

j

Bj

-LRB-

-RRB-

tj

-LRB-

Bj

-RRB-

j

T

i

P

ropi

-LRB-

tj

T

i

-RRB-

j

-LRB-

Bj

-LSB-

Xi

T

i

-RSB-

-RRB-

j

One

can

already

makes

some

remarks

ffl

Marking

and

typing

are

not

directly

linked

For

a

given

term

one

can

give

several

different

markings

Meanwhile

the

marking

respects

some

rules

described

in

typing

rules

ffl

There

are

two

different

kinds

of

marks

The

ones

used

to

label

variables

only

depend

on

the

context

whereas

the

ones

used

to

label

a

term

are

inherited

from

the

subterms

it

contains

ffl

One

can

only

weaken

a

mark

at

the

introduction

of

variable

level

-LRB-

rules

-LRB-

-RRB-

and

-LRB-

-RRB-

-RRB-

This

is

clearly

needed

if

we

consider

the

previous

remark

ffl

The

links

built

in

Boerio

's

algorithm

have

been

translated

within

the

typing

rules

To

exploit

this

system

we

have

to

define

a

new

-LCB-

reduction

Definition

-LRB-

-LCB-

reduction

in

a

marked

language

-RRB-

there

are

two

cases

If

the

argument

is

marked

with

r

we

have

a

redex

which

looks

like

-LRB-

-LRB-

-LSB-

x

r

A

-RSB-

M

i

-RRB-

iN

r

-RRB-

i

and

the

inference

rules

on

well

formation

for

terms

impose

that

every

occurrence

of

x

in

M

is

marked

r

We

define

-LRB-

-LRB-

-LSB-

x

r

A

-RSB-

M

i

-RRB-

i

N

r

-RRB-

i

M

i

-LSB-

cr

N

r

-RSB-

If

the

argument

is

marked

with

c

we

only

know

that

there

is

at

least

one

occurrence

of

the

binded

variable

marked

with

c

while

the

others

can

be

marked

with

r

We

have

a

problem

to

instantiate

both

kind

of

variables

But

we

know

that

the

weakening

rules

enable

us

to

consider

every

term

marked

with

c

as

the

same

term

but

marked

r

-LRB-

one

just

have

to

mark

with

r

every

introduction

of

a

variable

during

the

building

of

the

term

-RRB-

It

leads

to

the

following

definition

-LRB-

-LRB-

-LSB-

x

c

A

-RSB-

M

i

-RRB-

iN

c

-RRB-

i

-LRB-

M

i

-LSB-

xc

N

c

-RSB-

-LSB-

xr

N

r

-RSB-

-RRB-

i

where

N

r

represent

the

term

N

in

which

every

atom

has

been

marked

with

r

This

definition

looks

reasonable

because

the

following

property

holds

Property

-LRB-

Invariance

of

marking

under

-LCB-

reduction

-RRB-

Let

M

i

be

a

well

formed

term

of

we

have

the

following

property

M

i

M

i

Proof

Let

consider

a

term

M

i

We

show

by

structural

induction

that

substituting

any

subterm

of

M

i

it

by

another

one

with

the

same

mark

does

not

change

the

mark

of

M

This

is

trivially

verified

for

variables

Indeed

the

only

subterm

is

the

variable

itself

and

so

it

will

keep

the

same

mark

Suppose

that

M

-LRB-

-RRB-

j.

Then

if

we

substitute

the

subterm

by

qi

the

term

will

keep

the

same

mark

It

is

also

the

case

if

we

substitute

qj

to

The

other

cases

are

treated

in

the

same

way

Order

introduced

on

terms

by

marking

We

now

define

an

order

on

well

formed

terms

of

m

This

order

is

generated

by

the

order

relation

previously

defined

on

the

set

Label

set

We

say

that

if

two

terms

have

the

same

syntactical

tree

-LRB-

without

looking

at

the

marks

-RRB-

the

one

which

has

the

longest

number

of

c

is

the

bigger

This

leads

to

the

following

definition

-LRB-

by

structural

induction

-RRB-

ffl

Ground

cases

-LCB-

For

constants

P

ropr

P

ropc

-LCB-

For

variables

xr

xc

ffl

Induction

cases

on

types

-LCB-

If

M

M

N

and

N

are

types

M

N

M

N

if

M

M

and

N

N

-LCB-

If

X

are

type

variables

and

M

M

are

types

then

if

X

and

if

M

M

ffl

Induction

cases

on

terms

-LCB-

If

et

are

terms

then

-LRB-

-RRB-

-LRB-

-RRB-

if

and

-LCB-

If

t

are

terms

T

and

T

types

then

-LRB-

-LSB-

T

-RSB-

-RRB-

-LRB-

t

-LSB-

T

-RSB-

-RRB-

if

t

and

T

T

-LCB-

If

M

M

are

terms

A

types

then

-LSB-

x

-RSB-

M

-LSB-

y

A

-RSB-

M

if

A

and

if

M

-LSB-

x

z

-RSB-

M

-LSB-

y

z

-RSB-

where

z

is

a

fresh

term

variable

-LRB-

this

is

to

avoid

problems

linked

to

-LCB-

conversion

-RRB-

-LCB-

If

M

and

M

are

terms

then

XM

Y

M

if

M

-LSB-

X

Z

-RSB-

M

-LSB-

Y

Z

-RSB-

where

Z

is

a

fresh

terms

variable

-LRB-

it

is

to

avoid

problems

linked

to

-LCB-

conversion

-RRB-

Flexibility

of

We

now

show

that

our

system

is

flexible

by

simulating

the

other

extraction

procedures

These

different

simulations

are

naturally

obtained

by

playing

on

two

parameters

The

first

parameter

concerns

the

initial

conditions

it

corresponds

to

the

initial

marking

of

Boerio

's

algorithm

The

second

parameter

deals

with

the

way

the

extraction

is

defined

In

Boerio

for

example

one

can

remove

a

subtree

only

if

all

atoms

of

this

subtree

are

marked

with

r

while

it

is

not

the

case

for

Paulin

ffl

Simulation

of

Paulin

's

Extraction

Definition

The

extracting

function

ExP

is

inductively

defined

by

ffl

ExP

-LRB-

xc

-RRB-

x

ffl

ExP

-LRB-

Xc

-RRB-

X

ffl

ExP

-LRB-

-LRB-

Ar

Bj

-RRB-

j

-RRB-

ExP

-LRB-

Bj

-RRB-

ffl

ExP

-LRB-

-LRB-

Ac

Bj

-RRB-

j

-RRB-

ExP

-LRB-

Ac

-RRB-

ExP

-LRB-

Bj

-RRB-

ffl

ExP

-LRB-

-LRB-

Xr

Aj

-RRB-

j

-RRB-

X

ExP

-LRB-

Aj

-RRB-

ffl

ExP

-LRB-

-LRB-

Xc

Aj

-RRB-

j

-RRB-

ExP

-LRB-

Aj

-RRB-

ffl

ExP

-LRB-

-LSB-

x

r

A

-RSB-

M

j

-RRB-

j

-RRB-

ExP

-LRB-

M

j

-RRB-

ffl

ExP

-LRB-

-LSB-

x

c

A

-RSB-

M

j

-RRB-

j

-RRB-

-LSB-

x

ExP

-LRB-

A

-RRB-

-RSB-

ExP

-LRB-

M

j

-RRB-

ffl

ExP

-LRB-

-LRB-

tj

T

r

-RRB-

j

-RRB-

ExP

-LRB-

tj

-RRB-

ffl

ExP

-LRB-

-LRB-

tj

T

c

-RRB-

j

-RRB-

-LRB-

ExP

-LRB-

tj

-RRB-

ExP

-LRB-

T

c

-RRB-

ffl

ExP

-LRB-

-LRB-

tj

ur

-RRB-

j

-RRB-

ExP

-LRB-

tj

-RRB-

ffl

ExP

-LRB-

-LRB-

tj

uc

-RRB-

j

-RRB-

-LRB-

ExP

-LRB-

tj

-RRB-

ExP

-LRB-

uc

-RRB-

-RRB-

Where

x

and

X

are

fresh

term

and

type

variables

One

can

easily

extend

this

definition

to

environments

Theorem

If

M

c

N

c

is

provable

in

then

ExP

-LRB-

-RRB-

ExP

-LRB-

N

c

-RRB-

ExP

in

F

Proof

To

prove

this

theorem

we

look

what

is

going

on

by

induction

on

the

term

structure

The

ground

case

the

case

of

variables

is

clearly

verified

Consider

the

case

of

a

variable

marked

by

c

This

the

only

case

to

be

considered

as

extraction

only

works

on

c

marked

terms

We

have

ExP

-LRB-

vc

-RRB-

v

which

is

a

well

formed

term

in

Indeed

as

the

variable

is

marked

c

its

declaration

in

the

context

is

of

the

kind

v

c

V

and

so

in

the

extracted

context

appears

v

V

hence

the

announced

result

For

induction

cases

we

have

the

following

options

ffl

Suppose

-LRB-

-LSB-

x

i

A

-RSB-

M

j

-RRB-

j

-LRB-

Ai

Bj

-RRB-

j

Two

cases

are

to

be

considered

i

r

In

this

case

we

have

ExP

-LRB-

-LRB-

-LSB-

x

i

A

-RSB-

M

j

-RRB-

j

-RRB-

ExP

-LRB-

M

j

-RRB-

and

ExP

-LRB-

-LRB-

Ai

Bj

-RRB-

j

-RRB-

ExP

-LRB-

Bj

-RRB-

So

it

is

sufficient

to

show

that

ExP

-LRB-

-RRB-

ExP

-LRB-

M

j

-RRB-

ExP

-LRB-

Bj

-RRB-

which

is

exactly

the

induction

hypothesis

i

c

Then

we

have

ExP

-LRB-

-LRB-

-LSB-

x

i

A

-RSB-

M

j

-RRB-

j

-RRB-

-LSB-

x

ExP

-LRB-

Ai

-RRB-

-RSB-

ExP

-LRB-

M

j

-RRB-

and

ExP

-LRB-

-LRB-

Ai

Bj

-RRB-

j

-RRB-

ExP

-LRB-

Ai

-RRB-

ExP

-LRB-

Bj

-RRB-

One

has

to

show

that

ExP

-LRB-

-RRB-

-LSB-

x

ExP

-LRB-

Ai

-RRB-

-RSB-

ExP

-LRB-

M

j

-RRB-

ExP

-LRB-

Ai

-RRB-

ExP

-LRB-

Bj

-RRB-

One

uses

the

induction

hypothesis

which

says

that

ExP

-LRB-

x

c

A

-RRB-

ExP

-LRB-

M

j

-RRB-

ExP

-LRB-

Bj

-RRB-

In

another

terms

ExP

-LRB-

-RRB-

x

ExP

-LRB-

Ac

-RRB-

ExP

-LRB-

M

j

-RRB-

ExP

-LRB-

Bj

-RRB-

This

last

remark

shows

that

one

can

apply

the

abstraction

rule

in

hence

the

result

ffl

Now

if

we

have

-LRB-

ti

uj

-RRB-

i

T

i

with

ti

-LRB-

U

j

T

i

-RRB-

i

and

uj

U

j

We

have

the

two

following

subcases

to

treat

j

r

We

have

ExP

-LRB-

-LRB-

ti

uj

-RRB-

i

-RRB-

ExP

-LRB-

ti

-RRB-

and

one

has

to

show

that

ExP

-LRB-

-RRB-

ExP

-LRB-

ti

-RRB-

ExP

-LRB-

T

i

-RRB-

But

by

induction

hypothesis

one

has

ExP

-LRB-

-RRB-

ExP

-LRB-

ti

-RRB-

ExP

-LRB-

U

j

T

i

-RRB-

and

as

ExP

-LRB-

U

j

T

i

-RRB-

ExP

-LRB-

T

i

-RRB-

one

has

the

researched

result

j

c.

Now

one

has

ExP

-LRB-

-LRB-

ti

uj

-RRB-

i

-RRB-

-LRB-

ExP

-LRB-

ti

-RRB-

ExP

-LRB-

uj

-RRB-

-RRB-

and

one

wants

to

show

that

ExP

-LRB-

-RRB-

-LRB-

ExP

-LRB-

ti

-RRB-

ExP

-LRB-

uj

-RRB-

-RRB-

ExP

-LRB-

-LRB-

U

j

T

i

-RRB-

i

-RRB-

we

know

by

induction

hypothesis

that

ExP

-LRB-

-RRB-

ExP

-LRB-

ti

-RRB-

ExP

-LRB-

U

j

T

i

-RRB-

and

also

that

ExP

-LRB-

-RRB-

ExP

-LRB-

uj

-RRB-

ExP

-LRB-

U

j

-RRB-

Now

one

has

Exp

-LRB-

U

j

T

i

-RRB-

i

-RRB-

Exp

-LRB-

U

j

-RRB-

ExP

-LRB-

T

i

-RRB-

Hence

by

applying

the

application

rule

of

it

comes

ExP

-LRB-

-RRB-

-LRB-

ExP

-LRB-

ti

-RRB-

ExP

-LRB-

uj

-RRB-

-RRB-

Exp

-LRB-

U

j

-RRB-

ExP

-LRB-

T

i

-RRB-

in

other

words

ExP

-LRB-

-RRB-

-LRB-

ExP

-LRB-

ti

-RRB-

ExP

-LRB-

uj

-RRB-

-RRB-

ExP

-LRB-

-LRB-

U

j

T

i

-RRB-

i

-RRB-

which

demonstrates

the

result

All

other

cases

abstraction

of

types

and

application

of

types

to

terms

are

treated

in

the

same

way

Theorem

One

can

simulate

in

the

extraction

procedure

proposed

by

C.

Paulin

for

the

Calculus

of

Construction

restricted

to

the

second

order

Proof

To

the

type

P

rop

of

the

Calculus

of

Constructions

one

associates

P

ropr

and

to

Set

one

associates

P

ropc

Now

one

only

has

to

show

that

every

term

with

empty

content

in

Paulin

's

system

is

marked

with

an

r

in

our

system

It

is

simply

done

by

induction

on

formation

of

empty

content

terms

ffl

Ground

case

If

M

P

rop

in

Paulin

's

system

then

by

definition

it

will

be

translated

in

P

ropr

in

our

system

ffl

If

M

is

a

term

of

empty

content

in

Paulin

's

system

and

translated

to

a

term

with

a

mark

c

in

our

system

then

-LCB-

-LRB-

-LRB-

x

N

-RRB-

M

-RRB-

has

an

empty

content

and

is

translated

by

-LRB-

-LRB-

x

i

N

-RRB-

M

r

-RRB-

r

and

so

marked

with

r.

-LCB-

-LRB-

-LSB-

x

N

-RSB-

M

-RRB-

has

an

empty

content

and

is

translated

by

-LRB-

-LSB-

x

i

N

-RSB-

M

r

-RRB-

r

and

so

marked

with

r.

-LCB-

-LRB-

M

N

-RRB-

has

an

empty

content

and

is

translated

by

-LRB-

M

r

N

i

-RRB-

r.

Hence

every

term

with

an

empty

content

can

be

translated

in

our

system

It

shows

that

one

can

simulate

Paulin

's

extraction

in

ffl

Simulation

of

Berardi

-LCB-

Boerio

's

Extraction

The

first

thing

to

do

is

to

define

a

new

extraction

function

Indeed

for

Boerio

a

term

can

only

be

replaced

by

if

it

has

all

of

its

atoms

marked

with

an

r

This

leads

to

the

following

definition

Definition

The

extracting

function

ExB

is

inductively

defined

by

ffl

ExB

-LRB-

xc

-RRB-

x

ffl

ExB

-LRB-

Xc

-RRB-

X

ffl

ExB

-LRB-

-LRB-

Ar

Bj

-RRB-

j

-RRB-

-LCB-

If

every

atom

of

Ar

is

marked

r

then

ExB

-LRB-

Bj

-RRB-

-LCB-

Else

-LRB-

ExB

-LRB-

Ar

-RRB-

ExB

-LRB-

Bj

-RRB-

-RRB-

ffl

ExB

-LRB-

-LRB-

Ac

Bj

-RRB-

j

-RRB-

ExB

-LRB-

Ac

-RRB-

ExB

-LRB-

Bj

-RRB-

ffl

ExB

-LRB-

-LRB-

Xr

Aj

-RRB-

j

-RRB-

ExB

-LRB-

Aj

-RRB-

ffl

ExB

-LRB-

-LRB-

Xc

Aj

-RRB-

j

-RRB-

-LRB-

Aj

-RRB-

ffl

ExB

-LRB-

-LSB-

x

r

A

-RSB-

M

j

-RRB-

j

-RRB-

-LCB-

If

every

atom

of

Ar

is

marked

r

then

X

ExB

-LRB-

M

j

-RRB-

-LCB-

Else

-LSB-

x

ExB

-LRB-

A

-RRB-

-RSB-

ExB

-LRB-

M

j

-RRB-

ffl

ExB

-LRB-

-LSB-

x

c

A

-RSB-

M

j

-RRB-

j

-RRB-

-LSB-

x

ExB

-LRB-

A

-RRB-

-RSB-

ExB

-LRB-

M

j

-RRB-

ffl

ExB

-LRB-

-LRB-

tj

T

r

-RRB-

j

-RRB-

-LCB-

If

every

atom

of

T

r

is

marked

r

then

ExB

-LRB-

tj

-RRB-

-LCB-

Else

-LRB-

ExB

-LRB-

tj

-RRB-

ExB

-LRB-

T

r

-RRB-

ffl

ExB

-LRB-

-LRB-

tj

T

c

-RRB-

j

-RRB-

-LRB-

ExB

-LRB-

tj

-RRB-

ExB

-LRB-

T

c

-RRB-

ffl

ExB

-LRB-

-LRB-

tj

ur

-RRB-

j

-RRB-

-LCB-

If

every

atom

of

ur

is

marked

r

then

ExB

-LRB-

tj

-RRB-

-LCB-

Else

-LRB-

ExB

-LRB-

tj

-RRB-

ExB

-LRB-

ur

-RRB-

ffl

ExB

-LRB-

-LRB-

tj

uc

-RRB-

j

-RRB-

-LRB-

ExB

-LRB-

tj

-RRB-

ExB

-LRB-

uc

-RRB-

-RRB-

Here

too

one

extends

easily

this

notion

for

environments

Theorem

If

M

c

N

c

is

provable

in

then

ExP

-LRB-

-RRB-

ExP

-LRB-

N

c

-RRB-

ExP

in

F

Proof

The

proof

is

almost

the

same

as

the

one

used

to

prove

the

theorem

One

just

has

to

check

that

terms

are

uniformly

marked

with

r

or

not

This

condition

does

not

influences

the

well

formation

of

terms

Moreover

every

term

extracted

with

Boerio

's

extraction

is

also

extracted

in

the

same

way

by

Paulin

's

extraction

hence

the

result

Actually

erasing

subterms

labeled

by

an

r

is

like

identifying

terms

of

the

form

-LRB-

t

;-RRB-

to

t

U

B

to

B

B

U

to

U

in

Boerio

's

system

This

shows

well

that

to

the

function

Simplify

we

give

a

corresponding

function

which

is

ExB

We

are

now

going

to

exploit

this

correspondence

to

prove

the

following

theorem

Theorem

Let

M

be

a

saturated

marking

in

Boerio

's

sense

of

a

term

t

One

can

derive

tj

T

j

in

in

such

a

way

that

tj

has

the

same

marks

on

its

atoms

than

the

one

associated

by

M

to

t

in

Proof

First

let

us

recall

the

definition

of

a

saturated

marking

This

is

a

marking

which

is

both

canonical

-LRB-

a

subterm

marked

by

an

r

has

all

of

its

atoms

marked

by

r

-RRB-

and

consistent

-LRB-

the

extraction

of

subterms

marked

by

r

is

done

and

the

extracted

term

is

well

formed

-RRB-

The

theorem

already

proves

us

that

a

marking

in

is

always

consistent

It

is

easy

to

see

that

one

can

always

build

a

canonical

marking

in

from

a

given

marking

Indeed

since

a

subtree

is

marked

with

an

r

one

just

has

to

instantiate

the

following

rule

of

-LRB-

-RRB-

is

valid

X

i

P

rop

appears

in

P

to

build

the

subtree

This

rule

can

be

read

as

-LRB-

-RRB-

is

valid

X

i

P

rop

appears

in

Xr

P

ropr

hence

every

of

the

subtree

will

be

marked

with

an

r

So

we

can

forget

about

the

problem

of

canonicity

Next

one

has

to

show

that

any

consistent

marking

in

can

be

realized

in

our

marking

system

Let

us

prove

it

by

absurdity

Suppose

that

we

have

a

term

tc

marked

in

such

a

way

that

we

can

not

build

its

marking

in

our

system

although

ExB

-LRB-

tc

-RRB-

is

well

formed

with

respect

to

or

that

we

can

find

a

lower

marking

So

there

exists

at

least

a

node

in

the

proof

tree

which

does

not

satisfy

the

constraints

generated

by

Let

us

consider

the

different

possibilities

The

node

can

be

ffl

A

term

application

formation

node

In

our

system

we

have

-LRB-

-RRB-

-LRB-

Ai

Bj

-RRB-

j

Ai

-LRB-

-RRB-

j

Bj

As

the

marking

has

to

be

impossible

to

build

in

our

system

the

node

must

have

the

following

shape

-LRB-

Ai

Bj

-RRB-

j

Ak

-LRB-

-RRB-

j

Bj

with

k

i.

Now

let

us

extract

this

subterm

By

our

definition

of

extraction

we

have

-LCB-

ExB

-LRB-

-LRB-

-RRB-

j

-RRB-

-RRB-

ExB

-LRB-

-RRB-

if

k

r

and

-LRB-

ExB

-LRB-

-RRB-

ExB

-LRB-

-RRB-

-RRB-

otherwise

-LCB-

ExB

-LRB-

-LRB-

Ai

Bj

-RRB-

j

-RRB-

ExB

-LRB-

Ai

-RRB-

ExB

-LRB-

Bj

-RRB-

if

i

r

and

ExBj

otherwise

Now

one

can

easily

check

that

whether

k

r

or

c

the

extracted

term

will

not

be

well

formed

ffl

A

type

application

formation

node

In

our

system

we

have

-LRB-

-RRB-

tj

-LRB-

Bj

-RRB-

j

T

i

P

ropi

-LRB-

tj

T

i

-RRB-

j

-LRB-

Bj

-LSB-

Xi

T

i

-RSB-

-RRB-

j

if

we

do

n't

use

those

constraints

one

can

show

as

above

that

the

extracted

term

will

not

be

well

formed

ffl

An

abstraction

over

terms

node

In

our

system

we

have

-LRB-

-RRB-

x

i

A

M

j

N

j

N

j

P

ropj

sup

-LRB-

mark

-LRB-

occ

-LRB-

x

M

-RRB-

-RRB-

-RRB-

-LRB-

-LSB-

x

A

-RSB-

M

j

-RRB-

j

-LRB-

N

j

-RRB-

j

Now

to

find

a

marking

impossible

to

build

in

our

system

the

node

must

looks

like

x

i

A

M

j

N

j

N

j

P

ropj

-LRB-

-LSB-

x

A

-RSB-

M

j

-RRB-

j

-LRB-

N

j

-RRB-

j

such

that

sup

-LRB-

mark

-LRB-

occ

-LRB-

X

N

-RRB-

-RRB-

-RRB-

As

we

have

a

two

element

domain

this

leads

to

the

unique

solution

r.

Indeed

if

c

while

there

is

no

occurrence

of

x

in

M

So

mark

-LRB-

occ

-LRB-

x

M

-RRB-

-RRB-

in

and

we

can

choose

c

sup

-LRB-

;-RRB-

obtaining

the

same

marking

So

let

us

consider

the

case

where

r

whereas

there

exists

an

occurrence

of

x

in

M

j

which

is

marked

c.

By

extraction

we

will

erase

the

binder

-LSB-

x

i

A

-RSB-

but

not

the

occurrence

of

x

in

M

hence

M

will

not

be

well

formed

after

extraction

as

it

will

contain

a

variable

x

which

has

no

binder

and

no

definition

in

the

context

ffl

Abstraction

over

types

The

proof

is

the

same

as

above

Hence

by

absurdity

we

have

proved

the

result

This

theorem

is

crucial

for

understanding

of

what

marking

is

It

expresses

thatin

order

to

have

a

coherent

marking

i.e.

saturated

the

marks

have

to

verify

certain

constraints

precisely

those

constraints

that

are

encoded

in

the

typing

rules

of

Actually

the

last

theorem

proves

than

in

our

system

we

can

at

worse

obtain

the

same

results

than

in

the

with

pruning

Indeed

if

we

restrict

to

the

terms

having

a

saturated

marking

we

will

exactly

find

the

system

studied

by

Boerio

In

particular

we

can

prove

for

this

restriction

of

all

what

was

proved

in

by

Boerio

To

optimize

a

term

t

of

type

T

it

suffices

to

find

the

greatest

lower

bound

of

CLEm

-LRB-

t

-RRB-

tand

T

and

g

in

the

restriction

of

to

saturated

terms

For

doing

that

we

follow

the

method

proposed

by

Boerio

in

-LSB-

-RSB-

The

initial

marking

consists

to

set

all

marks

to

a

fresh

variable

of

mark

except

the

ones

of

the

global

term

and

of

the

environments

-LRB-

terms

of

the

environments

are

uniformly

marked

by

the

same

mark

everywhere

-RRB-

which

are

marked

with

c

After

that

one

just

has

to

follow

the

typing

rules

and

generate

constraints

between

the

mark

variables

in

the

tree

Let

us

consider

a

small

example

Suppose

we

have

-LRB-

Aj

Bk

-RRB-

l

An

-LRB-

-RRB-

q

Bh

Then

if

we

follow

the

associated

typing

rules

we

can

find

that

i

l

o

q

h

and

that

j

m

n

p

This

way

one

can

make

the

final

c

mark

flows

from

the

root

to

the

rest

of

the

term

Let

us

next

develop

a

larger

example

to

see

how

one

can

simulate

Boerio

's

algorithm

Example

Consider

the

following

term

t

-LRB-

-LRB-

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

u

-RRB-

v

-RRB-

We

will

show

how

to

simplify

it

using

the

system

Suppose

X

c

P

rop

u

c

X

v

c

X

We

begin

by

giving

its

derivation

tree

in

y

X

y

X

y

X

y

X

-LSB-

y

X

-RSB-

y

X

X

x

X

x

X

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

-LRB-

X

-LRB-

X

X

-RRB-

-RRB-

u

X

-LRB-

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

u

-RRB-

X

X

v

X

-LRB-

-LRB-

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

u

-RRB-

v

-RRB-

X

Where

represents

the

following

environment

X

P

rop

u

X

v

X.

Now

we

have

to

assign

initial

marks

to

start

the

algorithm

For

that

we

begin

to

d?decorate

our

proof

tree

to

its

root

We

only

know

that

the

final

type

and

term

and

the

variables

in

the

final

environment

have

to

be

conserved

and

hence

marked

with

a

c

It

gives

the

following

derivation

tree

y

X

y

X

y

X

y

X

-LSB-

y

X

-RSB-

y

X

X

x

X

x

X

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

-LRB-

X

-LRB-

X

X

-RRB-

-RRB-

u

X

-LRB-

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

u

-RRB-

X

X

v

X

-LRB-

-LRB-

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

u

-RRB-

v

-RRB-

c

Xc

Now

using

the

rule

-LRB-

-RRB-

-LRB-

Ai

Bj

-RRB-

j

Ai

-LRB-

-RRB-

j

Bj

we

can

deduce

the

following

decoration

y

X

y

X

y

X

y

X

-LSB-

y

X

-RSB-

y

X

X

x

X

x

X

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

-LRB-

X

-LRB-

X

X

-RRB-

-RRB-

u

X

-LRB-

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

u

-RRB-

c

-LRB-

Xi

Xc

-RRB-

c

vi

Xi

-LRB-

-LRB-

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

u

-RRB-

v

-RRB-

c

Xc

where

i

is

a

mark

variable

One

can

already

notice

that

this

is

the

same

as

the

one

used

to

mark

the

first

occurrence

of

X

in

-LRB-

Xi

Xc

-RRB-

c

It

is

here

that

the

realization

of

the

links

used

in

Boerio

's

algorithm

is

done

in

our

system

with

marking

Still

using

the

same

rule

one

can

lift

the

mark

on

the

left

premise

to

finally

get

y

X

y

X

y

X

y

X

-LSB-

y

X

-RSB-

y

X

X

x

X

x

X

-LRB-

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

-RRB-

c

-LRB-

Xj

-LRB-

Xi

Xc

-RRB-

c

-RRB-

uj

Xj

-LRB-

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

u

-RRB-

c

-LRB-

Xi

Xc

-RRB-

c

vi

Xi

-LRB-

-LRB-

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

u

-RRB-

v

-RRB-

c

Xc

Where

j

is

a

new

mark

variable

Now

to

progress

in

the

tree

on

has

to

apply

the

following

rule

-LRB-

-RRB-

x

i

A

M

j

N

j

N

j

P

ropj

sup

-LRB-

mark

-LRB-

occ

-LRB-

x

M

-RRB-

-RRB-

-RRB-

-LRB-

-LSB-

x

A

-RSB-

M

j

-RRB-

j

-LRB-

N

j

-RRB-

j

We

then

get

y

X

y

X

y

X

y

X

-LRB-

-LSB-

y

X

-RSB-

y

-RRB-

c

-LRB-

Xi

Xc

-RRB-

c

x

X

xj

Xj

-LRB-

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

-RRB-

c

-LRB-

Xj

-LRB-

Xi

Xc

-RRB-

c

-RRB-

c

uj

Xj

-LRB-

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

u

-RRB-

c

-LRB-

Xi

Xc

-RRB-

c

vi

Xi

-LRB-

-LRB-

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

u

-RRB-

v

-RRB-

c

Xc

Finally

we

obtain

y

X

yi

Xi

y

X

yc

Xc

-LRB-

-LSB-

y

X

-RSB-

y

-RRB-

c

-LRB-

Xi

Xc

-RRB-

c

x

X

xj

Xj

-LRB-

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

-RRB-

c

-LRB-

Xj

-LRB-

Xi

Xc

-RRB-

c

-RRB-

c

uj

Xj

-LRB-

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

u

-RRB-

c

-LRB-

Xi

Xc

-RRB-

c

vi

Xi

-LRB-

-LRB-

-LSB-

x

X

-RSB-

-LSB-

y

X

-RSB-

y

u

-RRB-

v

-RRB-

c

Xc

One

can

notice

that

variables

x

and

y

have

no

marks

in

their

declaration

in

the

context

we

recall

that

by

convention

everything

in

the

context

is

marked

with

c.

From

the

rule

-LRB-

-RRB-

it

follows

that

i

c

and

one

has

to

replace

every

occurrences

of

i

by

c

in

our

tree

As

the

j

variable

does

not

have

any

constraints

and

that

we

seek

for

the

minimal

marking

we

just

have

to

choose

it

equal

to

r

We

obtain

the

following

marked

term

-LRB-

-LRB-

-LSB-

x

r

X

-RSB-

-LSB-

y

c

X

-RSB-

yc

uc

-RRB-

c

vr

-RRB-

c

which

after

extraction

gives

-LRB-

-LSB-

y

X

-RSB-

y

u

-RRB-

Which

was

the

result

expected

This

very

simple

example

shows

how

inference

rules

with

marks

can

simulate

the

link

of

Boerio

ffl

Simulation

of

extraction

with

subtyping

The

problem

which

has

given

birth

to

the

subtyping

was

the

fact

that

some

optimizations

were

not

allowed

because

they

would

lead

to

ill

typed

terms

In

our

system

this

is

not

the

case

Indeed

as

the

marking

is

independent

from

the

typing

mechanism

such

problems

are

avoided

Thus

we

are

able

to

simulate

the

subtyping

mechanism

simply

by

choosing

the

ExP

extraction

It

represents

an

extension

to

the

second

order

of

the

work

done

by

Berardi

and

Boerio

in

-LSB-

-RSB-

Theorem

One

can

simulate

the

pruning

technique

with

subtyping

in

Proof

One

only

has

to

check

that

there

is

for

each

-LCB-

type

of

Berardi

-LCB-

Boerio

's

system

a

corresponding

type

in

The

first

thing

to

do

is

to

find

an

equivalent

for

Clearly

N

r

where

N

is

the

predefined

constant

representing

integers

is

the

good

choice

Now

it

is

clear

that

for

each

-LCB-

type

one

can

give

a

term

representing

it

in

Indeed

an

-LCB-

type

is

of

kind

A

O

or

O

O.

By

induction

it

is

clear

that

we

can

build

such

types

in

One

just

has

to

add

for

each

-LCB-

type

T

a

declaration

of

the

form

dT

r

T

one

which

corresponds

to

the

dO

constants

in

Berardi

-LCB-

Boerio

's

system

Now

one

has

to

find

the

correspondence

for

application

rule

Let

us

recall

that

this

rule

is

for

more

precision

refer

to

section

of

the

form

f

A

B

a

A

-LRB-

f

a

-RRB-

B

while

in

our

system

one

has

the

following

application

rule

-LRB-

-RRB-

-LRB-

Ai

Bj

-RRB-

j

Ai

-LRB-

-RRB-

j

Bj

Now

let

us

look

at

the

definition

of

N

N

N

If

we

follow

our

simulation

we

have

the

following

definition

of

in

our

system

N

N

r

N

N

c

N

r

N

r

One

has

to

check

that

the

typing

rule

-LRB-

-RRB-

is

equivalent

to

the

one

given

for

Boerio

-LCB-

Berardi

system

Clearly

as

we

have

the

same

type

only

marks

are

changing

In

both

parts

of

an

expression

of

the

form

B

we

can

build

a

derivation

in

such

that

f

i

-LRB-

Aj

Ci

-RRB-

j

if

there

exists

a

derivation

of

f

i

-LRB-

Bj

Ci

-RRB-

j

We

have

shown

that

our

approach

of

extraction

is

relevant

since

it

allows

to

represent

every

known

technique

On

this

basis

we

are

going

to

extend

Berardi

-LCB-

Boerio

's

approach

to

higher

level

The

natural

language

to

consider

is

F

because

it

is

a

higher

order

language

simpler

than

the

calculus

of

Construction

as

there

are

no

dependences

from

low

level

to

high

level

Marking

in

a

higher

order

language

Fm

Presentation

of

F

system

The

F

system

has

been

introduced

by

J.

-LCB-

Y.

Girard

in

-LSB-

-RSB-

It

is

more

powerful

than

It

presents

some

features

which

make

it

the

natural

system

to

generalize

Boerio

and

Berardi

's

technic

ffl

The

first

point

is

the

expressivity

of

the

system

F

allows

to

express

all

programs

and

it

has

the

same

computational

power

as

the

Calculus

of

Constructions

ffl

The

second

point

concerns

its

hierarchical

structure

The

language

is

structured

in

such

a

way

that

objects

of

an

higher

level

can

not

have

an

influence

on

objects

situated

below

them

This

makes

the

task

easier

ffl

The

third

important

feature

comes

from

how

are

structured

the

levels

of

objects

in

F

Their

structure

is

such

that

apart

few

remarks

they

strongly

remind

languages

of

the

first

and

second

order

The

idea

is

to

re-apply

to

different

levels

what

we

already

know

We

will

note

F

the

language

of

F

In

this

language

we

can

distinguish

three

kinds

of

objects

Orders

operators

terms

These

three

kinds

of

objects

are

defined

in

three

successive

levels

beginning

with

orders

followed

by

operators

which

can

depend

on

orders

and

finally

terms

which

can

depend

on

both

orders

and

operators

We

will

talk

about

level

to

designate

orders

operators

or

terms

More

precisely

we

have

ffl

Orders

-LRB-

level

-RRB-

The

constant

Data

is

an

order

and

if

A

and

B

are

orders

then

A

-RRB-

B

is

also

an

order

ffl

Operators

-LRB-

level

-RRB-

If

oe

o

are

operators

X

an

operator

variable

and

A

an

order

then

oe

o

-LRB-

functions

-RRB-

-LRB-

oe

o

-RRB-

-LRB-

applications

-RRB-

-LRB-

X

A

-RRB-

oe

-LRB-

products

-RRB-

and

-LSB-

X

A

-RSB-

oe

-LRB-

abstraction

-RRB-

are

operators

ffl

Terms

-LRB-

level

-RRB-

If

s

t

are

terms

and

x

a

term

variable

-LRB-

and

by

taking

again

the

previous

conventions

-RRB-

then

-LRB-

s

t

-RRB-

-LRB-

s

oe

-RRB-

-LSB-

x

oe

-RSB-

s

-LSB-

X

A

-RSB-

s

are

also

terms

An

order

context

is

a

finite

sequence

of

pairs

-LRB-

X

A

-RRB-

where

X

is

an

operator

variable

and

A

an

order

Typing

rules

As

the

notion

of

order

is

purely

syntactical

we

begin

to

define

the

relation

oe

A

which

means

the

operator

oe

is

well

formed

of

type

A

in

the

order

context

The

typing

rules

for

operators

are

if

X

A

appears

in

X

A

oe

Data

o

Data

oe

o

Data

X

A

oe

Data

-LRB-

X

A

-RRB-

oe

Data

X

A

oe

B

-LSB-

X

A

-RSB-

oe

A

-RRB-

B

oe

A

-RRB-

B

o

A

-LRB-

oe

o

-RRB-

B

For

terms

we

have

also

to

define

the

notion

of

environment

We

want

that

the

declaration

of

variables

precedes

the

declaration

of

operators

So

we

introduce

the

following

definition

for

environments

ffl

The

empty

sequence

-LSB-

-RSB-

is

a

valid

environment

and

the

associated

order

context

-LSB-

-RSB-

o

is

the

empty

sequence

ffl

If

is

a

valid

environment

X

an

operator

variable

which

is

not

in

and

A

an

order

then

X

A

is

a

valid

environment

and

-LRB-

X

A

-RRB-

o

o

X

A

ffl

If

is

a

valid

environment

x

a

term

variable

that

does

not

appear

in

and

if

there

is

a

derivation

o

oe

Data

where

-LRB-

x

oe

-RRB-

o

o

then

x

oe

is

a

valid

environment

and

One

now

defines

a

typing

relation

for

terms

which

will

be

noted

t

oe

with

a

valid

environment

t

a

term

and

oe

an

operator

The

typing

rules

for

terms

x

oe

appears

in

x

oe

t

oe

o

u

oe

-LRB-

t

u

-RRB-

o

x

oe

t

o

-LSB-

x

oe

-RSB-

t

oe

o

t

-LRB-

X

A

-RRB-

oe

O

o

A

-LRB-

t

o

-RRB-

oe

-LSB-

X

o

-RSB-

X

A

t

oe

-LSB-

X

A

-RSB-

t

-LRB-

X

A

-RRB-

oe

Informal

semantics

of

marking

in

this

system

Our

aim

is

to

extend

the

techniques

of

the

Turin

school

to

Fm

while

keeping

our

approach

of

marking

We

have

to

think

about

what

meaning

have

the

marking

and

optimization

on

higher

orders

The

first

observation

which

comes

to

thought

is

that

Fm

is

divided

in

three

partsm

which

are

hierarchically

comparable

The

Level

-LRB-

orders

-RRB-

does

not

raise

big

problems

to

be

an

order

is

a

too

much

syntactic

feature

to

search

any

optimization

Level

one

-LRB-

operators

-RRB-

is

already

more

interesting

At

a

first

glance

one

could

think

that

the

language

generated

by

it

is

a

simply

typed

language

-LRB-

akin

of

G?odel

T

system

-RRB-

like

the

one

studied

by

Berardi

Nevertheless

one

rule

shows

us

it

is

not

exactly

the

case

oe

Data

o

Data

oe

o

Data

Indeed

the

Data

type

is

absorbent

with

respect

to

operators

of

kind

This

means

that

if

we

wanted

to

apply

directly

Berardi

's

technique

we

would

have

a

bad

surprise

To

detect

the

informative

parts

of

a

term

Berardi

uses

the

fact

that

one

has

just

to

conserve

the

final

type

of

the

term

I

serve

for

the

building

of

the

final

type

is

the

only

information

needed

to

find

where

we

can

prune

or

not

Now

it

is

clear

that

this

criterion

is

no

longer

enough

in

this

system

Indeed

if

oe

o

are

of

type

Data

then

oe

o

and

o

will

have

the

same

type

if

we

follow

the

typing

rule

So

the

question

is

the

contribution

to

the

final

type

of

oe

o

If

this

rule

did

n't

exist

one

would

have

almost

exactly

Berardi

's

system

Actually

as

we

will

see

later

one

just

have

to

define

a

suitable

equivalence

relation

to

solve

the

problem

Level

the

one

of

terms

is

alike

apart

few

details

as

a

second

order

system

The

only

notable

differences

are

coming

from

the

creation

of

the

context

One

can

introduce

a

term

variable

only

if

the

type

of

this

variable

is

a

well

formed

operator

So

when

we

are

in

a

leaf

of

the

tree

and

this

leaf

corresponds

to

the

introduction

of

a

variable

one

has

to

build

another

proof

tree

for

the

well

formation

of

the

operator

designing

the

type

of

the

variable

The

second

bridge

between

those

two

levels

comes

from

the

following

rule

t

oe

o

u

oe

-LRB-

t

u

-RRB-

o

For

this

last

rule

one

has

to

go

to

the

operator

's

language

to

prove

the

equivalence

between

the

two

operators

This

means

that

modulo

the

last

remarks

we

are

in

a

second

order

system

in

which

one

can

apply

the

already

known

methods

to

optimize

terms

Now

to

optimize

a

term

in

F

while

keeping

our

point

of

view

of

marking

one

has

to

solve

the

problems

raised

by

the

operators

of

kind

oe

o

and

the

equivalence

between

two

marked

operators

We

propose

in

the

next

section

a

language

Fm

which

enables

to

solve

these

problems

The

Fm

language

Syntax

of

Fm

For

the

creation

of

Fm

language

we

follow

the

general

ideas

already

developed

for

For

uniformisation

reasons

we

decided

to

mark

orders

despite

the

remarks

raised

in

the

last

section

which

have

clearly

shown

that

we

can

not

expect

optimization

for

those

terms

As

usual

in

the

rest

of

the

text

the

indices

i

j

k

will

indistinctly

represent

r

or

c

One

find

again

the

main

lines

of

F

language

ffl

Orders

The

constants

Datai

are

orders

and

if

Ai

and

Bj

are

orders

then

-LRB-

Ai

-RRB-

Bj

-RRB-

j

is

also

an

order

ffl

Operators

If

oei

o

j

are

operators

Xk

an

operator

variable

and

Al

an

order

then

-LRB-

oei

o

j

-RRB-

m

-LRB-

functions

-RRB-

-LRB-

oei

o

j

-RRB-

m

-LRB-

applications

-RRB-

-LRB-

Xk

Al

-RRB-

oem

-LRB-

products

-RRB-

and

-LSB-

Xk

Al

-RSB-

oei

-LRB-

abstraction

-RRB-

are

operators

ffl

Terms

if

sn

to

are

terms

and

xp

a

term

variable

-LRB-

and

by

taking

again

the

previous

conventions

-RRB-

then

-LRB-

sn

to

-RRB-

m

-LRB-

sn

oei

-RRB-

m

-LRB-

-LSB-

xp

oei

-RSB-

sn

-RRB-

m

-LRB-

-LSB-

Xk

Al

-RSB-

sn

-RRB-

m

are

also

terms

The

syntax

is

the

same

than

in

F

apart

the

fact

that

all

subterms

are

marked

with

a

r

or

a

c

One

still

has

to

define

typing

rules

for

this

language

One

naturally

extend

those

marking

notions

to

the

formation

of

order

context

and

of

environment

for

terms

The

formation

rules

are

the

same

as

preceding

ones

and

one

simply

adds

marks

Optimization

in

Fm

We

have

pointed

out

two

points

in

the

discussion

on

optimization

in

the

last

section

Let

us

see

how

we

can

handle

them

First

we

will

denote

Op

the

language

defined

by

the

typing

rules

on

operators

in

F

For

the

first

point

we

will

simplify

the

language

Op

in

such

a

way

that

we

will

obtain

a

simply

marked

language

Definition

The

T

r

function

is

inductively

defined

by

T

r

-LRB-

oe

o

-RRB-

T

r

-LRB-

o

-RRB-

T

r

-LRB-

-LSB-

X

A

-RSB-

oe

-RRB-

-LSB-

X

A

-RSB-

T

r

-LRB-

oe

-RRB-

T

r

-LRB-

-LRB-

X

A

-RRB-

oe

-RRB-

-LRB-

X

A

-RRB-

T

r

-LRB-

oe

-RRB-

T

r

-LRB-

-LRB-

oe

o

-RRB-

-RRB-

-LRB-

T

r

-LRB-

oe

-RRB-

T

r

-LRB-

o

-RRB-

-RRB-

We

will

denote

by

the

equivalence

relation

generated

by

T

r

function

which

is

to

say

oe

o

-LRB-

-RRB-

T

r

-LRB-

oe

-RRB-

T

r

-LRB-

o

-RRB-

One

can

already

observe

that

oe

o

o

where

o

represents

the

equivalence

class

of

o

This

way

a

particular

representant

of

the

class

of

an

object

formed

by

many

is

the

rightmost

situated

subterm

Theorem

The

system

generated

by

Op

is

a

simply

typed

-LCB-

calculus

So

one

can

apply

the

results

precedently

obtained

for

the

first

order

in

Op

To

obtain

an

equivalent

to

marked

system

one

has

just

to

manage

with

equivalence

classes

in

a

way

to

avoid

to

forget

some

informative

subterms

In

clear

one

has

to

force

the

terms

of

kind

oe

o

to

be

marked

in

the

same

way

on

the

right

and

on

the

left

of

the

arrow

unless

the

user

specifies

the

contrary

Thus

this

remark

does

not

play

its

role

at

the

logical

level

-LRB-

i.e.

in

typing

rules

-RRB-

but

during

the

development

of

the

marking

algorithm

It

has

to

be

understood

as

a

marking

strategy

One

obtains

the

following

rules

if

X

i

A

appears

in

oej

Dataj

o

i

Datai

-LRB-

oej

o

i

-RRB-

i

Datai

X

i

A

oej

Dataj

sup

-LRB-

mark

-LRB-

occ

-LRB-

X

oe

-RRB-

-RRB-

-RRB-

-LRB-

-LRB-

X

A

-RRB-

oej

-RRB-

j

Dataj

X

i

A

oej

Dataj

sup

-LRB-

mark

-LRB-

occ

-LRB-

X

oe

-RRB-

-RRB-

-RRB-

-LRB-

-LSB-

X

A

-RSB-

oej

-RRB-

j

-LRB-

-RRB-

Bj

-RRB-

j

oei

-LRB-

Aj

-RRB-

Bi

-RRB-

i

o

j

Aj

-LRB-

oei

o

j

-RRB-

i

Bi

For

the

second

point

one

has

to

define

an

equivalence

between

marked

operators

Remember

that

types

represent

set

of

terms

Now

the

question

is

not

when

a

marked

term

is

equivalent

to

another

marked

term

but

when

two

sets

of

terms

are

equivalent

From

this

point

of

view

the

answer

comes

more

easily

When

you

realize

that

a

type

marked

with

r

means

that

it

has

no

informative

content

you

are

getting

very

close

to

the

solution

Knowing

the

semantics

of

the

marking

-LRB-

Keep

what

is

marked

with

c

and

erase

what

is

marked

with

r

-RRB-

the

researched

equivalence

is

easy

to

find

What

we

seek

is

the

following

ffl

If

the

mark

is

r

we

can

forget

about

marks

and

only

care

about

standard

equivalence

ffl

In

the

case

when

the

mark

is

c

we

have

to

check

both

standard

equivalence

and

also

the

compatibility

of

marks

inside

the

terms

All

these

remarks

lead

to

the

following

definition

of

equivalence

between

operators

We

will

note

oe

the

F

term

corresponding

to

the

marked

term

oei

oe

is

simply

obtained

by

erasing

all

marks

in

oei

Definition

We

inductively

define

m

by

oei

o

i

oei

m

o

i

oei

m

o

i

oei

m

o

i

o

i

m

aei

oei

m

oei

o

i

m

oei

oei

m

aei

oec

m

o

c

oer

m

o

r

-LRB-

-LSB-

X

i

A

-RSB-

oec

-RRB-

c

m

-LRB-

-LSB-

X

i

A

-RSB-

o

c

-RRB-

c

-LRB-

-LSB-

X

i

A

-RSB-

oer

-RRB-

r

m

-LRB-

-LSB-

X

j

A

-RSB-

o

r

-RRB-

r

oec

m

o

c

oer

m

o

r

-LRB-

-LRB-

X

i

A

-RRB-

oec

-RRB-

c

m

-LRB-

-LRB-

X

i

A

-RRB-

o

c

-RRB-

c

-LRB-

-LRB-

X

i

A

-RRB-

oer

-RRB-

r

m

-LRB-

-LRB-

X

j

A

-RRB-

o

r

-RRB-

r

oec

m

o

c

aei

m

i

oer

m

o

r

aer

m

r

-LRB-

aej

oec

-RRB-

c

m

-LRB-

j

o

c

-RRB-

c

-LRB-

aej

oer

-RRB-

r

m

-LRB-

k

o

r

-RRB-

r

oec

m

o

c

aei

m

i

-LRB-

oec

aei

-RRB-

c

m

-LRB-

o

c

i

-RRB-

c

oer

m

o

r

aei

m

i

-LRB-

oer

aej

-RRB-

r

m

-LRB-

o

r

k

-RRB-

r

One

easily

checks

the

following

properties

Property

Let

oei

o

j

be

marked

terms

The

following

facts

are

verified

oei

m

o

i

-RRB-

oe

o

oe

o

-RRB-

oer

m

o

r

From

this

equivalence

relation

one

obtains

the

typing

rules

for

terms

x

i

oe

appears

in

ti

-LRB-

oej

o

i

-RRB-

i

uj

oej

m

-LRB-

ti

uj

-RRB-

i

o

i

x

i

oe

tj

o

j

sup

-LRB-

mark

-LRB-

occ

-LRB-

x

oe

-RRB-

-RRB-

-RRB-

-LRB-

-LSB-

x

oe

-RSB-

tj

-RRB-

j

-LRB-

o

j

-RRB-

j

ti

-LRB-

-LRB-

X

j

A

-RRB-

oei

-RRB-

i

O

o

j

Aj

-LRB-

ti

o

j

-RRB-

j

oei

-LRB-

-LSB-

Xj

o

j

-RSB-

-RRB-

i

X

i

A

tj

oej

sup

-LRB-

mark

-LRB-

occ

-LRB-

X

t

-RRB-

-RRB-

-RRB-

-LSB-

X

A

-RSB-

tj

-LRB-

-LRB-

X

A

-RRB-

oej

-RRB-

j

These

rules

are

almost

the

same

as

ones

developed

in

Only

the

definition

of

the

-LCB-

equivalence

and

the

context

formation

differ

from

a

second

order

language

Now

we

prove

the

validity

of

our

marking

system

by

defining

a

new

extracting

function

EXF

Definition

The

function

EXF

is

inductively

defined

as

follows.

ffl

On

terms

-LCB-

EXF

-LRB-

xc

-RRB-

x

-LCB-

EXF

-LRB-

-LRB-

tj

ur

-RRB-

j

-RRB-

EXF

-LRB-

tj

-RRB-

-LCB-

EXF

-LRB-

-LRB-

tj

uc

-RRB-

j

-RRB-

-LRB-

EXF

-LRB-

tj

-RRB-

EXF

-LRB-

uc

-RRB-

-RRB-

-LCB-

EXF

-LRB-

-LRB-

-LSB-

x

r

oe

-RSB-

tj

-RRB-

j

-RRB-

EXF

-LRB-

tj

-RRB-

-LCB-

EXF

-LRB-

-LRB-

-LSB-

x

c

oe

-RSB-

tj

-RRB-

j

-RRB-

-LSB-

x

EXF

-LRB-

oec

-RRB-

-RSB-

EXF

-LRB-

tj

-RRB-

-LCB-

EXF

-LRB-

-LRB-

tj

o

r

-RRB-

j

-RRB-

EXF

-LRB-

tj

-RRB-

-LCB-

EXF

-LRB-

-LRB-

tj

o

c

-RRB-

j

-RRB-

-LRB-

EXF

-LRB-

tj

-RRB-

EXF

-LRB-

o

c

-RRB-

-RRB-

-LCB-

EXF

-LRB-

-LRB-

-LSB-

X

r

oe

-RSB-

tj

-RRB-

j

-RRB-

EXF

-LRB-

tj

-RRB-

-LCB-

EXF

-LRB-

-LRB-

-LSB-

X

c

oe

-RSB-

tj

-RRB-

j

-RRB-

-LSB-

X

EXF

-LRB-

oec

-RRB-

-RSB-

EXF

-LRB-

tj

-RRB-

ffl

On

operators

-LCB-

EXF

-LRB-

Xc

-RRB-

X

-LCB-

EXF

-LRB-

-LRB-

oer

o

i

-RRB-

i

-RRB-

EXF

-LRB-

o

i

-RRB-

-LCB-

EXF

-LRB-

-LRB-

oec

o

i

-RRB-

i

-RRB-

EXF

-LRB-

oec

-RRB-

EXF

-LRB-

o

i

-RRB-

-LCB-

EXF

-LRB-

-LRB-

-LSB-

X

r

A

-RSB-

oej

-RRB-

j

-RRB-

EXF

-LRB-

oej

-RRB-

-LCB-

EXF

-LRB-

-LRB-

-LSB-

X

c

A

-RSB-

oej

-RRB-

j

-RRB-

-LSB-

X

EXF

-LRB-

Ac

-RRB-

-RSB-

EXF

-LRB-

oej

-RRB-

-LCB-

EXF

-LRB-

-LRB-

-LRB-

X

r

A

-RRB-

oej

-RRB-

j

-RRB-

EXF

-LRB-

oej

-RRB-

-LCB-

EXF

-LRB-

-LRB-

-LRB-

X

c

A

-RRB-

oej

-RRB-

j

-RRB-

-LRB-

X

EXF

-LRB-

Ac

-RRB-

-RRB-

EXF

-LRB-

oej

-RRB-

-LCB-

EXF

-LRB-

-LRB-

o

j

oer

-RRB-

j

-RRB-

EXF

-LRB-

o

j

-RRB-

-LCB-

EXF

-LRB-

-LRB-

o

j

oec

-RRB-

j

-RRB-

-LRB-

EXF

-LRB-

o

j

-RRB-

EXF

-LRB-

oec

-RRB-

-RRB-

ffl

On

orders

-LCB-

EXF

-LRB-

Datac

-RRB-

Data

-LCB-

EXF

-LRB-

-LRB-

Or

-RRB-

P

j

-RRB-

j

-RRB-

EXF

-LRB-

P

j

-RRB-

-LCB-

EXF

-LRB-

-LRB-

Oc

-RRB-

P

j

-RRB-

j

-RRB-

EXF

-LRB-

Oc

-RRB-

-RRB-

EXF

-LRB-

P

j

-RRB-

Theorem

If

tc

o

c

is

derivable

in

Fm

then

EXF

-LRB-

-RRB-

EXF

-LRB-

tc

-RRB-

EXF

-LRB-

o

c

-RRB-

is

derivable

in

F

Proof

We

prove

this

theorem

by

a

structural

induction

on

orders

operators

and

terms

On

orders

it

is

clear

that

extraction

gives

a

well

formed

term

Indeed

if

an

order

is

marked

with

c

then

at

least

one

Data

namely

the

rightest

one

will

be

conserved

by

extraction

For

the

level

of

operators

one

can

re-use

what

was

previously

done

for

For

the

ground

case

it

works

since

extraction

on

orders

works

Now

we

can

reason

by

induction

It

is

clear

that

for

the

cases

of

application

and

abstraction

the

result

will

be

verified

-LRB-

the

proof

is

similar

to

what

was

done

in

-RRB-

There

are

only

two

cases

left

The

operator

is

of

the

form

-LRB-

oei

o

c

-RRB-

c

this

means

that

the

rule

oei

Datai

o

c

Datac

-LRB-

oei

o

c

-RRB-

c

Datac

has

been

applied

By

definition

ExFm

-LRB-

oei

o

c

-RRB-

ExFm

-LRB-

o

c

-RRB-

if

i

r

and

ExFm

-LRB-

oei

-RRB-

ExFm

-LRB-

o

c

-RRB-

if

i

c

In

both

cases

one

can

use

the

induction

hypothesis

to

prove

that

both

terms

are

of

type

ExFm

-LRB-

Datac

-RRB-

Data

The

operator

is

of

the

form

-LRB-

-LRB-

X

A

-RRB-

oec

-RRB-

c

Here

too

the

extracted

order

will

be

Data

and

it

is

clear

from

the

definition

of

extraction

that

whether

i

c

or

r

that

the

extracted

term

will

be

of

type

Data

in

F

Now

one

has

to

prove

the

final

result

i.e.

the

extracting

function

on

terms

gives

well

formed

terms

in

F

The

ground

cases

as

the

cases

of

abstraction

of

operators

and

terms

on

terms

as

well

as

the

application

of

operators

on

terms

are

verified

in

the

same

way

than

what

was

done

for

It

remains

the

case

of

application

of

terms

on

terms

The

novelty

comes

from

the

utilization

of

equivalence

on

types

Let

us

consider

the

term

s

-LRB-

tc

uj

-RRB-

c

This

means

that

the

rule

tc

-LRB-

oej

o

c

-RRB-

c

uj

oej

m

-LRB-

tc

uj

-RRB-

c

o

c

has

been

applied

Two

subcases

are

to

be

considered

j

r.

ExFm

-LRB-

s

-RRB-

ExFm

-LRB-

tc

-RRB-

But

ExFm

-LRB-

-LRB-

oer

o

c

-RRB-

c

-RRB-

ExFm

-LRB-

o

c

-RRB-

c

This

allows

to

conclude

by

induction

hypothesis

Indeed

this

hypothesis

states

that

ExFm

-LRB-

-RRB-

ExFm

-LRB-

tc

-RRB-

ExFm

-LRB-

-LRB-

oer

o

c

-RRB-

c

-RRB-

which

can

be

rewritten

ExFm

-LRB-

-RRB-

ExFm

-LRB-

tc

-RRB-

ExFm

-LRB-

o

c

-RRB-

hence

the

result

j

c

We

have

to

show

that

ExFm

-LRB-

-RRB-

ExFm

-LRB-

tc

uc

-RRB-

ExFm

-LRB-

-LRB-

oec

o

c

-RRB-

c

-RRB-

We

know

by

definition

of

extraction

that

ffl

ExFm

-LRB-

-LRB-

tc

uc

-RRB-

c

-RRB-

-LRB-

ExFm

-LRB-

tc

-RRB-

ExFm

-LRB-

uc

-RRB-

-RRB-

ffl

ExFm

-LRB-

o

c

oec

-RRB-

ExFm

-LRB-

o

c

-RRB-

ExFm

-LRB-

oec

-RRB-

Hence

we

have

to

prove

that

ExFm

-LRB-

-RRB-

-LRB-

ExFm

-LRB-

tc

-RRB-

ExFm

-LRB-

uc

-RRB-

-RRB-

ExFm

-LRB-

oec

-RRB-

which

is

clear

if

we

look

at

the

induction

hypothesis

which

are

the

following

ffl

ExFm

-LRB-

-RRB-

ExFm

-LRB-

tc

-RRB-

ExFm

-LRB-

oec

o

c

-RRB-

ffl

ExFm

-LRB-

-RRB-

ExFm

-LRB-

uc

-RRB-

ExFm

-LRB-

-RRB-

ffl

oec

m

If

we

can

prove

that

oec

m

implies

that

ExFm

-LRB-

oec

-RRB-

ExFm

-LRB-

-RRB-

then

the

case

will

be

proved

This

is

easy

to

show

Indeed

we

have

shown

in

Property

that

the

marking

is

stable

under

-LCB-

reduction

Thus

if

oec

then

all

subterms

marked

with

r

in

oec

will

also

be

marked

with

an

r

in

hence

the

extraction

which

erase

terms

marked

with

c

will

leave

two

terms

such

that

ExFm

-LRB-

oec

-RRB-

ExFm

-LRB-

-RRB-

Marking

in

the

Calculus

of

Constructions

Now

using

what

was

previously

done

in

F

we

propose

a

marking

system

for

the

calculus

of

constructions

The

difference

between

F

and

the

calculus

of

construction

comes

from

the

dependent

types

So

our

first

aim

will

be

to

handle

the

problems

raised

by

this

feature

Until

now

we

have

always

performed

extraction

within

the

same

system

For

example

in

when

extraction

was

done

it

was

giving

a

new

term

typable

in

The

same

remark

was

also

valid

for

F

an

extracted

term

of

Fm

was

an

F

term

For

the

Calculus

of

Construction

this

is

no

longer

the

case

We

will

extract

from

the

Calculus

of

Constructions

to

F

Thus

one

has

to

erase

these

kind

of

dependences

The

language

of

our

system

the

Calculus

of

Constructions

with

marks

will

be

m

already

defined

for

Here

too

two

kinds

of

judgments

will

be

done

is

a

valid

environment

and

M

N

which

has

to

be

read

M

is

well

formed

of

type

N

under

the

valid

environment

ffl

Environment

formation

-LSB-

-RSB-

is

valid

M

i

Ki

x

does

appear

in

is

valid

x

M

is

valid

ffl

Propositional

type

formation

is

valid

x

i

N

appears

in

N

i

m

N

ffl

Hypotheses

is

valid

P

ropi

Typei

ffl

Product

-LCB-

Propositional

types

P

i

P

ropi

x

P

N

j

Typej

-LRB-

-LRB-

x

r

P

-RRB-

N

j

-RRB-

j

Typej

Oi

P

ropi

P

x

P

N

j

Typej

-LRB-

-LRB-

x

r

P

-RRB-

N

j

-RRB-

j

Typej

P

i

Typei

x

P

N

j

Typej

sup

-LRB-

mark

-LRB-

occ

-LRB-

x

N

-RRB-

-RRB-

-LRB-

-LRB-

x

P

-RRB-

N

j

-RRB-

j

Typej

-LCB-

Propositional

schemes

P

i

Typei

x

P

N

j

P

ropj

sup

-LRB-

mark

-LRB-

occ

-LRB-

x

N

-RRB-

-RRB-

-LRB-

-LRB-

-RRB-

N

j

-RRB-

j

P

ropj

ffl

Abstraction

-LCB-

Propositional

schemes

N

j

Typej

x

i

P

M

j

N

j

sup

-LRB-

mark

-LRB-

occ

-LRB-

x

N

-RRB-

-RRB-

-LRB-

-LSB-

x

P

-RSB-

M

j

-RRB-

j

-LRB-

-LRB-

x

P

-RRB-

N

j

-RRB-

j

N

j

P

ropj

x

i

P

M

j

N

j

-LRB-

-LSB-

x

r

P

-RSB-

M

j

-RRB-

j

-LRB-

-LRB-

x

r

P

-RRB-

N

j

-RRB-

j

-LCB-

Proofs

N

j

P

ropj

x

i

P

M

j

N

j

sup

-LRB-

mark

-LRB-

occ

-LRB-

x

N

-RRB-

-RRB-

-LRB-

-LSB-

x

P

-RSB-

M

j

-RRB-

j

-LRB-

-LRB-

x

P

-RRB-

N

j

-RRB-

j

ffl

Application

-LCB-

Propositional

schemes

M

j

-LRB-

-LRB-

x

i

P

-RRB-

N

j

-RRB-

Ri

P

ropi

P

i

m

P

ropi

-LRB-

M

j

Ri

-RRB-

-LRB-

N

j

-LSB-

xi

Ri

-RSB-

-RRB-

M

j

-LRB-

-LRB-

x

i

P

-RRB-

N

j

-RRB-

Ri

Qi

Qi

P

ropi

P

i

m

Qi

-LRB-

M

j

Rr

-RRB-

-LRB-

N

j

-LSB-

xr

Rr

-RSB-

-RRB-

-LCB-

Proofs

M

j

-LRB-

-LRB-

x

i

P

-RRB-

N

j

-RRB-

Ri

Qi

Qi

P

ropi

P

i

m

Qi

-LRB-

M

R

-RRB-

-LRB-

N

-LSB-

x

R

-RSB-

-RRB-

ffl

Equality

M

i

N

i

P

i

Ki

N

i

m

P

i

M

i

P

i

m

is

inductively

defined

as

in

Fm

by

induction

Definition

we

inductively

define

m

by

M

i

N

i

M

i

m

N

i

M

i

m

N

i

M

i

m

N

i

N

i

m

P

i

M

i

m

M

i

N

i

m

M

i

M

i

m

P

i

M

c

m

N

c

M

r

m

N

r

-LRB-

-LSB-

X

i

A

-RSB-

M

c

-RRB-

c

m

-LRB-

-LSB-

X

i

A

-RSB-

N

c

-RRB-

c

-LRB-

-LSB-

X

i

A

-RSB-

M

r

-RRB-

r

m

-LRB-

-LSB-

X

j

A

-RSB-

N

r

-RRB-

r

M

c

m

N

c

M

r

m

N

r

-LRB-

-LRB-

X

i

A

-RRB-

M

c

-RRB-

c

m

-LRB-

-LRB-

X

i

A

-RRB-

N

c

-RRB-

c

-LRB-

-LRB-

X

i

A

-RRB-

M

r

-RRB-

r

m

-LRB-

-LRB-

X

j

A

-RRB-

N

r

-RRB-

r

M

c

m

N

c

P

i

m

Qi

-LRB-

M

c

P

i

-RRB-

c

m

-LRB-

N

c

Qi

-RRB-

c

M

r

m

N

r

P

i

m

Qi

-LRB-

M

r

P

j

-RRB-

c

m

-LRB-

N

r

Qk

-RRB-

r

One

can

notice

that

the

case

of

dependent

types

has

been

dealt

by

the

typing

rules

If

there

is

a

dependence

from

a

lower

level

to

a

higher

level

than

the

term

realizing

this

dependence

is

marked

with

an

r

So

it

will

be

erased

by

extraction

hence

we

will

obtain

a

term

typable

in

F

by

extraction

We

define

the

extraction

function

as

follows

Definition

The

function

EXCCm

is

inductively

defined

by

ffl

EXCCm

-LRB-

P

ropc

-RRB-

P

rop

ffl

EXCCm

-LRB-

-LRB-

-LRB-

x

r

M

-RRB-

N

c

-RRB-

c

-RRB-

EXCCm

-LRB-

N

i

-RRB-

ffl

EXCCm

-LRB-

-LRB-

-LRB-

x

c

M

-RRB-

N

c

-RRB-

c

-RRB-

-LRB-

x

M

-RRB-

EXCCm

-LRB-

N

i

-RRB-

ffl

EXCCm

-LRB-

-LRB-

-LSB-

x

r

M

-RSB-

N

c

-RRB-

c

-RRB-

EXCCm

-LRB-

N

i

-RRB-

ffl

EXCCm

-LRB-

-LRB-

-LSB-

x

c

M

-RSB-

N

c

-RRB-

c

-RRB-

-LSB-

x

M

-RSB-

EXCCm

-LRB-

N

i

-RRB-

ffl

EXCCm

-LRB-

-LRB-

M

c

N

r

-RRB-

c

-RRB-

EXCCm

-LRB-

M

c

-RRB-

ffl

EXCCm

-LRB-

-LRB-

M

c

N

c

-RRB-

c

-RRB-

-LRB-

EXCCm

-LRB-

M

c

-RRB-

EXCCm

-LRB-

N

c

-RRB-

-RRB-

Theorem

-LRB-

Validity

of

EXCCm

-RRB-

If

M

c

N

c

in

CCm

then

EXCCm

-LRB-

-RRB-

EXCCm

-LRB-

M

c

-RRB-

EXCCm

-LRB-

N

c

-RRB-

is

valid

both

in

the

Calculus

of

Constructions

and

F

Proof

The

proof

is

essentially

the

same

as

done

in

section

For

the

application

abstraction

product

introduction

of

variables

it

is

exactly

similar

Only

the

case

of

type

equality

is

different

But

since

it

has

been

shown

that

if

M

c

m

N

c

implies

that

EXCCm

-LRB-

M

c

-RRB-

EXCCm

-LRB-

N

c

-RRB-

which

is

shown

in

the

proof

of

the

validity

of

EXFm

then

the

first

part

of

the

demonstration

is

ended

Now

we

have

still

to

show

that

the

extracted

term

is

well

typed

in

F

Since

we

have

erased

the

dependences

of

inferior

types

to

superior

types

we

can

apply

the

result

shown

in

-LSB-

-RSB-

to

prove

that

the

term

is

well

typed

in

F

Theorem

One

can

simulate

Paulin

's

extraction

in

the

calculus

of

constructions

in

CCm

Proof

The

simulation

will

be

conducted

in

the

same

manner

as

for

the

calculus

of

constructions

restricted

to

the

second

order

If

a

term

is

typed

by

P

rop

in

Paulin

's

system

we

will

type

it

by

P

ropr

in

CCm

and

if

it

is

typed

by

Set

we

will

type

it

by

P

ropc

in

CCm

We

have

already

shown

that

under

these

assumptions

the

terms

marked

with

an

r

in

our

system

and

terms

having

an

empty

content

in

Paulin

's

system

correspond

Moreover

we

know

that

the

dependences

are

handled

correctly

Hence

the

result

announced

Conclusion

and

future

works

We

have

proposed

a

new

frame

to

report

on

problems

linked

to

extraction

the

marking.This

new

approach

allows

us

to

unify

various

approaches

known

in

this

domain

By

modifying

some

aspects

of

a

marking

system

i.e.

the

extraction

function

and

the

initial

conditions

one

can

simulate

all

of

the

extraction

techniques

So

it

seems

that

marking

is

a

sound

point

of

view

Moreover

marking

systems

are

flexible

The

user

can

if

he

wants

to

mark

certain

parts

of

the

proof

tree

The

system

will

then

just

check

that

the

marking

rules

can

be

applied

to

find

a

term

with

such

a

marking

By

using

this

flexibility

and

soundness

approach

we

have

been

able

to

extend

immediately

Berardi

and

Boerio

's

approach

regarding

sub

-LCB-

typing

to

second

order

To

higher

orders

one

could

easily

find

a

semantics

of

extraction

The

observational

equality

was

a

good

device

to

conduct

extraction

An

interesting

work

is

suggested

by

the

research

of

such

a

device

for

higher

orders

Indeed

if

we

have

shown

that

extraction

is

valid

for

higher

orders

it

still

remains

to

find

how

to

build

a

marking

satisfying

some

condition

on

the

extracted

term

In

-LSB-

-RSB-

Paulin

has

developed

a

notion

of

realizability

to

encounter

this

problem

It

is

maybe

a

good

way

to

go

further

in

the

understanding

of

marking

but

one

can

also

try

to

develop

a

semantics

based

on

c.p.o.

or

another

interpretation

domain

One

can

also

remark

that

we

have

developed

a

specific

approach

for

the

Calculus

of

Construction

We

have

chosen

to

perform

extraction

with

F

as

target

language

This

has

led

to

introduce

the

rules

which

explicitly

destroy

the

dependences

of

low

level

to

high

level

One

could

now

study

what

would

happen

if

we

choosed

to

extract

within

the

Calculus

of

Constructions

how

the

mark

are

going

to

react

Are

they

going

to

behave

like

in

our

proposed

system

and

destroy

by

themselves

dependences

In

the

future

we

will

work

on

the

Calculus

of

Construction

with

marks

to

provide

a

theoretical

study

which

is

still

to

be

done

Also

we

will

try

to

develop

a

logical

point

of

view

for

various

software

techniques

as

we

have

done

here

for

marking

Acknowledgments

This

part

is

dedicated

to

the

shadow

workers

who

by

their

numerous

and

clever

remarks

or

questions

have

contributed

very

broadly

to

this

work

Among

them

I

would

like

to

cite

P.

Audebaud

and

C.

Paulin

Every

discussion

brings

its

part

of

creation

Many

people

have

helped

me

more

than

they

can

imagine

and

I

am

afraid

to

not

really

value

well

their

importance

To

all

those

people

I

can

just

say

thank

you

and

try

to

pay

them

back

with

words

and

remarks

which

will

-LRB-

i

hope

-RRB-

bring

them

the

spark

they

look

for

just

as

they

have

done

for

me

I

also

would

like

to

thank

M.

Gengler

for

his

very

deep

and

helpful

proofreading

Bibliography

-LSB-

-RSB-

S.

Berardi

Pruning

Simply

terms

Technical

Report

Turin

University

-LSB-

-RSB-

L.

Boerio

Extending

Pruning

Techniques

to

Polymorphic

Second

Order

Calculus

Technical

Report

Turin

University

-LSB-

-RSB-

S.Berardi

L.

Boerio

Using

Subtyping

in

Program

Optimization

Proc

of

TLCA

in

Lectures

Note

in

Computer

Science

Springer-Verlag

-LSB-

-RSB-

R.L.

Constable

et

al.

Implementing

Mthematics

with

the

Nuprl

Proff

Development

System

Prentice

Hall

-LSB-

-RSB-

C.

Cornes

et

al.

The

Coq

Proff

Assistant

Reference

Manual

technical

Report

INRIA

-LSB-

-RSB-

J.-Y

Girard

Interpr?etation

fonctionnelle

et

elimination

des

coupures

de

l'arithm

etique

d'ordre

sup?erieur.

PhD

thesis

Universit?e

Paris

-LSB-

-RSB-

C.

Goad

Proofs

as

description

of

computation

Proc

of

the

Conference

on

Automated

Deduction

Les

Arcs

Lectures

Notes

in

Computer

Science

Springer-Verlag

-LSB-

-RSB-

G.

Huet

A

uniform

approach

to

type

theory

Logical

foudations

of

functionnal

programing

AddisonWesley

-LSB-

-RSB-

C.

Paulin

Extraction

de

programmes

dans

le

calcul

des

constructions

PhD

thesis

Unniversit?e

Paris

-LSB-

-RSB-

C.

Paulin

Informative

contents

as

annotations

in

the

Calculus

of

Inductive

Constructions

Manuscript

-LSB-

-RSB-

Y.

Takayama

Extraction

of

Redundancy-free

Programs

from

Constructive

Natural

Deduction

Proofs

Journal

of

Symbolic

Computation