<?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 for Verifiable Software</title>
	<atom:link href="http://softwareverificaton.wordpress.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://softwareverificaton.wordpress.com</link>
	<description></description>
	<lastBuildDate>Mon, 08 Apr 2013 16:24:01 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>Comment on Mutable structures: Arrays by helmutbrandl</title>
		<link>http://softwareverificaton.wordpress.com/2013/02/04/mutable-structures-arrays/#comment-327</link>
		<dc:creator><![CDATA[helmutbrandl]]></dc:creator>
		<pubDate>Mon, 08 Apr 2013 16:24:01 +0000</pubDate>
		<guid isPermaLink="false">http://softwareverificaton.wordpress.com/?p=211#comment-327</guid>
		<description><![CDATA[Hi Jesper,

the definition of your function foo is recursive and the execution of this
function in a naive way recursively is highly imperformant. This statement is
true for the verifier and for any runtime execution as well.

Let me make some general comments first and then adress the performance of your
specific function foo.

1. Needed calculations and compile/verfication time

In my experience actual calculations are rarely necessary during
verification. The question whether a function f returns a specific value when
fed with a constant is usually not necessary. Why do you want the verifier to
answer the question &quot;Is 4! = 24 true?&quot;? You usually ask the verifier if your
specific implementation of the factorial function returns the same result as
the mathematical definition. But in some cases actual calculations are
necessary. Since the verifier will do calculations (if needed) in an
interpretative manner, the performance of this needed calculations will be
slower than the calculations done by software compiled to native code.

2. Recursive and iterative evaluation of a function

Your function foo is highly imperformant if executed recursively. Its like the
fibonacci function. When you do recursive evalutation you get bad performance
and when you do iterative evaluation you get excellent results. Therefore my
language allows to give a definition/specification of a function and an
implementation of a function.

In the case of your function foo I would use the recursive definition as the
specification and provide an iterative implementation.

&lt;pre&gt;&lt;code&gt;
foo(i:NATURAL): FLOAT
    do
        if i&lt;3 then
            Result := i/3.33
        else
            local
                a,b,c:FLOAT
                j: NATURAL
            do
                from
                    j     := 2
                    a,b,c := 0/3.33, 1/3.33, 2/3.33
                invariant
                    2 &lt;= j &lt;= i
                    a = foo(j-2)
                    b = foo(j-1)
                    c = foo(j)
                variant
                    i - j
                until
                    i = j
                loop
                    j,a,b,c := 
                        j+1, 
                        b, 
                        c, 
                        a*0.33+b*0.51+c*0.71
                end
                Result := c
            end
        end
    ensure
        Result = if i&lt;3
                 then i/3.33 
                 else foo(i-1)*0.33
                      +foo(i-2)*0.51
                      +foo(i-3)*0.71
                 end
    end
&lt;/code&gt;&lt;/pre&gt;

For all values of i with i&gt;=3 a loop is used to calculate foo(i). The
important thing for the verifier is the invariant of the loop. At all
iterations the invariant is maintained i.e. it is valid before and after the
body of the loop. Note that the function foo can be used within the assertions
of the implementation because it has a definition/specification (as shown in
the postcondition) which is independent of the implementation of the function.

With this code the execution of the funciton foo will be excellent. This
applies to interpretation and compilation to native code as well. The
calculation of foo(50) requires just 48 iterations with a trivial loop body.]]></description>
		<content:encoded><![CDATA[<p>Hi Jesper,</p>
<p>the definition of your function foo is recursive and the execution of this<br />
function in a naive way recursively is highly imperformant. This statement is<br />
true for the verifier and for any runtime execution as well.</p>
<p>Let me make some general comments first and then adress the performance of your<br />
specific function foo.</p>
<p>1. Needed calculations and compile/verfication time</p>
<p>In my experience actual calculations are rarely necessary during<br />
verification. The question whether a function f returns a specific value when<br />
fed with a constant is usually not necessary. Why do you want the verifier to<br />
answer the question &#8220;Is 4! = 24 true?&#8221;? You usually ask the verifier if your<br />
specific implementation of the factorial function returns the same result as<br />
the mathematical definition. But in some cases actual calculations are<br />
necessary. Since the verifier will do calculations (if needed) in an<br />
interpretative manner, the performance of this needed calculations will be<br />
slower than the calculations done by software compiled to native code.</p>
<p>2. Recursive and iterative evaluation of a function</p>
<p>Your function foo is highly imperformant if executed recursively. Its like the<br />
fibonacci function. When you do recursive evalutation you get bad performance<br />
and when you do iterative evaluation you get excellent results. Therefore my<br />
language allows to give a definition/specification of a function and an<br />
implementation of a function.</p>
<p>In the case of your function foo I would use the recursive definition as the<br />
specification and provide an iterative implementation.</p>
<pre><code>
foo(i:NATURAL): FLOAT
    do
        if i&lt;3 then
            Result := i/3.33
        else
            local
                a,b,c:FLOAT
                j: NATURAL
            do
                from
                    j     := 2
                    a,b,c := 0/3.33, 1/3.33, 2/3.33
                invariant
                    2 &lt;= j &lt;= i
                    a = foo(j-2)
                    b = foo(j-1)
                    c = foo(j)
                variant
                    i - j
                until
                    i = j
                loop
                    j,a,b,c := 
                        j+1, 
                        b, 
                        c, 
                        a*0.33+b*0.51+c*0.71
                end
                Result := c
            end
        end
    ensure
        Result = if i&lt;3
                 then i/3.33 
                 else foo(i-1)*0.33
                      +foo(i-2)*0.51
                      +foo(i-3)*0.71
                 end
    end
</code></pre>
<p>For all values of i with i&gt;=3 a loop is used to calculate foo(i). The<br />
important thing for the verifier is the invariant of the loop. At all<br />
iterations the invariant is maintained i.e. it is valid before and after the<br />
body of the loop. Note that the function foo can be used within the assertions<br />
of the implementation because it has a definition/specification (as shown in<br />
the postcondition) which is independent of the implementation of the function.</p>
<p>With this code the execution of the funciton foo will be excellent. This<br />
applies to interpretation and compilation to native code as well. The<br />
calculation of foo(50) requires just 48 iterations with a trivial loop body.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Mutable structures: Arrays by Jesper Nordenberg</title>
		<link>http://softwareverificaton.wordpress.com/2013/02/04/mutable-structures-arrays/#comment-326</link>
		<dc:creator><![CDATA[Jesper Nordenberg]]></dc:creator>
		<pubDate>Mon, 08 Apr 2013 09:13:46 +0000</pubDate>
		<guid isPermaLink="false">http://softwareverificaton.wordpress.com/?p=211#comment-326</guid>
		<description><![CDATA[Oh, it&#039;s nice that you only have to write the spec+impl once. That surely saves a lot of work. I agree that you need to cover all error cases, either statically or at runtime, but my concern is the performance of the verifier. The foo function is extremely slow to execute for larger i&#039;s unless it&#039;s memoized. It&#039;s also not easy to check if i == foo(x).to_natural without executing foo(x) since it contains recursive floating point calculations. So, how is the performance of your verifier with the specification of foo that you gave? Will it complete the verification of foo(50) ==  in reasonable time?]]></description>
		<content:encoded><![CDATA[<p>Oh, it&#8217;s nice that you only have to write the spec+impl once. That surely saves a lot of work. I agree that you need to cover all error cases, either statically or at runtime, but my concern is the performance of the verifier. The foo function is extremely slow to execute for larger i&#8217;s unless it&#8217;s memoized. It&#8217;s also not easy to check if i == foo(x).to_natural without executing foo(x) since it contains recursive floating point calculations. So, how is the performance of your verifier with the specification of foo that you gave? Will it complete the verification of foo(50) ==  in reasonable time?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Mutable structures: Arrays by helmutbrandl</title>
		<link>http://softwareverificaton.wordpress.com/2013/02/04/mutable-structures-arrays/#comment-325</link>
		<dc:creator><![CDATA[helmutbrandl]]></dc:creator>
		<pubDate>Sun, 07 Apr 2013 17:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://softwareverificaton.wordpress.com/?p=211#comment-325</guid>
		<description><![CDATA[1. Specification and implementation:

For many functions (including your function foo) the specification and implementation is practically identical. Look at the function times_two
&lt;pre&gt;&lt;code&gt;
times_two(i:NATURAL): NATURAL
   ensure Result = 2*i end
&lt;/code&gt;&lt;/pre&gt;
Each time you can express that result of a function as a closed expression (i.e. in the form Result = ...) you have a valid specification. As long as the right hand side of &#039;Result=...&#039; is computable (i.e. contains no ghost functions) the specification is sufficient in my programming language. The compiler derives the implementation automatically. The compiler treats the above definition of &#039;times_two&#039; as if it had been written
&lt;pre&gt;&lt;code&gt;
times_two(i:NATURAL): NATURAL
    do
        Result := 2*i
    ensure
        Result = 2*i
    end
&lt;/code&gt;&lt;/pre&gt;
But it is not necessary to write implementation and specification if the specification has the form &#039;Result=...&#039;.

Let&#039;s look at your function foo. In my programming language it is sufficient to write
&lt;pre&gt;&lt;code&gt;
foo(i:NATURAL): FLOAT
    ensure
        Result = if i&lt;3
                 then i/3.33 
                 else foo(i-1)*0.33
                      +foo(i-2)*0.51
                      +foo(i-3)*0.71
                 end
    end
&lt;/code&gt;&lt;/pre&gt;
As you can see there is practically no difference between my programming language and languages like C#, java, etc. in the complexity of writing such a function.

2. Runtime exceptions and static verification:

Let&#039;s assume you use your function foo to do some indexing operations on an array a like &#039;v := a[foo(i).to_natural]&#039;. In java and C# each array access at runtime includes an out of bound check. In case that the expression &#039;foo(i).to_natural&#039; is out of the array bounds you get a runtime exception. What are you going to do if you get such a runtime exception? You certainly will analyze what values can become attached to the variable i and you certainly have to analyze the possible return values of the function &#039;foo&#039;.

Static verification requires you to do this analysis upfront. You have to convince the verifier that the expression &#039;foo(i).to_natural&#039; never yields an index out of the bounds of the array &#039;a&#039;.

Therefore you gain nothing by not doing any static analysis unless you are willing to accept that your program might have errors which have not yet popped up with the tests you have done up to now.

3. Skills:

It is undeniable that programming with static analysis requires some skills which many programmers do not yet have. Static analysis can be done successfully only if one is capable of writing assertions and capable of reasoning with assertions. But these skills are nothing magic. They can be learned like any other technique (e.g. using a debugger etc.).]]></description>
		<content:encoded><![CDATA[<p>1. Specification and implementation:</p>
<p>For many functions (including your function foo) the specification and implementation is practically identical. Look at the function times_two</p>
<pre><code>
times_two(i:NATURAL): NATURAL
   ensure Result = 2*i end
</code></pre>
<p>Each time you can express that result of a function as a closed expression (i.e. in the form Result = &#8230;) you have a valid specification. As long as the right hand side of &#8216;Result=&#8230;&#8217; is computable (i.e. contains no ghost functions) the specification is sufficient in my programming language. The compiler derives the implementation automatically. The compiler treats the above definition of &#8216;times_two&#8217; as if it had been written</p>
<pre><code>
times_two(i:NATURAL): NATURAL
    do
        Result := 2*i
    ensure
        Result = 2*i
    end
</code></pre>
<p>But it is not necessary to write implementation and specification if the specification has the form &#8216;Result=&#8230;&#8217;.</p>
<p>Let&#8217;s look at your function foo. In my programming language it is sufficient to write</p>
<pre><code>
foo(i:NATURAL): FLOAT
    ensure
        Result = if i&lt;3
                 then i/3.33 
                 else foo(i-1)*0.33
                      +foo(i-2)*0.51
                      +foo(i-3)*0.71
                 end
    end
</code></pre>
<p>As you can see there is practically no difference between my programming language and languages like C#, java, etc. in the complexity of writing such a function.</p>
<p>2. Runtime exceptions and static verification:</p>
<p>Let&#8217;s assume you use your function foo to do some indexing operations on an array a like &#8216;v := a[foo(i).to_natural]&#8216;. In java and C# each array access at runtime includes an out of bound check. In case that the expression &#8216;foo(i).to_natural&#8217; is out of the array bounds you get a runtime exception. What are you going to do if you get such a runtime exception? You certainly will analyze what values can become attached to the variable i and you certainly have to analyze the possible return values of the function &#8216;foo&#8217;.</p>
<p>Static verification requires you to do this analysis upfront. You have to convince the verifier that the expression &#8216;foo(i).to_natural&#8217; never yields an index out of the bounds of the array &#8216;a&#8217;.</p>
<p>Therefore you gain nothing by not doing any static analysis unless you are willing to accept that your program might have errors which have not yet popped up with the tests you have done up to now.</p>
<p>3. Skills:</p>
<p>It is undeniable that programming with static analysis requires some skills which many programmers do not yet have. Static analysis can be done successfully only if one is capable of writing assertions and capable of reasoning with assertions. But these skills are nothing magic. They can be learned like any other technique (e.g. using a debugger etc.).</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Mutable structures: Arrays by Jesper Nordenberg</title>
		<link>http://softwareverificaton.wordpress.com/2013/02/04/mutable-structures-arrays/#comment-324</link>
		<dc:creator><![CDATA[Jesper Nordenberg]]></dc:creator>
		<pubDate>Sat, 06 Apr 2013 10:22:46 +0000</pubDate>
		<guid isPermaLink="false">http://softwareverificaton.wordpress.com/?p=211#comment-324</guid>
		<description><![CDATA[Well, you compare your language to languages like C++, Java and C#. In these languages I don&#039;t have to write specifications for my functions, I just write the implementation and type, and I get runtime array index checks. This shows the downside of static verification, it sometimes places an unnecessary burden on the programmer. The specification for the timesTwo is as you write trivial to come up with, but I can&#039;t write the specification for foo (can you?), still I can write a valid implementation.]]></description>
		<content:encoded><![CDATA[<p>Well, you compare your language to languages like C++, Java and C#. In these languages I don&#8217;t have to write specifications for my functions, I just write the implementation and type, and I get runtime array index checks. This shows the downside of static verification, it sometimes places an unnecessary burden on the programmer. The specification for the timesTwo is as you write trivial to come up with, but I can&#8217;t write the specification for foo (can you?), still I can write a valid implementation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Mutable structures: Arrays by helmutbrandl</title>
		<link>http://softwareverificaton.wordpress.com/2013/02/04/mutable-structures-arrays/#comment-323</link>
		<dc:creator><![CDATA[helmutbrandl]]></dc:creator>
		<pubDate>Sat, 06 Apr 2013 01:24:27 +0000</pubDate>
		<guid isPermaLink="false">http://softwareverificaton.wordpress.com/?p=211#comment-323</guid>
		<description><![CDATA[1. Function specification: 

All functions need a specification. The type NATURAL-&gt;NATURAL is not a specification it is just a type. A specification of times_two can look like 

times_two(i:NATURAL): NATURAL     ensure Result = 2*i end 

Don&#039;t confuse the specification with an implementation (in this trivial case the specification is nearly identical with the implementation). 

The compiler/verifier &quot;knows&quot; the specification and can therefore derive &#039;2=times_two(1)&#039;. 

2. Undecidable problems: 

Clearly the verifier cannot resolve problems which are in its general case undecidable. If you state any assertion and expect the verifier to tell you that the assertion is true or false I have to disappoint you. This is impossible! 

3. Your function foo: 

You designed some function foo. Then you want an answer to the question if there is some i in (1..100) such that foo(i).to_natural = 844 is valid. In order to answer this question I would have to analyze your function definition in detail. Since you have designed this function, you are better suited to analyze it. I can offer you the following: If you can convince yourself that &#039;some(i) i in (1..100) and foo(i).to_natural=844&#039; is valid, write down your arguments and post them here. Then I can show you how to convince that verifier about this fact. If you are not able to convince yourself about this fact don&#039;t expect that you can convince the verifier.]]></description>
		<content:encoded><![CDATA[<p>1. Function specification: </p>
<p>All functions need a specification. The type NATURAL-&gt;NATURAL is not a specification it is just a type. A specification of times_two can look like </p>
<p>times_two(i:NATURAL): NATURAL     ensure Result = 2*i end </p>
<p>Don&#8217;t confuse the specification with an implementation (in this trivial case the specification is nearly identical with the implementation). </p>
<p>The compiler/verifier &#8220;knows&#8221; the specification and can therefore derive &#8217;2=times_two(1)&#8217;. </p>
<p>2. Undecidable problems: </p>
<p>Clearly the verifier cannot resolve problems which are in its general case undecidable. If you state any assertion and expect the verifier to tell you that the assertion is true or false I have to disappoint you. This is impossible! </p>
<p>3. Your function foo: </p>
<p>You designed some function foo. Then you want an answer to the question if there is some i in (1..100) such that foo(i).to_natural = 844 is valid. In order to answer this question I would have to analyze your function definition in detail. Since you have designed this function, you are better suited to analyze it. I can offer you the following: If you can convince yourself that &#8216;some(i) i in (1..100) and foo(i).to_natural=844&#8242; is valid, write down your arguments and post them here. Then I can show you how to convince that verifier about this fact. If you are not able to convince yourself about this fact don&#8217;t expect that you can convince the verifier.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Mutable structures: Arrays by Jesper Nordenberg</title>
		<link>http://softwareverificaton.wordpress.com/2013/02/04/mutable-structures-arrays/#comment-322</link>
		<dc:creator><![CDATA[Jesper Nordenberg]]></dc:creator>
		<pubDate>Fri, 05 Apr 2013 22:04:20 +0000</pubDate>
		<guid isPermaLink="false">http://softwareverificaton.wordpress.com/?p=211#comment-322</guid>
		<description><![CDATA[But the whole point is that you dont know &quot;2=times_two(i)&quot;, all you know is timesTwo : NATURAL -&gt; NATURAL.

I just gave you the implementation of foo, you&#039;re free to derive any assertions you can from it. Can the verifier check if the arrary read is valid or not in reasonable time?]]></description>
		<content:encoded><![CDATA[<p>But the whole point is that you dont know &#8220;2=times_two(i)&#8221;, all you know is timesTwo : NATURAL -&gt; NATURAL.</p>
<p>I just gave you the implementation of foo, you&#8217;re free to derive any assertions you can from it. Can the verifier check if the arrary read is valid or not in reasonable time?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Mutable structures: Arrays by helmutbrandl</title>
		<link>http://softwareverificaton.wordpress.com/2013/02/04/mutable-structures-arrays/#comment-321</link>
		<dc:creator><![CDATA[helmutbrandl]]></dc:creator>
		<pubDate>Fri, 05 Apr 2013 15:40:23 +0000</pubDate>
		<guid isPermaLink="false">http://softwareverificaton.wordpress.com/?p=211#comment-321</guid>
		<description><![CDATA[First example:
The loop has the postcondition &#039;all(i) i in (1..10) =&gt; times_two(i) in a.domain and a[times_two(i)]=i&#039;. With this we can do the reasoning &#039;1 in (1..10)&#039; which implies &#039;time_two(1) in a.domain&#039; which together with &#039;2=times_two(1)&#039; implies &#039;2 in a.domain&#039;.

Second example:
The loop has the postcondition &#039;all(i) i in (1..100) =&gt; foo(i) in a.domain and a[foo(i).to_natural]=i&#039;. In order to proof that &#039;844 in a.domain&#039; we need to proof &#039;some(i) i in (1..10) and foo(i).to_natural = 844&#039;. In order to proof this it is necesary to derive some assertions about the function foo.]]></description>
		<content:encoded><![CDATA[<p>First example:<br />
The loop has the postcondition &#8216;all(i) i in (1..10) =&gt; times_two(i) in a.domain and a[times_two(i)]=i&#8217;. With this we can do the reasoning &#8217;1 in (1..10)&#8217; which implies &#8216;time_two(1) in a.domain&#8217; which together with &#8217;2=times_two(1)&#8217; implies &#8217;2 in a.domain&#8217;.</p>
<p>Second example:<br />
The loop has the postcondition &#8216;all(i) i in (1..100) =&gt; foo(i) in a.domain and a[foo(i).to_natural]=i&#8217;. In order to proof that &#8217;844 in a.domain&#8217; we need to proof &#8216;some(i) i in (1..10) and foo(i).to_natural = 844&#8242;. In order to proof this it is necesary to derive some assertions about the function foo.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Mutable structures: Arrays by Jesper Nordenberg</title>
		<link>http://softwareverificaton.wordpress.com/2013/02/04/mutable-structures-arrays/#comment-320</link>
		<dc:creator><![CDATA[Jesper Nordenberg]]></dc:creator>
		<pubDate>Fri, 05 Apr 2013 14:32:08 +0000</pubDate>
		<guid isPermaLink="false">http://softwareverificaton.wordpress.com/?p=211#comment-320</guid>
		<description><![CDATA[I mis-wrote, I meant:

timesTwo : NATURAL -&gt; NATURAL

for (i in 1..10) {
  a[timesTwo(i)] := i
}

b = a[2] // Illegal?

Here&#039;s an example of a costly indexing operation:

foo(i : Int) : Double = if (i &lt; 3) i / 3.33 else foo(i - 1) * 0.33 + foo(i - 2) * 0.51 + foo(i - 3) * 0.71

for (i in 1..100) {
  a[foo(i).toInt] := i
}

b = a[844] // Illegal?]]></description>
		<content:encoded><![CDATA[<p>I mis-wrote, I meant:</p>
<p>timesTwo : NATURAL -&gt; NATURAL</p>
<p>for (i in 1..10) {<br />
  a[timesTwo(i)] := i<br />
}</p>
<p>b = a[2] // Illegal?</p>
<p>Here&#8217;s an example of a costly indexing operation:</p>
<p>foo(i : Int) : Double = if (i &lt; 3) i / 3.33 else foo(i &#8211; 1) * 0.33 + foo(i &#8211; 2) * 0.51 + foo(i &#8211; 3) * 0.71</p>
<p>for (i in 1..100) {<br />
  a[foo(i).toInt] := i<br />
}</p>
<p>b = a[844] // Illegal?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Mutable structures: Arrays by helmutbrandl</title>
		<link>http://softwareverificaton.wordpress.com/2013/02/04/mutable-structures-arrays/#comment-319</link>
		<dc:creator><![CDATA[helmutbrandl]]></dc:creator>
		<pubDate>Fri, 05 Apr 2013 13:59:23 +0000</pubDate>
		<guid isPermaLink="false">http://softwareverificaton.wordpress.com/?p=211#comment-319</guid>
		<description><![CDATA[I am not sure whether I understand your question.

Assertions are verified during compile time by the proof engine. This checking is done by reasoning and not by calculation. Therefore it does not matter if an operation is costly or not.

The operation &#039;b:=a[2]&#039; is legal if compiler can verify that &#039;2 in a.domain&#039; is valid. This is not difficult in your example. The loop has the postcondition &#039;all(i) i in (1..10) =&gt; i in a.domain and a[i]=times_two(i)&#039;. Since &#039;2 in (1..10) is valid, the verifier can derive the validity of &#039;2 in a.domain&#039;. I.e. the statement &#039;b:=a[2]&#039; is legal and accepted by the verifier.]]></description>
		<content:encoded><![CDATA[<p>I am not sure whether I understand your question.</p>
<p>Assertions are verified during compile time by the proof engine. This checking is done by reasoning and not by calculation. Therefore it does not matter if an operation is costly or not.</p>
<p>The operation &#8216;b:=a[2]&#8216; is legal if compiler can verify that &#8217;2 in a.domain&#8217; is valid. This is not difficult in your example. The loop has the postcondition &#8216;all(i) i in (1..10) =&gt; i in a.domain and a[i]=times_two(i)&#8217;. Since &#8217;2 in (1..10) is valid, the verifier can derive the validity of &#8217;2 in a.domain&#8217;. I.e. the statement &#8216;b:=a[2]&#8216; is legal and accepted by the verifier.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Mutable structures: Arrays by Jesper Nordenberg</title>
		<link>http://softwareverificaton.wordpress.com/2013/02/04/mutable-structures-arrays/#comment-318</link>
		<dc:creator><![CDATA[Jesper Nordenberg]]></dc:creator>
		<pubDate>Fri, 05 Apr 2013 07:39:12 +0000</pubDate>
		<guid isPermaLink="false">http://softwareverificaton.wordpress.com/?p=211#comment-318</guid>
		<description><![CDATA[I see. What if the computation of the indexes to write in the array is a complex function which takes a lot of time to execute (ie it&#039;s extremely costly to check if a NATURAL is a member of the index set)? Or if the indexes are calculated in some function that simply returns NATURAL&#039;s? For example:

timesTwo : NATURAL -&gt; NATURAL

for (i in 1..10)
  a[i] := timesTwo(i)

b = a[2]   // Illegal?]]></description>
		<content:encoded><![CDATA[<p>I see. What if the computation of the indexes to write in the array is a complex function which takes a lot of time to execute (ie it&#8217;s extremely costly to check if a NATURAL is a member of the index set)? Or if the indexes are calculated in some function that simply returns NATURAL&#8217;s? For example:</p>
<p>timesTwo : NATURAL -&gt; NATURAL</p>
<p>for (i in 1..10)<br />
  a[i] := timesTwo(i)</p>
<p>b = a[2]   // Illegal?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
