{"id":79,"date":"2006-07-18T16:16:51","date_gmt":"2006-07-18T16:16:51","guid":{"rendered":"http:\/\/scientopia.org\/blogs\/goodmath\/2006\/07\/18\/linear-logic\/"},"modified":"2006-07-18T16:16:51","modified_gmt":"2006-07-18T16:16:51","slug":"linear-logic","status":"publish","type":"post","link":"http:\/\/www.goodmath.org\/blog\/2006\/07\/18\/linear-logic\/","title":{"rendered":"Linear Logic"},"content":{"rendered":"<p>[Monday][yesterday], I said that I needed to introduce the sequent calculus, because it would be useful for describing things like linear logic. Today we&#8217;re going to take a quick look at linear logic &#8211; in particular, at *propositional* linear logic; you can expand to predicate linear logic in a way very similar to the way we went from propositional logic to first order predicate logic.<br \/>\nSo first: what the heck *is* linear logic?<br \/>\nThe answer is, basically, logic where statements are treated as *resources*. So using a statement in an inference step in linear logic *consumes* the resource. This is a strange notion if you&#8217;re coming from a regular predicate logic. For example, in regular predicate logic, if we have the statements: &#8220;A&#8221;, &#8220;A &rArr; B&#8221;, and &#8220;A &rArr; C&#8221;, we know that we can conclude &#8220;B &and; C&#8221;. In linear logic, that&#8217;s not true: using either implication statement would *consume* the &#8220;A&#8221;. So we could infer &#8220;B&#8221;, or we could infer &#8220;C&#8221;, but we could *not* infer both.<br \/>\nWhen people talk about linear logic, and why it makes sense, they almost always use a vending machine analogy. Suppose I walk up to a vending machine, and I want to buy a soda and a candy bar. I&#8217;ve got 8 quarters in my pocket; the soda costs $1.50; the candy bar costs $.75.<br \/>\nIn linear logic, I&#8217;d say something like the following (the syntax is wrong, but we&#8217;ll get to syntax later): (Q,Q,Q,Q,Q,Q,Q,Q), (Q,Q,Q,Q,Q,Q) &rArr; Soda, (Q,Q,Q) &rArr; Candy.<br \/>\nUsing the rules, I can by a soda by &#8220;spending&#8221; 6 of my Qs. I wind up with &#8220;(Q,Q) &and; Soda&#8221;, and &#8220;(Q,Q,Q) &rArr; Candy&#8221;. I&#8217;ve consumed 6 Qs, and I&#8217;ve consumed the &#8220;(Q,Q,Q,Q,Q,Q) &rArr; Soda&#8221; implication. I can&#8217;t do anything else; I don&#8217;t have enough Qs.<br \/>\nThe basic statements in linear logic, with intuitive meanings are:<br \/>\n1. A &otimes; B. This is called *multiplicative conjunction*, also known as *simultaneous occurrence*. This means that I definitely have both A and B. This has an *identity unit* called &#8220;1&#8221;, such that A &otimes; 1 &equiv; 1 &otimes; A &equiv; A. 1 represents the idea of the absence of any resource.<br \/>\n2. A &amp; B : *additive conjunction*, aka *internal choice*. I can have either A *or* B, and I get to pick which one. The unit is \u22a4, pronounced &#8220;top&#8221;, and represents a sort of &#8220;I don&#8217;t care&#8221; value.<br \/>\n3. A &oplus; B. This is called *additive disjunction*, also known as *external choice*. It means that I get either A or B, but I don&#8217;t get to pick which one. The unit here is 0, and represents the lack of an outcome.<br \/>\n4. A \u214b B  : *multiplicative disjunction*, aka *parallel occurence*; I *need to have* both A and B at the same time. The unit for this is &perp;, pronounced &#8220;bottom&#8221;, and represents the absence of a goal. In the vending machine metaphor, think of it as the &#8220;cancel&#8221; button on the vending machine: I decided I don&#8217;t want any, so I&#8217;m not going to spend my resources.<br \/>\n5. A -o B : Linear implication. Consume resource A to *produce* resource B. The normal symbol for this looks like an arrow with a circle instead of an arrowhead; this operator is often called &#8220;lolly&#8221; because of what the normal symbol looks like. I&#8217;m stuck writing it as &#8220;-o&#8221;, because there&#8217;s no HTML entity for the symbol.<br \/>\n6. !A : Positive exponentiation, pronounced &#8220;Of course A&#8221;. This *produces* an arbitrary number of As. Equivalent to A &otimes; !A.<br \/>\n7. ?A : Negative exponentiation, pronounced &#8220;Why not A?&#8221;. This *consumes*  As.<br \/>\nOk. So, suppose I want to talk about buying lunch. I&#8217;ve got 10 dollars to buy lunch. I&#8217;ll be full if I have a salad, a coke, and a tuna sandwich. If I wanted to write &#8220;I&#8217;ve got a dollar&#8221; as &#8220;D&#8221;, &#8220;I have a salad&#8221; as &#8220;S&#8221;, &#8220;I have a coke&#8221; as &#8220;C&#8221;,  &#8220;I have a  tuna sandwich&#8221; as &#8220;T&#8221;, and finally, &#8220;I&#8217;m full&#8221; as &#8220;F&#8221;<br \/>\n* I can write &#8220;I have 10 dollars&#8221; in LL as: &#8220;(D &otimes; D &otimes; D &otimes; D &otimes;  D &otimes; D &otimes; D &otimes; D&otimes; D &otimes; D)&#8221;.<br \/>\n* I can write &#8220;Tuna sandwich and salad and coke&#8221; as a group of things that I want to have all of as: &#8220;T \u214b S \u214b C&#8221;.<br \/>\n* I can say that I&#8217;ll be full if I have lunch as &#8220;T \u214b S \u214b C -o F&#8221;<br \/>\nIf I want to talk about buying lunch, I can describe the prices of the things I want using implication:<br \/>\n* A coke costs one dollar: &#8220;D -o C&#8221;; I can spend one dollar, and in return I get one coke.<br \/>\n* A salad costs 3 dollars: &#8220;(D &otimes; D &otimes; D) -o S&#8221;<br \/>\n* A tuna sandwich also costs three dollars: &#8220;(D &otimes; D &otimes; D) -o S&#8221;<br \/>\nNow, I can do some reasoning with these.<br \/>\n* By taking 1 of the dollars, I can get one C. That leaves me with &#8220;D &otimes; D &otimes; D &otimes; D &otimes;  D &otimes; D &otimes; D &otimes; D&otimes; D &otimes; C&#8221;<br \/>\n* By taking 3 D, I can get one S. &#8220;D &otimes;  D &otimes; D &otimes; D &otimes; D&otimes; D &otimes; C &otimes; S&#8221;.<br \/>\n* By taking 3 D, I can get one T. &#8220;D &otimes; D&otimes; D &otimes; C &otimes; S &otimes; T&#8221;.<br \/>\n* Now I&#8217;ve got my lunch. I can eat it and be full, with three dollars left: &#8220;D &otimes; D&otimes; D &otimes; F&#8221;.<br \/>\nJust from this trivial example, you should be able to see why linear logic is cool: the idea of being able to talk about *how* resources are used in an inference process or a computation is really valuable, and linear logic gives you the ability to really work with the concept of resource in a solid, formal way. If you think of it in terms of the Curry-Howard isomorphism [types-as-proofs concept from the simply typed lambda calculus][types-as-proofs], you can imagine using linear logic for types of values that are *consumed* by a computation &#8211; i.e., they&#8217;re no longer available once they&#8217;ve been used.<br \/>\nI&#8217;m going to adopt a slightly different format for the sequents for working in linear logic. The way that I produced the center bars in yesterdays post was really painful to write, and didn&#8217;t even end up looking particularly good. So, the way that I&#8217;m going to right the sequents in this post is to wrap the &#8220;top&#8221; and &#8220;bottom&#8221; of the sequent in curly braces, and separate them by a &#8220;&rArr;&#8221;, as in:<\/p>\n<p>{GivenContext :- GivenEntailment } &rArr; { InferredContext :- InferredEntailment}<\/p>\n<p>Now, let&#8217;s take a look at the sequent rules for propositional linear logic. I&#8217;m using the version of these rules from [Patrick Lincoln&#8217;s SIGACT &#8217;92 paper][sigact92]. Yeah, I know that&#8217;s a bit of a big load there. Don&#8217;t worry about it too much; the important part is the concept described up above; the sequents are useful to look at when you have a hard time figuring out what some operator means in inference. For example, you can see the difference between &amp; and &oplus; (which I found confusing at first) by looking at their sequents, to see what they do.<br \/>\n1. **Identity**: { } &rArr; { A :- A }<br \/>\n2. **Cut**: { &Gamma;<sub>1<\/sub> :- A, &Sigma;<sub>1<\/sub> &emsp; &Gamma;<sub>2<\/sub>, A :- &Sigma;<sub>2<\/sub> } &rArr; { &Gamma;<sub>1<\/sub>, &Gamma;<sub>2<\/sub> :- &Sigma;<sub>1<\/sub>,&Sigma;<sub>2<\/sub>}<br \/>\n3. **Exchange Left**: { &Gamma;<sub>1<\/sub>, A, B, &Gamma;<sub>2<\/sub> :- &Sigma; } &rArr;  { &Gamma;<sub>1<\/sub>, B, A, &Gamma;<sub>2<\/sub> :- &Sigma; }<br \/>\n4. **Exchange Right**: { &Gamma; :- &Sigma;<sub>1<\/sub>, A, B, &Sigma;<sub>2<\/sub> } &rArr;  { &Gamma; :- &Sigma;<sub>1<\/sub>, B, A, &Sigma;<sub>2<\/sub>}<br \/>\n5. **&otimes; Left**: {&Gamma;, A, B :- &Sigma;} &rArr; { &Gamma;, A &otimes; B :- &Sigma; }<br \/>\n6. **&otimes; Right**: { &Gamma;<sub>1<\/sub> :- A, &Sigma;<sub>1<\/sub> &emsp; &Gamma;<sub>2<\/sub> :- B, &Sigma;<sub>2<\/sub>} &rArr; { &Gamma;<sub>1<\/sub>, &Gamma;<sub>2<\/sub> :- (A &otimes; B), &Sigma;<sub>1<\/sub>,&Sigma;<sub>2<\/sub>}<br \/>\n7. **-o Left**: { &Gamma;<sub>1<\/sub> :- A, &Sigma;<sub>1<\/sub> &emsp;&Gamma;<sub>2<\/sub>, B :- &Sigma;<sub>2<\/sub> } &rArr; { &Gamma;<sub>1<\/sub>,&Gamma;<sub>2<\/sub>, (A -o B) :- &Sigma;<sub>1<\/sub>,&Sigma;<sub>2<\/sub>}<br \/>\n8. **-o Right**: { &Gamma;, A :- B, &Sigma;} &rArr; { &Gamma; :- A -o B, &Sigma;}<br \/>\n9. **\u214b Left**: { &Gamma;<sub>1<\/sub>,A :- &Sigma;<sub>1<\/sub> &emsp;&Gamma;<sub>2<\/sub> :- B, &Sigma;<sub>2<\/sub> } &rArr; { &Gamma;<sub>1<\/sub>,&Gamma;<sub>2<\/sub>, (A \u214b B) :- &Sigma;<sub>1<\/sub>,&Sigma;<sub>2<\/sub>}<br \/>\n10. **\u214b Right**: { &Gamma; :- A, B, &Sigma;} &rArr; { &Gamma; :- A \u214b B, &Sigma;}<br \/>\n11. **&amp; Left**: { &Gamma;, A :- &Sigma; } &rArr; { &Gamma;,A &amp; B :- &Sigma;}\/{ &Gamma;, B :- &Sigma; } &rArr; { &Gamma;,A &amp; B :- &Sigma;}<br \/>\n12. **&amp; Right**: { &Gamma; :- A,&Sigma; &emsp; &Gamma; :- B,&Sigma;} &rArr; { &Gamma; :- (A &amp; B), &Sigma; }<br \/>\n13. **&oplus; Left**: &Gamma;,A :- &Sigma; &emsp; &Gamma;,B :- &Sigma;} &rArr; { &Gamma;,A &oplus; B :- &Sigma;}<br \/>\n14. **&oplus; Right**: {&Gamma; :- A,&Sigma;} &rArr; {&Gamma; :- A &oplus; B, &Sigma;}\/{&Gamma; :- B,&Sigma;} &rArr; {&Gamma; :- A &oplus; B, &Sigma;}<br \/>\n15. **!W**: {&Gamma; :- &Sigma;} &rArr; {&Gamma;,!A :- &Sigma;}<br \/>\n16. **!C**: {&Gamma;,!A,!A :- &Sigma;} &rArr; { &Gamma;,!A :- &Sigma; }<br \/>\n17. **!D**: { &Gamma;, A :- &Sigma;} &rArr; { &Gamma;,!A :- &Sigma;}<br \/>\n18. **!S**: { !&Gamma; :- A, ?&Sigma;} &rArr; { !&Gamma; :- !A, ?&Sigma;}<br \/>\n19. **?W**: {&Gamma; :- &Sigma;} &rArr; {&Gamma;:- ?A, &Sigma;}<br \/>\n20. **?C**: {&Gamma; :- ?A,?A, &Sigma;} &rArr; { &Gamma; :- ?A, &Sigma; }<br \/>\n21. **?D**: { &Gamma; :- A, &Sigma;} &rArr; { &Gamma; :- ?A, &Sigma;}<br \/>\n22. **?S**: { !&Gamma;, A :- ?&Sigma;} &rArr; { !&Gamma;,?A :- ?&Sigma;}<br \/>\n23. **&perp; Exp Left**: { &Gamma; :- A, &Sigma;} &rArr; { &Gamma;, A<sup>&perp;<\/sup> :- &Sigma;}<br \/>\n24. **&perp; Exp Right**: { &Gamma;, A :- &Sigma;} &rArr; { &Gamma; :- A<sup>&perp;<\/sup>, &Sigma;}<br \/>\n25. **0 Left**: { &Gamma;,0 :- &Sigma; }    *(Nothing can be inferred)*<br \/>\n26. **\u22a4 Right**: { &Gamma; :-  \u22a4,&Sigma;}<br \/>\n27. **&perp; Left**: { &perp; :- }<br \/>\n28. **&perp; Right**: {&Gamma; :- &Sigma;} &rArr; {&Gamma; :- &perp;,&Sigma;}<br \/>\n29. **1 Left**: { &Gamma; :- &Sigma;} &rArr; { &Gamma;,1 :- &Sigma;}<br \/>\n30.  **1 Right**: { :- 1}<br \/>\nThis is long enough that I&#8217;m not going to get into how this hooks into category theory today, except to point out that if you look carefully at the multiplication and exponentiations, they might seem a tad familiar.<br \/>\n[types-as-proofs]: http:\/\/goodmath.blogspot.com\/2006\/06\/finally-modeling-lambda-calculus.html<br \/>\n[sigact92]: http:\/\/www.csl.sri.com\/~lincoln\/papers\/sigact92.ps<br \/>\n[yesterday]: http:\/\/scienceblogs.com\/goodmath\/2006\/07\/a_brief_diversion_sequent_calc.php<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[Monday][yesterday], I said that I needed to introduce the sequent calculus, because it would be useful for describing things like linear logic. Today we&#8217;re going to take a quick look at linear logic &#8211; in particular, at *propositional* linear logic; you can expand to predicate linear logic in a way very similar to the way [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[76,33],"tags":[],"class_list":["post-79","post","type-post","status-publish","format-standard","hentry","category-category-theory","category-logic"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4lzZS-1h","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts\/79","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/comments?post=79"}],"version-history":[{"count":0,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts\/79\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/media?parent=79"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/categories?post=79"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/tags?post=79"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}