<<

App eared in SIGACT

Linear Logic

Patrick Lincoln

lincolncslsricom

SRI and Stanford University

Linear Logic

Linear logic was intro duced by Girard in Since then many results have supp orted

Girards claims such as Linear logic is a resource conscious logic Increasingly computer

scientists have recognized linear logic as an expressive and p owerful logic with deep connec

tions to concepts from computer science The expressive p ower of linear logic is evidenced by

some very natural enco dings of computational mo dels such as Petri nets counter machines

Turing machines and others

This note presents an intuitive overview of linear logic some recent theoretical results

and some interesting applications of linear logic to computer science Other intro ductions

to linear logic may b e found in

Linear Logic vs Classical and Intuitionistic Logics

Linear logic diers from classical and in several fundamental ways Clas

sical logic may b e viewed as if it deals with static prop ositions ab out the world where each

prop osition is either true or false Because of the static nature of prop ositions in classical

logic one may duplicate prop ositions P implies P and P Implicitly we learn that one

P is as go o d as two Also one may discard prop ositions P and Q implies P Here the

prop osition Q has b een thrown away Both of these sentences are valid in

for any P and Q

In linear logic these sentences are not valid A linear logician might ask Where did the

second P come from and Where did the Q go Of course these questions are nonse

quiturs in the classical setting since prop ositions are assumed to b e static unchanging facts

ab out the world On the other hand the rules of linear logic imply that linear prop ositions

stand for dynamic prop erties or nite resources

For example consider the prop ositions D M and C conceived as resources



D One Dollar



M A pack of Marlb oros



C A pack of Camels

Consider the following axiomatization of a vending machine

D implies M

D implies C

Then in classical or intuitionistic logic one is able to deduce

D implies M and C

Which may b e read as With one dollar I may buy b oth a pack of Marlb oros and a pack of

Camels Although this deduction is valid in classical logic it is nonsense in the intended

interpretation of prop ositions as resources one cannot buy two packs of cigarettes with one

dollar from the vending machine describ ed This paradox arises out of the confusion in

classical and intuitionistic logic b etween two kinds of conjunction one intuitively meaning

I have b oth which is written in linear logic as and another meaning I have a choice

written in linear logic

Linear logic avoids such paradoxes by distinguishing two kinds of conjunction two kinds

of disjunction and by intro ducing a mo dal storage op erator that explicitly marks those

prop ositions that can b e arbitrarily reused

? ? ?

Linear A is involutive that is A A but is yet constructive This is one

of the fascinating asp ects of linear logic

Linear logic multiplicative conjunction A B stands for the prop osition that one has

b oth A and B at the same time The linear logic additive conjunction AB stands for

ones own choice b etween A and B but not b oth Dually there are two disjunctions

The multiplicative disjunction written A B stands for the prop osition if not A then B

Perhaps this disjunction can b e more easily understo o d by considering linear implication

?

A B which is dened by A B The formula A B can b e thought of as can B b e

derived using A exactly once The additive disjunction A B stands for the p ossibility of

either A or B but you dont know which That is someone elses choice

For each of these connectives there is a unit is the unit of so A A and

A A is the unit of is the unit of and is the unit of

Exp onentials

To complete the logic there is a mo dal storage op erator of course and its dual why

not The formula A may b e thought of as a printing press for As which can generate any

numb er of As For example the US government can b e thought to have D ol l ar s and

do esnt need to balance its budget while citizens do not have D ol l ar s and thus have to

balance their budgets

Example

To illustrate the use of linear connectives and mo dal op erators here is an example inspired

by Girard and Lafont Supp ose for a xed price a restaurant will provide a hamburger

a Coke as many french fries as you like onion soup or salad your choice and pie or ice

cream some elses choice One may enco de this information in the linear logic formula

b eside the menu

FixedPrice Menu D D D D D

Hamburger

Coke H C F O S P I

All the french fries you can eat

Onion Soup or Salad

Pie or Ice Cream dep ending on availability

Notation for Linear Logic

The entire set of Gentzenstyle sequent rules for linear logic are given at the end of this note

As explained ab ove the rules dene two conjunctions and two disjunctions as well as mo dal

and constant op erators One could add quantiers to form rst or higher order linear logic

but for this pap er we will restrict attention to prop ositional linear logic

The sequent calculus notation due to Gentzen uses roman letters for prop ositions

and greek letters for sequences of formulas A sequent is comp osed of two sequences of

formulas separated by a or symb ol One may read the sequent as asserting

that the multiplicative conjunction of the formulas in together imply the multiplicative

disjunction of the formulas in

A sequent calculus proof rule consists of a set of hyp othesis sequents displayed ab ove a

horizontal line and a single conclusion sequent displayed b elow the line as b elow

Hyp othesis Hyp othesis

Conclusion

Connections to Other Logics

The most interesting features of linear logic arise from the absence of the rules of contraction

and weakening In classical or intuitionistic logic the following rules are allowed

A A

Contraction Left Weakening Left

A A

Direct and Ane logic share with linear logic the elimination of the contraction rule

ieprop ositions cannot b e arbitrarily copied However b oth of these logics allow weakening

Relevance and Pertinent logic disallow weakening but allow contraction ieprop ositions

cannot b e arbitrarily discarded but can b e copied Pertinent logic is decidable but

Relevance logic adds a distributivity axiom which is absent from linear logic which makes

Relevance logic undecidable Linear logic disallows b oth weakening and contraction in

general although they are allowed for mo dal and formulas

Linear logic arose partly out of a study of intuitionistic implication Girard found that

the intuitionistic implication A B could b e decomp osed into two separate connectives

A B Girard showed that one could thus translate intuitionistic and also classical logic

into linear logic directly simply app ending mo dals to certain subformulas and making the

right choice as to which sort of conjunction and disjunction should b e used Here we see a

rst glimpse of the substance b ehind the slogan Linear logic is a logic b ehind logics

Connections to Computer Science

There has b een much recent excitement ab out linear logic in the logicbased theoretical

computer science community Most of this excitement stems from the newfound ability to

capture dicult resource problems logically For example linear logic provides a natural

and simple enco ding of Petri net reachability In linear logic the formula a c b may

b e used to enco de a Petri net transition taking tokens from place a and c and adding a token

to place b Similarly the formula b d d c d may b e seen as a transition taking

one token from b and two tokens from d and adding one token to c These transitions are

presented graphically b elow

A B

 

 

a c b

b d d c d



J

a c d d

J

J

J

J

J

C D

 

J

J



 

Thus one can enco de Petri net transitions as reusable linear implications Tokens are

represented as atomic prop ositions and a reachability problem may b e presented as a se

quent

a c b b d d c d a c d d c d

This sequent is provable in linear logic if and only if there is a sequence of Petri net

rule applications that transform the token set fa c d dg to fc dg This connection has b een

wellstudied and extended to cover other mo dels of concurrency

Linear logic has also b een applied to several other areas of computer science One key

application of the resourcesensitive asp ect of the logic was the development of a functional

programming language implementation in which garbage collection was replaced by explicit

duplication op erations based on linear logic More recent work has attempted to nd

a linear logical basis for many optimizations in lazy functional programming language

implementations by concentrating on linear logic as a typ e system

Other applications include analyzing the control structure of logic programs general

ized and natural language pro cessing A natural characteri

zation of p olynomial time computations can b e given in a b ounded version of linear logic

obtained by limiting reuse to sp ecied b ounds ie by b ounding the numb er of references

to each datum in memory

We now turn our attention to some questions of a more theoretical nature

Complexity Results for Linear Logic

Although prop ositional linear logic was known to b e very expressive for some time it was

thought to b e decidable However prop ositional linear logic was recently shown to b e un

decidable Several other complexity results are given in including the pspace

completeness of prop ositional linear logic without or

A key op en complexity problem is the decision problem for the fragment of

linear logic An equivalent fragment is which suces for the enco ding of Petri

net reachability questions as shown ab ove and thus is at least expspacehard It is

currently unknown if this multiplicativeexp onential fragment of linear logic is decidable or

not

Undecidability of Prop ositional Linear Logic

The full pro of of undecidability is presented in and is sketched b elow

The pro of of the undecidability of full linear logic pro ceeds by reduction of a form of alter

nating counter machine to prop ositional linear logic An andbranching twocounter machine

ACM is a nondeterministic machine with a nite set of states A conguration is a triple

hQ A B i where Q is a state and A and B are natural numb ers the values of two coun

i i

ters An ACM has a nite set of instructions of ve kinds IncrementA IncrementB

DecrementA DecrementB and Fork The Increment and Decrement instructions

op erate as they do in standard counter machines The Fork instruction causes a ma

chine to split into two indep endent machines from state hQ A B i a machine taking the

i

transition Q ForkQ Q results in two machines hQ A B i and hQ A B i Thus an instan

i j k j k

taneous description is set of machine congurations which is accepting only if all machine

congurations are in the nal state and all counters are zero ACMs have an undecidable

halting problem One may notice that ACMs are essentially alternating Petri nets It is

convenient to use ACMs as opp osed to standard counter machines to show undecidability

since zerotest has no natural counterpart in linear logic but there is a natural counterpart

of Fork the additive conjunction The remaining ACM instructions may b e enco ded

using techniques very similar to the Petri net rechability enco ding describ ed earlier

Linear logic has a great control over resources through the elimination of weakening and

contraction and the explicit addition of a resuable mo dal op erator Although the logic

do es not have quantiers the combination of these features yields a great deal of expressive

p ower

Complexity of Fragments of Linear Logic

PSPACEcompleteness of Linear Logic Without

The multiplicativeadditive fragment of linear logic MALL excludes the reusable mo dals

Thus every formula is used at most once in any branch of any cutfree MALL

pro of Also in every noncut MALL rule each hyp othesis sequent has a smaller numb er

of symb ols than the conclusion sequent This provides an immediate linear b ound on the

depth of cutfree MALL pro ofs Since MALL enjoys a cutelimination prop erty there is a

nondeterministic PSPACE algorithm to decide MALL sequents

To show that MALL is PSPACEHard one can enco de classical quantied b o olean for

mulas QBF For simplicity one may assume that a QBF is presented in prenex form The

quantierfree formula may b e enco ded using truth tables but the quantiers present some

? ?

diculty One may enco de quantiers using the additives x as xx and x as x x

This enco ding has incorrect b ehavior in that it do es not resp ect quantier order but using

multiplicative connectives one can enforce an ordering up on the enco ding of quantiers to

achieve soundness and completeness The full pro of of pspacecompleteness is presented

in

NPcompleteness of Multiplicative Linear Logic

The multiplicative fragment of linear logic contains only the connectives and or equiv

alently and a set of prop ositions and the constants and The decision problem

for this fragment is in np since an entire cutfree multiplicative pro of may b e guessed and

checked in p olynomial time The decision problem is nphard by reduction from Partition

a problem which requires a p erfect partitioning of groups of ob jects in much the same way

that linear logic requires a complete accounting of prop ositions Somewhat surpris

ingly there is an alternate enco ding of Partition in multiplicative linear logic that do es not

use any prop ositions that is using only the constants and and the connectives and

Thus this multiplicative constantonly fragment of linear logic is also npcomplete

The full pro of of npcompleteness is presented in

Summary of Linear Logic Complexity

The following table summarizes some of the results thus far achieved in the study of the

complexity of the decision problems for fragments of linear logic The rst two fragments

listed are those discussed in some detail ab ove the full prop ositional logic and the prop osi

tional fragment without mo dals MALL The of the next problem is in some

question An enco ding of Petri net reachability problems in this fragment has b een studied

in but although expspacehard Petri net reachability is known to b e decidable

It is not known how much more expressive this fragment of linear logic might b e The fourth

fragment containing only the multiplicative connectives is NPComplete

Connectives Linear Logic

In Fragment Complexity

Undecidable

PSPACEComplete

unknown

NPComplete

In summary linear logic is an expressive logic with an intrinsic accounting of resources

Although a nonclassical logic linear logic has the pleasant features of cutelimination and in

volutive negation In practical use much mileage can b e gained from the resourcesensitivity

of linear logic to enco de dicult problems in even the prop ositional fragment of linear

logic Current work is progressing to exploit the unique features of linear logic for use

as a typ e system to study computational complexity and compiler optimization tech

niques as well as uses in logic programming natural language

pro cessing and concurrency These recent contributions are developing

linear logic from a theoretical curiosity into a to ol that already has practical use within

mainstream computer science

References

S Abramsky Computational interpretations of linear logic Theoretical Computer Science

Sp ecial Issue on the Workshop on Math Found Prog Semantics To app ear

S Abramsky and S Vickers Quantales observational logic and pro cess semantics Preprint

January

JM Andreoli Logic programming with fo cusing pro ofs in linear logic Draft

JM Andreoli and R Pareschi Linear ob jects Logical pro cesses with builtin inheritance

In Proc th International Conference on Logic Programming Jerusalem May

A Asp erti A logic for concurrency Technical rep ort Dipartimento di Informatica Universita

di Pisa

A Asp erti GL Ferrari and R Gorrieri Implicative formulae in the pro ofs as computations

analogy In Proc th ACM Symp on Principles of Programming Languages San Francisco

pages January

S Cerrito A linear semantics for allowed logic programs In Proc th IEEE Symp on Logic

in Computer Science Philadelphia June

J Chirimar C Gunter and J Riecke Linear ML In Lisp and Functional Programming

To App ear

V Gehlot and CA Gunter Normal pro cess representatives In Proc th IEEE Symp on

Logic in Computer Science Philadelphia June

G Gentzen Col lected Works Edited by ME Szabo NorthHolland Amsterdam

JY Girard Linear logic Theoretical Computer Science

JY Girard La logique lineaire Pour La Science Edition Francaise de Scientic American

April

JY Girard A Scedrov and PJ Scott Bounded linear logic A mo dular approach to

p olynomial time computability In SR Buss and PJ Scott editors Feasible Mathematics

A Mathematical Sciences Institute Workshop Ithaca New York June pages

Birkhauser Boston Also To App ear in TCS

CA Gunter and V Gehlot Nets as tensor theories In G De Michelis editor Proc

th International Conference on Application and Theory of Petri Nets Bonn pages

JC Guzman and P Hudak Singlethreaded p olymorphic lamb da calculus In Proc th

IEEE Symp on Logic in Computer Science Philadelphia June

JS Ho das and D Miller Logic programming in a fragment of intuitionistic linear logic In

Proc th Annual IEEE Symposium on Logic in Computer Science Amsterdam pages

IEEE Computer So ciety Press Los Alamitos California July Full pap er to app ear in

Information and Computation

M Kanovich The multiplicative fragment of linear logic is npcomplete Technical Rep ort

X Institute for Language Logic and Information June

M Kanovich Horn programming in linear logic is npcomplete In Proc th Annual IEEE

Symposium on Logic in Computer Science Santa Cruz IEEE Computer So ciety Press Los

Alamitos California June

J Ketonen and R Weyhrauch A decidable fragment of predicate calculus Theoretical Com

puter Science

SR Kosara ju Decidability of reachability in vector addition systems In Proc th ACM

Symp on Theory of Computing pages

Y Lafont The linear abstract machine Theoretical Computer Science

Y Lafont Interaction nets In Proc th ACM Symp on Principles of Programming Lan

guages San Francisco pages January

J Lamb ek The mathematics of sentence structure Amer Math Monthly

J Lamb ek From to bilinear logic Draft

P Lincoln and J Mitchell Op erational asp ects of linear lamb da calculus In Proc th Annual

IEEE Symposium on Logic in Computer Science Santa Cruz IEEE Computer So ciety Press

Los Alamitos California June

P Lincoln J Mitchell A Scedrov and N Shankar Decision problems for prop ositional linear

logic In Proc st IEEE Symp on Foundations of Computer Science pages

P Lincoln J Mitchell A Scedrov and N Shankar Decision problems for prop ositional linear

logic Technical Rep ort SRICSL CSL SRI International To app ear in Annals

of Pure and Applied Logic

P Lincoln and T Winkler Constant multiplicative linear logic is NPcomplete Draft

IC Mackie Lilac a functional programming language based on linear logic Masters thesis

Imp erial College London

N MartiOliet and J Meseguer From Petri nets to linear logic In Springer LNCS ed

by DH Pitt et al

E Mayr and A Meyer The complexity of the word problems for commutative semigroups

and p olynomial ideals Advances in Mathematics

RK Meyer Topics in Modal and ManyValued Logic PhD thesis University of Pittsburgh

M Minsky Recursive unsolvability of Posts problem of tag and other topics in the theory

of Turing machines Annals of Mathematics

P OHearn Linear logic and interference control In th Conf on Category Thoery and CS

VR Pratt Event spaces and their linear logic In Proc Second International Conference on

Algebraic Methodology and Software Technology SpringerVerlag

A Scedrov A brief guide to linear logic Bul letin of the European Assoc for Theoretical

Computer Science June

A Urquhart The undecidability of entailment and relevant implication Journal of Symbolic

Logic

J VanBentham Language in Action NorthHolland

P Wadler Is there a use for linear logic To App ear ACMIFIP PEPM

P Wadler Theres no substitute for linear logic Draft

D Wakeling and C Runciman Linearity and laziness In Proc th ACM Conference on

Functional Programming Languages and Computer Architecture SpringerVerlag

Denition of Linear Negation

 

? ? ? ?

p p p p

i i

i i

 

? ? ? ? ? ?

A B B A A B B A

 

? ? ? ? ? ?

A  B A B A B A  B

 

? ? ? ?

A A A A

 

? ?

? ?

 

? ?

> >

Sequent Calculus Rules for Linear Logic

` A A `

1 1 2 2

Cut Identity

A ` A

`

1 2 1 2

` A B A B `

1 2 1 2

Exch Right Exch Left

B A ` ` B A

1 2 1 2

A B ` ` A ` B

1 1 2 2

Left Right

A B ` ` A B

1 2 1 2

` A B ` A ` B

1 1 2 2

 Left  Right

A B ` ` AB

1 2 1 2

` A B A ` B `

1 1 2 2

Right Left

A B ` ` A B

1 2 1 2

` A ` B

A ` B `

Right Left

AB ` AB `

` AB

A ` B `

` A ` B

 Right  Left

` A  B ` A  B

A  B `

` A A `

W C

A ` A `

` A A `

S D

A ` `A

` `A A

W C

`A `A

` A A `

D S

`A A `

A ` ` A

? ?

Right Left

? ?

A ` ` A

Left ` ` > > Right

`

? Right ? Left ? `

` ?

`

Left ` Right

`