<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>Spec#</title><link>http://specsharp.codeplex.com/project/feeds/rss</link><description>Spec&amp;#35; &amp;#40;&amp;#34;speck-sharp&amp;#34;&amp;#41; is an object-oriented .NET programming language with design-by-contract features for method pre- and postconditions and object invariants and also a non-null type system.</description><item><title>New Post: Using a cloned object as if it were newly instantiated - verifier complaining about 'modifies' clause</title><link>http://specsharp.codeplex.com/discussions/441804</link><description>&lt;div style="line-height: normal;"&gt;Hello.&lt;br /&gt;
&lt;br /&gt;
As expected, it worked. Thank you very much!&lt;br /&gt;
&lt;br /&gt;
Cheers,&lt;br /&gt;
Paolo&lt;br /&gt;
&lt;/div&gt;</description><author>paolanto</author><pubDate>Wed, 01 May 2013 21:05:17 GMT</pubDate><guid isPermaLink="false">New Post: Using a cloned object as if it were newly instantiated - verifier complaining about 'modifies' clause 20130501090517P</guid></item><item><title>New Post: Using a cloned object as if it were newly instantiated - verifier complaining about 'modifies' clause</title><link>https://specsharp.codeplex.com/discussions/441804</link><description>&lt;div style="line-height: normal;"&gt;Hi,&lt;br /&gt;
&lt;br /&gt;
Your reasoning is correct. All you need to add to your Clone method is&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;ensures result.IsNew;
&lt;/code&gt;&lt;/pre&gt;

Cheers,&lt;br /&gt;
  Peter&lt;br /&gt;
&lt;/div&gt;</description><author>mueller</author><pubDate>Tue, 30 Apr 2013 04:25:58 GMT</pubDate><guid isPermaLink="false">New Post: Using a cloned object as if it were newly instantiated - verifier complaining about 'modifies' clause 20130430042558A</guid></item><item><title>New Post: Using a cloned object as if it were newly instantiated - verifier complaining about 'modifies' clause</title><link>http://specsharp.codeplex.com/discussions/441804</link><description>&lt;div style="line-height: normal;"&gt;Hello.&lt;br /&gt;
&lt;br /&gt;
I have a question, if anybody has a minute.&lt;br /&gt;
&lt;br /&gt;
The Spec# tutorial introduces at some point a Rectangle class. This class has a Clone() method.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;  public Rectangle Clone()
  {
    Rectangle res = new Rectangle();
    res.X = X;
    res.Y = Y;
    res.Dx = Dx;
    res.Dy = Dy;
    return res;
  }&lt;/code&gt;&lt;/pre&gt;

Now, I am trying to do this:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;// Somewhere in the code
    static void foo() {
        Rectangle rect = new Rectangle();
        rect.MoveToOrigin(); // no problems here
        Rectangle rect2 = rect.Clone();
        rect2.MoveToOrigin(); // the verifier complains here!
    }&lt;/code&gt;&lt;/pre&gt;

The verifier's warning is this: &lt;em&gt;method invocation may violate the modifies clause of the enclosing method&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
Now, I think this happens because the verifier doesn't know that the rectangle returned by clone is a new, fresh clone created on the spot and to which the previous rectangle doesn't hold any reference.&lt;br /&gt;
&lt;br /&gt;
My intuition is that there must be some tag/attribute/whatever that I should add to the Clone() method which basically promises this, but I don't know how and I can't find any documentation about this. The Spec# tutorial doesn't seem to mention that. I tried [Fresh], ensures Owner.None(result) and other stuff with no luck.&lt;br /&gt;
&lt;br /&gt;
Any hints?&lt;br /&gt;
&lt;br /&gt;
Thank you&lt;br /&gt;
&lt;/div&gt;</description><author>paolanto</author><pubDate>Sat, 27 Apr 2013 21:21:53 GMT</pubDate><guid isPermaLink="false">New Post: Using a cloned object as if it were newly instantiated - verifier complaining about 'modifies' clause 20130427092153P</guid></item><item><title>Source code checked in, #9ded16cfa629</title><link>http://specsharp.codeplex.com/SourceControl/changeset/changes/9ded16cfa629</link><description>Changed non-null types in ctor signatures to be checked internally to the methods, thereby avoiding the try block with the ContractMarkerException that is causing problems with PEVerify.</description><author>Rustan Leino</author><pubDate>Sat, 09 Feb 2013 00:12:05 GMT</pubDate><guid isPermaLink="false">Source code checked in, #9ded16cfa629 20130209121205A</guid></item><item><title>Created Issue: website link for z3 on the home page should be updated [10114]</title><link>http://specsharp.codeplex.com/workitem/10114</link><description>z3 has been moved to codeplex, the new uri is http&amp;#58;&amp;#47;&amp;#47;z3.codeplex.com&amp;#47;&lt;br /&gt;&lt;br /&gt;</description><author>cl1motorsports</author><pubDate>Tue, 29 Jan 2013 21:12:13 GMT</pubDate><guid isPermaLink="false">Created Issue: website link for z3 on the home page should be updated [10114] 20130129091213P</guid></item><item><title>New Post: Collection of Different types of object</title><link>http://specsharp.codeplex.com/discussions/429903</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;In Royal&amp;Loyal model, Can we collect the detail of Customer and Customer card details based on common constraint as customer name or id??&lt;/p&gt;
&lt;/div&gt;</description><author>jagadeest</author><pubDate>Thu, 17 Jan 2013 23:28:33 GMT</pubDate><guid isPermaLink="false">New Post: Collection of Different types of object 20130117112833P</guid></item><item><title>New Post: Collection of Different types of object</title><link>http://specsharp.codeplex.com/discussions/429903</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;I don't understand your question.&amp;nbsp; Can you describe it in more detail or give an example?&lt;/p&gt;
&lt;/div&gt;</description><author>rustanleino</author><pubDate>Thu, 17 Jan 2013 18:46:37 GMT</pubDate><guid isPermaLink="false">New Post: Collection of Different types of object 20130117064637P</guid></item><item><title>New Post: Collection of Different types of object</title><link>http://specsharp.codeplex.com/discussions/429903</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Is there any possibility to collect the different types of object with common constraint in spec#?&lt;/p&gt;
&lt;/div&gt;</description><author>jagadeest</author><pubDate>Thu, 17 Jan 2013 14:05:48 GMT</pubDate><guid isPermaLink="false">New Post: Collection of Different types of object 20130117020548P</guid></item><item><title>New Post: Nested use of Quantifiers</title><link>http://specsharp.codeplex.com/discussions/428625</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;/div&gt;</description><author>ankitdixit</author><pubDate>Sun, 13 Jan 2013 15:33:59 GMT</pubDate><guid isPermaLink="false">New Post: Nested use of Quantifiers 20130113033359P</guid></item><item><title>New Post: Nested use of Quantifiers</title><link>http://specsharp.codeplex.com/discussions/428625</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;After fixing the curly braces in the postcondition to&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ensures (result == true) ==&amp;gt; &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; exists{ int x in (-100:100); exists{int y in (-100:100); y==10}};&lt;/p&gt;
&lt;p&gt;the code compiles on my Spec# installation (which I built from the sources). However, it throws an exception on rise4fun. We'll try to investigate why.&lt;/p&gt;
&lt;p&gt;Both postconditions do not verify, which is due to the weak support for existential quantifiers.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Peter&lt;/p&gt;
&lt;/div&gt;</description><author>mueller</author><pubDate>Sun, 13 Jan 2013 15:26:55 GMT</pubDate><guid isPermaLink="false">New Post: Nested use of Quantifiers 20130113032655P</guid></item><item><title>New Post: Nested use of Quantifiers</title><link>http://specsharp.codeplex.com/discussions/428625</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Does Spec# support nested use of quantifications.&lt;/p&gt;
&lt;p&gt;If it does, can anyone please correct the example given below so that it gets compiled&lt;/p&gt;
&lt;p&gt;(The postcondition i want to verify is given commented, but i cannot even get the uncommented one to compile)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;&lt;span style="color:blue"&gt;public&lt;/span&gt; &lt;span style="color:blue"&gt;class&lt;/span&gt; C
{
&lt;span style="color:blue"&gt;int&lt;/span&gt; p11x,p11y,p12x,p12y,p21x,p21y,p22x,p22y;
&lt;span style="color:blue"&gt;public&lt;/span&gt; C(&lt;span style="color:blue"&gt;int&lt;/span&gt; p1,&lt;span style="color:blue"&gt;int&lt;/span&gt; p2,&lt;span style="color:blue"&gt;int&lt;/span&gt; p3,&lt;span style="color:blue"&gt;int&lt;/span&gt; p4,&lt;span style="color:blue"&gt;int&lt;/span&gt; p5,&lt;span style="color:blue"&gt;int&lt;/span&gt; p6,&lt;span style="color:blue"&gt;int&lt;/span&gt; p7,&lt;span style="color:blue"&gt;int&lt;/span&gt; p8)
{
    p11x=p1;
    p11y=p2;
    p12x=p3;
    p12y=p4;
    p21x=p5;
    p21y=p6;
    p22x=p7;
    p22y=p8;

    
 }
&lt;span style="color:blue"&gt;bool&lt;/span&gt; intersect()
ensures (result == &lt;span style="color:blue"&gt;true&lt;/span&gt;) ==&amp;gt; exists{ &lt;span style="color:blue"&gt;int&lt;/span&gt; x &lt;span style="color:blue"&gt;in&lt;/span&gt; (-100:100);{exists{&lt;span style="color:blue"&gt;int&lt;/span&gt; y &lt;span style="color:blue"&gt;in&lt;/span&gt; (-100:100); y==10};
&lt;span style="color:green"&gt;//ensures (result == true) ==&amp;gt; exists{ int x in (-100:100);{exists{int y in (-100:100);{(y-p11y)*(p12x-p11x) -(p12y-p11y)*(x-p11x)==0 &amp;&amp; (p11x &amp;lt;= x) &amp;&amp; (x &amp;lt;= p12x) }}};&lt;/span&gt;
{
	&lt;span style="color:blue"&gt;int&lt;/span&gt; test1, test2;
	test1 = (( (p12x - p11x) * (p21y -p11y ))- ((p21x - p11x) * (p12y - p11y))) * (( (p12x - p11x) * (p22y -p11y ))- ((p22x - p11x) * (p12y - p11y)));
	test2 = (( (p22x - p21x) * (p11y -p21y ))- ((p11x - p21x) * (p22y - p21y))) * (( (p22x - p21x) * (p12y -p21y ))- ((p12x - p21x) * (p22y - p21y)));
	&lt;span style="color:blue"&gt;bool&lt;/span&gt; result =(test1 &amp;lt;= 0) &amp;&amp; (test2 &amp;lt;= 0);
  &lt;span style="color:blue"&gt;return&lt;/span&gt; result;
}
}
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;</description><author>AnkitDixit</author><pubDate>Sun, 06 Jan 2013 01:17:09 GMT</pubDate><guid isPermaLink="false">New Post: Nested use of Quantifiers 20130106011709A</guid></item><item><title>New Post: Problem while trying to use the quantifiers in pre-post condition</title><link>http://specsharp.codeplex.com/discussions/428216</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;I am not talking about any specific example, but in general. The post-condition and example i have is pretty complex,so I am not posting it here, I tried, in all the examples provided on the page, this assertion seems to fail for all of them. It would nice
 of you even if you could give me any workaround,such that I could write my conditions in a different way and make them work(I tried negating, and using forall quantifier but that doesnot works ).&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;p&gt;class Example&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp; int x;&lt;br&gt;
&amp;nbsp; void Inc(int y)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; ensures exists{int i in (-10:10); i==0};&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;{&amp;nbsp; &amp;nbsp; x += y;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;/div&gt;</description><author>ankitdixit</author><pubDate>Fri, 04 Jan 2013 10:58:09 GMT</pubDate><guid isPermaLink="false">New Post: Problem while trying to use the quantifiers in pre-post condition 20130104105809A</guid></item><item><title>New Post: Problem while trying to use the quantifiers in pre-post condition</title><link>http://specsharp.codeplex.com/discussions/428216</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Unfortunately, SMT solvers such as Z3, which is the prover behind Spec#, have weak support for existential quantifiers. It is sometimes possible to provide intermediate assertions that help Z3 find a witness for the quantified variable, but I have no suggestion
 how to fix your example. If this is part of a bigger example, you could post the entire method; maybe we can come up with a fix then.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;br&gt;
&amp;nbsp;&amp;nbsp; Peter&lt;/p&gt;
&lt;/div&gt;</description><author>mueller</author><pubDate>Wed, 02 Jan 2013 22:18:22 GMT</pubDate><guid isPermaLink="false">New Post: Problem while trying to use the quantifiers in pre-post condition 20130102101822P</guid></item><item><title>New Post: Problem while trying to use the quantifiers in pre-post condition</title><link>http://specsharp.codeplex.com/discussions/428216</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;When I try to write a simple program postcondition, which should be trivially true,I get &amp;nbsp;unsatisfied postcondition &amp;nbsp;as output.&lt;/p&gt;
&lt;p&gt;Here is my postcondition:&lt;/p&gt;
&lt;p&gt;there exists an integer i in range (-10:10), such that i==0,i.e.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ensures exists{int i in (-10:10); i==0};&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;according to me this postcondition should be trivially true for all examples, but thats not the case.&lt;/p&gt;
&lt;p&gt;Please help me&lt;/p&gt;
&lt;p&gt;Thanks, in advance&lt;/p&gt;
&lt;/div&gt;</description><author>AnkitDixit</author><pubDate>Wed, 02 Jan 2013 03:42:58 GMT</pubDate><guid isPermaLink="false">New Post: Problem while trying to use the quantifiers in pre-post condition 20130102034258A</guid></item><item><title>New Post: Spec# is what C# 1.0 should have been</title><link>http://specsharp.codeplex.com/discussions/425734</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Are there anyone who feels the same way? Spec# seems like it's thought out and executed much better than C# 4.0.&lt;/p&gt;
&lt;p&gt;If C# was Spec# with all the fluff taken out from C# 4.0, i.e. non generics, etc, extensions everthing, reference to be non-nullable&amp;nbsp;by default, Maybe type, etc, and frozen in time, it would have been perfect.&lt;/p&gt;
&lt;p&gt;Even great features of Spec# is plagued by these flaws, no? For example the non-nullable references in the language, there are still null checks done behind the scenes for these, right?&lt;/p&gt;
&lt;p&gt;I remember watching a video where Anders was saying that they made a mistake by not making references non-nullable by default and that they could have achieved much better performance and code clarity. It seems like there is no way around this to have true&amp;nbsp;non-nullable
 references in any .NET language due to CLR.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Anyway just thought I would get your thoughts on the subject.&lt;/p&gt;
&lt;/div&gt;</description><author>JoanVenge</author><pubDate>Wed, 26 Dec 2012 22:48:48 GMT</pubDate><guid isPermaLink="false">New Post: Spec# is what C# 1.0 should have been 20121226104848P</guid></item><item><title>New Post: Array Permutation</title><link>http://specsharp.codeplex.com/discussions/404247</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;I think your postcondition does not verify since the second count-comprehension should range over (0:a.Length) rather than (0:i). This is probably a copy-and-paste error. The fixed condition does verify on my system. Isn't it great to have a verifier? :-)&lt;/p&gt;
&lt;p&gt;I am sorry about the bug you ran into. We will look into this and see whether we can fix it.&lt;/p&gt;
&lt;p&gt;Cheers,&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Peter&lt;/p&gt;
&lt;/div&gt;</description><author>mueller</author><pubDate>Tue, 27 Nov 2012 15:07:04 GMT</pubDate><guid isPermaLink="false">New Post: Array Permutation 20121127030704P</guid></item><item><title>New Post: Array Permutation</title><link>http://specsharp.codeplex.com/discussions/404247</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;Your workaround permits to get rid of the error.&lt;/p&gt;
&lt;p&gt;But I still have problems proving that the following holds after a simple swap:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;pre&gt;  ensures forall{int k in (0:a.Length); count{int v in (0:a.Length); a[v] == b[k]} == count{int u in (0:i); b[u] == b[k]}};&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So I try to prove it in the case where there is no swap by using the dummy function:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;pre&gt;  [Pure]
  static bool Lemma(int[]! a, int[]! b)
  requires a.Length == b.Length;
  requires forall{int i in (0:a.Length); a[i] == b[i]};
//  ensures forall{int k in (0:a.Length); count{int v in (0:a.Length); a[v] == b[k]} == count{int u in (0:i); b[u] == b[k]}};
  {
    return true;
  }&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But Spec# throws a quite &amp;quot;deep&amp;quot; error that starts with&lt;/p&gt;
&lt;p&gt;&amp;quot;Error&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; Internal Compiler Error: System.NullReferenceException: Object reference not set to an instance of an object.&lt;br&gt;
&amp;nbsp;&amp;nbsp; at System.Compiler.Normalizer.VisitBinaryExpression(BinaryExpression binaryExpression) in c:\codeplex_current_build\specsharp\SpecSharp\System.Compiler.Framework\Compiler\Normalizer.cs:line 752&amp;quot;&lt;/p&gt;
&lt;p&gt;You can find the complete listing of the error &lt;a title="full error description" href="http://pastebin.com/E3cKfTRp"&gt;
here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for your help!&lt;/p&gt;
&lt;/div&gt;</description><author>othrez</author><pubDate>Mon, 26 Nov 2012 09:55:35 GMT</pubDate><guid isPermaLink="false">New Post: Array Permutation 20121126095535A</guid></item><item><title>New Post: Array Permutation</title><link>http://specsharp.codeplex.com/discussions/404247</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You get the error because Spec# does not permit quantified variables within old-expressions. So the &amp;quot;old(a[u])&amp;quot; is what it complains about. Maybe as a workaround,you could pass two copies of the array (which you can express in a precondition) and modify
 only one of them. You can view the second array as a ghost parameter, which you use for specifications, but which is not needed to execute the program:&lt;/p&gt;
&lt;pre&gt;static void simpleSwap(int[]! a, int[]! b, int i, int j)&lt;br&gt;  requires a != b &amp;&amp; a.Length == b.Length;&lt;br&gt;  requires forall{int i in (0:a.Length); a[i] == b[i]};&lt;br&gt;  modifies a;  // but not b&lt;br&gt;&lt;br&gt;Then you can replace &amp;quot;old(a[u])&amp;quot; by &amp;quot;b[u]&amp;quot;.&lt;br&gt;&lt;br&gt;Cheers,&lt;br&gt;   Peter&lt;/pre&gt;
&lt;/div&gt;</description><author>mueller</author><pubDate>Fri, 23 Nov 2012 21:15:28 GMT</pubDate><guid isPermaLink="false">New Post: Array Permutation 20121123091528P</guid></item><item><title>Source code checked in, #a025f4e6cb71</title><link>http://specsharp.codeplex.com/SourceControl/changeset/changes/a025f4e6cb71</link><description>SpecSharp build succeeded</description><author>CodeplexBot</author><pubDate>Fri, 23 Nov 2012 06:03:09 GMT</pubDate><guid isPermaLink="false">Source code checked in, #a025f4e6cb71 20121123060309A</guid></item><item><title>New Post: Array Permutation</title><link>http://specsharp.codeplex.com/discussions/404247</link><description>&lt;div style="line-height: normal;"&gt;
&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;My question is related to sorting algorithms, and how to fully specify them using SpecSharp (see
&lt;a title="QuickSort Discussion" href="http://specsharp.codeplex.com/discussions/254253" target="_blank"&gt;
QuickSort&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;For instance I would like to be able to specify that the content of the array before and after calling the sorting function is the same.&lt;/p&gt;
&lt;p&gt;I guess one way to do it is to use the following post-condition, giving that 'a' is the array being sorted:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="color:black; background-color:white"&gt;
&lt;pre&gt;  ensures forall{&lt;span style="color:blue"&gt;int&lt;/span&gt; k &lt;span style="color:blue"&gt;in&lt;/span&gt; (0:i); count{&lt;span style="color:blue"&gt;int&lt;/span&gt; v &lt;span style="color:blue"&gt;in&lt;/span&gt; (0:i); a[v] == a[k]} == count{&lt;span style="color:blue"&gt;int&lt;/span&gt; u &lt;span style="color:blue"&gt;in&lt;/span&gt; (0:i); old(a[u]) == a[k]}};
&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The problem is that SpecSharp throws then the following error:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;C:\Windows\system32\unknown file(1,1): error CS2663: internal error: 7 name resolution errors detected
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Which apparently is not well documented in this forum.&lt;/p&gt;
&lt;p&gt;Here is the full source code:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;pre&gt;using System;
using Microsoft.Contracts;

public class Program
{
  static void Main(string![]! args) {
    Console.WriteLine(&amp;quot;Spec# says hello!&amp;quot;);
  }

  static void simpleSwap(int[]! a, int i, int j)
  requires 0 &amp;lt;= i &amp;&amp; i &amp;lt; a.Length;
  requires 0 &amp;lt;= j &amp;&amp; j &amp;lt; a.Length;
  modifies a[i], a[j];
  ensures a[i] == old(a[i]);
  ensures a[j] == old(a[j]);
  ensures forall{int k in (0:i); count{int v in (0:i); a[v] == a[k]} == count{int u in (0:i); old(a[u]) == a[k]}};
  {
    int swapDude;
	swapDude = a[i];
	a[i] = a[j];
	a[i] = swapDude;
  }

}
&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;/div&gt;</description><author>othrez</author><pubDate>Thu, 22 Nov 2012 15:42:58 GMT</pubDate><guid isPermaLink="false">New Post: Array Permutation 20121122034258P</guid></item></channel></rss>