Automata
Contains automaton class and functions to set up automata from the specifications.
Automaton
Automaton class defines an Automaton as the tuple B = (Q, Sigma, Delta, Q_init, Acc)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
Q
|
the states, |
required | |
q_init
|
the initial states, |
required | |
ap
|
the atomic propositions, |
required | |
delta
|
the transition function, |
required | |
Acc
|
The set of acceptance conditions. |
required |
Source code in src/floras/components/automata.py
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 | |
complement_negation(propositions)
Negation of all atomic propositions not listed in propositions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
propositions
|
List of all propositions. |
required |
Source code in src/floras/components/automata.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | |
get_transition(q0, propositions)
Get the transition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
q0
|
Initial state, |
required | |
propositions
|
List of propositions. |
required |
Source code in src/floras/components/automata.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | |
print_transitions()
Print the transitions.
Source code in src/floras/components/automata.py
33 34 35 36 37 38 | |
save_plot(fn)
Save the an image of the automaton as a pdf.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Name of the file to save the figure. |
required |
Source code in src/floras/components/automata.py
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 | |
construct_Acc(spot_aut, player='sys')
Constructing the Automaton attribute Acc for a single automaton
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spot_aut
|
Spot automaton. |
required | |
player
|
Player name, 'sys' or 'test'. |
'sys'
|
Returns:
| Name | Type | Description |
|---|---|---|
Acc |
Accepting states of the automaton. |
Source code in src/floras/components/automata.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
construct_automaton_attr(spot_aut)
Function that returns attributes (except accepting conditions) needed to build an Automaton object from a spot automaton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spot_aut
|
Spot automaton. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Q |
states, |
|
qinit |
initial states, |
|
tau |
transitions, |
|
AP |
atomic propositions. |
Source code in src/floras/components/automata.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
construct_product_Acc(spot_aut_sys, spot_aut_test)
Return the accepting state dictionary for the synchronous product of the system and tester acceptances.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spot_aut_sys
|
Spot system automaton |
required | |
spot_aut_test
|
Spot test automaton |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Acc |
Dictionary of accepting states for 'sys' and 'test' |
Source code in src/floras/components/automata.py
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 | |
count_automaton_states(spot_aut)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spot_aut
|
Spot automaton |
required |
Returns:
| Name | Type | Description |
|---|---|---|
nstates |
Number of states in the automaton |
Source code in src/floras/components/automata.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
get_APs(spot_aut)
Return a list of spot atomic propositions in a Spot Buchi automaton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spot_aut
|
Spot automaton. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
AP |
Atomic propositions used in automaton. |
Source code in src/floras/components/automata.py
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 | |
get_acc_states(spot_aut)
Return a list of accepting states in the spot_automaton by parsing the body of the automaton In the prefix of the hoa_string, the succeeding portion of Acc refers to the number of accepting conditions in the automaton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spot_aut
|
Spot automaton |
required |
Returns:
| Name | Type | Description |
|---|---|---|
acc_states |
Accepting states of the automaton. |
Source code in src/floras/components/automata.py
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 | |
get_automaton(formula_str, playername)
Get automaton from LTL formula.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
formula_str
|
LTL formula. |
required | |
playername
|
Whether the automaton is for the system ('sys') |
required |
Source code in src/floras/components/automata.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |
get_formula_dict(spot_aut)
Get formula dict from a list of spot atomic propositions. Formula dict is necessary for interpreting the atomic propositions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spot_aut
|
Spot automaton |
required |
Returns:
| Name | Type | Description |
|---|---|---|
formula_dict |
Dictionary used in the automaton. |
Source code in src/floras/components/automata.py
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | |
get_hoa_body(spot_aut)
Parse the body of a hoa string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spot_aut
|
Spot automaton |
required |
Returns:
| Name | Type | Description |
|---|---|---|
hoa_body |
Body of hoa string between the --BODY-- and --END-- lines |
Source code in src/floras/components/automata.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |
get_initial_state(spot_aut)
Find the initial state.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spot_aut
|
Spot automaton |
required |
Returns:
| Name | Type | Description |
|---|---|---|
init_state |
Initial state of the automaton. |
Source code in src/floras/components/automata.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | |
get_prod_automaton(system_formula_str, tester_formula_str)
Construct the specification product automaton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system_formula_str
|
LTL formula of system objective. |
required | |
tester_formula_str
|
LTL formula of test objective. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
aut_prod |
Specification product automaton. |
Source code in src/floras/components/automata.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
get_product_automaton(spot_aut_sys, spot_aut_test)
Get the specification product automaton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spot_aut_sys
|
Spot object of system automaton. |
required | |
spot_aut_test
|
Spot object of tester automaton. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
aut_prod |
Specification product automaton. |
Source code in src/floras/components/automata.py
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
get_product_states(spec_prod)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spec_prod
|
Specification product automaton. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
product_states |
list of pairs of states |
|
|
(product_states[num_prod_state] = pair_prod_state) |
||
product_states_dict |
dictionary of product state |
|
|
pairs mapping to a state number |
||
|
(product_states_dict[pair_prod_state] = num_prod_state) |
Source code in src/floras/components/automata.py
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | |
get_system_automaton(formula_str)
Get system automaton from LTL formula.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
formula_str
|
LTL formula. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
aut_sys |
System automaton. |
|
spot_aut_sys |
Spot system automaton. |
Source code in src/floras/components/automata.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |
get_tester_automaton(formula_str)
Get tester automaton from LTL formula.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
formula_str
|
LTL formula. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
aut_test |
Tester automaton. |
|
spot_aut_test |
Spot tester automaton. |
Source code in src/floras/components/automata.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
get_transitions(spot_aut)
Get the transitions from the automaton.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
spot_aut
|
Spot automaton |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tau |
Transitions in the automaton |
Source code in src/floras/components/automata.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | |
parse_cnf_str(cnf_str, formula_dict)
Unpacking a string cnf formula into a list of conjunctive formulas, and then parsing each of those conjunctive formulas separately.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cnf_str
|
CNF formula |
required | |
formula_dict
|
Dictionary used in the automaton |
required |
Returns:
| Name | Type | Description |
|---|---|---|
formula |
Parsed formula |
Source code in src/floras/components/automata.py
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 | |
parse_conjunction_str(conj_str, formula_dict)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conj_str
|
String of cunjunctive formulas |
required | |
formula_dict
|
Formulas used in automaton |
required |
Returns:
| Name | Type | Description |
|---|---|---|
formula |
Formula in Spot form |
Source code in src/floras/components/automata.py
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | |
parse_hoa_transition_str(line)
Function separating the hoa line into the cnf_portion, the incoming state, and any information on the accepting condition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line
|
Line with transition formula, |
required |
Returns:
| Name | Type | Description |
|---|---|---|
cnf_str |
CNF formula, |
|
qin_st |
Incoming state string, |
|
transition_acc_conditions |
List of accepting conditions (if any) |
Source code in src/floras/components/automata.py
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 | |
read_state(state)
Converting string state to an interger
Source code in src/floras/components/automata.py
309 310 311 312 313 | |