<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dvanhorn @ λ-calcul.us &#187; Types</title>
	<atom:link href="http://dvanhorn.lambda-calcul.us/category/types/feed/" rel="self" type="application/rss+xml" />
	<link>http://dvanhorn.lambda-calcul.us</link>
	<description>Research weblog for David Van Horn</description>
	<lastBuildDate>Sat, 28 Aug 2010 13:39:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CACM: Type Theory Comes of Age</title>
		<link>http://dvanhorn.lambda-calcul.us/2010/02/02/cacm-type-theory-comes-of-age/</link>
		<comments>http://dvanhorn.lambda-calcul.us/2010/02/02/cacm-type-theory-comes-of-age/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 14:51:39 +0000</pubDate>
		<dc:creator>dvanhorn</dc:creator>
				<category><![CDATA[Types]]></category>

		<guid isPermaLink="false">http://dvanhorn.lambda-calcul.us/?p=203</guid>
		<description><![CDATA[The current issue of CACM has an article on type theory:
When the philosopher Bertrand Russell invented type theory at the beginning of the 20th century, he could hardly have imagined that his solution to a simple logic paradox—defining the set of all sets not in themselves—would one day shape the trajectory of 21st century computer [...]]]></description>
			<content:encoded><![CDATA[<p>The current issue of CACM has an article on type theory:</p>
<blockquote><p>When the philosopher Bertrand Russell invented type theory at the beginning of the 20th century, he could hardly have imagined that his solution to a simple logic paradox—defining the set of all sets not in themselves—would one day shape the trajectory of 21st century computer science.</p></blockquote>
<p>It is riddled with misconceptions, errors, and self-aggrandizement.  It does us the great disservice of conflating (dynamic) memory safety and (static) type safety, and has whoppers like &#8220;A type system ensures the correct behavior of any program routine by enforcing a set of predetermined behaviors,&#8221; which is just false.  But hey, ra-ra types!  No?</p>
]]></content:encoded>
			<wfw:commentRss>http://dvanhorn.lambda-calcul.us/2010/02/02/cacm-type-theory-comes-of-age/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TLCA Open Problems</title>
		<link>http://dvanhorn.lambda-calcul.us/2009/06/08/tlca-open-problems/</link>
		<comments>http://dvanhorn.lambda-calcul.us/2009/06/08/tlca-open-problems/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 19:03:01 +0000</pubDate>
		<dc:creator>dvanhorn</dc:creator>
				<category><![CDATA[Semantics]]></category>
		<category><![CDATA[Syntax]]></category>
		<category><![CDATA[Types]]></category>

		<guid isPermaLink="false">http://dvanhorn.lambda-calcul.us/?p=115</guid>
		<description><![CDATA[I just came across the TLCA List of Open Problems, which includes 20 unsolved problems in the areas of:

Typed and untyped lambda-calculi as models of computation.
Proof-theory: Natural deduction, sequent calculi, cut elimination and normalization. Propositions as types, linear logic and proof nets.
Semantics: Denotational semantics, game semantics, realizability, categorical models.
Programming languages: Foundations of functional and object-oriented [...]]]></description>
			<content:encoded><![CDATA[<p>I just came across the <a href="http://tlca.di.unito.it/opltlca/">TLCA List of Open Problems</a>, which includes 20 unsolved problems in the areas of:</p>
<ul>
<li>Typed and untyped lambda-calculi as models of computation.</li>
<li>Proof-theory: Natural deduction, sequent calculi, cut elimination and normalization. Propositions as types, linear logic and proof nets.</li>
<li>Semantics: Denotational semantics, game semantics, realizability, categorical models.</li>
<li>Programming languages: Foundations of functional and object-oriented programming, proof search, logic programming, type checking.</li>
<li>Implementation: Abstract machines, parallel execution, optimal reduction, program optimization.</li>
</ul>
<p>The problems are all interesting.  I liked 6, 8, 12-14, 16-18 in particular.</p>
]]></content:encoded>
			<wfw:commentRss>http://dvanhorn.lambda-calcul.us/2009/06/08/tlca-open-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Semantics / Computational logic reading list</title>
		<link>http://dvanhorn.lambda-calcul.us/2008/01/16/semantics-computational-logic-reading-list/</link>
		<comments>http://dvanhorn.lambda-calcul.us/2008/01/16/semantics-computational-logic-reading-list/#comments</comments>
		<pubDate>Thu, 17 Jan 2008 04:10:28 +0000</pubDate>
		<dc:creator>dvanhorn</dc:creator>
				<category><![CDATA[Classic papers]]></category>
		<category><![CDATA[Semantics]]></category>
		<category><![CDATA[Types]]></category>

		<guid isPermaLink="false">http://dvanhorn.lambda-calcul.us/2008/01/16/semantics-computational-logic-reading-list/</guid>
		<description><![CDATA[Harry Mairson is teaching a semantics graduate course and the reading list looks very enjoyable, if you&#8217;re into that sort of thing.  As Harry said on the first day, the course is really more about computational logic and proof theory than semantics, but due to various reasons, it&#8217;s being offered under the auspices of [...]]]></description>
			<content:encoded><![CDATA[<p>Harry Mairson is teaching a semantics graduate course and the <a href="http://www.cs.brandeis.edu/~dvanhorn/tmp/factsheet.pdf">reading list</a> looks very enjoyable, if you&#8217;re into that sort of thing.  As Harry said on the first day, the course is really more about computational logic and proof theory than semantics, but due to various reasons, it&#8217;s being offered under the auspices of a semantics course.</p>
]]></content:encoded>
			<wfw:commentRss>http://dvanhorn.lambda-calcul.us/2008/01/16/semantics-computational-logic-reading-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Readback from principal types of linear terms</title>
		<link>http://dvanhorn.lambda-calcul.us/2007/10/11/readback-from-principal-types-of-linear-terms/</link>
		<comments>http://dvanhorn.lambda-calcul.us/2007/10/11/readback-from-principal-types-of-linear-terms/#comments</comments>
		<pubDate>Thu, 11 Oct 2007 16:34:20 +0000</pubDate>
		<dc:creator>dvanhorn</dc:creator>
				<category><![CDATA[Linearity]]></category>
		<category><![CDATA[Types]]></category>
		<category><![CDATA[booleans]]></category>
		<category><![CDATA[linear]]></category>
		<category><![CDATA[mairson]]></category>
		<category><![CDATA[readback]]></category>

		<guid isPermaLink="false">http://dvanhorn.lambda-calcul.us/2007/10/11/readback-from-principal-types-of-linear-terms/</guid>
		<description><![CDATA[A key observation made by Mairson and explained in his 2004 JFP Functional Pearl about the type inference problem for simply typed λ-terms is that, when the term is linear (every bound variable occurs exactly once), the most general type and normal form are isomorphic. So given a linear term in normal form, we can [...]]]></description>
			<content:encoded><![CDATA[<p>A key observation made by Mairson and explained in his 2004 JFP Functional Pearl about the type inference problem for simply typed λ-terms is that, when the term is linear (every bound variable occurs exactly once), the most general type and normal form are isomorphic. So given a linear term in normal form, we can construct its most general type (no surprise there), but conversely, when given a most general type, we can construct the normal form of all terms with that type.</p>
<blockquote><p>As a consequence, while the compiler does not explicitly reduce [...] expressions to normal form, hence computing an &#8220;answer,&#8221; its type inference mechanism implicitly carries out that reduction to normal form, expressed in the language of first-order unification.</p></blockquote>
<p>This insight becomes the key ingredient in proving the lower bound complexity of simple type inference&#8212;when our program is linear, static analysis is effectively &#8220;running&#8221; the program. Lower bounds, then, can be obtained by simply hacking within the linear λ-calculus.</p>
<p>In this note, I just want to look a bit more closely at the problem of &#8220;reading back&#8221; a normal form from a given type for a linear term. It&#8217;s not exactly spelled out and I had to think about what the readback algorithm would actually look like.</p>
<p>In general, we have a type σ<sub>1</sub> → σ<sub>2</sub> &#8230; → σ<sub>k</sub> → A, where A is a type variable.  So what do we know about the normal form? It has to have the shape λx<sub>1</sub>.λx<sub>2</sub>&#8230;λx<sub>k</sub>.[---]. Since the term is linear, and the type is most general, every type variable occurs exactly twice: once positively and once negatively (convince yourself of this in the privacy of your own home). Furthermore, there exists a unique σ<sub>i</sub> ≡ τ<sub>1</sub> → τ<sub>2</sub> &#8230; → τ<sub>m</sub> → A, so&#8230; x<sub>i</sub> must be the head variable of the normal form, ie., we now know: λx<sub>1</sub>.λx<sub>2</sub>&#8230;λx<sub>i</sub>&#8230;λx<sub>k</sub>.x<sub>i</sub>[---], and x<sub>i</sub> is applied to m arguments, each with type τ<sub>1</sub>, &#8230;, τ<sub>m</sub>, respectively. But now we can recursively construct the normal forms of the arguments and we&#8217;re done. We hit the base case when we get to a base type (a type variable); here the term is just the occurrence of the λ-bound variable that has this type.</p>
<p>Let&#8217;s look at a concrete example.  There are two linear functions on pairs: identity and twist, so we have as normal forms:</p>
<ul>
<li>λc.λp.λq.cpq = Id</li>
<li>λc.λp.λq.cqp = Twist</li>
</ul>
<p>These are the basic building blocks of the Mairson encodings of the Booleans, which are linear, unlike the Church encodings that are linear-affine (each bound variable occurs at most once). True is a pair of functions on pairs&#8212;the first is identity, the second is a twist (swap the car and cdr). False, likewise, is a pair of function on pairs, but it has twist in the first component and identity in the second. The most general types for Id and Twist are the following (if you don&#8217;t believe me, just fire up your ML interpreter):</p>
<ul>
<li>λc.λp.λq.cpq : (A → B → C) → A → B → C</li>
<li>λc.λp.λq.cqp : (A → B → C) → B → A → C</li>
</ul>
<p>Notice each type variable occurs exactly twice, once positively, once negatively. Now let&#8217;s look only at the types and readback the above normal forms. In the case of (A → B → C) → A → B → C, we have σ<sub>1</sub> → σ<sub>2</sub> → σ<sub>3 </sub>→ C, so we know the term has the shape λx<sub>1</sub>.λx<sub>2</sub>.λx<sub>3</sub>.[---].  There is a unique σ<sub>i</sub> ending in C, namely σ<sub>1</sub> = A → B → C, so x<sub>1</sub> is the head variable and it takes two arguments: λx<sub>1</sub>.λx<sub>2</sub>.λx<sub>3</sub>.x<sub>1</sub>[---][---].   The first argument has type A, so it must be x<sub>2</sub> and the second argument has type B, so it must be x<sub>3</sub>.  So we have λx<sub>1</sub>.λx<sub>2</sub>.λx<sub>3</sub>.x<sub>1</sub>x<sub>2</sub>x<sub>3</sub> ≡<sub>α</sub> λc.λp.λq.cpq.</p>
<p>In the case of  (A → B → C) → B → A → C, by the same steps we get to λx<sub>1</sub>.λx<sub>2</sub>.λx<sub>3</sub>.x<sub>1</sub>[---][---], but the first argument has type B and the second argument has type A, so the normal form is λx<sub>1</sub>.λx<sub>2</sub>.λx<sub>3</sub>.x<sub>1</sub>x<sub>3</sub>x<sub>2</sub> ≡<sub>α</sub> λc.λp.λq.cqp.</p>
<p>For a more complicated example, try reading back the normal forms of Mairson&#8217;s True and False from the following types:</p>
<ul>
<li>(((A → B → C) → A → B → C)  → ((D → E → F) → E → D → F) → G) → G</li>
<li>(((A → B → C) → B → A → C)  → ((D → E → F) → D → E → F) → G) → G</li>
</ul>
<p>There is also a pretty straightforward way of seeing how to do this via a proofs-as-programs correspondence between linear λ-terms and multiplicative linear logic proofs, but that&#8217;s a story for another day.</p>
<ul>
<li>
<div>[2004,article] <a href="#mairson_linear_lambda_ptime" class="toggle">bibtex</a> </div>
<div>H. G. Mairson, &quot;Linear lambda calculus and PTIME-completeness,&quot; <em>J. Funct. Program.</em>, vol. 14, iss. 6, pp. 623-633, 2004.</div>
<div class="bibtex" id="mairson_linear_lambda_ptime">
         <code>@ARTICLE{mairson_linear_lambda_ptime, <br />
 &nbsp;&nbsp;author = {Harry G. Mairson}, <br />
 &nbsp; title = {Linear lambda calculus and PTIME-completeness}, <br />
 &nbsp; journal = {J. Funct. Program.}, <br />
 &nbsp; volume = {14}, <br />
 &nbsp; number = {6}, <br />
 &nbsp; year = {2004}, <br />
 &nbsp; issn = {0956-7968}, <br />
 &nbsp; pages = {623--633}, <br />
 &nbsp; doi = {http://dx.doi.org/10.1017/S0956796804005131}, <br />
 &nbsp; publisher = {Cambridge University Press}, <br />
 &nbsp; address = {New York, NY, USA}, <br />
 &nbsp; }</code>
    </div>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://dvanhorn.lambda-calcul.us/2007/10/11/readback-from-principal-types-of-linear-terms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
