{"id":3139,"date":"2015-03-22T19:53:36","date_gmt":"2015-03-22T23:53:36","guid":{"rendered":"http:\/\/www.goodmath.org\/blog\/?p=3139"},"modified":"2015-03-22T19:53:36","modified_gmt":"2015-03-22T23:53:36","slug":"logical-statements-as-tasks","status":"publish","type":"post","link":"http:\/\/www.goodmath.org\/blog\/2015\/03\/22\/logical-statements-as-tasks\/","title":{"rendered":"Logical Statements as Tasks"},"content":{"rendered":"<p> In the next step of our exploration of type theory, we&#8217;re going to take a step away from the set-based stuff. There are set-based intepretations of every statement in set theory. But what we really want to focus on is the interpretation of statements in computational terms.<\/p>\n<p> What that means is that we&#8217;re going to take logical statements, and view them as <em>computation tasks<\/em> &#8211; that is, as formal logical specifications of a computation that we&#8217;d like to do. Under that interpretation, a proof of a statement <img src='http:\/\/l.wordpress.com\/latex.php?latex=S&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='S' style='vertical-align:1%' class='tex' alt='S' \/> is an <em>implementation<\/em> of the task specified by <img src='http:\/\/l.wordpress.com\/latex.php?latex=S&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='S' style='vertical-align:1%' class='tex' alt='S' \/>.<\/p>\n<p> This interpretation is much, much easier for computer science types like me than the set-based interpretations. We can walk through the interpretations of all of the statements of our intuitionistic logic in just a few minutes.<\/p>\n<p> We&#8217;ll start with the simple statements.<\/p>\n<dl>\n<dt> <b>Conjunction<\/b><\/dt>\n<dd><img src='http:\/\/l.wordpress.com\/latex.php?latex=A%20%5Cland%20B&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='A \\land B' style='vertical-align:1%' class='tex' alt='A \\land B' \/> is a specification for a program that produces a pair <img src='http:\/\/l.wordpress.com\/latex.php?latex=%28a%2C%20b%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='(a, b)' style='vertical-align:1%' class='tex' alt='(a, b)' \/> where  <img src='http:\/\/l.wordpress.com\/latex.php?latex=a&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='a' style='vertical-align:1%' class='tex' alt='a' \/> is a solution for <img src='http:\/\/l.wordpress.com\/latex.php?latex=A&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='A' style='vertical-align:1%' class='tex' alt='A' \/>, and <img src='http:\/\/l.wordpress.com\/latex.php?latex=b&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='b' style='vertical-align:1%' class='tex' alt='b' \/> is a solution for <img src='http:\/\/l.wordpress.com\/latex.php?latex=B&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='B' style='vertical-align:1%' class='tex' alt='B' \/>.<\/dd>\n<dt><b>Disjunction<\/b><\/dt>\n<dd> <img src='http:\/\/l.wordpress.com\/latex.php?latex=A%20%5Clor%20B&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='A \\lor B' style='vertical-align:1%' class='tex' alt='A \\lor B' \/> is a specification for a program that produces either a solution to <img src='http:\/\/l.wordpress.com\/latex.php?latex=A&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='A' style='vertical-align:1%' class='tex' alt='A' \/> or a solution to <img src='http:\/\/l.wordpress.com\/latex.php?latex=B&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='B' style='vertical-align:1%' class='tex' alt='B' \/>, along with a way of identifying which of <img src='http:\/\/l.wordpress.com\/latex.php?latex=A&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='A' style='vertical-align:1%' class='tex' alt='A' \/> and <img src='http:\/\/l.wordpress.com\/latex.php?latex=B&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='B' style='vertical-align:1%' class='tex' alt='B' \/> it solved. We do that using a version of the classical projection functions: <img src='http:\/\/l.wordpress.com\/latex.php?latex=A%20%5Clor%20B&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='A \\lor B' style='vertical-align:1%' class='tex' alt='A \\lor B' \/> produce either <img src='http:\/\/l.wordpress.com\/latex.php?latex=%5Ctext%7Binl%7D%28A%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='\\text{inl}(A)' style='vertical-align:1%' class='tex' alt='\\text{inl}(A)' \/> (that is, the left projection), or <img src='http:\/\/l.wordpress.com\/latex.php?latex=%5Ctext%7Binr%7D%28B%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='\\text{inr}(B)' style='vertical-align:1%' class='tex' alt='\\text{inr}(B)' \/> (the right projection).<\/dd>\n<dt>Implication<\/dt>\n<dd> <img src='http:\/\/l.wordpress.com\/latex.php?latex=A%20%5Csupset%20B&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='A \\supset B' style='vertical-align:1%' class='tex' alt='A \\supset B' \/> is a specification for a program that produces a solution to <img src='http:\/\/l.wordpress.com\/latex.php?latex=B&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='B' style='vertical-align:1%' class='tex' alt='B' \/> given a solution to <img src='http:\/\/l.wordpress.com\/latex.php?latex=A&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='A' style='vertical-align:1%' class='tex' alt='A' \/>; in lambda calculus terms, it&#8217;s a form like <img src='http:\/\/l.wordpress.com\/latex.php?latex=%5Clambda%20x%3A%20b%28x%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='\\lambda x: b(x)' style='vertical-align:1%' class='tex' alt='\\lambda x: b(x)' \/>.<\/dd>\n<\/dl>\n<p> Now, we can move on to quantified statements. They get a bit more complicated, but if you read the quantifier right, it&#8217;s not bad.<\/p>\n<dl>\n<dt>Universal<\/dt>\n<dd> <img src='http:\/\/l.wordpress.com\/latex.php?latex=%28%5Cforall%20x%20%5Cin%20A%29%20B%28x%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='(\\forall x \\in A) B(x)' style='vertical-align:1%' class='tex' alt='(\\forall x \\in A) B(x)' \/> is a program which, when executed, yields a program of the form <img src='http:\/\/l.wordpress.com\/latex.php?latex=%5Clambda%20x.b%28x%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='\\lambda x.b(x)' style='vertical-align:1%' class='tex' alt='\\lambda x.b(x)' \/>, where <img src='http:\/\/l.wordpress.com\/latex.php?latex=b%28x%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='b(x)' style='vertical-align:1%' class='tex' alt='b(x)' \/> is an implementation of <img src='http:\/\/l.wordpress.com\/latex.php?latex=B&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='B' style='vertical-align:1%' class='tex' alt='B' \/>, and <img src='http:\/\/l.wordpress.com\/latex.php?latex=x&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='x' style='vertical-align:1%' class='tex' alt='x' \/> is an implementation of <img src='http:\/\/l.wordpress.com\/latex.php?latex=A&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='A' style='vertical-align:1%' class='tex' alt='A' \/>. In other words, a universal statement is a program factory, which produces a program that turns one program into another program.<\/p>\n<p>     To me, the easiest way to understand this is to expand the quantifier. A quantified statement <img src='http:\/\/l.wordpress.com\/latex.php?latex=%5Cforall%20x%20%5Cin%20A%3A%20B%28x%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='\\forall x \\in A: B(x)' style='vertical-align:1%' class='tex' alt='\\forall x \\in A: B(x)' \/> can be read as <img src='http:\/\/l.wordpress.com\/latex.php?latex=%5Cforall%20x%3A%20x%20%5Cin%20A%20%5CRightarrow%20B%28x%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='\\forall x: x \\in A \\Rightarrow B(x)' style='vertical-align:1%' class='tex' alt='\\forall x: x \\in A \\Rightarrow B(x)' \/>. If you read it that way, and just follow the computational interpretation of implication, you get precisely the definition above.\n  <\/dd>\n<dt>Existential<\/dt>\n<dd> Existential quantification is easy. An existential statement <img src='http:\/\/l.wordpress.com\/latex.php?latex=%5Cexists%20x%20%5Cin%20A%3A%20B%28x%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='\\exists x \\in A: B(x)' style='vertical-align:1%' class='tex' alt='\\exists x \\in A: B(x)' \/> is a two part problem: it needs a value for <img src='http:\/\/l.wordpress.com\/latex.php?latex=a&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='a' style='vertical-align:1%' class='tex' alt='a' \/> (that is, a value of <img src='http:\/\/l.wordpress.com\/latex.php?latex=x&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='x' style='vertical-align:1%' class='tex' alt='x' \/> for which a proof exists that <img src='http:\/\/l.wordpress.com\/latex.php?latex=x%20%5Cin%20A&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='x \\in A' style='vertical-align:1%' class='tex' alt='x \\in A' \/>), and a proof that for that specific value of <img src='http:\/\/l.wordpress.com\/latex.php?latex=x&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='x' style='vertical-align:1%' class='tex' alt='x' \/>, <img src='http:\/\/l.wordpress.com\/latex.php?latex=x%20%5Cin%20B&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='x \\in B' style='vertical-align:1%' class='tex' alt='x \\in B' \/>. A solution, then, has two parts: it&#8217;s a pair <img src='http:\/\/l.wordpress.com\/latex.php?latex=%28a%2C%20b%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='(a, b)' style='vertical-align:1%' class='tex' alt='(a, b)' \/>, where <img src='http:\/\/l.wordpress.com\/latex.php?latex=a&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='a' style='vertical-align:1%' class='tex' alt='a' \/> is a value in <img src='http:\/\/l.wordpress.com\/latex.php?latex=A&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='A' style='vertical-align:1%' class='tex' alt='A' \/>, and <img src='http:\/\/l.wordpress.com\/latex.php?latex=b&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='b' style='vertical-align:1%' class='tex' alt='b' \/> is a program that computes the problem <img src='http:\/\/l.wordpress.com\/latex.php?latex=B%28a%29&#038;bg=FFFFFF&#038;fg=000000&#038;s=0' title='B(a)' style='vertical-align:1%' class='tex' alt='B(a)' \/>.<\/dd>\n<\/dl>\n<p> This is the perspective from which most of Martin-Loff&#8217;s type theory pursues things. There&#8217;s a reason why ML&#8217;s type theory is so well-loved by computer scientists: because what we&#8217;re really doing here is taking a foundational theory of mathematics, and turning it into a specification language for describing computing systems.<\/p>\n<p> That&#8217;s the fundamental beauty of what Martin-Loff did: he found a way of formulating all of constructive mathematics so that it&#8217;s one and the same thing as the theory of computation.<\/p>\n<p> And that&#8217;s why this kind of type theory is so useful as a component of programming languages: because it&#8217;s allowing you to describe the semantics of your program in terms that are completely natural to the program. The type system is a description of the problem; and the program is the proof.<\/p>\n<p> With full-blown Martin-Loff type system, the types really are a full specification of the computation described by the program. We don&#8217;t actually use the full expressiveness of type theory in real languages &#8211; among other things, it&#8217;s not checkable! But we do use a constrained, limited logic with Martin-Loff&#8217;s semantics. That&#8217;s what types really are in programming languages: they&#8217;re logical statements! As we get deeper into type theory, well see exactly how that works.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the next step of our exploration of type theory, we&#8217;re going to take a step away from the set-based stuff. There are set-based intepretations of every statement in set theory. But what we really want to focus on is the interpretation of statements in computational terms. What that means is that we&#8217;re going to [&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":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[292],"tags":[],"class_list":["post-3139","post","type-post","status-publish","format-standard","hentry","category-type-theory"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p4lzZS-OD","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts\/3139","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=3139"}],"version-history":[{"count":3,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts\/3139\/revisions"}],"predecessor-version":[{"id":3142,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/posts\/3139\/revisions\/3142"}],"wp:attachment":[{"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/media?parent=3139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/categories?post=3139"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.goodmath.org\/blog\/wp-json\/wp\/v2\/tags?post=3139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}