关键字:uppaal命令行,命令行验证 :::success 本文基于uppaal-4.1.25版本,Win10 20H2。 ::: 利用命令行来运行UPPAAL的验证过程,设置相关参数(结果返回最短、最快,搜索模式深度、广度优先等),并输出相应结果。

一、基本语法

Win10利用power shell跑UPPAAL:
首先进入\uppaal\bin-Windows目录,把要验证的.xml模型拷贝到该目录,然后按下shift+鼠标右键打开power shell(或者其他命令行),然后运行
.\verifyta.exe [OPTION]... MODEL QUERY, where MODEL is a model file and QUERY is a query file.
其中QUERY会验证写在xml文件中的所有验证语句。具体查看本文末的help文档。

二、Example

这里提供最常用的两个例子,批量运行可以使用python调用系统命令行,并且可以利用多线程来加快运行速度。文档链接:python 多线程。 :::success 注意,在命令行中,UPPAAL会对所有语句进行验证,无法指定某个语句。 :::

1. 保存xtr格式的Trace

跑一个验证并返回结果(-t),并保存xtr格式的trace(-f)。

  1. .\verifyta.exe -t 1 -f traceFileName .\xmlModelFile.xml
  2. #############################################################################
  3. -t [ --diagnostic ] arg <0|1|2> Generate diagnostic information on stderr.
  4. 0: Some trace
  5. 1: Shortest trace (disables reuse)
  6. 2: Fastest trace (disables reuse)
  7. -f [ --prefix ] arg Write symbolic traces to files 'prefix-n.xtr'
  8. rather than to stderr.
  • traceFileName是保存的反例文件,不需要加.xtr
  • 注意,必须有-t,不然不能输出结果;

    2. 保存xml格式的Trace

    跑一个验证并返回验证结果(-t),并保存xml格式的trace(-X)。 ```powershell .\verifyta.exe -t 1 -X readableTraceFileName .\xmlModelFile.xml
#

-t [ —diagnostic ] arg <0|1|2> Generate diagnostic information on stderr. 0: Some trace 1: Shortest trace (disables reuse) 2: Fastest trace (disables reuse)

-X [ —save-trace ] arg Save the symbolic trace in file ‘Propertynumber.xml’

  1. - `readableTraceFileName`是保存的反例文件,不需要加`.xml`
  2. - 注意,必须有`-t`,不然不能输出结果;
  3. - 注意,`-X``-f`好像不能同时使用;
  4. - 为了方便阅读xml,可以使用:[xml在线格式化 | 菜鸟工具](https://c.runoob.com/front-end/710)。
  5. <a name="QGvkh"></a>
  6. # 三、官方Help文档
  7. 双击打开`verifyta.exe`会告诉如何查看help
  8. ```powershell
  9. Usage: D:\uppaal64-4.1.25-5\bin-Windows\verifyta.exe [OPTION]... MODEL QUERY
  10. where MODEL is a model file and QUERY is a query file.
  11. If QUERY is missing it will be guessed.
  12. Options:
  13. -h [ --help ] produce help message
  14. General:
  15. -H [ --hashtable-size ] arg Set hash table size for bit state
  16. hashing to 2**n bits
  17. (default = 27)
  18. -n [ --extrapolation ] arg <0|1|2|3|4>
  19. Select extrapolation operator.
  20. 0: Automatic
  21. 1: No extrapolation (use with care)
  22. 2: Difference extrapolation
  23. 3: Location based extrapolation
  24. 4: Lower/upper extrapolation
  25. -t [ --diagnostic ] arg <0|1|2>
  26. Generate diagnostic information on
  27. stderr.
  28. 0: Some trace
  29. 1: Shortest trace (disables reuse)
  30. 2: Fastest trace (disables reuse)
  31. -o [ --search-order ] arg <0|1|2|3|4>
  32. Select search order. Only 0 and 1 for
  33. TIGA properties.
  34. 0: Breadth first (short-hand -b)
  35. 1: Depth first (short-hand -d)
  36. 2: Random depth first
  37. 3: Optimal first (requires -t1 or -t2)
  38. 4: Random optimal depth first
  39. (requires -t1 or -t2)
  40. --state-representation arg <0|1|2|3>
  41. Choose how discrete states should be
  42. represented. (default 1)
  43. 0: Difference Bound Matrix. Has
  44. short-hand -C
  45. 1: Compact DBM. Uses less space but
  46. more time compared to pure DBM.
  47. 2: Bit-state hashing.
  48. Under-approximates states. Has
  49. short-hand -Z.
  50. 3: Convex-hull approximation.
  51. Over-approximates states. Has
  52. short-hand -A.
  53. -S [ --statespace-consumption ] arg <0|1|2|3>
  54. Optimize space consumption (0 = none,
  55. 1 = default, 2 = aggressive, 3 =
  56. extreme)
  57. -T [ --reuse-statespace ] Reuse state space when several
  58. properties are examined.
  59. -N [ --polyhedra ] Use polyhedra verification of
  60. stopwatches over-approximation
  61. -M [ --modest ] activate Modest semantics for updates.
  62. Output:
  63. -f [ --prefix ] arg Write symbolic traces to files
  64. 'prefix-n.xtr' rather than to stderr.
  65. -W Disable warnings
  66. -y [ --post-symbolic ] Display traces symbolically
  67. (post-stable).
  68. -Y [ --pre-symbolic ] Display traces symbolically (pre- and
  69. post-stable).
  70. -q [ --nosummary ] Do not display the option summary.
  71. -x [ --save-system ] arg Save the (modified) system in XML
  72. format, in specified file.
  73. If the system has been modified, an
  74. associated query file is created.
  75. -X [ --save-trace ] arg Save the symbolic trace in file
  76. '<arg>Propertynumber.xml'
  77. -O [ --simulation-format ] arg write the filtered simulation
  78. trajectories to:
  79. std: one trajectory per line into
  80. standard output (default)
  81. csv: one trajectory per file in
  82. comma-separated-values format.
  83. Miscellaneous:
  84. -s [ --silence-progress ] Do not display the progress indicator.
  85. -u [ --summary ] Show verification summary at the end
  86. (incorrect for liveness properties).
  87. -v [ --version ] Show version number.
  88. SMC:
  89. -r [ --seed ] arg Set seed for random number generator
  90. (default is current time).
  91. -p [ --lower-delta ] arg lower (delta) probabilistic uncertainty.
  92. -P [ --upper-delta ] arg upper (delta) probabilistic uncertainty.
  93. -a [ --alpha ] arg probability of false negatives (alpha).
  94. -B [ --beta ] arg probability of false positives (beta).
  95. -E [ --epsilon ] arg probability uncertainty (epsilon).
  96. -i [ --u0 ] arg threshold u0 for comparing
  97. probabilities.
  98. -j [ --u1 ] arg threshold u1 for comparing
  99. probabilities.
  100. -w [ --histogram-bar-width ] arg width of buckets in histogram. Should
  101. not be set in conjunction with
  102. --histogram-bar-count
  103. --histogram-bar-count arg number of buckets in histogram. Should
  104. not be set in conjunction with
  105. --histogram-bar-width
  106. -c [ --parametric-comp ] arg <0|1>
  107. activate (1) or not (0) the SMC
  108. parametric comparison.
  109. -V [ --smc-coverage ] activate SMC coverage.
  110. -R [ --resolution ] arg simulation resolution (pixels).
  111. -D [ --discretization ] arg discretization step size (time) for
  112. hybrid systems.
  113. -L [ --probability-log ] arg SMC-Log file.
  114. -F [ --sampling-time ] arg outputs to a file a sampling of
  115. simulations (when simulate is used).
  116. The ordering of options is significant.
  117. Environment variables:
  118. UPPAAL_DUMP_STATE output a state satisfying the property.
  119. UPPAAL_DISABLE_SWEEPLINE disable sweepline method
  120. UPPAAL_DISABLE_OPTIMISER disable peephole optimiser
  121. UPPAAL_DISABLE_SYMMETRY disable symmetry reduction
  122. UPPAAL_COMPILE_ONLY write compiled model to stdout and stop
  123. UPPAAL_OLD_SYNTAX use UPPAAL 3.4 syntax
  124. The value of these variables does not matter. Defining them is
  125. enough to activate the feature in question.