-
Notifications
You must be signed in to change notification settings - Fork 0
/
cat-and-mouse.xml
859 lines (858 loc) · 33.8 KB
/
cat-and-mouse.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE nta PUBLIC '-//Uppaal Team//DTD Flat System 1.5//EN' 'http://www.it.uu.se/research/group/darts/uppaal/flat-1_5.dtd'>
<nta>
<declaration>/**
* "Cat and Mouse" by Kim Guldstrand Larsen and Marius Mikučionis.
* The model is about a cat chasing a mouse in a maze with a narrow passage.
* Demonstrates the features of Stratego:
* symbolic and SMC queries, TIGA synthesis and optimization using learning.
* The system consists of four processes:
* - Cat tracks the position and possible moves for the cat.
* - Mouse tracks the position and possible moves for the mouse,
* has an extra narrow passage to Cheese, that is not available to Cat.
* - CatP models the cat player moves (up, left, down, right) with delay.
* - MouseP models the mouse player moves (up, left, down, right) with delay.
* The objective of the game is for Mouse to get to Cheese location and
* avoid being cought by Cat (detected when positions are equal).
* Mouse is the player/controller with controllable movements.
* Cat is the opponent/environment with uncontrollable movements.
* The strategy synthesis and optimization queries achieve the specified
* objectives by restricting controlable actions.
*/
const int CP = 2; // delay step size for Cat
const int MP = 1; // delay step size for Mouse
broadcast chan cu, cl, cd, cr; // cat: up, left, down, right
broadcast chan mu, ml, md, mr; // mouse: up, left, down, right</declaration>
<template>
<name x="5" y="5">Cat</name>
<declaration>int s = 0;</declaration>
<location id="id0" x="34" y="-170">
<name x="24" y="-204">L1</name>
</location>
<location id="id1" x="-102" y="-170">
<name x="-112" y="-204">L0</name>
</location>
<location id="id2" x="-102" y="-34">
<name x="-136" y="-42">L4</name>
</location>
<location id="id3" x="170" y="-170">
<name x="160" y="-204">L2</name>
</location>
<location id="id4" x="306" y="-170">
<name x="297" y="-204">Cheese</name>
</location>
<location id="id5" x="306" y="-34">
<name x="297" y="-17">L6</name>
</location>
<location id="id6" x="170" y="-34">
<name x="161" y="-17">L5</name>
</location>
<location id="id7" x="170" y="102">
<name x="160" y="68">L9</name>
</location>
<location id="id8" x="34" y="102">
<name x="24" y="68">L8</name>
</location>
<location id="id9" x="-102" y="102">
<name x="-136" y="93">L7</name>
</location>
<location id="id10" x="-102" y="238">
<name x="-144" y="229">L10</name>
</location>
<location id="id11" x="34" y="238">
<name x="25" y="255">L11</name>
</location>
<location id="id12" x="170" y="238">
<name x="153" y="255">L12</name>
</location>
<location id="id13" x="306" y="238">
<name x="297" y="255">L13</name>
</location>
<init ref="id1"/>
<transition id="id14" controllable="false">
<source ref="id6"/>
<target ref="id3"/>
<label kind="synchronisation" x="187" y="-119">cu?</label>
<label kind="assignment" x="187" y="-102">s=2</label>
<nail x="187" y="-68"/>
<nail x="187" y="-136"/>
</transition>
<transition id="id15" controllable="false">
<source ref="id5"/>
<target ref="id6"/>
<label kind="synchronisation" x="205" y="-34">cl?</label>
<label kind="assignment" x="238" y="-34">s=5</label>
<nail x="280" y="-17"/>
<nail x="195" y="-17"/>
</transition>
<transition id="id16" controllable="false">
<source ref="id12"/>
<target ref="id13"/>
<label kind="synchronisation" x="204" y="238">cr?</label>
<label kind="assignment" x="238" y="238">s=13</label>
<nail x="204" y="255"/>
<nail x="272" y="255"/>
</transition>
<transition id="id17" controllable="false">
<source ref="id3"/>
<target ref="id0"/>
<label kind="synchronisation" x="68" y="-170">cl?</label>
<label kind="assignment" x="102" y="-170">s=1</label>
<nail x="136" y="-153"/>
<nail x="68" y="-153"/>
</transition>
<transition id="id18" controllable="false">
<source ref="id0"/>
<target ref="id1"/>
<label kind="synchronisation" x="-68" y="-170">cl?</label>
<label kind="assignment" x="-34" y="-170">s=0</label>
<nail x="0" y="-153"/>
<nail x="-68" y="-153"/>
</transition>
<transition id="id19" controllable="false">
<source ref="id1"/>
<target ref="id2"/>
<label kind="synchronisation" x="-85" y="-119">cd?</label>
<label kind="assignment" x="-85" y="-102">s=4</label>
<nail x="-85" y="-136"/>
<nail x="-85" y="-68"/>
</transition>
<transition id="id20" controllable="false">
<source ref="id2"/>
<target ref="id9"/>
<label kind="synchronisation" x="-85" y="17">cd?</label>
<label kind="assignment" x="-85" y="34">s=7</label>
<nail x="-85" y="0"/>
<nail x="-85" y="68"/>
</transition>
<transition id="id21" controllable="false">
<source ref="id9"/>
<target ref="id10"/>
<label kind="synchronisation" x="-85" y="153">cd?</label>
<label kind="assignment" x="-85" y="170">s=10</label>
<nail x="-85" y="136"/>
<nail x="-85" y="204"/>
</transition>
<transition id="id22" controllable="false">
<source ref="id10"/>
<target ref="id11"/>
<label kind="synchronisation" x="-68" y="221">cr?</label>
<label kind="assignment" x="-34" y="221">s=11</label>
</transition>
<transition id="id23" controllable="false">
<source ref="id8"/>
<target ref="id11"/>
<label kind="synchronisation" x="51" y="153">cd?</label>
<label kind="assignment" x="51" y="170">s=11</label>
<nail x="51" y="136"/>
<nail x="51" y="204"/>
</transition>
<transition id="id24" controllable="false">
<source ref="id8"/>
<target ref="id9"/>
<label kind="synchronisation" x="-68" y="102">cl?</label>
<label kind="assignment" x="-34" y="102">s=7</label>
<nail x="0" y="119"/>
<nail x="-76" y="119"/>
</transition>
<transition id="id25" controllable="false">
<source ref="id0"/>
<target ref="id3"/>
<label kind="synchronisation" x="68" y="-187">cr?</label>
<label kind="assignment" x="102" y="-187">s=2</label>
</transition>
<transition id="id26" controllable="false">
<source ref="id1"/>
<target ref="id0"/>
<label kind="synchronisation" x="-68" y="-187">cr?</label>
<label kind="assignment" x="-34" y="-187">s=1</label>
</transition>
<transition id="id27" controllable="false">
<source ref="id2"/>
<target ref="id1"/>
<label kind="synchronisation" x="-136" y="-119">cu?</label>
<label kind="assignment" x="-136" y="-102">s=0</label>
</transition>
<transition id="id28" controllable="false">
<source ref="id9"/>
<target ref="id2"/>
<label kind="synchronisation" x="-136" y="17">cu?</label>
<label kind="assignment" x="-136" y="34">s=4</label>
</transition>
<transition id="id29" controllable="false">
<source ref="id11"/>
<target ref="id8"/>
<label kind="synchronisation" x="0" y="153">cu?</label>
<label kind="assignment" x="0" y="170">s=8</label>
</transition>
<transition id="id30" controllable="false">
<source ref="id12"/>
<target ref="id7"/>
<label kind="synchronisation" x="170" y="153">cu?</label>
<label kind="assignment" x="170" y="170">s=9</label>
</transition>
<transition id="id31" controllable="false">
<source ref="id3"/>
<target ref="id6"/>
<label kind="synchronisation" x="144" y="-119">cd?</label>
<label kind="assignment" x="144" y="-102">s=5</label>
</transition>
<transition id="id32" controllable="false">
<source ref="id4"/>
<target ref="id3"/>
<label kind="synchronisation" x="204" y="-187">cl?</label>
<label kind="assignment" x="238" y="-187">s=2</label>
</transition>
<transition id="id33" controllable="false">
<source ref="id5"/>
<target ref="id4"/>
<label kind="synchronisation" x="306" y="-119">cu?</label>
<label kind="assignment" x="306" y="-102">s=3</label>
</transition>
<transition id="id34" controllable="false">
<source ref="id6"/>
<target ref="id5"/>
<label kind="synchronisation" x="204" y="-51">cr?</label>
<label kind="assignment" x="238" y="-51">s=6</label>
</transition>
<transition id="id35" controllable="false">
<source ref="id7"/>
<target ref="id8"/>
<label kind="synchronisation" x="68" y="85">cl?</label>
<label kind="assignment" x="102" y="85">s=8</label>
</transition>
<transition id="id36" controllable="false">
<source ref="id9"/>
<target ref="id8"/>
<label kind="synchronisation" x="-68" y="85">cr?</label>
<label kind="assignment" x="-34" y="85">s=8</label>
</transition>
<transition id="id37" controllable="false">
<source ref="id10"/>
<target ref="id9"/>
<label kind="synchronisation" x="-136" y="153">cu?</label>
<label kind="assignment" x="-136" y="170">s=7</label>
</transition>
<transition id="id38" controllable="false">
<source ref="id11"/>
<target ref="id10"/>
<label kind="synchronisation" x="-68" y="238">cl?</label>
<label kind="assignment" x="-34" y="238">s=10</label>
<nail x="8" y="255"/>
<nail x="-76" y="255"/>
</transition>
<transition id="id39" controllable="false">
<source ref="id11"/>
<target ref="id12"/>
<label kind="synchronisation" x="68" y="221">cr?</label>
<label kind="assignment" x="102" y="221">s=12</label>
</transition>
<transition id="id40" controllable="false">
<source ref="id13"/>
<target ref="id12"/>
<label kind="synchronisation" x="204" y="221">cl?</label>
<label kind="assignment" x="238" y="221">s=12</label>
</transition>
</template>
<template>
<name x="5" y="5">Mouse</name>
<declaration>int s = 13;</declaration>
<location id="id41" x="34" y="-170">
<name x="24" y="-204">L1</name>
</location>
<location id="id42" x="-102" y="-170">
<name x="-112" y="-204">L0</name>
</location>
<location id="id43" x="-102" y="-34">
<name x="-136" y="-42">L4</name>
</location>
<location id="id44" x="170" y="-170">
<name x="160" y="-204">L2</name>
</location>
<location id="id45" x="306" y="-170">
<name x="280" y="-204">Cheese</name>
</location>
<location id="id46" x="306" y="-34">
<name x="297" y="-17">L6</name>
</location>
<location id="id47" x="170" y="-34">
<name x="136" y="-42">L5</name>
</location>
<location id="id48" x="170" y="102">
<name x="187" y="93">L9</name>
</location>
<location id="id49" x="34" y="102">
<name x="24" y="68">L8</name>
</location>
<location id="id50" x="-102" y="102">
<name x="-136" y="93">L7</name>
</location>
<location id="id51" x="-102" y="238">
<name x="-144" y="229">L10</name>
</location>
<location id="id52" x="34" y="238">
<name x="25" y="255">L11</name>
</location>
<location id="id53" x="170" y="238">
<name x="153" y="255">L12</name>
</location>
<location id="id54" x="306" y="238">
<name x="296" y="204">L13</name>
</location>
<init ref="id54"/>
<transition id="id55">
<source ref="id47"/>
<target ref="id44"/>
<label kind="synchronisation" x="187" y="-118">mu?</label>
<label kind="assignment" x="187" y="-101">s=2</label>
<nail x="187" y="-59"/>
<nail x="187" y="-144"/>
</transition>
<transition id="id56">
<source ref="id46"/>
<target ref="id47"/>
<label kind="synchronisation" x="204" y="-34">ml?</label>
<label kind="assignment" x="238" y="-34">s=5</label>
<nail x="280" y="-17"/>
<nail x="195" y="-17"/>
</transition>
<transition id="id57">
<source ref="id53"/>
<target ref="id54"/>
<label kind="synchronisation" x="204" y="238">mr?</label>
<label kind="assignment" x="238" y="238">s=13</label>
<nail x="204" y="255"/>
<nail x="272" y="255"/>
</transition>
<transition id="id58">
<source ref="id44"/>
<target ref="id41"/>
<label kind="synchronisation" x="68" y="-170">ml?</label>
<label kind="assignment" x="102" y="-170">s=1</label>
<nail x="136" y="-153"/>
<nail x="68" y="-153"/>
</transition>
<transition id="id59">
<source ref="id41"/>
<target ref="id42"/>
<label kind="synchronisation" x="-68" y="-170">ml?</label>
<label kind="assignment" x="-34" y="-170">s=0</label>
<nail x="0" y="-153"/>
<nail x="-68" y="-153"/>
</transition>
<transition id="id60">
<source ref="id42"/>
<target ref="id43"/>
<label kind="synchronisation" x="-85" y="-119">md?</label>
<label kind="assignment" x="-85" y="-102">s=4</label>
<nail x="-85" y="-136"/>
<nail x="-85" y="-68"/>
</transition>
<transition id="id61">
<source ref="id43"/>
<target ref="id50"/>
<label kind="synchronisation" x="-85" y="17">md?</label>
<label kind="assignment" x="-85" y="34">s=7</label>
<nail x="-85" y="0"/>
<nail x="-85" y="68"/>
</transition>
<transition id="id62">
<source ref="id50"/>
<target ref="id51"/>
<label kind="synchronisation" x="-85" y="153">md?</label>
<label kind="assignment" x="-85" y="170">s=10</label>
<nail x="-85" y="136"/>
<nail x="-85" y="204"/>
</transition>
<transition id="id63">
<source ref="id51"/>
<target ref="id52"/>
<label kind="synchronisation" x="-68" y="221">mr?</label>
<label kind="assignment" x="-34" y="221">s=11</label>
</transition>
<transition id="id64">
<source ref="id49"/>
<target ref="id52"/>
<label kind="synchronisation" x="51" y="153">md?</label>
<label kind="assignment" x="51" y="170">s=11</label>
<nail x="51" y="136"/>
<nail x="51" y="204"/>
</transition>
<transition id="id65">
<source ref="id47"/>
<target ref="id48"/>
<label kind="synchronisation" x="136" y="17">md?</label>
<label kind="assignment" x="136" y="34">s=9</label>
<label kind="comments" x="221" y="25">Narrow passage
only mice can use.</label>
</transition>
<transition id="id66">
<source ref="id48"/>
<target ref="id47"/>
<label kind="synchronisation" x="187" y="17">mu?</label>
<label kind="assignment" x="187" y="34">s=5</label>
<nail x="187" y="76"/>
<nail x="187" y="0"/>
</transition>
<transition id="id67">
<source ref="id49"/>
<target ref="id50"/>
<label kind="synchronisation" x="-68" y="102">ml?</label>
<label kind="assignment" x="-34" y="102">s=7</label>
<nail x="0" y="119"/>
<nail x="-76" y="119"/>
</transition>
<transition id="id68">
<source ref="id41"/>
<target ref="id44"/>
<label kind="synchronisation" x="68" y="-187">mr?</label>
<label kind="assignment" x="102" y="-187">s=2</label>
</transition>
<transition id="id69">
<source ref="id42"/>
<target ref="id41"/>
<label kind="synchronisation" x="-68" y="-187">mr?</label>
<label kind="assignment" x="-34" y="-187">s=1</label>
</transition>
<transition id="id70">
<source ref="id43"/>
<target ref="id42"/>
<label kind="synchronisation" x="-136" y="-119">mu?</label>
<label kind="assignment" x="-136" y="-102">s=0</label>
</transition>
<transition id="id71">
<source ref="id50"/>
<target ref="id43"/>
<label kind="synchronisation" x="-136" y="17">mu?</label>
<label kind="assignment" x="-136" y="34">s=4</label>
</transition>
<transition id="id72">
<source ref="id52"/>
<target ref="id49"/>
<label kind="synchronisation" x="0" y="153">mu?</label>
<label kind="assignment" x="0" y="170">s=8</label>
</transition>
<transition id="id73">
<source ref="id53"/>
<target ref="id48"/>
<label kind="synchronisation" x="170" y="153">mu?</label>
<label kind="assignment" x="170" y="170">s=9</label>
</transition>
<transition id="id74">
<source ref="id44"/>
<target ref="id47"/>
<label kind="synchronisation" x="144" y="-119">md?</label>
<label kind="assignment" x="144" y="-102">s=5</label>
</transition>
<transition id="id75">
<source ref="id45"/>
<target ref="id44"/>
<label kind="synchronisation" x="204" y="-187">ml?</label>
<label kind="assignment" x="238" y="-187">s=2</label>
</transition>
<transition id="id76">
<source ref="id46"/>
<target ref="id45"/>
<label kind="synchronisation" x="306" y="-119">mu?</label>
<label kind="assignment" x="306" y="-102">s=3</label>
</transition>
<transition id="id77">
<source ref="id47"/>
<target ref="id46"/>
<label kind="synchronisation" x="204" y="-51">mr?</label>
<label kind="assignment" x="238" y="-51">s=6</label>
</transition>
<transition id="id78">
<source ref="id48"/>
<target ref="id49"/>
<label kind="synchronisation" x="68" y="85">ml?</label>
<label kind="assignment" x="102" y="85">s=8</label>
</transition>
<transition id="id79">
<source ref="id50"/>
<target ref="id49"/>
<label kind="synchronisation" x="-68" y="85">mr?</label>
<label kind="assignment" x="-34" y="85">s=8</label>
</transition>
<transition id="id80">
<source ref="id51"/>
<target ref="id50"/>
<label kind="synchronisation" x="-136" y="153">mu?</label>
<label kind="assignment" x="-136" y="170">s=7</label>
</transition>
<transition id="id81">
<source ref="id52"/>
<target ref="id51"/>
<label kind="synchronisation" x="-68" y="238">ml?</label>
<label kind="assignment" x="-34" y="238">s=10</label>
<nail x="8" y="255"/>
<nail x="-76" y="255"/>
</transition>
<transition id="id82">
<source ref="id52"/>
<target ref="id53"/>
<label kind="synchronisation" x="68" y="221">mr?</label>
<label kind="assignment" x="102" y="221">s=12</label>
</transition>
<transition id="id83">
<source ref="id54"/>
<target ref="id53"/>
<label kind="synchronisation" x="204" y="221">ml?</label>
<label kind="assignment" x="238" y="221">s=12</label>
</transition>
</template>
<template>
<name>CatP</name>
<declaration>clock x;</declaration>
<location id="id84" x="204" y="-34">
<name x="195" y="-25">Move</name>
<urgent/>
</location>
<location id="id85" x="102" y="-34">
<name x="51" y="-51">Idle</name>
<label kind="invariant" x="51" y="-34">x<=CP</label>
</location>
<init ref="id85"/>
<transition id="id86" controllable="false">
<source ref="id85"/>
<target ref="id84"/>
<label kind="guard" x="127" y="-110">x>=CP</label>
<label kind="assignment" x="127" y="-93">x=0</label>
<nail x="102" y="-93"/>
<nail x="204" y="-93"/>
</transition>
<transition id="id87" controllable="false">
<source ref="id84"/>
<target ref="id85"/>
<label kind="synchronisation" x="144" y="-76">cu!</label>
<nail x="178" y="-59"/>
<nail x="136" y="-59"/>
</transition>
<transition id="id88" controllable="false">
<source ref="id84"/>
<target ref="id85"/>
<label kind="synchronisation" x="144" y="-59">cr!</label>
<nail x="178" y="-42"/>
<nail x="136" y="-42"/>
</transition>
<transition id="id89" controllable="false">
<source ref="id84"/>
<target ref="id85"/>
<label kind="synchronisation" x="144" y="-42">cd!</label>
<nail x="178" y="-25"/>
<nail x="136" y="-25"/>
</transition>
<transition id="id90" controllable="false">
<source ref="id84"/>
<target ref="id85"/>
<label kind="synchronisation" x="143" y="-25">cl!</label>
<nail x="178" y="-8"/>
<nail x="136" y="-8"/>
</transition>
</template>
<template>
<name>MouseP</name>
<declaration>clock x;</declaration>
<location id="id91" x="204" y="-34">
<name x="195" y="-25">Move</name>
<urgent/>
</location>
<location id="id92" x="102" y="-34">
<name x="51" y="-51">Idle</name>
<label kind="invariant" x="51" y="-34">x<=MP</label>
</location>
<init ref="id92"/>
<transition id="id93" controllable="false">
<source ref="id92"/>
<target ref="id91"/>
<label kind="guard" x="127" y="-110">x>=MP</label>
<label kind="assignment" x="127" y="-93">x=0</label>
<label kind="comments" x="51" y="-153">Delay transition
must be uncontrollable.</label>
<nail x="102" y="-93"/>
<nail x="204" y="-93"/>
</transition>
<transition id="id94">
<source ref="id91"/>
<target ref="id92"/>
<label kind="synchronisation" x="144" y="-76">mu!</label>
<nail x="178" y="-59"/>
<nail x="136" y="-59"/>
</transition>
<transition id="id95">
<source ref="id91"/>
<target ref="id92"/>
<label kind="synchronisation" x="144" y="-59">mr!</label>
<nail x="178" y="-42"/>
<nail x="136" y="-42"/>
</transition>
<transition id="id96">
<source ref="id91"/>
<target ref="id92"/>
<label kind="synchronisation" x="144" y="-42">md!</label>
<nail x="178" y="-25"/>
<nail x="136" y="-25"/>
</transition>
<transition id="id97">
<source ref="id91"/>
<target ref="id92"/>
<label kind="synchronisation" x="143" y="-25">ml!</label>
<nail x="178" y="-8"/>
<nail x="136" y="-8"/>
</transition>
</template>
<system>clock time; // used in minimization queries
system Cat, Mouse, CatP, MouseP;
</system>
<queries>
<query>
<formula/>
<comment>// GOAL: can Mouse reach Cheese?</comment>
</query>
<query>
<formula>E<> Mouse.Cheese // Can Mouse reach Cheese?</formula>
<comment>Expect YES, satisfied, Mouse can reach Cheese.
The query also loads a witness trace into Symbolic Simulator.</comment>
<option key="--diagnostic" value="0"/>
</query>
<query>
<formula>simulate [<=100; 20] { Mouse.s } // Where is Mouse most of the time?</formula>
<comment>Expect trajectory all over entire maze, locations 0 through 12.
Inspect the simulations by right-clicking the query.</comment>
</query>
<query>
<formula>simulate [<=100; 100] { Mouse.s } : 1 : Mouse.Cheese // Show trajectory of Mouse raching Cheese</formula>
<comment>Expect a trajectory through random locations eventually reaching value 3 (Cheese location).</comment>
<option key="--diagnostic" value="0"/>
</query>
<query>
<formula>Pr[<=1000](<> Mouse.Cheese) // Probability of Mouse reaching Cheese?</formula>
<comment>Expect close to 100%, i.e. given enough time Mouse will eventually reach Cheese.
Cumulative Probability Distribution (right-click on the query) shows that it takes about 147 time units on average.
The query also provides a trace for Concrete Simulator to step through.</comment>
<option key="--alpha" value="0.005"/>
<option key="--epsilon" value="0.005"/>
</query>
<query>
<formula/>
<comment/>
</query>
<query>
<formula/>
<comment>// OPTIMIZE: strategy for Mouse to reach Cheese as Fast as possible</comment>
</query>
<query>
<formula>strategy Fast = minE(time) [<=100] { Mouse.location } -> {} : <> Mouse.Cheese // Minimize expected time for Mouse reaching Cheese</formula>
<comment>Expect success.
The resulting strategy can be used in SMC and learning queries.</comment>
</query>
<query>
<formula>simulate [<=100; 20] { Mouse.s } under Fast // Where is Mouse while using Fast strategy?</formula>
<comment>Expect homing to and motion between locations 2, 3, 5, 6 around Cheese at 3.</comment>
</query>
<query>
<formula>Pr[<=100](<> Mouse.Cheese) under Fast >= Pr[<=100](<> Mouse.Cheese) // Compare probabilities of Mouse reaching Cheese with and without Fast</formula>
<comment>Expect YES, satisfied.
The comparison plot shows 0.5 before the first 5 time units (could not distinguish as Mouse is never at Cheese in both cases)
and then 1 (probability with Fast is strictly greater than without).</comment>
</query>
<query>
<formula>Pr[<=100](<> Mouse.Cheese) under Fast // Probability of Mouse reaching Cheese under Fast</formula>
<comment>Expect 100%.
Cumulative Probability Distribution shows that Mouse reaches Cheese always in exactly 5 time units.</comment>
<option key="--alpha" value="0.005"/>
<option key="--epsilon" value="0.005"/>
</query>
<query>
<formula/>
<comment/>
</query>
<query>
<formula/>
<comment>// Evaluate SAFETY</comment>
</query>
<query>
<formula>E<> Cat.Cheese // Can Cat get to Cheese?</formula>
<comment>Expect YES, satisfied, Cat can get to Cheese too.
A witness trace is loaded into Symbolic Simulator.</comment>
<option key="--diagnostic" value="0"/>
</query>
<query>
<formula>E<> Cat.s == Mouse.s // Can Cat catch Mouse?</formula>
<comment>Expect YES, satisfied.
A witness trace is loaded into Symbolic Simulator.</comment>
<option key="--diagnostic" value="0"/>
</query>
<query>
<formula>simulate [<=100; 20] { Cat.s } // Where is Cat most of the time?</formula>
<comment>Expect the location to vary all over the maze, values 0 through 12.</comment>
</query>
<query>
<formula>simulate [<=100] { 13*(Cat.s==Mouse.s), Cat.s, Mouse.s } // Cat and Mouse trajectories with their collisions</formula>
<comment>Expect trajectories of Cat and Mouse and sometimes collision marked in red reaching value 13.</comment>
</query>
<query>
<formula>simulate [<=100; 100] { 13*(Cat.s==Mouse.s), Cat.s, Mouse.s } : 1 : Cat.s==Mouse.s // Find 1 trajectory where Mouse is cought</formula>
<comment>Expect one trajectory where Cat and Mouse locations collide definately</comment>
<option key="--diagnostic" value="0"/>
</query>
<query>
<formula>Pr[<=1000](<> Cat.s == Mouse.s) // Probability of Cat catching Mouse?</formula>
<comment>Expect probability close to 100%
Cumulative Probability Distribution (right-click on the query) shows Mouse is cought in 44.3 time units on average.
A concrete trace leading to collision is loaded into Concrete Simulator.</comment>
<option key="--alpha" value="0.005"/>
<option key="--epsilon" value="0.005"/>
<option key="--diagnostic" value="0"/>
</query>
<query>
<formula/>
<comment/>
</query>
<query>
<formula/>
<comment>// Evaluate SAFETY of Fast strategy</comment>
</query>
<query>
<formula>simulate [<=100; 20] { Cat.s } under Fast // Where is Cat when Mouse uses Fast strategy?</formula>
<comment>Expect trajectories all over the maze, similarly to when Mouse is not using Fast strategy.</comment>
</query>
<query>
<formula>simulate [<=100] { 13*(Cat.s==Mouse.s), Cat.s, Mouse.s } under Fast // Show trajectories of Cat and Mouse and their collisions</formula>
<comment>Expect to see trajectories of Cat and Mouse locations and sometimes red getting to 13 when they collide.</comment>
</query>
<query>
<formula>simulate [<=100; 100] { 13*(Cat.s==Mouse.s), Cat.s, Mouse.s } : 1 : Cat.s==Mouse.s under Fast // Find how Mouse is cought under Fast</formula>
<comment>Expect Mouse to home-in to and stay around Cheese, while Cat moves randomly and eventually arrives to location equal to Mouse's.</comment>
</query>
<query>
<formula>Pr[<=1000](<> Cat.s == Mouse.s) under Fast >= Pr[<=1000](<> Cat.s == Mouse.s) // Is Fast strategy safer than no strategy?</formula>
<comment>Expect success.
The comparison plot shows 1 in the beginning -- Fast strategy is safer than no strategy in the very beginning,
but later 0 -- less safe later,
and eventually 0.5 -- the probabilities could not be distinguished.</comment>
</query>
<query>
<formula>Pr[<=1000](<> Cat.s == Mouse.s) under Fast // Probability of Cat catching Mouse using Fast strategy?</formula>
<comment>Expect close to 100%.
Cumulative Proability Distribution plot shows that it takes 135.8 time units on average
(takes longer than when Mouse is not rushing to Cheese)</comment>
<option key="--alpha" value="0.005"/>
<option key="--epsilon" value="0.005"/>
</query>
<query>
<formula/>
<comment/>
</query>
<query>
<formula/>
<comment>// SAFETY strategy for Mouse to avoid Cat</comment>
</query>
<query>
<formula>strategy Safe = control: A[] Cat.s != Mouse.s // Can Mouse avoid Cat?</formula>
<comment>Expect success.
The resulting strategy can be used in symbolic (E<>, A[] etc), SMC and learning queries.</comment>
</query>
<query>
<formula>simulate [<=100; 20] { Cat.s } under Safe // Where is Cat most of the time under Safe?</formula>
<comment>Expect trajectory all over the maze</comment>
</query>
<query>
<formula>simulate [<=100; 20] { Mouse.s } under Safe // Where is Mouse most of the time under Safe?</formula>
<comment>Expect trajectory all over the maze</comment>
</query>
<query>
<formula>simulate [<=100; 104] { 14*(Cat.s==Mouse.s), Cat.s, Mouse.s } : 1 : Cat.s==Mouse.s under Safe // Find trajectory of Cat catching Mouse using Safe strategy</formula>
<comment>Expect failure: such trajectory cannot be found.
Also the probability is estimated below 5% with 99% confidence level.</comment>
<option key="--alpha" value="0.01"/>
</query>
<query>
<formula>Pr[<=100](<> Cat.s == Mouse.s) under Safe // Probability of Cat catching Mouse using Safe?</formula>
<comment>Expect probability to be below 0.5% with 99% confidence.</comment>
<option key="--alpha" value="0.01"/>
<option key="--epsilon" value="0.005"/>
</query>
<query>
<formula>A[] Cat.s != Mouse.s under Safe // Can Mouse avoid Cat by using Safe strategy?</formula>
<comment>Expect YES, satisfied, i.e. there is absolutely no way for Cat to catch Mouse using Safe strategy.</comment>
</query>
<query>
<formula/>
<comment/>
</query>
<query>
<formula/>
<comment>// Evaluate PERFORMANCE of the Safe strategy</comment>
</query>
<query>
<formula>Pr[<=1000](<> Mouse.Cheese) under Safe >= Pr[<=1000](<> Mouse.Cheese) // Is Mouse better at reaching Cheese with or without Safe strategy?</formula>
<comment>Expect YES, the probability of Mouse reaching Cheese is greater with Safe strategy.
The Comparison plot shows 1 up to time 650 -- Safe strategy is better than no strategy,
but later it shows 0.5 -- it could not distinguish the probabilities from that point.</comment>
</query>
<query>
<formula>Pr[<=1000](<> Mouse.Cheese) under Fast >= Pr[<=1000](<> Mouse.Cheese) under Safe // Is Mouse better at reaching Cheese with Fast or Safe strategy?</formula>
<comment>Expect YES, the probability of Mouse reaching Cheese greater with Fast than Safe strategy.
The Comparison plot shows 1 up to time 470 -- Fast strategy is better than Safe strategy,
and later it shows 0.5 -- it could not distinguish the probabilities from that point.</comment>
</query>
<query>
<formula>Pr[<=1000](<> Mouse.Cheese) under Safe // Probability of Mouse reaching Cheese using Safe</formula>
<comment>Expect probability close to 100%.
Cumulative Probability Distribution shows that Mouse reaches Cheese within 124 time units on average
-- better than without strategy, but nowhere near the result of using Fast strategy (5 time units).</comment>
<option key="--alpha" value="0.005"/>
<option key="--epsilon" value="0.005"/>
</query>
<query>
<formula/>
<comment/>
</query>
<query>
<formula/>
<comment>// SAFE & OPTIMAL: get to Cheese quick without getting cought</comment>
</query>
<query>
<formula>strategy SafeFast = minE(time) [<=100] { Cat.location, Mouse.location } -> {} : <> Mouse.Cheese under Safe // Optimize Safe strategy for Mouse to reach Cheese in minimal time.</formula>
<comment>Expect success.
The resulting strategy can be used only in SMC queries.</comment>
</query>
<query>
<formula>simulate [<=100; 20] { Cat.s } under SafeFast // Where is Cat under SafeFast?</formula>
<comment>Expect the location trajectory to be all over the maze from 0 through 12.</comment>
</query>
<query>
<formula>simulate [<=100; 20] { Mouse.s } under SafeFast // Where is Mouse under SafeFast?</formula>
<comment>Expect the location trajectory to home-in to 2,3,5,6 (just like Fast), but occasionally get distracted to other places of the maze.</comment>
</query>
<query>
<formula>simulate [<=100] { Cat.s, Mouse.s } under SafeFast // Cat and Mouse trajectories under SafeFast</formula>
<comment/>
</query>
<query>
<formula>simulate [<=100; 104] { 13*(Cat.s==Mouse.s), Cat.s, Mouse.s } : 1 : Cat.s==Mouse.s under SafeFast // Find trajectory of Cat catching Mouse using SafeFast</formula>
<comment>Expect failure as such trace does ont exist, and the estimated probability is less than 5% with 99% confidence level.</comment>
<option key="--alpha" value="0.01"/>
</query>
<query>
<formula>Pr[<=1000](<> Cat.s == Mouse.s) under SafeFast // Probability of Cat catching Mouse using SafeFast</formula>
<comment>Expect probability less than 1% with 99% confidence level -- virtually impossible.</comment>
<option key="--alpha" value="0.01"/>
<option key="--epsilon" value="0.01"/>
</query>
<query>
<formula>Pr[<=100](<> Mouse.Cheese) under SafeFast >= Pr[<=100](<> Mouse.Cheese) under Fast // Which SafeFast or Fast is better for reaching Cheese?</formula>
<comment>Expect YES, satisfied.
The comparison plot shows 0.5 everywhere, meaning that it could not distinguish the probabilities,
i.e. probabilities are approximately equal for entire time duration.</comment>
</query>
<query>
<formula>Pr[<=100](<> Mouse.Cheese) under SafeFast // Probability of Mouse reaching Cheese using SafeFast</formula>
<comment>Expect probability close to 100%.
Cumulative Probability Distribution shows that it always takes 5 time units -- as good result as using Fast strategy.</comment>
<option key="--alpha" value="0.005"/>
<option key="--epsilon" value="0.005"/>
</query>
</queries>
</nta>