<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: A language which does term inference</title>
	<atom:link href="http://xorshammer.com/2008/10/07/term-inference/feed/" rel="self" type="application/rss+xml" />
	<link>http://xorshammer.com/2008/10/07/term-inference/</link>
	<description>Some things in mathematical logic that I find interesting</description>
	<lastBuildDate>Wed, 18 Jan 2012 18:13:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: mkoconnor</title>
		<link>http://xorshammer.com/2008/10/07/term-inference/#comment-133</link>
		<dc:creator><![CDATA[mkoconnor]]></dc:creator>
		<pubDate>Fri, 17 Oct 2008 22:41:36 +0000</pubDate>
		<guid isPermaLink="false">http://xorshammer.wordpress.com/?p=170#comment-133</guid>
		<description><![CDATA[Using &lt;code&gt;&amp;&lt;/code&gt; to get projections is a good idea.  I had actually kind of stopped thinking about the linear logic side of things once I decided that it wouldn&#039;t make for a practical implementation, but now that it&#039;s come up again, it seems theoretically quite interesting to me.
I&#039;m not sure if using &lt;code&gt;&amp;&lt;/code&gt; to get the diagonal function would work out though: if you used the diagonal function to get an &lt;code&gt;a&amp;a&lt;/code&gt; from an &lt;code&gt;a&lt;/code&gt;, you would probably want to use both &lt;code&gt;a&lt;/code&gt;&#039;s (since otherwise, why did you apply the diagonal function in the first place?), but you can&#039;t, by the definition of &lt;code&gt;&amp;&lt;/code&gt;.]]></description>
		<content:encoded><![CDATA[<p>Using <code>&amp;</code> to get projections is a good idea.  I had actually kind of stopped thinking about the linear logic side of things once I decided that it wouldn&#8217;t make for a practical implementation, but now that it&#8217;s come up again, it seems theoretically quite interesting to me.<br />
I&#8217;m not sure if using <code>&amp;</code> to get the diagonal function would work out though: if you used the diagonal function to get an <code>a&amp;a</code> from an <code>a</code>, you would probably want to use both <code>a</code>&#8216;s (since otherwise, why did you apply the diagonal function in the first place?), but you can&#8217;t, by the definition of <code>&amp;</code>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: François Dorais</title>
		<link>http://xorshammer.com/2008/10/07/term-inference/#comment-129</link>
		<dc:creator><![CDATA[François Dorais]]></dc:creator>
		<pubDate>Fri, 17 Oct 2008 05:53:05 +0000</pubDate>
		<guid isPermaLink="false">http://xorshammer.wordpress.com/?p=170#comment-129</guid>
		<description><![CDATA[Michigan is great! I&#039;m having a good time in Ann Arbor.

The close connection with linear logic is starting to become clearer.

I think &lt;code&gt;&amp;&lt;/code&gt; could be useful as an alternate product. You could then derive the projection &lt;code&gt;fst: (&#039;a &amp; &#039;b) -&gt; &#039;a&lt;/code&gt; as well as the diagonal &lt;code&gt;diag: &#039;a -&gt; (&#039;a &amp; &#039;a)&lt;/code&gt;. The idea is that &lt;code&gt;&amp;&lt;/code&gt; is a &quot;lazy&quot; product, whereas &lt;code&gt;*&lt;/code&gt; is an &quot;eager&quot; product.

The same distinction applies to &lt;code&gt;!&lt;/code&gt; and &lt;code&gt;?&lt;/code&gt;. They are both similar storage constructors, but &lt;code&gt;!&lt;/code&gt; is &quot;eager&quot; while &lt;code&gt;?&lt;/code&gt; is &quot;lazy&quot;. Lists make sense to me, but I can see that the implicit order could lead to problems. Some kind of reference types would also make sense, but I find this interpretation very sketchy and undesirable.

As for the units, 1 is pretty clearly the empty list. I couldn&#039;t make much sense of $latex \top.$ As for 0 and $latex \bot,$ the axiom $latex \bot \vdash$ suggests that $latex \bot$ is &quot;failure&quot; and the axiom $latex \Gamma,0 \vdash A$ suggests that 0 is &quot;void&quot;. I don&#039;t know if you really want partial functions, but $latex \bot$ would be one way to explicitly allow for that. I don&#039;t know if 0 is desirable, but I&#039;m pretty confident it can&#039;t hurt.

Of course, adding too many features will lead to undecidability. I wonder where the line is...]]></description>
		<content:encoded><![CDATA[<p>Michigan is great! I&#8217;m having a good time in Ann Arbor.</p>
<p>The close connection with linear logic is starting to become clearer.</p>
<p>I think <code>&amp;</code> could be useful as an alternate product. You could then derive the projection <code>fst: ('a &amp; 'b) -&gt; 'a</code> as well as the diagonal <code>diag: 'a -&gt; ('a &amp; 'a)</code>. The idea is that <code>&amp;</code> is a &#8220;lazy&#8221; product, whereas <code>*</code> is an &#8220;eager&#8221; product.</p>
<p>The same distinction applies to <code>!</code> and <code>?</code>. They are both similar storage constructors, but <code>!</code> is &#8220;eager&#8221; while <code>?</code> is &#8220;lazy&#8221;. Lists make sense to me, but I can see that the implicit order could lead to problems. Some kind of reference types would also make sense, but I find this interpretation very sketchy and undesirable.</p>
<p>As for the units, 1 is pretty clearly the empty list. I couldn&#8217;t make much sense of <img src='http://s0.wp.com/latex.php?latex=%5Ctop.&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;top.' title='&#92;top.' class='latex' /> As for 0 and <img src='http://s0.wp.com/latex.php?latex=%5Cbot%2C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;bot,' title='&#92;bot,' class='latex' /> the axiom <img src='http://s0.wp.com/latex.php?latex=%5Cbot+%5Cvdash&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;bot &#92;vdash' title='&#92;bot &#92;vdash' class='latex' /> suggests that <img src='http://s0.wp.com/latex.php?latex=%5Cbot&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;bot' title='&#92;bot' class='latex' /> is &#8220;failure&#8221; and the axiom <img src='http://s0.wp.com/latex.php?latex=%5CGamma%2C0+%5Cvdash+A&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;Gamma,0 &#92;vdash A' title='&#92;Gamma,0 &#92;vdash A' class='latex' /> suggests that 0 is &#8220;void&#8221;. I don&#8217;t know if you really want partial functions, but <img src='http://s0.wp.com/latex.php?latex=%5Cbot&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;bot' title='&#92;bot' class='latex' /> would be one way to explicitly allow for that. I don&#8217;t know if 0 is desirable, but I&#8217;m pretty confident it can&#8217;t hurt.</p>
<p>Of course, adding too many features will lead to undecidability. I wonder where the line is&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mkoconnor</title>
		<link>http://xorshammer.com/2008/10/07/term-inference/#comment-127</link>
		<dc:creator><![CDATA[mkoconnor]]></dc:creator>
		<pubDate>Wed, 15 Oct 2008 09:32:22 +0000</pubDate>
		<guid isPermaLink="false">http://xorshammer.wordpress.com/?p=170#comment-127</guid>
		<description><![CDATA[Andrej: I&#039;ll have to look into relevant logic; I know nothing about it presently.  In my current way of thinking, I do sometimes want to throw away a hypothesis (either to infer a projection (which I am, like you, not sure is a good thing to allow) or, for example, in the case of map where the list argument is empty you do not use the function argument), but that&#039;s certainly not necessary and it&#039;s quite possible relevant logic gives the framework I need.

François: I don&#039;t have an interpretation for par, and it also turned out that I didn&#039;t need $latex \&amp;$. (This is in reference to my last comment; the posted compiler doesn&#039;t use linear logic at all.)  I don&#039;t have  interpretation for 0 (and, embarrassingly, I never really understood the distinction in linear logic either).  The list constructor behaves a lot like ? (in that, if you have ?A as a resource, your opponent gets to choose how many A&#039;s you have, and you can produce a ?A by bundling up as many A&#039;s as you want), but I think that you can&#039;t view the A&#039;s you get from a ?A as coming with an order, although I could be wrong. 
In any case, I think that if you want to interpret constructors more general than &quot;list&quot;, it will not be easy to interpret them as exponentials.

I hope everything&#039;s going great in Michigan!]]></description>
		<content:encoded><![CDATA[<p>Andrej: I&#8217;ll have to look into relevant logic; I know nothing about it presently.  In my current way of thinking, I do sometimes want to throw away a hypothesis (either to infer a projection (which I am, like you, not sure is a good thing to allow) or, for example, in the case of map where the list argument is empty you do not use the function argument), but that&#8217;s certainly not necessary and it&#8217;s quite possible relevant logic gives the framework I need.</p>
<p>François: I don&#8217;t have an interpretation for par, and it also turned out that I didn&#8217;t need <img src='http://s0.wp.com/latex.php?latex=%5C%26&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;&amp;' title='&#92;&amp;' class='latex' />. (This is in reference to my last comment; the posted compiler doesn&#8217;t use linear logic at all.)  I don&#8217;t have  interpretation for 0 (and, embarrassingly, I never really understood the distinction in linear logic either).  The list constructor behaves a lot like ? (in that, if you have ?A as a resource, your opponent gets to choose how many A&#8217;s you have, and you can produce a ?A by bundling up as many A&#8217;s as you want), but I think that you can&#8217;t view the A&#8217;s you get from a ?A as coming with an order, although I could be wrong.<br />
In any case, I think that if you want to interpret constructors more general than &#8220;list&#8221;, it will not be easy to interpret them as exponentials.</p>
<p>I hope everything&#8217;s going great in Michigan!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: François Dorais</title>
		<link>http://xorshammer.com/2008/10/07/term-inference/#comment-126</link>
		<dc:creator><![CDATA[François Dorais]]></dc:creator>
		<pubDate>Tue, 14 Oct 2008 04:52:43 +0000</pubDate>
		<guid isPermaLink="false">http://xorshammer.wordpress.com/?p=170#comment-126</guid>
		<description><![CDATA[I think we talked about this over the Summer, but I never followed up. In any case, I&#039;m very curious about the connection with linear logic. I have a bunch of questions...

It seems to me that you&#039;re using intuitionistic linear logic. In particular, you probably don&#039;t have an interpretation of &quot;par&quot; (distinct from $latex \oplus$).

I can make sense of 1 as the empty list, do you have an interpretation for 0 (other than &quot;fail&quot;)?

Doesn&#039;t the list constructor behave just like the exponential &quot;!&quot;? Wouldn&#039;t it make sense to identify the two?]]></description>
		<content:encoded><![CDATA[<p>I think we talked about this over the Summer, but I never followed up. In any case, I&#8217;m very curious about the connection with linear logic. I have a bunch of questions&#8230;</p>
<p>It seems to me that you&#8217;re using intuitionistic linear logic. In particular, you probably don&#8217;t have an interpretation of &#8220;par&#8221; (distinct from <img src='http://s0.wp.com/latex.php?latex=%5Coplus&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;oplus' title='&#92;oplus' class='latex' />).</p>
<p>I can make sense of 1 as the empty list, do you have an interpretation for 0 (other than &#8220;fail&#8221;)?</p>
<p>Doesn&#8217;t the list constructor behave just like the exponential &#8220;!&#8221;? Wouldn&#8217;t it make sense to identify the two?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrej Bauer</title>
		<link>http://xorshammer.com/2008/10/07/term-inference/#comment-124</link>
		<dc:creator><![CDATA[Andrej Bauer]]></dc:creator>
		<pubDate>Wed, 08 Oct 2008 20:54:03 +0000</pubDate>
		<guid isPermaLink="false">http://xorshammer.wordpress.com/?p=170#comment-124</guid>
		<description><![CDATA[I see. Well, it&#039;s a nice idea and you&#039;ve clearly thought about it carefully. I would just add that having infinitely many axioms does not automagically give you undecidability. Your axioms are nicely structured (they are just parametrized by types), so possibly you can answer many interesting questions about them.

The idea with linear logic is neat. To circumvent the problem with guessing where the bangs should go, you could use relevant logic instead: it requires that every hypothesis be used at least once (programmers don&#039;t write functions which accept useless arguments). This would also prevent a projection a*b-&gt;a from being deduced, although I am not sure whether this is good or bad. The trick then would be to find a proof which uses every hypothesis at least once, and as few times as possible. Can that give you anything interesting?]]></description>
		<content:encoded><![CDATA[<p>I see. Well, it&#8217;s a nice idea and you&#8217;ve clearly thought about it carefully. I would just add that having infinitely many axioms does not automagically give you undecidability. Your axioms are nicely structured (they are just parametrized by types), so possibly you can answer many interesting questions about them.</p>
<p>The idea with linear logic is neat. To circumvent the problem with guessing where the bangs should go, you could use relevant logic instead: it requires that every hypothesis be used at least once (programmers don&#8217;t write functions which accept useless arguments). This would also prevent a projection a*b-&gt;a from being deduced, although I am not sure whether this is good or bad. The trick then would be to find a proof which uses every hypothesis at least once, and as few times as possible. Can that give you anything interesting?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mkoconnor</title>
		<link>http://xorshammer.com/2008/10/07/term-inference/#comment-123</link>
		<dc:creator><![CDATA[mkoconnor]]></dc:creator>
		<pubDate>Wed, 08 Oct 2008 10:14:14 +0000</pubDate>
		<guid isPermaLink="false">http://xorshammer.wordpress.com/?p=170#comment-123</guid>
		<description><![CDATA[Hi Andrej,
Thanks for your PL zoo and your reply!

What I&#039;m doing isn&#039;t exactly a proof search in intuitionistic propositional logic in two ways: First, the stored coercions (non-logical axioms, if you&#039;re thinking about it as a proof search) are allowed to have polymorphic types.  Second, the interpreter doesn&#039;t take the intuitionistic axioms for granted: for example, it won&#039;t deduce the coercion &lt;code&gt;fst: (&#039;a * &#039;b) -&gt; &#039;a&lt;/code&gt; on its own.  The only thing it tries are applications.  (The second difference was mostly for my convenience.)  Also, it doesn&#039;t just look for a proof in normal form, it tries to make sure that it&#039;s unique.

But those are minor differences and you can indeed recast its search as a restricted intuitionistic proof search, although one which is undecidable since you have infinitely many non-logical axioms due to polymorphism.

I was originally thinking about having the compiler or interpreter infer an expression for a given type, and I first tried an intuitionistic proof search.  This had a problem though, since when inferring a term with type &lt;code&gt;&#039;a -&gt; (&#039;a * &#039;b -&gt; &#039;a) -&gt; &#039;b list -&gt; &#039;a&lt;/code&gt; (which is intended to be &lt;code&gt;fold_left&lt;/code&gt;), a perfectly good intuitionistic proof would have you simply throw away all but the first argument and return that.  

Something that works, though, is to use linear logic instead of intuitionistic logic.  You interpret &lt;code&gt;*&lt;/code&gt; as $latex \otimes$, and let &lt;code&gt;list&lt;/code&gt; be a constructor such that $latex A\text{ list}$ is equivalent to $latex A \oplus (A\otimes A\text{ list})$.  Now, you have to require the programmer to annotate the type with $latex !$&#039;s somehow, but under suitable hypotheses, there is only one proof of $latex A \rightarrow !(A\otimes B\rightarrow A) \rightarrow (A \text{ list})\rightarrow A$, and it corresponds under Curry-Howard to &lt;code&gt;fold_left&lt;/code&gt;, and similarly for &lt;code&gt;map&lt;/code&gt;, etc.  By the way, I&#039;m using $latex \rightarrow$ for linear implication since I&#039;m not sure how to get the actual symbol.

This currently seems impractical to me, though, for a couple of reasons, one of which is that the generated programs could easily be inefficient whereas if you have the user define coercions, they can make the functions as efficient as they like.]]></description>
		<content:encoded><![CDATA[<p>Hi Andrej,<br />
Thanks for your PL zoo and your reply!</p>
<p>What I&#8217;m doing isn&#8217;t exactly a proof search in intuitionistic propositional logic in two ways: First, the stored coercions (non-logical axioms, if you&#8217;re thinking about it as a proof search) are allowed to have polymorphic types.  Second, the interpreter doesn&#8217;t take the intuitionistic axioms for granted: for example, it won&#8217;t deduce the coercion <code>fst: ('a * 'b) -&gt; 'a</code> on its own.  The only thing it tries are applications.  (The second difference was mostly for my convenience.)  Also, it doesn&#8217;t just look for a proof in normal form, it tries to make sure that it&#8217;s unique.</p>
<p>But those are minor differences and you can indeed recast its search as a restricted intuitionistic proof search, although one which is undecidable since you have infinitely many non-logical axioms due to polymorphism.</p>
<p>I was originally thinking about having the compiler or interpreter infer an expression for a given type, and I first tried an intuitionistic proof search.  This had a problem though, since when inferring a term with type <code>'a -&gt; ('a * 'b -&gt; 'a) -&gt; 'b list -&gt; 'a</code> (which is intended to be <code>fold_left</code>), a perfectly good intuitionistic proof would have you simply throw away all but the first argument and return that.  </p>
<p>Something that works, though, is to use linear logic instead of intuitionistic logic.  You interpret <code>*</code> as <img src='http://s0.wp.com/latex.php?latex=%5Cotimes&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;otimes' title='&#92;otimes' class='latex' />, and let <code>list</code> be a constructor such that <img src='http://s0.wp.com/latex.php?latex=A%5Ctext%7B+list%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A&#92;text{ list}' title='A&#92;text{ list}' class='latex' /> is equivalent to <img src='http://s0.wp.com/latex.php?latex=A+%5Coplus+%28A%5Cotimes+A%5Ctext%7B+list%7D%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A &#92;oplus (A&#92;otimes A&#92;text{ list})' title='A &#92;oplus (A&#92;otimes A&#92;text{ list})' class='latex' />.  Now, you have to require the programmer to annotate the type with <img src='http://s0.wp.com/latex.php?latex=%21&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='!' title='!' class='latex' />&#8216;s somehow, but under suitable hypotheses, there is only one proof of <img src='http://s0.wp.com/latex.php?latex=A+%5Crightarrow+%21%28A%5Cotimes+B%5Crightarrow+A%29+%5Crightarrow+%28A+%5Ctext%7B+list%7D%29%5Crightarrow+A&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A &#92;rightarrow !(A&#92;otimes B&#92;rightarrow A) &#92;rightarrow (A &#92;text{ list})&#92;rightarrow A' title='A &#92;rightarrow !(A&#92;otimes B&#92;rightarrow A) &#92;rightarrow (A &#92;text{ list})&#92;rightarrow A' class='latex' />, and it corresponds under Curry-Howard to <code>fold_left</code>, and similarly for <code>map</code>, etc.  By the way, I&#8217;m using <img src='http://s0.wp.com/latex.php?latex=%5Crightarrow&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;rightarrow' title='&#92;rightarrow' class='latex' /> for linear implication since I&#8217;m not sure how to get the actual symbol.</p>
<p>This currently seems impractical to me, though, for a couple of reasons, one of which is that the generated programs could easily be inefficient whereas if you have the user define coercions, they can make the functions as efficient as they like.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrej Bauer</title>
		<link>http://xorshammer.com/2008/10/07/term-inference/#comment-122</link>
		<dc:creator><![CDATA[Andrej Bauer]]></dc:creator>
		<pubDate>Wed, 08 Oct 2008 07:15:27 +0000</pubDate>
		<guid isPermaLink="false">http://xorshammer.wordpress.com/?p=170#comment-122</guid>
		<description><![CDATA[Using the Curry-Howard correspondence we see that what you are doing is automated theorem proving for (intuitionistic) propositional calculus. That is, the type is a statement which you want to prove, and the term is the proof you are looking for. Proofs in intuitionistic propositional calculus have normal forms, so you can look for a normal form proof. One possible reference where you can read about this is Troelstra &amp; Scwichtenberg&#039;s &quot;Basic Proof Theory&quot; (I might have gotten the title wrong, but the authors are correct).]]></description>
		<content:encoded><![CDATA[<p>Using the Curry-Howard correspondence we see that what you are doing is automated theorem proving for (intuitionistic) propositional calculus. That is, the type is a statement which you want to prove, and the term is the proof you are looking for. Proofs in intuitionistic propositional calculus have normal forms, so you can look for a normal form proof. One possible reference where you can read about this is Troelstra &amp; Scwichtenberg&#8217;s &#8220;Basic Proof Theory&#8221; (I might have gotten the title wrong, but the authors are correct).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

