adjointlogic and its concurrent semanticsfp/talks/edinburgh17-talk.pdfadjointlogic and its...
TRANSCRIPT
Adjoint LogicandItsConcurrentSemantics
FrankPfenningABCDMeeting,Edinburgh,December18-19,2017JointworkwithKlaas Pruiksma andWilliamChargin
Outline
• Proofsasprograms• Linearsequentproofsasconcurrentprograms
• Take1:standardsequentcalculus=synchronouscommunication• Take2:unary⊗Rand–oR• Take3:positiveaxiomaticform=asynchronouscommunication
• Adjoint logic• Structuralpropertiesandmodesoftruth• DeclarationofIndependence
• Concurrentoperationalsemantics• Contraction,weakening,multicut,andmulti-identity• Garbagecollection
12/19/17 ABCDMeeting,Edinburgh 2
ProofsasPrograms
• Codesign oflanguageanditsreasoningprinciples• Threelevelsofcorrespondence
• Propositionsastypes• Proofsasprograms• Proofreductionascomputation
• Styleofproofsystemiscriticaltocharacterizecomputation• Axiomaticstyle⟺ combinators andcombinatoryreduction[Curry’35]• Naturaldeduction⟺ λ-calculusandsubstitution[Howard’69]• Sequentcalculus⟺ explicitsubstitutions[Herbelin’94]
• Allintuitionisticandstructural(admittingweakening&contraction)
12/19/17 ABCDMeeting,Edinburgh 3
LinearProofsasSession-TypedPrograms
• Threelevelsofcorrespondence• Linearpropositionsassessiontypes• Sequentproofsasconcurrentprograms• Cutreductionascommunication
• Intuitionisticvariant:provider/clientmodel[Caires &Pf’10]• Noneedtodualize types• Dependenttypes[Toninho etal.’11]• Monadicintegrationwithfunctionallanguage(SILL)[Toninho’15][Griffith’15]• Integrationinimperativelanguage(CC0)[Willsey etal.16]• Polymorphismandlogicalrelations[Perezetal.’13]• Exploitingcategoricalview(thistalk)
• Classicalvariant:symmetriccommunication• [Wadler’12][Caires etal.’16]
12/19/17 ABCDMeeting,Edinburgh 4
Outline
• Proofsasprograms• Linearsequentproofsasconcurrentprograms
• Take1:standardsequentcalculus=synchronouscommunication• Take2:unary⊗Rand–oR• Take3:positiveaxiomaticform=asynchronouscommunication
• Adjoint logic• Structuralpropertiesandmodesoftruth• DeclarationofIndependence
• Concurrentoperationalsemantics• Contraction,weakening,multicut,andmulti-identity• Garbagecollection
12/19/17 ABCDMeeting,Edinburgh 5
� ` c : A �0, c : A ` e : C
�,�0 ` e : Ccut
CutasParallelComposition
c:A
provideschannelc:AprocessP processQ
usedby
ΔΔ’
e :C
whichprovidese:C
processconfigurationalwaysformsatree
12/19/17 ABCDMeeting,Edinburgh 6
CutasProcessSpawn
c:A
Δ’
e :C
Δ
x :A
ΔΔ’
e :C
� ` c : A �0, c : A ` e : C
�,�0 ` e : Ccut
12/19/17 ABCDMeeting,Edinburgh 7
IdentityasIdentification
d : A ` c : Aid
d:A c:A
d=c:A
transitionofconfigurationmodelscutofanyproofwithidentity
12/19/17 ABCDMeeting,Edinburgh 8
Tensor,Original
x :A
ΔΔ’
c:A⊗ B
� ` x : A �0 ` c : B�,�0 ` c : A⌦B
⌦R
c:B
Δ
Δ’ c:B
d :A
12/19/17 ABCDMeeting,Edinburgh 9
Tensor,Simplified
c:A⊗ B
c:B
d :A
� ` c : B�, d : A ` c : A⌦B
⌦R⇤
cutreductionpredisposestosynchronoussemantics
d :A
12/19/17 ABCDMeeting,Edinburgh 10
Interderivable usingIdentityandCut
A ` Aid
� ` B�, A ` A⌦B
⌦R
� ` A�0 ` B
�0, A ` A⌦B⌦R⇤
�,�0 ` A⌦Bcut
12/19/17 ABCDMeeting,Edinburgh 11
TensorasaMessage
d : A, c0 : B ` c : A⌦B⌦RA
c:A⊗ B
c’:B
d :A
c’:B
d :A
asynchronousmessagesendingd:Aalongc:A⊗ Bwithcontinuationc’:B
useaxiomaticformforpositiveprovidersornegativeclients(”senders”)
12/19/17 ABCDMeeting,Edinburgh 12
Interderivable with2cuts,2ids
A ` Aid
B ` Bid
A,B ` A⌦B⌦R
� ` A
�0 ` B A,B ` A⌦B⌦RA
�0, A ` A⌦Bcut
�,�0 ` A⌦Bcut
because⊗RAhasnocontinuationanasynchronoussemanticsseemsforced!
12/19/17 ABCDMeeting,Edinburgh 13
PositiveAxiomaticFormulation
• Forces(?)asynchronoussemantics• Restoresynchronouscommunicationviamode-neutralshifts[Pf&Griffith’15]• Canwriteall“sending”rulesasaxioms
• Rightrulesforpositiveconnectives• Leftrulesfornegativeconnectives
• Canhidethisfromsurfacesyntax,ifdesired
12/19/17 ABCDMeeting,Edinburgh 14
Outline
• Proofsasprograms• Linearsequentproofsasconcurrentprograms
• Take1:standardsequentcalculus=synchronouscommunication• Take2:unary⊗Rand–oR• Take3:positiveaxiomaticform=asynchronouscommunication
• Adjoint logic• Structuralpropertiesandmodesoftruth• DeclarationofIndependence
• Concurrentoperationalsemantics• Contraction,weakening,multicut,andmulti-identity• Garbagecollection
12/19/17 ABCDMeeting,Edinburgh 15
StructuralRules
• Weakening:donotneedtouseantecedents(affinelogic)• Contraction:mayreuseantecedents(strictlogic)• Weakening+contraction=structurallogic
• Compromisestheusualcutreductionandcutelimination!
� ` e : C�, c : A ` e : C
W�, c1 : A, c2 : A ` e : C
�, c : A ` e : CC
12/19/17 ABCDMeeting,Edinburgh 16
Adjoint Logic[Reed’09]
• Wouldliketohaveourcakeandeatit,too!• Allowweakening,contractionwheredesirableornecessary
• Challenges• Howdowemakesystemcoherent:linearremainslinear,etc.• Combinationshouldbeconservativeoveritsparts• Logically:cutelimination,identityelimination• Operationally:sessionfidelity,globalprogress(evenwithrecursion)• Uniformsyntaxandsemantics
12/19/17 ABCDMeeting,Edinburgh 17
ModesofTruth
• Modesoftruthk,m,n• EverypropositionAm hasanintrinsicmodeoftruthm• Everymodempossessesstructuralpropertiesσ(m)⊆{W,C}
• Itispossibletoaddexchangeasanoption,startingfromorderedlogic
• Modesarerelatedbypreorder≤,wherem≤kimpliesσ(m)⊆σ(k)
12/19/17 ABCDMeeting,Edinburgh 18
ModesofTruth,continued
• Syntaxofpropositions(andproofs)isuniformacrossallmodes
• Shift↑Ak referencespropositionAk inmodem,form≥k• Shift↓An referencespropositionAn inmodem,forn≥m
mknm
Am, Bm ::= Pm | Am ( Bm | N{` : A`m}`2L | "mk Ak
| Am ⌦Bm | 1 | �{` : A`m}`2L | #nmAn
12/19/17 ABCDMeeting,Edinburgh 19
Example:IntuitionisticLinearLogic
• UnrestrictedmodeUwithσ(U)={W,C}• LinearmodeLwithσ(L)={}• L<U• ModeUpopulatedonlybyshifts
AU ::= "ULAL
AL ::= AL ( BL | · · · | #ULAU
!AL , #UL "ULAL
12/19/17 ABCDMeeting,Edinburgh 20
Example:LNL[Benton’94]
• UnrestrictedmodeUwithσ(U)={W,C},withallconnectives• LinearmodeLwithσ(L)={}• L<U
m ::= L | U with L < U
Am, Bm ::= Pm | Am ( Bm | N{` : A`}`2L | "ULAL
| Am ⌦Bm | 1 | �{` : A`}`2L | #ULAU
AU ! BU , AU ( BU
12/19/17 ABCDMeeting,Edinburgh 21
OtherExamples
• IntuitionisticS4~stagedcomputation• U<V,σ(U)=σ(V)={W,C}
• Laxlogic~monadicencapsulation• X<U,σ(X)=σ(U)={W,C}
• Subexponential logic• Likeadjoint logic,distinguishedmodeL• Allothermodesmcontainonly↑AL
• !mAL ≜ ↓↑AL
mLm
LmL
12/19/17 ABCDMeeting,Edinburgh 22
TheDeclarationofIndependence
• Keytoobtainingcoherence,conservativity,cutelimination,uniformity• Ψ ::=ε |Am |Ψ1,Ψ2 where‘,’isassociative,commutative,w/unitε• Ψ ≥mifk≥mforeveryAk inΨ
• TruthofAm mustbeindependentfromallAk fork≥m
Ψ ⊢ Am iswell-formedonlyifΨ ≥m
12/19/17 ABCDMeeting,Edinburgh 23
RulesforAdjoint Logic
• Logicalrulesunchanged,stayatsame,butarbitrarymodem• Structuralrulesdependonmodeproperties
W 2 �(m) � ` e : Cr
�, c : Am ` e : CrW
C 2 �(m) �, c1 : Am, c2 : Am ` e : C
�, c : Am ` e : CrC
12/19/17 ABCDMeeting,Edinburgh 24
RulesforShift
• Derivedentirelyfromdeclarationofindependence
12/19/17 ABCDMeeting,Edinburgh 25
` Ak
` "mk Ak"R k � r , Ak ` Cr
, "mk Ak ` Cr"L
� n ` An
` #nmAn#R , An ` Cr
, #nmAn ` Cr#L
JudgmentalRules
• Cutandidentityarethemostinterestingrules• Standardargumentforcuteliminationdoesnotworkinthepresenceofexplicitcontraction• ReturntoGentzen (1935):Multicut
12/19/17 ABCDMeeting,Edinburgh 26
Multicut
• Somerestrictionsforcedbydeclarationofindependence
• IfWϵσ(m),thenn=0isallowed• IfCϵσ(m),thenn>1isallowed• Provideris“awareof”allclientchannelsc
12/19/17 ABCDMeeting,Edinburgh 27
c = (c1, . . . , cn) � m � r ` c : Am 0, c1:Am, . . . , cn:Am ` e : Cr
, 0 ` e : Crmcut⇤
Multi-identity
• Providermightbecommunicatingwithmultipleclients
• IfWϵσ(m),then|c|=0isallowed• IfCϵσ(m),then|c|>1isallowed
d : Am ` c : Amid⇤
12/19/17 ABCDMeeting,Edinburgh 28
Outline
• Proofsasprograms• Linearsequentproofsasconcurrentprograms
• Take1:standardsequentcalculus=synchronouscommunication• Take2:unary⊗Rand–oR• Take3:positiveaxiomaticform=asynchronouscommunication
• Adjoint logic• Structuralpropertiesandmodesoftruth• DeclarationofIndependence
• Concurrentoperationalsemantics• Contraction,weakening,multicut,andmulti-identity• Garbagecollection
12/19/17 ABCDMeeting,Edinburgh 29
ProcessInterpretation
• Transitionsdonotcareaboutmodesatruntime• However,somerulescareaboutthenumberofclientsaprocesshas• Inthisuniformsemantics,computationatallstructuralpropertiesisimplementedbymessagepassing• Transitionsofprocessconfigurationsmimiccutreductions(notcutelimination)• Shiftssendandreceive’shift’messageswhichsynchronize[Pf&Griffith’15]
12/19/17 ABCDMeeting,Edinburgh 30
Multicut,ProcessInterpretation
c1 :A
cn :A
c:A ci :A
c=c1,…,cn
providershouldknowaboutallclientchannels
oneproviderwithmultipleclients
12/19/17 ABCDMeeting,Edinburgh 31
withoutmodes,toemphasizedynamicmodeindependence
� ` c : A �0, c1:A, . . . , cn:A ` e : C
�,�0 ` e : Cmcut
KeyIdea:Contraction=Identity+Multicut
c : A ` c : Aid
�, c1 : A, c2 : A ` e : C
�, c : A ` e : Cmcut
c:A
c:Ac1 :A
c2 :A
c:A
12/19/17 ABCDMeeting,Edinburgh 32
KeyIdea:IdentityPropagation
• Helpstoimplementbothdrop(W)andcopy(C)• Distributedgarbagecollection“forfree”
b :A
dn :A
b,d:A d1 :A
c:A
dn :A
c,d:A d1 :A
c1 :Ack :A
c1 :A
ck :A
12/19/17 ABCDMeeting,Edinburgh 34
KeyIdeas:MulticastandCopy-on-Receive
• Positivetypes(e.g.,A⊗ B)domulticast,iftherearemultipleclients• Negativetypes(e.g.,A–oB)copy-on-receive,iftherearemultipleclients• Previousworkon!Aonlyperformedcopy-on-receive
12/19/17 ABCDMeeting,Edinburgh 35
OngoingandFutureWork
• Exploitindependenceprinciplefornon-uniformsemantics• S=shared,U=unrestricted,L=linearwithS≤U,U≤S,L<U,L<Sandσ(S)=σ(U)={C,W},σ(L)={}[Balzer &Pf,2017]
• H=locallyheap-allocated,L=linear,L<Hwithσ(H)=?,σ(L)={}• Proofirrelevance,intensional equality[Pf’01]• Ghostmessagesforcontractsandreasoningaboutdistributedcomputation
• Isthereageneraltheoremaboutnon-uniformcompatibility?• Surfacesyntax?(Uniformispossible,uptoapoint)• Generalimplementation
12/19/17 ABCDMeeting,Edinburgh 36
Summary
• Adjoint logiccombineslogicscoherentlyandconservatively• Shiftscomposetoamonad(oneorder)andcomonad (otherorder)• DeclarationofIndependenceenableskeyresults
• Cutelimination,identityelimination• Conservativeextensionovercombinedfragments
• Uniformmessage-passingsemanticsviamulticut andidentity• Contraction=identity+multicut forn>1• Weakening=identity+multicut forn=0• Distributedgarbagecollection=identitypropagation
12/19/17 ABCDMeeting,Edinburgh 37