<?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/"
		>
<channel>
	<title>Comments on: I need a theorem prover!</title>
	<atom:link href="http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/</link>
	<description>Just another Blog.mozilla.com weblog</description>
	<lastBuildDate>Wed, 25 Jan 2012 23:29:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: tax disc holders</title>
		<link>http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/comment-page-1/#comment-32579</link>
		<dc:creator>tax disc holders</dc:creator>
		<pubDate>Wed, 24 Nov 2010 19:17:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/#comment-32579</guid>
		<description>Fantastic post! I dont think Ive seen all the angles of this subject the way youve pointed them out. Youre a true star, a rock star man. Youve got so much to say and know so much about the subject that I think you should just teach a class about it</description>
		<content:encoded><![CDATA[<p>Fantastic post! I dont think Ive seen all the angles of this subject the way youve pointed them out. Youre a true star, a rock star man. Youve got so much to say and know so much about the subject that I think you should just teach a class about it</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ALISE</title>
		<link>http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/comment-page-1/#comment-27326</link>
		<dc:creator>ALISE</dc:creator>
		<pubDate>Thu, 14 Oct 2010 05:45:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/#comment-27326</guid>
		<description>Well, the article is actually the sweetest topic on this related issue. I fit in with your conclusions and will thirstily look forward to your forthcoming updates.</description>
		<content:encoded><![CDATA[<p>Well, the article is actually the sweetest topic on this related issue. I fit in with your conclusions and will thirstily look forward to your forthcoming updates.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: seo</title>
		<link>http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/comment-page-1/#comment-27294</link>
		<dc:creator>seo</dc:creator>
		<pubDate>Wed, 13 Oct 2010 14:53:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/#comment-27294</guid>
		<description>It&#039;s an interesting approach. I commonly see unexceptional views on the subject but yours it&#039;s written in a pretty unusual fashion. Surely, I will revisit your website for additional info.</description>
		<content:encoded><![CDATA[<p>It&#8217;s an interesting approach. I commonly see unexceptional views on the subject but yours it&#8217;s written in a pretty unusual fashion. Surely, I will revisit your website for additional info.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: seo company</title>
		<link>http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/comment-page-1/#comment-23100</link>
		<dc:creator>seo company</dc:creator>
		<pubDate>Sun, 08 Aug 2010 07:37:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/#comment-23100</guid>
		<description>Where did you got this much info on your blog from?? Also can i take the initiave to take the feeds from your blog for my own website?? But cant find the RSS feeds link here!!</description>
		<content:encoded><![CDATA[<p>Where did you got this much info on your blog from?? Also can i take the initiave to take the feeds from your blog for my own website?? But cant find the RSS feeds link here!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dmandelin</title>
		<link>http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/comment-page-1/#comment-90</link>
		<dc:creator>dmandelin</dc:creator>
		<pubDate>Tue, 11 Mar 2008 23:01:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/#comment-90</guid>
		<description>Thanks! I just tried out Rich&#039;s example in G12 MiniZinc, and it worked. I can even leave off a predicate on rv and the solution will print out an assignment for rv. I guess that doesn&#039;t prove that rv must have that value, though. And I&#039;m looking at CVC3 docs right now. 

I think Taras might be interested in this stuff too; I recall he always wanted to do infeasible path elimination in Dehydra, and a solver like this would make it a lot easier.

Another good thing about having a real solver is that it easily takes care of another detail I papered over in my work on this so far. In the real Firefox code, NS_SUCCEEDED is not a function, but rather:

  #define NS_SUCCEEDED(_nsresult) (NS_LIKELY(!((_nsresult) &amp; 0x80000000)))

So the code sequence actually looks more like:

  rv1 = rv
  t1 = rv1 &lt; 0
  t2 = !t1
  t3 = __builtin_expect(t2)
  if (t3)

I just coded up the constraints directly from the C semantics (and assuming __builtin_expect is a no-op) and MiniZinc was able to solve it correctly. Pretty cool! Here&#039;s my code:

var int: rv;
var int: rv1;
var int: t1;
var int: t2;
var int: t3;

predicate succ(var int: rv) = rv &gt;= 0;
predicate fail(var int: rv) = rv = 0;

predicate true_if_not(var int: lhs, var int: rhs) =
	  lhs = 1 /\ c_false(rhs) \/ lhs = 0 /\ c_true(rhs);

constraint
	rv1 = rv /\
	true_if_ltz(t1, rv1) /\
	true_if_not(t2, t1) /\
	t3 = t2 /\
	c_false(t3) /\
	fail(rv);
	
solve satisfy;</description>
		<content:encoded><![CDATA[<p>Thanks! I just tried out Rich&#8217;s example in G12 MiniZinc, and it worked. I can even leave off a predicate on rv and the solution will print out an assignment for rv. I guess that doesn&#8217;t prove that rv must have that value, though. And I&#8217;m looking at CVC3 docs right now. </p>
<p>I think Taras might be interested in this stuff too; I recall he always wanted to do infeasible path elimination in Dehydra, and a solver like this would make it a lot easier.</p>
<p>Another good thing about having a real solver is that it easily takes care of another detail I papered over in my work on this so far. In the real Firefox code, NS_SUCCEEDED is not a function, but rather:</p>
<p>  #define NS_SUCCEEDED(_nsresult) (NS_LIKELY(!((_nsresult) &amp; 0&#215;80000000)))</p>
<p>So the code sequence actually looks more like:</p>
<p>  rv1 = rv<br />
  t1 = rv1 &lt; 0<br />
  t2 = !t1<br />
  t3 = __builtin_expect(t2)<br />
  if (t3)</p>
<p>I just coded up the constraints directly from the C semantics (and assuming __builtin_expect is a no-op) and MiniZinc was able to solve it correctly. Pretty cool! Here&#8217;s my code:</p>
<p>var int: rv;<br />
var int: rv1;<br />
var int: t1;<br />
var int: t2;<br />
var int: t3;</p>
<p>predicate succ(var int: rv) = rv &gt;= 0;<br />
predicate fail(var int: rv) = rv = 0;</p>
<p>predicate true_if_not(var int: lhs, var int: rhs) =<br />
	  lhs = 1 /\ c_false(rhs) \/ lhs = 0 /\ c_true(rhs);</p>
<p>constraint<br />
	rv1 = rv /\<br />
	true_if_ltz(t1, rv1) /\<br />
	true_if_not(t2, t1) /\<br />
	t3 = t2 /\<br />
	c_false(t3) /\<br />
	fail(rv);</p>
<p>solve satisfy;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Manu</title>
		<link>http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/comment-page-1/#comment-88</link>
		<dc:creator>Manu</dc:creator>
		<pubDate>Tue, 11 Mar 2008 14:51:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/#comment-88</guid>
		<description>I&#039;ve just been looking at some theorem proving stuff, and the hot new thing seems to be sat-modulo-theories (SMT) provers.  Three available ones are Z3, Yices, and CVC3:

http://research.microsoft.com/projects/z3/
http://yices.csl.sri.com/
http://www.cs.nyu.edu/acsys/cvc3/

CVC3 has the advantage of being open source; not sure about the license details for the others.  I haven&#039;t completely understood your example, but if I recall our nifty automated deduction class correctly, I think the prover should be able to handle your formulas mostly just using uninterpreted functions.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve just been looking at some theorem proving stuff, and the hot new thing seems to be sat-modulo-theories (SMT) provers.  Three available ones are Z3, Yices, and CVC3:</p>
<p><a href="http://research.microsoft.com/projects/z3/" rel="nofollow">http://research.microsoft.com/projects/z3/</a><br />
<a href="http://yices.csl.sri.com/" rel="nofollow">http://yices.csl.sri.com/</a><br />
<a href="http://www.cs.nyu.edu/acsys/cvc3/" rel="nofollow">http://www.cs.nyu.edu/acsys/cvc3/</a></p>
<p>CVC3 has the advantage of being open source; not sure about the license details for the others.  I haven&#8217;t completely understood your example, but if I recall our nifty automated deduction class correctly, I think the prover should be able to handle your formulas mostly just using uninterpreted functions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rich Dougherty</title>
		<link>http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/comment-page-1/#comment-87</link>
		<dc:creator>Rich Dougherty</dc:creator>
		<pubDate>Tue, 11 Mar 2008 05:35:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/#comment-87</guid>
		<description>Hi David

How about trying a constraint programming system?

I haven&#039;t done any work with them before, although I&#039;ve read a little. But I managed to hack up something fairly quickly that seems to give a solution to one of your examples. The code is in &lt;a href=&quot;http://www.g12.cs.mu.oz.au/minizinc/&quot; rel=&quot;nofollow&quot;&gt;MiniZinc&lt;/a&gt;, something I hadn&#039;t heard of before today!


var int: rv;
var int: tmp;
var int: iftemp;

predicate successful(var int: returnvalue) =
	  returnvalue = 0;

predicate ns_succeeded(var int: value, var int: check_result) =
	  (successful(value) /\ check_result = 1) \/
	  (not successful(value) /\ check_result = 0);

constraint
	tmp = rv /\
	ns_succeeded(tmp, iftemp) /\
	iftemp = 0 /\
	not successful(rv);

solve satisfy;


To run it, I downloaded the &lt;a href=&quot;http://www.g12.cs.mu.oz.au/minizinc/download.html&quot; rel=&quot;nofollow&quot;&gt;G12 MiniZinc distribution&lt;/a&gt;, then I run it with &lt;code&gt;mzn2fzn outparms.mzn &amp;&amp; flatzinc outparms.fzn&lt;/code&gt;. The output is below.


iftemp = 0;

rv = -2097152;

tmp = -2097152;


But if I change the last &lt;code&gt;&lt;b&gt;not&lt;/b&gt; successful(rv)&lt;/code&gt; to just &lt;code&gt;successful(rv)&lt;/code&gt;, then no solutions are found. This means that &lt;code&gt;rv&lt;/code&gt; must be not successful. i.e. a failure code.

In terms of automating this, you should be able to do the same work in an embeddable constraint programming library, like &lt;a href=&quot;http://www.gecode.org/&quot; rel=&quot;nofollow&quot;&gt;Gecode&lt;/a&gt;. Gecode has a &lt;a href=&quot;http://www.gecode.org/flatzinc.html&quot; rel=&quot;nofollow&quot;&gt;FlatZinc interpreter&lt;/a&gt;, so you can move from handcoded MiniZinc examples to automation step by step.

Cheers
Rich</description>
		<content:encoded><![CDATA[<p>Hi David</p>
<p>How about trying a constraint programming system?</p>
<p>I haven&#8217;t done any work with them before, although I&#8217;ve read a little. But I managed to hack up something fairly quickly that seems to give a solution to one of your examples. The code is in <a href="http://www.g12.cs.mu.oz.au/minizinc/" rel="nofollow">MiniZinc</a>, something I hadn&#8217;t heard of before today!</p>
<p>var int: rv;<br />
var int: tmp;<br />
var int: iftemp;</p>
<p>predicate successful(var int: returnvalue) =<br />
	  returnvalue = 0;</p>
<p>predicate ns_succeeded(var int: value, var int: check_result) =<br />
	  (successful(value) /\ check_result = 1) \/<br />
	  (not successful(value) /\ check_result = 0);</p>
<p>constraint<br />
	tmp = rv /\<br />
	ns_succeeded(tmp, iftemp) /\<br />
	iftemp = 0 /\<br />
	not successful(rv);</p>
<p>solve satisfy;</p>
<p>To run it, I downloaded the <a href="http://www.g12.cs.mu.oz.au/minizinc/download.html" rel="nofollow">G12 MiniZinc distribution</a>, then I run it with <code>mzn2fzn outparms.mzn &amp;&amp; flatzinc outparms.fzn</code>. The output is below.</p>
<p>iftemp = 0;</p>
<p>rv = -2097152;</p>
<p>tmp = -2097152;</p>
<p>But if I change the last <code><b>not</b> successful(rv)</code> to just <code>successful(rv)</code>, then no solutions are found. This means that <code>rv</code> must be not successful. i.e. a failure code.</p>
<p>In terms of automating this, you should be able to do the same work in an embeddable constraint programming library, like <a href="http://www.gecode.org/" rel="nofollow">Gecode</a>. Gecode has a <a href="http://www.gecode.org/flatzinc.html" rel="nofollow">FlatZinc interpreter</a>, so you can move from handcoded MiniZinc examples to automation step by step.</p>
<p>Cheers<br />
Rich</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert O'Callahan</title>
		<link>http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/comment-page-1/#comment-86</link>
		<dc:creator>Robert O'Callahan</dc:creator>
		<pubDate>Tue, 11 Mar 2008 02:19:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mozilla.com/dmandelin/2008/03/10/i-need-a-theorem-prover/#comment-86</guid>
		<description>One technique which helps with tracking values through temporaries is value numbering. Basically you introduce a new abstract value for every assignment that&#039;s not a simple copy; these abstract values represent equivalence classes which you can then use to decide simple equalities.

That isn&#039;t enough for the case analysis side of your problem, of course. Sounds fun.</description>
		<content:encoded><![CDATA[<p>One technique which helps with tracking values through temporaries is value numbering. Basically you introduce a new abstract value for every assignment that&#8217;s not a simple copy; these abstract values represent equivalence classes which you can then use to decide simple equalities.</p>
<p>That isn&#8217;t enough for the case analysis side of your problem, of course. Sounds fun.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

