3

Using Alloy 4.2, the following Alloy model...

sig E {}
sig G {}
sig D extends G {
  x: E
}
sig F1 extends G {
  x: G
}
sig F2 extends G {
  x: G
}
sig F3 extends G {
  x: G
}
sig F4 extends G {
  x: G
}
run {} for 3

... executes with the following output:

Executing "Run run$1 for 3"
   Solver=sat4j Bitwidth=0 MaxSeq=0 SkolemDepth=1 Symmetry=20
   486 vars. 66 primary vars. 748 clauses. 158ms.
   Instance found. Predicate is consistent. 36ms.

If you just rename signature D to H (truly a single-char change), the number of variables and clauses of the underlying SAT problem changes:

Executing "Run run$1 for 3"
   Solver=sat4j Bitwidth=0 MaxSeq=0 SkolemDepth=1 Symmetry=20
   494 vars. 66 primary vars. 762 clauses. 23ms.
   Instance found. Predicate is consistent. 28ms.

Why? When does this behavior appear? Is there a way to name signatures to be sure to get the smallest possible number of variables and clauses?

More details:

I'm convinced this has to do with the alphabetical order of the names of the signatures. If you choose any name lower than E, you get 486 variables, and with any name higher than H you get 494 variables.

During my search for a minimal example (starting from my rather large model), I've witnessed some situations where choosing three different names yields three different numbers of variables. I've lost these examples in the process but I remember the alphabetical order was involved.

This may look like nothing for small sizes, but if you run {} for 12 instead of 3, the numbers of variables become 17415 and 19439 so the difference is more than 10%. I've witnessed large-ish differences for my actual model as well (with more signatures, but not really a bigger scope).

Thanks,

Loïc Gammaitoni
  • 4,173
  • 16
  • 39
jacquev6
  • 620
  • 4
  • 18

0 Answers0