<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="/rss.xsl"?><rss version="2.0"><channel><title>specsharp Discussions Rss Feed</title><link>http://specsharp.codeplex.com/Thread/List.aspx</link><description>specsharp Discussions Rss Description</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>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>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><item><title>New Post: Object invariant - a simple subset relationship</title><link>http://specsharp.codeplex.com/discussions/397400</link><description>&lt;div style="line-height: normal;"&gt;&lt;p&gt;Sounds like a nice exercise.&amp;nbsp; Are you hoping to (statically) verify properties about the program, or is your focus the writing of the specifications (and perhaps getting run-time checks)?&lt;/p&gt;
&lt;p&gt;If it's the latter, then Spec# is probably fine.&amp;nbsp; The ownership of the tiles will require some care.&amp;nbsp; I don't remember, but I think Spec# does this better (or&amp;nbsp;only?) for single-dimensional arrays.&amp;nbsp; If it is possible for you to represent the tiles as integers, you'll avoid both the == vs. .Equals issue as well as ownership issues.&lt;/p&gt;
&lt;p&gt;If it's the former (that is, you want to verify the program statically), then Dafny will be a much better choice.&amp;nbsp; You can also compile and execute Dafny programs, but there are no UI libraries, for example.&amp;nbsp; (I'd be delighted if someone would write such libraries for Dafny, even simple ones.)&lt;/p&gt;
&lt;p&gt;&amp;nbsp; Rustan&lt;/p&gt;&lt;/div&gt;</description><author>rustanleino</author><pubDate>Wed, 17 Oct 2012 21:59:07 GMT</pubDate><guid isPermaLink="false">New Post: Object invariant - a simple subset relationship 20121017095907P</guid></item><item><title>New Post: Object invariant - a simple subset relationship</title><link>http://specsharp.codeplex.com/discussions/397400</link><description>&lt;div style="line-height: normal;"&gt;Hi Rustan,&lt;br&gt;
&lt;br&gt;
Thanks for your thoughts. I was thinking about having a class that&lt;br&gt;
represents the state of a scrabble game. Thinking about it in Z&lt;br&gt;
terminology, there is a set of tiles in a bag (or even a bag of tiles&lt;br&gt;
in a bag), two size-7 sets on two racks and a partial function from&lt;br&gt;
{0..WIDTH-1} x {0..WIDTH-1} to tile, commonly called a 2D array. Tiles&lt;br&gt;
could be characters but perhaps should be tagged to keep tiles unique&lt;br&gt;
eg the 1st A, 2nd A etc. An important decision but one yet to be made.&lt;br&gt;
I'm keeping it open because maybe Spec# would be better with&lt;br&gt;
primitives, though counting the A's would be a bit tricky.&lt;br&gt;
&lt;br&gt;
I don't know whether this is an appropriate use of Spec# but you could&lt;br&gt;
have an object invariant that says every tile must have been in the&lt;br&gt;
bag originally and every tile that was in the bag has not &amp;quot;fallen&lt;br&gt;
under the table&amp;quot; ie it's still in the bag, on a rack or on the board.&lt;br&gt;
Except for the board, I certainly want sets (but I think they were&lt;br&gt;
introduced to C# later than 2.0 and I can't use later libraries).&lt;br&gt;
However, even if I can't have sets, I want to model sets as 1D arrays&lt;br&gt;
and be able to test for subset inclusion. I thought I would write a&lt;br&gt;
method to check for this, so I could then use it in the object&lt;br&gt;
invariant. That's why you see the method I've shown you.&lt;br&gt;
&lt;br&gt;
I'm not really experienced enough with Spec# to know what I can expect&lt;br&gt;
it to do for me but maybe you can tell me how this sounds. Also, on a&lt;br&gt;
minor, more easily correctable point, I don't know if I should be&lt;br&gt;
using == or Equals, but I had no luck with == either; I'm sure I have&lt;br&gt;
bigger problems that just that though.&lt;br&gt;
&lt;br&gt;
Ian&lt;/div&gt;</description><author>Ergotron</author><pubDate>Tue, 16 Oct 2012 15:24:47 GMT</pubDate><guid isPermaLink="false">New Post: Object invariant - a simple subset relationship 20121016032447P</guid></item><item><title>New Post: Difficulty running Spec# at all</title><link>http://specsharp.codeplex.com/discussions/396673</link><description>&lt;div style="line-height: normal;"&gt;HI,&lt;br&gt;
&lt;br&gt;
Thanks. We'll try that, and look for the possible error message I&lt;br&gt;
might get from the link that Rustan posted.&lt;br&gt;
&lt;br&gt;
Ian&lt;br&gt;
&lt;br&gt;
On 12 October 2012 09:22, wuestholz &amp;lt;notifications@codeplex.com&amp;gt; wrote:&lt;br&gt;
&amp;gt; From: wuestholz&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Hi Ian,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; that's very strange since I've been using it on Windows 7 for quite some&lt;br&gt;
&amp;gt; time without any problems. Could you maybe try to run Spec# from the command&lt;br&gt;
&amp;gt; line to see if it's Visual Studio that causes the problem?&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Best regards,&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Valentin&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Read the full discussion online.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; To add a post to this discussion, reply to this email&lt;br&gt;
&amp;gt; ([email removed])&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; To start a new discussion for this project, email&lt;br&gt;
&amp;gt; [email removed]&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; You are receiving this email because you subscribed to this discussion on&lt;br&gt;
&amp;gt; CodePlex. You can unsubscribe on CodePlex.com.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Please note: Images and attachments will be removed from emails. Any posts&lt;br&gt;
&amp;gt; to this discussion will also be available online at CodePlex.com&lt;/div&gt;</description><author>Ergotron</author><pubDate>Tue, 16 Oct 2012 15:24:07 GMT</pubDate><guid isPermaLink="false">New Post: Difficulty running Spec# at all 20121016032407P</guid></item></channel></rss>