10903

how to define scope of Int

I'm using Alloy 4.2 to define the scope of Int using the 'for ... but...' syntax, however it seems that it is ignoring my request. For example, given the following simple model:

sig A { y : seq A } run { some a : A | #(a.y) = 4} for 3 but 4 Int run { some a : A | #(a.y) = 4} for 4 Int, 3 A

the first run finds no instance while the second finds an instance. As far as I understand these two commands are equivalent (unless there is some hidden signature whose scope is deduced automatically).

Could someone shed light on this behavior?

Answer1:

Those two run commands would be equivalent under the assumption that the atoms used to "index" the A-atoms of the sequence y are typed by the signature Int.

Though this assumption seems legit enough, it is not the case, as the index of sequences is typed by the signature "seq/Int". Increasing the scope of Int will thus have no effect on the maximal length of the sequence.

To accomplish what you intend to do, you can assign a scope to the "sequence itself". This is done as follows :

run { some a : A | #(a.y) = 4} for 3 but 4 seq

The answer and other information about sequences can be found at this address : http://alloy.mit.edu/alloy/documentation/quickguide/seq.html

<strong>EDIT:</strong> (more readable than in comments)

Note that

1.run { some a : A | #(a.y) = 4} for 4

works, and

2.run { some a : A | #(a.y) = 4} for 3

doesn't work.

Now the interesting thing is that

3.run { some a : A | #(a.y) = 4}

works , even if the default scope is known to be 3. From those experimentation we can conclude that :

    <li>1 and 2 shows us that the fact instances are found or no, does not depend on the scope you assign to the signature Int</li> <li>3 makes me guess that the Analyzer is "smart enough" to adapt the scope of seq/Int given the predicate you are running if you do not EXPLICITLY define a global scope.</li> </ul>

Recommend

  • How to declare and init two dimensional array of strings?
  • Inserting null columns into a scipy sparse matrix in a specific order
  • How the C++0x standard defines C++ Auto multiple declarations?
  • jQuery not triggering on appended item
  • NSString writeToFile with URL encoded string
  • http response text fetching incomplete html
  • Visual VM showing strange behavior
  • Jquery - fadeIn() and fadeOut() in PNG image. Border Solid (black) in IE8…?
  • Outlook Com not registered
  • Facebook Like Button doesn't increment
  • C++ DLL Wrapper in vb.net Passing byte array of a byte array?
  • With one EDMX file use multiple connection strings that relate to multiple databases
  • Using Paypal Pro in Omnipay
  • Load Same ACF Map Twice on Same Page
  • Recreate the Oracle DUAL table
  • How to get real device model in Android?
  • Quick Question About Get and Set
  • Deduce parent class of inherited method in C++
  • How to use animated gif in Firemonkey?
  • How dotnet build chooses the output name
  • Converter from SAT to 3-SAT
  • Excel VBA How to populate a multi-dimensional (3d) array with values from multiple excel ranges?
  • Get Currently Active User in Android
  • insert radio value multiple data codeigniter in database to one row?
  • Failed to find version-tag string. File must be updated
  • Can you pass an array from javascript to asp.net mvc controller action without using a form?
  • Alamofire and Reachability.swift not working on xCode8-beta5
  • Universal Image Loader reuse images
  • Compare struct to a constant in C
  • Creating PDF from TIFF image using iText
  • Wrong labels when plotting a time series pandas dataframe with matplotlib
  • Android application: how to use the camera and grab the image bytes?
  • MonoTouch: How to download pdf incrementally as indicated in the Apple slides “Building Newsstand Ap
  • How to Cache Real-time Data?
  • QLineEdit password safety
  • swift auto completion not working in Xcode6-Beta
  • Excel - Autoshape get it's name from cell (value)
  • -fvisibility=hidden not passed by compiler for Debug builds
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Busy indicator not showing up in wpf window [duplicate]